:root {
  color-scheme: light;
  --navy: #0c2440;
  --navy-2: #173958;
  --copper: #b4673d;
  --copper-soft: #f1d7c4;
  --cream: #f5efe5;
  --paper: #fffdf9;
  --ink: #1c2733;
  --muted: #697586;
  --line: #e5ddd1;
  --success: #18724a;
  --danger: #a63a36;
  --shadow: 0 24px 70px rgba(12, 36, 64, .13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: #f5f3ef;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--navy); font-family: Georgia, "Times New Roman", serif; }

.eyebrow {
  margin-bottom: 6px;
  color: var(--copper);
  font-size: .73rem;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

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

.auth-layout {
  display: grid;
  grid-template-columns: minmax(390px, 1.08fr) minmax(420px, .92fr);
  min-height: 100vh;
  background: var(--paper);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px clamp(32px, 7vw, 110px);
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 20% 20%, rgba(180, 103, 61, .32), transparent 30rem),
    linear-gradient(145deg, #071a30, var(--navy-2));
}

.auth-logo {
  width: min(360px, 74%);
  height: auto;
  margin-bottom: 24px;
  filter: drop-shadow(0 20px 32px rgba(0, 0, 0, .25));
}

.auth-kicker { margin-bottom: 12px; color: #f1c49c; font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.auth-brand h1 { max-width: 620px; margin-bottom: 15px; color: #fff7eb; font-size: clamp(2.2rem, 4vw, 4.4rem); line-height: 1.02; }
.auth-brand > p:last-child { color: #dbe5ef; font-size: 1.04rem; }
.compact-brand .auth-logo { width: min(430px, 78%); }

.auth-panel {
  display: grid;
  place-items: center;
  padding: 36px;
  background:
    radial-gradient(circle at 90% 10%, rgba(180, 103, 61, .14), transparent 25rem),
    var(--cream);
}

.auth-card {
  display: grid;
  gap: 19px;
  width: min(450px, 100%);
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid rgba(229, 221, 209, .9);
  border-radius: 30px;
  background: rgba(255, 253, 249, .96);
  box-shadow: var(--shadow);
}

.auth-card h2 { margin-bottom: 10px; font-size: 2.15rem; }
.auth-card p { margin-bottom: 0; line-height: 1.55; }

label { display: grid; gap: 8px; color: var(--navy); font-size: .88rem; font-weight: 750; }
label small { color: var(--muted); font-weight: 500; }

input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  color: var(--ink);
  border: 1px solid #cfc8bd;
  border-radius: 12px;
  outline: none;
  background: #fff;
  transition: border-color .16s, box-shadow .16s;
}

textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--copper); box-shadow: 0 0 0 4px rgba(180, 103, 61, .13); }
input:disabled, select:disabled, textarea:disabled { color: #7d8791; background: #f1f1ef; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 800;
  transition: transform .15s, background .15s, box-shadow .15s;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .56; transform: none; }
.button-primary { color: #fff; background: var(--navy); box-shadow: 0 9px 20px rgba(12, 36, 64, .16); }
.button-primary:hover { background: #153858; }
.button-ghost { color: var(--navy); border-color: var(--line); background: #fff; }
.button-text { color: var(--navy); background: transparent; }
.button-wide { width: 100%; }

.form-error { padding: 10px 12px; color: var(--danger); border-radius: 10px; background: #fdecea; font-size: .85rem; }
.version-note { text-align: center; color: var(--muted); font-size: .76rem; }

.app-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 16px;
  color: #fff;
  background: var(--navy);
  box-shadow: 10px 0 30px rgba(12, 36, 64, .08);
  z-index: 5;
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 23px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-brand img { width: 62px; height: 62px; object-fit: contain; }
.sidebar-brand div { display: grid; gap: 2px; }
.sidebar-brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; }
.sidebar-brand span { color: #b9c8d8; font-size: .7rem; }
.sidebar nav { display: grid; gap: 7px; padding-top: 24px; }

.nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  color: #cfdae5;
  border: 0;
  border-radius: 12px;
  text-align: left;
  background: transparent;
  font-weight: 700;
}
.nav-button span { width: 20px; font-size: 1.2rem; text-align: center; }
.nav-button:hover, .nav-button.active { color: #fff; background: rgba(255,255,255,.1); }
.nav-button.active { box-shadow: inset 3px 0 var(--copper); }

.sidebar-footer { display: grid; gap: 14px; margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar .button-ghost { color: #fff; border-color: rgba(255,255,255,.17); background: rgba(255,255,255,.06); }
.user-mini { display: flex; align-items: center; gap: 10px; }
.user-mini > span { display: grid; place-items: center; width: 38px; height: 38px; color: var(--navy); border-radius: 50%; background: #f2c6a1; font-size: .78rem; font-weight: 850; }
.user-mini div { display: grid; min-width: 0; }
.user-mini strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.user-mini small { color: #aebed0; font-size: .7rem; text-transform: capitalize; }

.content { min-width: 0; padding: 28px clamp(20px, 4vw, 58px) 54px; background: #f5f3ef; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 30px; }
.topbar h1 { margin: 0; font-size: clamp(1.8rem, 3.4vw, 2.7rem); }
.topbar .eyebrow { margin-bottom: 3px; }
.health { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; color: var(--success); border-radius: 999px; background: #e4f4eb; font-size: .78rem; font-weight: 800; }
.health i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(24,114,74,.11); }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--navy); border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 1.25rem; }
#mobile-menu { display: none; }

.page { animation: reveal .2s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }

.welcome-card {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 245px;
  padding: clamp(28px, 5vw, 48px);
  overflow: hidden;
  color: #e6eef6;
  border-radius: 26px;
  background: linear-gradient(120deg, var(--navy), #183e61);
  box-shadow: 0 18px 45px rgba(12, 36, 64, .15);
}
.welcome-card > div { position: relative; max-width: 660px; z-index: 1; }
.welcome-card h2 { margin-bottom: 14px; color: #fff7eb; font-size: clamp(2rem, 4vw, 3.15rem); }
.welcome-card p:last-child { max-width: 600px; margin-bottom: 0; line-height: 1.65; }
.welcome-card img { position: absolute; right: -38px; width: 320px; opacity: .16; transform: rotate(-7deg); }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-top: 18px; }
.summary-card { display: flex; gap: 14px; padding: 21px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.summary-card div { display: grid; align-content: start; }
.summary-card small { margin-bottom: 5px; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.summary-card strong { color: var(--navy); font-size: .96rem; }
.summary-card p { margin: 7px 0 0; color: var(--muted); font-size: .79rem; line-height: 1.45; }
.summary-icon { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; color: var(--success); border-radius: 12px; background: #e4f4eb; font-weight: 900; }
.summary-icon.copper { color: var(--copper); background: #f6e7dc; }
.summary-icon.pale { color: var(--navy); background: #e7edf3; }

.roadmap-card { margin-top: 18px; padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); }
.roadmap-card h2 { margin-bottom: 0; font-size: 1.55rem; }
.roadmap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px 0 0; padding: 0; list-style: none; }
.roadmap li { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: #f5f3ef; }
.roadmap li > span { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; color: #fff; border-radius: 50%; background: var(--copper); font-size: .78rem; font-weight: 900; }
.roadmap li.roadmap-done { background: #eaf5ef; }
.roadmap li.roadmap-done > span { background: var(--success); }
.roadmap li div { display: grid; }
.roadmap strong { color: var(--navy); font-size: .85rem; }
.roadmap small { color: var(--muted); font-size: .72rem; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin-bottom: 7px; font-size: clamp(1.65rem, 3vw, 2.2rem); }
.section-heading p:last-child { margin-bottom: 0; }
.heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.panel { padding: clamp(20px, 4vw, 32px); border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 10px 30px rgba(12, 36, 64, .05); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.span-two { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding-top: 4px; }

.table-wrap { overflow-x: auto; padding: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 13px; border-bottom: 1px solid #eee8df; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .69rem; letter-spacing: .07em; text-transform: uppercase; }
td { font-size: .86rem; }
tbody tr:last-child td { border-bottom: 0; }
.identity { display: grid; gap: 2px; }
.identity strong { color: var(--navy); }
.identity small { color: var(--muted); }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: var(--navy); background: #e7edf3; font-size: .7rem; font-weight: 800; text-transform: capitalize; }
.badge.success { color: var(--success); background: #e4f4eb; }
.badge.off { color: #7b4d4b; background: #f5e8e6; }
.table-actions { display: flex; justify-content: flex-end; gap: 7px; }
.small-button { min-height: 34px; padding: 6px 9px; color: var(--navy); border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: .72rem; font-weight: 800; }

.staff-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.staff-stats article { display: grid; gap: 3px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.staff-stats small { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.staff-stats strong { color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; }
.staff-toolbar { display: grid; grid-template-columns: minmax(240px, 1.4fr) repeat(2, minmax(170px, .7fr)); gap: 15px; margin-bottom: 14px; padding: 18px; }
.staff-table-panel { padding: 8px; }
.contact-cell { display: grid; gap: 3px; }
.contact-cell small { color: var(--muted); overflow-wrap: anywhere; }
.staff-note { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inactive-row { opacity: .7; }
.readonly-note { margin-bottom: 14px; padding: 12px 15px; color: var(--navy); border: 1px solid #d8e3ed; border-radius: 12px; background: #edf4f8; font-size: .84rem; }
.empty-state { margin: 0; padding: 34px 16px; color: var(--muted); text-align: center; }
.print-heading { display: none; }

.dialog { width: min(520px, calc(100% - 28px)); padding: 0; color: var(--ink); border: 0; border-radius: 22px; background: var(--paper); box-shadow: 0 28px 90px rgba(4, 20, 38, .3); }
dialog:not([open]) { display: none !important; }
.dialog::backdrop { background: rgba(5, 21, 37, .62); backdrop-filter: blur(3px); }
.dialog form, .secret-dialog[open] { display: grid; gap: 18px; padding: 26px; }
.staff-dialog { width: min(760px, calc(100% - 28px)); }
.staff-dialog form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.dialog-heading h2 { margin-bottom: 0; font-size: 1.65rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.check-label { display: flex; align-items: center; gap: 9px; }
.check-label input { width: 18px; min-height: 18px; }
.temporary-password { display: block; padding: 16px; overflow-wrap: anywhere; color: var(--navy); border: 1px dashed var(--copper); border-radius: 12px; background: #faf1ea; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.05rem; font-weight: 850; text-align: center; user-select: all; }

.toast { position: fixed; top: 18px; right: 18px; max-width: min(410px, calc(100% - 36px)); padding: 13px 17px; color: #fff; border-radius: 12px; background: var(--success); box-shadow: 0 12px 35px rgba(0,0,0,.2); font-size: .86rem; font-weight: 750; z-index: 50; }
.toast.error { background: var(--danger); }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: 1fr; }
  .roadmap { grid-template-columns: 1fr; }
  .staff-toolbar { grid-template-columns: 1fr 1fr; }
  .staff-toolbar label:first-child { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { min-height: 310px; padding: 28px 24px; }
  .auth-logo { width: 190px; margin-bottom: 10px; }
  .auth-brand h1 { font-size: 2.2rem; }
  .auth-panel { padding: 20px; }
  .auth-card { padding: 27px; }
  .compact-brand { display: none; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -290px; width: 270px; transition: left .2s; }
  .sidebar.open { left: 0; }
  #mobile-menu { display: grid; }
  .content { padding: 20px 16px 40px; }
  .topbar { justify-content: flex-start; }
  .topbar .health { margin-left: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; justify-content: flex-start; }
  .staff-dialog form { grid-template-columns: 1fr; }
  .staff-dialog .span-two { grid-column: auto; }
}

@media (max-width: 520px) {
  .auth-brand { min-height: 245px; }
  .auth-brand > p:last-child { display: none; }
  .auth-brand h1 { font-size: 1.75rem; }
  .auth-kicker { font-size: .65rem; }
  .health { display: none; }
  .welcome-card img { width: 220px; }
  .dialog-actions, .form-actions { align-items: stretch; flex-direction: column; }
  .table-actions { flex-direction: column; }
  .staff-stats, .staff-toolbar { grid-template-columns: 1fr; }
  .staff-toolbar label:first-child { grid-column: auto; }
  .heading-actions .button { width: 100%; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body.print-staff { min-width: 0; color: #111; background: #fff; }
  body.print-staff .sidebar,
  body.print-staff .topbar,
  body.print-staff .page:not(#page-staff),
  body.print-staff .no-print,
  body.print-staff .toast,
  body.print-staff dialog { display: none !important; }
  body.print-staff .app-layout,
  body.print-staff .content { display: block; min-height: 0; padding: 0; background: #fff; }
  body.print-staff #page-staff { display: block !important; animation: none; }
  body.print-staff .print-heading { display: flex; align-items: center; gap: 15px; margin-bottom: 8mm; padding-bottom: 5mm; border-bottom: 2px solid var(--navy); }
  body.print-staff .print-heading img { width: 27mm; height: 27mm; object-fit: contain; }
  body.print-staff .print-heading p { margin-bottom: 1mm; color: var(--copper); font-size: 8pt; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
  body.print-staff .print-heading h1 { margin-bottom: 1mm; font-size: 20pt; }
  body.print-staff .print-heading small { color: #555; font-size: 8pt; }
  body.print-staff .staff-table-panel { overflow: visible; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  body.print-staff .staff-table { table-layout: fixed; }
  body.print-staff .staff-table th,
  body.print-staff .staff-table td { padding: 3mm 2mm; border-color: #cfcfcf; font-size: 8.5pt; overflow-wrap: anywhere; }
  body.print-staff .staff-table th { font-size: 7pt; }
  body.print-staff .staff-table th:nth-child(1) { width: 24%; }
  body.print-staff .staff-table th:nth-child(2) { width: 17%; }
  body.print-staff .staff-table th:nth-child(3) { width: 14%; }
  body.print-staff .staff-table th:nth-child(4) { width: 9%; }
  body.print-staff .staff-table th:nth-child(5) { width: 25%; }
  body.print-staff .staff-table th:nth-child(6) { width: 11%; }
  body.print-staff .staff-note { max-width: none; white-space: normal; }
  body.print-staff .badge { padding: 1mm 2mm; color: #111; border: 1px solid #aaa; background: transparent; font-size: 7pt; }
  body.print-staff .inactive-row { opacity: 1; color: #666; }
}
