:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #66727e;
  --line: #d9e0e6;
  --surface: #ffffff;
  --wash: #f3f6f8;
  --accent: #1769aa;
  --accent-dark: #0d4d80;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--wash); }
button, input { font: inherit; }
button, .button { border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); cursor: pointer; padding: .45rem .75rem; text-decoration: none; }
button:hover, .button:hover { border-color: var(--accent); }
button:disabled { cursor: not-allowed; opacity: .55; }
.primary { color: white; background: var(--accent); border-color: var(--accent); }
.primary:hover { background: var(--accent-dark); color: white; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 2rem; background: #102a43; color: white; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .15rem; font-size: 1.35rem; }
.topbar .muted { color: #c7d5e2; }
.auth-controls { display: flex; align-items: center; gap: .75rem; }
.muted { color: var(--muted); }
.message { margin: 1rem 2rem 0; padding: .75rem 1rem; border: 1px solid #e4b64d; border-radius: 5px; background: #fff8df; }
.message.error { border-color: #d66; background: #fff0f0; color: #8d2020; }
.login-panel { max-width: 32rem; margin: 8rem auto; padding: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 18px #102a4314; }
main { display: grid; grid-template-columns: minmax(230px, 300px) 1fr; min-height: calc(100vh - 76px); }
.sidebar { padding: 1rem; border-right: 1px solid var(--line); background: var(--surface); overflow: auto; }
.content { min-width: 0; padding: 2rem clamp(1rem, 4vw, 4rem); }
.panel-heading, .detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.panel-heading h2 { font-size: 1rem; margin-bottom: .75rem; }
.tree ul { list-style: none; padding-left: 1rem; margin: .15rem 0; }
.tree > ul { padding-left: 0; }
.tree li { margin: .15rem 0; }
.tree button { width: 100%; border: 0; background: transparent; text-align: left; padding: .3rem .4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree button:hover { background: #eaf2f9; }
.tree .directory { font-weight: 600; }
.upload-box { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.upload-box h2 { font-size: 1rem; }
.upload-box label { display: block; margin: .7rem 0; font-size: .85rem; font-weight: 600; }
.upload-box input { display: block; width: 100%; margin-top: .25rem; padding: .45rem; border: 1px solid var(--line); border-radius: 4px; }
.upload-box progress { display: block; width: 100%; margin-top: .75rem; }
.eyebrow { margin-bottom: .2rem; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.detail-heading h2 { overflow-wrap: anywhere; }
.metadata { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .75rem; margin: 1.5rem 0; }
.metadata dl { margin: 0; padding: .8rem; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.metadata dt { color: var(--muted); font-size: .75rem; }
.metadata dd { margin: .25rem 0 0; overflow-wrap: anywhere; }
.viewer-section { margin: 2rem 0; }
.viewer { min-height: 5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); overflow: auto; }
.viewer img, .viewer video, .viewer audio { display: block; max-width: 100%; max-height: 60vh; margin: auto; }
.viewer iframe { width: 100%; min-height: 60vh; border: 0; }
.viewer pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.history { overflow-x: auto; }
.history table { width: 100%; border-collapse: collapse; background: var(--surface); }
.history th, .history td { padding: .65rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.history th { background: #e9eef2; font-size: .8rem; }
.empty-state { max-width: 38rem; padding-top: 6rem; color: var(--muted); }
@media (max-width: 750px) {
  .topbar { padding: 1rem; }
  main { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .content { padding: 1.25rem; }
  .empty-state { padding-top: 2rem; }
}
