:root {
  --ink: #0f1117;
  --panel: #171a24;
  --panel-raised: #1d212c;
  --line: #262b39;
  --line-soft: #1e2230;
  --paper: #edeff5;
  --dim: #8991a8;
  --dimmer: #5b6379;
  --brass: #d9a441;
  --brass-soft: #a9862f;
  --brass-wash: rgba(217, 164, 65, 0.12);
  --green: #5fb98c;
  --red: #e2685f;
  --red-wash: rgba(226, 104, 95, 0.1);
  --font-ui: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --footer-h: 44px;
}
[data-theme="light"] {
  --ink: #f4f2ec;
  --panel: #ffffff;
  --panel-raised: #f4f2ec;
  --line: #e2ded2;
  --line-soft: #ece8dc;
  --paper: #1c1d1f;
  --dim: #6b6a63;
  --dimmer: #96948a;
  --brass: #b3791f;
  --brass-soft: #8f6119;
  --brass-wash: rgba(179, 121, 31, 0.1);
  --red-wash: rgba(226, 104, 95, 0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
body {
  font-family: var(--font-ui);
  background: var(--ink);
  color: var(--paper);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
}
button, input {
  font-family: inherit;
  color: inherit;
}
a { color: var(--brass); }
:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
.hidden { display: none !important; }
.screen { min-height: 100vh; }
.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px calc(40px + var(--footer-h));
}
#login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% -10%, rgba(217, 164, 65, 0.09), transparent 55%),
    var(--ink);
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 340px;
  padding: 36px 32px;
  margin-bottom: var(--footer-h);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-align: center;
}
.login-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--brass-wash);
  color: var(--brass);
}
.login-box h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.login-sub {
  color: var(--dim);
  font-size: 13px;
  margin-top: 6px;
  margin-bottom: 26px;
}
.field {
  display: block;
  text-align: left;
  margin-bottom: 14px;
}
.field span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dimmer);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 12px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.15s ease;
}
.field input:focus {
  border-color: var(--brass-soft);
}
.error {
  color: var(--red);
  margin-top: 14px;
  font-size: 12.5px;
}
.btn-primary, .btn-ghost, .btn-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-height: 42px;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--brass);
  color: #1b1404;
  margin-top: 6px;
}
.btn-primary:hover { background: #e5b256; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost {
  background: var(--panel-raised);
  border-color: var(--line);
  color: var(--paper);
}
.btn-ghost:hover { border-color: var(--brass-soft); color: var(--brass); }
.btn-block { width: 100%; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--brass);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--dim);
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.icon-btn:hover { border-color: var(--brass-soft); color: var(--brass); }
.gauge-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.gauge-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.gauge-figure {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
}
.gauge-label {
  font-size: 12px;
  color: var(--dimmer);
  margin-top: 4px;
}
.gauge-track {
  display: flex;
  gap: 3px;
  height: 16px;
}
.gauge-segments {
  display: flex;
  gap: 3px;
  width: 100%;
}
.gauge-seg {
  flex: 1;
  height: 100%;
  border-radius: 2px;
  background: var(--line-soft);
  transition: background-color 0.25s ease;
}
.gauge-seg.filled { background: var(--brass); }
.gauge-seg.filled.warn { background: #e0a63f; }
.gauge-seg.filled.hot { background: var(--red); }
.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--dim);
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  padding: 10px 0;
  flex: 1;
  min-width: 200px;
}
.breadcrumb-btn {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 2px;
}
.breadcrumb-btn:hover { color: var(--brass); }
.breadcrumb-btn.current { color: var(--paper); }
.breadcrumb-sep { color: var(--line); margin: 0 2px; }
.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.upload-area {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.drag-text {
  font-size: 12px;
  color: var(--dimmer);
}
.file-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.file-list-header {
  display: grid;
  grid-template-columns: 1fr 100px 190px;
  background: var(--panel);
  padding: 12px 18px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dimmer);
  border-bottom: 1px solid var(--line);
}
#file-list-items { background: var(--panel); }
.file-item {
  display: grid;
  grid-template-columns: 1fr 100px 190px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  font-size: 13.5px;
  transition: background-color 0.12s ease;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--panel-raised); }
.col-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.file-icon {
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
}
.file-icon.folder-icon { color: var(--brass); }
.file-icon.media-icon { color: #7fb0d9; }
.entry-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-link {
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--paper);
  text-align: left;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-link:hover { color: var(--brass); }
.file-name-btn {
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--paper);
  text-align: left;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-name-btn.previewable:hover { color: #8fc4f0; text-decoration: underline; }
.file-name-static {
  font-family: var(--font-mono);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-size {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 12px;
}
.action-buttons {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.action-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.action-btn:hover { border-color: var(--brass-soft); color: var(--brass); }
.action-btn.danger:hover { border-color: var(--red); color: var(--red); }
.empty-state {
  padding: 56px 20px;
  text-align: center;
  color: var(--dimmer);
  font-size: 13px;
}
.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--dimmer);
  z-index: 800;
}
.upload-tray {
  position: fixed;
  right: 20px;
  bottom: calc(var(--footer-h) + 16px);
  width: 300px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 950;
}
.upload-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.upload-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.upload-item-name {
  font-family: var(--font-mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.upload-item-pct {
  font-size: 11px;
  color: var(--dim);
  flex-shrink: 0;
}
.upload-item-bar {
  height: 5px;
  background: var(--line-soft);
  border-radius: 3px;
  overflow: hidden;
}
.upload-item-fill {
  height: 100%;
  width: 0%;
  background: var(--brass);
  border-radius: 3px;
  transition: width 0.15s ease;
}
.upload-item.done .upload-item-fill { background: var(--green); }
.upload-item.error .upload-item-fill { background: var(--red); }
.upload-item.error .upload-item-pct { color: var(--red); }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 10, 15, 0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-content {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  min-width: 300px;
  max-width: 90%;
  width: 360px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-content h3 {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 18px;
  text-align: center;
}
.modal-content p {
  font-size: 13.5px;
  color: var(--dim);
  text-align: center;
}
.modal-content input {
  width: 100%;
  padding: 11px 12px;
  margin-top: 16px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 14px;
}
.modal-content input:focus { border-color: var(--brass-soft); }
.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}
.modal-buttons .btn-primary { margin-top: 0; }
.modal-buttons button { flex: 1; }
.modal-buttons .btn-danger {
  background: var(--red);
  color: #250705;
  border: none;
}
.modal-buttons .btn-danger:hover { background: #ea7c74; }
.modal-content.settings-content {
  width: min(460px, 100%);
  text-align: left;
  padding: 24px;
}
.modal-content.settings-content h3 {
  text-align: left;
  margin-bottom: 18px;
}
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.settings-tab {
  background: none;
  border: none;
  padding: 4px 2px 10px;
  margin-bottom: -1px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.settings-tab:hover { color: var(--paper); }
.settings-tab.active { color: var(--brass); border-bottom-color: var(--brass); }
.settings-panel { display: none; }
.settings-panel.active { display: block; animation: settings-fade 0.12s ease; }
@keyframes settings-fade { from { opacity: 0; } to { opacity: 1; } }
.settings-row { margin-bottom: 18px; }
.settings-row:last-child { margin-bottom: 0; }
.settings-row label.row-label,
.settings-row .row-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dimmer);
  margin-bottom: 7px;
}
.settings-row input[type="text"],
.settings-row input[type="number"],
.settings-row input[type="password"],
.settings-row textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.15s ease;
}
.settings-row textarea { resize: vertical; min-height: 60px; font-family: var(--font-ui); line-height: 1.5; }
.settings-row input:focus, .settings-row textarea:focus { border-color: var(--brass-soft); }
.settings-hint {
  font-size: 11.5px;
  color: var(--dimmer);
  margin-top: 7px;
  line-height: 1.55;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.check-row input { width: 15px; height: 15px; flex-shrink: 0; accent-color: var(--brass); cursor: pointer; }
.perm-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 6px; }
.settings-save-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.settings-save-row .btn-primary { margin-top: 0; padding: 8px 18px; }
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.user-row:last-child { border-bottom: none; }
.user-row-name { font-family: var(--font-mono); word-break: break-all; }
.user-row-perms { font-size: 11px; color: var(--dimmer); margin-top: 2px; }
.user-row-del {
  background: none; border: none; color: var(--dimmer); cursor: pointer;
  width: 28px; height: 28px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.12s ease, background-color 0.12s ease;
}
.user-row-del:hover { color: var(--red); background: var(--red-wash); }
.user-list { max-height: 180px; overflow-y: auto; margin-bottom: 18px; padding-right: 2px; }
.settings-divider { border-top: 1px solid var(--line); margin: 4px 0 18px; }
.settings-subheading { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dimmer); margin-bottom: 12px; }
@media (max-width: 480px) {
  .modal-content.settings-content { padding: 20px 18px; }
  .settings-tabs { gap: 4px 14px; }
}
.share-fallback {
  position: fixed;
  left: 50%;
  bottom: calc(var(--footer-h) + 16px);
  transform: translateX(-50%);
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 1050;
}
.share-fallback p {
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 10px;
}
.share-url-container {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.share-url-container input {
  flex: 1;
  margin-top: 0;
  font-size: 12px;
}
.copy-btn {
  padding: 0 16px;
  background: var(--brass);
  color: #1b1404;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.copy-btn:hover { background: #e5b256; }
.viewer-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 11, 0.92);
  z-index: 1100;
  display: flex;
  flex-direction: column;
}
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 12px;
}
.viewer-title {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--paper);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.viewer-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px 24px;
  min-height: 0;
}
.viewer-body img,
.viewer-body video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.viewer-body audio { width: 100%; max-width: 480px; }
.viewer-body .pdf-frame {
  width: min(92vw, 900px);
  height: 100%;
  max-height: 85vh;
  border: none;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.toast-message {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  color: var(--paper);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  z-index: 2000;
  text-align: left;
  max-width: 90%;
  word-break: break-word;
}
.toast-message.error { border-left-color: var(--red); }
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(15, 17, 23, 0.88);
  border: 2px dashed var(--brass-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.drop-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--brass);
  font-size: 15px;
  font-weight: 500;
}
@media (max-width: 720px) {
  .shell { padding: 20px 14px 32px; }
  .file-list-header,
  .file-item {
    grid-template-columns: 1fr 74px;
  }
  .file-list-header .col-actions,
  .col-size { display: none; }
  .file-item .col-actions {
    display: flex;
    justify-content: flex-end;
    grid-column: 2;
  }
  .gauge-figure { font-size: 17px; }
  .toolbar { flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .upload-area { width: 100%; }
  #upload-btn { flex: 1; }
  .drag-text { display: none; }
  .modal-buttons { flex-direction: column; }
}
@media (max-width: 420px) {
  .file-list-header, .file-item { padding: 10px 12px; }
  .action-buttons { gap: 4px; }
  .action-btn { width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
.not-found-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% -10%, rgba(217, 164, 65, 0.09), transparent 55%),
    var(--ink);
}
.not-found-card {
  width: min(100%, 460px);
  padding: 42px 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  text-align: center;
}
.not-found-code {
  margin-bottom: 10px;
  color: var(--brass);
  font-family: var(--font-mono);
  font-size: clamp(54px, 13vw, 86px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.06em;
}
.not-found-card h1 {
  margin-bottom: 8px;
  font-size: 22px;
  font-weight: 600;
}
.not-found-card p {
  margin: 0 auto 24px;
  max-width: 340px;
  color: var(--dim);
  font-size: 13px;
}
.not-found-home {
  text-decoration: none;
}
.not-found-brand { margin-top: 18px !important; margin-bottom: 0 !important; font-size: 11px !important; }
.not-found-brand a { color: var(--dim); text-decoration: none; }
