:root {
  --ink: #1d2623;
  --ink-soft: #55615d;
  --paper: #f6f4ef;
  --card: #ffffff;
  --line: #e2ded4;
  --side: #1f2a27;
  --side-ink: #d9e0dc;
  --brass: #b08d57;
  --brass-dark: #8a6a38;
  --ok: #2f7d57;
  --warn: #9a6a12;
  --bad: #b3372f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 38, 35, .06), 0 4px 14px rgba(29, 38, 35, .05);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.5; font-size: 15px; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: .1px; margin: 0 0 .5rem; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.15rem; }
a { color: var(--brass-dark); }
.muted { color: var(--ink-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid #e0b96b; outline-offset: 2px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: var(--side); color: var(--side-ink); padding: 1.25rem 1rem; flex-shrink: 0; display: flex; flex-direction: column; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: Georgia, serif; font-size: 1.15rem; color: #fff; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--brass); color: #1b1b1b; font-weight: 700; }
.brand-lg { color: var(--ink); font-size: 1.4rem; margin-bottom: 1rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .2rem; }
.nav-link { color: var(--side-ink); text-decoration: none; padding: .6rem .75rem; border-radius: 8px; }
.nav-link:hover { background: rgba(255, 255, 255, .07); }
.nav-link.is-active { background: rgba(176, 141, 87, .22); color: #fff; }
.sidebar-note { margin-top: auto; font-size: .8rem; color: #98a6a0; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-org { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: .75rem; }
.user-chip small { display: block; color: var(--ink-soft); font-size: .75rem; line-height: 1.1; }
.menu-toggle { display: none; }
.content { padding: 1.5rem; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* Cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.stat-num { display: block; font-family: Georgia, serif; font-size: 1.9rem; line-height: 1.1; }
.stat-label { color: var(--ink-soft); font-size: .85rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { background: #f1eee6; }
.btn-primary { background: var(--brass); border-color: var(--brass-dark); color: #1b1b1b; font-weight: 600; }
.btn-primary:hover { background: #bd9a63; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-block { width: 100%; justify-content: center; }
.btn.is-disabled { opacity: .55; cursor: not-allowed; }
.btn small { font-size: .7rem; color: var(--ink-soft); }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem; font-size: 1.1rem; cursor: pointer; }
.quick-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Forms */
.form { display: flex; flex-direction: column; gap: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.field > span { font-weight: 600; }
.field em { font-weight: 400; color: var(--ink-soft); }
.field small { color: var(--ink-soft); }
.field-wide { grid-column: 1 / -1; }
input, select, textarea { font: inherit; padding: .55rem .7rem; border: 1px solid #cfc9bb; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input[type="color"] { padding: .15rem; height: 2.4rem; width: 5rem; }
input:disabled { background: #f1eee6; color: var(--ink-soft); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filters input[type="search"] { flex: 1; min-width: 200px; width: auto; }
.filters select { width: auto; }
.inline-form { display: inline-flex; gap: .3rem; align-items: center; }
.inline-form select { width: auto; padding: .35rem .5rem; }

/* Tables & lists */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); border-bottom: 1px solid var(--line); padding: .5rem .6rem; }
.table td { padding: .6rem; border-bottom: 1px solid #efece4; vertical-align: middle; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { white-space: nowrap; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; flex-direction: column; padding: .6rem 0; border-bottom: 1px solid #efece4; }
.list li:last-child { border-bottom: 0; }
.list li.is-unread { border-left: 3px solid var(--brass); padding-left: .6rem; }
.empty { color: var(--ink-soft); padding: 1rem 0; }

/* Badges & alerts */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; background: #eceae2; color: var(--ink-soft); }
.badge-draft { background: #eceae2; }
.badge-issued { background: #e4edf8; color: #24527f; }
.badge-approved { background: #e0f1e8; color: var(--ok); }
.badge-rejected { background: #f7e3e1; color: var(--bad); }
.badge-superseded, .badge-archived { background: #efe9da; color: var(--warn); }
.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alert-success { background: #e8f5ee; border-color: #b7dcc6; color: #1f5a3d; }
.alert-error { background: #fbeceb; border-color: #efc2be; color: #8c2a24; }
.alert-warning { background: #fbf3df; border-color: #ecd9a6; color: #6f4d0c; }

/* Auth */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; box-shadow: var(--shadow); }
.auth-title { margin-bottom: .75rem; }
.auth-links { text-align: center; margin-top: 1.25rem; font-size: .9rem; }
.error-page { text-align: center; padding: 2rem 0; }
.error-code { font-family: Georgia, serif; font-size: 3rem; margin: 0; color: var(--brass-dark); }

/* Responsive */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; width: 270px; }
  .sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .menu-toggle { display: inline-block; }
  .content { padding: 1rem; }
  .topbar { padding: .6rem 1rem; }
  .user-chip { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .sidebar, .topbar, .quick-actions { display: none; } }
