/*
  Design plan (Sprint 1A foundation page):
  - Subject: an internal, multi-brand restaurant operations console.
    Audience is kitchen/floor supervisors on phones and tablets, and
    admins on desktop - a utility tool, not a marketing site.
  - Color: deep roots-green for structure/navigation, warm parchment
    background, copper accent for state/emphasis (kitchen-copper, not
    the default terracotta+cream combo - paired with green instead).
  - Type: Space Grotesk for headings/labels (geometric, structural),
    Inter for body/data. Unit codes (RAI-BEL) use monospace because
    they are literal identifiers, not decorative labels.
  - Layout: fixed sidebar showing Platform -> Brand -> Unit on desktop;
    collapses to a top bar + slide-in drawer below 960px.
*/

:root {
  --forest: #14261e;
  --forest-dark: #0d1913;
  --parchment: #f6f3ec;
  --paper: #fffdf9;
  --copper: #c97d34;
  --ink: #262820;
  --muted: #6b7063;
  --sage: #8fa98c;
  --brick: #a8442c;
  --line: #e4dfd2;
  --radius: 8px;
  /* Elevation - the login screen already used a real shadow
     (0 20px 50px rgba(13,25,19,.35) on .auth-card) while every other
     surface (.org-section, .org-table, .panel, .status-card) had none
     at all, which is most of why the app read as flat next to it.
     These bring the rest of the app up to that same quality bar. */
  --shadow-sm: 0 1px 2px rgba(20, 38, 30, 0.06), 0 1px 3px rgba(20, 38, 30, 0.08);
  --shadow-md: 0 4px 10px rgba(20, 38, 30, 0.08), 0 2px 4px rgba(20, 38, 30, 0.06);
  --shadow-lift: 0 8px 20px rgba(20, 38, 30, 0.14);
}

*:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, .sidebar-brand, .topbar-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

code, .unit-code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

a { color: var(--copper); }

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

.shell {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--forest);
  color: var(--paper);
  padding: 0.85rem 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-name {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
}

.topbar-badge {
  margin-left: auto;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  white-space: nowrap;
}

.topbar-badge--ok { background: rgba(143, 169, 140, 0.18); border-color: var(--sage); color: #d9e6d6; }
.topbar-badge--error { background: rgba(168, 68, 44, 0.18); border-color: var(--brick); color: #f0c9bf; }

.topbar-login {
  color: var(--paper);
  font-size: 0.82rem;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem;
}

.topbar-login:hover { background: rgba(255,255,255,0.12); }

.nav-toggle { display: none !important; } /* replaced by always-visible module tab bar */
.nav-toggle-_unused {
  width: 32px;
  height: 28px;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--paper);
  border-radius: 2px;
}

/* ---------- Sidebar / hierarchy ---------- */

.sidebar {
  background: var(--forest-dark);
  color: var(--paper);
  padding: 1.25rem 1rem 2rem;
  overflow-y: auto;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.sidebar.is-open {
  max-height: 80vh;
}

.sidebar-brand {
  display: none; /* shown only in desktop sidebar, topbar covers mobile */
}

.sidebar-login {
  display: none;
  color: var(--paper);
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  margin-bottom: 1rem;
}

.sidebar-login:hover { background: rgba(255,255,255,0.12); }

.sidebar-caption {
  color: var(--sage);
  font-size: 0.82rem;
  margin: 0 0 1rem;
}

.brand-group + .brand-group { margin-top: 1.25rem; }

.brand-name {
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding-bottom: 0.4rem;
  margin-bottom: 0.6rem;
}

.unit-list { list-style: none; margin: 0; padding: 0; }

.unit-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
  font-size: 0.92rem;
}

.unit-code {
  color: var(--copper);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.unit-name { flex: 1; }

.unit-type {
  font-size: 0.68rem;
  color: var(--sage);
  flex-shrink: 0;
}

/* ---------- Content ---------- */

.content {
  padding: 1.25rem 1rem 3rem;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

.intro h1 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

.intro p {
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 1.5rem;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.status-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--sage);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.status-card--error { border-left-color: var(--brick); }
.status-card--warn { border-left-color: var(--copper); }

.status-label {
  font-size: 0.76rem;
  color: var(--muted);
}

.status-value {
  font-size: 1.15rem;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
}

.status-detail {
  font-size: 0.78rem;
  color: var(--brick);
  word-break: break-word;
}

.panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.2rem;
}

.panel h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.panel-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  font-size: 0.9rem;
}

.settings-list dt { color: var(--muted); }
.settings-list dd { margin: 0; }

.checklist {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.92rem;
}

.checklist li { margin-bottom: 0.4rem; }
.checklist--muted li { color: var(--muted); }

.error-shell {
  padding: 3rem 1.5rem;
  text-align: center;
}

/* ---------- Tablet and up ---------- */

@media (min-width: 640px) {
  .status-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Desktop and up: fixed sidebar layout ---------- */

/* ---------- Auth: login screen ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at top left, rgba(143,169,140,0.15), transparent 45%),
    var(--forest);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--paper);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: 0 20px 50px rgba(13, 25, 19, 0.35);
}

.auth-platform {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--forest);
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-error {
  background: rgba(168, 68, 44, 0.1);
  border: 1px solid var(--brick);
  color: var(--brick);
  font-size: 0.86rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  margin: 0 0 1rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.75rem 0 0.3rem;
}

.auth-input {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--parchment);
  color: var(--ink);
}

.auth-input:focus {
  outline: 2px solid var(--copper);
  outline-offset: 1px;
}

.auth-submit {
  margin-top: 1.5rem;
  background: var(--forest);
  color: var(--paper);
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
}

.auth-submit:hover { background: var(--forest-dark); }

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

.app-shell { min-height: 100vh; }

.app-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
  background: var(--forest);
  color: var(--paper);
  padding: 0.9rem 1.25rem;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 25;
}

.app-topbar-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
}

.app-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.88rem;
}

.logout-form { margin: 0; }

.logout-button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.logout-button:hover { background: rgba(255,255,255,0.12); }

.app-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.app-content h1 {
  font-size: 1.4rem;
  margin: 0 0 0.75rem;
}

.app-content-note {
  color: var(--muted);
  max-width: 60ch;
}

@media (min-width: 960px) {
  .shell {
    grid-template-columns: 260px 1fr;
    grid-template-rows: 100vh;
  }

  .topbar { display: none; }

  .sidebar {
    max-height: none;
    grid-row: 1;
    grid-column: 1;
  }

  .sidebar-brand {
    display: block;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    margin-bottom: 0.3rem;
  }

  .sidebar-login { display: inline-block; }

  .content {
    grid-row: 1;
    grid-column: 2;
    overflow-y: auto;
    padding: 2.5rem 3rem;
  }

  .status-grid { grid-template-columns: repeat(4, 1fr); }
  .panels { grid-template-columns: repeat(3, 1fr); }

  .app-content { padding: 3rem 1.25rem; }
}


/* ---------- Organization module ---------- */

.org-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.org-nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.86rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.org-nav-link:hover { background: var(--parchment); }

.org-nav-link.is-active {
  background: var(--forest);
  color: var(--paper);
}

/* ---------- Mobile nav drawer (org-nav.php) ----------
   The topbar itself is always visible at every width; below 960px
   the context switcher + nav collapse into a panel toggled by the
   .nav-toggle button in the topbar (app.js handles it generically via
   aria-controls - same interaction home.php's own sidebar toggle
   already used, section: "Design plan" comment at the top of this
   file promised this and it was never actually built for the
   authenticated app's own nav). At 960px+ everything reverts to
   exactly the always-visible horizontal bar this already was. */
@media (max-width: 959px) {
  .app-nav-panel { display: none; }
  .app-nav-panel.is-open { display: block; animation: nav-panel-in 0.15s ease; }

  .org-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    background: var(--forest-dark);
    border-bottom: none;
    padding: 0.5rem 0 0.75rem;
  }

  .org-nav-link {
    color: rgba(255, 255, 255, 0.88);
    padding: 0.85rem 1.25rem;
    border-radius: 0;
    font-size: 0.95rem;
  }

  .org-nav-link:hover { background: rgba(255, 255, 255, 0.08); }
  .org-nav-link.is-active { background: rgba(255, 255, 255, 0.14); color: var(--paper); }

  .context-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .context-switch-form { justify-content: space-between; }
  .context-select { flex: 1; }
}

@media (min-width: 960px) {
  .app-topbar .nav-toggle { display: none; }
  .app-nav-panel { display: block !important; }
}

@keyframes nav-panel-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-content--narrow { max-width: 560px; }
.app-content--wide { max-width: 900px; }

.org-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.org-page-header h1 { margin: 0; font-size: 1.4rem; }

.org-button {
  display: inline-block;
  background: var(--forest);
  color: var(--paper);
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.org-button:hover { background: var(--forest-dark); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.org-button:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.org-button--ghost {
  background: transparent;
  color: var(--forest);
  border: 1px solid var(--line);
  box-shadow: none;
}

.org-button--ghost:hover { background: var(--parchment); box-shadow: none; transform: none; }

.org-button--small { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

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

.org-table-wrap {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.org-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.org-table tbody tr {
  transition: background-color 0.12s ease;
}

.org-table tbody tr:hover {
  background: var(--parchment);
}

.org-table th, .org-table td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.org-table th {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
}

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

.org-badge {
  display: inline-block;
  font-size: 0.76rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.org-badge--ok { background: rgba(143,169,140,0.18); border-color: var(--sage); color: #3f5c3c; }
.org-badge--off { background: rgba(168,68,44,0.1); border-color: var(--brick); color: var(--brick); }

.org-form { display: flex; flex-direction: column; }

.org-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.9rem 0 0.3rem;
}

.org-input, .org-select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}

.org-input:disabled { background: var(--parchment); color: var(--muted); }

.org-hint { font-size: 0.78rem; color: var(--muted); margin: 0.3rem 0 0; }

.org-field-error { font-size: 0.8rem; color: var(--brick); margin-top: 0.25rem; }

.org-form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.org-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.org-section h2 { font-size: 1rem; margin: 0 0 0.9rem; }

.org-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--line);
}

.org-checkbox-row:last-child { border-bottom: none; }

.org-checkbox-row label { font-size: 0.92rem; flex: 1; }

.org-shift-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.4rem 0 0.6rem;
}

.org-hours-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.org-hours-table th, .org-hours-table td { padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); text-align: left; }
.org-hours-table input[type="time"] { width: 100%; }

.org-copy-box {
  background: rgba(201,125,52,0.08);
  border: 1px solid var(--copper);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

@media (max-width: 719px) {
  .org-table thead { display: none; }
  .org-table, .org-table tbody, .org-table tr, .org-table td { display: block; width: 100%; }
  .org-table tr { border-bottom: 1px solid var(--line); padding: 0.5rem 0; }
  .org-table td {
    border-bottom: none;
    padding: 0.25rem 0.9rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
  }
  .org-table td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
  }
  .org-shift-times { grid-template-columns: 1fr; }
}

/* ---------- Users/Roles module additions ---------- */

.org-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.org-filter-bar .org-input { width: auto; flex: 1 1 220px; }

.org-link-button {
  background: none;
  border: none;
  color: var(--copper);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  font-family: inherit;
}

.org-role-group + .org-role-group { margin-top: 1rem; }
.org-role-group h3 { font-size: 0.85rem; color: var(--muted); margin: 0 0 0.5rem; text-transform: capitalize; }

.org-radio-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* ---------- Context switcher (Sprint 1E) ---------- */

.context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1.25rem;
  background: var(--forest-dark);
  color: var(--paper);
}

.context-switch-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

.context-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.85);
}

.context-select {
  background: rgba(255,255,255,0.1);
  color: var(--paper);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
  font-family: inherit;
}

.context-select option { color: var(--ink); }

/* ---------- Sprint 2D: read-only occurrence board & unit view ---------- */

.org-badge--neutral { background: var(--parchment); border-color: var(--line); color: var(--muted); }

.occ-view-switch { display: flex; gap: 0.4rem; }

.occ-day-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 0.5rem 0 1rem;
}
.occ-day-title { margin: 0; font-size: 1.15rem; flex: 1 1 auto; }

.occ-group { margin: 0 0 1.75rem; }
.occ-group h2 { font-size: 1.05rem; margin: 0 0 0.15rem; }
.occ-group--overdue h2 { color: var(--brick); }
.occ-count {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--parchment);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  text-align: center;
  color: var(--muted);
  font-weight: 500;
}
details.occ-group > summary { cursor: pointer; font-weight: 600; margin-bottom: 0.75rem; }

.occ-muted { color: var(--muted); font-size: 0.82rem; }

.occ-priority {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--parchment);
  color: var(--muted);
}
.occ-priority--high { background: rgba(168,68,44,0.1); border-color: var(--brick); color: var(--brick); }
.occ-priority--normal { color: var(--ink); }

/* Cards (phones and tablets). No horizontal scrolling by construction. */
.occ-table-wrap { display: none; }
.occ-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.occ-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  min-width: 0;
}
.occ-card--overdue { border-left-color: var(--brick); }
.occ-card--pending { border-left-color: var(--sage); }
.occ-card--programmed { border-left-color: var(--copper); }
.occ-card-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.occ-card-title { margin: 0.35rem 0 0.15rem; font-size: 1.02rem; overflow-wrap: anywhere; }
.occ-card-meta { margin: 0.1rem 0; font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.occ-card-times { display: flex; gap: 1.5rem; margin: 0.5rem 0; }
.occ-card-times dt { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.occ-card-times dd { margin: 0; font-weight: 600; }

@media (min-width: 640px) {
  .occ-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* tablet */
}

/* Desktop: dense table, cards hidden. */
@media (min-width: 960px) {
  .occ-cards { display: none; }
  .occ-table-wrap { display: block; overflow-x: auto; }
  .occ-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); }
  .occ-table th, .occ-table td { padding: 0.55rem 0.7rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
  .occ-table th { background: var(--parchment); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
  .occ-row--overdue td:first-child { box-shadow: inset 4px 0 0 var(--brick); }
  .occ-row--pending td:first-child { box-shadow: inset 4px 0 0 var(--sage); }
  .occ-row--programmed td:first-child { box-shadow: inset 4px 0 0 var(--copper); }
}

.occ-pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1.25rem 0; flex-wrap: wrap; }

.occ-detail { display: grid; grid-template-columns: 1fr; gap: 0.6rem 2rem; margin: 0.5rem 0 0; }
.occ-detail dt { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.occ-detail dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (min-width: 640px) { .occ-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Unit-centric activity configuration (2D section 10) */
.uact-schedules { margin: 0; padding: 0; list-style: none; }
.uact-schedules li { margin: 0.1rem 0; font-size: 0.88rem; }
.uact-cards { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.uact-table-wrap { display: none; }
@media (min-width: 640px) { .uact-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) {
  .uact-cards { display: none; }
  .uact-table-wrap { display: block; overflow-x: auto; }
}
.uact-summary { font-size: 0.85rem; color: var(--muted); margin: 0 0 0.5rem; }

/* Activity detail: Brand standard -> Unit application -> Schedules (2D section 9) */
.act-unit-list { display: grid; gap: 0.6rem; }
.act-unit {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 0.7rem 0.9rem;
}
.act-unit--off { background: var(--parchment); }
.act-unit-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; align-items: center; }
.act-unit-facts { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--muted); }

/* ---------- Sprint 3A: employee execution UX (mobile-first) ---------- */

.home-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 1rem 0 1.5rem;
}
@media (min-width: 640px) { .home-counts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.home-count-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 1rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  text-decoration: none;
  color: inherit;
}
.home-count-card--attention { border-color: var(--brick); background: rgba(168,68,44,0.06); }
.home-count-value { font-size: 1.7rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; color: var(--forest); }
.home-count-card--attention .home-count-value { color: var(--brick); }
.home-count-label { font-size: 0.78rem; color: var(--muted); text-align: center; }

.home-section-title { font-size: 1.05rem; margin: 1.5rem 0 0.6rem; }

.occ-cards--home { grid-template-columns: 1fr; }
@media (min-width: 640px) { .occ-cards--home { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
a.occ-card { display: block; text-decoration: none; color: inherit; }

/* Tabs: horizontally scrollable on narrow screens, never wraps into
   a cramped multi-row block that eats vertical space on a phone. */
.employee-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  margin: 0.75rem 0 1.25rem;
  -webkit-overflow-scrolling: touch;
}
.employee-tab {
  flex: 0 0 auto;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}
.employee-tab.is-active { background: var(--forest); border-color: var(--forest); color: var(--paper); }

.employee-flash { padding: 0.6rem 0.9rem; border-radius: var(--radius); margin: 0.75rem 0; font-size: 0.9rem; }
.employee-flash--ok { background: rgba(143,169,140,0.18); border: 1px solid var(--sage); color: #3f5c3c; }
.employee-flash--error { background: rgba(168,68,44,0.1); border: 1px solid var(--brick); color: var(--brick); }

/* Primary action: a large, easy-to-tap button (section 48), full
   width on phones so it is never a small target. */
.employee-action-form { margin: 1.25rem 0; }
.employee-action-button {
  display: block;
  width: 100%;
  padding: 1rem;
  margin-top: 0.6rem;
  border: none;
  border-radius: var(--radius);
  background: var(--copper);
  color: var(--paper);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.employee-action-button:active { background: var(--forest-dark); }
@media (min-width: 640px) { .employee-action-button { width: auto; min-width: 260px; } }

.employee-event-list { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; color: var(--muted); }
.employee-event-list li { padding: 0.3rem 0; border-bottom: 1px solid var(--line); }

.employee-history-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.employee-history-item a {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.employee-history-check { color: var(--sage); font-weight: 700; flex: 0 0 auto; }
.employee-history-name { font-weight: 600; flex: 1 1 auto; }
.employee-history-meta { font-size: 0.8rem; color: var(--muted); width: 100%; }
@media (min-width: 640px) {
  .employee-history-item a { flex-wrap: wrap; }
  .employee-history-meta { width: auto; margin-left: auto; }
}

/* ---------- Sprint 3B: Checklist & Quantitative execution ---------- */

.employee-action-button--small { padding: 0.7rem 1rem; font-size: 0.9rem; min-width: 0; width: 100%; }
@media (min-width: 640px) { .employee-action-button--small { width: auto; } }

.checklist-progress-summary { font-size: 0.95rem; margin: 0.5rem 0 1rem; }

.checklist-items { display: flex; flex-direction: column; gap: 0.9rem; margin: 1rem 0; }
.checklist-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 0.9rem 1rem;
}
.checklist-item--observation { border-left-color: var(--brick); }
.checklist-item-text { font-weight: 600; margin: 0 0 0.6rem; }
.checklist-item-result-readonly { font-weight: 600; margin: 0 0 0.3rem; }
.checklist-item-comment-readonly { color: var(--muted); font-size: 0.88rem; margin: 0; }

/* Vertical stack of options, never a wide desktop grid (section 63). */
.checklist-item-options { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.6rem; }
.checklist-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
}
.checklist-option input[type="radio"], .checklist-option input[type="checkbox"] { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }
.checklist-item-form textarea { margin-bottom: 0.6rem; }

.quantitative-summary { text-align: center; margin: 1rem 0 1.5rem; }
.quantitative-total { display: flex; align-items: baseline; justify-content: center; gap: 0.4rem; flex-wrap: wrap; }
.quantitative-total-value { font-size: 2.4rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; color: var(--forest); }
.quantitative-total-target { font-size: 1.2rem; color: var(--muted); }
.quantitative-progress-bar { height: 0.6rem; border-radius: 999px; background: var(--parchment); overflow: hidden; margin: 0.6rem auto 0.3rem; max-width: 320px; }
.quantitative-progress-fill { height: 100%; background: var(--sage); border-radius: 999px; }
.quantitative-progress-fill--over { background: var(--brick); }

.quantitative-progress-form input[type="number"] { font-size: 1.1rem; padding: 0.8rem; margin-bottom: 0.6rem; }

.quantitative-history { list-style: none; margin: 0; padding: 0; }
.quantitative-history-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.quantitative-history-item--correction { padding-left: 0.75rem; border-left: 3px solid var(--copper); }
.quantitative-history-qty { font-weight: 600; }
.quantitative-correct-toggle { margin-top: 0.4rem; font-size: 0.85rem; }
.quantitative-correct-toggle form { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; max-width: 320px; }

/* ---------- Sprint 3C: Evidence ---------- */

.evidence-section { margin-top: 0.5rem; }
.evidence-policy-line { font-size: 0.88rem; color: var(--muted); margin: 0 0 0.7rem; }

.evidence-list { list-style: none; margin: 0 0 0.9rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.7rem; }
.evidence-list-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem;
  background: var(--paper);
  max-width: 160px;
}
.evidence-thumb-link { display: block; }
.evidence-thumb { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; background: var(--parchment); }
.evidence-doc-link { font-size: 0.85rem; word-break: break-word; }
.evidence-comment-text { font-size: 0.85rem; margin: 0; max-width: 220px; }
.evidence-remove-form { margin: 0; }
.evidence-remove-button { background: none; border: none; color: var(--brick); font-size: 0.78rem; padding: 0; cursor: pointer; text-decoration: underline; }

.evidence-upload-actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.5rem; }
.evidence-upload-form { margin: 0; }
.evidence-file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: 100%;
}
.evidence-file-label--secondary { background: var(--paper); color: var(--forest); border: 1px solid var(--forest); }
.evidence-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.evidence-comment-form textarea { margin-bottom: 0.5rem; }

/* ---------- Sprint 3D: Operational Control ---------- */

.employee-flash--info { background: #e8f0fe; color: #1a4480; border: 1px solid #a8c5f0; }
.employee-flash--warn { background: #fff3cd; color: #7a5c00; border: 1px solid #ffe08a; }

.employee-inline-form { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.5rem; }

.operational-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.operational-history-list li { font-size: 0.88rem; border-left: 3px solid var(--forest); padding-left: 0.6rem; }

/* ---------- Sprint 4A: Operational Audit & Correction ---------- */

.org-checkbox-label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; }

.audit-queue-list { display: flex; flex-direction: column; gap: 0.7rem; }
.audit-queue-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: var(--paper);
  text-decoration: none;
  color: inherit;
}
.audit-queue-card:hover { border-color: var(--forest); }
.audit-queue-card-header { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }

/* Employee-side correction-required banner. */
.employee-flash--correction { background: #fde8e8; color: #7a1c1c; border: 1px solid #f0aeae; }

.correction-required-banner {
  background: #fde8e8;
  border: 2px solid var(--brick);
  border-radius: var(--radius);
  padding: 1rem;
}
.correction-required-banner h2 { color: var(--brick); margin-top: 0; }

/* ---------- Sprint 4B: Operational Dashboard ---------- */

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.dashboard-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: var(--paper);
  text-decoration: none;
  color: inherit;
}
.dashboard-kpi-card:hover { border-color: var(--forest); }
.dashboard-kpi-card--warn { border-color: var(--brick); }
.dashboard-kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--forest); }
.dashboard-kpi-card--warn .dashboard-kpi-value { color: var(--brick); }
.dashboard-kpi-label { font-size: 0.85rem; font-weight: 600; }
.dashboard-kpi-context { font-size: 0.75rem; color: var(--muted); }

/* ---------- Sprint 5A: Production Foundation ---------- */

.org-subnav { display: flex; gap: 0.6rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.org-subnav-link {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
}
.org-subnav-link.is-active { background: var(--forest); color: var(--paper); border-color: var(--forest); }
.org-subnav-link:hover:not(.is-active) { border-color: var(--forest); }

/* ---------- Sprint 5B: Operational Counts ---------- */

.occ-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--line);
}
.occ-stat strong { font-size: 1.4rem; }
.occ-stat span { font-size: 0.78rem; color: var(--muted); }

/* Sprint 5F-B: Station admin screens */
.org-notice { background: #eaf3ea; border: 1px solid var(--sage); color: var(--forest); padding: 10px 14px; border-radius: var(--radius); margin: 12px 0; }
.station-token-reveal { background: #fff7e6; border: 2px solid var(--copper); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.station-token-reveal-code { display: block; font-size: 1.1rem; word-break: break-all; background: var(--paper); padding: 10px; border-radius: var(--radius); margin: 8px 0; }

/* ==========================================================
   Two-level navigation (mobile-first redesign)
   Replaces .org-nav hamburger drawer.
   ========================================================== */

/* ① Module nav — 5 tabs, bottom-fixed on mobile, in-flow on desktop */
.app-module-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.app-module-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 4px 9px;
  text-decoration: none;
  color: var(--muted);
  font-size: 10px;
  border-top: 2px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.app-module-tab i { font-size: 22px; line-height: 1; }
.app-module-tab .mnav-full { display: none !important; }
.app-module-tab .mnav-short { display: block !important; }

.app-module-tab.is-active { color: var(--forest); border-top-color: var(--forest); }
.app-module-tab:hover { color: var(--forest); }

/* Content needs breathing room so fixed bottom nav doesn't cover it */
@media (max-width: 1023px) {
  .app-content { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px) + 1rem); }
}

/* ② Sub-nav — horizontal scrollable strip below context bar (mobile) / below module nav (desktop) */
.app-sub-nav {
  display: flex;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0 0.5rem;
}

.app-sub-nav::-webkit-scrollbar { display: none; }

.app-sub-link {
  flex-shrink: 0;
  padding: 0.55rem 0.8rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
  display: inline-block;
}

.app-sub-link.is-active { color: var(--forest); border-bottom-color: var(--forest); }
.app-sub-link:hover { color: var(--forest); }

/* Separator between config group and operations group in Production sub-nav */
.app-sub-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 4px;
  flex-shrink: 0;
  align-self: center;
}

/* ③ Desktop/tablet (≥1024px): module nav moves to in-flow top bar, icon+label side by side */
@media (min-width: 1024px) {
  .app-module-nav {
    position: static !important;
    border-top: none;
    border-bottom: 1px solid #0d1913;
    background: #14261e !important;
    padding-bottom: 0;
    gap: 0;
  }

  .app-module-tab {
    flex: none;
    flex-direction: row !important;
    gap: 6px;
    padding: 0.65rem 1.1rem;
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.72);
    border-top: none;
    border-bottom: 3px solid transparent;
  }

  .app-module-tab i { font-size: 15px; }
  .app-module-tab .mnav-short { display: none !important; }
  .app-module-tab .mnav-full  { display: block !important; }

  .app-module-tab.is-active {
    color: #fff;
    background: rgba(255,255,255,0.12);
    border-bottom-color: rgba(255,255,255,0.7);
  }

  .app-module-tab:hover { color: #fff; background: rgba(255,255,255,0.07); }

  /* Remove bottom padding override on desktop since nav is no longer fixed */
  .app-content { padding-bottom: 3rem; }
}

/* Inline SVG icons inside module tabs inherit the tab's current color */
.app-module-tab svg { flex-shrink: 0; }

/* Sprint 5H: kiosk alert animations */
@keyframes station-counter-flash {
  0%,100% { background: var(--bg-card,#fff); }
  25%,75%  { background: #fbbf24; color: #1a1a1a; transform: scale(1.08); }
  50%      { background: #f59e0b; color: #1a1a1a; transform: scale(1.12); }
}
.station-counter--flash {
  animation: station-counter-flash 0.6s ease-in-out 5;
}

@keyframes station-idle-pulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.75; }
}
.station-idle-alert--pulse {
  animation: station-idle-pulse 1.2s ease-in-out infinite;
}

/* Sprint 5H: shift/date context on station cards */
.card-context {
  font-size: .78rem;
  color: var(--muted, #888);
  margin: 2px 0 6px;
  font-weight: 500;
  letter-spacing: .01em;
}
.station-section-title {
  margin: 20px 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--line, #e5e5e5);
  padding-bottom: 6px;
}
