/* ── Omega Light Design System ── */
@import url('https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600;700&display=swap');

:root {
  color-scheme: light;

  /* Omega Light palette */
  --ol-900: #0F363F;
  --ol-800: #186077;
  --ol-700: #1e7a94;
  --ol-600: #2594b0;
  --ol-400: #6ec4d8;
  --ol-100: #e6f7fb;

  /* Semantic tokens */
  --bg:        #f3f5f7;
  --surface:   #ffffff;
  --surface-2: #eef1f4;
  --text:      #17222c;
  --muted:     #637080;
  --line:      #d6dde5;
  --accent:    var(--ol-800);
  --accent-strong: var(--ol-900);
  --ok:        #2d6a4f;
  --danger:    #a33a3a;
  --shadow:    0 8px 24px rgba(15, 54, 63, 0.08);

  /* Layout */
  --topbar-h:  56px;
  --sidebar-w: 220px;
  --radius:    12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  font-family: 'Jost', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }

/* ── Page progress bar ── */
#page-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 99999;
  background: var(--ol-400);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
#page-progress.loading {
  opacity: 1;
  animation: pg-run 2s cubic-bezier(.1,.6,.4,1) forwards;
}
@keyframes pg-run {
  0%   { width: 0; }
  25%  { width: 55%; }
  60%  { width: 78%; }
  100% { width: 92%; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }

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

/* ── Topbar ── */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ol-900);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar h1 { color: #fff; }
.topbar .eyebrow { color: rgba(255,255,255,.55); }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.topbar-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ol-400);
  margin-right: 4px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.75);
  font-size: 13px;
}

.role-badge {
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.65);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.topbar-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-pill);
  color: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 120ms;
}

.topbar-logout:hover {
  background: rgba(255,255,255,.16);
  color: #fff;
}

/* ── Sidebar ── */
.sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.sidebar-section {
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-label {
  padding: 6px 8px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: background 100ms, color 100ms;
  text-decoration: none;
}

.sidebar-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--ol-100);
  color: var(--ol-800);
  font-weight: 600;
}

.sidebar-divider {
  height: 1px;
  background: var(--line);
  margin: 10px 16px;
}

/* ── Main content ── */
.main {
  grid-area: main;
  min-width: 0;
  padding: 24px;
  overflow: auto;
}

/* ── Page structure ── */
.page {
  max-width: 1200px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.page-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--ol-600);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}

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

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.card-body {
  padding: 20px;
}

.card-body--table {
  /* no padding — table extends to edges */
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms, box-shadow 120ms;
}

.btn-primary {
  background: var(--ol-800);
  border-color: var(--ol-800);
  color: #fff;
}
.btn-primary:hover {
  background: var(--ol-900);
  border-color: var(--ol-900);
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}
.btn-secondary:hover {
  background: #dde3ea;
  border-color: #c0c9d4;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: #fff0ee;
  border-color: #f0b8b2;
  color: var(--danger);
}
.btn-danger:hover {
  background: #ffe0db;
}

.btn-ok {
  background: #edf8f1;
  border-color: #b0ddc2;
  color: var(--ok);
}
.btn-ok:hover {
  background: #d5f0e1;
}

.btn-sm {
  min-height: 28px;
  padding: 4px 12px;
  font-size: 12px;
}

/* Legacy compat */
button,
.primary-link,
.row-action,
.ghost-button,
.pager a {
  min-height: 32px;
  border: 1px solid var(--ol-800);
  border-radius: var(--radius-pill);
  background: var(--ol-800);
  color: #fff;
  padding: 6px 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background 120ms;
}

button:hover,
.primary-link:hover,
.row-action:hover,
.pager a:hover {
  background: var(--ol-900);
  border-color: var(--ol-900);
}

.ghost-button {
  background: transparent;
  color: var(--ol-800);
  border-color: var(--line);
}

.ghost-button:hover {
  background: var(--surface-2);
  color: var(--ol-900);
  border-color: var(--line);
}

/* ── Forms ── */
input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  transition: border-color 120ms, box-shadow 120ms;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ol-600);
  box-shadow: 0 0 0 3px rgba(37, 148, 176, 0.14);
}

textarea { resize: vertical; }

.form-grid {
  display: grid;
  gap: 16px;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row .form-group { flex: 1 1 200px; }

.form-group {
  display: grid;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}

.form-check input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--ol-700);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.badge-admin    { background: #e8e0fb; color: #5a36b0; }
.badge-approver { background: var(--ol-100); color: var(--ol-800); }
.badge-viewer   { background: var(--surface-2); color: var(--muted); }
.badge-active   { background: #e8f6ee; color: var(--ok); }
.badge-inactive { background: #f5e8e8; color: var(--danger); }

/* ── Flash messages ── */
.flash {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 12px;
}

.flash.error   { background: #fff0ee; color: var(--danger); border: 1px solid #f0c0bc; }
.flash.success { background: #e8f6ee; color: var(--ok); border: 1px solid #b0ddc2; }
.flash.info    { background: var(--ol-100); color: var(--ol-800); border: 1px solid #b0d8e5; }

/* ── Tables ── */
.table-wrap { overflow: auto; }

table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

td strong { display: block; max-width: 360px; overflow-wrap: anywhere; }
tr.selected td { background: var(--ol-100); }

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px;
  font-size: 13px;
}

.row-action {
  min-height: 28px;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: var(--radius-pill);
}

/* ── Pager ── */
.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 13px;
  gap: 12px;
}

.pager span:last-child { text-align: right; }
.pager span:first-child:not(:only-child) { text-align: left; }
.pager > span:nth-child(2) { text-align: center; }

/* ── KPI grid ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
}

.kpi-card--clickable:hover {
  background: var(--surface-2);
  border-color: var(--ol-400);
  box-shadow: 0 4px 18px rgba(23, 107, 135, 0.18);
  transform: translateY(-1px);
  color: var(--text);
}

.kpi-card--warning {
  border-color: var(--ol-400);
  background: var(--ol-100);
}

.kpi-card--urgent {
  border-color: #e08070;
  background: #fff3f1;
}

.kpi-card--urgent .kpi-value { color: #c0392b; }

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.kpi-value {
  display: block;
  font-size: 32px;
  font-weight: 800;
  margin-top: 6px;
  line-height: 1;
}

.kpi-sub {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  color: #c0392b;
}

.kpi-sub--muted { color: var(--muted); }

/* ── KPI clickable ── */
.kpi-card--clickable {
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: box-shadow 0.12s, transform 0.1s;
}


/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 440px;
}

.login-hero {
  background: var(--ol-900);
  display: flex;
  align-items: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(37,148,176,.25) 0%, transparent 60%);
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.login-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ol-700);
  margin: 0 0 28px;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 4px;
}

/* ── Legacy app-shell (drawings/dashboard still use this wrapper) ── */
.app-shell {
  min-height: 100vh;
  padding: 20px;
}

/* ── Metrics bar ── */
.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metrics div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.metric-button {
  min-height: auto;
  display: block;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px;
}

.metric-button:hover {
  background: var(--ol-100);
  border-color: var(--ol-600);
  color: var(--text);
}

.metrics span,
.file-meta dt,
td span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.muted { color: var(--muted); }

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

/* ── Workspace (drawings list + preview) ── */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 14px;
  align-items: start;
}

.list-pane,
.preview-pane {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

/* ── Preview pane ── */
.preview-pane {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  overflow: hidden;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.preview-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.preview-head h2 { overflow-wrap: anywhere; }

.file-meta {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.file-meta div { min-width: 0; }
.file-meta dd { margin: 2px 0 0; overflow-wrap: anywhere; }

.session-note {
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff8e8;
  color: #755100;
  font-size: 12px;
  font-weight: 700;
}

.session-note.ok {
  background: #e8f6ee;
  color: var(--ok);
}

.preview-frame,
.preview-empty {
  width: 100%;
  height: min(72vh, 780px);
  border: 0;
}

.preview-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-2);
  padding: 24px;
  text-align: center;
}

/* ── Session panel ── */
.session-panel { width: min(640px, 100%); }

.session-state {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px;
}

.session-state span,
.session-state small { color: var(--muted); font-size: 12px; }
.session-state strong { font-size: 18px; }

.session-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ── NC badges & modals ── */
.nc-badge {
  min-height: 0;
  width: fit-content;
  min-width: 28px;
  border-radius: var(--radius-pill);
  border: 0;
  background: #ffe8d1;
  color: #7a3f00;
  padding: 3px 8px;
  font-weight: 800;
  text-align: center;
}

.nc-badge:hover { background: #ffd6a6; color: #5b2f00; }

.nc-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.nc-list article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fffaf4;
}

.nc-list .row-action { width: fit-content; }

.nc-list article div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.nc-list p { margin: 0; overflow-wrap: anywhere; }
.nc-list span { color: var(--muted); font-size: 12px; }

.nc-modal {
  width: min(980px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 54, 63, 0.28);
}

.nc-modal::backdrop { background: rgba(15, 54, 63, 0.45); }

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.modal-body {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 16px;
}

.nc-modal-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fffaf4;
  padding: 12px;
}

.nc-modal-item div { display: flex; justify-content: space-between; gap: 12px; }
.nc-modal-item p { margin: 0; overflow-wrap: anywhere; }
.nc-modal-item span { color: var(--muted); font-size: 12px; }
.nc-modal-item .primary-link { width: fit-content; }

/* ── OP badges & lists ── */
.op-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  border-radius: var(--radius-pill);
  background: var(--ol-100);
  color: var(--ol-800);
  padding: 3px 8px;
  font-weight: 800;
  font-size: 12px;
}

.op-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.list-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.op-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--ol-100);
}

.op-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.op-status {
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 6px;
}

.op-status--active { background: #d4edda; color: #155724; }
.op-status--idle   { background: var(--surface-2); color: var(--muted); }

.op-data-apt {
  font-size: 11px;
  font-weight: 600;
  color: #c0392b;
}

/* ── Dashboard ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
  align-items: start;
}

.dash-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.dash-panel-title { margin: 0 0 14px; font-size: 15px; }

.chart-wrap { height: 260px; position: relative; }
.dash-table { min-width: 0; }

.bar-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.bar-inline::before {
  content: '';
  display: block;
  height: 8px;
  width: calc(var(--bar-pct, 0%) * 0.8);
  min-width: 4px;
  background: var(--ol-700);
  border-radius: 99px;
}

.alert-box {
  background: #fff8e8;
  border: 1px solid #e0c060;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
  color: #755100;
}

.alert-box code {
  background: #f3e9c0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ── Dashboard filter bar ── */
.dash-filter-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.dash-filter-row {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.dash-filter-group { display: grid; gap: 6px; }
.dash-filter-group--grow { flex: 1; min-width: 240px; }

.dash-filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.date-quick-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-quick {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.date-quick:hover { background: var(--ol-100); border-color: var(--ol-600); }

.date-quick--active {
  background: var(--ol-800);
  border-color: var(--ol-800);
  color: #fff;
  font-weight: 700;
}

input[type="date"] {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.search-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.search-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  min-width: 0;
}

.search-input:focus {
  outline: none;
  border-color: var(--ol-600);
  box-shadow: 0 0 0 3px rgba(37, 148, 176, 0.14);
}

.primary-button {
  background: var(--ol-800);
  border: 1px solid var(--ol-800);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button:hover {
  background: var(--ol-900);
  border-color: var(--ol-900);
}

/* ── Search results (dashboard) ── */
.search-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.search-section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.search-section-header h2 { margin: 0; font-size: 16px; }

.inspecao-card--search { border-color: #b8d4e8; background: #f0f8ff; }
.inspecao-card--search:hover { background: #dceefa; border-color: var(--ol-700); }
.inspecao-card--search .inspecao-code { color: var(--ol-700); }

.ops-result-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

/* ── Inspeção hoje ── */
.inspecao-panel {
  background: var(--surface);
  border: 2px solid #c0392b;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(192, 57, 43, 0.12);
}

.inspecao-header { margin-bottom: 14px; }

.inspecao-pill {
  display: inline-block;
  background: #c0392b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.inspecao-header h2 { margin: 0 0 4px; color: #c0392b; }
.inspecao-header p { margin: 0; }

.inspecao-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.inspecao-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e8b4b0;
  border-radius: var(--radius-sm);
  background: #fff8f7;
  overflow: hidden;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.inspecao-card-link {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  flex: 1;
  transition: background 0.12s;
}
.inspecao-card-link:hover { background: #fce8e6; }
.inspecao-card:hover { border-color: #c0392b; }

.inspecao-actions {
  display: flex;
  gap: 1px;
  border-top: 1px solid #e8b4b0;
}

.inspecao-btn {
  flex: 1;
  border: none;
  border-radius: 0;
  padding: 7px 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.1s;
  min-height: unset;
  letter-spacing: .02em;
}

.inspecao-btn--approve {
  background: #f0faf4;
  color: #2d6a4f;
}
.inspecao-btn--approve:hover { background: #2d6a4f; color: #fff; }

.inspecao-btn--nc {
  background: #fffbea;
  color: #b45309;
}
.inspecao-btn--nc:hover { background: #b45309; color: #fff; }

/* Cards aprovados e com NC */
.inspecao-card--aprovado {
  border-color: #86efac;
  background: #f0faf4;
  opacity: .85;
}
.inspecao-card--aprovado .inspecao-code { color: #2d6a4f; }
.inspecao-card--aprovado .inspecao-card-link:hover { background: #dcfce7; }

.inspecao-card--nc {
  border-color: #fcd34d;
  background: #fffbea;
  opacity: .85;
}
.inspecao-card--nc .inspecao-code { color: #b45309; }
.inspecao-card--nc .inspecao-card-link:hover { background: #fef9c3; }

/* KPI cards novos */
.kpi-card--aprovado {
  border-color: #86efac;
  background: #f0faf4;
}
.kpi-card--aprovado .kpi-value { color: #2d6a4f; }

.kpi-card--nc {
  border-color: #fcd34d;
  background: #fffbea;
}
.kpi-card--nc .kpi-value { color: #b45309; }

.kpi-sub--ok { color: #2d6a4f; }
.kpi-sub--nc { color: #b45309; }

/* Labels de seção dentro do painel */
.inspecao-section-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.inspecao-section-label--ok  { color: #2d6a4f; }
.inspecao-section-label--nc  { color: #b45309; }

/* ── Modal drag & maximize ── */
dialog {
  position: fixed;
}
dialog:not([open]) {
  display: none;
}
.modal-max-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-height: unset;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms, color 120ms;
}
.modal-max-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
dialog.modal-maximized {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  left: 0 !important;
  top: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
}
dialog.modal-maximized .preview-frame {
  height: calc(100vh - 280px) !important;
}

.inspecao-code {
  font-size: 11px;
  font-weight: 800;
  color: #c0392b;
  letter-spacing: .03em;
}

.inspecao-name { font-size: 13px; font-weight: 600; color: var(--text); }
.inspecao-prod { font-size: 11px; }

.inspecao-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

/* ── PDF viewer modal ── */
.modal-pdf-viewer {
  width: min(1100px, calc(100vw - 28px));
  height: min(92vh, 900px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 54, 63, 0.28);
  display: flex;
  flex-direction: column;
}

.modal-pdf-viewer::backdrop { background: rgba(15, 54, 63, 0.6); }

.modal-pdf-viewer .modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-shrink: 0;
}

.modal-pdf-viewer .modal-body {
  flex: 1;
  overflow-y: auto;
  background: #e5e5e5;
}

/* ── OP modal ── */
.op-modal {
  width: min(900px, calc(100vw - 28px));
  max-height: min(86vh, 820px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 54, 63, 0.28);
  display: flex;
  flex-direction: column;
}

.op-modal::backdrop { background: rgba(15, 54, 63, 0.45); }

.op-modal .modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}

.op-modal .modal-body { overflow: auto; flex: 1; padding: 0; }

.modal-table { width: 100%; min-width: 560px; }
.modal-table thead { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }

.modal-search {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  width: 200px;
}

.modal-search:focus {
  outline: none;
  border-color: var(--ol-600);
}

.modal-pedido-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  color: var(--ol-700);
  background: var(--ol-100);
  border: 1px solid var(--ol-400);
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}

.modal-open-btn:hover {
  background: var(--ol-800);
  color: #fff;
  border-color: var(--ol-800);
}

/* ── Row highlight for drawings to inspect ── */
tr.row--inspecao { background: #fff8f7 !important; }
tr.row--inspecao:hover { background: #fce8e6 !important; }

.insp-dot {
  color: #c0392b;
  font-size: 8px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Metric button urgent variant ── */
.metric-button--urgent {
  border-color: #c0392b !important;
  color: #c0392b !important;
  text-decoration: none;
}

.metric-button--urgent strong { color: #c0392b; }

.metric-approval {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  background: var(--ol-100);
  border: 1px solid #b2dbe5;
  border-radius: var(--radius-sm);
}
.metric-approval > span:first-child {
  font-size: 11px;
  color: var(--ol-700);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.metric-approval strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--ol-900);
}

.file-meta-approval dt { color: var(--ok); font-weight: 600; }
.file-meta-approval dd { color: var(--text); }

.approval-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #d4edda;
  color: var(--ok);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
}

/* ── Label utility ── */
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}

/* ── Empty state ── */
.empty {
  height: 120px;
  text-align: center;
  color: var(--muted);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }

  .sidebar { display: none; }
  .main { padding: 16px; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { grid-template-columns: 1fr; }
  .preview-pane { position: static; }
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-panel { padding: 40px 32px; }
}

@media (max-width: 640px) {
  .app-shell { padding: 12px; }
  .topbar, .preview-head { align-items: flex-start; flex-direction: column; }
  .topbar form, .preview-actions { width: 100%; justify-content: flex-start; }
  .modal-head, .nc-modal-item div { flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Viewer (busca rápida) ────────────────────────────────────────────────── */
.viewer-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.viewer-search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 6px 8px 6px 18px;
  gap: 10px;
  transition: border-color .15s;
}

.viewer-search-box:focus-within {
  border-color: var(--ol-600);
  background: var(--surface);
}

.viewer-search-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.viewer-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  min-width: 0;
}

.viewer-input::placeholder { color: var(--muted); }

.viewer-search-wrap {
  position: relative;
}

.viewer-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--ol-600);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.viewer-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: var(--surface-2);
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .1s, color .1s;
}
.viewer-clear-btn:hover { background: var(--line); color: var(--text); }

.viewer-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(15,54,63,.14);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 360px;
  overflow-y: auto;
  z-index: 200;
}

.vd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .08s;
}

.vd-item--active,
.vd-item:hover { background: var(--ol-100); }

.vd-code {
  font-weight: 700;
  font-size: 13px;
  color: var(--ol-800);
  min-width: 110px;
  flex-shrink: 0;
}

.vd-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vd-ext {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.vd-item mark {
  background: #fff3a3;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.viewer-tip {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0 4px;
}

.viewer-tip kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-family: monospace;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
}

.viewer-body {
  padding: 24px;
}

.viewer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 64px 24px;
  color: var(--muted);
  font-size: 14px;
}

.viewer-empty svg {
  width: 48px;
  height: 48px;
  opacity: .3;
}

.viewer-status {
  font-size: 14px;
  color: var(--muted);
  padding: 12px 0;
}

.viewer-status--error { color: var(--danger); }

.viewer-results-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px 2px;
}

.viewer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.viewer-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background .1s;
}

.viewer-list-item:last-child { border-bottom: none; }

.viewer-list-item:hover { background: var(--ol-100); }

.viewer-list-code {
  font-weight: 700;
  font-size: 13px;
  color: var(--ol-800);
  min-width: 120px;
  flex-shrink: 0;
}

.viewer-list-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-list-ext {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   Hamburger / Sidebar drawer
   ══════════════════════════════════════════════════ */
.topbar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.85);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  margin-right: 2px;
  flex-shrink: 0;
  transition: background .12s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.topbar-hamburger svg, .topbar-hamburger svg * { pointer-events: none; }
.topbar-hamburger:hover { background: rgba(255,255,255,.12); }

.sidebar-close-row {
  display: none;
  justify-content: flex-end;
  padding: 10px 12px 4px;
}
.sidebar-close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 0;
}
.sidebar-close-btn:hover { background: var(--surface-2); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 149;
}
.sidebar-overlay--visible { display: block; }

.topbar-username {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════
   Lifecycle badges
   ══════════════════════════════════════════════════ */
.lc-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
}
.lc-ativo      { background: #d4edda; color: #1a5c33; }
.lc-em_revisao { background: #fff3cd; color: #7d5a00; }
.lc-aprovado   { background: #cce5ff; color: #004085; }
.lc-obsoleto   { background: #f8d7da; color: #721c24; }

/* ══════════════════════════════════════════════════
   Help page
   ══════════════════════════════════════════════════ */
.help-page { max-width: 1100px; margin: 0 auto; }
.help-hero { margin-bottom: 32px; }
.help-hero h1 { font-size: 2rem; margin-bottom: 6px; }
.help-subtitle { color: var(--muted); font-size: 15px; margin: 4px 0 0; }
.tour-btn {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 16px;
  padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--ol-800); color: #fff; font-size: 13px; font-weight: 500;
  font-family: inherit; transition: background .15s;
}
.tour-btn:hover { background: var(--ol-700); }

.help-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
}
.help-toc {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.help-toc-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.help-toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.help-toc a {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
  transition: background .1s, color .1s;
}
.help-toc a:hover { background: var(--ol-100); color: var(--ol-800); }

.help-section { margin-bottom: 48px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.help-section h2 {
  font-size: 1.25rem;
  border-bottom: 2px solid var(--ol-100);
  padding-bottom: 10px;
  margin-bottom: 14px;
  color: var(--ol-900);
}
.help-section h3 { font-size: 14px; margin: 18px 0 6px; color: var(--ol-700); }
.help-section p, .help-section li { font-size: 14px; line-height: 1.7; }
.help-section ul, .help-section ol { padding-left: 20px; margin: 6px 0; }
.help-section li { margin-bottom: 4px; }
.help-section code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}

.help-highlight {
  background: var(--ol-100);
  border-left: 3px solid var(--ol-600);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 13px;
}
.help-highlight--warn { background: #fff8e1; border-left-color: #f9a825; }
.help-highlight ul { margin: 6px 0 0; }

.help-table-wrap { overflow-x: auto; margin: 10px 0; }
.help-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.help-table th {
  background: var(--surface-2);
  text-align: left;
  padding: 8px 12px;
  font-weight: 700;
  color: var(--ol-800);
  border-bottom: 2px solid var(--line);
}
.help-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.help-table tr:last-child td { border-bottom: none; }
.help-table code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 11px; font-family: monospace; }

.help-code {
  background: var(--ol-900);
  color: #a8d8e8;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 12px;
  font-family: monospace;
  overflow-x: auto;
  line-height: 1.6;
  margin: 12px 0;
}

.method-get  { background:#d4edda; color:#1a5c33; border-radius:3px; padding:1px 6px; font-size:11px; font-weight:700; }
.method-post { background:#cce5ff; color:#004085; border-radius:3px; padding:1px 6px; font-size:11px; font-weight:700; }

/* ══════════════════════════════════════════════════
   QR Code page
   ══════════════════════════════════════════════════ */
.qr-wrap {
  max-width: 360px;
  margin: 40px auto;
  text-align: center;
  padding: 32px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.qr-wrap h1 { font-size: 1.6rem; margin: 8px 0 24px; }
.qr-box { display: flex; justify-content: center; margin-bottom: 16px; }
.qr-url { font-size: 11px; color: var(--muted); word-break: break-all; margin: 0 0 20px; }
.qr-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.qr-hint { font-size: 12px; color: var(--muted); margin: 0; }

/* ══════════════════════════════════════════════════
   Admin badges
   ══════════════════════════════════════════════════ */
.badge-danger { background:#f8d7da; color:#721c24; border-radius:var(--radius-pill); padding:2px 8px; font-size:12px; font-weight:700; }
.badge-warn   { background:#fff3cd; color:#7d5a00; border-radius:var(--radius-pill); padding:2px 8px; font-size:12px; font-weight:700; }
.empty-state  { padding: 32px; text-align: center; color: var(--muted); font-size: 14px; }

/* ══════════════════════════════════════════════════
   Workflow steps
   ══════════════════════════════════════════════════ */
.wf-steps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.wf-step {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ol-100);
  border: 1px solid var(--ol-400);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
}
.wf-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ol-800);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wf-step-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ol-900);
}
.wf-arrow {
  color: var(--muted);
  font-weight: 700;
  font-size: 18px;
}

/* ══════════════════════════════════════════════════
   Profile / 2FA
   ══════════════════════════════════════════════════ */
.profile-2fa-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
}
.profile-2fa-on  { background: #d4edda; color: #1a5c33; }
.profile-2fa-off { background: #f8d7da; color: #721c24; }

/* ══════════════════════════════════════════════════
   MOBILE BREAKPOINTS
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }

  /* Sidebar → fixed drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform .25s ease;
    padding-top: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
    grid-area: unset;
  }
  .sidebar--open { transform: translateX(0); }
  .sidebar-close-row { display: flex; }

  .topbar-hamburger { display: inline-flex; }
  .topbar { padding: 0 12px; gap: 6px; }
  .topbar-brand { font-size: 11px; }
  .topbar-logout-label { display: none; }
  .topbar-username { max-width: 70px; }

  .main { grid-area: unset; }
  .page { padding: 12px; }

  /* Tables scroll */
  .table-wrap, .card-body--table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }

  /* Metrics 2-col */
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Workspace single col */
  .workspace { grid-template-columns: 1fr; }
  .preview-pane { position: static; max-height: none; }
  .preview-frame { height: 380px; }

  /* Modals full-screen */
  dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    left: 0 !important;
    top: 0 !important;
  }

  .filters { grid-template-columns: 1fr; }
  .preview-actions { flex-wrap: wrap; gap: 6px; }
  .preview-head { flex-direction: column; align-items: flex-start; gap: 10px; }

  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; }

  .viewer-topbar { padding: 10px 12px; }
  .viewer-body { padding: 12px; }
  .vd-code { min-width: 80px; }

  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-panel { padding: 32px 20px; }

  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .role-badge { display: none; }
  h1 { font-size: 20px; }
  h2 { font-size: 16px; }
  .page { padding: 10px; }
  .preview-frame { height: 300px; }
}
