:root {
  color-scheme: light;
  --canvas: #fafbfc;
  --sidebar: #eef1f4;
  --panel: #fff;
  --surface: #f2f4f6;
  --surface-hover: #e9edf1;
  --line: #e0e5e9;
  --line-strong: #cbd3da;
  --text: #17202a;
  --muted: #505d69;
  --dim: #596774;
  --accent: #006d95;
  --accent-hover: #005e81;
  --accent-soft: #e1eef4;
  --accent-contrast: #fff;
  --danger: #992b38;
  --danger-soft: #fae9eb;
  --folder: #505a66;
  --folder-edge: #38424f;
  --folder-seam: #8793a0;
  --shadow: #26384c24;
  --backdrop: #202b3e58;
  --radius: 9px;
  --radius-large: 13px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font: 15px/1.5 var(--sans);
  background: var(--canvas);
  color: var(--text);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #1d2228;
  --sidebar: #181c22;
  --panel: #242a31;
  --surface: #282f37;
  --surface-hover: #333c46;
  --line: #39434e;
  --line-strong: #4c5967;
  --text: #eff3f7;
  --muted: #b9c6d1;
  --dim: #a5b2bf;
  --accent: #7ccdee;
  --accent-hover: #a1ddf3;
  --accent-soft: #253f4d;
  --accent-contrast: #112632;
  --danger: #ffadb6;
  --danger-soft: #412c34;
  --folder: #7b8592;
  --folder-edge: #697480;
  --folder-seam: #b4bec9;
  --shadow: #0e12176e;
  --backdrop: #0d101696;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
h1, h2, p, dl, dd { margin: 0; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button, .button, a { touch-action: manipulation; }
button:disabled { cursor: progress; opacity: .55; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.symbols, .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  display: inline-block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.workspace {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 23px 14px 14px;
  height: 100dvh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  min-height: 0;
  overflow: auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  line-height: 1.13;
  padding: 0;
}
.sidebar .brand { margin: 0 7px 27px; }
.brand img { display: block; flex: none; border-radius: 9px; }
.brand strong { display: block; font-size: .85rem; font-weight: 720; letter-spacing: .06em; }
.brand span { display: block; color: var(--muted); font-size: .79rem; margin-top: 2px; }
.main-nav { display: grid; gap: 4px; }
.main-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
}
.main-nav a:hover { background: var(--surface); color: var(--text); }
.main-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.sidebar-bottom { margin-top: auto; padding-top: 36px; }
.account {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 53px;
  border-top: 1px solid var(--line);
  padding: 13px 5px 0 7px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font: 600 .78rem var(--mono);
}
.account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; font-weight: 600; }
.account .theme-toggle { margin-left: auto; }

.theme-mark {
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.main { min-width: 0; }
.overview-node { display: grid; justify-items: end; gap: 4px; }
.server-name { color: var(--muted); font: .81rem/1.3 var(--mono); overflow-wrap: anywhere; }
.connection { color: var(--muted); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: .8rem; }
.connection i { width: 7px; height: 7px; background: var(--dim); border-radius: 50%; }
.connection[data-state="online"] i { background: var(--accent); }
.connection[data-state="offline"] i { background: var(--danger); }
.view { max-width: 1290px; margin-inline: auto; padding: 43px clamp(24px, 4vw, 58px) 58px; }
.view-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 23px; }
.view-heading h1, .auth h1, .share h1 {
  font-weight: 660;
  font-size: clamp(1.8rem, 3.1vw, 2.45rem);
  letter-spacing: -.043em;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.view-heading p { color: var(--muted); font-size: .88rem; padding-top: 5px; }
.heading-actions { display: flex; align-items: center; flex: none; gap: 9px; }
.button, .icon-button, .menu button, .sort-button, .file-name, .breadcrumb-button { cursor: pointer; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 41px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: .86rem;
  white-space: nowrap;
  font-weight: 650;
  line-height: 1.15;
  transition: background-color .15s ease, border-color .15s ease;
}
.button .icon { width: 18px; height: 18px; }
.button-primary { color: var(--accent-contrast); background: var(--accent); border-color: var(--accent); }
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button-secondary { color: var(--text); background: var(--panel); border-color: var(--line-strong); }
.button-secondary:hover, .button-quiet:hover { background: var(--surface-hover); }
.button-quiet { min-height: 36px; background: transparent; color: var(--muted); }
.button-danger { background: var(--danger-soft); border-color: var(--line-strong); color: var(--danger); }
.button-danger:hover { border-color: var(--danger); }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}
.icon-button:hover, .icon-button[aria-expanded="true"] { background: var(--surface-hover); color: var(--text); }
.icon-button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.workspace-toolbar {
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
}
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; row-gap: 3px; }
.breadcrumbs .icon { width: 14px; height: 14px; color: var(--dim); }
.breadcrumb-button, .breadcrumb-current {
  display: inline-block;
  max-width: 230px;
  min-height: 29px;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  font-size: .86rem;
  line-height: 1.35;
}
.breadcrumb-button { background: none; color: var(--muted); }
.breadcrumb-button:hover { background: var(--surface-hover); color: var(--text); }
.breadcrumb-current { color: var(--text); font-weight: 600; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.search-control {
  display: flex;
  width: clamp(165px, 20vw, 262px);
  align-items: center;
  gap: 8px;
  min-height: 39px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--dim);
  background: var(--panel);
}
.search-control:focus-within { border-color: var(--accent); color: var(--accent); }
.search-control .icon { width: 18px; height: 18px; }
.search-control input { padding: 6px 0; width: 100%; min-width: 0; border: 0; outline: none; color: var(--text); background: none; font-size: .86rem; }
input::placeholder { color: var(--dim); }
.trash-trigger { width: 39px; height: 39px; border-color: var(--line); background: var(--panel); }

.files-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-large);
  border: 1px solid var(--line);
  background: var(--panel);
}
.file-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; font-size: .89rem; }
.file-table thead { background: var(--surface); }
.file-table th { height: 38px; font-size: .83rem; font-weight: 600; color: var(--muted); }
.file-table th:first-child, .file-table td:first-child { padding-left: 16px; }
.file-table th:last-child, .file-table td:last-child { padding-right: 11px; }
.file-table th, .file-table td { padding: 0 10px; }
.file-table tbody tr { border-top: 1px solid var(--line); }
.file-table tbody tr:hover { background: var(--surface); }
.file-table td { height: 48px; color: var(--muted); }
.date-column { width: 19%; }
.size-column { width: 13%; }
.actions-column { width: 59px; text-align: right; }
.sort-button { border: 0; padding: 4px 0; background: none; font-size: inherit; font-weight: inherit; color: inherit; white-space: nowrap; }
.sort-button:hover { color: var(--text); }
.sort-button[aria-pressed="true"] { color: var(--text); }
.sort-button span { color: var(--accent); margin-left: 4px; }
.file-name { display: flex; align-items: center; gap: 11px; width: fit-content; max-width: 100%; min-width: 0; height: auto; border: 0; padding: 4px 0; background: transparent; text-align: left; }
.file-name > span:last-child { min-width: 0; }
.file-name strong, .file-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name strong { color: var(--text); font-size: .91rem; font-weight: 580; }
.file-name:hover strong { color: var(--accent); }
.file-name small { color: var(--dim); font-size: .72rem; margin-top: 1px; }
.entry-symbol {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--dim);
}
.entry-symbol .icon { width: 19px; height: 19px; }
.entry-symbol.folder .icon { width: 25px; height: 25px; fill: var(--folder); stroke: var(--folder-edge); stroke-width: 1.1; --seam: var(--folder-seam); }
.folder-seam { stroke: var(--seam, currentColor); fill: none; }
.cell-meta { color: var(--muted); font-size: .81rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-state {
  display: grid;
  place-content: center;
  justify-items: center;
  min-height: 243px;
  padding: 35px 18px;
  color: var(--muted);
  text-align: center;
  gap: 8px;
}
.empty-state > .entry-symbol { width: 50px; height: 44px; margin-bottom: 3px; }
.empty-state > .entry-symbol .icon { width: 35px; height: 35px; }
.empty-state h2 { color: var(--text); font-size: 1.1rem; font-weight: 650; }
.empty-state p { max-width: 37ch; font-size: .84rem; }
.empty-state .button { margin-top: 7px; }
.drop-overlay {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  inset: 6px;
  pointer-events: none;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
  z-index: 2;
}
.upload-menu { position: relative; }
.menu {
  z-index: 8;
  padding: 5px;
  min-width: 185px;
  max-width: calc(100vw - 20px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 30px var(--shadow);
}
.upload-options { position: absolute; top: calc(100% + 6px); right: 0; }
.entry-menu { position: fixed; }
.menu button, .menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 35px;
  border: 0;
  border-radius: 7px;
  padding: 0 9px;
  text-align: left;
  font-size: .86rem;
  background: transparent;
  color: var(--text);
  white-space: nowrap;
}
.menu button:hover, .menu a:hover { background: var(--surface-hover); }
.menu .icon { width: 17px; height: 17px; color: var(--muted); }
.menu .danger, .menu .danger .icon { color: var(--danger); }
.menu hr { margin: 4px 0; border-width: 0 0 1px; border-color: var(--line-strong); }

.transfer-panel { padding: 11px 15px 13px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.transfer-header { display: flex; align-items: center; gap: 11px; min-width: 0; margin-bottom: 9px; }
.transfer-header > .icon { color: var(--accent); }
.transfer-header > div:nth-child(2) { flex: 1; min-width: 0; }
.transfer-header strong, .transfer-header span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-header strong { font-size: .85rem; color: var(--text); }
.transfer-header span { font-size: .75rem; color: var(--muted); }
.transfer-actions { display: flex; align-items: center; gap: 3px; }
.meter { display: block; width: 100%; height: 5px; appearance: none; border: 0; border-radius: 20px; background: var(--surface-hover); overflow: hidden; }
.meter::-webkit-progress-bar { background: var(--surface-hover); }
.meter::-webkit-progress-value { background: var(--accent); border-radius: 20px; transition: width .21s ease; }
.meter::-moz-progress-bar { background: var(--accent); border-radius: 20px; }

.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-large); background: var(--panel); }
.metric { min-width: 0; padding: 18px 20px; border-top: 1px solid var(--line); }
.metric:nth-child(even) { border-right: 1px solid var(--line); }
.metric-disk { grid-column: 1 / -1; border-top: 0; }
.metric-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: .87rem; }
.metric-label .icon { color: var(--accent); width: 17px; height: 17px; }
.metric-value { color: var(--text); font-size: clamp(1.35rem, 2.4vw, 1.9rem); font-weight: 640; letter-spacing: -.04em; line-height: 1.13; margin-top: 8px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.metric-note { color: var(--muted); font-size: .83rem; margin-top: 6px; }
.metric .meter { margin-top: 10px; }
.metric-timestamp { font: .7rem/1.45 var(--mono); color: var(--dim); }
.network-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 17px; gap: 5px 10px; }
.network-metrics dt { color: var(--dim); font-size: .74rem; }
.network-metrics dd { margin-top: 3px; color: var(--text); font-size: .95rem; font-weight: 620; white-space: nowrap; }
.network-metrics small { display: block; color: var(--dim); font-size: .69rem; overflow-wrap: anywhere; }
.view-message { color: var(--muted); font-size: .85rem; margin-top: 16px; }
.events-table th:first-child { width: 43%; }
.events-table th:last-child { width: 22%; }
.events-table td { overflow-wrap: anywhere; }
.event-name { color: var(--text); font-weight: 600; }
.event-name.critical { color: var(--danger); }
.event-detail { color: var(--muted); font-size: .79rem; }

.dialog {
  width: min(500px, calc(100% - 28px));
  max-height: min(82dvh, 680px);
  padding: 21px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 70px var(--shadow);
}
.dialog::backdrop { background: var(--backdrop); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.dialog h2 { min-width: 0; font-size: 1.31rem; line-height: 1.2; letter-spacing: -.029em; overflow-wrap: anywhere; }
.dialog-content-note { color: var(--muted); font-size: .9rem; margin: 0 0 16px; overflow-wrap: anywhere; }
.dialog label, .auth label { display: block; margin: 0 0 6px; color: var(--muted); font-weight: 560; font-size: .84rem; }
.dialog input:not([type="file"]), .auth input {
  width: 100%;
  height: 43px;
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--text);
  background: var(--canvas);
  border: 1px solid var(--line-strong);
}
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin: 18px 0 0; }
.dialog-actions .button { min-height: 37px; }
.form-error { font-size: .82rem; margin-top: 9px; color: var(--danger); }
.share-links, .destination-list { list-style: none; margin: 13px 0 0; padding: 0; max-height: 260px; overflow: auto; }
.share-links li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.share-links input { font: .72rem var(--mono); }
.share-links .button { min-height: 34px; padding-inline: 7px; }
.destination-list li { border-top: 1px solid var(--line); }
.destination-list button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 36px; padding: 5px 3px; background: none; border: 0; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.destination-list button:hover { color: var(--accent); }
.destination-list .icon { color: var(--accent); width: 17px; height: 17px; }
.toast {
  position: fixed;
  z-index: 9;
  max-width: min(390px, calc(100% - 25px));
  bottom: 18px;
  right: 18px;
  padding: 10px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: 0 10px 30px var(--shadow);
  font-size: .87rem;
  color: var(--text);
  overflow-wrap: anywhere;
}
.toast[data-error="true"] { color: var(--danger); }
.boot-status { display: grid; place-content: center; justify-items: center; gap: 14px; min-height: 100dvh; color: var(--muted); font-size: .87rem; }

.auth { display: grid; place-items: center; min-height: 100dvh; padding: 26px; }
.auth-layout {
  width: min(100%, 410px);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--panel);
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px 0;
}
.auth-main { padding: 25px 26px 28px; }
.auth h1 { font-size: clamp(1.42rem, 3.6vw, 1.85rem); margin-bottom: 21px; }
.auth input { margin: 0 0 13px; }
.auth-submit { width: 100%; margin-top: 10px; height: 43px; }

.share { max-width: 1070px; margin: auto; padding: 36px clamp(18px, 5vw, 64px) 68px; }
.share-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.share-main { padding-top: 34px; }
.share h1 { margin-bottom: 10px; }
.share .summary { color: var(--muted); font-size: .89rem; }
.share .workspace-toolbar { margin-top: 19px; }
.share .workspace-toolbar[hidden] + .files-panel { margin-top: 23px; }

@media (max-width: 1030px) {
  .workspace { grid-template-columns: 187px minmax(0, 1fr); }
  .sidebar { padding-inline: 13px; }
}
@media (max-width: 740px) {
  .workspace { display: block; }
  .sidebar { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; height: auto; padding: 15px 16px 0; border: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { margin: 0; }
  .sidebar .brand img { width: 35px; height: 35px; }
  .sidebar-bottom { grid-area: 1 / 2; padding: 0; margin: 0; }
  .account-name, .avatar { display: none; }
  .account { min-height: auto; gap: 4px; padding: 0; border: 0; }
  .main-nav { grid-area: 2 / 1 / 3 / -1; display: flex; gap: 4px; padding: 11px 0; }
  .main-nav a { padding: 6px 10px; gap: 6px; font-size: .85rem; }
  .main-nav a .icon { width: 17px; height: 17px; }
  .view { padding: 29px 16px 44px; }
  .view-heading { margin-bottom: 17px; }
  .view-heading p { padding-top: 5px; }
  .workspace-toolbar { gap: 7px; margin-bottom: 7px; }
  .search-control { width: min(168px, 46vw); }
  .breadcrumbs .breadcrumb-button, .breadcrumbs .breadcrumb-current { max-width: 135px; padding-inline: 4px; }
  .file-table th:first-child, .file-table td:first-child { padding-left: 10px; }
  .file-table th:last-child, .file-table td:last-child { padding-right: 5px; }
  .file-table th, .file-table td { padding-inline: 5px; }
  .date-column { display: none; }
  .size-column { width: 20%; }
  .actions-column { width: 43px; }
  .empty-state { min-height: 255px; }
  .events-table th:first-child { width: 31%; }
  .events-table th:last-child { width: 23%; }
  .events-table td { font-size: .76rem; }
  .events-table .cell-meta { font-size: .66rem; white-space: normal; }
}
@media (max-width: 480px) {
  .view-heading { gap: 8px; flex-wrap: wrap; }
  .heading-actions { margin-left: auto; gap: 5px; }
  .heading-actions .button { gap: 5px; min-height: 36px; padding-inline: 8px; }
  .heading-actions .button .icon { width: 16px; height: 16px; }
  .workspace-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .breadcrumbs { flex-basis: 100%; }
  .toolbar-actions { flex-basis: 100%; }
  .search-control { width: auto; flex: 1; }
  .file-table td { height: 47px; }
  .file-name { gap: 7px; }
  .entry-symbol { width: 31px; height: 31px; }
  .entry-symbol .icon { width: 17px; height: 17px; }
  .entry-symbol.folder .icon { width: 22px; height: 22px; }
  .cell-meta { font-size: .73rem; }
  .metric { padding: 13px; }
  .network-metrics { grid-template-columns: 1fr; }
  .share-links li { grid-template-columns: 1fr auto auto; }
  .transfer-header { gap: 6px; }
  .transfer-actions .button { padding: 0 6px; }
}
@media (max-width: 620px) {
  .auth { padding: 17px; }
  .auth-brand { padding: 19px 20px 0; }
  .auth-main { padding: 22px 20px 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
