:root {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  color: #102a22;
  background: #f3f7f4;
  --ink: #102a22;
  --muted: #5e776e;
  --green: #087a55;
  --green-dark: #05593e;
  --mint: #eaf6ef;
  --line: #d6e6dd;
  --card: #ffffff;
  --shadow: 0 14px 36px rgba(17, 63, 45, 0.08);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: radial-gradient(circle at 95% 2%, #d8eee2 0, transparent 32rem), #f3f7f4;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  padding-top: env(safe-area-inset-top);
}

button, a.link-btn, select, input, .nav-tab, .pill, .sub-tab {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.shell {
  max-width: 1280px;
  margin: auto;
  padding: 20px max(22px, env(safe-area-inset-right)) 54px max(22px, env(safe-area-inset-left));
}

/* Topbar */
.topbar {
  min-height: 66px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}

.brand-logo {
  height: 38px;
  width: auto;
  max-width: 92px;
  object-fit: contain;
  border-radius: 9px;
  background: #fff;
  padding: 2px 5px;
  border: 1px solid var(--line);
}

.brand b { font-size: 24px; letter-spacing: -1px; color: var(--green); }
.brand span { font-size: 12px; font-weight: 700; color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.connection {
  color: #0e6f4a;
  background: #e1f4e8;
  border: 1px solid #bce4cc;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 13px;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.link-btn:hover { background: var(--mint); border-color: #9ecfb7; }

.tel-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #087a55;
  font-weight: 700;
  text-decoration: none;
  background: #eaf6ef;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
}
.tel-link:hover { background: #d5efdf; }

.hidden { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(24px, 3.6vw, 38px); letter-spacing: -1.1px; line-height: 1.1; }
h2 { font-size: clamp(17px, 2.2vw, 21px); letter-spacing: -0.4px; margin-bottom: 6px; }
h3 { font-size: 15px; margin-bottom: 7px; }
.eyebrow { color: #157a55; font-size: 10px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; margin-bottom: 4px; }
.muted { color: var(--muted); font-size: 13px; }

/* Controls */
button, input, select {
  font: inherit;
  border-radius: 11px;
  min-height: 44px;
  padding: 9px 13px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

input, select {
  border: 1px solid #bfd4c7;
  background: #fff;
  color: var(--ink);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

button {
  border: 0;
  background: var(--green);
  color: #fff;
  font-weight: 750;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(8, 122, 85, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover:not(:disabled) { background: var(--green-dark); transform: translateY(-1px); }
button:active:not(:disabled) { transform: scale(0.98); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

button.secondary {
  border: 1px solid #c6dacd;
  background: #fff;
  color: #21443a;
  box-shadow: none;
}
button.secondary:hover:not(:disabled) { background: #eef6f1; }

button.danger {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: none;
}
button.danger:hover:not(:disabled) { background: #fee2e2; }

button.sm { min-height: 36px; padding: 6px 12px; font-size: 12px; border-radius: 9px; }
button.text-button { padding: 4px 0; min-height: 32px; color: #0e7650; background: transparent; box-shadow: none; font-size: 13px; }

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #4fc293;
  outline-offset: 2px;
}

/* Password Eye Toggle */
.pw-wrap { position: relative; display: flex; align-items: center; width: 100%; }
.pw-wrap input { padding-right: 46px; }
.pw-eye {
  position: absolute;
  right: 6px;
  min-height: 34px;
  width: 34px;
  padding: 0;
  background: transparent;
  color: #4f6f63;
  box-shadow: none;
  border-radius: 8px;
  font-size: 15px;
}
.pw-eye:hover:not(:disabled) { background: #eaf4ee; transform: none; color: var(--green-dark); }

/* Auth Card */
.login {
  max-width: 460px;
  margin: clamp(24px, 6vw, 56px) auto;
  background: var(--card);
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.login h1 { font-size: clamp(24px, 4vw, 28px); margin-bottom: 10px; }
.login label { display: grid; gap: 6px; margin-top: 14px; font-weight: 700; font-size: 13px; color: #2f5448; }
.login > button { width: 100%; margin-top: 14px; }
.error { margin-top: 12px; padding: 11px 13px; background: #fff1f0; color: #b42318; border: 1px solid #fecaca; border-radius: 10px; font-size: 13px; font-weight: 600; }

/* Navigation Tabs (Desktop & Tablet) */
.main-nav {
  display: flex;
  gap: 8px;
  margin: 18px 0 6px;
  flex-wrap: wrap;
}
.nav-tab {
  padding: 9px 15px;
  min-height: 42px;
  background: #fff;
  color: #4f6a61;
  border: 1px solid var(--line);
  box-shadow: none;
  white-space: nowrap;
}
.nav-tab .nav-short { display: none; }
.nav-tab.active {
  background: #143d31;
  color: #fff;
  border-color: #143d31;
}

/* Pill Filters & Subtabs */
.pill-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0 14px;
}
.pill {
  min-height: 36px;
  padding: 6px 13px;
  border-radius: 999px;
  background: #fff;
  color: #365c50;
  border: 1px solid var(--line);
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
}
.pill.active {
  background: #143d31;
  color: #fff;
  border-color: #143d31;
}

/* Hero */
.owner-hero {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 165px;
  gap: 20px;
  align-items: center;
  padding: 26px 30px;
  border-radius: 20px;
  background: linear-gradient(135deg, #103b30, #087a55);
  color: #fff;
  overflow: hidden;
  position: relative;
  box-shadow: 0 18px 38px rgba(8, 122, 85, 0.16);
}
.owner-hero:after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border: 40px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  right: -115px;
  top: -120px;
}
.owner-hero > * { position: relative; z-index: 1; min-width: 0; }
.owner-hero .eyebrow { color: #b9efd2; }
.owner-hero h1 { margin: 4px 0 8px; }
.owner-hero p:not(.eyebrow) { color: #d8efe3; max-width: 680px; margin-bottom: 16px; font-size: 14px; }
.hero-company-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.hero-company-logo {
  height: 46px;
  width: auto;
  max-width: 110px;
  background: #fff;
  padding: 4px 8px;
  border-radius: 10px;
  object-fit: contain;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions button.secondary, .hero-actions a.link-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: none;
}
.hero-actions button.secondary:hover, .hero-actions a.link-btn:hover { background: rgba(255, 255, 255, 0.24); }
.sync-orb {
  width: 145px;
  height: 145px;
  border: 1px solid rgba(189, 235, 211, 0.28);
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.09);
  justify-self: end;
  padding: 10px;
}
.sync-orb span { font-size: 13px; font-weight: 800; line-height: 1.25; }
.sync-orb small { font-size: 10px; color: #cbecdb; margin-top: 4px; }

/* Notices & Alerts */
.notice {
  margin: 14px 0;
  padding: 12px 15px;
  border-radius: 12px;
  background: #e6f6ec;
  color: #195d42;
  border: 1px solid #bfe3cd;
  font-size: 13px;
  font-weight: 650;
}
.notice:empty { display: none; }
.notice.error { background: #fff1f0; color: #b42318; border-color: #fecaca; }

.attention {
  margin-top: 16px;
  background: #fff8e6;
  border: 1px solid #f5d287;
  color: #7c5209;
  border-radius: 14px;
  padding: 12px 16px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.attention p { margin: 0; }

/* Section headings & KPI grids */
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 12px;
  flex-wrap: wrap;
}
.section-heading h2 { margin: 0; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
}
.metric-card {
  min-height: 126px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 3px 12px rgba(20, 63, 50, 0.04);
  border-top: 4px solid #087a55;
  min-width: 0;
}
.metric-card.metric-1, .metric-card.metric-5 { border-top-color: #0ea5e9; }
.metric-card.metric-2, .metric-card.metric-6 { border-top-color: #f59e0b; }
.metric-card.metric-3, .metric-card.metric-7 { border-top-color: #8b5cf6; }
.metric-card strong { font-size: clamp(19px, 2.3vw, 25px); letter-spacing: -0.7px; color: #124637; word-break: break-word; }
.metric-card span { font-size: 13px; font-weight: 800; color: #1b3b31; }
.metric-card small { font-size: 11px; color: var(--muted); margin-top: auto; }

/* Cash breakdown */
.cash-summary {
  margin-top: 16px;
  padding: 18px 22px;
  border: 1px solid #b4dec7;
  border-radius: 16px;
  background: linear-gradient(130deg, #e8f7ee, #f8fcf9);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}
.cash-summary h2 { margin: 2px 0 0; }
.cash-summary p { margin: 0; }
.cash-breakdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; min-width: 480px; }
.cash-breakdown span { display: grid; gap: 4px; color: #4d7062; font-size: 11px; }
.cash-breakdown b { color: #13392e; font-size: 15px; }

/* 7-Day Trend Bar Chart */
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; font-weight: 700; color: var(--muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 185px;
  padding: 14px 4px 4px;
}
.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.bar-val { font-size: 10px; font-weight: 800; color: #194d3c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bar-track {
  width: 100%;
  max-width: 44px;
  height: 122px;
  background: #eef5f0;
  border-radius: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 4px;
}
.bar-fill { width: 46%; min-height: 3px; border-radius: 6px; transition: height 0.3s ease; }
.bar-fill.pc { background: linear-gradient(180deg, #109468, #087a55); }
.bar-fill.mob { background: linear-gradient(180deg, #38bdf8, #0284c7); }
.bar-lbl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }

/* Cards & Grids */
.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.panel, .enroll-card, .billing-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: 0 4px 15px rgba(20, 63, 50, 0.04);
  min-width: 0;
}
.panel { margin-top: 18px; }

.focus-card { background: linear-gradient(145deg, #f9fdf9, #edf7f0); }
.focus-card ol { list-style: none; margin: 14px 0 18px; padding: 0; display: grid; gap: 11px; }
.focus-card li { display: flex; gap: 10px; align-items: center; color: #31564a; font-size: 13px; }
.focus-card b { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 50%; background: #d6eedf; color: #0e6f4c; font-size: 12px; }

.enroll-card {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 0.9fr 1.4fr;
  gap: 20px;
  align-items: start;
  background: linear-gradient(145deg, #fff, #eff8f2);
}
.enroll-card p { font-size: 13px; color: #506c62; }
.enroll-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.enroll-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 750; color: #365c50; min-width: 0; }
.code-result { grid-column: 1 / -1; margin: 0 !important; border-top: 1px solid #dbeae1; padding-top: 12px; font-size: 13px; word-break: break-word; }
.code-result strong { display: inline-block; margin-top: 4px; padding: 6px 10px; background: #143d31; color: #fff; border-radius: 8px; letter-spacing: 1px; }

.billing-card { margin-top: 18px; background: linear-gradient(135deg, #123c31, #087a55); color: #fff; }
.billing-card h2 { font-size: clamp(20px, 3vw, 26px); }
.billing-card p { color: #ddf1e6; max-width: 720px; }
.billing-card .eyebrow { color: #b9efd2; }
.billing-card .notice { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.25); color: #fff; }

.audit-details { margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; padding: 15px 18px; background: #fff; }
.audit-details summary { font-weight: 800; cursor: pointer; color: #225444; min-height: 30px; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; border: 1px solid #dfeae4; border-radius: 12px; overflow: hidden; background: #fff; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #e7efeb; vertical-align: middle; }
th { background: #f2f8f4; color: #546e65; text-transform: uppercase; font-size: 10px; font-weight: 800; letter-spacing: 0.6px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafdfb; }
.empty { padding: 24px; text-align: center; color: #728a81; font-size: 13px; margin: 0; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #eaf6ef;
  color: #166534;
  border: 1px solid #c6e6d1;
  white-space: nowrap;
}
.badge.active, .badge.paid, .badge.online, .badge.delivered { background: #dcfce7; color: #166534; border-color: #86efac; }
.badge.pending, .badge.partial, .badge.recently_online { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge.expired, .badge.suspended, .badge.cancelled, .badge.offline, .badge.unpaid { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* Toolbar, Forms, and AdBox Operator Portal */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin: 12px 0 16px;
}
.toolbar label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 750;
  color: #365c50;
  flex: 1 1 200px;
  min-width: 0;
}
label.checkbox-label {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: #274a3f;
}
label.checkbox-label input { min-height: auto; width: 18px; height: 18px; padding: 0; margin: 0; flex: 0 0 18px; accent-color: var(--green); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr));
  gap: 12px;
  align-items: end;
}
.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 750;
  color: #365c50;
  min-width: 0;
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

body.operator {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px max(22px, env(safe-area-inset-right)) 56px max(22px, env(safe-area-inset-left));
}
body.operator header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 26px;
  border-radius: 20px;
  background: linear-gradient(135deg, #103b30, #087a55);
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 16px 34px rgba(8, 122, 85, 0.16);
}
body.operator header .eyebrow { color: #b9efd2; }
body.operator header .muted { color: #d8efe3; margin-bottom: 0; }
body.operator header h1 { margin-bottom: 6px; font-size: clamp(22px, 3vw, 32px); }
body.operator > section, body.operator section.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px;
  margin-top: 16px;
  box-shadow: 0 4px 14px rgba(20, 63, 50, 0.04);
}
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr));
  gap: 12px;
  margin: 14px 0 16px;
}
.summary article {
  background: linear-gradient(180deg, #fff, #f8fbf9);
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.summary article strong {
  font-size: clamp(20px, 2.5vw, 26px);
  letter-spacing: -0.7px;
  color: var(--ink);
}
.org-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  margin-top: 14px;
}
.org-subcard {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  min-width: 0;
}
.org-subcard h3 { margin-bottom: 10px; }

/* Tablet & iPad Adjustments (641px..960px) */
@media (max-width: 960px) {
  input, select, textarea { font-size: 16px; min-height: 44px; }
  .main-nav { flex-wrap: wrap; gap: 7px; }
  .main-nav .nav-tab { padding: 8px 12px; font-size: 12px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-columns { grid-template-columns: 1fr; }
  .enroll-card { grid-template-columns: 1fr; }
  .enroll-form { grid-template-columns: 1fr; }
  .cash-summary { align-items: flex-start; flex-direction: column; }
  .cash-breakdown { min-width: 0; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Smartphone Android & iOS (<= 640px) */
@media (max-width: 640px) {
  .shell { padding: 12px max(12px, env(safe-area-inset-right)) calc(90px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  body.operator { padding: 12px max(12px, env(safe-area-inset-right)) calc(34px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  body.operator > section, body.operator section.panel, .panel, .enroll-card, .billing-card { padding: 15px; border-radius: 15px; }
  .topbar { gap: 8px; }
  .owner-hero { grid-template-columns: 1fr; padding: 18px; }
  .sync-orb { justify-self: start; width: auto; height: auto; border-radius: 14px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; }
  .sync-orb small { margin-top: 0; }
  .metric-grid { grid-template-columns: 1fr; }
  .cash-breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bar-chart { gap: 5px; }
  .bar-track { max-width: 34px; height: 96px; }
  .bar-val { font-size: 9px; }
  .hero-actions button, .hero-actions a.link-btn, .actions button { width: 100%; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  /* Native Sticky Mobile Bottom Dock on Owner Portal */
  #dashboard .main-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 26px rgba(16, 59, 48, 0.12);
    overflow: visible;
  }
  #dashboard .nav-tab {
    flex-direction: column;
    gap: 2px;
    padding: 6px 2px;
    min-height: 50px;
    border: 0;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 750;
    background: transparent;
    color: #4f6a61;
  }
  #dashboard .nav-tab .nav-full { display: none; }
  #dashboard .nav-tab .nav-short { display: block; font-size: 10px; line-height: 1.1; }
  #dashboard .nav-tab .nav-ico { font-size: 16px; line-height: 1.1; }
  #dashboard .nav-tab.active { background: #087a55; color: #fff; font-weight: 800; }
}

/* Tablet Portrait & Phone Card Tables (<= 840px, zero right-edge clipping on iPad) */
@media (max-width: 840px) {
  table, tbody, td { display: block; width: 100%; }
  table { border: 0; background: transparent; }
  thead { display: none; }
  tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 14px;
    border: 1px solid #dfeae4;
    border-radius: 14px;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(16, 59, 48, 0.04);
  }
  td {
    display: grid;
    grid-template-columns: 44% 1fr;
    gap: 8px;
    padding: 7px 4px;
    border-bottom: 1px solid #eef4f1;
    align-items: center;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  td:before {
    content: attr(data-label);
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--muted);
  }
}

@media (max-width: 640px) {
  tbody tr { grid-template-columns: 1fr; gap: 0; padding: 8px 10px; }
  td:last-child { border-bottom: 0; }
}

/* Custom Confirmation Message Box & Floating Toasts */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(10, 34, 26, 0.56);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-box {
  width: min(100%, 460px);
  max-height: 90dvh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(8, 42, 30, 0.25);
  animation: modalIn 0.16s ease-out;
}
.modal-box.wide { width: min(100%, 680px); }
.modal-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.modal-ico {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: #e6f6ec;
  color: #087a55;
}
.modal-ico.danger { background: #fee2e2; color: #b91c1c; }
.modal-ico.warn { background: #fef3c7; color: #b45309; }
.modal-box h3 { margin: 0 0 4px; font-size: 18px; color: var(--ink); }
.modal-body { font-size: 14px; line-height: 1.5; color: #365c50; margin-bottom: 18px; white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.toast-stack {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 130;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 13px;
  background: #103b30;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 12px 30px rgba(8, 38, 28, 0.22);
  border-left: 4px solid #34d399;
}
.toast.err { background: #7f1d1d; border-left-color: #f87171; }
.toast button { min-height: 26px; padding: 2px 7px; background: rgba(255,255,255,0.16); box-shadow: none; font-size: 11px; }

.guide-list { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13px; color: #2b4d42; }
.guide-code { background: #0f2720; color: #d8f5e5; padding: 10px 12px; border-radius: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; overflow-x: auto; margin: 8px 0; }

@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .modal-actions button { width: 100%; }
}
