/* ─── Reset / base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --c-brand:        #0f4c5c;
  --c-brand-mid:    #1a6578;
  --c-brand-light:  #e8f4f7;
  --c-accent:       #17a589;
  --c-accent-light: #d4f0ea;

  --c-bg:           #f0f3f5;
  --c-surface:      #ffffff;
  --c-border:       #dde3e8;
  --c-border-light: #edf1f4;

  --c-text:         #1a2530;
  --c-text-mid:     #4a5e6a;
  --c-text-light:   #7a8f9a;

  --c-success:      #1a8a60;
  --c-success-bg:   #d6f5ea;
  --c-warning:      #b37a00;
  --c-warning-bg:   #fff3cd;
  --c-danger:       #b03030;
  --c-danger-bg:    #fce8e8;
  --c-info:         #1a6fa8;
  --c-info-bg:      #d8edf8;

  --radius-sm:  4px;
  --radius:     8px;
  --radius-lg:  12px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);

  --font:       'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --font-mono:  'Cascadia Code', 'Consolas', monospace;
}

html { font-size: 15px; position: relative; min-height: 100%; }
@media (min-width: 1200px) { html { font-size: 15.5px; } }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  line-height: 1.6;
  margin-bottom: 60px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-brand-mid); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--c-brand); }

code, pre { font-family: var(--font-mono); font-size: 0.88em; }

code {
  background: var(--c-brand-light);
  border-radius: var(--radius-sm);
  color: var(--c-brand);
  padding: 1px 5px;
}

/* ─── Focus ring ────────────────────────────────────────────────────────────── */
.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(23, 165, 137, .25) !important;
  outline: none;
}

/* ─── Sidebar layout variables ───────────────────────────────────────────────── */
:root {
  --sb-w:          240px;
  --sb-bg:         #0a3040;
  --sb-text:       rgba(255,255,255,.78);
  --sb-text-hi:    #fff;
  --sb-hover:      rgba(255,255,255,.07);
  --sb-active:     rgba(255,255,255,.13);
  --sb-label:      rgba(255,255,255,.38);
  --sb-border:     rgba(255,255,255,.09);
  --topbar-h:      50px;
  --topbar-bg:     var(--c-surface);
  --easing:        cubic-bezier(.4,0,.2,1);
}

/* ─── Root layout ────────────────────────────────────────────────────────────── */
body { margin: 0; }

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

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
.app-sidebar {
  background: var(--sb-bg);
  bottom: 0;
  display: flex;
  flex-direction: column;
  left: 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  transition: width .22s var(--easing), transform .22s var(--easing);
  width: var(--sb-w);
  z-index: 1030;
}

.app-layout.sb-closed .app-sidebar {
  transform: translateX(-100%);
}

/* Sidebar header (brand) */
.sb-header {
  align-items: center;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  flex-shrink: 0;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 14px;
  white-space: nowrap;
}

.sb-logo {
  align-items: center;
  background: var(--c-accent);
  border-radius: 7px;
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  letter-spacing: -.01em;
  width: 28px;
}

.sb-brand-text {
  color: var(--sb-text-hi);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -.01em;
  text-decoration: none;
}

/* Sidebar nav scroll area */
.sb-nav {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px 0 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* Top-level direct link */
.sb-direct {
  align-items: center;
  color: var(--sb-text);
  display: flex;
  font-size: 0.875rem;
  font-weight: 500;
  gap: 8px;
  padding: 8px 16px;
  text-decoration: none;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.sb-direct:hover { background: var(--sb-hover); color: var(--sb-text-hi); text-decoration: none; }
.sb-direct.active { background: var(--sb-active); color: var(--sb-text-hi); font-weight: 600; }

/* Section header (group toggle) */
.sb-section {
  align-items: center;
  background: none;
  border: none;
  color: var(--sb-label);
  cursor: pointer;
  display: flex;
  font-size: 0.68rem;
  font-weight: 700;
  gap: 6px;
  letter-spacing: .08em;
  padding: 13px 16px 5px;
  text-transform: uppercase;
  transition: color .12s;
  width: 100%;
  white-space: nowrap;
}
.sb-section:hover { color: rgba(255,255,255,.65); }
.sb-section .sb-chev {
  margin-left: auto;
  transition: transform .18s var(--easing);
}
.sb-section.collapsed .sb-chev { transform: rotate(-90deg); }
.sb-badge {
  background: #f59e0b;
  border-radius: 9px;
  color: #1a1a2e;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  min-width: 17px;
  padding: 2px 5px;
  text-align: center;
}

/* Sub-section label (inside a group) */
.sb-sub-label {
  color: rgba(255,255,255,.28);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: .07em;
  padding: 10px 16px 3px 28px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Individual nav item */
.sb-item {
  align-items: center;
  color: var(--sb-text);
  display: flex;
  font-size: 0.875rem;
  padding: 6px 16px 6px 28px;
  text-decoration: none;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.sb-item:hover { background: var(--sb-hover); color: var(--sb-text-hi); text-decoration: none; }
.sb-item.active { color: var(--sb-text-hi); font-weight: 600; }

.sb-divider {
  border-color: var(--sb-border);
  margin: 4px 14px;
  opacity: 1;
}

/* Sidebar footer */
.sb-footer {
  border-top: 1px solid var(--sb-border);
  flex-shrink: 0;
  padding: 10px 0;
}
.sb-footer .sb-item { padding-left: 16px; }

/* ─── Main wrapper ───────────────────────────────────────────────────────────── */
.app-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-left: var(--sb-w);
  min-height: 100vh;
  min-width: 0;
  transition: margin-left .22s var(--easing);
}
.app-layout.sb-closed .app-main { margin-left: 0; }

/* ─── Top bar ────────────────────────────────────────────────────────────────── */
.app-topbar {
  align-items: center;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Hamburger button */
.topbar-toggle {
  align-items: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--c-text-mid);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 4px;
  height: 34px;
  justify-content: center;
  padding: 6px;
  transition: background .12s, color .12s;
  width: 34px;
}
.topbar-toggle:hover { background: var(--c-bg); color: var(--c-text); }
.topbar-toggle span {
  background: currentColor;
  border-radius: 1px;
  display: block;
  height: 2px;
  transition: transform .2s, opacity .2s, width .2s;
  width: 18px;
}
.topbar-toggle span:nth-child(2) { width: 14px; }

.topbar-spacer { flex: 1; }

.period-chip {
  align-items: center;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 5px;
  min-height: 30px;
  padding: 4px 10px;
  white-space: nowrap;
}
.period-chip.open {
  background: var(--c-success-bg);
  border-color: #a8dcca;
  color: #0f5236;
}
.period-chip.closed {
  background: var(--c-warning-bg);
  border-color: #ffd470;
  color: #6b4800;
}

/* Login partial inside topbar */
.app-topbar .navbar-nav {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 4px;
}
.app-topbar .nav-link { color: var(--c-text-mid) !important; font-size: 0.875rem; padding: 5px 10px; }
.app-topbar .nav-link:hover { color: var(--c-text) !important; }
.app-topbar .navbar-text { color: var(--c-text-mid); font-size: 0.875rem; padding: 5px 4px; }

/* ─── Layout shell ──────────────────────────────────────────────────────────── */
.app-shell {
  flex: 1;
  padding: 24px 28px;
}

.app-footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  color: var(--c-text-light);
  font-size: 0.85rem;
  padding: 12px 28px;
}

/* ─── Mobile overlay ─────────────────────────────────────────────────────────── */
.sb-backdrop {
  background: rgba(0,0,0,.45);
  bottom: 0;
  display: none;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 1029;
}
.sb-backdrop.show { display: block; }

/* ─── Auth layout ───────────────────────────────────────────────────────────── */
.auth-body {
  align-items: center;
  background: var(--c-bg);
  display: flex;
  justify-content: center;
  margin: 0;
  min-height: 100vh;
  padding: 32px 16px;
}

.auth-wrap {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 420px;
}

.auth-brand {
  align-items: center;
  display: flex;
  gap: 10px;
}

.auth-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 40px;
  width: 100%;
}

.auth-card h1, .auth-card h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: 4px; }
.auth-card .lead { color: var(--c-text-mid); font-size: 0.9rem; margin-bottom: 24px; }
.auth-card hr { display: none; }
..auth-card .col-md-4 { width: 100%; max-width: 100%; flex: none; padding: 0; }
.auth-card .col-md-8 { display: none !important; }
.auth-card .row { display: block; }
.auth-wrap:has(.nav-pills) .auth-card .row { display: flex; }
.auth-login h1 { margin-bottom: 0; }
.auth-login .lead { margin-bottom: 28px; color: var(--c-text-mid); }
.auth-login .form-label { font-weight: 600; margin-bottom: 0.35rem; }
.auth-login .form-check { margin-bottom: 20px; }
.auth-login .btn-primary { min-height: 48px; }
.auth-login a { color: var(--c-brand); }
.auth-login a:hover { text-decoration: underline; }
.external-login { margin-top: 30px; }
.auth-card p:has(a[href*="Register"]),
.auth-card p:has(a[href*="ResendEmailConfirmation"]) { display: none; }
.auth-footer-text { color: var(--c-text-light); font-size: 0.8rem; }

/* ─── Identity Manage pages (widen auth layout + style tabs) ────────────────── */
/* Detect the Manage page by its nav-pills inside auth-card */
.auth-wrap:has(.nav-pills) {
  max-width: 880px;
}

.auth-card h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.auth-card h1 + div > h2 {
  color: var(--c-text-mid);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0;
}

.auth-card hr {
  display: block !important;
  border-top: 1px solid var(--c-border-light);
  margin: 10px 0 18px;
}

/* Row layout: nav sidebar + content */
.auth-card .row {
  display: flex;
  gap: 0;
}

.auth-card .col-lg-3,
.auth-card .col-md-3 {
  flex: 0 0 210px;
  max-width: 210px;
  padding-right: 18px;
}

.auth-card .col-lg-9,
.auth-card .col-md-9 {
  flex: 1;
  min-width: 0;
  padding-left: 18px;
  border-left: 1px solid var(--c-border-light);
}

/* Nav pills (tabs) */
.auth-card .nav-pills {
  gap: 1px;
}

.auth-card .nav-pills .nav-link {
  border-radius: var(--radius-sm);
  color: var(--c-text-mid);
  font-size: 0.86rem;
  font-weight: 500;
  padding: 8px 14px;
  text-decoration: none;
  transition: background .12s, color .12s;
  white-space: nowrap;
}

.auth-card .nav-pills .nav-link:hover {
  background: var(--c-brand-light);
  color: var(--c-brand);
  text-decoration: none;
}

.auth-card .nav-pills .nav-link.active,
.auth-card .nav-pills .nav-link.active:focus {
  background: var(--c-brand);
  color: #fff;
  font-weight: 600;
}

.auth-card .nav-pills .nav-link.active:hover {
  background: var(--c-brand-mid);
  color: #fff;
}

/* Form styling inside manage card */
.auth-card .form-floating { margin-bottom: 10px; }
.auth-card .form-floating label { color: var(--c-text-light); }
.auth-card .valid   { border-color: var(--c-success) !important; }
.auth-card .invalid { border-color: var(--c-danger)  !important; }
.auth-card .text-danger { color: var(--c-danger) !important; }

/* PersonalData page: tidy up Download / Delete buttons */
#download-data {
  display: inline-block;
  margin-bottom: 6px;
  margin-right: 8px;
}

#download-data + p {
  display: inline-block;
  margin-bottom: 0;
  vertical-align: middle;
}

#download-data + p #delete {
  vertical-align: middle;
}

/* Responsive: stack on small screens */
@media (max-width: 991px) {
  .auth-card .row { flex-direction: column; }
  .auth-card .col-lg-3,
  .auth-card .col-lg-9,
  .auth-card .col-md-3,
  .auth-card .col-md-9 {
    flex: none;
    max-width: 100%;
    padding: 0;
    border-left: none;
  }
  .auth-card .col-lg-3,
  .auth-card .col-md-3 {
    border-bottom: 1px solid var(--c-border-light);
    margin-bottom: 14px;
    padding-bottom: 12px;
  }
  .auth-card .nav-pills {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .auth-card .nav-pills .nav-link {
    padding: 6px 10px;
    font-size: 0.82rem;
  }
  #download-data,
  #download-data + p {
    display: block;
    margin-right: 0;
  }
  #download-data + p {
    margin-top: 6px;
  }
}

/* ─── Page structure ────────────────────────────────────────────────────────── */
.ops-page { display: grid; gap: 20px; }

.page-band {
  align-items: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 120px;
  padding: 24px 28px;
}

.page-band.compact { min-height: 88px; padding: 18px 24px; }

.page-band h1 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
  margin: 4px 0 0;
}

.page-band-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.eyebrow {
  color: var(--c-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}
.eyebrow a { color: inherit; }
.eyebrow a:hover { text-decoration: underline; }

.lead { color: var(--c-text-mid); font-size: 0.95rem; margin: 4px 0 0; }

/* ─── Panels / cards ────────────────────────────────────────────────────────── */
.panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
}

.panel-heading {
  align-items: center;
  border-bottom: 1px solid var(--c-border-light);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -20px -24px 18px;
  padding: 14px 24px;
}

.panel-heading h2 {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 0;
}

/* ─── Panel grid / stat cards ──────────────────────────────────────────────── */
.panel-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 2px;
  padding: 16px 18px;
  transition: box-shadow .18s, transform .18s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.stat-card .stat-value {
  color: var(--c-text);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .stat-label {
  color: var(--c-text-light);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-card--info { border-top: 3px solid var(--c-info); }
.stat-card--success { border-top: 3px solid var(--c-success); }
.stat-card--warning { border-top: 3px solid var(--c-warning); }
.stat-card--danger { border-top: 3px solid var(--c-danger); }

@media (max-width: 1100px) {
  .panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .panel-grid { grid-template-columns: 1fr; }
}

/* ─── Metric / KPI cards ────────────────────────────────────────────────────── */
.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 4px;
  padding: 18px 20px;
  transition: box-shadow .18s, transform .18s;
}
.metric-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.metric-card small { color: var(--c-text-light); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.metric-card strong { color: var(--c-text); font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.metric-card span { color: var(--c-text-mid); font-size: 0.85rem; }

.tone-success  { border-top: 3px solid var(--c-success); }
.tone-warning  { border-top: 3px solid var(--c-warning); }
.tone-danger   { border-top: 3px solid var(--c-danger); }
.tone-info     { border-top: 3px solid var(--c-info); }
.tone-accent   { border-top: 3px solid var(--c-accent); }

/* ─── Summary tiles (reports) ───────────────────────────────────────────────── */
.summary-tiles {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(var(--tile-cols, 4), minmax(0, 1fr));
}

.summary-tile {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-accent);
  border-radius: var(--radius);
  display: grid;
  gap: 2px;
  padding: 16px 18px;
}
.summary-tile.warning { border-left-color: var(--c-warning); }
.summary-tile.danger  { border-left-color: var(--c-danger); }
.summary-tile.info    { border-left-color: var(--c-info); }

.summary-tile .label { color: var(--c-text-light); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.summary-tile .value { color: var(--c-text); font-size: 1.55rem; font-weight: 700; line-height: 1.15; }

/* ─── Data tables ───────────────────────────────────────────────────────────── */
.data-table {
  border-collapse: collapse;
  font-size: 0.9rem;
  width: 100%;
}

.data-table thead tr {
  background: var(--c-bg);
  border-bottom: 2px solid var(--c-border);
}

.data-table thead th {
  color: var(--c-text-light);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 10px 14px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--c-border-light);
  transition: background .1s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--c-brand-light); }

.data-table td {
  color: var(--c-text);
  padding: 11px 14px;
  vertical-align: middle;
}

.data-table tfoot tr { border-top: 2px solid var(--c-border); background: var(--c-bg); }
.data-table tfoot td { font-weight: 600; padding: 10px 14px; }

/* Pagination */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--c-border);
  font-size: 0.85rem;
  color: var(--c-text-mid);
}

/* Extra-small button */
.btn-xs {
  padding: 2px 8px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

/* Backward-compat alias */
.ops-table { border-collapse: collapse; font-size: 0.9rem; width: 100%; }
.ops-table thead th { color: var(--c-text-light); font-size: 0.73rem; font-weight: 700; letter-spacing: .06em; padding: 10px 14px; text-transform: uppercase; }
.ops-table td { padding: 11px 14px; vertical-align: middle; }

/* ─── Filter bar ────────────────────────────────────────────────────────────── */
.filter-bar {
  align-items: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
}

.filter-bar .form-control,
.filter-bar .form-select { max-width: 240px; min-width: 130px; }

/* ─── Period pills ──────────────────────────────────────────────────────────── */
.period-pill {
  background: var(--c-brand-light);
  border: 1px solid #b8d8e4;
  border-radius: var(--radius);
  color: var(--c-brand);
  display: grid;
  gap: 2px;
  min-width: 160px;
  padding: 12px 16px;
}
.period-pill strong { font-size: 1.15rem; }
.period-pill span   { color: var(--c-text-mid); font-size: 0.83rem; }

/* ─── Content grid ──────────────────────────────────────────────────────────── */
.content-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
}
.content-grid.wide-left {
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.5fr);
}

/* ─── Work rows / step rows ─────────────────────────────────────────────────── */
.work-list, .step-list, .quick-form { display: grid; gap: 10px; }

.work-row, .step-row {
  align-items: start;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  transition: box-shadow .15s;
}
.work-row:hover, .step-row:hover { box-shadow: var(--shadow-sm); }

.work-row { grid-template-columns: minmax(0, 1fr) auto; }
.work-row strong, .work-row span, .work-row small,
.step-row strong, .step-row p { display: block; }

.step-row { grid-template-columns: 104px minmax(0, 1fr); }
.step-row > span, .status {
  background: var(--c-accent-light);
  border: 1px solid #a8ddd5;
  border-radius: 999px;
  color: var(--c-accent);
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  width: fit-content;
}
.step-row p { color: var(--c-text-mid); font-size: 0.88rem; margin: 4px 0 0; }

.row-meta { display: grid; gap: 6px; justify-items: end; }

/* ─── Forms ─────────────────────────────────────────────────────────────────── */
.data-form { display: grid; gap: 20px; }
.data-form h2 {
  border-bottom: 1px solid var(--c-border-light);
  color: var(--c-text-mid);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: .06em;
  margin: 4px 0 0;
  padding-bottom: 8px;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid label, .quick-form label {
  color: var(--c-text-mid);
  display: grid;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 6px;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.form-actions {
  border-top: 1px solid var(--c-border-light);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
  padding-top: 16px;
}

.toolbar-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Bootstrap overrides — inputs */
.form-control, .form-select {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  font-size: 0.9rem;
  padding: 8px 11px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:hover, .form-select:hover { border-color: #b0c4cc; }
.form-control:focus, .form-select:focus { border-color: var(--c-accent); }
.form-control::placeholder { color: var(--c-text-light); }

.form-control-sm, .form-select-sm { font-size: 0.85rem; padding: 5px 9px; }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 16px;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--c-brand);
  border-color: var(--c-brand);
  color: #fff;
}
.btn-primary:hover { background: var(--c-brand-mid); border-color: var(--c-brand-mid); color: #fff; }

.btn-success {
  background: var(--c-success);
  border-color: var(--c-success);
  color: #fff;
}
.btn-success:hover { background: #157a52; border-color: #157a52; color: #fff; }

.btn-warning {
  background: #e09400;
  border-color: #e09400;
  color: #fff;
}
.btn-warning:hover { background: #c47f00; border-color: #c47f00; color: #fff; }

.btn-danger {
  background: var(--c-danger);
  border-color: var(--c-danger);
  color: #fff;
}
.btn-danger:hover { background: #962828; border-color: #962828; color: #fff; }

.btn-secondary {
  background: #4a6370;
  border-color: #4a6370;
  color: #fff;
}
.btn-secondary:hover { background: #3b5260; border-color: #3b5260; color: #fff; }

.btn-outline-secondary {
  border-color: var(--c-border);
  color: var(--c-text-mid);
}
.btn-outline-secondary:hover {
  background: var(--c-bg);
  border-color: #b0c0c8;
  color: var(--c-text);
}

.btn-outline-danger {
  border-color: #e8b4b4;
  color: var(--c-danger);
}
.btn-outline-danger:hover { background: var(--c-danger-bg); border-color: var(--c-danger); color: var(--c-danger); }

.btn-sm { font-size: 0.8rem; padding: 5px 11px; }
.btn-lg { font-size: 1rem;   padding: 11px 22px; }

.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-group .btn { border-radius: var(--radius-sm) !important; }

/* ─── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 3px 8px;
  text-transform: uppercase;
}
.bg-success  { background: var(--c-success)  !important; }
.bg-danger   { background: var(--c-danger)   !important; }
.bg-warning  { background: var(--c-warning)  !important; color: #fff !important; }
.bg-info     { background: var(--c-info)     !important; }
.bg-primary  { background: var(--c-brand)    !important; }
.bg-secondary{ background: #6b8290          !important; }
.bg-dark     { background: #2d3f4a          !important; }

/* ─── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  font-size: 0.9rem;
  padding: 12px 16px;
}
.alert-success {
  background: var(--c-success-bg);
  border: 1px solid #a8dcca;
  color: #0f5236;
}
.alert-danger {
  background: var(--c-danger-bg);
  border: 1px solid #f0b8b8;
  color: #7a1f1f;
}
.alert-warning {
  background: var(--c-warning-bg);
  border: 1px solid #ffd470;
  color: #6b4800;
}
.alert-info {
  background: var(--c-info-bg);
  border: 1px solid #98cde8;
  color: #0f3d5c;
}

/* ─── Modals ────────────────────────────────────────────────────────────────── */
.modal-content {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 14px 20px;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-body  { padding: 20px; }
.modal-footer {
  background: var(--c-bg);
  border-top: 1px solid var(--c-border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 12px 20px;
}

/* Ensure form-check inputs are interactive inside modals */
.modal .form-check {
  position: relative;
}
.modal .form-check-input {
  cursor: pointer;
}
.modal .form-check-label {
  cursor: pointer;
}

/* ─── Detail list (key-value pairs) ─────────────────────────────────────────── */
.detail-list {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  margin: 0;
  row-gap: 10px;
}
.detail-list dt {
  color: var(--c-text-light);
  font-size: 0.83rem;
  font-weight: 700;
  padding-top: 1px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.detail-list dd { margin: 0; }

/* ─── Validation ────────────────────────────────────────────────────────────── */
.field-validation-error { color: var(--c-danger); font-size: 0.82rem; }
.text-danger { color: var(--c-danger) !important; }
.text-warning { color: var(--c-warning) !important; }
.text-muted { color: var(--c-text-light) !important; }
.text-success { color: var(--c-success) !important; }

/* ─── Validation summary ────────────────────────────────────────────────────── */
.validation-summary-errors {
  background: var(--c-danger-bg);
  border: 1px solid #f0b8b8;
  border-radius: var(--radius);
  color: #7a1f1f;
  font-size: 0.88rem;
  padding: 12px 16px;
}
.validation-summary-errors ul { margin: 6px 0 0; padding-left: 18px; }

/* ─── Progress bars ─────────────────────────────────────────────────────────── */
.progress {
  background: var(--c-border-light);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.progress-bar { border-radius: 999px; transition: width .4s ease; }

/* ─── Miscellaneous helpers ──────────────────────────────────────────────────── */
.text-end { text-align: right; }
.fw-semibold { font-weight: 600; }

/* Empty state */
.ops-page .panel > p.text-muted:only-child,
p.text-muted.empty-state {
  padding: 32px 0;
  text-align: center;
  font-size: 0.95rem;
}

/* Inline form delete buttons */
form[style*="display:inline"] { display: inline !important; }

/* ─── Bootstrap .table harmonisation ────────────────────────────────────────── */
.table {
  font-size: 0.9rem;
  color: var(--c-text);
  margin-bottom: 0;
}
.table > :not(caption) > * > * { padding: 11px 14px; }
.table thead > tr > th {
  background: var(--c-bg);
  border-bottom: 2px solid var(--c-border);
  color: var(--c-text-light);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table tbody > tr { border-bottom: 1px solid var(--c-border-light); transition: background .1s; }
.table tbody > tr:last-child > * { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { background: var(--c-brand-light); }

/* ─── Login partial / identity ───────────────────────────────────────────────── */
.navbar-nav .nav-link.text-dark { color: rgba(255,255,255,.82) !important; }
.navbar-nav .nav-link.text-dark:hover { color: #fff !important; }

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .panel-grid           { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metric-grid          { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .summary-tiles        { --tile-cols: 2 !important; }
  .content-grid,
  .content-grid.wide-left { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-shell            { padding: 14px 16px; }
  .page-band            { flex-direction: column; align-items: flex-start; min-height: auto; }
  .page-band h1         { font-size: 1.35rem; }
  .page-band-actions    { width: 100%; }
  .form-grid            { grid-template-columns: 1fr; }
  .span-2, .span-3      { grid-column: auto; }
  .metric-grid          { grid-template-columns: 1fr; }
  .summary-tiles        { --tile-cols: 1 !important; }
  .filter-bar           { flex-direction: column; align-items: stretch; }
  .filter-bar .form-control,
  .filter-bar .form-select { max-width: none; }
  .data-table           { font-size: 0.82rem; }
  .data-table th,
  .data-table td        { padding: 8px 10px; }
  .btn-group            { flex-wrap: wrap; }
}
