:root {
  --ink: #15211b;
  --ink-soft: #344039;
  --forest: #183d31;
  --forest-deep: #102b22;
  --forest-soft: #285345;
  --paper: #eeece3;
  --paper-deep: #e2dfd4;
  --surface: #faf9f4;
  --surface-raised: #ffffff;
  --line: #d7d3c7;
  --line-strong: #b9b4a7;
  --muted: #68726b;
  --muted-light: #aab6af;
  --amber: #e2b84a;
  --amber-soft: #f5e4b4;
  --red: #b9412f;
  --red-deep: #913326;
  --green: #2d6b56;
  --danger: #a63e31;
  --focus: #d79f2a;
  --radius: 13px;
  --radius-sm: 8px;
  --shadow-floating: 0 14px 42px rgba(21, 33, 27, 0.16), 0 2px 8px rgba(21, 33, 27, 0.08);
  --sidebar-width: 244px;
  --font-ui: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-editorial: Georgia, "Songti SC", "STSong", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::selection,
::selection {
  color: #fff;
  background: var(--forest);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  caret-color: var(--red);
}

textarea {
  resize: vertical;
}

a {
  color: inherit;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #a9a496 transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #aaa497;
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 26px 16px 18px;
  color: #f5f1e5;
  background: var(--forest);
  border-right: 1px solid #0d2c22;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 26px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  color: var(--forest-deep);
  background: var(--amber);
  border-radius: 9px;
  font-family: var(--font-editorial);
  font-size: 21px;
  font-weight: 700;
  box-shadow: 0 5px 14px rgba(5, 20, 15, 0.28);
}

.sidebar-brand div {
  display: grid;
  gap: 2px;
}

.sidebar-brand strong {
  font-family: var(--font-editorial);
  font-size: 19px;
  letter-spacing: 0.02em;
}

.sidebar-brand span:last-child {
  color: #9eb2a8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.19em;
}

.main-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 0 2px;
}

.nav-label {
  margin: 0 12px 8px;
  color: #8ea59a;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-label-spaced {
  margin-top: 24px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  margin-bottom: 3px;
  padding: 0 12px;
  color: #bccbc4;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: color 160ms ease, background-color 160ms ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  opacity: 0.85;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.is-active {
  color: var(--forest-deep);
  background: #f3efe3;
  font-weight: 650;
}

.nav-item.is-active svg {
  color: var(--red);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 14px 10px 0;
  border-top: 1px solid #33594b;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: var(--forest-deep);
  background: #e6e0cf;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 750;
}

.user-summary {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.user-summary strong,
.user-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-summary strong {
  font-size: 12px;
}

.user-summary span {
  color: #98aea3;
  font-size: 10px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user-action {
  margin-left: auto;
  width: 32px;
  height: 32px;
  color: #a8bbb1;
}

.workspace {
  min-width: 0;
  background: var(--paper);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(280px, 560px) auto auto;
  align-items: center;
  justify-content: end;
  gap: 18px;
  height: 72px;
  padding: 0 34px;
  background: rgba(238, 236, 227, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.global-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.global-search:focus-within {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(24, 61, 49, 0.12);
}

.global-search svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: #6e7871;
}

.global-search input {
  width: 100%;
  height: 100%;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.global-search input::placeholder {
  color: #79827c;
}

.global-search kbd {
  flex: 0 0 auto;
  padding: 3px 6px;
  color: #737a75;
  background: #ece9df;
  border: 1px solid #d7d2c5;
  border-radius: 4px;
  font: 10px/1.2 var(--font-ui);
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3d8669;
  box-shadow: 0 0 0 3px rgba(61, 134, 105, 0.14);
}

.topbar-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 11px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.topbar-button:hover {
  background: var(--surface);
  border-color: var(--line);
}

.topbar-button svg {
  width: 16px;
  height: 16px;
}

.menu-button {
  display: none;
}

.main-content {
  width: 100%;
  max-width: 1520px;
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 34px 38px 52px;
}

.loading-state {
  display: grid;
  gap: 14px;
  max-width: 560px;
  padding-top: 32px;
}

.loading-line,
.loading-block {
  display: block;
  background: #dedbd0;
  border-radius: 6px;
  animation: pulse 1.4s ease-in-out infinite;
}

.loading-line {
  width: 42%;
  height: 34px;
}

.loading-line-short {
  width: 68%;
  height: 14px;
}

.loading-block {
  width: 100%;
  height: 260px;
  margin-top: 36px;
}

@keyframes pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 26px;
}

.page-heading h1 {
  max-width: 740px;
  margin: 0 0 8px;
  font-family: var(--font-editorial);
  font-size: 38px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.page-heading p {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.heading-date {
  flex: 0 0 auto;
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.heading-date strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-family: var(--font-editorial);
  font-size: 18px;
  font-weight: 600;
}

.summary-strip {
  display: flex;
  align-items: stretch;
  margin-bottom: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(21, 33, 27, 0.04);
}

.summary-item {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
  padding: 16px 22px;
}

.summary-item + .summary-item {
  border-left: 1px solid var(--line);
}

.summary-item strong {
  color: var(--forest);
  font-family: var(--font-editorial);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
}

.summary-item span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.summary-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 0 20px;
  color: var(--muted);
  font-size: 11px;
  border-left: 1px solid var(--line);
}

.summary-note svg {
  width: 16px;
  height: 16px;
  color: var(--green);
}

.mission-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 30px 0 13px;
}

.mission-heading h2 {
  margin: 0;
  font-family: var(--font-editorial);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.text-button {
  padding: 4px 0;
  color: var(--forest);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.scenario-strip {
  display: flex;
  gap: 8px;
  padding-bottom: 12px;
  overflow-x: auto;
}

.scenario-chip,
.filter-chip {
  min-height: 34px;
  padding: 0 13px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.scenario-chip:hover,
.filter-chip:hover {
  border-color: var(--forest);
}

.scenario-chip.is-active,
.filter-chip.is-active {
  color: #fff;
  background: var(--forest);
  border-color: var(--forest);
}

.library-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 354px;
  gap: 20px;
  align-items: start;
  margin-top: 12px;
}

.material-board {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(21, 33, 27, 0.05);
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 60px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}

.board-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.board-title h2 {
  margin: 0;
  font-family: var(--font-editorial);
  font-size: 19px;
  font-weight: 600;
}

.board-title span {
  color: var(--muted);
  font-size: 10px;
}

.view-controls {
  display: flex;
  gap: 6px;
}

.select-compact {
  height: 34px;
  padding: 0 30px 0 10px;
  color: var(--ink-soft);
  background: #f4f1e9;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.material-columns,
.material-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 88px 90px;
  align-items: center;
  gap: 10px;
}

.material-columns {
  min-height: 34px;
  padding: 0 17px;
  color: #737c76;
  background: #f1eee6;
  border-bottom: 1px solid var(--line);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.material-row {
  position: relative;
  width: 100%;
  min-height: 76px;
  padding: 10px 17px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid #e5e1d6;
  text-align: left;
  transition: background-color 150ms ease;
}

.material-row:last-child {
  border-bottom: 0;
}

.material-row:hover {
  background: #f5f2ea;
}

.material-row.is-selected {
  background: #f1eee4;
  box-shadow: inset 0 0 0 1px #d8c8aa;
}

.material-row.is-selected .row-index {
  color: var(--red);
  font-weight: 700;
}

.row-index {
  color: #8d938e;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.row-main {
  min-width: 0;
}

.row-main strong {
  display: block;
  margin-bottom: 4px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-main span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-label {
  color: var(--ink-soft);
  font-size: 10px;
}

.access-label {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 5px;
  min-height: 25px;
  padding: 0 8px;
  color: #425047;
  background: #e8ebe5;
  border: 1px solid #c7cbc4;
  border-radius: 5px;
  font-size: 9px;
  white-space: nowrap;
}

.access-label.is-restricted {
  color: #81372b;
  background: #f6e8e4;
  border-color: #dfc3bc;
}

.access-label svg {
  width: 11px;
  height: 11px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 40px;
  text-align: center;
}

.empty-state-inner {
  max-width: 340px;
}

.empty-state svg {
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  color: #8c978f;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-family: var(--font-editorial);
  font-size: 21px;
  font-weight: 600;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.detail-panel {
  position: sticky;
  top: 94px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(21, 33, 27, 0.07);
  animation: sheet-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sheet-in {
  from {
    opacity: 0.8;
    transform: translateY(4px);
  }
}

.detail-cover-wrap {
  position: relative;
  padding: 22px 22px 0;
}

.detail-cover-wrap::after {
  content: "";
  position: absolute;
  right: 15px;
  bottom: 2px;
  left: 15px;
  height: 10px;
  background: rgba(21, 33, 27, 0.08);
  filter: blur(6px);
}

.document-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 23px 24px;
  overflow: hidden;
  color: #f8f5ea;
  background: var(--forest);
  border-radius: 9px;
}

.document-cover::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 32%;
  background: #10271f;
  opacity: 0.58;
}

.document-cover.tone-ink {
  background: #202521;
}

.document-cover.tone-ink::after {
  background: #101411;
}

.document-cover.tone-amber {
  color: #1c241f;
  background: #e0b54c;
}

.document-cover.tone-amber::after {
  background: #c99e38;
}

.document-cover.tone-red {
  background: #9f3b2e;
}

.document-cover.tone-red::after {
  background: #792d23;
}

.cover-topline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tone-amber .cover-topline {
  color: rgba(20, 32, 25, 0.7);
}

.cover-sample,
.cover-lock {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  padding: 0 7px;
  color: #f8f5ea;
  background: var(--red);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  font-size: 8px;
  letter-spacing: 0.08em;
  transform: rotate(-2deg);
}

.cover-lock {
  color: var(--forest);
  background: var(--amber);
  transform: none;
}

.document-cover h3 {
  position: relative;
  z-index: 1;
  max-width: 82%;
  margin: auto 0 10px;
  font-family: var(--font-editorial);
  font-size: 27px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.cover-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 9px;
  color: rgba(255, 255, 255, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 8px;
}

.tone-amber .cover-meta {
  color: rgba(20, 32, 25, 0.68);
  border-top-color: rgba(20, 32, 25, 0.23);
}

.detail-body {
  padding: 20px 22px 22px;
}

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

.detail-headline h2 {
  margin: 0 0 8px;
  font-family: var(--font-editorial);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.detail-headline p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.detail-permission {
  flex: 0 0 auto;
  padding: 4px 7px;
  color: var(--forest);
  background: #ecf0e9;
  border: 1px solid #cfd6ce;
  border-radius: 5px;
  font-size: 9px;
}

.detail-description {
  margin: 17px 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.72;
}

.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 18px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.detail-meta div {
  min-width: 0;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-meta dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.detail-meta dd {
  margin: 0;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 19px;
}

.tag {
  padding: 4px 7px;
  color: #59645d;
  background: #f0ede5;
  border: 1px solid #dedad0;
  border-radius: 4px;
  font-size: 9px;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 43px;
  gap: 8px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 650;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.primary-button {
  color: #fff;
  background: var(--red);
  border: 1px solid var(--red);
}

.primary-button:hover {
  background: var(--red-deep);
  border-color: var(--red-deep);
}

.primary-button svg,
.secondary-button svg {
  width: 16px;
  height: 16px;
}

.secondary-button {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.secondary-button:hover {
  border-color: var(--forest);
  background: #f2f0e8;
}

.detail-actions .secondary-button {
  padding: 0;
}

.permission-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 10px;
  color: #6e4b42;
  background: #f7ece8;
  border: 1px solid #e4ccc5;
  border-radius: 6px;
  font-size: 9px;
  line-height: 1.55;
}

.permission-note svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-top: 1px;
}

.library-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0 18px;
}

.library-filters select {
  min-height: 38px;
  padding: 0 34px 0 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.filter-result {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}

.briefing-callout {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 11px 14px;
  color: #5e4b20;
  background: #f5e9c8;
  border: 1px solid #e4d19c;
  border-radius: 8px;
  font-size: 11px;
}

.briefing-callout svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.admin-stat {
  padding: 17px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-stat span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.admin-stat strong {
  font-family: var(--font-editorial);
  font-size: 28px;
  font-weight: 600;
}

.admin-panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.admin-toolbar-actions {
  display: flex;
  gap: 8px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  padding: 11px 16px;
  color: #747d77;
  background: #f1eee6;
  border-bottom: 1px solid var(--line);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #e5e1d6;
  font-size: 11px;
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.table-person {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 170px;
}

.table-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  color: var(--forest);
  background: #e8ece6;
  border: 1px solid #cdd5ce;
  border-radius: 50%;
  font-weight: 700;
}

.table-person strong,
.table-person span {
  display: block;
}

.table-person span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 0 7px;
  color: #315e4d;
  background: #e7eee9;
  border: 1px solid #c6d5cc;
  border-radius: 5px;
  font-size: 9px;
}

.state-badge.is-off {
  color: #6f726d;
  background: #efefeb;
  border-color: #d4d4ce;
}

.state-badge.is-warning {
  color: #795d19;
  background: #f5ebcf;
  border-color: #dfcf9f;
}

.table-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  color: var(--forest);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  font-size: 9px;
}

.table-action:hover {
  border-color: var(--forest);
}

.table-action svg {
  width: 12px;
  height: 12px;
}

.table-title {
  max-width: 320px;
}

.table-title strong {
  display: block;
  overflow: hidden;
  margin-bottom: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-title span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid #e5e1d6;
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--amber);
}

.activity-item p {
  margin: 0;
  font-size: 11px;
}

.activity-item small,
.activity-time {
  color: var(--muted);
  font-size: 9px;
}

.toast-region {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  color: #f7f3e8;
  background: #1c2b24;
  border: 1px solid #3b5549;
  border-radius: 9px;
  box-shadow: var(--shadow-floating);
  animation: toast-in 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.is-error {
  background: #6d2b22;
  border-color: #985046;
}

.toast svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-top: 2px;
  color: var(--amber);
}

.toast p {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

dialog {
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-floating);
}

dialog::backdrop {
  background: rgba(10, 24, 18, 0.56);
  backdrop-filter: blur(2px);
}

.viewer-dialog {
  width: min(1120px, calc(100vw - 40px));
  max-width: none;
  height: min(820px, calc(100vh - 40px));
}

.viewer-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 0;
  font-family: var(--font-editorial);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

.dialog-close {
  flex: 0 0 38px;
  color: var(--muted);
  border-color: var(--line);
}

.dialog-close:hover {
  background: #f2efe7;
}

.preview-body {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 0;
  padding: 14px;
  background: #dedbd0;
}

.preview-body iframe,
.preview-body video,
.preview-body img {
  width: 100%;
  max-width: 100%;
  height: 100%;
  background: #fff;
  border: 1px solid #c9c5b9;
  border-radius: 5px;
}

.preview-body img {
  object-fit: contain;
}

.preview-unavailable {
  width: min(480px, 90%);
  padding: 30px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.preview-unavailable svg {
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  color: var(--forest);
}

.preview-unavailable h3 {
  margin: 0 0 7px;
  font-family: var(--font-editorial);
  font-size: 22px;
  font-weight: 600;
}

.preview-unavailable p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.form-dialog {
  width: min(690px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}

.material-form-dialog {
  width: min(820px, calc(100vw - 32px));
}

.dialog-form {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px 16px;
  padding: 20px;
}

.field {
  display: grid;
  align-content: start;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
}

.field-span-2 {
  grid-column: span 2;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fbfaf6;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field textarea {
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(24, 61, 49, 0.1);
}

.field small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
  line-height: 1.5;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--ink-soft);
  font-size: 11px;
}

.checkbox-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--forest);
}

.file-field input {
  padding: 7px;
  background: #f2efe7;
}

.dialog-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.toast-region:empty {
  display: none;
}

/* Login */
.login-page {
  background: var(--paper);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(500px, 1.25fr) minmax(390px, 0.8fr);
  min-height: 100vh;
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 42px clamp(42px, 6vw, 96px);
  overflow: hidden;
  color: #f7f3e8;
  background: var(--forest);
}

.login-visual::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 30%;
  background: var(--forest-deep);
  border-left: 1px solid #315749;
}

.login-brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-editorial);
  font-size: 21px;
  font-weight: 600;
}

.login-message {
  position: relative;
  z-index: 2;
  max-width: 600px;
  margin-top: clamp(70px, 12vh, 130px);
}

.login-message h1 {
  max-width: 570px;
  margin: 0 0 24px;
  font-family: var(--font-editorial);
  font-size: clamp(52px, 6vw, 80px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.login-message > p:last-child {
  max-width: 52ch;
  margin: 0;
  color: #b8c9c0;
  font-size: 14px;
  line-height: 1.8;
}

.login-stack {
  position: absolute;
  right: clamp(30px, 7vw, 110px);
  bottom: 80px;
  width: 255px;
  height: 330px;
}

.stack-sheet {
  position: absolute;
  display: flex;
  flex-direction: column;
  width: 220px;
  height: 286px;
  padding: 22px;
  color: var(--ink);
  background: #f2eee2;
  border: 1px solid #d9d3c4;
  border-radius: 7px;
  box-shadow: 0 16px 35px rgba(6, 20, 14, 0.23);
}

.stack-sheet span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.stack-sheet strong {
  margin-top: auto;
  font-family: var(--font-editorial);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stack-sheet i {
  align-self: flex-start;
  margin-top: 17px;
  padding: 4px 7px;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 3px;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}

.stack-sheet-1 {
  top: 10px;
  left: 16px;
  transform: rotate(-5deg);
}

.stack-sheet-2 {
  top: 25px;
  left: 33px;
  transform: rotate(2deg);
}

.stack-sheet-3 {
  top: 39px;
  left: 50px;
  transform: rotate(7deg);
}

.login-meta {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 32px;
  margin-top: auto;
  padding-top: 30px;
  color: #93a99e;
  border-top: 1px solid #3c5f52;
  font-size: 10px;
}

.login-form-panel {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 42px clamp(32px, 6vw, 76px);
  background: var(--surface);
}

.login-form {
  display: grid;
  gap: 19px;
  width: 100%;
  max-width: 390px;
}

.login-form h2 {
  margin: 0 0 7px;
  font-family: var(--font-editorial);
  font-size: 37px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.form-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-group label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.field-group input {
  width: 100%;
  height: 48px;
  padding: 0 13px;
  color: var(--ink);
  background: #fbfaf6;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field-group input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(24, 61, 49, 0.1);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 58px;
}

.password-field .text-button {
  position: absolute;
  top: 5px;
  right: 6px;
  height: 38px;
  padding: 0 8px;
  text-decoration: none;
}

.login-submit {
  justify-content: space-between;
  min-height: 49px;
  padding: 0 16px;
  margin-top: 3px;
}

.login-submit svg {
  width: 18px;
  height: 18px;
}

.form-error {
  margin: 0;
  padding: 10px 11px;
  color: #87382d;
  background: #f8eae6;
  border: 1px solid #e6c8c1;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.5;
}

.login-notice {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(9, 25, 18, 0.54);
}

@media (max-width: 1180px) {
  .main-content {
    padding-right: 26px;
    padding-left: 26px;
  }

  .library-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .document-cover h3 {
    font-size: 24px;
  }

  .login-stack {
    opacity: 0.55;
    right: 20px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    width: var(--sidebar-width);
    transform: translateX(-102%);
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .menu-button {
    display: inline-grid;
    margin-right: -8px;
  }

  .topbar {
    grid-template-columns: auto minmax(200px, 1fr) auto;
    gap: 12px;
    padding: 0 20px;
  }

  .topbar-status {
    display: none;
  }

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

  .detail-panel {
    position: static;
    display: grid;
    grid-template-columns: minmax(260px, 0.72fr) 1fr;
  }

  .detail-cover-wrap {
    padding: 18px;
  }

  .detail-cover-wrap::after {
    display: none;
  }

  .document-cover {
    min-height: 100%;
  }

  .detail-body {
    padding: 20px;
  }

  .login-layout {
    grid-template-columns: minmax(380px, 1fr) minmax(350px, 0.8fr);
  }

  .login-stack {
    display: none;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: 64px;
    padding: 0 14px;
  }

  .topbar-button span,
  .global-search kbd {
    display: none;
  }

  .topbar-button {
    min-width: 38px;
    padding: 0;
    justify-content: center;
  }

  .main-content {
    min-height: calc(100vh - 64px);
    padding: 24px 16px 42px;
  }

  .page-heading {
    display: block;
    margin-bottom: 21px;
  }

  .page-heading h1 {
    font-size: 31px;
  }

  .heading-date {
    margin-top: 13px;
    text-align: left;
  }

  .heading-date strong {
    display: inline;
    margin-right: 7px;
    font-size: 14px;
  }

  .summary-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .summary-item {
    padding: 13px 15px;
  }

  .summary-item:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .summary-item:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .summary-note {
    display: none;
  }

  .board-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .material-columns {
    display: none;
  }

  .material-row {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 82px;
    padding: 12px 12px;
  }

  .type-label {
    display: none;
  }

  .detail-panel {
    display: block;
  }

  .document-cover {
    min-height: 225px;
  }

  .admin-summary {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .viewer-dialog {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .filter-result {
    width: 100%;
    margin-left: 0;
  }

  .login-layout {
    display: block;
  }

  .login-visual {
    min-height: 390px;
    padding: 27px 25px 30px;
  }

  .login-message {
    margin-top: 55px;
  }

  .login-message h1 {
    margin-bottom: 18px;
    font-size: 47px;
  }

  .login-message > p:last-child {
    max-width: 38ch;
    font-size: 12px;
  }

  .login-meta {
    display: none;
  }

  .login-form-panel {
    place-items: start center;
    min-height: calc(100vh - 390px);
    padding: 38px 24px 48px;
  }
}

@media (max-width: 430px) {
  .global-search {
    min-width: 0;
  }

  .page-heading h1 {
    font-size: 28px;
  }

  .mission-heading {
    align-items: flex-start;
  }

  .material-row {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .access-label {
    grid-column: 2;
  }

  .detail-body {
    padding: 17px;
  }

  .detail-cover-wrap {
    padding: 13px 13px 0;
  }

  .document-cover {
    min-height: 205px;
    padding: 19px;
  }

  .document-cover h3 {
    font-size: 23px;
  }

  .login-visual {
    min-height: 360px;
  }

  .login-message h1 {
    font-size: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
