:root {
  color-scheme: light;
  --navy: #17263f;
  --navy-soft: #263a5c;
  --blue: #316bd6;
  --blue-soft: #eaf1ff;
  --background: #f4f6f9;
  --surface: #ffffff;
  --line: #dfe4ec;
  --text: #1e293b;
  --muted: #68758a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--background); }
a { color: inherit; }
.topbar { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 0 34px; border-bottom: 1px solid #253653; color: white; background: var(--navy); }
.topbar.compact { position: static; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: var(--navy); background: #8fb8ff; font-weight: 900; }
.brand > span:last-child { display: grid; line-height: 1.05; }
.brand small { margin-top: 4px; color: #9fb0ca; font-size: .6rem; font-weight: 700; letter-spacing: .18em; }
.top-actions { display: flex; align-items: center; gap: 24px; }
.sync-state { display: flex; align-items: center; gap: 8px; color: #bfcaDA; font-size: .8rem; }
.sync-state i { width: 7px; height: 7px; border-radius: 50%; background: #5dd698; box-shadow: 0 0 0 4px rgb(93 214 152 / 12%); }
.profile { display: flex; align-items: center; gap: 10px; }
.profile > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--navy-soft); font-size: .74rem; font-weight: 800; }
.profile p { display: grid; margin: 0; font-size: .82rem; }
.profile small { margin-top: 2px; color: #9fb0ca; font-size: .68rem; }
.layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: calc(100vh - 122px); }
.sidebar { display: flex; flex-direction: column; padding: 30px 18px; border-right: 1px solid var(--line); background: #fafbfc; }
.nav-label { margin: 0 12px 10px; color: #9aa5b5; font-size: .65rem; font-weight: 800; letter-spacing: .15em; }
.nav-label.second { margin-top: 30px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; color: #526079; font-size: .86rem; font-weight: 650; text-decoration: none; }
.nav-item span { width: 18px; color: #7e8ba0; text-align: center; }
.nav-item.active { color: #2459bc; background: var(--blue-soft); }
.nav-item.disabled { cursor: default; opacity: .72; }
.storage-card { margin-top: auto; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.storage-card strong { font-size: .76rem; }
.storage-card > div { height: 5px; margin: 11px 0 8px; overflow: hidden; border-radius: 99px; background: #e8ebf0; }
.storage-card > div span { display: block; width: 68%; height: 100%; background: var(--blue); }
.storage-card small { color: var(--muted); font-size: .68rem; line-height: 1.45; }
main { width: min(1080px, calc(100% - 56px)); margin: 0 auto; padding: 34px 0 70px; }
.breadcrumb { display: flex; gap: 9px; margin-bottom: 30px; color: #8390a3; font-size: .78rem; }
.breadcrumb a { color: var(--blue); font-weight: 700; text-decoration: none; }
.breadcrumb b { color: #c2c8d2; }
.breadcrumb strong { color: #5a6679; }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.eyebrow { margin: 0; color: var(--blue); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .7rem; font-weight: 850; letter-spacing: .12em; }
h1 { margin: 7px 0 10px; color: #17243a; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.04em; }
.heading > div > p:last-child, .viewer-header p { margin: 0; color: var(--muted); }
.count { flex: none; padding: 7px 11px; border-radius: 6px; color: #53617a; background: #e9edf3; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; font-weight: 700; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.toolbar div { display: flex; align-items: center; gap: 10px; padding-left: 4px; color: #98a2b2; font-size: .84rem; }
.toolbar button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; color: #788498; background: #f8f9fb; }
.document-grid { display: grid; gap: 14px; margin-top: 18px; }
.document-card { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 8px 25px rgb(38 54 82 / 4%); transition: border-color .15s ease, transform .15s ease; }
.document-card:hover { transform: translateY(-1px); border-color: #b9c8e2; }
.document-icon { display: grid; width: 50px; height: 58px; place-items: center; border-radius: 7px 7px 10px 7px; color: #285ab5; background: #e8f0ff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .65rem; font-weight: 900; }
.document-icon.large { width: 58px; height: 68px; }
.category { color: var(--blue); font-size: .69rem; font-weight: 800; }
.document-copy h2 { margin: 4px 0 7px; font-size: 1.05rem; }
.document-copy > p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.document-meta { display: flex; gap: 16px; margin-top: 11px; color: #98a3b3; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .66rem; }
.document-card > a, .back-button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid #cad4e5; border-radius: 7px; color: #315eae; background: #fafcff; font-size: .78rem; font-weight: 800; text-decoration: none; }
.document-card > a:hover, .back-button:hover { border-color: #8aa8da; background: var(--blue-soft); }
footer { display: flex; justify-content: space-between; min-height: 50px; padding: 17px 34px; border-top: 1px solid var(--line); color: #8a96a8; background: white; font-size: .7rem; }
.viewer-badge { padding: 5px 9px; border: 1px solid #536681; border-radius: 5px; color: #b7c4d6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .65rem; font-weight: 800; }
.viewer-shell { width: min(900px, calc(100% - 36px)); padding-top: 36px; }
.viewer-card { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 14px 42px rgb(30 45 72 / 7%); }
.viewer-header { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 26px; }
.viewer-header h1 { margin: 3px 0 5px; font-size: clamp(1.45rem, 4vw, 2.1rem); overflow-wrap: anywhere; }
.viewer-header p:last-child { font-size: .78rem; }
.viewer-toolbar { display: flex; justify-content: flex-end; gap: 18px; padding: 10px 24px; border-block: 1px solid var(--line); color: #7d899b; background: #f8f9fb; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .68rem; }
.document-content { min-height: 320px; margin: 0; padding: 34px; overflow-x: auto; white-space: pre-wrap; color: #25334a; background: white; font: 500 .9rem/1.8 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.empty-card { width: min(580px, 100%); margin: 70px auto; padding: 46px; border: 1px solid var(--line); border-radius: 14px; background: white; text-align: center; }
.empty-card h1 { font-size: 2rem; }
.empty-card > p:not(.eyebrow) { color: var(--muted); }
.empty-card code { display: block; margin: 18px 0; padding: 10px; overflow-wrap: anywhere; border-radius: 6px; color: #657187; background: #f1f3f6; }
.empty-icon { display: grid; width: 52px; height: 52px; margin: 0 auto 18px; place-items: center; border-radius: 50%; color: #6d7d96; background: #edf0f5; font-size: 1.2rem; font-weight: 900; }
.empty-card .back-button { justify-content: center; }

@media (max-width: 760px) {
  .topbar { padding: 0 18px; }
  .sync-state, .profile p { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  main { width: min(100% - 30px, 680px); padding-top: 28px; }
  .heading { align-items: flex-start; flex-direction: column; }
  .toolbar button { display: none; }
  .document-card { grid-template-columns: 46px minmax(0, 1fr); padding: 18px; }
  .document-icon { width: 44px; height: 52px; }
  .document-card > a { grid-column: 1 / -1; justify-content: center; }
  .document-meta { align-items: flex-start; flex-direction: column; gap: 4px; }
  .viewer-header { grid-template-columns: 52px minmax(0, 1fr); padding: 20px; }
  .viewer-header .document-icon { width: 50px; height: 58px; }
  .viewer-header .back-button { grid-column: 1 / -1; justify-content: center; }
  .document-content { padding: 22px; }
  footer { padding-inline: 18px; }
}
