:root {
  --navy: #012e7a;
  --navy-dark: #071633;
  --blue: #017dc2;
  --cyan: #00cdc7;
  --cyan-soft: #dffbfa;
  --paper: #ecf3f8;
  --panel: #fbfdff;
  --line: #d5e0eb;
  --muted: #5d6880;
  --ink: #0b1736;
  --success: #009b78;
  --warning: #c88200;
  --shadow: 0 12px 30px rgba(7, 22, 51, 0.055);
  --shadow-soft: 0 8px 22px rgba(7, 22, 51, 0.045);
  --shell-pad: clamp(12px, 0.95vw, 20px);
  --shell-gap: clamp(14px, 1vw, 20px);
  --sidebar-width: clamp(252px, 16vw, 306px);
  font-family: "Segoe UI", "Inter Local", system-ui, sans-serif;
}

@font-face {
  font-family: "Inter Local";
  src: url("fonts/Inter-Medium.ttf") format("truetype");
  font-weight: 400 650;
}

@font-face {
  font-family: "Aeonik Local";
  src: url("fonts/Aeonik-Regular.ttf") format("truetype");
  font-weight: 400;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(251, 253, 255, 0.64), rgba(236, 243, 248, 0.18) 96px),
    var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

body::before {
  content: "";
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  height: 3px;
  background: var(--cyan);
  pointer-events: none;
}

body.design-dark {
  --navy: #60a5fa;
  --navy-dark: #f8fafc;
  --blue: #38bdf8;
  --cyan: #22d3ee;
  --cyan-soft: #183b45;
  --paper: #0b1220;
  --panel: #141d2c;
  --line: #42536a;
  --muted: #d5dfea;
  --ink: #f8fafc;
  --success: #34d399;
  --warning: #fbbf24;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
  background:
    linear-gradient(180deg, rgba(16, 36, 58, 0.72), rgba(7, 19, 33, 0.18) 120px),
    var(--paper);
}

@media (prefers-color-scheme: dark) {
  body.design-auto {
    --navy: #60a5fa;
    --navy-dark: #f8fafc;
    --blue: #38bdf8;
    --cyan: #22d3ee;
    --cyan-soft: #183b45;
    --paper: #0b1220;
    --panel: #141d2c;
    --line: #42536a;
    --muted: #d5dfea;
    --ink: #f8fafc;
    --success: #34d399;
    --warning: #fbbf24;
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
    --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.24);
    color-scheme: dark;
    background:
      linear-gradient(180deg, rgba(16, 36, 58, 0.72), rgba(7, 19, 33, 0.18) 120px),
      var(--paper);
  }
}

button, input, textarea, select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #f7fbfd;
  color: var(--navy);
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
  font-weight: 600;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

button:hover {
  border-color: #b9cfdf;
  background: #eef7fb;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(0, 205, 199, 0.14);
}

button.secondary,
.toolbar button {
  background: #e7f4fb;
  color: var(--navy);
}

button.danger {
  background: #fff3f4;
  border-color: #f0c1c8;
  color: #9f2536;
}

button.subtle {
  padding: 0;
}

.icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: 0 0 auto;
}

.action-button,
.upload-button,
.ai-write {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 8px;
  line-height: 1;
  white-space: nowrap;
}

.action-button.soft,
.upload-button {
  background: #f4f9fc;
  color: var(--navy);
}

.action-button.primary {
  background: linear-gradient(180deg, #0e6ba8, #002e47);
  border-color: #06456e;
  color: #f8fbff;
  box-shadow: 0 8px 18px rgba(1, 46, 122, 0.16);
}

.action-button.primary:hover {
  background: linear-gradient(180deg, #1176b9, #073a5b);
  border-color: #07517f;
}

.action-button.secondary {
  background: #f7fbfd;
  border-color: #cdddea;
  color: var(--navy);
}

.action-button.secondary:hover,
.action-button.soft:hover,
.upload-button:hover {
  background: #e9f5fb;
  border-color: #bad3e4;
}

.ai-write {
  background: #e6fbf8;
  border-color: #afe9e2;
  color: var(--navy);
}

.ai-write .icon {
  color: var(--cyan);
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
}

.icon-button.text-icon {
  font-size: 12px;
  font-weight: 700;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  background: #fbfdff;
  color: var(--ink);
}

textarea { min-height: 88px; resize: vertical; }

.shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: min(1960px, 100vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(244px, var(--sidebar-width)) minmax(0, 1fr);
  gap: var(--shell-gap);
  padding: calc(var(--shell-pad) + 4px) var(--shell-pad) var(--shell-pad);
  align-items: start;
  align-content: start;
}

.workspace {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: var(--shell-gap);
}

.shell.auth-shell {
  max-width: 440px;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  padding-top: max(24px, 7vh);
}

.shell.auth-shell .workspace {
  grid-column: 1;
  grid-row: 1;
}

.shell.auth-shell .account-strip {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  justify-items: start;
  max-width: 460px;
  margin: 0 auto;
  width: 100%;
}

.shell.auth-shell .account-form {
  grid-template-columns: 1fr;
  max-width: 360px;
}

.shell.auth-shell .content.auth-login {
  width: min(100%, 420px);
  margin: 0 auto;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  gap: 10px;
}

.shell.auth-shell .auth-login .account-strip,
.shell.auth-shell .auth-login .account-strip--compact {
  padding: 22px;
  margin: 0;
  width: 100%;
  max-width: 420px;
  background: rgba(251, 253, 255, 0.96);
  border: 1px solid rgba(214, 226, 236, 0.86);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.shell.auth-shell .auth-login .account-form {
  max-width: 420px;
  width: 100%;
}

.shell.auth-shell .auth-login .account-form input,
.shell.auth-shell .auth-login .account-form button {
  min-height: 40px;
}

.shell.auth-shell .auth-login .notice {
  width: min(100%, 420px);
}

.login-brand {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.login-brand img {
  display: block;
  width: 180px;
  max-width: 100%;
  height: auto;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.login-brand p {
  margin: 4px 0 0;
  color: var(--muted);
}

.shell.auth-shell .sidebar {
  display: none;
}

.shell.has-commandbar > .sidebar {
  grid-column: 1;
  grid-row: 1;
}

.account-strip.account-strip--compact {
  padding: 14px 16px;
}

.sidebar, .content {
  background: rgba(251, 253, 255, 0.94);
  border: 1px solid rgba(214, 226, 236, 0.86);
  border-radius: 13px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
}

.sidebar {
  padding: clamp(14px, 0.95vw, 20px);
  width: 100%;
  max-width: none;
  min-width: 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-direction: column;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(214, 226, 236, 0.86);
}

.brand img {
  display: block;
  width: 180px;
  max-width: 100%;
  height: auto;
  max-height: 32px;
}

.brand span,
.article-list small,
.article-meta,
.summary,
.login-box p,
.box p,
.audit span {
  color: var(--muted);
}

.sidebar-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.sidebar-section-title em {
  min-width: 26px;
  text-align: center;
  font-style: normal;
  background: #edf6fb;
  color: var(--navy);
  border: 1px solid #d7e7f2;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

.article-list {
  display: flex;
  flex-direction: column;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  max-height: calc(100dvh - 134px);
}

.article-group {
  display: grid;
  gap: 7px;
  width: 100%;
}

.article-group header {
  width: 100%;
}

.article-group header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  padding: 2px 4px;
}

.article-group em {
  font-style: normal;
  background: #edf6fb;
  color: var(--navy);
  border-radius: 999px;
  padding: 2px 7px;
}

.article-list form { margin: 0; }

.article-row {
  display: block;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(247, 251, 253, 0.84);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.article-row.active {
  border-color: var(--cyan);
  background: #e4f8f7;
  box-shadow: inset 0 0 0 1px rgba(0, 205, 199, 0.22);
}

.article-row:hover {
  border-color: #bfd7e7;
  background: #fafdff;
}

.article-row.active:hover {
  border-color: var(--cyan);
  background: #e8faf8;
}

.article-open {
  min-width: 0;
  width: 100%;
}

.article-list button {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 0;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  font-weight: 600;
  box-shadow: none;
  margin: 0;
}

.article-list button span {
  display: block;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.article-list button small {
  display: block;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.article-list button:hover {
  background: transparent;
}

.article-row-title {
  display: block;
  line-height: 1.35;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.article-row-meta {
  display: block;
  line-height: 1.35;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
}

.login-box {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

/* sidebar-foot removed to keep list compact and avoid extra empty space */

.sidebar-login-note {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7fbfd;
}

.sidebar-login-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.content {
  padding: clamp(12px, 0.95vw, 18px);
  overflow-y: visible;
  overflow-x: hidden;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.global-search,
.search-field {
  min-width: 0;
  width: 100%;
  justify-self: stretch;
}

.top-commandbar {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) max-content;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(214, 226, 236, 0.86);
  border-radius: 13px;
  background: rgba(251, 253, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.top-commandbar .global-search {
  margin: 0;
  grid-column: 1;
}

.top-command-actions {
  grid-column: 2;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.top-command-actions .action-button {
  min-height: 44px;
}

.shared-inline {
  justify-self: end;
  text-align: right;
}

.global-search label {
  display: none;
}

.search-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(104px, auto);
  gap: 6px;
}

.search-field input {
  min-height: 44px;
  background: #fbfdff;
  font-size: 14px;
  border-radius: 9px;
}

.search-field .action-button {
  min-height: 44px;
  padding-inline: 16px;
}

body.design-dark button,
body.design-dark input,
body.design-dark textarea,
body.design-dark select {
  background: #0b1a2c;
  border-color: #2d4965;
  color: var(--ink);
}

body.design-dark button:hover {
  background: #11243a;
  border-color: #426887;
}

body.design-dark .sidebar,
body.design-dark .content,
body.design-dark .top-commandbar,
body.design-dark .account-strip,
body.design-dark .editor-panel,
body.design-dark .article,
body.design-dark .article-body-card,
body.design-dark .article-section,
body.design-dark .resource-panel,
body.design-dark .editor-meta-card,
body.design-dark .editor-canvas-card {
  background: rgba(15, 33, 53, 0.95);
  border-color: rgba(62, 91, 120, 0.78);
  box-shadow: var(--shadow-soft);
}

body.design-dark .brand {
  border-bottom-color: rgba(62, 91, 120, 0.78);
}

body.design-dark .brand img {
  width: auto;
  max-width: 190px;
  height: auto;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(247, 251, 255, 0.96);
}

body.design-dark .article-row,
body.design-dark .file-card,
body.design-dark .material-drop,
body.design-dark .toolbar,
body.design-dark .article-facts .fact-card {
  background: rgba(11, 26, 44, 0.72);
  border-color: rgba(62, 91, 120, 0.78);
}

body.design-dark .article-row.active,
body.design-dark .article-row.active:hover {
  background: rgba(19, 68, 76, 0.82);
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(37, 213, 208, 0.24);
}

body.design-dark .article-row:hover {
  background: rgba(15, 37, 61, 0.92);
  border-color: rgba(84, 124, 158, 0.86);
}

body.design-dark .action-button.primary {
  background: linear-gradient(180deg, #1078a8, #063753);
  border-color: #1681b0;
  color: #f5fbff;
}

body.design-dark .action-button.secondary,
body.design-dark .action-button.soft,
body.design-dark .upload-button,
body.design-dark .toolbar button,
body.design-dark .icon-button {
  background: #10243a;
  border-color: #2d4965;
  color: #dcecff;
}

body.design-dark .ai-write,
body.design-dark .notice {
  background: rgba(16, 70, 67, 0.7);
  border-color: rgba(37, 213, 208, 0.56);
  color: #dffdf8;
}

body.design-dark .notice.error,
body.design-dark button.danger {
  background: rgba(80, 25, 39, 0.72);
  border-color: rgba(238, 116, 135, 0.52);
  color: #ffd7de;
}

body.design-dark .article-meta span,
body.design-dark .keyword-strip span,
body.design-dark .sidebar-section-title em,
body.design-dark .article-group em,
body.design-dark .status-info {
  background: rgba(26, 59, 92, 0.9);
  border-color: rgba(65, 103, 137, 0.78);
  color: #d7ecff;
}

body.design-dark .status-success {
  background: rgba(20, 66, 52, 0.88);
  border-color: rgba(73, 211, 159, 0.48);
  color: #a7f3d0;
}

body.design-dark .status-warning {
  background: rgba(85, 66, 21, 0.88);
  border-color: rgba(240, 195, 91, 0.52);
  color: #ffe4a3;
}

body.design-dark .status-danger {
  background: rgba(84, 28, 42, 0.88);
  border-color: rgba(239, 126, 145, 0.52);
  color: #ffd1da;
}

body.design-dark .summary,
body.design-dark .body-html,
body.design-dark .account-strip small,
body.design-dark .article-list button small {
  color: var(--muted);
}

@media (prefers-color-scheme: dark) {
  body.design-auto button,
  body.design-auto input,
  body.design-auto textarea,
  body.design-auto select {
    background: #0b1a2c;
    border-color: #2d4965;
    color: var(--ink);
  }

  body.design-auto button:hover {
    background: #11243a;
    border-color: #426887;
  }

  body.design-auto .sidebar,
  body.design-auto .content,
  body.design-auto .top-commandbar,
  body.design-auto .account-strip,
  body.design-auto .editor-panel,
  body.design-auto .article,
  body.design-auto .article-body-card,
  body.design-auto .article-section,
  body.design-auto .resource-panel,
  body.design-auto .editor-meta-card,
  body.design-auto .editor-canvas-card {
    background: rgba(15, 33, 53, 0.95);
    border-color: rgba(62, 91, 120, 0.78);
    box-shadow: var(--shadow-soft);
  }

  body.design-auto .brand {
    border-bottom-color: rgba(62, 91, 120, 0.78);
  }

  body.design-auto .brand img {
    width: auto;
    max-width: 190px;
    height: auto;
    padding: 5px 8px;
    border-radius: 10px;
    background: rgba(247, 251, 255, 0.96);
  }

  body.design-auto .article-row,
  body.design-auto .file-card,
  body.design-auto .material-drop,
  body.design-auto .toolbar,
  body.design-auto .article-facts .fact-card {
    background: rgba(11, 26, 44, 0.72);
    border-color: rgba(62, 91, 120, 0.78);
  }

  body.design-auto .article-row.active,
  body.design-auto .article-row.active:hover {
    background: rgba(19, 68, 76, 0.82);
    border-color: var(--cyan);
    box-shadow: inset 0 0 0 1px rgba(37, 213, 208, 0.24);
  }

  body.design-auto .article-row:hover {
    background: rgba(15, 37, 61, 0.92);
    border-color: rgba(84, 124, 158, 0.86);
  }

  body.design-auto .action-button.primary {
    background: linear-gradient(180deg, #1078a8, #063753);
    border-color: #1681b0;
    color: #f5fbff;
  }

  body.design-auto .action-button.secondary,
  body.design-auto .action-button.soft,
  body.design-auto .upload-button,
  body.design-auto .toolbar button,
  body.design-auto .icon-button {
    background: #10243a;
    border-color: #2d4965;
    color: #dcecff;
  }

  body.design-auto .ai-write,
  body.design-auto .notice {
    background: rgba(16, 70, 67, 0.7);
    border-color: rgba(37, 213, 208, 0.56);
    color: #dffdf8;
  }

  body.design-auto .notice.error,
  body.design-auto button.danger {
    background: rgba(80, 25, 39, 0.72);
    border-color: rgba(238, 116, 135, 0.52);
    color: #ffd7de;
  }

  body.design-auto .article-meta span,
  body.design-auto .keyword-strip span,
  body.design-auto .sidebar-section-title em,
  body.design-auto .article-group em,
  body.design-auto .status-info {
    background: rgba(26, 59, 92, 0.9);
    border-color: rgba(65, 103, 137, 0.78);
    color: #d7ecff;
  }

  body.design-auto .status-success {
    background: rgba(20, 66, 52, 0.88);
    border-color: rgba(73, 211, 159, 0.48);
    color: #a7f3d0;
  }

  body.design-auto .status-warning {
    background: rgba(85, 66, 21, 0.88);
    border-color: rgba(240, 195, 91, 0.52);
    color: #ffe4a3;
  }

  body.design-auto .status-danger {
    background: rgba(84, 28, 42, 0.88);
    border-color: rgba(239, 126, 145, 0.52);
    color: #ffd1da;
  }

  body.design-auto .summary,
  body.design-auto .body-html,
  body.design-auto .account-strip small,
  body.design-auto .article-list button small {
    color: var(--muted);
  }
}

.top-actions .action-button {
  min-height: 38px;
  padding-inline: 13px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 2px 2px 0;
}

.topbar-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow,
.topline {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  font-family: "Aeonik Local", "Inter Local", "Segoe UI", sans-serif;
  font-size: 22px;
  line-height: 1.18;
  font-weight: 500;
  margin-bottom: 4px;
}

h2 {
  font-size: 16px;
  font-weight: 600;
}

h3 {
  font-size: 14px;
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.top-actions form {
  margin: 0;
}

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


.article-meta span {
  background: #edf6fb;
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f4f8fb;
  color: var(--navy);
  font-size: 12px;
  font-weight: 650;
}

.status-badge .icon {
  width: 14px;
  height: 14px;
}

.status-success {
  background: #e8f8f0;
  border-color: #b9e4cf;
  color: #18724d;
}

.status-warning {
  background: #fff6de;
  border-color: #f1d489;
  color: #8c6400;
}

.status-danger {
  background: #fff1f3;
  border-color: #efc0c9;
  color: #a72f43;
}

.status-muted {
  background: #f2f5f8;
  border-color: #d6e2ec;
  color: #5d6880;
}

.status-top-line {
   margin: 0;
}

.article-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(214, 226, 236, 0.62);
}

.article-title-row h1 {
  margin: 0;
  flex: 1 1 280px;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.read-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.read-actions .action-button {
  min-height: 36px;
}

.read-actions form {
  margin: 0;
}

.status-info {
  background: #edf7fc;
  border-color: #cfe4f4;
  color: #0d4f86;
}

.account-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 12px;
  background: rgba(247, 251, 253, 0.88);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.account-strip.is-admin {
  background: rgba(247, 251, 253, 0.72);
}

.account-strip strong {
  display: block;
  font-weight: 650;
}

.account-strip small {
  color: var(--muted);
}

.account-identity {
  display: grid;
  gap: 2px;
}

.account-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto;
  gap: 8px;
  align-items: center;
  flex: 1 1 420px;
  min-width: 0;
  max-width: 100%;
}

.account-form--compact {
  grid-template-columns: minmax(0, 1fr) auto;
  max-width: 340px;
}

.account-form--solo {
  grid-template-columns: 116px minmax(0, 1fr) auto;
  max-width: 520px;
}

.login-only {
  margin-top: 4vh;
  max-width: 430px;
  justify-self: center;
}

.login-only .account-form {
  margin-top: 6px;
  max-width: 100%;
}

.account-spacer {
  min-height: 1px;
}

.account-strip:has(.account-spacer) {
  justify-content: flex-end;
}

.account-buttons,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.account-buttons form,
.editor-actions form {
  margin: 0;
}

.account-form input,
.account-form button {
  min-width: 0;
}

.notice {
  border: 1px solid #b8eee8;
  background: #e8fbf8;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

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

.share-copy-notice {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  width: auto;
  max-width: min(340px, calc(100vw - 32px));
  margin: 0;
  padding: 12px 14px;
  align-items: center;
  background: #e8fbf5;
  border-color: #9de6d2;
  color: #0b604e;
  box-shadow: 0 18px 42px rgba(7, 22, 51, 0.14);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.share-copy-notice.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.share-copy-notice .icon {
  color: var(--success);
}

.share-copy-notice small {
  display: none;
}

.notice input {
  margin-top: 10px;
  background: #fbfdff;
}

.notice.error {
  border-color: #f0c1c8;
  background: #fff0f2;
}

.deleted-notice {
  border: 1px solid #f5c0c8;
  background: #fff2f4;
  color: #8a2234;
  border-radius: 10px;
  padding: 11px 12px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.share-actions {
  display: inline-flex;
  margin-top: 10px;
}

.share-actions button {
  white-space: nowrap;
}

.article,
.editor-panel,
.resource-panel,
.article-body-card,
.article-section,
.editor-meta-card,
.editor-canvas-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(16px, 1.15vw, 22px);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.article-view,
.editor-panel {
  margin-top: -4px;
}

.empty-state {
  max-width: 68ch;
}

.article-view {
  display: grid;
  gap: 14px;
}

.article-hero {
  display: grid;
  gap: 9px;
  align-items: start;
  min-width: 0;
}

.article-hero-copy {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.article-keywords-section {
  border: 1px solid #d3e3ef;
  background: #f6faff;
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}

.article-keywords-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.article-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 0;
  min-width: 0;
}

.keyword-strip {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 0;
}

.keyword-strip span {
  background: #e8faf8;
  border: 1px solid #b8eee8;
  color: var(--navy);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
}

.body-html {
  line-height: 1.56;
  font-weight: 400;
  max-width: none;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  padding-top: 2px;
}

.summary {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  max-width: 78ch;
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 2px 0 8px;
}

.article h1 {
  margin-bottom: 2px;
}

.article-keywords-box {
  border: 1px solid #d7e7f2;
  border-radius: 10px;
  background: #f8fbfd;
  padding: 11px 12px;
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.article-keywords-box h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
}

.article-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
}

.article-facts .fact-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  background: #f7fbfd;
  min-height: 66px;
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.article-facts .fact-status {
  background: linear-gradient(180deg, #f8fcfd, #f0f8f5);
}

.article-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 4px;
}

.article-facts dd {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}

.body-html strong,
.body-html b {
  font-weight: 650;
}

.body-html h2 {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.body-html h2:first-child {
  margin-top: 4px;
  padding-top: 0;
  border-top: 0;
}

.body-html p,
.body-html li {
  margin-bottom: 10px;
  max-width: 82ch;
  overflow-wrap: anywhere;
}

.body-html ol,
.body-html ul {
  padding-left: 20px;
  max-width: 82ch;
  overflow-wrap: anywhere;
}

.body-html img,
.article img,
.article table {
  max-width: 100%;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.body-html code {
  background: #edf6fb;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
}

.editor-panel {
  margin-top: 0;
  display: grid;
  gap: 14px;
}

.editor-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.editor-head-copy {
  min-width: 190px;
}

.editor-head h2 {
  margin-bottom: 2px;
}

.editor-commandbar {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.editor-actions {
  justify-content: flex-end;
}

.editor-actions-primary,
.editor-actions-secondary {
  width: 100%;
  justify-content: flex-end;
}

.editor-actions-primary {
  margin-bottom: 2px;
}

.editor-flow-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  max-width: 38ch;
  margin-left: auto;
  text-align: right;
}

.editor-form {
  display: grid;
  gap: 14px;
}

.editor-upload-form {
  display: block;
  height: 0;
  overflow: hidden;
}

.editor-meta-card,
.editor-canvas-card {
  display: grid;
  gap: 12px;
}

.inline-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #edf6fb;
  color: var(--navy);
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.toolbar-actions .action-button,
.toolbar-actions .upload-button {
  margin: 0;
}

.field-label,
.form-row label span,
.editor-fields label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  margin: 0 0 6px;
}

.editor-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 0.42fr);
  gap: 10px;
  align-items: start;
}

.editor-fields label {
  min-width: 0;
}

.editor-fields .field-wide {
  grid-column: 1 / -1;
}

.editor-fields textarea {
  min-height: 58px;
  resize: vertical;
}

.editor-fields small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ai-preview-notice {
  margin: 0;
  align-items: center;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 180px 180px;
  gap: 10px;
}

.readonly-keywords {
  color: var(--muted);
  background: #f3f9fc;
  border-style: dashed;
}

.material-drop {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed #9bded9;
  background: #f2fbfa;
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--navy);
  outline: none;
}

.material-drop.drag-over,
.material-drop:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 205, 199, 0.12);
}

.material-drop-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #dffbfa;
  color: var(--navy);
  flex: 0 0 auto;
}

.material-drop strong,
.material-drop span {
  display: block;
}

.material-drop span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 0;
  padding: 6px;
  background: #f7fbfd;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.format-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wysiwyg {
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px;
  background: #fbfdff;
  line-height: 1.65;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

.wysiwyg:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.wysiwyg:focus {
  border-color: #87dcd8;
  box-shadow: 0 0 0 3px rgba(0, 205, 199, 0.12);
}

.wysiwyg blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  background: #edf8fb;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.wysiwyg pre,
.body-html pre {
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef6fa;
  white-space: pre-wrap;
}

.editor-hint {
  color: var(--muted);
  font-size: 12px;
  margin: -4px 0 0;
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.box {
  border: 1px solid var(--line);
  background: #f7fbfd;
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.resource-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 12px;
}

.resource-stack {
  display: grid;
  gap: 12px;
}

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

.file-list-inline {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.file-card {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #f7fbfd;
}

button.file-card {
  width: 100%;
  color: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
}

.article-attachments {
  display: grid;
  gap: 12px;
}

.article-attachments h2 {
  margin: 0;
}

.file-card img,
.file-icon {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: #e7f4fb;
  color: var(--navy);
  font-weight: 800;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(7, 22, 51, 0.72);
}

.lightbox.is-open {
  display: grid;
}

.lightbox-panel {
  display: grid;
  gap: 10px;
  max-width: min(92vw, 1180px);
  max-height: 92vh;
}

.lightbox img {
  max-width: 100%;
  max-height: 82vh;
  border-radius: 12px;
  background: #f7fbfd;
  box-shadow: 0 22px 60px rgba(7, 22, 51, 0.32);
}

.lightbox-caption {
  color: #f7fbfd;
  font-size: 13px;
}

.lightbox-close {
  justify-self: end;
  background: #f7fbfd;
}

details {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.section-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.audit {
  padding-left: 18px;
}

.audit li {
  margin-bottom: 10px;
}

.audit span {
  display: block;
  font-size: 12px;
}

@media (min-width: 2200px) {
  :root {
    --sidebar-width: 372px;
    --shell-pad: 20px;
    --shell-gap: 20px;
  }

  .shell {
    max-width: min(2280px, 100vw);
  }

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

@media (max-width: 1500px) {
  :root {
    --sidebar-width: clamp(278px, 21vw, 320px);
  }

  .article-list button {
    padding: 11px 12px;
  }

  h1 {
    font-size: 22px;
  }
}

@media (max-width: 1180px) {
  :root {
    --sidebar-width: clamp(250px, 28vw, 300px);
    --shell-pad: 10px;
    --shell-gap: 10px;
  }

  .shell {
    max-width: none;
    grid-template-columns: minmax(236px, var(--sidebar-width)) minmax(0, 1fr);
  }

  .top-commandbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .top-commandbar .global-search {
    grid-column: 1;
  }

  .top-command-actions {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-end;
  }

  .global-search {
    width: 100%;
    justify-self: stretch;
  }

  .brand img {
    width: 160px;
  }

  .article-list button {
    padding: 10px 11px;
  }

  .editor-fields {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.36fr);
  }

  .content,
  .sidebar {
    border-radius: 12px;
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .workspace {
    grid-column: 1;
    grid-row: 1;
  }
  .shell.has-commandbar > .sidebar {
    grid-column: 1;
    grid-row: 2;
  }
  .shell.auth-shell {
    grid-template-columns: 1fr;
  }
  .account-strip,
  .editor-head {
    display: grid;
    grid-template-columns: 1fr;
  }
  .account-form {
    grid-template-columns: 1fr;
  }
  .top-commandbar {
    grid-template-columns: 1fr;
  }
  .top-commandbar .global-search,
  .top-command-actions {
    grid-column: 1;
  }
  .top-command-actions,
  .shared-inline {
    justify-content: flex-start;
    justify-self: stretch;
    text-align: left;
  }
  .resource-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 13px;
    background: #eef5f9;
  }
  .shell {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
  }
  .sidebar,
  .content {
    border-radius: 12px;
  }
  .sidebar {
    padding: 12px;
    gap: 10px;
  }
  .brand {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .brand img {
    width: 150px;
  }
  .brand span {
    font-size: 12px;
  }
  .article-list {
    max-height: 260px;
  }
  .content {
    padding: 12px;
    gap: 10px;
  }
  .form-row,
  .split,
  .editor-fields {
    display: grid;
    grid-template-columns: 1fr;
  }
  .topbar {
    display: grid;
    gap: 10px;
  }
  .title-row {
    align-items: flex-start;
  }
  .top-actions,
  .account-buttons,
  .editor-actions {
    justify-content: flex-start;
  }
  .account-strip,
  .editor-panel,
  .article,
  .resource-panel,
  .article-body-card,
  .article-section,
  .editor-meta-card,
  .editor-canvas-card {
    padding: 12px;
  }
  .editor-head {
    gap: 10px;
  }
  .editor-actions {
    gap: 6px;
  }
  .editor-flow-hint {
    margin-top: 0;
    margin-left: 0;
    text-align: left;
  }
  .action-button,
  .upload-button,
  .ai-write {
    min-height: 34px;
    padding: 7px 9px;
  }
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .format-tools,
  .toolbar-actions {
    width: 100%;
  }
  .toolbar-actions {
    justify-content: flex-start;
  }
  .toolbar-actions .action-button,
  .toolbar-actions .upload-button,
  .toolbar-actions .ai-write {
    width: auto;
  }
  .icon-button {
    width: 32px;
    height: 32px;
  }
  .material-drop {
    align-items: flex-start;
    padding: 10px;
  }
  .wysiwyg {
    min-height: 230px;
    padding: 13px;
  }
  h1 {
    font-size: 22px;
  }
  .body-html {
    max-width: none;
  }
  .article-facts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
  }

  .shell {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    padding: 8px;
    gap: 8px;
  }

  .workspace {
    grid-column: 1;
    grid-row: 1;
    gap: 8px;
  }

  .shell.has-commandbar > .sidebar {
    grid-column: 1;
    grid-row: 2;
  }

  .top-commandbar,
  .sidebar,
  .content {
    width: 100%;
    max-width: 100%;
    margin-bottom: 8px;
  }

  .article,
  .editor-panel {
    width: auto;
    max-width: 100%;
    padding: 12px;
  }

  .search-field {
    grid-template-columns: 1fr;
  }

  .search-field .action-button {
    width: 100%;
  }

  .top-command-actions .action-button span,
  .read-actions .action-button span {
    display: none;
  }

  .top-command-actions .action-button,
  .read-actions .action-button {
    min-width: 40px;
    padding-inline: 10px;
  }

  .article-title-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .article-title-row h1 {
    width: 100%;
    font-size: 20px;
    line-height: 1.18;
  }

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

  .article-meta span {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .body-html,
  .body-html p,
  .body-html li,
  .body-html ol,
  .body-html ul,
  .summary {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

@media (max-height: 760px) and (min-width: 861px) {
  :root {
    --shell-pad: 8px;
    --shell-gap: 8px;
  }

  .sidebar,
  .content {
    padding: 10px;
    border-radius: 12px;
  }

  .brand {
    padding-bottom: 9px;
  }

  .brand img {
    width: 158px;
    max-height: 28px;
  }

  .article-list {
    gap: 8px;
    max-height: calc(100dvh - 112px);
  }

  .article-list button {
    padding: 9px 10px;
  }

  .article,
  .editor-panel {
    padding: 12px;
  }
}
