:root {
  color-scheme: dark;
  --bg: #0e1319;
  --surface: #151b23;
  --surface-2: #1c2430;
  --text: #e7ecf2;
  --muted: #8d9aab;
  --line: #263140;
  --accent: #3b82f6;
  --accent-2: #2dd4bf;
  --good: #34c77b;
  --warn: #f2b84b;
  --shadow: 0 10px 30px rgba(0, 0, 0, .3);
  --nav-width: 248px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --text: #111827;
  --muted: #5b6675;
  --line: #e0e5ec;
  --accent: #2563eb;
  --accent-2: #0d9488;
  --shadow: 0 6px 20px rgba(17, 24, 39, .06);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 68px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(16px, 3vw, 34px);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.brand-logo { width: 40px; height: 40px; display: block; object-fit: contain; border-radius: 8px; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 2px; }
nav { display: flex; gap: 8px; margin-left: auto; }
nav a {
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
}
nav a.active, nav a:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }

main { padding: clamp(16px, 3vw, 34px); }
.topbar { align-items: center; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.menu-btn { background: transparent; border-color: transparent; }
.menu-btn:hover { background: var(--surface-2); }
.user-chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-shell {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.admin-shell.nav-collapsed { grid-template-columns: 64px minmax(0, 1fr); }
.side-nav {
  position: sticky;
  top: 90px;
  min-width: 0;
  max-height: calc(100vh - 110px);
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  gap: 16px;
  padding: 14px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.nav-group { display: grid; gap: 2px; }
.nav-group-title {
  margin: 0 0 6px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nav-item {
  position: relative;
  width: 100%;
  justify-content: flex-start;
  gap: 12px;
  min-height: 40px;
  padding: 8px 10px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
}
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.nav-item.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-collapsed .nav-group-title { display: none; }
.nav-collapsed .nav-group + .nav-group { padding-top: 12px; border-top: 1px solid var(--line); }
.nav-collapsed .nav-item { justify-content: center; padding: 8px; }
.nav-collapsed .nav-item span { display: none; }
.nav-scrim { display: none; }
.breadcrumb { color: var(--muted); font-size: 13px; font-weight: 600; }
.breadcrumb span { margin: 0 4px; opacity: .6; }
.breadcrumb strong { color: var(--text); }

@media (max-width: 900px) {
  .admin-shell, .admin-shell.nav-collapsed { grid-template-columns: minmax(0, 1fr); }
  .side-nav {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    width: min(280px, 85vw);
    max-height: none;
    align-content: start;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 12px 18px;
    border-radius: 0 10px 10px 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .nav-open .side-nav { transform: none; }
  .nav-collapsed .nav-group-title { display: block; }
  .nav-collapsed .nav-group + .nav-group { padding-top: 0; border-top: 0; }
  .nav-collapsed .nav-item { justify-content: flex-start; padding: 8px 10px; }
  .nav-collapsed .nav-item span { display: inline; }
  .nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); }
  .user-chip { display: none; }
}
.login-wrap {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
}
.login-card {
  width: min(100%, 430px);
}
.login-card label + label { margin-top: 12px; }
.page-grid { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.content-stack { display: grid; gap: 18px; }
.panel, .hero-compact, .movie-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { padding: 18px; }
.admin-shell, .content-stack, .report-panel { min-width: 0; }
.side-panel { position: sticky; top: 86px; }
.section-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-head h1, .section-head h2, .hero-compact h2, .movie-card h1 { margin: 0; letter-spacing: 0; }
.section-head h1 { font-size: 28px; }
.section-head h2, .hero-compact h2 { font-size: 22px; }
.eyebrow { margin: 0 0 4px; color: var(--accent-2); text-transform: uppercase; font-size: 12px; font-weight: 800; letter-spacing: 0; }
.stack, .form-grid, .show-grid { display: grid; gap: 12px; }
.movie-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.movie-form-grid .image-field, .company-form-grid .image-field { grid-column: 1 / -1; }
.movie-form-grid button { align-self: end; }
.user-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.user-access {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
}
.user-access legend { color: var(--muted); font-size: 13px; font-weight: 800; padding: 0 6px; }
.user-access > small { display: block; margin-top: 8px; color: var(--muted); font-weight: 700; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.check-row input { width: auto; }
.check-row small { color: var(--muted); margin-left: 4px; }
.company-access-row { display: grid; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.company-access-row:last-of-type { border-bottom: 0; }
.company-access-row > .check-grid { padding-left: 26px; }
.company-access-row .muted-cell { text-align: left; }

label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 22%, transparent); }

button, .file-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 600;
}
button:hover, .file-btn:hover { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line)); }
.primary { background: var(--accent); border-color: var(--accent); color: white; }
.secondary { background: var(--surface-2); }
.danger { background: #c5362d; border-color: #c5362d; color: white; }
.wide { width: 100%; margin-top: 12px; }
.icon-btn { width: 40px; height: 40px; padding: 0; }
.file-btn input { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.public-link {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.public-link span { grid-column: 1 / -1; color: var(--muted); font-size: 12px; font-weight: 800; }
.public-link strong { overflow-wrap: anywhere; align-self: center; }

.hero-compact {
  min-height: 180px;
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 16px;
  align-items: center;
}
.hero-compact p:last-child { color: var(--muted); line-height: 1.7; }
.poster, .banner {
  height: 148px;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #272f32, #43332f);
}
.poster img, .banner img { width: 100%; height: 100%; object-fit: cover; }
.poster span { font-size: 64px; font-weight: 900; color: white; }

.cards { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 12px; }
.metric {
  padding: 16px;
  min-height: 98px;
  display: grid;
  align-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metric span { color: var(--muted); font-size: 13px; font-weight: 800; }
.metric strong { font-size: clamp(20px, 2vw, 28px); letter-spacing: 0; overflow-wrap: anywhere; }

.bulk { margin-bottom: 12px; }
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; min-width: 720px; }
#mappingTable { min-width: 760px; }
#reportTable { min-width: 980px; }
.report-table-wrap { min-width: 0; overscroll-behavior-x: contain; }
.range-report-table { width: max-content; min-width: 100%; }
.range-report-table th, .range-report-table td { text-align: center; }
.range-report-table td:nth-child(2), .range-report-table td:nth-child(3) { text-align: left; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
td input { min-width: 130px; padding: 9px 10px; }
td small { display: block; margin-top: 4px; color: var(--muted); font-weight: 700; }
.drag-cell { width: 48px; padding-right: 4px; }
.drag-handle { cursor: grab; color: var(--muted); }
.drag-handle:active { cursor: grabbing; }
#mappingTable tr.dragging {
  opacity: .55;
  background: color-mix(in srgb, var(--accent-2) 18%, var(--surface));
}
.url-cell {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.url-cell span { overflow-wrap: anywhere; white-space: normal; color: var(--muted); }
.row-actions { display: flex; gap: 8px; align-items: center; }
tfoot td { font-weight: 900; background: color-mix(in srgb, var(--accent-2) 10%, var(--surface)); }
.muted-cell { color: var(--muted); text-align: center; }

.mapping-set-bar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 12px;
  align-items: end;
}
.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  gap: 8px;
  align-items: end;
}

.filters { display: grid; grid-template-columns: minmax(180px, 260px) 180px minmax(220px, 1fr); gap: 12px; margin-bottom: 12px; }
.report-panel .filters > label { min-width: 0; }
.report-panel .filters input, .report-panel .filters select { width: 100%; min-width: 0; }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 12px; bottom: 12px; color: var(--muted); }
.search-field input { padding-left: 38px; }

.audit-list { display: grid; gap: 8px; }
.audit-list div {
  display: grid;
  grid-template-columns: minmax(160px, .7fr) 1fr auto;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.audit-list div:last-child { border-bottom: 0; }
.audit-list span, .audit-list time { color: var(--muted); }

.statement-page, .statement-sections { display: grid; gap: 16px; min-width: 0; }
.statement-heading .section-head { align-items: center; }
.statement-heading .section-head h1 { margin-bottom: 7px; }
.statement-company-line { margin: 0; color: var(--muted); }
.statement-company-logo { width: 112px; height: 72px; object-fit: contain; }
.statement-toolbar { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.statement-toolbar label { flex: 1 1 220px; }
.button-link { display: inline-flex; align-items: center; min-height: 40px; }
.statement-dashboard-link { margin-top: 12px; width: fit-content; }
.statement-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.statement-header-fields { padding-top: 14px; }
.company-address-field { grid-column: 1 / -1; }
.statement-rule, .statement-classification { color: var(--muted); line-height: 1.55; font-size: 13px; }
.statement-section-heading, .statement-subhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.statement-section-heading h2, .statement-subhead h2, .statement-subhead h3 { margin: 0; }
.statement-theater { min-width: 0; }
.statement-theater .statement-subhead { margin-bottom: 12px; }
.statement-subsection { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.statement-subsection h3 { font-size: 16px; }
.statement-lines { display: grid; gap: 10px; min-width: 0; }
.statement-line-row { display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)) minmax(110px, .8fr) minmax(110px, .8fr) auto; gap: 10px; align-items: end; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.statement-publicity-row { grid-template-columns: repeat(3, minmax(100px, 1fr)) repeat(3, minmax(125px, 1fr)) auto; }
.statement-expenses .statement-line-row { grid-template-columns: minmax(150px, .8fr) minmax(180px, 1.3fr) repeat(2, minmax(100px, .8fr)) minmax(110px, .8fr) minmax(110px, .8fr) auto; }
.statement-calculated { display: grid; gap: 6px; min-height: 62px; align-content: center; }
.statement-calculated span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.statement-calculated strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.statement-theater-total { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.statement-theater-total strong { color: var(--text); font-variant-numeric: tabular-nums; }
.statement-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.statement-ledger-wrap { margin-top: 24px; }
.statement-ledger-wrap h3 { margin: 0 0 10px; }
.statement-ledger { min-width: 560px; }
.statement-ledger td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.statement-total-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.statement-total-row strong { font-variant-numeric: tabular-nums; }
.statement-final-total { grid-column: 1 / -1; margin-top: 8px; padding: 16px 12px; border: 1px solid var(--accent-2); border-radius: 8px; color: var(--text); font-size: 17px; }
.reconcile-status { align-self: center; font-size: 13px; font-weight: 800; }
.reconcile-status.good { color: var(--good); }
.reconcile-status.warn { color: var(--warn); }
.statement-movie-list { display: grid; gap: 8px; }
.statement-movie-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.statement-movie-link span:first-child { display: grid; gap: 4px; }
.statement-movie-link small { color: var(--muted); }
.statement-movie-link span:last-child { color: var(--accent-2); font-weight: 800; }
.statement-paper-theater, .statement-paper-expenses { min-width: 0; padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.statement-paper-theater-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.statement-paper-theater-head > div { display: flex; align-items: center; gap: 12px; }
.statement-paper-theater-head span { color: var(--accent-2); font-size: 11px; font-weight: 900; }
.statement-paper-theater-head h2 { margin: 0; font-size: 18px; }
.statement-theater-details { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.statement-inline-field { display: inline-grid; gap: 3px; min-width: 82px; vertical-align: middle; }
.statement-inline-field > small, .statement-entered-amount > small { color: var(--muted); font-size: 10px; font-weight: 800; }
.statement-inline-field input { width: 100%; min-width: 0; padding: 6px 7px; font-size: 12px; }
.statement-paper-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.statement-entry-table { width: 100%; min-width: 780px; border-collapse: collapse; table-layout: fixed; }
.statement-entry-table th, .statement-entry-table td { padding: 8px 10px; border: 1px solid var(--line); white-space: normal; vertical-align: middle; }
.statement-entry-table th { background: var(--surface-2); color: var(--text); text-align: center; }
.statement-entry-table th:first-child, .statement-entry-table td:first-child { width: 66%; text-align: left; }
.statement-entry-table th:nth-child(2), .statement-entry-table th:nth-child(3), .statement-entry-table td:nth-child(2), .statement-entry-table td:nth-child(3) { width: 17%; text-align: right; }
.statement-entry-table td.statement-money-cell { font-variant-numeric: tabular-nums; }
.statement-money-cell span { display: block; }
.statement-paper-particular { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.statement-paper-particular strong { font-size: 12px; }
.statement-action-link { min-height: 24px; padding: 2px 5px; border: 0; color: var(--accent-2); background: transparent; font-size: 11px; }
.statement-action-link:hover { text-decoration: underline; }
.statement-action-link:disabled { opacity: .45; cursor: not-allowed; text-decoration: none; }
.statement-entry-inputs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.statement-entry-inputs .statement-inline-field { flex: 0 1 105px; }
.statement-entry-inputs .statement-inline-field input { padding: 5px 6px; }
.statement-paper-particular label { margin: 0; color: var(--muted); }
.statement-paper-particular label input, .statement-type-field select { min-width: 0; padding: 5px 7px; font-size: 12px; }
.statement-entered-amount { display: grid; gap: 4px; margin: 0; }
.statement-entered-amount input { padding: 6px 7px; text-align: right; font-size: 12px; }
.statement-calc-note { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.statement-paper-tax td { color: var(--muted); font-size: 11px; }
.statement-paper-subtotal td { background: color-mix(in srgb, var(--accent-2) 8%, var(--surface)); font-weight: 800; }
.statement-paper-total td { background: var(--surface-2); font-weight: 900; }
.statement-type-field { display: inline-grid; max-width: 190px; margin: 0; font-size: 10px; }
.statement-open-link { min-height: 36px; }

.submit-layout { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 760px); gap: 18px; justify-content: center; align-items: start; }
.movie-card { padding: 16px; position: sticky; top: 86px; }
/* Portrait 9:16 poster; capped to the viewport so the sticky card stays fully visible. */
.movie-card .banner { width: min(100%, max(200px, calc((100vh - 230px) * 9 / 16))); height: auto; aspect-ratio: 9 / 16; margin: 0 auto 16px; }
.movie-card .banner span { padding: 20px; text-align: center; font-size: 32px; font-weight: 900; color: white; }
.movie-card p { color: var(--muted); line-height: 1.7; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.show-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0; }
.terms-status, .calc-box {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  align-content: center;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}
.terms-status.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 48%, var(--line)); }
.terms-status.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 48%, var(--line)); }
.calc-box span { color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 900; }
.calc-box strong { font-size: 24px; margin-top: 4px; }

.empty { max-width: 640px; margin: 50px auto; text-align: center; }
.empty p { color: var(--muted); }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  padding: 13px 15px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-weight: 800;
}
.toast.good { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); }
.toast.warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .58);
}
.modal {
  width: min(100%, 430px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.modal p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 1050px) {
  .page-grid, .submit-layout { grid-template-columns: 1fr; }
  .side-panel, .movie-card { position: static; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mapping-set-bar { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: minmax(220px, 1fr) auto auto auto; }
  .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statement-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statement-line-row, .statement-publicity-row, .statement-expenses .statement-line-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .movie-form-grid, .user-form-grid, .filters, .inline-form { grid-template-columns: 1fr; }
  .section-head { display: grid; grid-template-columns: 1fr; }
  .actions { justify-content: stretch; }
  .actions > button, .actions > .file-btn { width: 100%; }
  .inline-form > button, .inline-form > .icon-btn { width: 100%; }
  .url-cell { grid-template-columns: 1fr auto; min-width: 0; }
  .statement-toolbar { align-items: stretch; }
  .statement-toolbar > button, .statement-toolbar > a { width: 100%; }
  .statement-theater-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .topbar { align-items: stretch; flex-wrap: wrap; }
  .brand { min-width: 0; flex: 1 1 240px; }
  nav { order: 3; width: 100%; margin-left: 0; }
  nav a { flex: 1; text-align: center; }
  main { padding: 14px; }
  .panel { padding: 14px; }
  .section-head, .hero-compact { grid-template-columns: 1fr; display: grid; }
  .section-head h1 { font-size: 23px; }
  .section-head h2, .hero-compact h2 { font-size: 20px; }
  .movie-form-grid, .user-form-grid, .check-grid { grid-template-columns: 1fr; }
  .hero-compact { min-height: 0; }
  .poster { height: 190px; }
  .actions, .filters, .form-grid, .show-grid { grid-template-columns: 1fr; display: grid; }
  .mapping-set-bar, .inline-form { grid-template-columns: 1fr; }
  .url-cell { grid-template-columns: minmax(0, 1fr) auto; min-width: 0; }
  .cards { grid-template-columns: 1fr; }
  .audit-list div { grid-template-columns: 1fr; }
  .movie-card .banner { width: min(100%, 260px); }
  th, td { padding: 9px 10px; }
  td input { min-width: 110px; }
  .toast { left: 14px; right: 14px; bottom: 14px; }
  .modal-actions { display: grid; grid-template-columns: 1fr; }
  .modal-actions button { width: 100%; }
  .statement-fields, .statement-summary-grid { grid-template-columns: 1fr; }
  .statement-final-total { grid-column: auto; }
  .statement-section-heading, .statement-subhead { align-items: flex-start; }
  .statement-line-row, .statement-publicity-row, .statement-expenses .statement-line-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statement-line-row .icon-btn { justify-self: end; }
  .statement-theater-details { grid-template-columns: 1fr; }
  .statement-paper-theater-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 620px) {
  .responsive-card-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }
  .responsive-card-table thead { display: none; }
  .responsive-card-table tbody,
  .responsive-card-table tr,
  .responsive-card-table td {
    display: block;
    width: 100%;
  }
  .responsive-card-table tr {
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }
  .responsive-card-table tr:last-child { border-bottom: 0; }
  .responsive-card-table td {
    padding: 7px 0;
    border-bottom: 0;
    white-space: normal;
  }
  .responsive-card-table td:nth-child(1)::before { content: "Name"; }
  .movie-list-table td:nth-child(1)::before { content: "Movie"; }
  .movie-list-table td:nth-child(2)::before { content: "Theatre Set"; }
  .movie-list-table td:nth-child(3)::before { content: "Exact URL"; }
  .user-list-table td:nth-child(2)::before { content: "Username"; }
  .user-list-table td:nth-child(3)::before { content: "Created"; }
  .responsive-card-table td:nth-child(4)::before { content: "Actions"; }
  .responsive-card-table td::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }
  .responsive-card-table .row-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    width: 100%;
  }
  .responsive-card-table .row-actions .secondary { width: 100%; }
  .responsive-card-table .url-cell { grid-template-columns: 1fr auto; }
  #mappingTable { min-width: 680px; }
  #reportTable { min-width: 900px; }
}

/* ========================================================
   Tax Invoice Modal & Template Styles
   ======================================================== */
.modal.invoice-modal {
  width: min(96vw, 980px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.invoice-modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-subtle);
}

.invoice-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.invoice-modal-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.invoice-modal-close:hover {
  background: var(--surface);
  color: var(--text);
}

.invoice-modal-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.invoice-tab-btn {
  padding: 8px 18px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.invoice-tab-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.invoice-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.invoice-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}

.invoice-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-subtle);
  flex-wrap: wrap;
}

/* Edit Tab Form Layouts */
.invoice-form-section {
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
}

.invoice-form-section-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

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

.invoice-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.invoice-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.invoice-field input,
.invoice-field select,
.invoice-field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  box-sizing: border-box;
}

.invoice-field textarea {
  resize: vertical;
  min-height: 52px;
}

/* Particulars Table Editor */
.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.invoice-items-table th {
  background: var(--surface);
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  text-align: left;
}

.invoice-items-table td {
  padding: 6px 8px;
  border: 1px solid var(--line);
  vertical-align: middle;
}

.invoice-items-table input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  box-sizing: border-box;
}

.invoice-delete-row-btn {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.invoice-delete-row-btn:hover {
  background: rgba(239, 68, 68, 0.15);
}

.invoice-add-item-row {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
}

.invoice-calc-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.invoice-calc-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.invoice-calc-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.invoice-calc-item span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.invoice-calc-item strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.invoice-calc-words {
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ========================================================
   Tax Invoice Template Preview (Pixel-perfect A4 Replica)
   ======================================================== */
.invoice-preview-wrapper {
  display: flex;
  justify-content: center;
  background: #2a2f35;
  padding: 20px 10px;
  border-radius: 8px;
  overflow-x: auto;
}

.invoice-paper {
  width: 100%;
  max-width: 800px;
  background: #ffffff;
  color: #111111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 12px;
  line-height: 1.35;
  padding: 32px 34px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.inv-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  position: relative;
}

.inv-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin: 0;
  color: #111111;
}

.inv-header-left {
  margin-top: 32px;
  font-size: 11px;
  line-height: 1.5;
}

.inv-header-left table {
  border-collapse: collapse;
}

.inv-header-left td {
  padding: 1px 4px 1px 0;
  vertical-align: top;
  font-size: 11px;
}

.inv-irn-text {
  max-width: 440px;
  word-break: break-all;
}

.inv-header-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.inv-einvoice-badge {
  font-size: 11px;
  font-weight: 600;
  color: #333333;
}

.inv-qr-img {
  width: 95px;
  height: 95px;
  border: 1px solid #111111;
  display: block;
}

/* Main Box */
.inv-main-box {
  border: 1px solid #111111;
  display: grid;
  grid-template-columns: 62% 38%;
  margin-top: 8px;
}

.inv-seller-cell {
  padding: 10px 12px;
  border-bottom: 1px solid #111111;
  display: flex;
  gap: 12px;
}

.inv-seller-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  flex-shrink: 0;
}

.inv-seller-details strong {
  font-size: 13px;
  display: block;
  margin-bottom: 2px;
}

.inv-seller-details p {
  margin: 0;
  font-size: 11px;
  color: #222222;
}

.inv-invoice-meta {
  border-left: 1px solid #111111;
  display: flex;
  flex-direction: column;
}

.inv-meta-row {
  padding: 8px 12px;
}

.inv-meta-row:first-child {
  border-bottom: 1px solid #111111;
}

.inv-meta-label {
  font-size: 10px;
  color: #444444;
  margin-bottom: 2px;
}

.inv-meta-val {
  font-size: 12px;
  font-weight: 800;
}

.inv-buyer-cell {
  padding: 10px 12px;
  border-top: 0;
}

.inv-buyer-cell p {
  margin: 0;
  font-size: 11px;
  color: #222222;
}

.inv-buyer-cell strong {
  font-size: 12px;
  display: block;
  margin: 2px 0;
}

.inv-buyer-right-space {
  border-left: 1px solid #111111;
}

/* Particulars Table */
.inv-table {
  width: 100%;
  border-collapse: collapse;
  border-left: 1px solid #111111;
  border-right: 1px solid #111111;
  border-bottom: 1px solid #111111;
}

.inv-table th {
  border-top: 1px solid #111111;
  border-bottom: 1px solid #111111;
  border-right: 1px solid #111111;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 800;
  background: #ffffff;
  color: #111111;
}
.inv-table th:last-child {
  border-right: 0;
}

.inv-table td {
  border-right: 1px solid #111111;
  padding: 5px 10px;
  font-size: 11px;
  vertical-align: top;
  color: #111111;
}
.inv-table td:last-child {
  border-right: 0;
}

.inv-particulars-body {
  min-height: 170px;
}

.inv-tax-inline-row td {
  padding-top: 3px;
  padding-bottom: 3px;
}

.inv-total-row td {
  border-top: 1px solid #111111;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
}

/* Words Box */
.inv-words-box {
  border-left: 1px solid #111111;
  border-right: 1px solid #111111;
  border-bottom: 1px solid #111111;
  padding: 6px 10px;
}

.inv-words-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #333333;
}

.inv-words-val {
  font-size: 11px;
  font-weight: 800;
  margin-top: 4px;
}

/* Tax Breakup Table */
.inv-tax-table {
  width: 100%;
  border-collapse: collapse;
  border-left: 1px solid #111111;
  border-right: 1px solid #111111;
  border-bottom: 1px solid #111111;
  font-size: 11px;
}

.inv-tax-table th,
.inv-tax-table td {
  border: 1px solid #111111;
  padding: 4px 6px;
  font-size: 10.5px;
  text-align: center;
}

.inv-tax-table .text-right {
  text-align: right;
}

.inv-tax-words-box {
  border-left: 1px solid #111111;
  border-right: 1px solid #111111;
  border-bottom: 1px solid #111111;
  padding: 6px 10px;
  font-size: 11px;
}

/* Bottom Box */
.inv-bottom-box {
  border-left: 1px solid #111111;
  border-right: 1px solid #111111;
  border-bottom: 1px solid #111111;
  display: grid;
  grid-template-columns: 28% 42% 30%;
  padding: 10px 12px;
  min-height: 90px;
  align-items: flex-start;
}

.inv-pan-col {
  font-size: 11px;
}

.inv-bank-col {
  font-size: 10.5px;
  line-height: 1.45;
}

.inv-bank-col strong {
  display: block;
  font-size: 11px;
  margin-bottom: 4px;
}

.inv-sign-col {
  border-left: 1px solid #111111;
  padding-left: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 90px;
}

.inv-sign-col .inv-for-comp {
  font-size: 11px;
  font-weight: 800;
}

.inv-sign-col .inv-sign-title {
  font-size: 10.5px;
}

.inv-footer-line {
  text-align: center;
  font-size: 10.5px;
  color: #333333;
  margin-top: 14px;
}

@media print {
  body * {
    visibility: hidden;
  }
  .invoice-paper, .invoice-paper * {
    visibility: visible;
  }
  .invoice-paper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    box-shadow: none !important;
  }
  @page {
    size: A4 portrait;
    margin: 10mm;
  }
}


/* min-width/table-layout override the global 720px table minimum so the preview fits its dialog. */
.submission-preview { width: 100%; min-width: 0; table-layout: fixed; margin: 0 0 18px; border-collapse: collapse; font-size: 14px; }
.submission-preview th, .submission-preview td { padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: normal; background: transparent; }
.submission-preview th { width: 45%; color: var(--muted); font-weight: 600; font-size: 13px; text-transform: none; letter-spacing: 0; text-align: left; }
.submission-preview td { text-align: right; font-weight: 700; overflow-wrap: anywhere; }
.submission-preview tr.total td { font-size: 15px; }
.submission-preview tr.share th, .submission-preview tr.share td { color: var(--accent-2); font-size: 16px; font-weight: 800; }
.modal:has(.submission-preview) { width: min(100%, 520px); max-height: 92vh; overflow-x: hidden; overflow-y: auto; }

/* Image upload with preview */
.image-field { display: grid; gap: 7px; }
.image-drop {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1.5px dashed color-mix(in srgb, var(--muted) 45%, var(--line));
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.image-drop:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface-2)); }
.image-drop:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.image-field-banner .image-drop { width: 220px; max-width: 100%; aspect-ratio: 9 / 16; }
.image-field-logo .image-drop { width: 160px; aspect-ratio: 1; }
.image-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.image-preview { width: 100%; height: 100%; object-fit: cover; }
.image-field-logo .image-preview { object-fit: contain; padding: 10px; background: #fff; }
.image-placeholder { display: grid; justify-items: center; gap: 6px; padding: 16px; text-align: center; color: var(--muted); }
.image-placeholder svg { width: 34px; height: 34px; stroke-width: 1.5; color: var(--accent); }
.image-placeholder strong { color: var(--text); font-size: 14px; }
.image-placeholder small { font-weight: 500; }
.image-change {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 20px);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 20, 26, .78);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.image-change svg { width: 14px; height: 14px; }
.image-drop:not(.has-image) .image-change { display: none; }
.image-field-logo .image-change { left: 8px; right: 8px; bottom: 8px; justify-content: center; }

/* Professional polish: calmer type weights, softer surfaces, consistent controls */
label { font-weight: 600; }
input, select, textarea { font-weight: 500; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); font-weight: 400; }
.panel { padding: 22px; border-radius: 10px; }
.section-head h1 { font-size: 24px; }
.section-head h2 { font-size: 19px; }
.eyebrow { font-size: 11px; letter-spacing: .08em; font-weight: 700; }
.cards { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.metric { border-radius: 10px; box-shadow: var(--shadow); border-top: 3px solid var(--accent); }
.metric span { font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .06em; }
.table-wrap { border-radius: 10px; }
th { font-weight: 600; font-size: 11px; letter-spacing: .06em; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
td small { font-weight: 500; }
tfoot td { font-weight: 700; }
.statement-open-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
}
.statement-open-link:hover { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line)); }
.user-access { border-radius: 10px; padding: 14px 16px 16px; }
.user-access legend { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.check-row { font-weight: 500; color: var(--text); }
.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }

.side-nav { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.nav-item { min-height: 38px; }
.company-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.company-form-grid label:has(textarea) { grid-column: 1 / -1; }
.company-form-grid > button { grid-column: 1 / -1; justify-self: start; min-width: 200px; }
.movie-form-grid > button { grid-column: 1 / -1; justify-self: start; min-width: 200px; }
.file-btn { font-size: inherit; }
.mapping-set-bar + .user-access { margin-top: 16px; }
@media (max-width: 720px) {
  .company-form-grid { grid-template-columns: 1fr; }
  .company-form-grid > button, .movie-form-grid > button { width: 100%; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: nowrap; align-items: center; gap: 10px; min-height: 60px; }
  .brand { flex: 1 1 auto; min-width: 0; gap: 8px; }
  .brand-logo { width: 40px; height: 32px; }
  .brand > span { min-width: 0; }
  .brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
  .brand small { display: none; }
  .topbar-actions { gap: 6px; }
  #logoutBtn { width: 40px; padding: 0; }
  #logoutBtn .btn-label { display: none; }
}
input[readonly], textarea[readonly] { background: transparent; border-style: dashed; color: var(--muted); }
.image-drop [hidden] { display: none !important; }
.image-drop > .image-preview, .image-drop > .image-placeholder { grid-area: 1 / 1; }
.image-drop > .image-preview { position: absolute; inset: 0; }

/* Roles */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.role-badge.main { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent); }
.tab-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tab-chip {
  padding: 3px 9px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
td.wrap-cell { white-space: normal; min-width: 260px; }
.panel-note { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.permission-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.permission-group { display: grid; gap: 8px; align-content: start; }
.permission-group .nav-group-title { padding: 0; }
.permission-group .check-row svg { width: 16px; height: 16px; color: var(--muted); }
@media (max-width: 900px) { .permission-groups { grid-template-columns: 1fr; } }

.report-panel .filters { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.report-panel .filters .search-field { grid-column: span 2; }
@media (max-width: 720px) { .report-panel .filters .search-field { grid-column: auto; } }

/* Landing page */
.btn-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-link.primary:hover { filter: brightness(1.1); }
.btn-link.secondary:hover { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line)); }
.login-home { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; color: var(--muted); font-size: 14px; font-weight: 600; }
.login-home:hover { color: var(--text); }

.landing-nav { margin: 0 auto; }
.landing { width: min(100%, 1180px); margin: 0 auto; display: grid; gap: clamp(48px, 8vw, 96px); padding-bottom: 64px; }
.landing h1, .landing h2, .landing h3 { margin: 0; letter-spacing: 0; }
.landing-lead { color: var(--muted); font-size: 17px; line-height: 1.7; margin: 16px 0 0; max-width: 60ch; }

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  padding-top: clamp(16px, 5vw, 56px);
}
.landing-hero h1 { font-size: clamp(34px, 5.5vw, 58px); line-height: 1.08; }
.landing-hero h1 span { color: #e0393f; }
:root[data-theme="light"] .landing-hero h1 span { color: #bd171d; }
.landing-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.landing-hero-card { display: grid; gap: 14px; padding: 24px; }
.landing-stat { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.landing-stat span { color: var(--muted); font-size: 14px; font-weight: 600; }
.landing-stat strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.landing-bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 6px; }
.landing-bars i { flex: 1; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--accent) 70%, transparent); }
.landing-bars i:last-child { background: var(--accent-2); }

.landing-section { scroll-margin-top: 90px; }
.landing-section-head { margin-bottom: 24px; }
.landing-section h2 { font-size: clamp(26px, 3.5vw, 36px); }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature-card { display: grid; gap: 10px; align-content: start; padding: 22px; }
.feature-card h3 { font-size: 18px; }
.feature-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.feature-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.feature-icon svg { width: 22px; height: 22px; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.steps li { counter-increment: step; display: grid; gap: 6px; padding: 22px; border-top: 3px solid var(--accent); background: var(--surface); border-radius: 0 0 8px 8px; }
.steps li::before { content: counter(step, decimal-leading-zero); color: var(--accent-2); font-weight: 800; font-size: 14px; }
.steps strong { font-size: 18px; }
.steps span { color: var(--muted); line-height: 1.6; }

.contact-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(24px, 5vw, 56px); align-items: start; }
.contact-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 24px; }
.contact-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 600;
}
.contact-link:hover { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line)); }
.contact-link svg { width: 22px; height: 22px; color: var(--accent); }
.contact-link span { min-width: 0; overflow-wrap: anywhere; }
.contact-link small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.contact-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 22px; }
.contact-message, .contact-actions { grid-column: 1 / -1; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.contact-actions button { flex: 1 1 180px; }

.landing-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px clamp(16px, 3vw, 34px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.landing-footer-links { display: flex; gap: 14px; }
.landing-footer-links a:hover { color: var(--text); }

@media (max-width: 900px) {
  .landing-hero, .contact-section { grid-template-columns: minmax(0, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .landing-nav { display: none; }
  .landing-topbar .topbar-actions { margin-left: auto; }
}
@media (max-width: 620px) {
  .landing-topbar .brand { min-width: 0; }
  .landing-topbar .brand small { display: none; }
  .landing-topbar .btn-label { display: none; }
  .feature-grid, .contact-links, .contact-form { grid-template-columns: minmax(0, 1fr); }
}
.field-hint { color: var(--muted); font-size: 12px; font-weight: 600; }

/* Dashboard charts. Series color is validated for both themes (slot 1, blue). */
:root { --series-1: #3987e5; }
:root[data-theme="light"] { --series-1: #2a78d6; }
.dash-range-label { margin: 6px 0 0; color: var(--muted); font-weight: 600; }
/* One row on desktop: movie and area shrink first, dates and quick-range buttons keep their size. */
.dash-filters { display: flex; flex-wrap: nowrap; align-items: end; gap: 12px; margin-bottom: 0; }
.dash-filters > label { flex: 1 1 180px; min-width: 0; }
.dash-filters > label:has(.dash-range-input) { flex: 0 0 150px; }
.dash-presets { display: flex; flex-wrap: nowrap; gap: 6px; flex: 0 0 auto; }
.dash-presets button { white-space: nowrap; }
.dash-presets .active { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: var(--accent); color: var(--accent); }
.dash-cards { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.dash-cards .metric { grid-column: span 3; }
.dash-cards .metric:nth-child(n + 5) { grid-column: span 4; }
.dash-grid { display: grid; gap: 18px; }
.chart-card { min-width: 0; }
.chart-head { margin-bottom: 12px; }
.chart-head h2 { margin: 0; font-size: 18px; }
.chart-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.chart { position: relative; width: 100%; min-height: 230px; }
.chart svg { display: block; width: 100%; height: 230px; overflow: visible; stroke: none; stroke-width: 0; fill: none; }
.chart-grid, .chart-baseline { stroke: var(--line); stroke-width: 1; }
.chart-baseline { stroke: color-mix(in srgb, var(--muted) 45%, var(--line)); }
.chart-axis { fill: var(--muted); font-size: 11px; font-weight: 600; }
.chart-value { fill: var(--text); font-size: 12px; font-weight: 700; }
.chart-bar { fill: var(--series-1); stroke: none; transition: opacity .12s; }
.chart-bar.dim { opacity: .4; }
.chart-hit { fill: transparent; stroke: none; cursor: crosshair; outline: none; }
.chart-hit:focus-visible { fill: color-mix(in srgb, var(--text) 6%, transparent); }
.chart-tip {
  position: absolute;
  z-index: 5;
  min-width: 150px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 13px;
}
.chart-tip[hidden] { display: none; }
.chart-tip-title { color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.chart-tip div:not(.chart-tip-title) { display: flex; justify-content: space-between; gap: 14px; }
.chart-tip div span { color: var(--muted); order: -1; }
.chart-empty { padding: 32px 0; text-align: center; }
.chart-table { margin-top: 12px; }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 700; }
.chart-table .table-wrap { margin-top: 10px; }
.chart-card > .table-wrap { margin-top: 14px; }

.rank-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank-bars li { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.rank-name { min-width: 0; }
.rank-name strong, .rank-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name small { color: var(--muted); font-size: 12px; font-weight: 600; }
.rank-track { height: 12px; background: var(--surface-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.rank-track i { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.rank-value { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; }

@media (max-width: 900px) {
  .dash-filters { flex-wrap: wrap; }
  .dash-filters > label, .dash-filters > label:has(.dash-range-input) { flex: 1 1 calc(50% - 6px); }
  .dash-presets { flex: 1 1 100%; flex-wrap: wrap; }
}
@media (max-width: 620px) {
  .rank-bars li { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .rank-track { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 900px) {
  .dash-cards .metric, .dash-cards .metric:nth-child(n + 5) { grid-column: span 6; }
  .dash-cards .metric:last-child { grid-column: 1 / -1; }
}
