:root {
  color-scheme: light;
  --ink: #172334;
  --muted: #738197;
  --line: #e3e9f0;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --blue: #246bdb;
  --blue-dark: #1559c0;
  --blue-soft: #edf4ff;
  --green: #18a875;
  --red: #c8414a;
  --red-soft: #fff0f1;
  --shadow: 0 18px 60px rgba(25, 46, 77, .09);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e5edf8;
  --muted: #9caabe;
  --line: #2a394d;
  --surface: #121d2a;
  --canvas: #0b121c;
  --blue: #76adff;
  --blue-dark: #5597f0;
  --blue-soft: #172941;
  --green: #38c795;
  --red: #ff7a84;
  --red-soft: #321d25;
  --shadow: 0 18px 60px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.5 Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
[hidden] { display: none !important; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 38px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 200px;
  color: inherit;
  text-decoration: none;
}
.brand > span:last-child { display: grid; line-height: 1.2; }
.brand strong { font-size: 15px; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, #3988f3, #1559c0);
  border-radius: 13px;
  box-shadow: 0 7px 18px rgba(36,107,219,.25);
  font-size: 25px;
  font-weight: 700;
}
.brand-mark.small { width: 36px; height: 36px; border-radius: 11px; font-size: 21px; }
.main-nav { display: flex; align-self: stretch; gap: 22px; }
.nav-item {
  position: relative;
  border: 0;
  background: transparent;
  color: #7b8799;
  padding: 0 3px;
  font-weight: 600;
}
.nav-item.active { color: var(--blue); }
.nav-item.active::after {
  content: "";
  position: absolute;
  height: 3px;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--blue);
  border-radius: 4px 4px 0 0;
}
.account-tools { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4f5c6e;
  font-size: 13px;
  font-weight: 600;
}
.online-dot { width: 8px; height: 8px; background: var(--green); border-radius: 50%; }
.admin-label {
  margin-left: 1px;
  padding: 2px 6px;
  color: #1756a7;
  background: #e8f1ff;
  border-radius: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.logout-form { margin: 0; }
.page-wrap { max-width: 1180px; margin: 0 auto; padding: 42px 24px 64px; }
.panel { min-height: 540px; }
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.page-heading h1 { margin: 3px 0 5px; font-size: clamp(25px, 4vw, 32px); line-height: 1.15; letter-spacing: -.04em; }
.page-heading p { margin: 0; }
.eyebrow {
  margin: 0 0 8px;
  color: #7590b5;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .14em;
}
.muted { color: var(--muted); }
.button {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  transition: .15s ease;
}
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 5px 12px rgba(36,107,219,.17); }
.button.primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
.button.secondary { color: #405168; border-color: #dce4ed; background: #fff; }
.button.secondary:hover { border-color: #b7c5d7; background: #fbfcfe; }
.button.danger-outline { color: var(--red); border-color: #f0cfd2; background: #fff; }
.button.danger-outline:hover { background: var(--red-soft); }
.button.compact { min-height: 34px; padding: 0 11px; }
.button.full { width: 100%; margin-top: 10px; min-height: 45px; }
.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #78869a;
  background: transparent;
  font-size: 19px;
}
.icon-button:hover { border-color: var(--line); color: var(--ink); background: #f7f9fc; }
.theme-toggle {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #607187;
  background: var(--surface);
  font-size: 17px;
}
.theme-toggle:hover { color: var(--blue); border-color: #9cbce6; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 13px 13px 0 0;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-right { justify-content: flex-end; }
.selection-count { color: var(--muted); font-size: 12px; margin-right: 3px; }
.drop-zone {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid #c9dbf3;
  border-top: 1px dashed #c9dbf3;
  border-bottom: 0;
  background: #f6faff;
  transition: .15s ease;
}
.drop-zone.drag-over { background: #e8f2ff; border-color: var(--blue); box-shadow: inset 0 0 0 2px rgba(36,107,219,.08); }
.drop-icon {
  width: 40px;
  height: 40px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--blue);
  background: #e5efff;
  border-radius: 12px;
  font-size: 23px;
  font-weight: 700;
}
.drop-zone strong, .drop-zone span { display: block; }
.drop-zone strong { font-size: 13px; }
.drop-zone span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.text-button { margin-left: auto; padding: 7px 10px; border: 0; color: var(--blue); background: transparent; font-size: 12px; font-weight: 700; }
.text-button:hover { text-decoration: underline; }
.transfer-panel {
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-top: 1px solid #eef2f6;
  background: #fff;
}
.transfer-heading { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.transfer-heading .icon-button { width: 28px; height: 28px; font-size: 20px; }
.overall-progress { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.overall-progress progress { flex: 1; }
.overall-progress span { min-width: 160px; color: var(--muted); text-align: right; font-size: 11px; }
progress { appearance: none; height: 8px; overflow: hidden; border: 0; border-radius: 9px; background: #e9eef5; }
progress::-webkit-progress-bar { background: #e9eef5; border-radius: 9px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #55a0ff, #246bdb); border-radius: 9px; transition: width .12s ease; }
progress::-moz-progress-bar { background: #246bdb; border-radius: 9px; }
.transfer-rows { max-height: 225px; overflow: auto; }
.transfer-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(100px, 1.4fr) 170px; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid #f0f3f7; font-size: 11px; }
.transfer-file-name { overflow: hidden; color: #42536a; text-overflow: ellipsis; white-space: nowrap; }
.transfer-row progress { width: 100%; }
.transfer-detail { color: var(--muted); text-align: right; }
.transfer-error { color: var(--red); }
.inline-message { padding: 10px 13px; color: #165c3f; background: #edf9f4; border: 1px solid #d3f0e3; font-size: 13px; }
.inline-message.error, .notice.error { color: #9b3039; background: var(--red-soft); border-color: #f2cfd2; }
.breadcrumb-wrap {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  border: 1px solid var(--line);
  background: #fff;
}
.breadcrumbs { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.crumb {
  max-width: 240px;
  padding: 4px 0;
  overflow: hidden;
  border: 0;
  color: #58708f;
  background: transparent;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumb:hover { color: var(--blue); }
.crumb:first-child { color: var(--blue); font-weight: 700; }
.crumb-divider { color: #aab5c3; font-size: 12px; }
.folder-summary { color: #8a97a8; font-size: 11px; white-space: nowrap; }
.file-table-wrap, .users-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 0 0 13px 13px; background: #fff; }
.file-table, .users-table { width: 100%; border-collapse: collapse; text-align: left; }
.file-table th, .users-table th {
  height: 42px;
  padding: 0 13px;
  color: #8492a5;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.file-table td, .users-table td { height: 50px; padding: 7px 13px; border-bottom: 1px solid #edf1f5; color: #45566c; font-size: 12px; }
.file-table tr:last-child td, .users-table tr:last-child td { border-bottom: 0; }
.file-table tbody tr:hover, .users-table tbody tr:hover { background: #fbfdff; }
.select-col { width: 44px; text-align: center; }
.select-col input, .permission-picks input { width: 15px; height: 15px; accent-color: var(--blue); vertical-align: middle; }
.name-cell { min-width: 220px; }
.item-icon { display: inline-block; width: 27px; color: #8897aa; font-size: 15px; text-align: center; }
.folder-icon { color: #eead47; }
.video-icon { color: #8257c9; }
.audio-icon { color: #2b9a71; font-size: 18px; }
.image-icon { color: #c25f9a; }
.document-icon { color: #377fd0; }
.archive-icon { color: #c17a32; }
.item-name { color: #33465e; }
.folder-link { padding: 0; border: 0; background: transparent; color: #284f85; font-weight: 650; text-align: left; }
.folder-link:hover { color: var(--blue); text-decoration: underline; }
.file-preview-link { padding: 0; border: 0; background: transparent; color: #33465e; text-align: left; }
.file-preview-link:hover { color: var(--blue); text-decoration: underline; }
.size-col { width: 120px; color: var(--muted) !important; }
.date-col { width: 170px; color: var(--muted) !important; white-space: nowrap; }
.row-actions-col { width: 105px; text-align: right; }
.row-download, .row-preview, .row-delete {
  padding: 5px 7px;
  border: 0;
  color: #58708f;
  background: transparent;
  font-size: 11px;
}
.row-preview:hover { color: var(--blue); }
.row-download:hover { color: var(--blue); }
.row-delete { color: var(--red); }
.row-delete:hover { text-decoration: underline; }
.empty-state, .loading-state {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}
.empty-state strong { color: #516176; font-size: 14px; }
.empty-icon { color: #a9b9cc; font-size: 30px; }
.storage-note { margin: 12px 2px; color: #8996a8; font-size: 11px; }

.count-pill { padding: 6px 10px; color: #48678d; background: #eaf2fc; border-radius: 999px; font-size: 11px; font-weight: 700; }
.create-user-card {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 7px 22px rgba(25,46,77,.035);
}
.form-title { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.form-title > div { display: grid; }
.form-title strong { font-size: 13px; }
.form-title span:not(.form-icon) { color: var(--muted); font-size: 11px; }
.form-icon { width: 30px; height: 30px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 9px; font-size: 18px; }
.create-user-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.create-user-fields label, .dialog-label { display: grid; gap: 6px; color: #58697e; font-size: 11px; font-weight: 650; }
.create-user-fields input, .dialog-label input, .dialog-label select {
  min-height: 39px;
  width: 100%;
  padding: 0 11px;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}
.create-user-fields input:focus, .dialog-label input:focus, .dialog-label select:focus { border-color: #82adea; box-shadow: 0 0 0 3px rgba(36,107,219,.1); }
.permission-picks { display: flex; gap: 20px; flex-wrap: wrap; margin: 14px 0; }
.permission-picks label { display: flex; align-items: center; gap: 7px; color: #52647a; font-size: 12px; }
.form-actions { display: flex; align-items: center; gap: 12px; }
.form-actions .muted, .form-error { font-size: 11px; }
.form-error { color: var(--red); }
.users-table-wrap { border-radius: 13px; }
.users-table { min-width: 1030px; }
.account-cell { min-width: 175px; }
.account-cell strong, .account-cell small { display: block; }
.account-cell strong { color: #35475e; font-size: 12px; }
.account-cell small { margin-top: 2px; color: #8a97a8; font-size: 10px; }
.role-cell { min-width: 105px; }
.role-cell .toggle { margin: 0 auto; }
.role-cell small, .role-label { display: block; margin-top: 4px; color: #74849a; font-size: 10px; white-space: nowrap; }
.principal-role { color: #a56d18; font-weight: 700; }
.users-table th:not(:first-child), .users-table td:not(:first-child) { text-align: center; }
.users-table td:last-child, .users-table th:last-child { width: 76px; }
.users-table td:last-child { width: 175px; text-align: left; white-space: nowrap; }
.last-login-cell { color: var(--muted) !important; font-size: 11px !important; white-space: nowrap; }
.row-edit, .row-reset {
  padding: 5px 6px;
  border: 0;
  color: #58708f;
  background: transparent;
  font-size: 11px;
}
.row-edit:hover, .row-reset:hover { color: var(--blue); text-decoration: underline; }
.toggle { position: relative; display: inline-flex; width: 34px; height: 19px; }
.toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle span { position: absolute; inset: 0; border-radius: 99px; background: #d8e0e9; transition: .15s ease; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.16); transition: .15s ease; }
.toggle input:checked + span { background: var(--blue); }
.toggle input:checked + span::after { transform: translateX(15px); }
.toggle input:disabled + span { opacity: .55; cursor: not-allowed; }
.status-pill { padding: 4px 8px; border-radius: 99px; font-size: 10px; }
.status-on { color: #16845f; background: #e8f7f1; }
.status-off { color: #9a5d19; background: #fff3df; }

.dialog-card {
  width: min(470px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 25px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
}
.dialog-card::backdrop { background: rgba(21,35,53,.42); backdrop-filter: blur(2px); }
.dialog-card h2 { margin: 0 0 18px; font-size: 21px; letter-spacing: -.03em; }
.dialog-card > form:first-child { position: absolute; right: 15px; top: 12px; }
.dialog-close { width: 30px; height: 30px; border: 0; color: #8290a3; background: transparent; font-size: 22px; }
.dialog-label { margin: 13px 0; }
.dialog-label small { color: var(--muted); font-weight: 400; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.credential-section { margin-top: 8px; }
.credential-actions { margin-top: 8px; }
.credential-divider { height: 1px; margin: 21px 0 16px; background: var(--line); }
.credential-heading { margin: 0; color: #58697e; font-size: 14px; }
.preview-dialog {
  width: min(980px, calc(100vw - 28px));
  max-width: 980px;
  max-height: min(92vh, 900px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #d6dee8;
  border-radius: 15px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
}
.preview-dialog::backdrop { background: rgba(15,27,42,.6); backdrop-filter: blur(3px); }
.preview-header { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line); background: #fff; }
.preview-header .eyebrow { margin-bottom: 2px; }
.preview-header h2 { max-width: min(760px, calc(100vw - 140px)); margin: 0; overflow: hidden; color: #33465e; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.preview-body { min-height: 180px; max-height: calc(92vh - 76px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; overflow: auto; padding: 18px; color: #eaf1f8; background: #111b28; }
.preview-image { display: block; max-width: 100%; max-height: calc(92vh - 130px); object-fit: contain; }
.preview-media { display: block; max-width: 100%; max-height: calc(92vh - 150px); }
video.preview-media { width: 100%; background: #05080c; }
audio.preview-media { width: min(760px, 100%); margin: 45px 0; }
.preview-hint { margin: 0; color: #9aaabe; font-size: 11px; text-align: center; }
.preview-loading, .preview-error { margin: 0; padding: 22px; color: #d5e0ed; font-size: 13px; }
.preview-error { color: #ffd3d7; }
.preview-caption { width: 100%; color: #aab8c9; font-size: 11px; }
.preview-text { width: 100%; max-height: calc(92vh - 150px); margin: 0; padding: 17px; overflow: auto; border: 1px solid #e4eaf1; border-radius: 9px; color: #26384e; background: #fff; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 5;
  max-width: min(440px, calc(100vw - 44px));
  padding: 11px 15px;
  border: 1px solid #d8e5f5;
  border-radius: 10px;
  color: #2c4f7d;
  background: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
  font-size: 12px;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { color: #9b3039; border-color: #f2cfd2; background: #fff7f8; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 20%, #e6f0ff, transparent 33%), radial-gradient(circle at 85% 80%, #e8f6f2, transparent 30%), #f4f7fb; }
.login-card { position: relative; width: min(410px, 100%); padding: 34px; border: 1px solid rgba(222,230,240,.9); border-radius: 18px; background: rgba(255,255,255,.95); box-shadow: var(--shadow); }
.login-card > .theme-toggle { position: absolute; top: 17px; right: 17px; }
.login-card .brand-mark { margin-bottom: 23px; }
.login-card h1 { margin: 0 0 5px; font-size: 25px; letter-spacing: -.04em; }
.login-card > .muted { margin: 0 0 22px; font-size: 13px; }
.login-form { display: grid; gap: 7px; }
.login-form label { margin-top: 6px; color: #55677d; font-size: 11px; font-weight: 700; }
.login-form input { min-height: 43px; padding: 0 12px; border: 1px solid #dbe3ec; border-radius: 9px; outline: none; background: #fff; }
.login-form input:focus { border-color: #82adea; box-shadow: 0 0 0 3px rgba(36,107,219,.1); }
.login-footnote { margin: 20px 0 0; padding-top: 15px; border-top: 1px solid #edf1f5; color: #8b98a8; text-align: center; font-size: 10px; }
.notice { margin: 12px 0; padding: 9px 11px; border: 1px solid #d5e7fa; border-radius: 8px; font-size: 12px; }

:root[data-theme="dark"] body { color: var(--ink); background: var(--canvas); }
:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .transfer-panel,
:root[data-theme="dark"] .breadcrumb-wrap,
:root[data-theme="dark"] .file-table-wrap,
:root[data-theme="dark"] .users-table-wrap,
:root[data-theme="dark"] .create-user-card,
:root[data-theme="dark"] .dialog-card,
:root[data-theme="dark"] .preview-dialog,
:root[data-theme="dark"] .preview-header,
:root[data-theme="dark"] .login-card {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}
:root[data-theme="dark"] .topbar { background: rgba(18,29,42,.96); }
:root[data-theme="dark"] .brand strong,
:root[data-theme="dark"] .page-heading h1,
:root[data-theme="dark"] .login-card h1,
:root[data-theme="dark"] .dialog-card h2,
:root[data-theme="dark"] .preview-header h2 { color: var(--ink); }
:root[data-theme="dark"] .brand small,
:root[data-theme="dark"] .user-badge,
:root[data-theme="dark"] .selection-count,
:root[data-theme="dark"] .storage-note,
:root[data-theme="dark"] .folder-summary,
:root[data-theme="dark"] .dialog-close { color: var(--muted); }
:root[data-theme="dark"] .button.secondary {
  color: #d5e0ef;
  border-color: #35465b;
  background: #172435;
}
:root[data-theme="dark"] .button.secondary:hover,
:root[data-theme="dark"] .icon-button:hover { border-color: #526a86; background: #1c2c40; }
:root[data-theme="dark"] .theme-toggle { color: #d5e0ef; border-color: #35465b; }
:root[data-theme="dark"] .icon-button { color: #aab9cb; }
:root[data-theme="dark"] .drop-zone { color: var(--ink); border-color: #35506f; background: #101e2c; }
:root[data-theme="dark"] .drop-zone.drag-over { background: #162a41; border-color: var(--blue); }
:root[data-theme="dark"] .drop-icon { color: #8dbbff; background: #192c44; }
:root[data-theme="dark"] .file-table th,
:root[data-theme="dark"] .users-table th { color: #99a9bd; border-color: var(--line); background: #0f1924; }
:root[data-theme="dark"] .file-table td,
:root[data-theme="dark"] .users-table td { color: #c4cfde; border-color: #263548; }
:root[data-theme="dark"] .file-table tbody tr:hover,
:root[data-theme="dark"] .users-table tbody tr:hover { background: #152234; }
:root[data-theme="dark"] .item-name,
:root[data-theme="dark"] .account-cell strong { color: #dce6f3; }
:root[data-theme="dark"] .folder-link { color: #9bc1ff; }
:root[data-theme="dark"] .row-download,
:root[data-theme="dark"] .row-preview { color: #a5b6ca; }
:root[data-theme="dark"] .row-download:hover,
:root[data-theme="dark"] .row-preview:hover { color: #8cbaff; }
:root[data-theme="dark"] .row-delete { color: #ff8790; }
:root[data-theme="dark"] .file-table th,
:root[data-theme="dark"] .users-table th { border-bottom-color: var(--line); }
:root[data-theme="dark"] .create-user-fields input,
:root[data-theme="dark"] .dialog-label input,
:root[data-theme="dark"] .dialog-label select,
:root[data-theme="dark"] .login-form input {
  color: var(--ink);
  border-color: #34455a;
  background: #0d1722;
}
:root[data-theme="dark"] .create-user-fields label,
:root[data-theme="dark"] .dialog-label,
:root[data-theme="dark"] .login-form label,
:root[data-theme="dark"] .permission-picks label { color: #b9c7d8; }
:root[data-theme="dark"] .login-page {
  background: radial-gradient(circle at 20% 20%, #17253a, transparent 34%), radial-gradient(circle at 85% 80%, #142c2b, transparent 32%), #0b121c;
}
:root[data-theme="dark"] .login-card { background: rgba(18,29,42,.96); }
:root[data-theme="dark"] .login-footnote { border-color: var(--line); color: #91a0b4; }
:root[data-theme="dark"] .admin-label,
:root[data-theme="dark"] .count-pill { color: #a8c9ff; background: #1a2b43; }
:root[data-theme="dark"] .status-on { color: #75dbb3; background: #15372f; }
:root[data-theme="dark"] .status-off { color: #f1c17b; background: #3a2d1b; }
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .loading-state { color: #9baabe; }
:root[data-theme="dark"] .empty-state strong { color: #d0dae7; }
:root[data-theme="dark"] .crumb { color: #aabbd0; }
:root[data-theme="dark"] .crumb:first-child { color: #8cbaff; }
:root[data-theme="dark"] .preview-text { color: #d5e0ef; border-color: #34465d; background: #0e1824; }
:root[data-theme="dark"] .preview-caption { color: #aab8c9; }
:root[data-theme="dark"] .toast { color: #c9dcf6; border-color: #34465d; background: #172435; }
:root[data-theme="dark"] .toast.error { color: #ffc4c9; border-color: #63333c; background: #2c1a21; }
:root[data-theme="dark"] .inline-message { color: #9be5c6; border-color: #275844; background: #142a24; }
:root[data-theme="dark"] .inline-message.error { color: #ffc4c9; border-color: #63333c; background: #2c1a21; }
:root[data-theme="dark"] .preview-dialog::backdrop { background: rgba(0,0,0,.72); }
:root[data-theme="dark"] .dialog-close:hover { color: #e9f1fb; }
:root[data-theme="dark"] .form-title strong { color: var(--ink); }
:root[data-theme="dark"] .account-cell small { color: #95a4b8; }
:root[data-theme="dark"] .role-cell small { color: #9aabc0; }
:root[data-theme="dark"] .principal-role { color: #e5b861; }
:root[data-theme="dark"] .video-icon { color: #b89ae9; }
:root[data-theme="dark"] .audio-icon { color: #70d3a9; }
:root[data-theme="dark"] .image-icon { color: #e89ac8; }
:root[data-theme="dark"] .document-icon { color: #8bb9f1; }
:root[data-theme="dark"] .archive-icon { color: #e7ad72; }
:root[data-theme="dark"] .last-login-cell { color: #a8b6c8 !important; }
:root[data-theme="dark"] .row-edit,
:root[data-theme="dark"] .row-reset { color: #a5b6ca; }
:root[data-theme="dark"] .row-edit:hover,
:root[data-theme="dark"] .row-reset:hover { color: #8cbaff; }
:root[data-theme="dark"] .credential-heading { color: #c1cede; }
:root[data-theme="dark"] .credential-divider { background: var(--line); }
:root[data-theme="dark"] .nav-item.active { color: #8cbaff; }
:root[data-theme="dark"] .nav-item { color: #9caabe; }
:root[data-theme="dark"] .overall-progress span,
:root[data-theme="dark"] .transfer-detail,
:root[data-theme="dark"] .transfer-file-name { color: #a9b8cb; }
:root[data-theme="dark"] .transfer-row { border-color: #263548; }
:root[data-theme="dark"] .form-error { color: #ff929b; }

@media (max-width: 860px) {
  .topbar { gap: 20px; padding: 0 16px; }
  .brand { min-width: unset; }
  .main-nav { gap: 15px; }
  .page-wrap { padding: 28px 16px 50px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-right { justify-content: flex-start; }
}
@media (max-width: 620px) {
  .topbar { height: 62px; gap: 13px; }
  .brand-mark.small { width: 31px; height: 31px; }
  .brand strong { font-size: 13px; }
  .brand small { font-size: 9px; }
  .main-nav { gap: 10px; }
  .nav-item { font-size: 11px; }
  .user-badge { font-size: 11px; gap: 5px; }
  .user-badge .admin-label, .account-tools .icon-button { display: none; }
  .button.compact { min-height: 31px; padding: 0 8px; font-size: 11px; }
  .account-tools { gap: 4px; }
  .page-heading { align-items: flex-start; }
  .page-heading > .button { margin-top: 4px; }
  .page-heading h1 { font-size: 25px; }
  .page-heading .muted { font-size: 12px; }
  .drop-zone { gap: 10px; padding: 13px; }
  .drop-icon { width: 34px; height: 34px; }
  .drop-zone strong { font-size: 11px; }
  .drop-zone span { font-size: 10px; }
  .text-button { padding: 4px 0; font-size: 10px; }
  .transfer-row { grid-template-columns: 1fr; gap: 4px; }
  .transfer-detail { text-align: left; }
  .overall-progress span { min-width: 105px; font-size: 10px; }
  .date-col { display: none; }
  .size-col { width: 70px; }
  .row-actions-col { width: 68px; }
  .file-table th, .file-table td { padding-left: 8px; padding-right: 8px; }
  .name-cell { min-width: 155px; }
  .create-user-fields { grid-template-columns: 1fr; }
  .permission-picks { gap: 12px; }
  .theme-toggle { min-width: 32px; height: 32px; padding: 0 7px; }
  .login-card > .theme-toggle { top: 13px; right: 13px; }
  .preview-dialog { width: calc(100vw - 14px); max-height: 95vh; }
  .preview-body { max-height: calc(95vh - 68px); padding: 10px; }
  .preview-image { max-height: calc(95vh - 100px); }
  .preview-media, .preview-text { max-height: calc(95vh - 110px); }
}
