/* ==========================================================================
   SAKSHAM — Apprenticeship Management Platform
   Layout: sidebar shell at >=1100px, icon rail 900–1099px, bottom tabs <900px
   ========================================================================== */

:root {
  --navy-900: #0a2240;
  --navy-800: #0d2b4e;
  --navy-700: #143a66;
  --navy-600: #1d4d81;
  --navy-100: #e7eef6;

  --amber-600: #b4761a;
  --amber-500: #e8a33d;
  --amber-100: #fdf2df;

  --green-600: #147d54;
  --green-500: #1c9c69;
  --green-100: #e3f5ed;

  --red-600: #b3261e;
  --red-500: #d8453b;
  --red-100: #fdeceb;

  --ink:      #16202e;
  --ink-2:    #43526a;
  --ink-3:    #6b7a90;
  --line:     #dfe5ee;
  --line-2:   #eef2f7;
  --bg:       #f4f7fb;
  --card:     #ffffff;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 2px rgba(16, 32, 56, .06), 0 4px 14px rgba(16, 32, 56, .05);
  --shadow-lg: 0 8px 30px rgba(16, 32, 56, .12);

  --sidebar-w: 246px;
  --rail-w:    72px;

  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* The UA rule for [hidden] is display:none, but any component rule that sets a
   display value beats it on specificity. Keep the attribute authoritative. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--navy-600); }

img, svg { max-width: 100%; }

/* Visible focus everywhere — keyboard users must be able to see where they are. */
:focus-visible {
  outline: 3px solid var(--amber-500);
  outline-offset: 2px;
  border-radius: 4px;
}

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

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--navy-800); color: #fff; padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) 0; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------------ shell */

.shell { display: flex; min-height: 100vh; }

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--navy-900);
  color: #cfdcec;
  display: flex; flex-direction: column;
  z-index: 40;
}

.sidebar-brand { padding: 20px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }

.brand-link { display: flex; align-items: center; gap: 11px; text-decoration: none; color: #fff; }

.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  background: var(--amber-500); color: var(--navy-900);
  border-radius: 9px;
  font: 700 19px/1 Georgia, "Times New Roman", serif;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 16px; letter-spacing: .12em; }
.brand-text small { font-size: 11px; color: #8ba6c6; letter-spacing: .02em; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #b9cae0; text-decoration: none;
  font-size: 14.5px;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.is-active {
  background: rgba(232,163,61,.14);
  color: #fff; font-weight: 600;
  border-left-color: var(--amber-500);
}
.nav-link .ico { flex: none; }

.sidebar-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }

.role-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; padding: 7px 10px; border-radius: 999px;
}
.role-admin  { background: rgba(232,163,61,.16); color: #f3c684; }
.role-viewer { background: rgba(255,255,255,.09); color: #a9bdd6; }

/* ----------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 22px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

/* The button is class="icon-btn menu-toggle", and .icon-btn below sets
   display:grid at the same specificity. Qualifying with .icon-btn wins on
   specificity rather than source order, so the toggle stays hidden at widths
   where the sidebar is permanently visible and there is nothing to toggle. */
.icon-btn.menu-toggle { display: none; }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink-2);
  cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }

.topsearch {
  flex: 1; max-width: 460px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-3);
}
.topsearch input {
  flex: 1; border: 0; background: none; padding: 9px 0;
  font: inherit; font-size: 14px; color: var(--ink);
}
.topsearch input:focus { outline: none; }
.topsearch:focus-within { border-color: var(--navy-600); background: #fff; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.usermenu { position: relative; }
.usermenu > summary {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 8px 4px 4px; border-radius: 999px;
  cursor: pointer; list-style: none;
}
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover { background: var(--line-2); }

.avatar {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--navy-700); color: #fff;
  font-size: 12.5px; font-weight: 600; letter-spacing: .04em;
}

.usermenu-name { display: flex; flex-direction: column; line-height: 1.2; }
.usermenu-name strong { font-size: 13.5px; }
.usermenu-name small  { font-size: 11.5px; color: var(--ink-3); }

.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 220px; padding: 12px;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  display: grid; gap: 2px;
}
.usermenu-email { font-size: 13px; font-weight: 600; word-break: break-all; }
.usermenu-desig { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.usermenu-panel a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-size: 14px;
}
.usermenu-panel a:hover { background: var(--line-2); color: var(--ink); }
.usermenu-panel a.danger { color: var(--red-600); }

/* ------------------------------------------------------------------- main */

.main { flex: 1; padding: 24px 22px 40px; max-width: 1500px; width: 100%; }

.sitefoot {
  padding: 20px 22px 28px;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}

/* ------------------------------------------------------------ page header */

.page-head { margin-bottom: 20px; }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--amber-600); margin-bottom: 6px;
}
.page-head h1 { font-size: 27px; font-weight: 400; }
.page-head .lede { color: var(--ink-2); margin-top: 5px; font-size: 14.5px; }

.head-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}

/* -------------------------------------------------------------- filterbar */

.filterbar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 20px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.filterbar .field { min-width: 168px; }
.filterbar .spacer { flex: 1; }
.filter-note {
  width: 100%; font-size: 12.5px; color: var(--ink-3);
  border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 2px;
}

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pad    { padding: 16px 18px; }
.pad-lg { padding: 26px 28px; }

.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding: 16px 18px 12px;
}
.card-head h2 { font-size: 16.5px; }
.card-head .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.card-link {
  font-size: 13px; font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.card-link::after { content: "›"; font-size: 16px; line-height: 1; }

/* --------------------------------------------------------------- kpi grid */

.kpi-grid {
  display: grid; gap: 14px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi {
  display: block; position: relative;
  padding: 16px 18px 15px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
a.kpi:hover { border-color: var(--navy-600); transform: translateY(-1px); box-shadow: var(--shadow-lg); }

.kpi-top { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.kpi-ico {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center; border-radius: 10px;
}
.kpi-ico.b1 { background: var(--navy-100);  color: var(--navy-700); }
.kpi-ico.b2 { background: #e6f0fb;          color: #1b5fa8; }
.kpi-ico.b3 { background: var(--amber-100); color: var(--amber-600); }
.kpi-ico.b4 { background: var(--green-100); color: var(--green-600); }

.kpi-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.kpi-value {
  display: block;
  font-size: 30px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1;
}
.kpi-caption { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.kpi-caption.up { color: var(--green-600); }
.kpi-chev { position: absolute; top: 16px; right: 16px; color: var(--ink-3); }

/* display:block matters — these are <span> elements inside an <a>, and an
   inline box cannot take a height, which makes the fill swallow the card. */
.meter {
  display: block;
  height: 5px; background: var(--line-2);
  border-radius: 999px; overflow: hidden; margin-top: 9px;
}
.meter > span { display: block; height: 100%; background: var(--amber-500); border-radius: 999px; }

/* ---------------------------------------------------------------- columns */

.cols {
  display: grid; gap: 16px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}
.cols-2-1 { display: grid; gap: 16px; margin-bottom: 16px; grid-template-columns: 1.6fr 1fr; }
@media (max-width: 1000px) { .cols-2-1 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ chart */

.chart { padding: 8px 18px 18px; }

.chart-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 14px; }
.legend-key { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.legend-dot.gen  { background: var(--navy-800); }
.legend-dot.comp { background: var(--amber-500); }

.bars {
  display: flex; align-items: flex-end; gap: 4px;
  height: 190px; padding-top: 8px;
  border-bottom: 1px solid var(--line);
}
.bar-group {
  flex: 1; display: flex; align-items: flex-end; justify-content: center;
  gap: 4px; height: 100%; position: relative;
}
.bar {
  width: 15px; min-height: 3px;
  border-radius: 3px 3px 0 0;
  position: relative;
}
.bar.gen  { background: var(--navy-800); }
.bar.comp { background: var(--amber-500); }
.bar-group:hover .bar { filter: brightness(1.15); }

.bar-tip {
  position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px);
  background: var(--navy-900); color: #fff;
  font-size: 11.5px; line-height: 1.35; white-space: nowrap;
  padding: 5px 8px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.bar-group:hover .bar-tip, .bar-group:focus-within .bar-tip { opacity: 1; }

.bar-axis { display: flex; gap: 4px; margin-top: 7px; }
.bar-axis span { flex: 1; text-align: center; font-size: 11.5px; color: var(--ink-3); }

.retention-pill {
  display: inline-flex; flex-direction: column; align-items: flex-end;
  background: var(--green-100); color: var(--green-600);
  padding: 6px 11px; border-radius: var(--radius-sm);
}
.retention-pill strong { font-size: 17px; line-height: 1.1; }
.retention-pill span   { font-size: 11px; }

/* ----------------------------------------------------------- action items */

.action-list { list-style: none; margin: 0; padding: 0 10px 12px; display: grid; gap: 2px; }
.action-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: inherit;
}
.action-item:hover { background: var(--line-2); }
.action-ico {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 9px; background: var(--navy-100); color: var(--navy-700);
}
.action-body { min-width: 0; flex: 1; }
.action-body strong { display: block; font-size: 14px; font-weight: 600; }
.action-body small  { color: var(--ink-3); font-size: 12.5px; }
.action-chev { color: var(--ink-3); flex: none; }

.empty-state { padding: 30px 18px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* ----------------------------------------------------------------- funnel */

.funnel { padding: 4px 18px 20px; display: grid; gap: 12px; }
.funnel-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: baseline; }
.funnel-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.funnel-count { font-size: 21px; font-weight: 650; letter-spacing: -.01em; }
.funnel-track { grid-column: 1 / -1; height: 7px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.funnel-fill  { display: block; height: 100%; background: var(--navy-700); border-radius: 999px; }
.funnel-row:nth-child(2) .funnel-fill { background: var(--navy-600); }
.funnel-row:nth-child(3) .funnel-fill { background: #2b6fae; }
.funnel-row:nth-child(4) .funnel-fill { background: var(--amber-600); }
.funnel-row:nth-child(5) .funnel-fill { background: var(--green-600); }
.funnel-meta { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-3); }

/* ------------------------------------------------------------- compliance */

.compliance { display: flex; gap: 22px; align-items: center; padding: 6px 18px 20px; flex-wrap: wrap; }

.ring { position: relative; width: 118px; height: 118px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring-track { stroke: var(--line-2); }
.ring-fill  { stroke: var(--green-500); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-mid {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.ring-mid strong { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.ring-mid span   { font-size: 11px; color: var(--ink-3); }

.compliance-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 200px; display: grid; gap: 9px; }
.compliance-list li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--green-500); } .dot.warn { background: var(--amber-500); }
.dot.bad { background: var(--red-500); }  .dot.neutral { background: var(--ink-3); }
.compliance-list .val { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ table */

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.data caption { text-align: left; padding: 0 18px 10px; color: var(--ink-3); font-size: 12.5px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; vertical-align: middle; }
table.data thead th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 600;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data tbody tr { border-bottom: 1px solid var(--line-2); }
table.data tbody tr:last-child { border-bottom: 0; }
table.data tbody tr:hover { background: #fafcfe; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th.num { text-align: right; }

.cell-main { display: flex; align-items: center; gap: 10px; }
.cell-sub  { font-size: 12px; color: var(--ink-3); }
.mono { font-variant-numeric: tabular-nums; font-size: 12.5px; }

.ind-avatar {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  border-radius: 8px; background: var(--navy-100); color: var(--navy-700);
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
}

.rowbar { height: 4px; background: var(--line-2); border-radius: 999px; margin-top: 4px; width: 74px; overflow: hidden; }
.rowbar > span { display: block; height: 100%; background: var(--green-500); border-radius: 999px; }

/* ----------------------------------------------------------------- badges */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-ok      { background: var(--green-100); color: var(--green-600); }
.badge-warn    { background: var(--amber-100); color: var(--amber-600); }
.badge-bad     { background: var(--red-100);   color: var(--red-600); }
.badge-neutral { background: var(--line-2);    color: var(--ink-2); }

.scheme-tag {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.scheme-NAPS { background: #e6f0fb; color: #1b5fa8; }
.scheme-NATS { background: var(--amber-100); color: var(--amber-600); }

/* ------------------------------------------------------------------ forms */

.field { display: grid; gap: 5px; }
.field > label, .label {
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.field .hint { font-size: 12px; color: var(--ink-3); }
.field .err  { font-size: 12px; color: var(--red-600); font-weight: 500; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], input[type=tel], input[type=month],
select, textarea, input[type=file] {
  width: 100%; padding: 9px 11px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
select { appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 15px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--navy-600); outline-offset: 0; }
input[disabled], select[disabled], textarea[disabled] { background: var(--line-2); color: var(--ink-3); }

.form-grid { display: grid; gap: 15px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--line);
}

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px; }
legend { font-size: 13px; font-weight: 700; padding: 0 6px; color: var(--navy-700); }

/* ----------------------------------------------- search-as-you-type picker */

.picker { position: relative; }

.picker-input { padding-right: 34px; }

.picker-clear {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 22px; height: 22px; display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--line-2); color: var(--ink-2);
  font-size: 15px; line-height: 1; cursor: pointer;
}
.picker-clear:hover { background: var(--line); color: var(--ink); }

.picker-list {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 340px;
  overflow-y: auto; overflow-x: hidden;
  margin: 0; padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

/* Wraps rather than overflowing: on a narrow screen the tags drop under the
   name instead of pushing a horizontal scrollbar into the list. */
.picker-option {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 3px 8px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.picker-option.is-active { background: var(--navy-100); }

.picker-name { font-weight: 600; font-size: 14px; margin-right: auto; }
.picker-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.picker-tags .mono { color: var(--ink-3); }
.picker-meta {
  flex-basis: 100%;
  font-size: 12px; color: var(--ink-3);
  overflow-wrap: anywhere;
}

.picker-empty { padding: 12px; font-size: 13px; color: var(--ink-3); text-align: center; }

.picker-status { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.picker-status.err { color: var(--red-600); font-weight: 500; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-500); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- flash */

.flash {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: 14px; font-weight: 500;
  border: 1px solid;
}
.flash-success { background: var(--green-100); border-color: #bfe4d3; color: var(--green-600); }
.flash-error   { background: var(--red-100);   border-color: #f3c9c6; color: var(--red-600); }
.flash-info    { background: var(--navy-100);  border-color: #c9d9ea; color: var(--navy-700); }
.flash-warn    { background: var(--amber-100); border-color: #f0d6a6; color: var(--amber-600); }

/* ------------------------------------------------------------ pagination */

.pager { display: flex; align-items: center; gap: 6px; padding: 14px 18px; flex-wrap: wrap; }
.pager .count { margin-right: auto; font-size: 13px; color: var(--ink-3); }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 9px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 13px; text-decoration: none; color: var(--ink-2); background: #fff;
}
.pager a:hover { background: var(--line-2); }
.pager .is-current { background: var(--navy-800); border-color: var(--navy-800); color: #fff; font-weight: 600; }
.pager .is-disabled { opacity: .4; }

/* ------------------------------------------------------------ auth screen */

.auth-main {
  min-height: 100vh; display: grid; place-items: center;
  padding: 30px 18px;
  background: linear-gradient(150deg, var(--navy-900) 0%, var(--navy-700) 55%, #1e5a94 100%);
}

.auth-card {
  width: 100%; max-width: 940px;
  display: grid; grid-template-columns: 1.05fr 1fr;
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(4, 18, 38, .38);
}

.auth-aside { padding: 40px 38px; background: var(--navy-900); color: #d3e0ef; }
.auth-aside .brand-mark { width: 44px; height: 44px; font-size: 25px; border-radius: 11px; }
.auth-aside h2 { color: #fff; font-size: 23px; margin: 22px 0 10px; font-weight: 500; }
.auth-aside p  { font-size: 14px; line-height: 1.65; color: #a8c0da; }
.auth-points { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 10px; font-size: 13.5px; align-items: flex-start; }
.auth-points .ico { color: var(--amber-500); flex: none; margin-top: 2px; }

.auth-form { padding: 40px 38px; }
.auth-form h1 { font-size: 24px; font-weight: 500; margin-bottom: 5px; }
.auth-form .lede { color: var(--ink-3); font-size: 14px; margin-bottom: 24px; }
.auth-form .field { margin-bottom: 15px; }
.auth-form .btn { width: 100%; padding: 11px; margin-top: 6px; }

.demo-creds {
  margin-top: 24px; padding: 14px 16px;
  background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius);
  font-size: 12.5px; color: var(--ink-2);
}
.demo-creds h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 8px; }
.demo-creds dl { margin: 0; display: grid; gap: 7px; }
.demo-creds .row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.demo-creds code { background: #fff; border: 1px solid var(--line); padding: 2px 6px; border-radius: 5px; font-size: 12px; }

/* Username above password, so the pair never splits across a line break. */
.demo-creds .creds { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }

@media (max-width: 800px) {
  .auth-card { grid-template-columns: 1fr; max-width: 460px; }
  .auth-aside { display: none; }
}

/* ------------------------------------------------------------- utilities */

.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 10px; } .mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; } .mb-2 { margin-bottom: 20px; }
.stack { display: grid; gap: 16px; }
.inline-form { display: inline; }

.ico { width: 20px; height: 20px; }
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 26px; height: 26px; }

.readonly-note {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; margin-bottom: 16px;
  background: var(--navy-100); border: 1px solid #c9d9ea;
  border-radius: var(--radius); font-size: 13px; color: var(--navy-700);
}

/* --------------------------------------------------------------- tab bar */

.tabbar { display: none; }

/* ----------------------------------------------------------- breakpoints */

/* Icon rail */
@media (max-width: 1099px) {
  :root { --sidebar-w: var(--rail-w); }
  .brand-text, .nav-link span, .sidebar-foot, .usermenu-name { display: none; }
  .sidebar-brand { padding: 18px 0 14px; }
  .brand-link { justify-content: center; }
  .nav-link { justify-content: center; padding: 11px 0; border-left: 0; border-radius: 10px; }
  .nav-link.is-active { border-left: 0; box-shadow: inset 0 0 0 1px rgba(232,163,61,.4); }
  .main { padding: 20px 16px 40px; }
  .topbar { padding: 10px 16px; }
}

/* Bottom tab bar, sidebar becomes an off-canvas drawer */
@media (max-width: 899px) {
  .content { margin-left: 0; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    width: 250px;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  body.nav-open { overflow: hidden; }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(8, 20, 38, .45); z-index: 35;
  }
  .brand-text, .nav-link span, .sidebar-foot { display: revert; }
  .brand-link { justify-content: flex-start; }
  .sidebar-brand { padding: 20px 18px 14px; }
  .nav-link { justify-content: flex-start; padding: 10px 12px; border-left: 3px solid transparent; }
  .nav-link.is-active { border-left-color: var(--amber-500); box-shadow: none; }

  .icon-btn.menu-toggle { display: grid; }
  .main { padding: 18px 14px 96px; }
  .sitefoot { padding-bottom: 92px; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: flex; justify-content: space-around;
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom, 0px));
    background: var(--navy-900);
    border-top: 1px solid rgba(255,255,255,.09);
  }
  .tab {
    flex: 1; display: grid; justify-items: center; gap: 3px;
    padding: 5px 2px; border-radius: 9px;
    color: #9fb6d1; text-decoration: none; font-size: 10.5px; text-align: center;
  }
  .tab.is-active { color: #fff; background: rgba(232,163,61,.16); }
  .tab .ico { width: 21px; height: 21px; }

  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .kpi-value { font-size: 25px; }
  .page-head h1 { font-size: 23px; }
  .usermenu-name { display: none; }
  .topsearch { max-width: none; }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi-ico { width: 32px; height: 32px; }
  .kpi-value { font-size: 22px; }
  .kpi-chev { display: none; }
  .topsearch { display: none; }
  .compliance { gap: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------- print/MIS */

@media print {
  .sidebar, .topbar, .tabbar, .filterbar, .btn, .card-link, .sitefoot { display: none !important; }
  .content { margin-left: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .main { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------- credential hand-off */

.cred-grid { display: grid; gap: 10px; }

.cred {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.cred-label {
  font-size: 12px; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .06em; min-width: 122px;
}
.cred-value {
  flex: 1; min-width: 160px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 15px; font-weight: 600; color: var(--navy-800);
  background: #fff; border: 1px solid var(--line);
  padding: 6px 10px; border-radius: 6px;
  word-break: break-all;
}
.cred button { flex: none; }

/* --------------------------------------------------- password field group */

.pw-field { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pw-field input {
  flex: 1; min-width: 170px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  letter-spacing: .02em;
}
.pw-field .btn { flex: none; }

/* ----------------------------------------------- drawer close button */

/* Only meaningful when the sidebar is an off-canvas drawer. At wider widths
   the sidebar is always visible and there is nothing to close. */
.drawer-close { display: none; }

@media (max-width: 899px) {
  .sidebar-brand {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
  }
  .sidebar-brand .brand-link { flex: 1; min-width: 0; }

  .drawer-close {
    display: grid; place-items: center;
    width: 36px; height: 36px; flex: none;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 9px;
    background: rgba(255, 255, 255, .06);
    color: #cfdcec;
    cursor: pointer;
  }
  .drawer-close:hover { background: rgba(255, 255, 255, .14); color: #fff; }
}

/* --------------------------------------------------- password reveal (eye) */

/* The wrapper is injected by app.js around every password input. */
.pw-wrap { position: relative; display: block; }

.pw-wrap input { width: 100%; padding-right: 42px; }

.pw-reveal {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 30px; height: 30px;
  display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 7px;
  background: none; color: var(--ink-3);
  cursor: pointer;
}
.pw-reveal svg { width: 18px; height: 18px; }
.pw-reveal:hover { background: var(--line-2); color: var(--ink); }
.pw-reveal[aria-pressed="true"] { color: var(--navy-600); }

/* Inside the establishment credential row the wrapper takes the input's place
   in the flex layout, so it has to carry the same growth rules. */
.pw-field .pw-wrap { flex: 1; min-width: 170px; }
.pw-field .pw-wrap input {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  letter-spacing: .02em;
}

/* ------------------------------------------------- pinned action column */

/* Wide tables scroll horizontally inside .table-wrap, which can push the
   Edit/Delete column out of sight with no hint that it is there. Pinning the
   last column keeps those controls reachable at any width. */
table.data.sticky-actions th:last-child,
table.data.sticky-actions td:last-child {
  position: sticky;
  right: 0;
  background: var(--card);
  box-shadow: -8px 0 8px -8px rgba(16, 32, 56, .18);
}

table.data.sticky-actions thead th:last-child {
  background: var(--card);
  z-index: 1;
}

/* The row hover tint has to be repainted on the pinned cell, otherwise it
   shows the card background and looks detached from its row. */
table.data.sticky-actions tbody tr:hover td:last-child { background: #fafcfe; }

/* ------------------------------------------------ auth: register / divider */

.auth-card-wide { max-width: 1020px; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 14px;
  color: var(--ink-3); font-size: 12.5px;
}
.auth-divider::before,
.auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

/* The register form is longer than the sign-in form, so let it scroll rather
   than stretching the card past the viewport on a laptop. */
.auth-card-wide .auth-form { max-height: 88vh; overflow-y: auto; }

/* ------------------------------------------------------- checkbox groups */

.check-grid {
  display: grid; gap: 8px 16px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.check-grid-wide { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }

.check {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; font-weight: 400; line-height: 1.45;
  padding: 7px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer;
}
.check:hover { border-color: var(--navy-600); background: var(--bg); }
.check input { width: auto; flex: none; margin: 0; }
.check:has(input:checked) {
  border-color: var(--navy-600);
  background: var(--navy-100);
  font-weight: 500;
}

/* The requirement form is long; give each section room to breathe. */
fieldset > .form-grid { margin-top: 4px; }

/* ------------------------------------------------ requirement form, read view */

.facts-head {
  font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--amber-600);
  margin: 22px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.facts-head:first-child { margin-top: 0; }

.facts {
  display: grid; gap: 12px 22px; margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fact-wide { grid-column: 1 / -1; }
.fact dt { font-size: 12px; color: var(--ink-3); }
.fact dd { margin: 0; font-size: 14px; line-height: 1.5; word-break: break-word; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; padding: 3px 10px;
  background: var(--navy-100); color: var(--navy-700);
  border-radius: 999px; font-size: 12.5px; font-weight: 500;
}

/* Registration lifecycle badges. */
.reg-pending_verification { background: var(--line-2);    color: var(--ink-2); }
.reg-pending_profile      { background: var(--amber-100); color: var(--amber-600); }
.reg-submitted            { background: #e6f0fb;          color: #1b5fa8; }
.reg-approved             { background: var(--green-100); color: var(--green-600); }
.reg-rejected             { background: var(--red-100);   color: var(--red-600); }

/* ------------------------------------------------- requirement submitted */

.submitted-wrap { max-width: 720px; margin: 0 auto; }

.submitted-card { text-align: center; border-top: 4px solid var(--green-500); }

.submitted-tick {
  width: 74px; height: 74px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--green-100); color: var(--green-600);
}
.submitted-tick svg { width: 46px; height: 46px; }

.submitted-card h1 { font-size: 28px; font-weight: 600; margin-bottom: 8px; }
.submitted-lede { font-size: 16px; font-weight: 600; color: var(--green-600); margin-bottom: 10px; }

.submitted-ref {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; flex-wrap: wrap;
  margin-top: 22px; padding: 12px 16px;
  background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius);
}
.submitted-ref .cred-value { flex: 0 1 auto; }

.submitted-foot {
  text-align: center; margin: 26px 0 10px;
  font-size: 12.5px; color: var(--ink-3); line-height: 1.7;
}

/* Numbered "what happens next" list. */
.next-steps {
  list-style: none; counter-reset: step;
  margin: 0; padding: 4px 18px 18px;
  display: grid; gap: 14px;
}
.next-steps li {
  counter-increment: step;
  display: grid; grid-template-columns: 30px 1fr; gap: 3px 12px;
  align-items: start;
}
.next-steps li::before {
  content: counter(step);
  grid-row: span 2;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--navy-100); color: var(--navy-700);
  font-size: 13px; font-weight: 700;
}
.next-steps strong { font-size: 14.5px; }
.next-steps span { font-size: 13.5px; color: var(--ink-2); }

/* Flash messages carry more weight now that they confirm real actions. */
.flash { display: flex; align-items: flex-start; gap: 10px; }
.flash::before { font-size: 15px; line-height: 1.4; flex: none; }
.flash-success::before { content: "\2714"; }
.flash-error::before   { content: "\2716"; }
.flash-warn::before    { content: "\26A0"; }
.flash-info::before    { content: "\2139"; }
