/* ==========================================================================
   Motography Daybook Design System for Shoot Manager
   ========================================================================== */

:root {
  --bg: #eceff1;
  --surface: #ffffff;
  --surface-2: #e2e7ea;
  --fg: #11171c;
  --fg-2: #4a5761;
  --line: #cfd6db;
  --accent: #0b6e6e;
  --accent-fg: #ffffff;
  --accent-soft: #d3ebe9;
  --good: #1b7a43;
  --warn: #a15c00;
  --bad: #b3261e;
  --st-booked: #3a5a8c;
  --st-shot: #a15c00;
  --st-editing: #7a45a8;
  --st-delivered: #1b7a43;
  --font-display: "Syne", system-ui, -apple-system, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1215;
    --surface: #161c20;
    --surface-2: #1f2730;
    --fg: #e8eef1;
    --fg-2: #98a7b0;
    --line: #2b353c;
    --accent: #4fc4b8;
    --accent-fg: #06201d;
    --accent-soft: #15332f;
    --good: #5bd08a;
    --warn: #f0b04a;
    --bad: #ff8a80;
    --st-booked: #86a8de;
    --st-shot: #f0b04a;
    --st-editing: #c39be6;
    --st-delivered: #5bd08a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1215;
  --surface: #161c20;
  --surface-2: #1f2730;
  --fg: #e8eef1;
  --fg-2: #98a7b0;
  --line: #2b353c;
  --accent: #4fc4b8;
  --accent-fg: #06201d;
  --accent-soft: #15332f;
  --good: #5bd08a;
  --warn: #f0b04a;
  --bad: #ff8a80;
  --st-booked: #86a8de;
  --st-shot: #f0b04a;
  --st-editing: #c39be6;
  --st-delivered: #5bd08a;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eceff1;
  --surface: #ffffff;
  --surface-2: #e2e7ea;
  --fg: #11171c;
  --fg-2: #4a5761;
  --line: #cfd6db;
  --accent: #0b6e6e;
  --accent-fg: #ffffff;
  --accent-soft: #d3ebe9;
  --good: #1b7a43;
  --warn: #a15c00;
  --bad: #b3261e;
  --st-booked: #3a5a8c;
  --st-shot: #a15c00;
  --st-editing: #7a45a8;
  --st-delivered: #1b7a43;
  color-scheme: light;
}

/* Base & Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100%;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: var(--surface);
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--fg);
  text-wrap: balance;
}

h1 { font-size: clamp(24px, 5vw, 32px); font-weight: 800; line-height: 1.1; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fg-2);
}

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

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Header & Navigation */
header.top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
  transition: background-color .2s ease;
}

header.top .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 10px;
}

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

.brand svg {
  flex: none;
  color: var(--accent);
}

.brand b {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .14em;
  font-size: 15px;
  color: var(--fg);
}

.brand span {
  color: var(--fg-2);
  font-size: 13px;
  letter-spacing: .04em;
}

nav.tabs {
  display: none;
  gap: 4px;
}

nav.tabs a, nav.tabs button {
  border: 0;
  background: none;
  color: var(--fg-2);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13.5px;
  text-decoration: none;
  transition: all .15s ease;
  white-space: nowrap;
}

nav.tabs a:hover, nav.tabs button:hover {
  background: var(--surface-2);
  color: var(--fg);
}

nav.tabs a.active, nav.tabs a[aria-current="page"], nav.tabs button[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

/* Header Live / User badge */
.user-badge {
  font-size: 13px;
  color: var(--fg-2);
  white-space: nowrap;
}

.user-badge strong {
  color: var(--fg);
  font-weight: 600;
}

.live {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
}

.theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--fg);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Mobile Bottom Bar (Native App Style) */
nav.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

nav.bar a, nav.bar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--fg-2);
  text-decoration: none;
  background: none;
  border: 0;
  min-height: 48px;
  border-radius: 8px;
  transition: transform 0.12s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
}

nav.bar a:active, nav.bar button:active {
  transform: scale(0.92);
}

nav.bar a.active, nav.bar button.active, nav.bar a[aria-current="page"] {
  color: var(--accent);
}

nav.bar svg {
  width: 22px;
  height: 22px;
  transition: transform 0.15s ease;
}

nav.bar a.active svg, nav.bar button.active svg {
  stroke-width: 2.3;
  filter: drop-shadow(0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent));
}

@media (min-width: 760px) {
  nav.tabs { display: flex; margin-left: 20px; }
  nav.bar { display: none; }
  body { padding-bottom: 40px; }
}

/* Native iOS-style Bottom Sheet */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s cubic-bezier(0.16, 1, 0.3, 1), visibility .22s cubic-bezier(0.16, 1, 0.3, 1);
}

.scrim.open {
  opacity: 1;
  visibility: visible;
}

.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(0.16, 1, 0.3, 1);
}

.scrim.open .sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 0 auto 4px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.sheet-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sheet-nav a, .sheet-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  background: none;
  border: 0;
  text-align: left;
  width: 100%;
  transition: background .12s ease;
  cursor: pointer;
}

.sheet-nav a:hover, .sheet-nav button:hover, .sheet-nav a:active, .sheet-nav button:active {
  background: var(--surface-2);
}

.sheet-nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sheet-nav svg {
  width: 20px;
  height: 20px;
  color: var(--fg-2);
  flex: none;
}

.sheet-nav a.active svg {
  color: var(--accent);
}

/* Main Content Area */
main {
  padding-block: 24px;
}

/* Layout Frames & Sections */
.frame {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.frame h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(24px, 5vw, 36px);
  line-height: 1.05;
}

.sec {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sec > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.two {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 900px) {
  .two { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 500;
  font-size: 14px;
  min-height: 40px;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  font-weight: 700;
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.danger {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 35%, transparent);
}

.btn.danger:hover {
  background: color-mix(in srgb, var(--bad) 10%, var(--surface));
}

.btn.sm {
  padding: 5px 10px;
  min-height: 32px;
  font-size: 13px;
  border-radius: 6px;
}

.btn.icon {
  padding: 9px 12px;
}

/* Metric Tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, border-color .15s ease;
}

.tile.primary-tile, .tile:first-child {
  grid-column: 1 / -1;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.tile.primary-tile .eyebrow, .tile.primary-tile .sub,
.tile:first-child .eyebrow, .tile:first-child .sub {
  color: inherit;
  opacity: .85;
}

.tile .num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(22px, 4vw, 28px);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.tile .sub {
  font-size: 12px;
  color: var(--fg-2);
}

@media (min-width: 760px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile:first-child { grid-column: auto; }
}

@media (min-width: 1024px) {
  .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* Status Chips */
.chip {
  --c: var(--fg-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 99px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  white-space: nowrap;
}

.chip.Booked, .chip.booked, .chip.New, .chip.new { --c: var(--st-booked); }
.chip.Scheduled, .chip.scheduled { --c: var(--st-booked); }
.chip.Shot, .chip.shot, .chip.Follow-up, .chip.contacted, .chip.quoted { --c: var(--st-shot); }
.chip.Editing, .chip.editing { --c: var(--st-editing); }
.chip.Delivered, .chip.delivered, .chip.Converted, .chip.won, .chip.paid { --c: var(--st-delivered); }
.chip.Closed, .chip.closed, .chip.Lost, .chip.lost { --c: var(--fg-2); }
.chip.Overdue, .chip.overdue { --c: var(--bad); }

.due {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.due.zero { color: var(--good); }
.due.owe { color: var(--warn); }
.late { color: var(--warn); font-family: var(--font-mono); font-size: 12px; }

/* Form Inputs */
input, select, textarea {
  width: 100%;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  min-height: 40px;
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

input[type="date"] {
  width: auto;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
}

label.f {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  min-width: 0;
}

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.span2 { grid-column: 1 / -1; }

/* Lists & Rows */
.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  width: 100%;
  text-align: left;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  transition: background .12s ease;
}

.row:last-child {
  border-bottom: 0;
}

.row:hover {
  background: var(--surface-2);
}

.row .main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row .main b {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.row .main small {
  color: var(--fg-2);
  overflow-wrap: anywhere;
}

.row .end {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
}

.empty {
  padding: 24px 16px;
  color: var(--fg-2);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

/* Tables */
.tablewrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}

th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg-2);
  font-weight: 500;
  background: var(--surface-2);
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

tr:last-child td {
  border-bottom: 0;
}

tr:hover td {
  background: var(--surface-2);
}

td.n, th.n {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Panels & Banners */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.banner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-size: 13px;
  margin-bottom: 16px;
}

.banner.warn {
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}

.banner.good {
  background: color-mix(in srgb, var(--good) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--good) 40%, transparent);
}

/* Stages Progress Bar */
.stages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 6px;
}

.stages .stage-step {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 9px 4px;
  font-size: 12px;
  font-weight: 700;
  min-height: 40px;
  color: var(--fg-2);
  text-align: center;
  text-transform: capitalize;
}

.stages .stage-step.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

/* Auth Section */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg);
}

.auth {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}

.auth h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  margin-top: 4px;
  margin-bottom: 16px;
}

/* ==========================================================================
   Tailwind Compatibility Layer (Mapped to Motography Daybook Tokens)
   ========================================================================== */
.bg-slate-900 { background-color: var(--surface) !important; color: var(--fg); }
header.bg-slate-900 { background-color: var(--surface) !important; border-bottom: 1px solid var(--line); }
.bg-slate-50 { background-color: var(--bg) !important; color: var(--fg); }
.bg-slate-100 { background-color: var(--surface-2) !important; color: var(--fg); }
.bg-slate-200 { background-color: var(--surface-2) !important; color: var(--fg); }
.bg-slate-700 { background-color: var(--accent-soft) !important; color: var(--accent) !important; }
.bg-white { background-color: var(--surface) !important; border: 1px solid var(--line); color: var(--fg); }
.text-slate-800 { color: var(--fg) !important; }
.text-slate-500, .text-slate-600 { color: var(--fg-2) !important; }
.text-slate-300, .text-slate-400 { color: var(--fg-2) !important; }
.text-white { color: var(--accent-fg) !important; }

.border { border: 1px solid var(--line) !important; }
.border-b { border-bottom: 1px solid var(--line) !important; }
.border-slate-300 { border-color: var(--line) !important; }
.divide-y > :not([hidden]) ~ :not([hidden]) { border-color: var(--line) !important; }

.hover\:bg-slate-50:hover, .hover\:bg-slate-100:hover { background-color: var(--surface-2) !important; }
.hover\:bg-slate-600:hover { background-color: var(--accent) !important; color: var(--accent-fg) !important; }
.hover\:bg-slate-800:hover { background-color: var(--surface-2) !important; color: var(--fg) !important; }

.shadow, .shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important; }
.rounded { border-radius: 8px !important; }
.rounded-lg { border-radius: 10px !important; }

/* Grid & Layout Utilities */
.container { width: 100%; }
.block { display: block; }
.inline { display: inline; }
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-self-start { justify-self: start; }

.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: .5rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: .75rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }

.w-full { width: 100%; }
.min-w-20 { min-width: 5rem; }
.min-w-40 { min-width: 10rem; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-6xl { max-width: 72rem; }
.min-h-screen { min-height: 100vh; }

.mx-auto { margin-left: auto; margin-right: auto; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.ml-2 { margin-left: .5rem; }
.ml-5 { margin-left: 1.25rem; }

.p-2 { padding: .5rem; }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: .5rem; padding-right: .5rem; }
.px-3 { padding-left: .75rem; padding-right: .75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: .25rem; padding-bottom: .25rem; }
.py-1\.5 { padding-top: .375rem; padding-bottom: .375rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-3 { padding-top: .75rem; padding-bottom: .75rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.pb-2 { padding-bottom: .5rem; }
.pb-3 { padding-bottom: .75rem; }
.pl-3 { padding-left: .75rem; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: .75rem; }
.text-sm { font-size: .875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; font-family: var(--font-display); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }
.underline { text-decoration: underline; }
.overflow-x-auto { overflow-x: auto; }
.whitespace-nowrap { white-space: nowrap; }

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

@media (min-width: 640px) {
  .sm\:inline { display: inline; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:col-span-2 { grid-column: span 2 / span 2; }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
}

/* Alert Boxes */
.bg-green-100 {
  background-color: color-mix(in srgb, var(--good) 15%, var(--surface)) !important;
  color: var(--good) !important;
  border: 1px solid color-mix(in srgb, var(--good) 35%, transparent) !important;
}
.bg-red-100 {
  background-color: color-mix(in srgb, var(--bad) 15%, var(--surface)) !important;
  color: var(--bad) !important;
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent) !important;
}
.bg-amber-100, .bg-amber-50 {
  background-color: color-mix(in srgb, var(--warn) 15%, var(--surface)) !important;
  color: var(--warn) !important;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent) !important;
}

/* ==========================================================================
   Native Mobile App / PWA Optimizations
   ========================================================================== */

/* Touch feedback across buttons, list items, tiles */
button, .btn, .row, .tile, nav.bar a, nav.bar button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active, button.btn:active {
  transform: scale(0.96);
}

.tile:active {
  transform: scale(0.98);
  background-color: var(--surface-2);
}

.row:active {
  background-color: var(--surface-2);
}

/* Mobile Screens (< 760px) */
@media (max-width: 759px) {
  /* Prevent iOS automatic input zooming */
  input, select, textarea {
    font-size: 16px !important;
    min-height: 44px;
  }

  /* Compact native mobile header */
  header.top .wrap {
    padding-block: 8px;
    gap: 12px;
  }
  header.top .brand b {
    font-size: 14px;
    letter-spacing: .12em;
  }
  header.top .brand span {
    font-size: 12px;
  }
  .desktop-only-form,
  .user-badge {
    display: none !important;
  }

  /* Full bleed padding on mobile */
  .wrap {
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }

  main {
    padding-block: 16px;
  }

  .frame h1 {
    font-size: clamp(22px, 5.5vw, 28px);
  }

  /* Touch-friendly metric tiles */
  .tiles {
    gap: 8px;
  }
  .tile {
    padding: 12px;
  }
  .tile .num {
    font-size: 24px;
  }

  /* Horizontally scrollable toolbars */
  .tools {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .tools::-webkit-scrollbar {
    display: none;
  }
  .tools input, .tools select {
    flex: none;
    min-width: 140px;
  }

  /* Table momentum scrolling */
  .tablewrap {
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
  table {
    font-size: 13px;
  }
  th, td {
    padding: 10px 10px;
  }
}