html, body {
  background: #0b0f14 !important;
}

:root{
  --bg: #0b0f14;
  --panel: #111824;
  --panel2: #0f1622;
  --text: #e7eefc;
  --muted: #9fb0cc;
  --line: #223047;
  --accent: #5aa7ff;
  --accent2: #7c5cff;
  --danger: #ff5a7a;
  --ok: #28d17c;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r: 14px;
}

*{
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: linear-gradient(180deg,#070a10,#0b0f14);
  color: var(--text);
}

body.share-view .app {
  grid-template-columns: 1fr;
  max-width: 1000px;
  margin: 0 auto;
}

body.share-view .app > section:first-child,
body.share-view .app > section:last-child {
  display: none;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid rgba(34,48,71,.7);
  background: rgba(15,22,34,.65);
  border-top-left-radius: var(--r);
  border-top-right-radius: var(--r);
  border-bottom-left-radius: var(--r);
  border-bottom-right-radius: var(--r);
}

.spacer {
  height: 85px;
}

.app {
  display: grid;
  grid-template-columns: 320px 1fr 420px;
  min-height: calc(100dvh - 85px);
  gap: 12px;
  padding: 12px;
}

.card {
  --card-bg: rgba(17,24,36,.96);
  background: var(--card-bg);
  border-radius: var(--r);
  border: 1px solid rgba(34,48,71,.8);
  box-shadow: var(--shadow);
}

.card-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background: transparent;
}

.card-sticky > header,
.card-sticky > .panel-fixed {
  background: var(--card-bg);
  border-top-left-radius: var(--r);
  border-top-right-radius: var(--r);
  border-bottom-left-radius: var(--r);
  border-bottom-right-radius: var(--r);
  backdrop-filter: blur(5px);
}

.panel-fixed {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid rgba(34,48,71,.7);
  border-bottom-left-radius: var(--r);
  border-bottom-right-radius: var(--r);
}

.panel-scroll {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 12px;
  border-bottom-left-radius: var(--r);
  border-bottom-right-radius: var(--r);
}

.panel-scroll-tree {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 12px;
  border-bottom-left-radius: var(--r);
  border-bottom-right-radius: var(--r);
}

.title {
  font-weight: 700;
  letter-spacing: .2px;
}

.muted {
  color: var(--muted);
}

.wrap {
  min-height: 80dvh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(34,48,71,.9);
  background: rgba(17,24,36,.7);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: .15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  border-color: rgba(90,167,255,.9);
}

.btn.primary {
  background: linear-gradient(135deg, rgba(90,167,255,.35), rgba(124,92,255,.28));
  border-color: rgba(90,167,255,.3);
}

.btn.primary:hover {
  border-color: rgba(90,167,255,.9);
}

.btn.secondary {
  background: rgba(90,167,255,.12);
  border-color: rgba(90,167,255,.3);
}

.btn.secondary:hover {
  border-color: rgba(90,167,255,.9);
}

.btn.danger {
  border-color: rgba(255,90,122,.55);
  background: rgba(255,90,122,.12);
}

.btn.danger:hover {
  border-color: rgba(255,90,122,.9);
}

.btn.ok {
  border-color: rgba(40,209,124,.55);
  background: rgba(40,209,124,.10);
}

.btn.ok:hover {
  border-color: rgba(40,209,124,.9);
}

button.btn:disabled,
button.btn[disabled] {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  filter: grayscale(1);
}

select {
  padding: 8px 10px;
  border: 1px solid rgba(34,48,71,.9);
  border-radius: 12px;
  background: rgba(17,24,36,.7);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
}

select:hover {
  border-color: rgba(90,167,255,.9);
}

select:disabled,
select[disabled] {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  filter: grayscale(1);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.listShare .rowShare {
  display: grid;
  grid-template-columns: 28px 1fr 110px 90px 170px;
  align-items: center;
  gap: 12px;
  padding: 5px 0px 8px;
  font-size: 14px;
  border-bottom: 1px solid rgba(34,48,71,.7);
  cursor: pointer;
  user-select: none;
  transition: background .12s ease;
}

.listShare .rowShare:hover {
  background: rgba(90,167,255,.08);
}

.rowShareHeader {
  display: grid;
  grid-template-columns: 28px 1fr 110px 90px 170px;
  align-items: center;
  gap: 12px;
  padding: 10px 0px 12px;
  font-size: 14px;
  border-bottom: 1px solid rgba(34,48,71,.7);
  cursor: pointer;
  user-select: none;
  transition: background .12s ease;
  color: var(--muted);
  font-weight: 600;
}

.rowShareHeader:hover {
  background: rgba(90,167,255,.08);
}

.rowShareBack {
  display: grid;
  grid-template-columns: 28px 1fr 110px 90px 170px;
  align-items: center;
  gap: 12px;
  padding: 10px 0px 12px;
  font-size: 14px;
  border-bottom: 1px solid rgba(34,48,71,.7);
  cursor: pointer;
  user-select: none;
  transition: background .12s ease;
}

.rowShareBack:hover {
  background: rgba(90,167,255,.08);
}

.itemLabel {
  user-select: none;
}

.pad {
  padding: 12px;
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.sep {
  height: 1px;
  background: rgba(34,48,71,.7);
  margin: 6px 0;
}

a {
  color: var(--text);
  text-decoration: none;
}

a:hover {
  color: rgba(90,167,255,.9);
  text-decoration: none;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(34,48,71,.9);
  border-radius: 6px;
  background: rgba(17,24,36,.7);
  cursor: pointer;
  appearance: none;
}

input[type="checkbox"]:hover {
  border-color: rgba(90,167,255,.9);
}

input[type="checkbox"]:checked {
  background: rgba(34,48,71,.9);
  border-color: rgba(90,167,255,.9);
}

input[type="checkbox"]:checked::after {
  content: "✓";
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(34,48,71,.9);
  background: rgba(10,14,20,.6);
  color: var(--text);
  outline: none;
}

.crumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.crumb {
  padding: 6px 10px;
  border: 1px solid rgba(34,48,71,.8);
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  background: rgba(10,14,20,.35);
}

.crumb:hover {
  border-color: rgba(90,167,255,.8);
  color: var(--text);
}

.list {
  width: 100%;
  border-collapse: collapse;
}

.list th,.list td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(34,48,71,.55);
  font-size: 14px;
}

.list th {
  color: var(--muted);
  font-weight: 600;
  text-align: left;
}

.list tr {
  cursor: pointer;
}

.list tr:hover {
  background: rgba(90,167,255,.08);
}

.list tr.sel {
  background: rgba(90,167,255,.14);
}

.tag {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(34,48,71,.85);
  color: var(--muted);
}

th[data-sort] {
  cursor: pointer;
  user-select: none;
}

.dropzone{
  border: 2px dashed rgba(90,167,255,.35);
  height: 100px;
  background: rgba(90,167,255,.06);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dropzone.drag {
  border-color: rgba(90,167,255,.9);
  background: rgba(90,167,255,.10);
}

.progress {
  height: 10px;
  background: rgba(34,48,71,.65);
  border-radius: 999px;
  overflow: hidden;
}

.bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.tree {
  flex: 1;
}

.node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}

.node:hover {
  background: rgba(90,167,255,.08);
}

.node.active {
  border-color: rgba(90,167,255,.6);
  background: rgba(90,167,255,.12);
}

.node .chev {
  width: 18px;
  opacity: .75;
}

.node .folder {
  font-weight: normal;
}

.indent {
  margin-left: 18px;
  padding-left: 10px;
}

.previewBox {
  border: 1px solid rgba(34,48,71,.7);
  border-radius: var(--r);
  overflow: hidden;
  background: rgba(10,14,20,.35);
}

.previewTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(34,48,71,.6);
}

.editor {
  width: 100%;
  height: 50dvh;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono";
  font-size: 13px;
  border: 0;
  outline: none;
  background: rgba(10,14,20,.35);
  color: var(--text);
  resize: vertical;
  border: 1px solid rgba(34,48,71,.8);
  border-radius: var(--r);
}

.editor.readonly {
  width: 100%;
  height: 50dvh;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono";
  font-size: 13px;
  border: 0;
  outline: none;
  background: rgba(10,14,20,.35);
  color: var(--text);
  resize: vertical;
  border: 1px solid rgba(34,48,71,.8);
  border-radius: var(--r);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 100px;
  background: rgba(17,24,36,.94);
  border: 1px solid rgba(34,48,71,.85);
  padding: 12px 12px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-width: 420px;
  display: none;
  z-index: 9999;
}

.toast.show {
  display: block;
}

.kbd {
  font-family: ui-monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(34,48,71,.9);
  background: rgba(10,14,20,.5);
  color: var(--muted);
}

.ctx {
  position: fixed;
  z-index: 9999;
  min-width: 220px;
  background: rgba(17,24,36,.98);
  border: 1px solid rgba(34,48,71,.9);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  padding: 8px;
  backdrop-filter: blur(10px);
}

.ctx button {
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
}

.ctx button:hover {
  background: rgba(90,167,255,.12);
}

.ctx .sep {
  height: 1px;
  margin: 6px 0;
  background: rgba(34,48,71,.7);
}

.ctx button.danger:hover {
  background: rgba(255,90,122,.14);
}

#sharePanel a {
  color: var(--text);
  background: rgba(90,167,255,.10);
  border: 1px solid rgba(90,167,255,.35);
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  display: inline-block;
}

#sharePanel a:hover {
  border-color: rgba(90,167,255,.75);
  background: rgba(90,167,255,.16);
}

#userPanel {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.55);
  z-index: 20000;
  overflow: hidden;
}

#userPanel > .card {
  max-height: 90dvh;
  overflow-y: auto;
  min-height: 0;
}

.header-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.header-actions {
  flex-wrap: wrap;
}

.fp-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(34,48,71,.7);
  background: rgba(10,14,20,.35);
  cursor: pointer;
  user-select: none;
}

.fp-node:hover {
  border-color: rgba(90,167,255,.75);
  background: rgba(90,167,255,.08);
}

.fp-node.sel {
  border-color: rgba(90,167,255,.9);
  background: rgba(90,167,255,.12);
}

.fp-chev {
  width: 18px;
  opacity: .8;
}

.fp-indent {
  margin-top: 6px;
  margin-left: 18px;
  padding-left: 10px;
  display: grid;
  gap: 6px;
}

#lb {
  position: fixed;
  inset: 0;
  z-index: 20000;
}

#lb .lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
}

#lb .lb-modal {
  position: absolute;
  inset: 2vw;
  background: rgba(17,24,36,.98);
  border: 1px solid rgba(34,48,71,.9);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#lb .lb-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(34,48,71,.7);
  background: rgba(15,22,34,.75);
}

#lb .lb-title {
  font-weight: 700;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#lb .lb-body {
  flex: 1;
  padding: 12px;
  background: rgba(10,14,20,.35);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

#lb .lb-body.pdf {
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
}

#lb iframe {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0;
  border-radius: 14px;
  background: #0b0f14;
}

#lb img, #lb video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 14px;
}

#lb audio {
  width: min(820px, 100%);
}

#lb .lb-editor {
  flex: 1;
  padding: 12px;
  display: flex;
}

#lb #lbEditor {
  width: 100%;
  height: 100%;
  min-height: 55vh;
  border-radius: 14px;
  border: 1px solid rgba(34,48,71,.7);
  background: rgba(10,14,20,.55);
  color: var(--text);
  outline: none;
  resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono";
  font-size: 13px;
  padding: 12px;
}

.u-card {
  border: 1px solid rgba(34,48,71,.7);
  background: rgba(10,14,20,.35);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 8px;
  transition: opacity .25s ease, transform .25s ease, height .25s ease, margin .25s ease, padding .25s ease;
}

.u-card.removing {
  opacity: 0;
  transform: translateY(-6px);
}

.u-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.u-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 54ch;
}

.u-meta {
  font-size: 12px;
  color: var(--muted);
}

.u-bar {
  height: 8px;
  background: rgba(34,48,71,.65);
  border-radius: 999px;
  overflow: hidden;
}

.u-bar > div {
  height: 100%;
  width: 0%;
}

.u-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#statusBar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #ccc;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#list tr.dropTarget{
  outline: 2px dashed rgba(90,167,255,.55);
  outline-offset: -4px;
  background: rgba(90,167,255,.10);
}

#fileList, #fileList * {
  -webkit-user-select: none;
  user-select: none;
}

.hideDropzone {
  transition: opacity .2s ease, max-height .25s ease;
}

hr {
  color: rgba(34,48,71,.25);
  width: 100%;
  margin-top: 3px;
  margin-bottom: 3px;
}

input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

footer {
  position: fixed;
  width: calc(100% - 24px);
  bottom: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 15px 0px 15px 0px;
  margin: 0px 12px 12px 12px;
  z-index: 8000;
  border: 1px solid rgba(34,48,71,.7);
  background: rgba(17,24,36,.96);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

footer.share-view {
  position: fixed;
  bottom: 0;
  max-width: calc(1000px - 24px);
  left: calc(50% - 12px);
  transform: translateX(-50%);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 15px 0px 15px 0px;
  margin: 0px 12px 12px 12px;
  z-index: 8000;
  border: 1px solid rgba(34,48,71,.7);
  background: rgba(17,24,36,.96);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

@media (max-width: 1250px) {
  .app {
    grid-template-columns: 1fr;
    height: auto;
  }

  .panel-scroll-tree {
    display: none;
  }

  .tree {
    height: auto;
    max-height: 35dvh;
    display: none;
  }

  .hideDropzone {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    display: none;
  }

  .right {
    height: auto;
    max-height: 70dvh;
  }

  .spacer {
    height: 26px;
  }

  footer {
    position: static;
    width: calc(100% - 24px);
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding: 15px 0px 15px 0px;
    margin: 0px 12px 12px 12px;
    border: 1px solid rgba(34,48,71,.7);
    background: rgba(17,24,36,.96);
    border-radius: var(--r);
    box-shadow: var(--shadow);
  }

  footer.share-view {
    position: static;
    max-width: calc(1000px - 24px);
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding: 15px 0px 15px 0px;
    margin: 0px auto 12px auto;
    border: 1px solid rgba(34,48,71,.7);
    background: rgba(17,24,36,.96);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    left: auto;
    transform: none;
  }
}
