:root {
  --ink: #0b0f14;
  --ink-soft: #5c6570;
  --paper: #eef1f5;
  --paper-2: #d9dee6;
  --panel: #ffffff;
  --line: #c8d0da;
  --navy: #102a4c;
  --rust: #c8102e;
  --rust-deep: #8e0b20;
  --moss: #2f4a3c;
  --gold: #9aa3ad;
  --danger: #8e0b20;
  --ok: #1f3d2b;
  --shadow: 0 16px 40px rgba(16, 42, 76, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3, .brand strong {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

a { color: var(--rust-deep); }
a:hover { color: var(--rust); }

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.rail {
  background: linear-gradient(180deg, #0b0f14 0%, var(--navy) 100%);
  color: #f3f5f8;
  border-right: 4px solid var(--rust);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand small { display: block; color: #9aa3ad; font-size: 12px; font-weight: 400; }
.brand-patch {
  width: 58px;
  height: 58px;
  object-fit: contain;
  flex-shrink: 0;
}

.rail nav { display: flex; flex-direction: column; gap: 4px; }
.rail nav a {
  color: #d5dbe3;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}
.rail nav a.on, .rail nav a:hover { background: var(--rust); color: #fff; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.rail-foot a { color: #f3f5f8; text-decoration: none; }
.rail-foot span { color: #9aa3ad; }
.ghost { color: #9aa3ad !important; }

.stage { padding: 36px 44px 64px; max-width: 1180px; }

.pagehead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
}
.pagehead h1 { margin: 0; font-size: 36px; letter-spacing: -0.03em; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  color: var(--rust);
  margin: 0 0 6px;
  font-weight: 700;
}

.btn, button, .filter button {
  background: var(--rust);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover, button:hover { background: var(--rust-deep); color: #fff; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.home-head { align-items: center; }
.home-mark {
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.35));
}
.rail-mark {
  width: 72px;
  opacity: 0.7;
  margin-bottom: 10px;
  display: block;
}
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  font-family: "Source Sans 3", sans-serif;
}
.status-pending { background: #edf0f5; color: #1d3557; }
.status-approved { background: #e4efe8; color: #1b4332; }
.status-rejected { background: #f8e6e6; color: #8b1e1e; }
.badge-new {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--rust);
  color: #fff;
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: "Source Sans 3", sans-serif;
  font-weight: 700;
  vertical-align: middle;
}
.rows li.is-new, .table tr.is-new td {
  background: #f4f6f9;
}
.table tr.is-new td:first-child {
  box-shadow: inset 4px 0 0 var(--rust);
}
.stats article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.stats strong { display: block; font-size: 30px; }
.stats span { color: var(--ink-soft); font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 4px 8px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 16px 4px;
}
.panel-head h2 { margin: 0; font-size: 22px; }
.rows { list-style: none; margin: 0; padding: 8px 8px 16px; }
.rows li { padding: 10px 10px; border-top: 1px solid var(--paper-2); display: flex; }
.rows strong { display: block; }
.rows span, .subtle { color: var(--ink-soft); font-size: 13px; }
.empty { color: var(--ink-soft); padding: 16px !important; }

.filter { display: flex; gap: 8px; margin-bottom: 18px; }
.filter input, input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
.filter input { max-width: 420px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card.warn { border-color: var(--gold); background: #fff6e8; }
.card.status-admitted { border-top: 4px solid var(--rust); }
.card.status-updating { border-top: 4px solid var(--gold); }
.card.status-home, .card.status-discharged { border-top: 4px solid var(--moss); }
.lede-inline { margin: 8px 0 0; color: var(--ink-soft); max-width: 36em; }
.ghost.dark { color: var(--ink-soft) !important; }
.card header { display: flex; justify-content: space-between; gap: 8px; }
.card h2 { margin: 0 0 4px; font-size: 22px; }
.card em { color: var(--rust); font-style: normal; font-weight: 700; font-size: 12px; }
.meta { color: var(--ink-soft); margin: 0 0 8px; }
.facts { display: grid; gap: 6px; margin: 12px 0 0; }
.facts div { display: grid; grid-template-columns: 72px 1fr; gap: 8px; font-size: 14px; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; }
.notes { background: var(--paper-2); padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.actions, .form-actions { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.linkish {
  background: none; color: var(--rust-deep); padding: 0; font-weight: 600;
}
.inline { display: inline; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a {
  text-decoration: none;
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
}
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 14px; overflow: hidden; }
.table th { text-align: left; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--paper-2); vertical-align: top; }
.nowrap { white-space: nowrap; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 820px;
}
.form-grid .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.check { flex-direction: row; align-items: center; font-weight: 500; }
.check input { width: auto; }

.pill { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.pill.pending { color: #8a5a12; }
.pill.approved { color: var(--moss); }
.pill.rejected { color: var(--danger); }
.pill.new, .pill.urgent { color: var(--danger); }
.pill.in_progress, .pill.soon { color: #8a5a12; }
.pill.contacted, .pill.routine { color: var(--navy); }
.pill.follow_up { color: #8a5a12; }
.pill.closed { color: var(--moss); }

.choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}
.choice:has(input:checked) {
  border-color: var(--rust);
  background: #f8ecee;
}
.name-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.assign-form select { min-width: 160px; }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
  margin: 0 0 16px;
}
.facts div { margin: 0; }
.facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.facts dd { margin: 2px 0 0; }
.request-body {
  white-space: pre-wrap;
  margin: 0;
  padding: 12px 14px;
  background: var(--paper);
  border-radius: 8px;
}
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 12px 0; border-bottom: 1px solid var(--paper-2); }
.timeline li:last-child { border-bottom: 0; }
.timeline p { margin: 6px 0 0; white-space: pre-wrap; }

.flash { padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; }
.flash.ok { background: #e4efe8; color: var(--ok); }
.flash.error { background: #f8e4de; color: var(--danger); }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
  background: #07090c;
}
.gate-mark {
  position: absolute;
  width: min(720px, 90vw);
  opacity: 0.18;
  pointer-events: none;
}
.gate-patch {
  display: block;
  width: 132px;
  margin: 0 auto 16px;
}
.gate-patch.small { width: 88px; }
.gate-card {
  position: relative;
  width: min(460px, 100%);
  background: #ffffff;
  border: 1px solid #c8d0da;
  border-top: 6px solid var(--rust);
  border-radius: 16px;
  padding: 28px 32px 32px;
  box-shadow: var(--shadow);
}
.file-list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.file-list li { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--paper-2); }
.file-list li:last-child { border-bottom: 0; }
.file-list span { display: flex; gap: 12px; }
.gate-card h1 { margin: 0 0 8px; font-size: 34px; }
.lede { color: var(--ink-soft); margin-top: 0; }
.stack { display: grid; gap: 14px; }
.hint { font-size: 13px; color: var(--ink-soft); }
.legal-notice {
  margin: 16px 0 0;
  padding: 12px 12px 10px;
  border-top: 3px solid var(--rust);
  background: #f4f6f9;
  color: #2a3138;
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
}
.viewer {
  width: 100%;
  min-height: 78vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.viewer-frame { margin: 0; }
.viewer-frame img,
.viewer-frame video {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { flex-direction: row; flex-wrap: wrap; align-items: center; position: static; height: auto; overflow: visible; }
  .rail nav { flex-direction: row; flex-wrap: wrap; }
  .rail-foot { margin: 0; width: 100%; flex-direction: row; gap: 12px; }
  .stage { padding: 24px 18px 48px; }
  .stats, .stats-3, .grid-2, .form-grid, .facts, .name-fields { grid-template-columns: 1fr; }
  .pagehead h1 { font-size: 28px; }
}


.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -8px 0 16px; color: var(--ink-soft); font-size: 14px; }
.crumbs a { text-decoration: none; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.folder-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.folder-card a { text-decoration: none; color: var(--ink); }
.folder-card strong { display: block; }
.folder-card span { color: var(--ink-soft); font-size: 12px; }
.folder-create input { max-width: 280px; }

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.bulk-bar button { background: var(--navy); }
.bulk-bar button:hover { background: #0b0f14; }
.bulk-bar .check { font-weight: 600; margin-right: 8px; }

.office-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px 28px 32px;
  max-width: 900px;
}
.office-preview h1, .office-preview h2, .office-preview h3 { margin: 0 0 10px; }
.office-preview p { margin: 0 0 10px; }
.office-slide {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}
.office-slide:first-child { border-top: 0; padding-top: 0; }
.office-slide h3 { color: var(--ink-soft); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }

.week-panel { margin-bottom: 28px; }
.cal-day { margin-bottom: 22px; }
.cal-day h2 { font-size: 16px; margin: 0 0 8px; color: var(--ink-soft); }

.month-cal { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.month-head, .month-week { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-head span {
  background: var(--navy);
  color: #fff;
  text-align: center;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 8px 4px;
}
.month-day {
  min-height: 110px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 6px 6px 8px;
  background: #fff;
}
.month-week .month-day:nth-child(7n) { border-right: 0; }
.month-day.out { background: #f4f6f9; color: #8b939c; }
.month-day.today { box-shadow: inset 0 3px 0 var(--rust); }
.month-num { display: block; font-weight: 700; margin-bottom: 4px; }
.month-event {
  margin: 0 0 4px;
  padding: 3px 5px;
  border-radius: 4px;
  background: #e8eef5;
  color: var(--navy);
  font-size: 11px;
  line-height: 1.25;
}
.month-event em { font-style: normal; color: var(--rust); display: block; }
@media (max-width: 900px) {
  .month-day { min-height: 84px; font-size: 12px; }
  .month-event { font-size: 10px; }
}
