:root {
  --font-display: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --teal-deep: #0f766e;
  --teal: #14b8a6;
  --accent: #0ea5e9;
  --accent-warm: #f59e0b;
  --dash-welcome-from: #e0f2fe;
  --dash-welcome-to: #ccfbf1;
  --dash-welcome-ink: #0f172a;
  --dash-welcome-muted: #475569;
  --dash-welcome-accent: #0d9488;
  --dash-tile-border: #5eead4;
  --dash-tile-soft: #ecfdf5;
  --dash-tile-ink: #115e59;
  --page-pad: clamp(0.75rem, 2.5vw, 2rem);
  --ok: #059669;
  --warn: #dc2626;
  --spice: #ea580c;
  --leaf: #14b8a6;
  --surface-shadow: 0 4px 24px rgba(15, 118, 110, 0.06);
  --surface-shadow-lg: 0 12px 40px rgba(14, 165, 233, 0.1);
}
:root[data-dash-theme="blue"] {
  --teal-deep: #0369a1;
  --teal: #0284c7;
  --accent: #2563eb;
  --dash-welcome-from: #dbeafe;
  --dash-welcome-to: #e0f2fe;
  --dash-welcome-accent: #0369a1;
  --dash-tile-border: #93c5fd;
  --dash-tile-soft: #eff6ff;
  --dash-tile-ink: #1e3a8a;
}
:root[data-dash-theme="navy"] {
  --teal-deep: #1e293b;
  --teal: #334155;
  --accent: #6366f1;
  --dash-welcome-from: #e2e8f0;
  --dash-welcome-to: #f1f5f9;
  --dash-welcome-accent: #334155;
  --dash-tile-border: #94a3b8;
  --dash-tile-soft: #f8fafc;
  --dash-tile-ink: #1e293b;
}
:root[data-dash-theme="brown"] {
  --teal-deep: #92400e;
  --teal: #b45309;
  --accent: #d97706;
  --dash-welcome-from: #ffedd5;
  --dash-welcome-to: #fef3c7;
  --dash-welcome-accent: #b45309;
  --dash-tile-border: #fdba74;
  --dash-tile-soft: #fff7ed;
  --dash-tile-ink: #9a3412;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  padding: calc(var(--page-pad) + 0px) var(--page-pad) 1.75rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(11, 114, 133, 0.1), transparent 28%),
    radial-gradient(circle at 0% 0%, rgba(26, 92, 87, 0.1), transparent 30%),
    linear-gradient(180deg, #eef3f6 0%, #e4ecef 100%);
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.brand-block { min-width: 0; flex: 1 1 220px; }
.product {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-weight: 700;
  color: var(--teal-deep);
  line-height: 1.2;
}
.meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-weight: 500;
}
.top-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.chip {
  border: 1px solid #b7c9c6;
  background: rgba(255, 255, 255, 0.75);
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
}
.dash-theme-picks {
  display: inline-flex;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid #b7c9c6;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 8px;
}
.dash-theme-swatch {
  width: 14px; height: 14px; padding: 0;
  border: 1px solid rgba(18, 34, 42, 0.2);
  border-radius: 3px; cursor: pointer;
}
.dash-theme-swatch.is-on { outline: 2px solid var(--teal-deep); outline-offset: 1px; }
.ghost, .top-actions a.ghost {
  border: 1px solid #8aa3a0;
  background: transparent;
  color: var(--teal-deep);
  padding: 0.45rem 0.75rem;
  min-height: 40px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.ghost:hover { background: #fff; text-decoration: none; }

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 0.9rem;
  padding: clamp(1rem, 2.5vw, 1.35rem);
  margin-bottom: 0.95rem;
  border: 1px solid rgba(94, 234, 212, 0.45);
  border-radius: 18px;
  background: linear-gradient(125deg, var(--dash-welcome-from) 0%, #fff 42%, var(--dash-welcome-to) 100%);
  color: var(--dash-welcome-ink);
  box-shadow: var(--surface-shadow-lg);
}
.welcome-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dash-welcome-accent);
  font-weight: 700;
}
.welcome h1 {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.8vw, 1.85rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--dash-welcome-ink);
}
.welcome h1 span { color: var(--dash-welcome-accent); }
.welcome-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.welcome-pills span {
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.72);
  padding: 0.32rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 650;
  border-radius: 999px;
  color: var(--dash-welcome-muted);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.welcome-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  align-content: center;
}
.welcome-stats article {
  padding: 0.75rem 0.6rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.08);
}
.welcome-stats strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  font-weight: 700;
  color: var(--dash-welcome-accent);
}
.welcome-stats span { font-size: 0.68rem; color: var(--dash-welcome-muted); }

.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.filters button {
  border: 1px solid #b7c9c6;
  background: #fff;
  color: #334155;
  padding: 0.45rem 0.75rem;
  min-height: 40px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 650;
}
.filters button.active, .filters button:hover {
  background: linear-gradient(135deg, var(--teal) 0%, var(--dash-welcome-accent) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.25);
}

.ag-icon-map {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.75rem;
  width: 100%;
}
.ag-icon-tile {
  appearance: none;
  font: inherit;
  width: 100%;
  cursor: pointer;
  display: grid;
  justify-items: center;
  align-content: start;
  text-align: center;
  min-height: 148px;
  padding: 1rem 0.65rem 0.85rem;
  border-radius: 18px;
  border: 1px solid var(--dash-tile-border);
  background: linear-gradient(180deg, #fff 0%, var(--dash-tile-soft) 100%);
  box-shadow: var(--surface-shadow);
  color: var(--dash-tile-ink);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.ag-icon-tile:hover {
  transform: translateY(-4px);
  border-color: var(--teal);
  box-shadow: var(--surface-shadow-lg);
  text-decoration: none;
}
.ag-icon-tile__glyph {
  width: 58px; height: 58px;
  border-radius: 18px;
  background: var(--dash-tile-soft);
  color: var(--dash-tile-ink);
  display: grid;
  place-items: center;
  margin-bottom: 0.65rem;
}
.ag-icon-tile__glyph svg { width: 28px; height: 28px; fill: currentColor; }
.ag-icon-tile strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.25;
  color: var(--dash-tile-ink);
}
.ag-icon-tile em {
  display: block;
  margin-top: 0.25rem;
  font-style: normal;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
}

.dash-footer {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  background: linear-gradient(105deg, #ecfdf5 0%, #e0f2fe 55%, #f0fdf4 120%);
  color: var(--muted);
  font-size: 0.72rem;
  border: 1px solid var(--line);
  box-shadow: var(--surface-shadow);
}
.dash-footer__legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 0.85rem;
  text-align: center;
  line-height: 1.45;
}

.page-head { margin-bottom: 1rem; }
.page-head .eyebrow { margin: 0; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.page-head h1 { margin: 0.25rem 0 0; font-size: clamp(1.25rem, 2.4vw, 1.6rem); color: var(--teal-deep); }
.page-head p { margin: 0.4rem 0 0; color: var(--muted); max-width: 46rem; }
.wrap { max-width: 1200px; margin: 0 auto; }
.flash { padding: 0.7rem 0.9rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: #e7f3e4; color: var(--ok); }
.flash.err { background: #fde8e4; color: var(--warn); }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.15rem;
  overflow: auto;
  box-shadow: var(--surface-shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.45rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.85rem; gap: 0.75rem; flex-wrap: wrap; }
.btn, .btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--teal) 0%, var(--dash-welcome-accent) 100%);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover, .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(20, 184, 166, 0.35);
}
.btn.ghost { background: #fff; color: var(--teal-deep); border: 1px solid var(--dash-tile-border); box-shadow: none; }
.btn.spice { background: linear-gradient(135deg, #fb923c 0%, var(--spice) 100%); box-shadow: 0 4px 14px rgba(234, 88, 12, 0.25); }
label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.3rem; font-weight: 600; }
.field { margin-bottom: 0.95rem; }
input, select, textarea {
  width: 100%;
  padding: 0.58rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}
textarea { min-height: 90px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1rem; }
.help {
  background: linear-gradient(135deg, #ecfdf5 0%, #e0f2fe 100%);
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
  color: #115e59;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  border: 1px solid #99f6e4;
}
.muted { color: var(--muted); font-size: 0.85rem; }
.lede { color: var(--muted); margin: 0 0 1rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin: 1rem 0 1.5rem; }
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem;
  box-shadow: var(--surface-shadow);
}
.kpi b { display: block; font-size: 1.6rem; color: var(--teal-deep); }
.kpi span { color: var(--muted); font-size: 0.85rem; }
.stepper { display: flex; gap: 0.4rem; list-style: none; padding: 0; margin: 0 0 1.2rem; flex-wrap: wrap; }
.stepper li { background: #e4ecef; color: var(--muted); padding: 0.4rem 0.75rem; border-radius: 999px; font-size: 0.82rem; }
.stepper li.done { background: var(--teal); color: #fff; }
.stepper li.now { background: var(--accent); color: #fff; }
.block { margin-bottom: 1rem; }
.block h2 { margin: 0 0 0.5rem; font-size: 1.05rem; color: var(--teal-deep); }
.inline { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }
.inline input, .inline select { width: auto; min-width: 8rem; }
.inline label { margin: 0; color: var(--ink); font-size: 0.82rem; }
table.lines input, table.lines select { min-width: 0; }
.pill { display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px; font-size: 0.78rem; background: #e4ecef; }
.pill.ok { background: #dcecdc; color: var(--ok); }
.pill.bad { background: #f8d8d0; color: var(--warn); }
.pill.mid { background: #e8f0f3; color: var(--teal-deep); }
.form-section { margin: 0 0 1.15rem; padding: 0.85rem 0 0; border-top: 1px solid var(--line); }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section h2, .wf-card h2, .dept-group {
  margin: 0 0 0.7rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-deep);
}
.wf-card {
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid #99f6e4;
  background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
  border-radius: 14px;
}
.dept-group { margin: 1.1rem 0 0.55rem; }
.exp-must { margin: 0 0 0.85rem 1.1rem; color: var(--muted); font-size: 0.92rem; }
.exp-must li { margin: 0.2rem 0; }
.exp-doc-tile { cursor: default; }
.exp-doc-tile em { display: block; min-height: 2.6em; }
.exp-doc-links { margin: 0.45rem 0 0; font-size: 0.82rem; }
.exp-doc-links a { color: var(--teal-deep); }
.odm-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0 0 1.2rem;
}
.odm-stats article {
  background: #f4faf8;
  border: 1px solid #c5d4d2;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
}
.odm-stats strong {
  display: block;
  font-size: 1.05rem;
  color: var(--teal-deep);
  word-break: break-word;
}
.odm-stats span { font-size: 0.75rem; color: var(--muted); }
@media (max-width: 900px) {
  .odm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.elog-dash {
  margin: 0 0 1.15rem;
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 16px;
  border: 1px solid #99f6e4;
  background: linear-gradient(135deg, #ecfdf5 0%, #f8fafc 58%, #fff 100%);
}
.elog-dash__head { margin-bottom: 0.75rem; }
.elog-dash__head h2 {
  margin: 0.15rem 0 0.25rem;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  color: var(--teal-deep);
}
.elog-dash__head p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.elog-dash__tiles { margin: 0; }
.elog-dash__tile {
  background: #fff;
  border-color: #5eead4;
}
.elog-book-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
}
.elog-book-nav a {
  border: 1px solid #b7c9c6;
  background: #fff;
  color: var(--teal-deep);
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 650;
  text-decoration: none;
}
.elog-book-nav a.is-on,
.elog-book-nav a:hover {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  color: #f4faf8;
}
.fn-flow {
  margin: 0 0 1.15rem;
  padding: 0.85rem 1rem 1rem;
  border-radius: 14px;
  border: 1px solid #99f6e4;
  background: linear-gradient(135deg, #ecfdf5 0%, #f8fafc 55%, #fff 100%);
}
.fn-flow--compact { padding: 0.65rem 0.8rem 0.75rem; margin-bottom: 0.9rem; }
.fn-flow__head { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.7rem; }
.fn-flow__head strong { font-size: 0.92rem; color: var(--teal-deep, #134e4a); }
.fn-flow__head span { font-size: 0.78rem; color: var(--muted); }
.fn-flow__track { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.2rem; }
.fn-flow__node {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 6.2rem; max-width: 8.2rem; min-height: 4rem;
  padding: 0.4rem 0.45rem; border-radius: 12px;
  border: 1px solid #0f766e; background: #fff; text-decoration: none; color: #134e4a;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.08);
}
.fn-flow__node:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(15, 118, 110, 0.14); }
.fn-flow__node em {
  font-style: normal; font-size: 0.68rem; font-weight: 800; color: #fff;
  background: #0f766e; border-radius: 999px; padding: 0.1rem 0.45rem; margin-bottom: 0.28rem;
}
.fn-flow__node span { font-size: 0.72rem; font-weight: 700; text-align: center; line-height: 1.25; }
.fn-flow__node.is-now { background: #0f766e; color: #fff; }
.fn-flow__node.is-now em { background: #fff; color: #0f766e; }
.fn-flow__arrow { font-size: 1.3rem; font-weight: 800; color: #0f766e; padding: 0 0.12rem; line-height: 1; }
@media (max-width: 720px) {
  .fn-flow__track { flex-direction: column; align-items: stretch; }
  .fn-flow__arrow { transform: rotate(90deg); width: 100%; text-align: center; }
  .fn-flow__node { max-width: none; width: 100%; min-height: auto; flex-direction: row; gap: 0.55rem; justify-content: flex-start; }
  .fn-flow__node span { text-align: left; }
}
.search { display: flex; gap: 0.4rem; align-items: center; }
.search input { width: 12rem; }
tr.off td { background: #fff4e5; }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  background:
    radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.12), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(20, 184, 166, 0.14), transparent 38%),
    linear-gradient(180deg, #f8fafc 0%, #f0fdfa 100%);
}
.login .visual {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 5vw, 4rem);
  display: flex;
  align-items: flex-end;
  background:
    radial-gradient(circle at 85% 15%, rgba(245, 158, 11, 0.22), transparent 45%),
    radial-gradient(circle at 15% 85%, rgba(14, 165, 233, 0.2), transparent 42%),
    linear-gradient(145deg, #e0f2fe 0%, #ccfbf1 45%, #ecfdf5 100%);
  color: var(--ink);
}
.login .visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2314b8a6' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.9;
  pointer-events: none;
}
.login .visual-copy { position: relative; z-index: 1; }
.login .visual h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.15rem);
  font-weight: 700;
  line-height: 1.22;
  color: #0f172a;
}
.login .mark {
  margin: 0 0 0.75rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--dash-welcome-accent);
}
.login .visual p.lede { color: var(--muted); margin-top: 0.9rem; font-size: 1.02rem; line-height: 1.55; max-width: 36rem; }
.login .panel { display: grid; place-content: center; padding: 2rem 1.25rem; }
.login .card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 1.65rem 1.5rem;
  box-shadow: var(--surface-shadow-lg);
  backdrop-filter: blur(8px);
}
.login .eyebrow { margin: 0; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.login h2 { margin: 0.25rem 0 1rem; color: var(--ink); font-size: 1.45rem; }
.login .btn-primary { width: 100%; text-align: center; margin-top: 0.25rem; }
.login .legal-foot { margin-top: 1rem; font-size: 0.72rem; color: var(--muted); text-align: center; line-height: 1.5; }

@media (max-width: 1100px) {
  .welcome { grid-template-columns: 1fr; }
  .welcome-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ag-icon-map { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .ag-icon-map { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login .visual { min-height: 220px; }
}
@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
  .welcome-stats { grid-template-columns: 1fr; }
  .ag-icon-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1400px) {
  .shell { max-width: 1480px; margin-inline: auto; }
}

/* ---- Plant shell (header + left NAV) ---- */
:root {
  --shell-nav-h: 64px;
  --shell-footer-h: 48px;
  --shell-gap: 12px;
  --shell-nav-pad-left: clamp(1rem, 2.5vw, 1.75rem);
  --shell-side-w: 300px;
  --shell-side-w-collapsed: 84px;
  --shell-bg: #f1f5f9;
  --shell-surface: #ffffff;
  --shell-ink: #0f172a;
  --shell-muted: #64748b;
  --shell-line: #e2e8f0;
  --shell-brand: var(--teal-deep);
  --shell-brand-2: var(--accent);
  --shell-soft: #ecfdf5;
  --shell-shadow: var(--surface-shadow);
  --shell-radius: 10px;
}
body.is-plant-app {
  overflow: hidden;
  background: var(--shell-bg);
}
.ag-shell {
  --side-current: var(--shell-side-w);
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--shell-bg);
  color: var(--shell-ink);
  width: 100%;
  overflow: hidden;
}
.ag-shell.is-collapsed { --side-current: var(--shell-side-w-collapsed); }
.ag-shell__workspace {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: var(--shell-gap);
  padding-bottom: calc(var(--shell-gap) + env(safe-area-inset-bottom, 0px));
}
.ag-shell__body {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--side-current) minmax(0, 1fr);
  gap: var(--shell-gap);
  transition: grid-template-columns 0.22s ease;
  align-items: stretch;
}
.ag-footer {
  min-height: var(--shell-footer-h);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 var(--shell-gap) calc(var(--shell-gap) * 0.5);
  padding: 0.4rem 1rem;
  background: linear-gradient(105deg, #ecfdf5 0%, #e0f2fe 50%, #f8fafc 100%);
  border: 1px solid var(--shell-line);
  border-radius: var(--shell-radius);
  color: var(--shell-muted);
  font-size: 0.72rem;
  box-shadow: var(--surface-shadow);
}
.ag-footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.2rem 0.85rem;
  width: 100%;
  text-align: center;
  line-height: 1.45;
}
.ag-navbar {
  min-height: var(--shell-nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.85rem;
  padding-left: calc(var(--shell-nav-pad-left) + env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--shell-ink);
  border-bottom: 1px solid var(--shell-line);
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.07);
  z-index: 40;
}
.ag-navbar a { color: var(--shell-brand); text-decoration: none; }
.ag-navbar a:hover { text-decoration: none; }
.ag-navbar__left,
.ag-navbar__right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex-wrap: wrap;
}
.ag-navbar__left { flex: 1 1 280px; }
.ag-navbar__right { flex: 1 1 320px; justify-content: flex-end; }
.ag-navbar__client { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.ag-navbar__logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, #ecfdf5, #e0f2fe);
  border: 1px solid #99f6e4;
}
.ag-navbar__logo svg { width: 42px; height: 42px; display: block; }
.ag-navbar__client-text { display: grid; gap: 0.1rem; min-width: 0; }
.ag-navbar__client-text strong {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-navbar__client-text span {
  font-size: 0.72rem;
  opacity: 0.82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-navbar__datetime {
  display: grid;
  gap: 0.08rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--shell-line);
  background: #fff;
  border-radius: 10px;
}
.ag-navbar__datetime strong {
  font-size: 0.86rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ag-navbar__datetime span { font-size: 0.68rem; opacity: 0.85; white-space: nowrap; }
.ag-navbar__lang select {
  min-height: 36px;
  border: 1px solid var(--shell-line);
  background: #fff;
  color: var(--shell-ink);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
}
.ag-navbar__lang select option { color: #12222a; }
.ag-nav-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--shell-line);
  background: #fff;
  color: var(--shell-brand);
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 999px;
}
.ag-nav-chip svg { width: 16px; height: 16px; fill: currentColor; flex: 0 0 auto; }
.ag-nav-chip:hover { background: var(--shell-soft); }
.ag-theme-picks {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 4px 6px;
  border: 1px solid var(--shell-line);
  background: #fff;
  border-radius: 999px;
}
.ag-theme-swatch {
  width: 14px;
  height: 14px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 3px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.ag-theme-swatch:hover { transform: scale(1.12); }
.ag-theme-swatch.is-on { outline: 2px solid var(--shell-brand); outline-offset: 1px; }
.ag-navbar__user { text-align: right; line-height: 1.15; min-width: 0; }
.ag-navbar__user strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.ag-navbar__user span { display: block; font-size: 0.7rem; opacity: 0.85; white-space: nowrap; }
.ag-icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--shell-line);
  background: #fff;
  color: var(--shell-brand);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  position: relative;
  border-radius: 10px;
}
.ag-icon-btn:hover { background: var(--shell-soft); }
.ag-icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.ag-icon-btn--logout {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(254, 202, 202, 0.45);
}
.ag-icon-btn--logout:hover { background: rgba(248, 113, 113, 0.28); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.ag-side-peek,
.ag-backdrop { display: none; }
.ag-side {
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--shell-surface);
  border: 1px solid var(--shell-line);
  border-radius: var(--shell-radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shell-shadow);
}
.ag-side__head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--shell-line);
  background: linear-gradient(180deg, #ecfdf5, #fff);
}
.ag-side__toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--shell-line);
  background: #fff;
  color: var(--shell-brand);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  border-radius: 8px;
}
.ag-side__toggle:hover { background: var(--shell-soft); }
.ag-side__toggle svg { width: 18px; height: 18px; fill: currentColor; }
.ag-side__head-text { min-width: 0; flex: 1; }
.ag-side__head h2 {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--shell-muted);
  font-weight: 700;
}
.ag-side__head p {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--shell-ink);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-side__scroll {
  flex: 1;
  overflow: auto;
  padding: 0.55rem 0.45rem 1rem;
}
.ag-side__group {
  margin: 0.55rem 0.35rem 0.3rem;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--shell-muted);
  font-weight: 700;
}
.ag-nav-item {
  width: 100%;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--shell-ink);
  padding: 0.5rem 0.5rem;
  margin-bottom: 0.15rem;
  cursor: pointer;
  border-radius: 8px;
  text-decoration: none;
}
.ag-nav-item:hover { background: var(--shell-soft); text-decoration: none; }
.ag-nav-item.is-active {
  background: linear-gradient(90deg, rgba(204, 251, 241, 0.9), rgba(224, 242, 254, 0.65));
  color: var(--shell-brand);
  box-shadow: inset 3px 0 0 var(--teal);
}
.ag-nav-item__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ecfdf5, #e0f2fe);
  color: var(--shell-brand);
}
.ag-nav-item__icon svg { width: 20px; height: 20px; fill: currentColor; }
.ag-nav-item__text { min-width: 0; }
.ag-nav-item__text strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-nav-item__text span {
  font-size: 0.7rem;
  color: var(--shell-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}
.ag-shell.is-collapsed .ag-side__head-text,
.ag-shell.is-collapsed .ag-side__group,
.ag-shell.is-collapsed .ag-nav-item__text { display: none; }
.ag-shell.is-collapsed .ag-nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0.4rem;
}
.ag-shell.is-collapsed .ag-side__head { justify-content: center; padding: 0.65rem 0.35rem; }
.ag-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--shell-surface);
  border: 1px solid var(--shell-line);
  border-radius: var(--shell-radius);
  box-shadow: var(--shell-shadow);
}
.ag-main__inner {
  width: 100%;
  display: grid;
  gap: 0.9rem;
  padding: 1.05rem clamp(1rem, 2vw, 1.5rem) 1.4rem;
  box-sizing: border-box;
}
.ag-main__inner > * { min-width: 0; max-width: 100%; }
.ag-main .welcome { margin-bottom: 0; }
.ag-main .filters { margin-bottom: 0; }
.ag-main .page-head { margin-bottom: 0; }
.ag-main .toolbar { margin-bottom: 0; }

@media (max-width: 1100px) {
  .ag-navbar__datetime span { display: none; }
  .ag-nav-chip span { display: none; }
  .ag-nav-chip { width: 40px; height: 40px; padding: 0; justify-content: center; }
}
@media (max-width: 960px) {
  .ag-shell__body { grid-template-columns: 1fr; }
  .ag-side-peek {
    display: inline-grid;
    place-items: center;
    position: fixed;
    top: calc(var(--shell-nav-h) + var(--shell-gap) + 8px);
    left: var(--shell-gap);
    z-index: 36;
    width: 42px;
    height: 42px;
    border: 1px solid var(--shell-line);
    border-radius: 10px;
    background: #fff;
    color: var(--shell-brand);
    box-shadow: var(--shell-shadow);
    cursor: pointer;
  }
  .ag-shell.is-side-open .ag-side-peek { display: none; }
  .ag-side-peek svg { width: 18px; height: 18px; fill: currentColor; }
  .ag-side {
    position: fixed;
    top: calc(var(--shell-nav-h) + var(--shell-gap));
    left: var(--shell-gap);
    bottom: calc(var(--shell-footer-h) + var(--shell-gap));
    width: min(86vw, 300px);
    z-index: 35;
    transform: translateX(calc(-100% - var(--shell-gap) - 8px));
    transition: transform 0.22s ease;
  }
  .ag-shell.is-side-open .ag-side { transform: translateX(0); }
  .ag-shell.is-collapsed .ag-side { width: min(86vw, 300px); }
  .ag-shell.is-collapsed .ag-side__head-text,
  .ag-shell.is-collapsed .ag-side__group,
  .ag-shell.is-collapsed .ag-nav-item__text { display: block; }
  .ag-shell.is-collapsed .ag-nav-item {
    grid-template-columns: 40px minmax(0, 1fr);
    justify-items: stretch;
    padding: 0.5rem;
  }
  .ag-shell.is-collapsed .ag-side__head { display: flex; padding: 0.7rem 0.65rem; }
  .ag-backdrop {
    display: block;
    position: fixed;
    inset: var(--shell-nav-h) 0 var(--shell-footer-h) 0;
    background: rgba(10, 24, 28, 0.42);
    border: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 30;
  }
  .ag-shell.is-side-open .ag-backdrop { opacity: 1; pointer-events: auto; }
  .ag-navbar__client-text span { display: none; }
}
@media (max-width: 720px) {
  .ag-navbar__datetime { display: none; }
  .ag-navbar__user strong { max-width: 96px; }
}

/* eBMR / eBPR template (AurenyxGMP Part I / II, food process) */
.bmr { max-width: 1120px; }
.bmr__dochead { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1rem; margin-bottom: 0.75rem; }
.bmr__brand { display: flex; gap: 0.65rem; align-items: center; min-width: 180px; }
.bmr__logo { width: 42px; height: 42px; border-radius: 10px; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 800; }
.bmr__co { font-weight: 800; color: var(--teal-deep); }
.bmr__plant { font-size: 0.82rem; color: var(--muted); }
.bmr__doctype { flex: 1 1 220px; }
.bmr__doctype h1 { margin: 0.15rem 0 0; font-size: 1.15rem; }
.bmr__doctype p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.88rem; }
.bmr__chip { display: inline-block; font-size: 0.7rem; font-weight: 800; background: #ccfbf1; color: #0f766e; padding: 0.12rem 0.5rem; border-radius: 6px; }
.bmr__meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 0.9rem; font-size: 0.78rem; }
.bmr__meta span { display: block; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.bmr__seq { display: flex; gap: 0.35rem; flex-wrap: wrap; margin: 0 0 0.75rem; }
.bmr__seq span { font-size: 0.72rem; font-weight: 800; padding: 0.35rem 0.75rem; border-radius: 8px; background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.bmr__seq span.on { background: var(--teal); color: #fff; border-color: var(--teal); }
.bmr__majors { display: flex; gap: 0.4rem; margin-bottom: 0.65rem; }
.bmr__major { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 0.45rem 1rem; font-weight: 800; cursor: pointer; color: var(--muted); }
.bmr__major.on { background: var(--teal-deep); color: #fff; border-color: var(--teal-deep); }
.bmr__togs { display: flex; gap: 0.85rem; flex-wrap: wrap; margin: 0 0 0.75rem; font-size: 0.88rem; }
.bmr__card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 0.75rem; }
.bmr__card h2 { margin: 0 0 0.65rem; font-size: 1rem; }
.bmr__card h2 em { font-style: normal; color: var(--muted); font-size: 0.78rem; font-weight: 600; margin-left: 0.35rem; }
.bmr__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem 0.85rem; }
.bmr__grid label, .bmr__stageh input, .bmr__step input, .bmr__step textarea { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.82rem; color: var(--muted); }
.bmr__grid input, .bmr__grid select, .bmr__table input, .bmr__table select, .bmr__line textarea, .bmr__stageh input, .bmr__stageh select, .bmr__step input, .bmr__step textarea {
  font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.5rem; background: #fff;
}
.bmr__table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.bmr__table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; color: #134e4a; background: #f0fdfa; padding: 0.4rem 0.45rem; border-bottom: 2px solid #99f6e4; }
.bmr__table td { padding: 0.3rem 0.35rem; border-bottom: 1px solid #f1f5f9; }
.bmr__line { display: flex; gap: 0.5rem; align-items: flex-start; margin-bottom: 0.45rem; }
.bmr__n { min-width: 1.5rem; height: 1.5rem; border-radius: 6px; background: #ccfbf1; color: #0f766e; display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; }
.bmr__n--warn { background: #ffedd5; color: #9a3412; }
.bmr__line textarea { flex: 1; }
.bmr__stage { border: 1px solid #99f6e4; border-left: 4px solid var(--teal); border-radius: 10px; padding: 0.75rem; margin-bottom: 0.75rem; background: #f8fffe; }
.bmr__stageh, .bmr__steph { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.45rem; }
.bmr__chip-s, .bmr__chip-p { font-size: 0.68rem; font-weight: 800; border-radius: 6px; padding: 0.15rem 0.45rem; }
.bmr__chip-s { color: #0f766e; background: #ccfbf1; }
.bmr__chip-p { color: #1e40af; background: #dbeafe; }
.bmr__code { max-width: 140px; }
.bmr__step { border: 1px dashed #cbd5e1; border-radius: 8px; padding: 0.55rem; margin: 0.5rem 0; background: #fff; }
.bmr__prov { display: flex; flex-wrap: wrap; gap: 0.55rem 0.85rem; margin-top: 0.45rem; font-size: 0.8rem; color: var(--ink); }
.bmr__ccp { display: flex; align-items: center; gap: 0.35rem; }
.bmr__actions { display: flex; gap: 0.5rem; margin: 0.5rem 0 1rem; }
@media (max-width: 900px) {
  .bmr__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .bmr__grid { grid-template-columns: 1fr; }
  .bmr__dochead { flex-direction: column; align-items: flex-start; }
}
