:root {
  --ink: #16343d;
  --teal: #20777b;
  --teal-dark: #155e62;
  --teal-light: #e6f3f2;
  --forest: #1d6757;
  --forest-light: #e8f5f1;
  --wine: #8c4261;
  --wine-light: #fbeff3;
  --amber: #b45309;
  --amber-light: #fef3c7;
  --ivory: #fbfaf7;
  --muted: #61757b;
  --edge: #dfe6e5;
  --edge-subtle: #edf2f1;
  --card-bg: #ffffff;
  --bg: #f2f5f4;
  --shadow-sm: 0 2px 8px rgba(18, 51, 58, 0.04);
  --shadow: 0 14px 40px rgba(18, 51, 58, 0.08);
  --shadow-hover: 0 18px 48px rgba(18, 51, 58, 0.12);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 15px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* Shell Layout */
.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* Topbar Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px 20px;
  border-bottom: 1px solid var(--edge);
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--ink);
  font-size: 19px;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 12px rgba(22, 52, 61, 0.25);
  flex-shrink: 0;
}

.brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.phase-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  background: var(--teal-light);
  color: var(--teal);
  border-radius: 20px;
  text-transform: uppercase;
}

.overline {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--teal);
  margin-bottom: 3px;
  text-transform: uppercase;
}

.topRight {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.dot {
  height: 8px;
  width: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.portal-status-text {
  font-weight: 600;
  color: var(--ink);
}

.updated-time {
  font-size: 12px;
  color: var(--muted);
  background: white;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--edge);
  font-variant-numeric: tabular-nums;
}

.session-timer {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  background: white;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--edge);
}

/* Buttons */
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: var(--teal);
  color: white;
  padding: 13px 20px;
  min-height: 46px;
  border-radius: 11px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: all 0.15s ease;
}
.primary:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}
.primary:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.outline-btn {
  border: 1px solid var(--edge);
  background: white;
  padding: 8px 14px;
  border-radius: 9px;
  color: var(--ink);
  font-weight: 650;
  font-size: 13px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.outline-btn:hover {
  border-color: var(--teal);
  background: #fdfefe;
}

.icon-btn {
  border: 1px solid var(--edge);
  background: white;
  padding: 6px 12px;
  border-radius: 9px;
  color: var(--ink);
  font-weight: 650;
  font-size: 12px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.icon-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.icon-btn.spinning {
  pointer-events: none;
  opacity: 0.7;
}

/* Authentication Panels */
.auth-panel {
  width: min(100%, 440px);
  margin: 48px auto 20px;
  background: white;
  padding: 36px 32px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: center;
}
.lock-emblem { font-size: 40px; margin-bottom: 12px; }
.auth-panel h1 {
  font-size: clamp(24px, 4vw, 30px);
  letter-spacing: -0.04em;
  margin: 0 0 10px;
}
.auth-panel p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13.5px;
  margin-bottom: 22px;
}
.auth-panel form {
  display: grid;
  gap: 12px;
  text-align: left;
}
.google { margin-top: 18px; width: 100%; }

/* Notices & Alerts */
.error-note, .notice {
  background: #fff1f0;
  border: 1px solid #f0c4c2;
  color: #953c34;
  border-radius: 11px;
  padding: 12px;
  font-size: 13px;
  margin-top: 16px;
  line-height: 1.5;
}

/* Navigation Tabs */
.portal-nav {
  display: flex;
  gap: 8px;
  margin: 22px 0 24px;
  background: white;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--edge);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.portal-nav::-webkit-scrollbar { display: none; }

.nav-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13.5px;
  padding: 10px 16px;
  border-radius: 10px;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav-tab:hover {
  color: var(--ink);
  background: #f4f8f7;
}
.nav-tab.active {
  background: var(--teal);
  color: white;
  box-shadow: 0 2px 8px rgba(32, 119, 123, 0.25);
}

.badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--amber-light);
  color: var(--amber);
  display: inline-block;
}
.nav-tab.active .badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Alert & Runway Banner */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border: 1px solid var(--edge);
  border-left: 5px solid #10b981;
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.alert-indicator { font-size: 20px; line-height: 1; flex-shrink: 0; }
.alert-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.alert-content strong {
  font-size: 15px;
  color: var(--ink);
}
.alert-content span {
  font-size: 12.5px;
  color: var(--muted);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--edge);
}
.kpi-card.accent-teal::before { background: var(--teal); }
.kpi-card.accent-wine::before { background: var(--wine); }
.kpi-card.accent-green::before { background: #10b981; }
.kpi-card.accent-amber::before { background: var(--amber); }

.kpi-label {
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: clamp(24px, 3.5vw, 30px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.kpi-card.accent-teal .kpi-value { color: var(--teal); }
.kpi-card.accent-wine .kpi-value { color: var(--wine); }
.kpi-card.accent-green .kpi-value { color: #047857; }
.kpi-card.accent-amber .kpi-value { color: var(--amber); }

.kpi-meta {
  font-size: 12px;
  color: var(--muted);
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.action-card {
  background: white;
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.action-card:hover {
  border-color: var(--teal);
  background: #fbfdfd;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.qa-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--teal-light);
  color: var(--teal);
  font-size: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}
.action-card strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
}
.action-card small {
  font-size: 12px;
  color: var(--muted);
}

/* Dashboard Cards */
.dash-card {
  background: white;
  border: 1px solid var(--edge);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.card-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 780;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.card-sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.compact-select {
  border: 1px solid var(--edge);
  background: white;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  min-height: 36px;
}
.compact-select:focus {
  border-color: var(--teal);
}

/* 30-Day Cycle Progress Bar */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.progress-bar-wrap {
  width: 100%;
  height: 16px;
  background: #e6eeec;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #10b981);
  border-radius: 20px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 8px;
}
.progress-labels strong {
  color: var(--teal);
  font-size: 14px;
}
.progress-labels span {
  color: var(--muted);
}

/* Water Metrics Quad */
.metrics-quad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  background: #f8faf9;
  border: 1px solid var(--edge-subtle);
  border-radius: 14px;
  padding: 18px;
}
.metric-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.metric-item small {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.metric-item strong {
  font-size: 21px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.metric-item span {
  font-size: 12px;
  color: var(--muted);
}

/* Analytics Row (2 columns) */
.analytics-row {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}
.flex-1 { flex: 1; min-width: 0; }

/* SVG Daily Expense Chart */
.chart-wrapper {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  padding-top: 10px;
}
.chart-loading {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px 0;
}
.svg-chart {
  width: 100%;
  height: 220px;
  overflow: visible;
}
.chart-bar {
  fill: var(--teal);
  transition: fill 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  rx: 3px;
}
.chart-bar:hover {
  fill: var(--teal-dark);
}
.chart-axis-line {
  stroke: var(--edge);
  stroke-width: 1;
}
.chart-axis-text {
  font-size: 10px;
  fill: var(--muted);
  text-anchor: middle;
}
.chart-tooltip {
  position: absolute;
  background: var(--ink);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translate(-50%, -100%);
  margin-top: -8px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

/* Tanker Breakdown Spending Mix */
.tanker-mix-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tanker-mix-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mix-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.mix-label { font-weight: 650; color: var(--ink); }
.mix-values { font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.mix-meta { font-size: 11.5px; color: var(--muted); font-weight: normal; margin-left: 6px; }
.mix-bar-wrap {
  width: 100%;
  height: 10px;
  background: #eef3f2;
  border-radius: 10px;
  overflow: hidden;
}
.mix-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease;
}
.bar-hmw-reg { background: #0284c7; }
.bar-hmw-comm { background: var(--teal); }
.bar-private { background: #d97706; }
.bar-other { background: #64748b; }

/* Tables */
.table-scroll {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--edge);
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
.data-table th {
  background: #f7faf9;
  color: #335056;
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--edge-subtle);
  color: var(--ink);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #fdfefe; }
.loading-cell { text-align: center; color: var(--muted); padding: 24px !important; }

.status-paid {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: #dcfce7;
  color: #15803d;
  font-size: 11.5px;
  font-weight: 700;
}
.status-partly-paid {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: #fef3c7;
  color: #b45309;
  font-size: 11.5px;
  font-weight: 700;
}
.status-concession {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 11.5px;
  font-weight: 700;
}

/* Pending Summary Strip */
.pending-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: #f8faf9;
  border: 1px solid var(--edge-subtle);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.pending-summary-strip div { display: flex; flex-direction: column; gap: 3px; }
.pending-summary-strip small { font-size: 11.5px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.pending-summary-strip strong { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.text-amber { color: var(--amber) !important; }

/* Entry Form */
.workcard {
  border: 1px solid var(--edge);
  background: white;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.tabrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 8px;
  gap: 8px;
  background: #f4f7f6;
  border-bottom: 1px solid var(--edge);
}
.tab {
  border: 0;
  background: transparent;
  color: #557477;
  font-weight: 750;
  border-radius: 10px;
  min-height: 44px;
  transition: all 0.15s ease;
}
.tab.active {
  background: var(--teal);
  color: white;
  box-shadow: 0 2px 6px rgba(32, 119, 123, 0.2);
}
#transactionForm { padding: 28px 24px; }
.formgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 750; color: #3c565a; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cad8d8;
  border-radius: 10px;
  min-height: 46px;
  padding: 11px 13px;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(32, 119, 123, 0.15);
}
.form-actions-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.saveMessage {
  border-radius: 11px;
  padding: 14px 16px;
  margin-top: 20px;
  line-height: 1.55;
  font-size: 13.5px;
}
.saveMessage.success { background: #e9f7ef; color: #12663b; border: 1px solid #afe2c7; }
.saveMessage.error { background: #fff0ef; color: #8e302a; border: 1px solid #efc0bb; }

/* Reports Subview Cards */
.flex-row-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.flex-row-card h4 {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--ink);
}

/* Footer */
.portal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 4px 12px;
  border-top: 1px solid var(--edge);
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 12px;
}
.textbutton {
  background: transparent;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  font-size: 13px;
  padding: 0;
}
.textbutton:hover { color: var(--ink); }

/* Phase 3: History & Audit Styling */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.history-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: #f8faf9;
  border: 1px solid var(--edge-subtle);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.history-summary-strip div { display: flex; flex-direction: column; gap: 3px; }
.history-summary-strip small { font-size: 11.5px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.history-summary-strip strong { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }

.history-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}
.history-sort-group, .history-page-size-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.badge-col {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  display: inline-block;
}
.badge-exp {
  background: #fce7f3;
  color: #9d174d;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  display: inline-block;
}
.amount-col {
  color: #15803d;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.amount-exp {
  color: #991b1b;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.text-green { color: #15803d !important; }
.text-wine { color: #8c4261 !important; }

/* Pagination */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.pagination-info {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.pagination-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}
.pagination-btn {
  border: 1px solid var(--edge);
  background: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s ease;
}
.pagination-btn:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal);
  background: #fbfdfd;
}
.pagination-btn.active {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}
.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 51, 58, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.modal-dialog {
  background: white;
  border-radius: 18px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  box-shadow: var(--shadow-hover);
  position: relative;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 14px;
}
.modal-header h3 {
  margin: 0 0 4px;
  font-size: 19px;
  color: var(--ink);
  letter-spacing: -0.03em;
}
.modal-sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}
.modal-close-btn {
  background: transparent;
  border: 0;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.modal-close-btn:hover {
  color: var(--ink);
  background: #f2f5f4;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
  border-top: 1px solid var(--edge);
  padding-top: 16px;
  flex-wrap: wrap;
}
.inspect-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.inspect-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #f8faf9;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--edge-subtle);
}
.inspect-item.full {
  grid-column: 1 / -1;
}
.inspect-item small {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.inspect-item strong {
  font-size: 14px;
  color: var(--ink);
  word-break: break-word;
}
.inspect-code {
  font-family: monospace;
  background: #eef3f2;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--ink);
}
.correction-safety-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #92400e;
}
.correction-safety-banner strong { font-size: 14px; color: #78350f; }
.feature-flag-tag {
  display: inline-block;
  align-self: flex-start;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 11.5px;
  font-weight: 750;
  border: 1px solid #fecaca;
}
.corr-comparison-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.corr-summary-box {
  background: #f8faf9;
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink);
}
.corr-formgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.corr-col-orig h4, .corr-col-new h4 {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: var(--ink);
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 860px) {
  .analytics-row { flex-direction: column; }
  .metrics-quad { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .pending-summary-strip { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .history-summary-strip { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .corr-comparison-wrap { grid-template-columns: 1fr; }
  .inspect-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .shell { padding: 14px 12px 36px; }
  .topbar { gap: 12px; padding-bottom: 14px; }
  .topRight { width: 100%; justify-content: space-between; }
  .portal-status-text { display: none; }
  .brand { font-size: 18px; }
  .mark { width: 42px; height: 42px; font-size: 16px; }
  .kpi-grid { grid-template-columns: 1fr; gap: 12px; }
  .quick-actions { grid-template-columns: 1fr; gap: 10px; }
  .metrics-quad { grid-template-columns: 1fr; }
  .pending-summary-strip { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
  .history-summary-strip { grid-template-columns: 1fr; }
  .corr-formgrid { grid-template-columns: 1fr; }
  .modal-dialog { padding: 18px 14px; }
  .formgrid { grid-template-columns: 1fr; gap: 14px; }
  .dash-card { padding: 18px 15px; }
  #transactionForm { padding: 20px 14px; }
  .portal-footer { flex-direction: column; text-align: center; }
}
