:root {
  --brand: #0f766e;
  --brand-dark: #0b5c56;
  --brand-light: #e6f4f2;
  --ink: #1f2933;
  --muted: #64748b;
  --border: #e2e8f0;
  --bg: #f7f6f3;
  --card: #ffffff;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --ok: #15803d;
  --gold: #b45309;
  --gold-bg: #fffbeb;
  --radius: 12px;
  /* Desktop shell — primary navigation is deep JTA green (the logo has
     dark-green/black lettering, so it stays on the light top bar rather
     than sitting on this). --gold-accent is a true metallic gold distinct
     from --warn/--gold above (which are really amber), used sparingly as a
     thin accent line, never a large surface. */
  --nav-bg: #0a3a35;
  --nav-bg-hover: #0f4a43;
  --nav-text: #d7ece9;
  --nav-text-muted: #8fb8b2;
  --nav-active-bg: #d7f2ec;
  --nav-active-text: #0b5c56;
  --gold-accent: #c9a961;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }

.brand-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: #fff; color: var(--ink); border-bottom: 3px solid var(--brand);
}
.brand-header .logo { font-weight: 800; letter-spacing: 0.5px; font-size: 18px; }
.brand-header .sub { font-size: 12px; color: var(--muted); }
.logo-img { height: 34px; width: auto; display: block; }
.ethos {
  font-size: 12px; color: var(--brand-dark); background: var(--brand-light);
  padding: 8px 14px; text-align: center; font-style: italic;
}

.container { max-width: 640px; margin: 0 auto; padding: 20px; }
.container.wide { max-width: 1080px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}

h1 { font-size: 28px; font-weight: 800; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 19px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 10px; color: var(--brand-dark); }
.hint { color: var(--muted); font-size: 13px; }
.step-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); margin-bottom: 6px; }

.progress-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 12px 0 20px; }
.progress-fill { height: 100%; background: var(--brand); transition: width 0.2s ease; }
.progress-label { font-size: 12px; color: var(--muted); text-align: right; margin-top: -14px; margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 22px; border-radius: 10px; border: none; font-size: 16px; font-weight: 700;
  cursor: pointer; background: var(--brand); color: #fff; min-height: 48px; text-decoration: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost { background: transparent; color: var(--brand); min-height: auto; padding: 8px 10px; font-size: 14px; }
.btn.danger { background: var(--danger); }
.btn.small { min-height: 36px; padding: 8px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; justify-content: space-between; margin-top: 20px; }

label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local],
select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
}
select { min-height: 48px; }
textarea { min-height: 90px; resize: vertical; }

.choice-group { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px; margin: 0;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 400;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.choice:hover { border-color: var(--brand); }
.choice.selected { border-color: var(--brand); background: var(--brand-light); font-weight: 600; }
.choice input { accent-color: var(--brand); pointer-events: none; }
.choice.big { padding: 18px 16px; font-size: 17px; font-weight: 700; }

.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .check-grid { grid-template-columns: 1fr; } }
.check-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 11px; margin: 0;
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-weight: 400; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.check-item.selected { border-color: var(--brand); background: var(--brand-light); }
.check-item input { accent-color: var(--brand); pointer-events: none; margin-top: 2px; }
.check-item.disabled { opacity: 0.4; cursor: not-allowed; }

.callout { border-radius: 8px; padding: 12px 14px; font-size: 13px; margin: 12px 0; }
.callout.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #fde68a; }
.callout.danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.callout.ok { background: #ecfdf5; color: var(--ok); border: 1px solid #bbf7d0; }
.callout.brand { background: var(--brand-light); color: var(--brand-dark); border: 1px solid #bfe4e0; }
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout li { margin-bottom: 3px; }

.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.badge.draft { background: #f1f5f9; color: #475569; }
.badge.open { background: #dcfce7; color: #166534; }
.badge.closed { background: #e2e8f0; color: #334155; }
.badge.upcoming { background: #fef3c7; color: #92400e; }
.badge.voted { background: #dcfce7; color: #166534; }
.badge.not-voted { background: #f1f5f9; color: #64748b; }
.badge.in_review { background: #fef3c7; color: #92400e; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.leaver { background: #fee2e2; color: #991b1b; }
.badge.active { background: #dcfce7; color: #166534; }
.badge.sent_to_accountant { background: var(--brand-light); color: var(--brand-dark); }
.badge.accountant_confirmed { background: #dcfce7; color: #166534; }
.badge.payslips_received { background: #e0e7ff; color: #3730a3; }
.badge.payslips_distributed { background: #dcfce7; color: #166534; }

/* --------------------------------------------------------- workflow stepper */
.stepper { display: flex; align-items: flex-start; overflow-x: auto; padding: 4px 0 8px; gap: 0; }
.step { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 84px; position: relative; }
.step:not(:last-child)::after {
  content: ""; position: absolute; top: 15px; left: calc(50% + 20px); right: calc(-50% + 20px);
  height: 2px; background: var(--border);
}
.step.done:not(:last-child)::after { background: var(--brand); }
.step-dot {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; background: #fff; border: 2px solid var(--border); color: var(--muted);
  z-index: 1; margin-bottom: 8px;
}
.step.done .step-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.current .step-dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-light); }
.step-label-sm { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; }
.step.done .step-label-sm, .step.current .step-label-sm { color: var(--ink); }

.attention-list { list-style: none; padding: 0; margin: 0; }
.attention-list li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.attention-list li:last-child { border-bottom: none; }
.attention-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.attention-dot.high { background: var(--danger); }
.attention-dot.medium { background: var(--warn); }
.attention-dot.low { background: var(--brand); }

.sticky-table thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.sticky-table .sticky-col { position: sticky; left: 0; background: var(--card); z-index: 2; }
.sticky-table thead th.sticky-col { z-index: 3; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px 16px;
  text-align: center; cursor: pointer; background: var(--card); transition: border-color 0.15s;
}
.dropzone.drag { border-color: var(--brand); background: var(--brand-light); }
.dropzone input[type=file] { display: none; }

.exception-list { list-style: none; padding: 0; margin: 0; }
.exception-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.exception-list li:last-child { border-bottom: none; }
.exception-tag { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: var(--warn-bg); color: var(--warn); margin-right: 6px; margin-bottom: 2px; }
.exception-tag.danger { background: var(--danger-bg); color: var(--danger); }
.exception-tag.notice { background: var(--bg); color: var(--muted); }

/* Filter bar — the one shared look for "search + filters" across Review,
   Employees, and Audit Log, so filtering feels the same everywhere. */
.filter-bar { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.filter-bar .filter-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.filter-bar .filter-row.cols-2 { grid-template-columns: 2fr 1fr; }
.filter-bar .filter-row.cols-4 { grid-template-columns: 2fr 1fr 1fr 1fr; }
@media (max-width: 720px) { .filter-bar .filter-row, .filter-bar .filter-row.cols-2, .filter-bar .filter-row.cols-4 { grid-template-columns: 1fr; } }
.filter-bar label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-bottom: 4px; }
.filter-bar .filter-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* Name cell — employee number + name + status badges stacked compactly,
   so the payroll grid's leftmost column carries more identity at a glance. */
.name-cell { display: flex; flex-direction: column; gap: 2px; }
.name-cell .emp-number { font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.03em; }
.name-cell .emp-name { font-weight: 700; }
.name-cell .badge { padding: 1px 8px; font-size: 9.5px; margin-top: 1px; align-self: flex-start; }

/* Summary strip — a slim, always-current orientation line above a data
   table, reflecting whatever filter is currently applied (not a fixed
   total), distinct from the fuller Totals breakdown card below the table. */
.summary-strip { display: flex; gap: 22px; flex-wrap: wrap; padding: 10px 16px; background: var(--brand-light); border: 1px solid #bfe4e0; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.summary-strip strong { color: var(--brand-dark); }

.data-grid tfoot td { position: sticky; bottom: 0; background: var(--nav-active-bg); font-weight: 800; border-top: 2px solid var(--brand); z-index: 1; }
.data-grid tfoot td.sticky-col { z-index: 2; }
.data-grid tfoot td.clickable { cursor: pointer; }
.data-grid tfoot td.clickable:hover { text-decoration: underline; }

/* Notification bell — topbar control, mirrors the sidebar badge pattern:
   a real, live count, never decorative. */
.notif-bell { position: relative; background: none; border: none; cursor: pointer; font-size: 19px; padding: 4px 6px; line-height: 1; }
.notif-bell .notif-count { position: absolute; top: -2px; right: -2px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; border-radius: 999px; padding: 1px 5px; min-width: 15px; text-align: center; }
.notif-panel { position: absolute; top: 54px; right: 24px; width: 360px; max-height: 70vh; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(15,23,42,0.18); z-index: 70; }
.notif-panel h3 { padding: 14px 16px 8px; margin: 0; font-size: 14px; }
.notif-panel .notif-item { padding: 10px 16px; border-top: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.notif-panel .notif-item:hover { background: var(--bg); }
.notif-panel .notif-item .notif-title { font-weight: 700; }
.notif-panel .notif-empty { padding: 16px; color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table-scroll { overflow-x: auto; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--brand);
  border-radius: var(--radius); padding: 18px 20px; transition: box-shadow 0.15s, transform 0.15s;
}
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { box-shadow: 0 4px 14px rgba(15,23,42,0.09); transform: translateY(-1px); }
.stat-card .num { font-size: 30px; font-weight: 800; color: var(--brand-dark); line-height: 1.1; }
.stat-card .label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.stat-card.large { padding: 24px 22px; border-top-width: 4px; }
.stat-card.large .num { font-size: 38px; }
.stat-card.large .label { font-size: 13.5px; }

.center-screen { min-height: 60vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-icon { font-size: 48px; margin-bottom: 8px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); padding: 20px; max-width: 480px; width: 100%; max-height: 85vh; overflow-y: auto; }

/* ---------------------------------------------------------- slide-over drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: flex; justify-content: flex-end; z-index: 60; }
.drawer {
  background: #fff; width: 460px; max-width: 92vw; height: 100%; overflow-y: auto;
  padding: 24px; box-shadow: -10px 0 28px rgba(15,23,42,0.18); animation: drawer-in 0.16s ease-out;
}
@keyframes drawer-in { from { transform: translateX(28px); opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }

/* ------------------------------------------------------------ data grid */
.data-grid th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.data-grid th.sortable:hover { color: var(--brand-dark); }
.data-grid tbody tr { cursor: pointer; }
.data-grid tbody tr:hover { background: var(--brand-light); }
.data-grid tbody tr:hover .sticky-col { background: var(--brand-light); }
.data-grid tbody tr.group-header-row { cursor: default; background: var(--bg); font-weight: 700; }
.data-grid tbody tr.group-header-row:hover { background: var(--bg); }
.data-grid tbody tr.group-header-row td { color: var(--brand-dark); padding-top: 12px; padding-bottom: 12px; }
.data-grid.compact th, .data-grid.compact td { padding: 5px 8px; font-size: 12.5px; }

.link-box { display: flex; gap: 8px; align-items: center; background: var(--brand-light); border-radius: 8px; padding: 10px 12px; font-size: 13px; word-break: break-all; }

footer.ethos-footer { text-align: center; padding: 20px; font-size: 12px; color: var(--muted); }

.reason-count { font-size: 12px; color: var(--muted); margin-top: 6px; }
.reason-count.limit { color: var(--warn); font-weight: 700; }

.winner-banner {
  background: linear-gradient(135deg, var(--gold-bg), #fff); border: 1px solid #fde68a; border-radius: var(--radius);
  padding: 22px; text-align: center; margin-bottom: 16px;
}
.winner-banner .trophy { font-size: 40px; }
.winner-banner .name { font-size: 24px; font-weight: 800; color: var(--brand-dark); margin: 6px 0 2px; }
.winner-banner .home { font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------- admin app */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: #fff; color: var(--ink);
  border-bottom: 3px solid var(--gold-accent); flex-wrap: wrap;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar .logo { font-weight: 800; letter-spacing: 0.5px; font-size: 18px; }
.topbar .sub { font-size: 13px; font-weight: 700; color: var(--brand-dark); text-transform: uppercase; letter-spacing: 0.4px; }
.topbar-status { display: flex; align-items: center; gap: 14px; font-size: 14px; }

.status-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--nav-bg); color: var(--nav-text); padding: 10px 20px; font-size: 13px; font-weight: 600;
  border-top: 1px solid var(--nav-bg-hover);
}
.status-bar-period { font-size: 15px; font-weight: 800; color: #fff; text-transform: uppercase; letter-spacing: 0.03em; }
.status-bar-version { color: var(--nav-text-muted); }

.command-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px;
}

.tab-nav { display: flex; gap: 2px; background: var(--card); border-bottom: 1px solid var(--border); padding: 0 20px; overflow-x: auto; }
.tab-btn {
  background: none; border: none; padding: 12px 14px; font-size: 14px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.tab-btn:hover { color: var(--brand-dark); }
.tab-btn.active { color: var(--brand-dark); border-bottom-color: var(--brand); }

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

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); font-size: 11px; margin: 2px 3px 2px 0; }

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr !important; }
}

@media (max-width: 700px) {
  .container { padding: 14px; }
  .card { padding: 16px; }
}

/* ----------------------------------------------------- app shell / sidebar */
.logo-img.big { height: 42px; }
.app-shell { display: flex; align-items: flex-start; min-height: calc(100vh - 110px); }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--nav-bg); border-right: 1px solid var(--nav-bg);
  padding: 20px 0; min-height: calc(100vh - 110px); position: sticky; top: 0;
}
.sidebar-group { padding: 0 16px; margin-top: 20px; }
.sidebar-group:first-child { margin-top: 0; }
.sidebar-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--nav-text-muted); margin-bottom: 8px; }
.sidebar-link {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: none; border: none; padding: 11px 12px; margin: 2px 0; border-radius: 8px;
  font-size: 14.5px; font-weight: 600; color: var(--nav-text); cursor: pointer;
}
.sidebar-link:hover { background: var(--nav-bg-hover); color: #fff; }
.sidebar-link.active { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 700; }
.main-content { flex: 1; padding: 24px 32px; min-width: 0; }
.main-content.wide { max-width: 1600px; margin: 0 auto; }

.greeting-bar { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.greeting-bar h1 { margin: 0; }
.greeting-bar .date { color: var(--muted); font-size: 13px; }

.action-table { width: 100%; border-collapse: collapse; }
.action-table td { padding: 10px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.priority-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }
.priority-dot.high { background: var(--danger); }
.priority-dot.medium { background: var(--warn); }
.priority-dot.low { background: var(--muted); }

.dq-bar-track { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; margin: 8px 0; }
.dq-bar-fill { height: 100%; background: var(--brand); }
.dq-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--border); }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%; position: static; min-height: auto; display: flex; overflow-x: auto;
    padding: 8px 10px; gap: 4px; border-right: none; border-bottom: 3px solid var(--brand);
  }
  .sidebar-group { padding: 0; margin-top: 0; display: flex; gap: 4px; }
  .sidebar-group-label { display: none; }
  .sidebar-link { white-space: nowrap; }
  .main-content { padding: 14px; }
}
