:root {
  color-scheme: light dark;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #172033;
  --muted: #657184;
  --line: #dbe3ef;
  --blue: #0b79ff;
  --blue-strong: #075cbd;
  --blue-soft: #eaf4ff;
  --green: #0f8f69;
  --red: #b42318;
  --shadow: 0 18px 44px rgba(30, 49, 82, 0.1);
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --panel: #111827;
  --panel-soft: #172033;
  --ink: #e7eefc;
  --muted: #9ca8bd;
  --line: #2b3850;
  --blue: #4b9dff;
  --blue-strong: #8fc2ff;
  --blue-soft: #10294a;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0b1220;
    --panel: #111827;
    --panel-soft: #172033;
    --ink: #e7eefc;
    --muted: #9ca8bd;
    --line: #2b3850;
    --blue: #4b9dff;
    --blue-strong: #8fc2ff;
    --blue-soft: #10294a;
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.modal-open {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.55;
}

a {
  color: var(--blue-strong);
  font-weight: 750;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--blue-strong);
  cursor: pointer;
  font-weight: 800;
}

button:hover,
.module-tabs button.is-active {
  border-color: #aad3ff;
  background: var(--blue-soft);
}

button[hidden],
[hidden] {
  display: none !important;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
}

.theme-switcher {
  display: grid;
  gap: 6px;
  color: #9fb2d2;
  font-size: 0.82rem;
  font-weight: 800;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.theme-options button {
  min-height: 34px;
  padding: 0 8px;
  color: #c9dcff;
  background: transparent;
  border-color: transparent;
  font-size: 0.82rem;
}

.theme-options button.is-active {
  color: #fff;
  background: rgba(75, 157, 255, 0.28);
  border-color: rgba(126, 183, 255, 0.26);
}

select[multiple] {
  min-height: 132px;
  padding: 8px;
}

textarea {
  width: 100%;
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(11, 121, 255, 0.16);
  border-color: var(--blue);
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(11, 121, 255, 0.12), rgba(15, 143, 105, 0.08)),
    var(--bg);
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(460px, 100%);
  padding: 34px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card h1,
.page-head h1,
.article-view h1 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

.login-card h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.primary-button:hover {
  color: #fff;
  background: var(--blue-strong);
}

.form-error {
  margin: 0;
  color: var(--red);
  font-weight: 800;
}

.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 282px;
  padding: 24px 18px;
  color: #d7e6ff;
  background:
    linear-gradient(180deg, rgba(13, 38, 76, 0.96), rgba(5, 14, 37, 0.98)),
    #081a38;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 12px 0 34px rgba(15, 23, 42, 0.16);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  flex: 0 0 auto;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
  border-radius: 8px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  overflow-wrap: anywhere;
}

.brand small,
.topbar-actions span {
  color: #9fb2d2;
  font-size: 0.88rem;
}

.module-tabs,
.topbar-actions {
  display: flex;
  gap: 10px;
}

.module-tabs {
  flex-direction: column;
  align-items: stretch;
  margin-top: 8px;
}

.module-tabs button {
  justify-content: flex-start;
  width: 100%;
  color: #c9dcff;
  background: transparent;
  border-color: transparent;
  text-align: left;
}

.module-tabs button:hover,
.module-tabs button.is-active {
  color: #fff;
  background: rgba(35, 126, 255, 0.22);
  border-color: rgba(126, 183, 255, 0.26);
}

.topbar-actions {
  align-items: stretch;
  flex-direction: column;
  margin-top: auto;
}

.topbar-actions button {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 20px;
  width: min(1500px, calc(100% - 322px));
  margin: 24px 24px 40px 306px;
}

.sidebar,
.reader,
.work-panel,
.editor-panel,
.profile-card,
.placeholder-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar,
.reader {
  min-height: calc(100vh - 116px);
}

.sidebar {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 116px);
  overflow: hidden;
}

.search-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
}

.sidebar-heading,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.sidebar-heading {
  padding: 14px 16px 10px;
}

.sidebar-heading h2,
.panel-title h2,
.profile-card h2,
.placeholder-grid h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.sidebar-heading span {
  min-width: 34px;
  padding: 3px 8px;
  color: var(--blue-strong);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

.article-list {
  flex: 1;
  overflow: auto;
  padding: 0 10px 14px;
}

.list-section {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.list-section h3 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 8px 6px;
  color: var(--muted);
  background: var(--panel);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.article-link {
  display: grid;
  gap: 5px;
  width: 100%;
  height: auto;
  padding: 11px 12px;
  color: var(--ink);
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
}

.article-link:hover,
.article-link.is-active {
  background: var(--blue-soft);
  border-color: #b9dcff;
}

.article-link span {
  font-weight: 850;
}

.article-link small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reader {
  overflow: auto;
}

.article-view {
  max-width: min(1240px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 56px);
}

.article-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.article-toolbar > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.article-actions button {
  min-width: 118px;
}

.article-view h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.04;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.breadcrumbs {
  margin: 14px 0 28px;
  color: var(--muted);
  font-size: 0.9rem;
}

.quick-stats,
.dashboard-grid,
.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.quick-stats div,
.profile-card {
  padding: 18px;
}

.quick-stats div {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quick-stats strong,
.quick-stats span {
  display: block;
}

.quick-stats strong {
  color: var(--blue-strong);
  font-size: 1.5rem;
}

.quick-stats span,
.profile-card p,
.placeholder-grid p {
  color: var(--muted);
}

.article-content {
  color: var(--ink);
  font-size: 1.04rem;
  line-height: 1.72;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  color: var(--blue-strong);
  letter-spacing: 0;
}

.article-content h2 {
  margin: 30px 0 12px;
  font-size: clamp(1.28rem, 2vw, 1.68rem);
  line-height: 1.25;
}

.article-content h3 {
  margin: 24px 0 10px;
  font-size: 1.16rem;
  line-height: 1.32;
}

.article-content p,
.article-content ul,
.article-content ol,
.article-content blockquote,
.article-content pre {
  margin: 14px 0;
}

.article-content ul,
.article-content ol {
  padding-left: 1.35rem;
}

.article-content li + li {
  margin-top: 6px;
}

blockquote {
  padding: 14px 16px;
  background: var(--blue-soft);
  border: 1px solid #c7e4ff;
  border-radius: 8px;
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
}

pre {
  overflow: auto;
  padding: 14px;
  background: #10213d;
  color: #e6f3ff;
  border-radius: 8px;
}

.empty-state {
  margin: 24px;
  padding: 18px;
  background: #fff8d8;
  border: 1px solid #f0dc7a;
  border-radius: 8px;
}

.content-shell {
  width: min(1400px, calc(100% - 322px));
  margin: 24px 24px 44px 306px;
}

.page-head {
  margin-bottom: 18px;
}

.page-head h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.04;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.admin-tabs button.is-active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.work-panel,
.editor-panel,
.placeholder-grid article {
  padding: 18px;
}

.editor-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-content: start;
  width: 100%;
  max-height: 100vh;
  margin: 0;
  padding: 24px;
  overflow: auto;
  background: rgba(15, 23, 42, 0.42);
  box-shadow: none;
  border: 0;
  border-radius: 0;
}

.editor-panel::before {
  content: "";
  position: fixed;
  inset: 0;
}

.editor-panel > * {
  position: relative;
  z-index: 1;
}

.editor-panel .panel-title,
.editor-panel .form-grid,
.editor-panel > .field,
.editor-panel .checkbox-grid,
.editor-panel .visual-editor-shell,
.editor-panel .form-result,
.editor-panel > .primary-button {
  width: min(980px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.editor-panel .panel-title {
  padding: 18px 18px 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.editor-panel .form-grid,
.editor-panel > .field,
.editor-panel .checkbox-grid,
.editor-panel .visual-editor-shell,
.editor-panel .form-result {
  padding: 12px 18px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.editor-panel > .primary-button {
  border-radius: 0 0 8px 8px;
}

.work-panel,
.placeholder-grid article {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.visual-editor-shell {
  display: grid;
  gap: 10px;
}

.editor-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.editor-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.editor-toolbar button,
.editor-toolbar label {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--blue-strong);
  font-size: 0.9rem;
  font-weight: 800;
}

.editor-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.editor-toolbar input[type="color"] {
  width: 30px;
  min-height: 24px;
  padding: 0;
}

.file-button input {
  display: none;
}

.visual-editor {
  min-height: 520px;
  max-height: none;
  padding: 24px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.inline-article-editor .visual-editor {
  min-height: 58vh;
}

.inline-article-editor {
  display: grid;
  gap: 16px;
}

.article-title-field input {
  min-height: 54px;
  font-size: 1.55rem;
  font-weight: 900;
}

.article-settings {
  padding: 14px 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.article-settings summary,
.collapsible-field summary {
  cursor: pointer;
  color: var(--blue-strong);
  font-weight: 900;
}

.article-settings .form-grid,
.article-settings .collapsible-field {
  margin-top: 12px;
}

.field small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.field small.is-good,
.password-hint.is-good {
  color: var(--green);
}

.textarea-field {
  position: relative;
}

.textarea-field textarea {
  min-height: 84px;
  padding-right: 34px;
  resize: vertical;
}

.textarea-field::after {
  content: "↘";
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: var(--muted);
  pointer-events: none;
}

.visual-editor:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(11, 121, 255, 0.14);
}

.article-content img,
.visual-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.article-content figure,
.visual-editor figure {
  margin: 18px 0;
}

.article-content figcaption,
.visual-editor figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.kb-callout {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid #c7e4ff;
  border-radius: 8px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.check-row input {
  width: auto;
  min-height: auto;
  margin-top: 4px;
}

.check-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.table-list {
  overflow-x: auto;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(120px, 1fr)) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.record-card.compact {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, auto) minmax(220px, 1fr);
}

.log-card,
.suggestion-box {
  padding: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.log-card + .log-card,
.suggestion-list article + article {
  margin-top: 10px;
}

.log-card p,
.log-card details,
.suggestion-box p {
  margin: 6px 0 0;
  color: var(--muted);
}

.suggestion-box {
  margin-top: 42px;
}

.suggestion-box h2 {
  margin: 0 0 12px;
  color: var(--ink);
}

.suggestion-box form {
  display: grid;
  gap: 10px;
}

.suggestion-list {
  margin-top: 14px;
}

.suggestion-list article {
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.password-form {
  display: grid;
  gap: 12px;
}

.record-card:first-child {
  border-top: 0;
}

.record-card strong,
.record-card small,
.record-card span {
  display: block;
}

.record-card small,
.record-card span {
  color: var(--muted);
}

.record-card span {
  margin-bottom: 4px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  table-layout: auto;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td small {
  color: var(--muted);
}

.profile-card dl {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.profile-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.profile-card dt {
  color: var(--muted);
  font-weight: 800;
}

.profile-card dd {
  margin: 0;
  text-align: right;
}

.permission-list {
  columns: 1;
  padding-left: 1.2rem;
  overflow-wrap: anywhere;
}

@media (max-width: 1200px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .record-card,
  .record-card.compact {
    grid-template-columns: minmax(0, 1fr) minmax(120px, auto);
  }

  .record-card button {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 1060px) {
  .topbar {
    position: static;
    width: 100%;
    min-height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .module-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  }

  .module-tabs,
  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions {
    margin-top: 0;
  }

  .app-shell,
  .content-shell {
    width: min(100% - 24px, 1500px);
    margin: 12px auto 32px;
  }
}

@media (max-width: 920px) {
  .app-shell,
  .dashboard-grid,
  .placeholder-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: 560px;
  }

  .quick-stats {
    grid-template-columns: 1fr;
  }

  .record-card {
    grid-template-columns: 1fr;
  }

  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-actions {
    justify-content: flex-start;
  }

  .article-toolbar {
    flex-direction: column;
  }

  .editor-panel {
    padding: 10px;
  }

  .visual-editor {
    min-height: 340px;
    max-height: 55vh;
    padding: 16px;
  }
}

@media (max-width: 560px) {
  .topbar,
  .content-shell,
  .app-shell {
    width: 100%;
  }

  .topbar {
    padding: 12px;
  }

  .app-shell,
  .content-shell {
    margin: 0;
  }

  .sidebar,
  .reader,
  .work-panel,
  .editor-panel,
  .profile-card,
  .placeholder-grid article {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .login-card {
    padding: 24px;
  }
}

/* Quiet surfaces and a navigation rail that opens without moving the page. */
:root { --shadow: 0 2px 10px rgba(30,49,82,.025); }
.app-root { --nav-space: 280px; }
.app-root.nav-collapsed { --nav-space: 100px; }
.topbar { inset: 16px auto 16px 16px; width: 248px; padding: 24px 14px 16px; gap: 26px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); transition: width .22s ease, box-shadow .22s ease; overflow: hidden auto; }
.brand { gap: 10px; padding: 0 4px; color: var(--ink); min-height: 44px; white-space: nowrap; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; color: var(--blue); background: var(--blue-soft); font-size: 32px; font-weight: 500; }
.brand strong { font-size: 24px; letter-spacing: -.8px; font-weight: 550; line-height: 1.2; }
.brand strong .brand-blue { display: inline; color: var(--blue); }
.brand small { font-size: 10px; color: var(--muted); margin-top: 4px; }
.brand-copy, .nav-label { transition: opacity .15s ease; }
.nav-heading { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); padding: 0 14px 10px; white-space: nowrap; }
.module-tabs { display: flex; gap: 7px; margin: 0; }
.module-tabs button { position: relative; display: flex; align-items: center; gap: 14px; height: 50px; min-height: 50px; padding: 0 12px; border: 0; border-radius: 12px; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.nav-icon { width: 24px; height: 24px; flex: 0 0 24px; }
.module-tabs button:hover { background: var(--panel-soft); color: var(--ink); }
.module-tabs button.is-active { background: var(--blue-soft); color: var(--blue); }
.module-tabs button.is-active::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 4px; background: var(--blue); }
.topbar-actions { gap: 14px; border-top: 1px solid var(--line); padding-top: 16px; }
.topbar-actions span, .theme-switcher { color: var(--muted); font-weight: 500; font-size: 11px; }
.theme-switcher { gap: 7px; }
.theme-options { border: 1px solid var(--line); background: var(--panel-soft); gap: 0; padding: 3px; }
.topbar-actions button { color: var(--muted); background: transparent; border-color: var(--line); font-weight: 500; }
.theme-options button { padding: 0 4px; min-height: 28px; font-size: 10px; border-color: transparent; }
.theme-options button.is-active { background: var(--panel); color: var(--blue); border-color: var(--line); }
#currentUserLabel { line-height: 1.6; }
#logoutButton { min-height: 34px; font-size: 12px; }
.app-shell, .content-shell { width: calc(100% - var(--nav-space) - 32px); margin: 32px 32px 40px var(--nav-space); }
.app-shell { grid-template-columns: minmax(260px, 300px) minmax(0, 1fr); gap: 20px; }
.sidebar, .reader, .work-panel, .profile-card, .placeholder-grid article { border-radius: 16px; box-shadow: var(--shadow); }
.sidebar { top: 24px; max-height: calc(100vh - 64px); }
.sidebar, .reader { min-height: calc(100vh - 64px); }
.article-view { padding: clamp(24px, 3vw, 44px); }
.article-view h1, .page-head h1 { font-size: clamp(26px, 2.8vw, 38px); line-height: 1.2; letter-spacing: -.8px; }
button, .field { font-weight: 600; }
.search-panel { background: var(--panel); padding: 20px; }
.article-link { border-radius: 10px; }
.home-heading { margin: 22px 0 32px; }
.home-heading h1 { margin: 6px 0 10px; font-size: clamp(28px, 3vw, 42px); font-weight: 650; letter-spacing: -1.3px; line-height: 1.2; }
.eyebrow { letter-spacing: 1.5px; font-size: 10px; }
.home-heading .lead { font-size: 15px; }
.home-feature { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 40px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); }
.feature-tag { color: var(--blue); font-size: 11px; font-weight: 600; }
.home-feature h2 { margin: 16px 0; font-size: clamp(28px, 3vw, 40px); letter-spacing: -1px; font-weight: 600; line-height: 1.2; }
.home-feature p { max-width: 410px; margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.home-feature button { padding: 0 20px; height: 44px; border-radius: 10px; font-size: 13px; }
.home-feature button span { margin-left: 24px; }
.feature-art { display: grid; place-items: center; gap: 20px; width: 240px; height: 224px; border-radius: 20px; background: var(--blue-soft); color: var(--blue); flex-shrink: 0; padding: 36px; transform: rotate(-4deg); }
.feature-art svg { width: 95px; height: 95px; stroke-width: 1; }
.feature-art span { font-size: 11px; }
.home-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 20px 0 36px; gap: 16px; }
.home-stats > div { display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 22px; }
.home-stats strong { font-size: 28px; font-weight: 550; letter-spacing: -1px; }
.home-stats span { font-size: 12px; color: var(--muted); max-width: 125px; }
.home-section h2 { font-size: 18px; font-weight: 600; }
.home-caption { font-size: 12px; color: var(--muted); }
.home-links { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-top: 10px; }
.home-link { position: relative; display: flex; align-items: flex-start; flex-direction: column; padding: 24px; text-align: left; border-radius: 16px; color: var(--ink); }
.home-link svg { margin-bottom: 24px; color: var(--blue); }
.home-link strong { font-size: 14px; font-weight: 600; }
.home-link > span { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 6px; }
.home-link i { position: absolute; top: 22px; right: 22px; color: var(--muted); font-style: normal; }
.auth-screen { background: var(--bg); }
.login-card { border-radius: 20px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.8px; }
@media (min-width: 761px) {
  .nav-collapsed .topbar { width: 72px; padding-left: 10px; padding-right: 10px; }
  .nav-collapsed .topbar:not(:hover):not(:has(:focus-visible)) .brand-copy,
  .nav-collapsed .topbar:not(:hover):not(:has(:focus-visible)) .nav-label { opacity: 0; width: 0; pointer-events: none; }
  .nav-collapsed .topbar:not(:hover):not(:has(:focus-visible)) .nav-heading { font-size: 0; height: 23px; padding: 0; }
  .nav-collapsed .topbar:not(:hover):not(:has(:focus-visible)) .topbar-actions { display: none; }
  .nav-collapsed .topbar:hover, .nav-collapsed .topbar:has(:focus-visible) { width: 248px; box-shadow: 10px 0 35px rgba(10,25,50,.12); }
}
@media (max-width: 1100px) {
  .home-links { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .feature-art { width: 160px; height: 190px; padding: 20px; }
  .home-stats > div { flex-direction: column; align-items: flex-start; gap: 4px; }
}
@media (max-width: 920px) { .app-shell { grid-template-columns: 1fr; } .sidebar { position: static; min-height: 0; max-height: 390px; } }
@media (max-width: 760px) {
  .topbar { position: relative; inset: auto; width: calc(100% - 24px); margin: 12px; padding: 14px; border-radius: 16px; gap: 14px; }
  .brand-copy { display: block; }
  .module-tabs { display: flex; flex-direction: row; overflow-x: auto; gap: 6px; }
  .nav-heading { display: none; }
  .module-tabs button { width: auto; flex-shrink: 0; font-size: 12px; gap: 8px; height: 42px; min-height: 42px; }
  .nav-collapsed .module-tabs .nav-label { display: none; }
  .nav-collapsed .module-tabs button:hover .nav-label, .nav-collapsed .module-tabs button:focus-visible .nav-label { display: inline; }
  .topbar-actions { flex-direction: row; align-items: center; flex-wrap: wrap; margin: 0; gap: 12px; padding-top: 10px; }
  .theme-switcher > span { display: none; }
  #currentUserLabel { flex: 1; }
  .app-shell, .content-shell { width: calc(100% - 24px); margin: 20px 12px; }
  .home-heading { margin: 24px 4px; }
  .home-feature { padding: 24px; }
  .feature-art { display: none; }
  .home-stats { gap: 8px; }
  .home-stats > div { padding: 14px; }
  .home-stats span { font-size: 10px; }
  .home-links { grid-template-columns: 1fr; }
  .home-caption { display: none; }
  .home-link { padding: 20px; }
  .reader, .work-panel, .profile-card { border: 1px solid var(--line); border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) { .topbar, .brand-copy, .nav-label { transition: none; } }

@media (min-width: 761px) {
  .nav-collapsed .topbar.nav-dismissed { width: 72px; box-shadow: var(--shadow); }
  .nav-collapsed .topbar.nav-dismissed .brand-copy,
  .nav-collapsed .topbar.nav-dismissed .nav-label { opacity: 0; width: 0; pointer-events: none; }
  .nav-collapsed .topbar.nav-dismissed .nav-heading { font-size: 0; height: 23px; padding: 0; }
  .nav-collapsed .topbar.nav-dismissed .topbar-actions { display: none; }
}

.save-notice { padding: 12px 16px; border-radius: 10px; background: var(--blue-soft); color: var(--blue-strong); }
button:disabled { opacity: .55; cursor: wait; }
