/* ============================================================
   Point Source OHS — app.css
   Brand: Gold #F3C242 / #F2B827, near-black #111, dark slate shell
   Fonts: Fjalla One (headings), Raleway (body)
   ============================================================ */

/* ── Custom Properties ──────────────────────────────────────── */
:root {
  /* Brand colours */
  --gold:           #F3C242;
  --gold-dark:      #F2B827;
  --gold-light:     #FAE08A;
  --near-black:     #111111;
  --muted:          #69727D;
  --muted-light:    #9AA0A6;

  /* Shell */
  --shell-bg:       #1C2331;
  --shell-border:   #2C3547;
  --shell-text:     #E8ECF0;
  --shell-muted:    #8C96A3;
  --sidebar-w:      240px;
  --topbar-h:       60px;

  /* Content surface */
  --surface:        #FFFFFF;
  --surface-alt:    #F7F8FA;
  --surface-border: #E2E6EA;
  --body-bg:        #F0F2F5;
  --text:           #1A1E26;
  --text-muted:     #5A6372;

  /* Status / semantic */
  --green:          #22A06B;
  --green-bg:       #E3F5ED;
  --green-border:   #A3D9BF;
  --amber:          #F2B827;
  --amber-bg:       #FEF4D5;
  --amber-border:   #F9D97A;
  --red:            #D93025;
  --red-bg:         #FDECEA;
  --red-border:     #F5A9A5;
  --blue:           #1A73E8;
  --blue-bg:        #E8F0FE;
  --blue-border:    #A8C7FA;
  --grey:           #69727D;
  --grey-bg:        #EAECEE;
  --grey-border:    #BFC4CA;

  /* Type scale */
  --text-xs:        0.75rem;
  --text-sm:        0.875rem;
  --text-base:      1rem;
  --text-lg:        1.125rem;
  --text-xl:        1.25rem;
  --text-2xl:       1.5rem;
  --text-3xl:       1.875rem;
  --text-4xl:       2.25rem;

  /* Spacing */
  --space-1:        0.25rem;
  --space-2:        0.5rem;
  --space-3:        0.75rem;
  --space-4:        1rem;
  --space-5:        1.25rem;
  --space-6:        1.5rem;
  --space-8:        2rem;
  --space-10:       2.5rem;
  --space-12:       3rem;

  /* Radius */
  --radius-sm:      4px;
  --radius:         6px;
  --radius-lg:      10px;
  --radius-xl:      16px;
  --radius-pill:    999px;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow:         0 2px 8px rgba(0,0,0,.10);
  --shadow-lg:      0 4px 20px rgba(0,0,0,.13);

  /* Transitions */
  --ease:           cubic-bezier(.4,0,.2,1);
  --dur:            180ms;
}

/* ── Reset / Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Raleway', system-ui, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--body-bg);
}

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

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

ul, ol { list-style: none; }

button { cursor: pointer; font-family: inherit; }

input, select, textarea, button {
  font-family: 'Raleway', system-ui, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Fjalla One', 'Impact', sans-serif;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5, h6 { font-size: var(--text-base); }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

/* ── Accessibility ───────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  background: var(--gold);
  color: var(--near-black);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: var(--text-sm);
}
.skip-link:focus { top: var(--space-4); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Authenticated Shell ─────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--shell-bg);
  border-bottom: 2px solid var(--gold);
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 200;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}

.topbar__logo {
  width: 36px;
  height: 36px;
}

.topbar__name {
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-lg);
  color: var(--gold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar__spacer { flex: 1; }

.topbar__user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--shell-text);
  font-size: var(--text-sm);
}

.topbar__user-name {
  font-weight: 600;
  color: var(--shell-text);
}

.topbar__user-role {
  color: var(--shell-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar__logout {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: rgba(255,255,255,.08);
  color: var(--shell-text);
  font-size: var(--text-sm);
  transition: background var(--dur) var(--ease);
  text-decoration: none;
}
.topbar__logout:hover { background: rgba(255,255,255,.14); text-decoration: none; }

/* Hamburger (mobile) */
.topbar__menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--shell-text);
  padding: var(--space-2);
  border-radius: var(--radius);
}

/* Sidebar */
.sidebar {
  grid-area: sidebar;
  background: var(--shell-bg);
  border-right: 1px solid var(--shell-border);
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: var(--space-4) 0;
}

.sidebar__section {
  padding: var(--space-2) var(--space-4) var(--space-1);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  color: var(--shell-text);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  border-left: 3px solid transparent;
}
.sidebar__link:hover {
  background: rgba(255,255,255,.06);
  color: var(--gold);
  text-decoration: none;
}
.sidebar__link.active {
  background: rgba(243,194,66,.1);
  border-left-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

.sidebar__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

/* Main content */
.main-content {
  grid-area: main;
  padding: var(--space-8);
  min-width: 0;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.page-header__title {
  flex: 1;
  min-width: 0;
}

.page-header__title h1 {
  color: var(--near-black);
  font-size: var(--text-2xl);
}

.page-header__subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.page-header__actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: flex-start;
}

/* ── Blank / Kiosk Layout ────────────────────────────────────── */
.blank-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--body-bg);
}

.blank-shell__card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.blank-shell__header {
  background: var(--shell-bg);
  border-bottom: 3px solid var(--gold);
  padding: var(--space-6);
  text-align: center;
}

.blank-shell__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-decoration: none;
  margin-bottom: var(--space-2);
}

.blank-shell__app-name {
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-xl);
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.blank-shell__body {
  padding: var(--space-8);
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--surface-border);
  overflow: hidden;
}

.card__header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--surface-border);
}

.card__title {
  flex: 1;
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-lg);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
}

.card__body {
  padding: var(--space-6);
}

.card__footer {
  padding: var(--space-4) var(--space-6);
  background: var(--surface-alt);
  border-top: 1px solid var(--surface-border);
}

/* KPI Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--surface-border);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-card__label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-card__value {
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-3xl);
  color: var(--near-black);
  line-height: 1;
}

.stat-card__sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.stat-card--gold    { border-top: 3px solid var(--gold); }
.stat-card--green   { border-top: 3px solid var(--green); }
.stat-card--amber   { border-top: 3px solid var(--amber); }
.stat-card--red     { border-top: 3px solid var(--red); }
.stat-card--blue    { border-top: 3px solid var(--blue); }

/* ── Status Pills ────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.6;
}

.pill-compliant   { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.pill-pending     { background: var(--amber-bg);  color: #8B6914;       border: 1px solid var(--amber-border); }
.pill-blocked     { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }
.pill-expired     { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }
.pill-conditional { background: var(--blue-bg);   color: var(--blue);   border: 1px solid var(--blue-border); }
.pill-overridden  { background: var(--blue-bg);   color: var(--blue);   border: 1px solid var(--blue-border); }
.pill-superseded  { background: var(--grey-bg);   color: var(--grey);   border: 1px solid var(--grey-border); }
.pill-approved    { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.pill-rejected    { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }
.pill-draft       { background: var(--grey-bg);   color: var(--grey);   border: 1px solid var(--grey-border); }
.pill-issued      { background: var(--blue-bg);   color: var(--blue);   border: 1px solid var(--blue-border); }
.pill-closed      { background: var(--grey-bg);   color: var(--grey);   border: 1px solid var(--grey-border); }
.pill-cancelled   { background: var(--grey-bg);   color: var(--grey);   border: 1px solid var(--grey-border); }
.pill-requested   { background: var(--amber-bg);  color: #8B6914;       border: 1px solid var(--amber-border); }

/* ── Alerts / Flash ──────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid;
}

.alert-ok {
  background: var(--green-bg);
  color: #155c3b;
  border-color: var(--green-border);
}

.alert-error {
  background: var(--red-bg);
  color: #8b1a14;
  border-color: var(--red-border);
}

.alert-warning {
  background: var(--amber-bg);
  color: #6b4d0a;
  border-color: var(--amber-border);
}

.alert-info {
  background: var(--blue-bg);
  color: #0d4d9f;
  border-color: var(--blue-border);
}

.alert__icon { flex-shrink: 0; font-size: 1.1em; margin-top: 1px; }
.alert__body { flex: 1; min-width: 0; }
.alert__title { font-weight: 700; margin-bottom: var(--space-1); }

.alert ul { list-style: disc; padding-left: var(--space-5); margin-top: var(--space-2); }
.alert ul li { margin-bottom: var(--space-1); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  font-family: 'Raleway', sans-serif;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--gold);
  color: var(--near-black);
  border-color: var(--gold);
}
.btn-primary:hover:not(:disabled) {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  text-decoration: none;
  color: var(--near-black);
  box-shadow: 0 2px 8px rgba(243,194,66,.4);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--surface-border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: var(--muted);
  text-decoration: none;
}

.btn-outline-gold {
  background: transparent;
  color: var(--gold-dark);
  border-color: var(--gold);
}
.btn-outline-gold:hover:not(:disabled) {
  background: rgba(243,194,66,.1);
  text-decoration: none;
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover:not(:disabled) {
  background: #b82820;
  border-color: #b82820;
  text-decoration: none;
  color: #fff;
}

.btn-outline-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-outline-danger:hover:not(:disabled) {
  background: var(--red-bg);
  text-decoration: none;
}

.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-lg); }

/* Kiosk / big-tap buttons */
.btn-kiosk {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-6) var(--space-8);
  border-radius: var(--radius-xl);
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-2xl);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  min-height: 80px;
}

.btn-kiosk-primary {
  background: var(--gold);
  color: var(--near-black);
}
.btn-kiosk-primary:hover { background: var(--gold-dark); text-decoration: none; color: var(--near-black); }

.btn-kiosk-danger {
  background: var(--red);
  color: #fff;
}
.btn-kiosk-danger:hover { background: #b82820; text-decoration: none; color: #fff; }

.btn-kiosk-secondary {
  background: transparent;
  color: var(--muted);
  border: 2px solid var(--surface-border);
  min-height: 64px;
  font-size: var(--text-xl);
}
.btn-kiosk-secondary:hover { background: var(--surface-alt); text-decoration: none; color: var(--near-black); }

/* Worker-selection list buttons on the kiosk lookup result screen */
.kiosk-worker-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: var(--space-5) var(--space-6);
  border: 2px solid var(--surface-border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-height: 72px;
}
.kiosk-worker-option:hover,
.kiosk-worker-option:focus-visible {
  border-color: var(--gold);
  background: #fffdf5;
  outline: none;
}
.kiosk-worker-option__name {
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-xl);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--near-black);
}
.kiosk-worker-option__meta {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.form-label .required {
  color: var(--red);
  margin-left: var(--space-1);
}

.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius);
  font-family: 'Raleway', sans-serif;
  font-size: var(--text-base);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(243,194,66,.2);
}

.form-control.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(217,48,37,.15);
}

.form-control::placeholder { color: var(--muted-light); }

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2369727D' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
  cursor: pointer;
}

/* Kiosk form controls */
.form-control-kiosk {
  width: 100%;
  padding: var(--space-5) var(--space-6);
  background: var(--surface);
  border: 2px solid var(--surface-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-xl);
  color: var(--text);
  transition: border-color var(--dur) var(--ease);
}
.form-control-kiosk:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(243,194,66,.2);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--red);
  font-weight: 600;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* Kiosk checkbox */
.form-check-kiosk {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 2px solid var(--surface-border);
  border-radius: var(--radius-lg);
}
.form-check-kiosk input[type="checkbox"] {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  accent-color: var(--gold);
}
.form-check-kiosk label {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.4;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-5);
}

.form-section {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--surface-border);
}
.form-section:last-child { border-bottom: none; margin-bottom: 0; }

.form-section__title {
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-base);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--surface-border);
}

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--surface-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: var(--text-sm);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--surface-alt);
  border-bottom: 2px solid var(--surface-border);
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--surface-border);
  vertical-align: middle;
  color: var(--text);
}

.table tr:last-child td { border-bottom: none; }

.table tbody tr:nth-child(even) td { background: var(--surface-alt); }

.table tbody tr:hover td { background: rgba(243,194,66,.05); }

.table th:first-child, .table td:first-child { padding-left: var(--space-6); }
.table th:last-child, .table td:last-child { padding-right: var(--space-6); }

/* Actions column */
.table td.actions { white-space: nowrap; text-align: right; }
.table__actions { display: flex; gap: var(--space-2); justify-content: flex-end; align-items: center; flex-wrap: wrap; }

/* Responsive table — stacked on mobile */
@media (max-width: 640px) {
  .table-responsive thead { display: none; }
  .table-responsive tr {
    display: block;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    background: var(--surface);
  }
  .table-responsive td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--surface-border);
    font-size: var(--text-sm);
  }
  .table-responsive td:last-child { border-bottom: none; }
  .table-responsive td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    flex-shrink: 0;
  }
}

/* ── Search / Filter Bar ─────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--space-5);
}

.filter-bar .form-control {
  min-width: 180px;
  flex: 1;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--text-muted);
}

.empty-state__icon {
  width: 56px;
  height: 56px;
  color: var(--muted-light);
}

.empty-state__title {
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-xl);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.empty-state__text {
  font-size: var(--text-sm);
  max-width: 360px;
  margin: 0;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--red);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
}

.badge-gold { background: var(--gold); color: var(--near-black); }
.badge-green { background: var(--green); }
.badge-amber { background: var(--amber); color: var(--near-black); }
.badge-grey { background: var(--grey); }

/* ── Workflow Timeline ───────────────────────────────────────── */
.timeline {
  position: relative;
  padding: var(--space-4) 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--surface-border);
}

.timeline__item {
  display: flex;
  gap: var(--space-4);
  padding-bottom: var(--space-6);
  position: relative;
}

.timeline__item:last-child { padding-bottom: 0; }

.timeline__dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 2px solid var(--surface-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  position: relative;
  z-index: 1;
}

.timeline__dot--gold { background: var(--gold); border-color: var(--gold-dark); }
.timeline__dot--green { background: var(--green); border-color: #1a8056; color: #fff; }
.timeline__dot--red { background: var(--red); border-color: #b82820; color: #fff; }
.timeline__dot--blue { background: var(--blue); border-color: #1557b0; color: #fff; }

.timeline__body { flex: 1; min-width: 0; padding-top: var(--space-2); }
.timeline__title { font-weight: 700; font-size: var(--text-sm); }
.timeline__meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-1); }
.timeline__note { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--space-2); }

/* ── Detail / Key-Value Grid ─────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4) var(--space-6);
}

.detail-item__label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.detail-item__value {
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--surface-border);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}

.tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--gold-dark); border-bottom-color: var(--gold); }

/* ── Signature Canvas ────────────────────────────────────────── */
.sig-container {
  border: 2px solid var(--surface-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  background: var(--surface);
}

#sig-canvas {
  display: block;
  width: 100%;
  touch-action: none;
  cursor: crosshair;
}

.sig-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-alt);
  border-top: 1px solid var(--surface-border);
}

.sig-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Kiosk / Visitor Mode ────────────────────────────────────── */
.kiosk-shell {
  min-height: 100vh;
  background: var(--shell-bg);
  display: flex;
  flex-direction: column;
}

.kiosk-header {
  background: var(--shell-bg);
  border-bottom: 3px solid var(--gold);
  padding: var(--space-6) var(--space-8);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
}

.kiosk-header__brand {
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-2xl);
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.kiosk-header__site {
  margin-left: auto;
  font-size: var(--text-lg);
  color: var(--shell-muted);
  font-weight: 600;
  text-align: right;
}

/* Narrow kiosk / phone: stack brand above site name so neither wraps mid-word */
@media (max-width: 560px) {
  .kiosk-header {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .kiosk-header__brand {
    font-size: var(--text-xl);
  }
  .kiosk-header__site {
    margin-left: 0;
    text-align: left;
    font-size: var(--text-base);
  }
}

.kiosk-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.kiosk-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-10);
  width: 100%;
}

.kiosk-title {
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-3xl);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--near-black);
  margin-bottom: var(--space-6);
  text-align: center;
}

.kiosk-status {
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  margin-bottom: var(--space-6);
}

.kiosk-status--allowed {
  background: var(--green-bg);
  border: 2px solid var(--green-border);
}

.kiosk-status--blocked {
  background: var(--red-bg);
  border: 2px solid var(--red-border);
}

.kiosk-status__icon {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: var(--space-4);
}

.kiosk-status__title {
  font-family: 'Fjalla One', sans-serif;
  font-size: var(--text-3xl);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kiosk-status--allowed .kiosk-status__title { color: var(--green); }
.kiosk-status--blocked .kiosk-status__title { color: var(--red); }

.kiosk-status__text {
  font-size: var(--text-lg);
  margin-top: var(--space-3);
  color: var(--text-muted);
}

/* ── Compliance Detail ───────────────────────────────────────── */
.compliance-rule {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--surface-border);
}
.compliance-rule:last-child { border-bottom: none; }
.compliance-rule__indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.compliance-rule__indicator--pass { background: var(--green); }
.compliance-rule__indicator--fail { background: var(--red); }
.compliance-rule__indicator--warn { background: var(--amber); }
.compliance-rule__text { flex: 1; font-size: var(--text-sm); }
.compliance-rule__name { font-weight: 600; }
.compliance-rule__note { color: var(--text-muted); font-size: var(--text-xs); margin-top: 2px; }

/* ── Utility Classes ─────────────────────────────────────────── */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }
.text-danger  { color: var(--red); }
.text-success { color: var(--green); }
.text-warning { color: #8B6914; }

.fw-bold { font-weight: 700; }
.fw-semi { font-weight: 600; }

.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }

.d-flex  { display: flex; }
.d-grid  { display: grid; }
.gap-2   { gap: var(--space-2); }
.gap-3   { gap: var(--space-3); }
.gap-4   { gap: var(--space-4); }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1  { flex: 1; }
.min-w-0 { min-width: 0; }

.w-full  { width: 100%; }
.p-0     { padding: 0; }

.divider {
  border: none;
  border-top: 1px solid var(--surface-border);
  margin: var(--space-6) 0;
}

/* ── Attachment / File List ──────────────────────────────────── */
.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--text-sm);
}

.file-item__icon { flex-shrink: 0; color: var(--muted); }
.file-item__name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item__size { color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; }

/* ── Quick Links / Action Grid ───────────────────────────────── */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
}

.action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  font-size: var(--text-sm);
  font-weight: 600;
}
.action-tile:hover {
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(243,194,66,.2);
  background: rgba(243,194,66,.04);
  text-decoration: none;
  color: var(--text);
}

.action-tile__icon {
  font-size: 2rem;
  line-height: 1;
}

/* ── Tag Chips ───────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  background: var(--surface-alt);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
}

.tag-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ── Logo Upload Preview ─────────────────────────────────────── */
.logo-preview {
  width: 120px;
  height: 60px;
  object-fit: contain;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: var(--space-2);
  background: var(--surface);
}

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: var(--space-4) 0;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.page-link:hover { background: var(--surface-alt); text-decoration: none; }
.page-link.active { background: var(--gold); border-color: var(--gold); color: var(--near-black); }
.page-link:disabled, .page-link.disabled { opacity: 0.45; pointer-events: none; }

/* ── Responsive / Mobile ─────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  .app-shell {
    grid-template-areas: "topbar" "main";
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
  }

  .sidebar {
    position: fixed;
    left: -260px;
    top: var(--topbar-h);
    width: 260px;
    height: calc(100vh - var(--topbar-h));
    z-index: 300;
    transition: left var(--dur) var(--ease);
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }

  .sidebar.open { left: 0; }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 299;
  }
  .sidebar-overlay.open { display: block; }

  .topbar__menu-btn { display: flex; }

  .main-content { padding: var(--space-5) var(--space-4); }
}

@media (max-width: 640px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .btn-lg { font-size: var(--text-base); padding: var(--space-4) var(--space-5); }
  .detail-grid { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .form-actions, .btn { display: none !important; }
  .app-shell { display: block; }
  .main-content { padding: 0; }
}
