:root {
  color-scheme: light;
  --paper: #f5f3ee;
  --paper-strong: #ffffff;
  --ink: #20272b;
  --ink-muted: #657076;
  --line: #d8d3c9;
  --blue: #285f88;
  --green: #49745a;
  --ochre: #b57933;
  --red: #923d42;
  --shadow: 0 18px 44px rgba(28, 34, 38, 0.13);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  background:
    linear-gradient(90deg, rgba(32, 39, 43, 0.82), rgba(32, 39, 43, 0.45)),
    url("/assets/ready-room.png") center / cover;
}

.login-panel {
  width: min(520px, calc(100vw - 32px));
  margin: auto;
  padding: 36px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.roundel {
  width: 52px;
  height: 52px;
  display: block;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.2));
}

.brand-text strong,
.brand-text span {
  display: block;
}

.brand-text strong {
  font-size: 18px;
}

.brand-text span {
  color: var(--ink-muted);
  font-size: 13px;
}

.login-panel h1 {
  margin: 30px 0 10px;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

.login-panel p {
  color: var(--ink-muted);
  margin: 0 0 22px;
}

.login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  transition: grid-template-columns 0.18s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  background: #22292d;
  color: #f7f1e4;
  position: sticky;
  top: 0;
}

.sidebar-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
}

.sidebar .brand-text span {
  color: rgba(247, 241, 228, 0.68);
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: rgba(247, 241, 228, 0.82);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 800;
}

.sidebar-toggle:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-list {
  display: grid;
  gap: 8px;
  margin: 34px 0 0;
}

.nav-link {
  width: 100%;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 0;
  border-radius: 7px;
  color: rgba(247, 241, 228, 0.8);
  background: transparent;
  text-align: left;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.nav-glyph {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 700;
}

.sidebar-collapsed .sidebar {
  padding-left: 12px;
  padding-right: 12px;
}

.sidebar-collapsed .sidebar-top {
  grid-template-columns: 1fr;
  justify-items: center;
}

.sidebar-collapsed .brand-lockup {
  justify-content: center;
}

.sidebar-collapsed .roundel {
  width: 42px;
  height: 42px;
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sidebar-collapsed .nav-list {
  margin-top: 24px;
}

.sidebar-collapsed .nav-link {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 0;
  padding: 11px 8px;
}

.sidebar-collapsed .nav-glyph {
  width: 34px;
  height: 34px;
}

.content {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 28px;
  background: rgba(245, 243, 238, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.main {
  padding: 28px;
  display: grid;
  gap: 22px;
  align-content: start;
}

.masthead {
  min-height: 236px;
  display: grid;
  align-items: end;
  padding: 26px;
  background:
    linear-gradient(180deg, rgba(32, 39, 43, 0.12), rgba(32, 39, 43, 0.82)),
    url("/assets/ready-room.png") center / cover;
  color: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.masthead h2 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.05;
  letter-spacing: 0;
}

.masthead p {
  max-width: 680px;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.8);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.stat-card,
.panel {
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(28, 34, 38, 0.06);
  min-width: 0;
}

.stat-card {
  min-height: 110px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.stat-label {
  color: var(--ink-muted);
  font-size: 13px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0;
}

.panel {
  padding: 20px;
}

.panel-header,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
}

.panel-header p {
  margin: 3px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.button,
.ghost-button,
.danger-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  padding: 0 14px;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.button {
  color: #ffffff;
  background: var(--blue);
}

.button:hover {
  background: #1f4f73;
}

.ghost-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.ghost-button:hover {
  border-color: #b9b1a2;
}

.danger-button {
  color: #ffffff;
  background: var(--red);
}

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 13px;
  color: var(--ink-muted);
}

.field > span {
  font-size: 13px;
  color: var(--ink-muted);
}

.field input,
.field select,
.field textarea,
.search-input,
.inline-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.inline-input {
  min-width: 180px;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1040px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--ink-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.secondary-line {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 12px;
}

.status-pill,
.confidence-pill,
.role-pill,
.lead-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-active,
.confidence-high,
.confidence-manual,
.lead-pill,
.role-pilot {
  background: rgba(73, 116, 90, 0.14);
  color: #315d43;
}

.status-pending {
  background: rgba(181, 121, 51, 0.18);
  color: #80541f;
}

.status-reserve,
.confidence-medium,
.role-crew {
  background: rgba(181, 121, 51, 0.16);
  color: #80541f;
}

.role-controller {
  background: rgba(40, 95, 136, 0.14);
  color: #204d70;
}

.status-leave,
.status-training {
  background: rgba(40, 95, 136, 0.14);
  color: #204d70;
}

.role-member {
  background: rgba(63, 57, 49, 0.1);
  color: #50483e;
}

.status-retired,
.confidence-low {
  background: rgba(146, 61, 66, 0.13);
  color: #7f3035;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 28px;
  border: 2px dashed #b9b1a2;
  border-radius: 8px;
  background: #fbfaf7;
  text-align: center;
}

.drop-zone.dragging {
  border-color: var(--green);
  background: rgba(73, 116, 90, 0.08);
}

.drop-zone input {
  margin-top: 14px;
}

.file-picker-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-action {
  background: #f3f0e8;
}

.attendance-workbench {
  display: grid;
  gap: 18px;
  align-items: start;
}

.attendance-side {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.attendance-sheet-panel {
  min-width: 0;
}

.import-launch-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.import-launch-panel h2 {
  margin: 0;
}

.import-launch-panel p {
  max-width: 740px;
  margin: 3px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.import-launch-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.workflow-steps {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.workflow-step.active {
  border-color: rgba(73, 116, 90, 0.42);
  background: rgba(73, 116, 90, 0.08);
}

.workflow-number {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 800;
}

.workflow-step strong,
.workflow-step span {
  display: block;
}

.workflow-step span {
  color: var(--ink-muted);
  font-size: 13px;
}

.import-review-form {
  display: grid;
  gap: 16px;
}

.manual-controller-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(40, 95, 136, 0.24);
  border-radius: 8px;
  background: #f7fafb;
}

.manual-controller-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.manual-controller-heading h3 {
  margin: 0;
  font-size: 16px;
}

.manual-controller-heading p {
  margin: 3px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.switch-control input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #c8c1b4;
  transition: background 0.15s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(22, 25, 28, 0.18);
  transition: transform 0.15s ease;
}

.switch-control input:checked + .switch-track {
  background: #285f88;
}

.switch-control input:checked + .switch-track::after {
  transform: translateX(18px);
}

.manual-controller-body {
  display: grid;
  gap: 12px;
}

.manual-controller-body[hidden],
.manual-controller-row[hidden] {
  display: none !important;
}

.controller-count-field {
  max-width: 220px;
}

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

.review-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.review-summary .stat-card {
  min-height: 82px;
  padding: 12px;
}

.review-summary .stat-value {
  font-size: 24px;
}

.pilot-review-list {
  display: grid;
  gap: 12px;
  max-height: min(58vh, 720px);
  overflow: auto;
  padding-right: 4px;
}

.pilot-review-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.review-row-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.review-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 0.92fr) minmax(0, 1.18fr);
  gap: 10px;
}

.flight-lead-control {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(73, 116, 90, 0.24);
  border-radius: 7px;
  background: rgba(73, 116, 90, 0.07);
}

.flight-lead-control input {
  margin-top: 3px;
}

.flight-lead-control strong,
.flight-lead-control small {
  display: block;
}

.flight-lead-control small {
  color: var(--ink-muted);
}

.validation-panel {
  border-color: rgba(40, 95, 136, 0.28);
}

.validation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

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

.member-open-button {
  max-width: 220px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  text-align: left;
}

.member-open-button:hover {
  text-decoration: underline;
}

.member-open-button.secondary {
  color: var(--ink);
}

.tag-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.airframe-tag {
  min-height: 26px;
  max-width: 150px;
  padding: 0 9px;
  border: 1px solid rgba(40, 95, 136, 0.2);
  border-radius: 999px;
  background: rgba(40, 95, 136, 0.08);
  color: #204d70;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.airframe-tag:hover {
  background: rgba(40, 95, 136, 0.14);
}

.validation-table {
  min-width: 980px;
}

.identity-audit {
  margin-bottom: 18px;
}

.identity-table {
  min-width: 820px;
}

.mission-list {
  display: grid;
  max-height: min(70vh, 760px);
  overflow: auto;
}

.mission-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

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

.mission-row:hover,
.mission-row.active {
  background: #f6f2ea;
}

.mission-row.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.mission-row strong {
  display: block;
}

.muted {
  color: var(--ink-muted);
}

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

.dashboard-wide {
  grid-column: 1 / -1;
}

.trend-list,
.leaderboard-list {
  display: grid;
  gap: 10px;
}

.trend-row,
.leaderboard-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 243, 238, 0.58);
}

.trend-row {
  grid-template-columns: minmax(190px, 1.3fr) minmax(160px, 2fr) repeat(3, minmax(72px, auto));
}

.leaderboard-row {
  grid-template-columns: 34px minmax(0, 1fr) auto;
}

.warning-row {
  border-color: rgba(146, 61, 66, 0.28);
  background: rgba(146, 61, 66, 0.05);
}

.rank-number {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(40, 95, 136, 0.1);
  color: var(--blue);
  font-weight: 800;
  font-size: 12px;
}

.trend-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(40, 95, 136, 0.12);
  overflow: hidden;
}

.trend-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.trend-stat {
  text-align: right;
}

.trend-stat strong,
.trend-stat span {
  display: block;
}

.trend-stat span {
  color: var(--ink-muted);
  font-size: 12px;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--ink-muted);
  background: #fbfaf7;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 28, 31, 0.52);
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 0 16px;
}

.modal-titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.modal-titlebar h2 {
  margin: 0;
}

.modal-titlebar p {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.compact-button {
  min-height: 34px;
  padding: 0 11px;
}

.import-modal {
  width: min(1180px, calc(100vw - 36px));
  height: min(880px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
}

.import-modal-body {
  min-height: 0;
  overflow: auto;
  padding: 20px 22px 22px;
}

.import-modal .review-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.import-modal .pilot-review-list {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.import-modal .validation-actions {
  position: sticky;
  bottom: -22px;
  padding: 14px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #ffffff 35%);
}

.dossier-modal {
  width: min(1180px, calc(100vw - 36px));
  height: min(900px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
  background: #f7f4ec;
}

.dossier-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 3px double #8f8778;
  background: #fffdf8;
}

.personnel-file {
  position: relative;
  isolation: isolate;
  border-radius: 10px 10px 7px 7px;
  background: #c9ad76;
  box-shadow:
    0 34px 90px rgba(20, 16, 10, 0.42),
    inset 0 0 0 1px rgba(93, 69, 35, 0.3);
}

.file-folder-tab {
  position: absolute;
  top: 0;
  left: 34px;
  z-index: 3;
  transform: translateY(-72%);
  min-width: 260px;
  padding: 10px 18px 13px;
  border: 1px solid #9d7c44;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, #d9bf86, #c8a664);
  box-shadow: 0 -8px 22px rgba(28, 20, 10, 0.16);
}

.file-folder-tab span,
.file-folder-tab strong {
  display: block;
  color: #3d2f1b;
}

.file-folder-tab span {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.file-folder-tab strong {
  margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.personnel-file::before {
  content: "";
  position: absolute;
  inset: 64px 12px 10px;
  z-index: -1;
  border-radius: 8px;
  background: rgba(80, 56, 25, 0.18);
  transform: rotate(-0.4deg);
}

.personnel-file .dossier-file-header {
  margin: 14px 14px 0;
  border: 1px solid #9f8d70;
  border-bottom: 3px double #6d604b;
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(90deg, rgba(146, 61, 66, 0.08), transparent 34%),
    repeating-linear-gradient(0deg, rgba(37, 31, 22, 0.035) 0 1px, transparent 1px 5px),
    #f8f1df;
}

.dossier-agency em {
  display: block;
  margin-top: 4px;
  color: #7b6d58;
  font-size: 12px;
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.personnel-file .dossier-body {
  margin: 0 14px 14px;
  border: 1px solid #9f8d70;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background:
    radial-gradient(circle at 12% 8%, rgba(146, 61, 66, 0.07), transparent 22%),
    linear-gradient(90deg, rgba(111, 78, 38, 0.08) 0 38px, transparent 38px),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(45, 38, 28, 0.045) 31px 32px),
    #f3ead8;
}

.personnel-page,
.file-page {
  position: relative;
  border-radius: 2px;
  background:
    linear-gradient(90deg, rgba(146, 61, 66, 0.08) 0 34px, transparent 34px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0)),
    #fff9ea;
  box-shadow:
    0 12px 24px rgba(55, 39, 18, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.personnel-page::before,
.file-page::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 34px;
  border-left: 2px solid rgba(146, 61, 66, 0.26);
}

.personnel-page {
  grid-template-columns: 190px minmax(0, 1fr);
  padding-left: 52px;
}

.file-page {
  padding-left: 52px;
}

.dossier-paperclip {
  position: absolute;
  top: -12px;
  left: 82px;
  width: 52px;
  height: 92px;
  border: 5px solid rgba(87, 82, 73, 0.46);
  border-bottom-color: transparent;
  border-radius: 26px 26px 18px 18px;
  transform: rotate(-9deg);
  pointer-events: none;
}

.personnel-photo-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 14px 12px 12px;
  border: 1px solid #b8a98f;
  background: #ece4d4;
  box-shadow: 0 5px 14px rgba(45, 34, 18, 0.12);
  transform: rotate(-0.5deg);
}

.photo-label,
.photo-caption,
.file-eyebrow,
.section-tab {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.photo-label {
  color: #6d604b;
  font-size: 10px;
}

.photo-caption {
  color: #923d42;
  font-size: 11px;
}

.personnel-photo-card .dossier-avatar {
  width: 112px;
  height: 132px;
  border: 1px solid #847965;
  border-radius: 2px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.12), transparent),
    #d7d0c2;
  font-size: 52px;
}

.file-eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  color: #923d42;
  font-size: 11px;
}

.classification-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.classification-strip span {
  padding: 5px 8px;
  border: 1px solid #b8a98f;
  background: rgba(255, 255, 255, 0.44);
  color: #5e523f;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.personnel-file .dossier-stamp {
  top: 22px;
  right: 26px;
  padding: 7px 12px;
  border-width: 3px;
  opacity: 0.78;
  transform: rotate(4deg);
}

.section-tab {
  position: absolute;
  top: -13px;
  left: 64px;
  padding: 5px 10px;
  border: 1px solid #b8a98f;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: #e4d8be;
  color: #5e523f;
  font-size: 10px;
}

.personnel-file .dossier-facts,
.personnel-file .dossier-notes {
  grid-column: 1 / -1;
}

.personnel-file .dossier-facts,
.personnel-file .dossier-stat,
.personnel-file .attendance-chart,
.personnel-file .dossier-record-table,
.personnel-file .dossier-notes {
  border-color: #b8a98f;
  background: rgba(255, 253, 248, 0.72);
}

.dossier-agency {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dossier-roundel {
  width: 58px;
  height: 58px;
  display: block;
  border-radius: 50%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.24));
}

.dossier-agency span,
.dossier-agency strong,
.dossier-file-meta span,
.dossier-file-meta strong {
  display: block;
}

.dossier-agency span,
.dossier-file-meta span {
  color: #6c6254;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dossier-agency strong {
  margin-top: 2px;
  color: #20272b;
  font-size: 24px;
  line-height: 1.05;
  text-transform: uppercase;
}

.dossier-file-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  text-align: right;
}

.dossier-file-meta strong {
  color: #923d42;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  letter-spacing: 0.04em;
}

.dossier-body {
  min-height: 0;
  overflow: auto;
  padding: 22px;
  display: grid;
  gap: 18px;
  background:
    linear-gradient(90deg, rgba(32, 39, 43, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(32, 39, 43, 0.03) 1px, transparent 1px),
    #f7f4ec;
  background-size: 26px 26px;
}

.dossier-cover,
.dossier-section {
  border: 1px solid #c7bda9;
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 10px 24px rgba(28, 34, 38, 0.08);
}

.dossier-cover {
  position: relative;
  display: grid;
  grid-template-columns: minmax(230px, 0.44fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 22px;
}

.dossier-section {
  padding: 18px;
}

.dossier-stamp {
  position: absolute;
  top: 16px;
  right: 20px;
  padding: 5px 9px;
  border: 2px solid rgba(146, 61, 66, 0.72);
  border-radius: 4px;
  color: #923d42;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(1deg);
}

.dossier-member-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.dossier-member-heading h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dossier-member-heading p {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.dossier-avatar {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 2px solid #8f8778;
  border-radius: 6px;
  background: #f3f0e8;
  color: #20272b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 28px;
  font-weight: 800;
}

.dossier-facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid #c7bda9;
  border-radius: 6px;
  overflow: hidden;
}

.dossier-facts div {
  min-height: 76px;
  padding: 12px;
  border-right: 1px solid #d7cdbb;
  border-bottom: 1px solid #d7cdbb;
  background: #fffdf8;
}

.dossier-facts div:nth-child(5n) {
  border-right: 0;
}

.dossier-facts div:nth-last-child(-n + 5) {
  border-bottom: 0;
}

.dossier-facts dt {
  color: #6c6254;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dossier-facts dd {
  margin: 7px 0 0;
  font-weight: 800;
}

.dossier-facts .tag-list {
  gap: 4px;
}

.dossier-notes {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid #d7cdbb;
  border-radius: 6px;
  background: #fffdf8;
}

.dossier-notes strong {
  display: block;
  color: #6c6254;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dossier-notes p {
  margin: 6px 0 0;
}

.dossier-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.dossier-section-heading h3,
.dossier-section-heading p {
  margin: 0;
}

.dossier-section-heading h3 {
  color: #20272b;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dossier-section-heading p {
  color: var(--ink-muted);
  font-size: 13px;
}

.range-control {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.range-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #c7bda9;
  border-radius: 5px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.range-button:hover,
.range-button.active {
  border-color: rgba(40, 95, 136, 0.36);
  background: rgba(40, 95, 136, 0.1);
  color: #204d70;
}

.dossier-stat-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.dossier-stat {
  min-height: 76px;
  padding: 13px;
  border: 1px solid #c7bda9;
  border-radius: 6px;
  background: #fffdf8;
}

.dossier-stat span,
.dossier-stat strong {
  display: block;
}

.dossier-stat span {
  color: #6c6254;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dossier-stat strong {
  margin-top: 4px;
  font-size: 24px;
}

.attendance-chart {
  border: 1px solid #c7bda9;
  border-radius: 6px;
  background: #fffdf8;
  overflow: hidden;
}

.attendance-chart svg {
  width: 100%;
  min-height: 220px;
  display: block;
}

.attendance-chart rect {
  fill: var(--green);
}

.attendance-chart line {
  stroke: #b9b1a2;
  stroke-width: 1;
}

.attendance-chart text {
  fill: var(--ink-muted);
  font-size: 12px;
}

.dossier-record-table {
  overflow: auto;
  border: 1px solid #c7bda9;
  border-radius: 6px;
}

.dossier-record-table table {
  min-width: 1120px;
  border: 0;
}

.dossier-record-table th {
  background: #e9e2d5;
  color: #423b31;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dossier-record-table td,
.dossier-record-table th {
  border-bottom-color: #d7cdbb;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 8px;
  color: #ffffff;
  background: #22292d;
  box-shadow: var(--shadow);
}

.toast.error {
  background: var(--red);
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    min-height: auto;
    position: static;
  }

  .sidebar-collapsed .sidebar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .sidebar-collapsed .sidebar-top {
    grid-template-columns: minmax(0, 1fr) 34px;
    justify-items: stretch;
  }

  .sidebar-collapsed .brand-lockup {
    justify-content: flex-start;
  }

  .sidebar-collapsed .roundel {
    width: 52px;
    height: 52px;
  }

  .sidebar-collapsed .brand-text,
  .sidebar-collapsed .nav-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 22px;
  }

  .sidebar-collapsed .nav-list {
    margin-top: 22px;
  }

  .sidebar-collapsed .nav-link {
    grid-template-columns: 26px minmax(0, 1fr);
    justify-items: stretch;
    gap: 10px;
    padding: 11px 12px;
  }

  .sidebar-collapsed .nav-glyph {
    width: 26px;
    height: 26px;
  }

  .stats-grid,
  .split-grid,
  .dashboard-grid,
  .attendance-workbench,
  .attendance-side,
  .dossier-cover,
  .dossier-facts,
  .dossier-stat-grid {
    grid-template-columns: 1fr;
  }

  .dossier-facts div,
  .trend-row {
    grid-template-columns: 1fr;
  }

  .trend-stat {
    text-align: left;
  }

  .dossier-facts div:nth-child(5n) {
    border-right: 0;
    border-bottom: 1px solid #d7cdbb;
  }

  .dossier-facts div:last-child {
    border-bottom: 0;
  }

  .range-control {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .main,
  .topbar,
  .sidebar {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .stats-grid,
  .field-grid,
  .nav-list,
  .review-summary,
  .review-grid,
  .manual-controller-grid {
    grid-template-columns: 1fr;
  }

  .import-launch-panel,
  .modal-titlebar,
  .dossier-file-header,
  .dossier-file-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .dossier-file-meta {
    text-align: left;
  }

  .dossier-agency strong {
    font-size: 20px;
  }

  .import-modal {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .dossier-modal {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .import-modal .review-summary {
    grid-template-columns: 1fr;
  }

  .manual-controller-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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