:root {
  --ink: #0b1720;
  --muted: #5f6f7b;
  --paper: #f4f7f5;
  --panel: #ffffff;
  --line: #d9e2e4;
  --cyan: #00b8c8;
  --cyan-deep: #087986;
  --green: #16a34a;
  --neon: #8cff3f;
  --orange: #f97316;
  --red: #dc2626;
  --yellow: #f59e0b;
  --shadow: 0 12px 34px rgba(11, 23, 32, 0.08);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(0, 184, 200, 0.12), transparent 270px),
    var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  line-height: 1.15;
  overflow-wrap: anywhere;
}

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

a {
  color: inherit;
  text-decoration: none;
}

body.auth-pending .topbar,
body.auth-pending .module-tabs,
body.auth-pending .app-shell {
  display: none;
}

body:not(.auth-pending) .login-screen {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 24px 12px;
}

.login-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.login-copy,
.login-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-copy {
  min-height: 340px;
  display: grid;
  align-content: end;
  justify-items: start;
  padding: 22px;
  color: #06262a;
  background:
    linear-gradient(145deg, rgba(0, 184, 200, 0.9), rgba(22, 163, 74, 0.76)),
    linear-gradient(315deg, rgba(140, 255, 63, 0.4), rgba(249, 115, 22, 0.18));
}

.platform-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 12px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 14px rgba(11, 23, 32, 0.18));
}

.platform-logo.is-large {
  width: 108px;
  height: 86px;
  margin-bottom: 18px;
  border-radius: 18px;
}

.login-copy .eyebrow {
  color: #053037;
}

.login-copy p:not(.eyebrow) {
  margin: 10px 0 0;
  font-weight: 900;
}

.login-panel {
  padding: 16px;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.role-option {
  position: relative;
  display: block;
}

.role-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.role-option span {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfd;
  padding: 10px;
  color: var(--ink);
  cursor: pointer;
}

.role-option strong,
.role-option em {
  display: block;
  font-style: normal;
}

.role-option strong {
  font-size: 14px;
}

.role-option em {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.role-option input:checked + span {
  border-color: var(--cyan);
  background: rgba(0, 184, 200, 0.11);
  box-shadow: inset 0 -4px 0 rgba(140, 255, 63, 0.72);
}

.pin-hint {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  border: 1px dashed rgba(0, 184, 200, 0.36);
  border-radius: var(--radius);
  background: rgba(0, 184, 200, 0.07);
  padding: 10px;
}

.pin-hint strong,
.pin-hint span {
  min-height: 28px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
}

.pin-hint strong {
  grid-column: 1 / -1;
  color: var(--cyan-deep);
  text-transform: uppercase;
}

.pin-hint span {
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
}

.topbar {
  width: min(var(--max), calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--cyan-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 18px;
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.status-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.is-online {
  border-color: rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.11);
  color: #087437;
}

.status-pill.is-offline {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.1);
  color: #991b1b;
}

.status-pill.is-waiting {
  border-color: rgba(249, 115, 22, 0.32);
  background: rgba(249, 115, 22, 0.1);
  color: #9a4512;
}

.role-pill {
  border-color: rgba(0, 184, 200, 0.35);
  background: rgba(0, 184, 200, 0.12);
  color: var(--cyan-deep);
}

.logout-btn {
  min-height: 34px;
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.11);
  color: #9a4512;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.module-tabs {
  width: min(var(--max), calc(100% - 24px));
  margin: 0 auto 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(98px, 1fr));
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 8px 0;
  background: rgba(244, 247, 245, 0.92);
  backdrop-filter: blur(10px);
  overflow-x: visible;
}

.module-tabs button {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.module-tabs button.is-active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #05252a;
  box-shadow: inset 0 -4px 0 rgba(140, 255, 63, 0.75);
}

.module-tabs button[hidden] {
  display: none;
}

.app-shell {
  width: min(var(--max), calc(100% - 24px));
  margin: 0 auto 40px;
  min-width: 0;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: grid;
  gap: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.metric {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 9px;
  color: var(--ink);
  font-size: clamp(22px, 4vw, 32px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.metric.is-alert {
  border-color: rgba(249, 115, 22, 0.35);
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.11), #fff);
}

.metric.is-name strong {
  font-size: clamp(17px, 3vw, 24px);
  line-height: 1.14;
}

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.9fr);
  gap: 12px;
  margin-bottom: 12px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-chart-grid.is-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  box-shadow: var(--shadow);
}

.chart-panel {
  min-width: 0;
}

.chart-shell {
  min-height: 260px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 250px;
}

.chart-axis,
.chart-grid-line {
  stroke: #dbe7e7;
  stroke-width: 1;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.chart-value {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 12px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subnav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.subnav-grid button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.subnav-grid button.is-active {
  border-color: var(--cyan);
  background: rgba(0, 184, 200, 0.12);
  color: var(--cyan-deep);
  box-shadow: inset 0 -3px 0 rgba(140, 255, 63, 0.72);
}

.icon-btn,
.primary-action,
.tap-action {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 900;
  cursor: pointer;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #eef6f6;
  color: var(--cyan-deep);
  font-size: 13px;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 10px;
}

.input-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
}

.input-grid.is-readonly,
form.is-readonly {
  position: relative;
  opacity: 0.58;
}

.input-grid.is-readonly::after,
form.is-readonly::after {
  content: "Read only untuk role ini";
  grid-column: 1 / -1;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(249, 115, 22, 0.42);
  border-radius: var(--radius);
  background: rgba(249, 115, 22, 0.08);
  color: #9a4512;
  font-size: 12px;
  font-weight: 900;
}

[data-field-module].is-field-readonly {
  opacity: 0.52;
}

[data-field-module].is-field-readonly::after {
  content: "Role Driver/Admin";
  color: #9a4512;
  font-size: 11px;
  font-weight: 900;
}

label,
fieldset {
  min-width: 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfd;
  color: var(--ink);
  padding: 0 11px;
  outline: none;
}

textarea {
  min-height: 96px;
  padding-block: 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 184, 200, 0.18);
}

.primary-action {
  grid-column: 1 / -1;
  background: var(--cyan);
  color: #06262a;
}

.tap-action {
  grid-column: 1 / -1;
  background: var(--green);
  color: #fff;
  box-shadow: inset 0 -4px 0 rgba(140, 255, 63, 0.6);
}

.check-row {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.check-row legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--ink);
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.cycle-row {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px solid rgba(0, 184, 200, 0.28);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  background: rgba(0, 184, 200, 0.05);
}

.cycle-row legend {
  padding: 0 6px;
  color: var(--cyan-deep);
  font-size: 12px;
  font-weight: 900;
}

.cycle-row label {
  color: var(--muted);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.quick-grid button,
.delay-grid button {
  min-height: 56px;
  border: 1px solid #263844;
  border-radius: var(--radius);
  background: #172533;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.quick-grid button.is-ready {
  background: var(--green);
  border-color: var(--green);
}

.quick-grid button.is-pending {
  background: var(--orange);
  border-color: var(--orange);
  color: #2b1505;
}

.quick-grid button:disabled,
.delay-grid button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.delay-grid button.is-active {
  background: var(--red);
  border-color: var(--red);
}

.delay-grid button.is-done {
  background: var(--green);
  border-color: var(--green);
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

.table-wrap.is-wide {
  max-height: 70vh;
}

.checker-kpi-block {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.section-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.section-title-row h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
}

.section-title-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  min-width: 110px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #eef6f6;
  color: var(--cyan-deep);
  font-size: 11px;
  text-transform: uppercase;
  z-index: 1;
}

.event-list {
  display: grid;
  gap: 8px;
}

.breakdown-list {
  display: grid;
  gap: 8px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(72px, 110px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfd;
  padding: 9px;
}

.breakdown-row strong,
.breakdown-row span {
  display: block;
}

.breakdown-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bar-track {
  min-height: 10px;
  border-radius: 999px;
  background: #e8f0f0;
  overflow: hidden;
}

.bar-fill {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--green), var(--neon));
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  background: #fbfdfd;
}

.cost-list {
  display: grid;
  gap: 8px;
}

.formula-list {
  display: grid;
  gap: 8px;
}

.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfd;
  padding: 10px;
}

.cost-row > div,
.cost-row > span {
  min-width: 0;
}

.cost-row > span {
  overflow-wrap: anywhere;
  text-align: right;
}

.cost-row strong,
.cost-row span {
  display: block;
}

.cost-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cost-row.is-positive strong {
  color: var(--green);
}

.cost-row.is-warning strong {
  color: var(--orange);
}

.formula-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1.2fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfd;
  padding: 10px;
}

.formula-row strong,
.formula-row span,
.formula-row code {
  display: block;
}

.formula-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 3px;
}

.formula-row code {
  color: var(--cyan-deep);
  font-weight: 900;
  white-space: normal;
}

.event-row {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fbfdfd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.event-row strong,
.event-row span {
  display: block;
  overflow-wrap: anywhere;
}

.event-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.event-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 98px;
}

.mini-action {
  min-height: 30px;
  border: 1px solid rgba(22, 163, 74, 0.35);
  border-radius: var(--radius);
  background: rgba(22, 163, 74, 0.12);
  color: #087437;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(420px, calc(100% - 24px));
  min-height: 42px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #10202a;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.toast.is-visible {
  display: flex;
}

@media (max-width: 860px) {
  .login-screen {
    align-items: start;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: 220px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .status-stack {
    justify-content: flex-start;
  }

  .module-tabs {
    width: 100%;
    margin: 0 0 12px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 12px;
    scroll-padding-inline: 12px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .module-tabs::-webkit-scrollbar {
    display: none;
  }

  .module-tabs button {
    flex: 0 0 auto;
    min-width: 112px;
    padding-inline: 10px;
    scroll-snap-align: start;
  }

  .insight-grid,
  .analysis-grid,
  .dashboard-chart-grid,
  .dashboard-chart-grid.is-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .insight-grid,
  .analysis-grid,
  .dashboard-chart-grid,
  .dashboard-chart-grid.is-compact,
  .input-grid,
  .input-grid.compact,
  .check-row,
  .cycle-row {
    grid-template-columns: 1fr;
  }

  .topbar,
  .app-shell {
    width: min(var(--max), calc(100% - 18px));
  }

  .panel-head {
    flex-direction: column;
  }

  .panel-actions {
    width: 100%;
  }

  .panel-actions .icon-btn {
    flex: 1 1 0;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-shell {
    min-height: 220px;
  }

  .chart-svg {
    min-height: 210px;
  }

  .breakdown-row {
    grid-template-columns: 1fr;
  }

  .cost-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .cost-row > span,
  .section-title-row span {
    text-align: left;
  }

  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .login-screen {
    padding: 12px 8px;
  }

  .login-panel,
  .panel {
    padding: 12px;
  }

  .login-copy {
    min-height: 180px;
    padding: 16px;
  }

  .platform-logo {
    width: 44px;
    height: 44px;
  }

  .platform-logo.is-large {
    width: 92px;
    height: 74px;
  }

  .role-grid,
  .pin-hint,
  .formula-row,
  .metric-grid,
  .insight-grid,
  .analysis-grid,
  .dashboard-chart-grid,
  .dashboard-chart-grid.is-compact,
  .input-grid,
  .input-grid.compact,
  .check-row,
  .cycle-row {
    grid-template-columns: 1fr;
  }

  .role-option span {
    min-height: 58px;
  }

  .status-stack {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .status-pill,
  .logout-btn {
    width: 100%;
    min-height: 38px;
    padding-inline: 8px;
  }

  .module-tabs {
    padding-inline: 8px;
    scroll-padding-inline: 8px;
  }

  .module-tabs button {
    min-width: 104px;
    min-height: 40px;
    font-size: 12px;
  }

  .metric {
    min-height: 78px;
    padding: 12px;
  }

  .metric-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric strong {
    font-size: 24px;
  }

  .quick-grid button,
  .delay-grid button {
    min-height: 50px;
    padding-inline: 8px;
  }

  th,
  td {
    min-width: 96px;
    padding: 8px;
    font-size: 12px;
  }

  .event-row {
    align-items: stretch;
    flex-direction: column;
  }

  .event-actions {
    justify-items: start;
  }
}

@media (max-width: 380px) {
  .topbar,
  .app-shell {
    width: calc(100% - 12px);
  }

  .topbar {
    padding-top: 12px;
  }

  .brand-lockup {
    gap: 8px;
  }

  .status-stack {
    grid-template-columns: 1fr;
  }

  .panel,
  .login-panel {
    padding: 10px;
  }

  .subnav-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-tabs button {
    min-width: 96px;
  }

  .metric-grid.compact {
    grid-template-columns: 1fr;
  }
}

/* One-click demo role login */
.login-instruction {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.demo-badge {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(22, 163, 74, 0.28);
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.1);
  color: #087437;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.role-option {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.role-option span {
  position: relative;
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.role-option span::after {
  content: "Masuk →";
  position: absolute;
  right: 10px;
  bottom: 9px;
  color: var(--cyan-deep);
  font-size: 10px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.role-option:hover span,
.role-option:focus-visible span {
  border-color: var(--cyan);
  background: rgba(0, 184, 200, 0.08);
  box-shadow: 0 9px 20px rgba(8, 49, 56, 0.08);
  transform: translateY(-2px);
}

.role-option:hover span::after,
.role-option:focus-visible span::after,
.role-option.is-recommended span::after {
  opacity: 1;
  transform: translateY(0);
}

.role-option.is-recommended span {
  border-color: rgba(0, 184, 200, 0.55);
  background: rgba(0, 184, 200, 0.1);
  box-shadow: inset 0 -4px 0 rgba(140, 255, 63, 0.72);
}

.role-option.is-recommended span::before {
  content: "REKOMENDASI";
  position: absolute;
  top: 8px;
  right: 9px;
  color: #087437;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.role-option:disabled {
  cursor: wait;
}

.role-option:disabled:not(.is-loading) {
  opacity: 0.56;
}

.role-option.is-loading span::after {
  content: "Membuka…";
  opacity: 1;
  transform: translateY(0);
}

.demo-login-note {
  margin-top: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px dashed rgba(0, 184, 200, 0.36);
  border-radius: var(--radius);
  background: rgba(0, 184, 200, 0.07);
  padding: 11px 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.demo-login-note strong {
  color: var(--cyan-deep);
  white-space: nowrap;
}

.operator-pill {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch-role-btn {
  min-height: 34px;
  border: 1px solid rgba(0, 184, 200, 0.32);
  border-radius: 999px;
  background: rgba(0, 184, 200, 0.1);
  color: var(--cyan-deep);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.switch-role-btn:hover,
.switch-role-btn:focus-visible,
.logout-btn:hover,
.logout-btn:focus-visible {
  filter: brightness(0.97);
  transform: translateY(-1px);
}

@media (max-width: 560px) {
  .demo-login-note {
    flex-direction: column;
    gap: 4px;
  }

  .role-option span::after {
    opacity: 1;
    transform: none;
  }

  .status-pill,
  .switch-role-btn,
  .logout-btn {
    width: 100%;
    min-height: 38px;
    padding-inline: 8px;
  }
}

/* MCC Control Room · Full-HD 16:9 television board */
.control-room-panel {
  width: min(1600px, calc(100vw - 24px));
  margin-left: 50%;
  transform: translateX(-50%);
}

.control-room-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.control-room-toolbar h2 {
  margin: 3px 0 0;
  font-size: clamp(20px, 2vw, 30px);
}

.control-room-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.control-room-actions label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.control-room-actions select,
.control-room-actions button {
  min-height: 40px;
}

.control-room-screen {
  --cr-bg: #040b11;
  --cr-panel: #0a151e;
  --cr-panel-2: #0d1d27;
  --cr-line: rgba(131, 192, 208, 0.18);
  --cr-text: #eefcff;
  --cr-muted: #8faeb9;
  --cr-cyan: #33d8e8;
  --cr-green: #70ef91;
  --cr-orange: #ffad5b;
  --cr-red: #ff6b6b;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 720px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: clamp(8px, .7vw, 12px);
  overflow: hidden;
  border: 1px solid #193745;
  border-radius: 12px;
  background:
    radial-gradient(circle at 82% 0%, rgba(51, 216, 232, .11), transparent 25%),
    linear-gradient(160deg, #06121a, var(--cr-bg) 55%, #03080d);
  color: var(--cr-text);
  padding: clamp(12px, 1.15vw, 22px);
  box-shadow: 0 26px 80px rgba(3, 12, 18, .34);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

.control-room-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .08;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
}

.control-room-screen:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  padding: clamp(14px, 1vw, 24px);
}

.cr-header,
.cr-kpi-grid,
.cr-main-grid,
.cr-alert-strip {
  position: relative;
  z-index: 1;
}

.cr-header {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) auto minmax(220px, .7fr) auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--cr-line);
  padding-bottom: 10px;
}

.cr-brand,
.cr-weather-head,
.cr-live-state,
.cr-clock {
  display: flex;
  align-items: center;
}

.cr-brand {
  gap: 10px;
}

.cr-brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(51, 216, 232, .5);
  border-radius: 50%;
  background: rgba(51, 216, 232, .08);
  color: var(--cr-cyan);
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: .08em;
}

.cr-brand div,
.cr-weather-head div,
.cr-clock {
  display: grid;
  gap: 2px;
}

.cr-brand strong {
  font-size: clamp(13px, 1.05vw, 18px);
  letter-spacing: .13em;
}

.cr-brand span:not(.cr-brand-mark),
.cr-weather-head span,
.cr-clock span,
.cr-live-state span {
  color: var(--cr-muted);
  font-size: clamp(8px, .58vw, 11px);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.cr-live-state {
  gap: 7px;
  border: 1px solid rgba(112, 239, 145, .24);
  border-radius: 999px;
  background: rgba(112, 239, 145, .07);
  padding: 7px 10px;
  color: var(--cr-green);
  font-size: 10px;
}

.cr-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cr-green);
  box-shadow: 0 0 0 0 rgba(112, 239, 145, .55);
  animation: cr-pulse 1.8s infinite;
}

@keyframes cr-pulse {
  70% { box-shadow: 0 0 0 8px rgba(112, 239, 145, 0); }
  100% { box-shadow: 0 0 0 0 rgba(112, 239, 145, 0); }
}

.cr-weather-head {
  justify-self: end;
  gap: 8px;
  min-width: 0;
}

.cr-weather-icon {
  font-size: clamp(24px, 2vw, 36px);
}

.cr-weather-head strong,
.cr-clock strong {
  font-size: clamp(16px, 1.55vw, 27px);
  line-height: 1;
}

.cr-clock {
  justify-items: end;
  text-align: right;
}

.cr-kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(5px, .5vw, 9px);
}

.cr-kpi-grid article {
  min-width: 0;
  display: grid;
  gap: 3px;
  border: 1px solid var(--cr-line);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(14, 36, 48, .92), rgba(8, 22, 31, .9));
  padding: clamp(7px, .7vw, 12px);
}

.cr-kpi-grid article.is-risk {
  border-color: rgba(255, 107, 107, .28);
  background: linear-gradient(160deg, rgba(65, 25, 27, .46), rgba(18, 19, 24, .9));
}

.cr-kpi-grid span,
.cr-kpi-grid em {
  overflow: hidden;
  color: var(--cr-muted);
  font-size: clamp(7px, .53vw, 10px);
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.cr-kpi-grid strong {
  overflow: hidden;
  color: var(--cr-text);
  font-size: clamp(14px, 1.35vw, 24px);
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cr-main-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1.25fr .78fr .92fr;
  grid-template-rows: minmax(0, 1fr) minmax(0, .9fr);
  gap: clamp(7px, .62vw, 11px);
}

.cr-card {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--cr-line);
  border-radius: 9px;
  background: linear-gradient(150deg, rgba(13, 29, 39, .94), rgba(7, 17, 25, .96));
  padding: clamp(8px, .75vw, 13px);
}

.cr-production-card { grid-column: 1 / 3; grid-row: 1; }
.cr-unit-card { grid-column: 3; grid-row: 1; }
.cr-finance-card { grid-column: 1; grid-row: 2; }
.cr-ai-card { grid-column: 2; grid-row: 2; }
.cr-weather-card { grid-column: 3; grid-row: 2; }
.cr-flow-card {
  position: absolute;
  right: clamp(12px, 1.15vw, 22px);
  bottom: 46px;
  width: min(29%, 430px);
  height: 31%;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transform: translateX(15px);
  transition: opacity .2s ease, transform .2s ease;
}

.control-room-screen:hover .cr-flow-card,
.control-room-screen:focus-within .cr-flow-card,
.control-room-screen:fullscreen .cr-flow-card {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.cr-card-head {
  min-height: 34px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--cr-line);
  margin-bottom: 8px;
  padding-bottom: 7px;
}

.cr-card-head div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.cr-card-head span,
.cr-card-head small {
  color: var(--cr-muted);
  font-size: clamp(7px, .52vw, 10px);
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.cr-card-head strong {
  overflow: hidden;
  font-size: clamp(10px, .83vw, 14px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cr-legend,
.cr-finance-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--cr-muted);
  font-size: clamp(7px, .48vw, 9px);
  font-weight: 800;
  white-space: nowrap;
}

.cr-legend i,
.cr-finance-legend i {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
}

.cr-legend .actual,
.cr-finance-legend .revenue { background: var(--cr-cyan); }
.cr-legend .target,
.cr-finance-legend .cost { background: var(--cr-orange); }

.cr-chart {
  height: calc(100% - 40px);
}

.cr-chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cr-chart-grid line {
  stroke: rgba(150, 195, 207, .11);
  stroke-width: 1;
}

.cr-area {
  fill: rgba(51, 216, 232, .08);
}

.cr-actual-line,
.cr-target-line {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.cr-actual-line {
  stroke: var(--cr-cyan);
  stroke-width: 3.5;
  filter: drop-shadow(0 0 5px rgba(51, 216, 232, .42));
}

.cr-target-line {
  stroke: var(--cr-orange);
  stroke-width: 2;
  stroke-dasharray: 7 7;
}

.cr-chart-labels text,
.cr-finance-label,
.cr-margin-label {
  fill: var(--cr-muted);
  font-size: 9px;
  font-weight: 700;
}

.cr-chart-latest {
  fill: var(--cr-text);
  font-size: 12px;
  font-weight: 900;
}

.cr-revenue-bar { fill: var(--cr-cyan); opacity: .82; }
.cr-cost-bar { fill: var(--cr-orange); opacity: .76; }
.cr-margin-label { fill: var(--cr-green); font-weight: 900; }

.cr-finance-legend {
  justify-content: center;
  margin-top: -3px;
}

.cr-unit-grid {
  height: calc(100% - 43px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  gap: 6px;
  overflow: hidden;
}

.cr-unit {
  min-width: 0;
  min-height: 45px;
  display: grid;
  align-content: center;
  gap: 1px;
  border: 1px solid rgba(143, 174, 185, .15);
  border-left: 3px solid var(--cr-green);
  border-radius: 5px;
  background: rgba(255, 255, 255, .025);
  padding: 5px 6px;
}

.cr-unit.is-approval { border-left-color: var(--cr-orange); }
.cr-unit.is-hold,
.cr-unit.is-breakdown { border-left-color: var(--cr-red); }

.cr-unit strong {
  font-size: clamp(8px, .64vw, 12px);
}

.cr-unit span,
.cr-unit em {
  overflow: hidden;
  color: var(--cr-muted);
  font-size: clamp(6px, .42vw, 8px);
  font-style: normal;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.cr-ai-list,
.cr-flow-list {
  height: calc(100% - 42px);
  display: grid;
  align-content: start;
  gap: 5px;
  overflow: auto;
  scrollbar-width: thin;
}

.cr-ai-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 7px;
  border-left: 2px solid var(--cr-orange);
  background: rgba(255, 255, 255, .025);
  padding: 6px 7px;
}

.cr-ai-item.is-good { border-left-color: var(--cr-green); }
.cr-ai-item.is-high { border-left-color: var(--cr-red); }
.cr-ai-item > span {
  color: var(--cr-cyan);
  font-size: 10px;
  font-weight: 900;
}

.cr-ai-item div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.cr-ai-item strong,
.cr-ai-item em,
.cr-ai-item p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cr-ai-item strong { font-size: clamp(8px, .59vw, 11px); }
.cr-ai-item em {
  color: var(--cr-orange);
  font-size: clamp(6px, .45vw, 8px);
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}
.cr-ai-item p {
  margin: 0;
  color: var(--cr-muted);
  font-size: clamp(6px, .45vw, 8px);
}

.cr-weather-grid {
  height: calc(100% - 43px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.cr-weather-day {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  border: 1px solid rgba(143, 174, 185, .13);
  border-radius: 6px;
  background: rgba(255,255,255,.025);
  text-align: center;
  padding: 5px 3px;
}

.cr-weather-day.is-rain-risk {
  border-color: rgba(255, 173, 91, .34);
  background: rgba(255, 173, 91, .055);
}

.cr-weather-day > span,
.cr-weather-day small {
  color: var(--cr-muted);
  font-size: clamp(6px, .45vw, 8px);
}

.cr-weather-day > strong { font-size: clamp(18px, 1.7vw, 30px); }
.cr-weather-day em {
  font-size: clamp(8px, .65vw, 11px);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.cr-flow-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 7px;
  border-left: 2px solid var(--cr-cyan);
  background: rgba(255,255,255,.025);
  padding: 5px 7px;
}
.cr-flow-item.is-high { border-left-color: var(--cr-red); }
.cr-flow-item.is-medium { border-left-color: var(--cr-orange); }
.cr-flow-item time {
  color: var(--cr-cyan);
  font-size: 8px;
  font-weight: 900;
}
.cr-flow-item div { min-width: 0; display: grid; gap: 1px; }
.cr-flow-item strong,
.cr-flow-item span,
.cr-flow-item em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-flow-item strong { font-size: 8px; }
.cr-flow-item strong b { color: var(--cr-cyan); }
.cr-flow-item span,
.cr-flow-item em { color: var(--cr-muted); font-size: 7px; font-style: normal; }

.cr-alert-strip {
  min-height: 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 173, 91, .2);
  border-radius: 5px;
  background: rgba(255, 173, 91, .06);
  padding: 5px 9px;
  font-size: clamp(7px, .5vw, 10px);
}

.cr-alert-strip strong { color: var(--cr-orange); letter-spacing: .08em; }
.cr-alert-strip div { overflow: hidden; color: var(--cr-text); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.cr-alert-strip span { color: var(--cr-muted); white-space: nowrap; }

.cr-empty {
  min-height: 80px;
  display: grid;
  place-items: center;
  color: var(--cr-muted);
  font-size: 10px;
  text-align: center;
}

.control-room-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 1100px) {
  .control-room-screen {
    min-height: 690px;
    aspect-ratio: auto;
  }
  .cr-header { grid-template-columns: 1fr auto auto; }
  .cr-weather-head { display: none; }
  .cr-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cr-main-grid { grid-template-columns: 1.2fr .8fr; grid-template-rows: repeat(3, minmax(200px, auto)); }
  .cr-production-card { grid-column: 1 / 3; grid-row: 1; }
  .cr-unit-card { grid-column: 2; grid-row: 2; }
  .cr-finance-card { grid-column: 1; grid-row: 2; }
  .cr-ai-card { grid-column: 1; grid-row: 3; }
  .cr-weather-card { grid-column: 2; grid-row: 3; }
  .cr-flow-card { display: none; }
}

@media (max-width: 720px) {
  .control-room-toolbar,
  .control-room-actions { align-items: stretch; flex-direction: column; }
  .control-room-actions { width: 100%; }
  .control-room-actions label,
  .control-room-actions button { width: 100%; }
  .control-room-screen { min-height: 0; display: block; padding: 10px; }
  .cr-header { display: grid; grid-template-columns: 1fr auto; margin-bottom: 8px; }
  .cr-live-state { display: none; }
  .cr-brand span:not(.cr-brand-mark) { display: none; }
  .cr-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 8px; }
  .cr-main-grid { display: grid; grid-template-columns: 1fr; grid-template-rows: none; }
  .cr-production-card,
  .cr-unit-card,
  .cr-finance-card,
  .cr-ai-card,
  .cr-weather-card { grid-column: 1; grid-row: auto; min-height: 260px; }
  .cr-weather-card { min-height: 210px; }
  .cr-alert-strip { margin-top: 8px; grid-template-columns: auto 1fr; }
  .cr-alert-strip span { display: none; }
  .cr-unit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* V7 · Mobile header and logo safe-area hotfix */
.platform-logo{display:block;object-fit:contain;object-position:center;padding:2px;overflow:visible;border-radius:50%;background:transparent}.brand-lockup>div{min-width:0}.brand-lockup .eyebrow,.brand-lockup h1,.brand-lockup .brand-subtitle{max-width:100%;overflow-wrap:anywhere}
@media(max-width:720px){.topbar{width:100%;margin:0;padding:12px 10px 10px;display:grid;grid-template-columns:minmax(0,1fr);gap:10px;border-bottom:1px solid rgba(11,23,32,.08);background:rgba(226,248,249,.92);backdrop-filter:blur(12px)}.brand-lockup{width:100%;display:grid;grid-template-columns:52px minmax(0,1fr);align-items:center;gap:10px}.platform-logo{width:52px;height:52px;padding:3px}.brand-lockup .eyebrow{margin:0 0 2px;font-size:10px;line-height:1.25;white-space:normal}.brand-lockup h1{font-size:25px;line-height:1}.brand-subtitle{margin-top:3px;font-size:10px;line-height:1.2}.status-stack{width:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.status-pill,.switch-role-btn,.logout-btn{width:100%;min-width:0;min-height:38px;padding:7px 8px;white-space:normal;line-height:1.15;text-align:center}.operator-pill{max-width:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.module-tabs{top:0;margin-bottom:10px;padding:8px 10px}.module-tabs button{min-width:112px;min-height:42px;padding:8px 10px;white-space:nowrap}.app-shell{width:calc(100% - 16px);margin-bottom:28px}.metric-grid,.metric-grid.compact{grid-template-columns:1fr}.metric{min-height:76px}}
@media(max-width:380px){.topbar{padding-inline:8px}.brand-lockup{grid-template-columns:46px minmax(0,1fr);gap:8px}.platform-logo{width:46px;height:46px;padding:3px}.brand-lockup .eyebrow{font-size:9px}.brand-lockup h1{font-size:23px}.status-stack{grid-template-columns:1fr 1fr;gap:6px}.module-tabs button{min-width:104px}}

/* V8 · True mobile application navigation
   Desktop keeps the full module bar. Mobile uses an active-module control,
   a complete bottom sheet, and a fixed quick-navigation dock. */
body.auth-pending .mobile-module-bar,
body.auth-pending .mobile-bottom-nav,
body.auth-pending .mobile-module-sheet {
  display: none !important;
}

.mobile-module-bar,
.mobile-bottom-nav,
.mobile-module-sheet {
  display: none;
}

@media (max-width: 720px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  body.mobile-module-open {
    overflow: hidden;
  }

  body * {
    min-width: 0;
  }

  .topbar {
    width: 100%;
    margin: 0;
    padding: calc(9px + env(safe-area-inset-top)) 10px 8px;
    gap: 8px;
  }

  .brand-lockup {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 9px;
  }

  .platform-logo {
    width: 44px;
    height: 44px;
    padding: 2px;
  }

  .brand-lockup .eyebrow {
    margin-bottom: 1px;
    font-size: 9px;
    line-height: 1.15;
    letter-spacing: .025em;
  }

  .brand-lockup h1 {
    font-size: 23px;
    line-height: .95;
  }

  .brand-subtitle {
    margin-top: 3px;
    font-size: 9px;
  }

  .status-stack {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .status-pill,
  .switch-role-btn,
  .logout-btn {
    min-height: 34px;
    padding: 6px;
    border-radius: 12px;
    font-size: 10px;
    line-height: 1.05;
  }

  .role-pill {
    grid-column: span 2;
  }

  .operator-pill {
    display: none;
  }

  .switch-role-btn,
  .logout-btn {
    grid-column: span 2;
  }

  .module-tabs {
    display: none !important;
  }

  .mobile-module-bar {
    position: sticky;
    z-index: 45;
    top: 0;
    display: block;
    width: 100%;
    padding: 8px 9px;
    border-top: 1px solid rgba(11, 23, 32, .06);
    border-bottom: 1px solid rgba(11, 23, 32, .1);
    background: rgba(244, 249, 249, .96);
    box-shadow: 0 7px 20px rgba(5, 37, 42, .08);
    backdrop-filter: blur(14px);
  }

  .mobile-module-bar[hidden] {
    display: none !important;
  }

  .mobile-module-trigger {
    width: 100%;
    min-height: 56px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(0, 184, 200, .3);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(0, 184, 200, .13), rgba(140, 255, 63, .08));
    padding: 8px 10px;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
  }

  .mobile-module-trigger-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--cyan);
    color: #05252a;
    font-size: 20px;
    font-weight: 1000;
  }

  .mobile-module-trigger-copy,
  .mobile-module-trigger-meta {
    display: grid;
    gap: 2px;
  }

  .mobile-module-trigger-copy small,
  .mobile-module-trigger-meta small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  .mobile-module-trigger-copy strong {
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.15;
  }

  .mobile-module-trigger-meta {
    justify-items: end;
    text-align: right;
  }

  .mobile-module-trigger-meta b {
    color: var(--cyan-deep);
    font-size: 11px;
    white-space: nowrap;
  }

  .app-shell {
    width: 100%;
    margin: 0;
    padding: 0 9px 28px;
  }

  .tab-panel.is-active {
    width: 100%;
    padding-top: 2px;
  }

  .panel,
  .metric,
  .chart-shell,
  .event-list,
  .table-wrap,
  form,
  fieldset {
    width: 100%;
    max-width: 100%;
  }

  .metric-grid,
  .metric-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric {
    min-height: 82px;
    padding: 11px;
  }

  .metric span {
    overflow-wrap: anywhere;
    font-size: 10px;
    line-height: 1.25;
  }

  .metric strong {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: clamp(20px, 6.4vw, 27px);
    line-height: 1.05;
  }

  .subnav-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .subnav-grid button {
    width: 100%;
    min-height: 48px;
    padding: 8px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .panel-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-actions > * {
    width: 100%;
    min-width: 0;
    white-space: normal;
    text-align: center;
  }

  input,
  select,
  textarea,
  button,
  a.icon-btn {
    max-width: 100%;
  }

  .table-wrap,
  .table-wrap.is-wide {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    width: max-content;
    min-width: 100%;
  }

  .table-wrap th:first-child,
  .table-wrap td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--panel);
    box-shadow: 1px 0 0 var(--line);
  }

  canvas,
  svg,
  img,
  video {
    max-width: 100%;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 70;
    right: 8px;
    bottom: calc(7px + env(safe-area-inset-bottom));
    left: 8px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    min-height: 62px;
    overflow: hidden;
    border: 1px solid rgba(11, 23, 32, .12);
    border-radius: 20px;
    background: rgba(250, 253, 253, .96);
    box-shadow: 0 14px 36px rgba(4, 30, 35, .2);
    padding: 5px;
    backdrop-filter: blur(18px);
  }

  .mobile-bottom-nav[hidden] {
    display: none !important;
  }

  .mobile-bottom-item {
    min-width: 0;
    min-height: 52px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: var(--muted);
    padding: 4px 2px;
    cursor: pointer;
  }

  .mobile-bottom-item span {
    min-height: 20px;
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 1000;
    line-height: 1;
  }

  .mobile-bottom-item b {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 9px;
    line-height: 1.05;
    text-align: center;
  }

  .mobile-bottom-item.is-active {
    background: rgba(0, 184, 200, .16);
    color: var(--cyan-deep);
    box-shadow: inset 0 -3px 0 rgba(140, 255, 63, .85);
  }

  .mobile-module-sheet {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    align-items: end;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }

  .mobile-module-sheet[hidden] {
    display: none !important;
  }

  .mobile-module-sheet.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-module-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(4, 23, 29, .62);
    backdrop-filter: blur(3px);
  }

  .mobile-module-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: min(82dvh, 720px);
    overflow: auto;
    border-radius: 24px 24px 0 0;
    background: #f8fbfb;
    padding: 14px 12px calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -18px 50px rgba(0, 0, 0, .24);
    transform: translateY(22px);
    transition: transform .18s ease;
  }

  .mobile-module-sheet.is-open .mobile-module-dialog {
    transform: translateY(0);
  }

  .mobile-module-dialog::before {
    content: "";
    width: 46px;
    height: 5px;
    display: block;
    margin: 0 auto 12px;
    border-radius: 999px;
    background: rgba(11, 23, 32, .2);
  }

  .mobile-module-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
  }

  .mobile-module-dialog-head h2 {
    margin: 1px 0 3px;
    font-size: 22px;
  }

  .mobile-module-dialog-head span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
  }

  .mobile-module-close {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
  }

  .mobile-module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .mobile-module-item {
    min-height: 82px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #fff;
    padding: 10px;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
  }

  .mobile-module-item-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: rgba(0, 184, 200, .1);
    color: var(--cyan-deep);
    font-size: 19px;
    font-weight: 1000;
  }

  .mobile-module-item > span:last-child {
    display: grid;
    gap: 4px;
  }

  .mobile-module-item strong,
  .mobile-module-item small {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .mobile-module-item strong {
    font-size: 12px;
    line-height: 1.15;
  }

  .mobile-module-item small {
    color: var(--muted);
    font-size: 9px;
    line-height: 1.3;
  }

  .mobile-module-item.is-active {
    border-color: var(--cyan);
    background: rgba(0, 184, 200, .1);
    box-shadow: inset 0 -4px 0 rgba(140, 255, 63, .78);
  }
}

@media (max-width: 360px) {
  .mobile-module-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .metric-grid.compact {
    grid-template-columns: 1fr;
  }

  .status-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .role-pill,
  .switch-role-btn,
  .logout-btn {
    grid-column: span 1;
  }

  #networkStatus,
  #queueStatus {
    display: none;
  }

  .mobile-module-trigger {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .mobile-module-trigger-meta {
    display: none;
  }
}
