:root {
  color-scheme: light;
  --bg: #f5f3ef;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --line: #e7e2da;
  --text: #1d1a17;
  --text-2: #5d5750;
  --muted: #8b847b;
  --brand: #b3122a;
  --brand-ink: #ffffff;
  --brand-dark: #5a0b16;
  --gold: #e8b04b;
  --s1: #2a78d6;   /* tickets */
  --s2: #eb6834;   /* canteen */
  --s3: #1baf7a;   /* profit */
  --s7: #6250d6;
  --good: #0a7d0a;
  --good-bg: #e6f4e6;
  --bad: #c22f2f;
  --bad-bg: #fbe9e9;
  --warn-bg: #fff4dc;
  --warn: #8a5a00;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 20, 10, .05), 0 4px 16px rgba(30, 20, 10, .05);
  --font: Inter, "Noto Sans Gujarati", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141212; --surface: #1d1b1a; --surface-2: #232120; --line: #34312e;
    --text: #f1eee9; --text-2: #c4beb5; --muted: #8f8880;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s7: #9085e9;
    --good: #3cc23c; --good-bg: #16301a; --bad: #ef6b6b; --bad-bg: #3a1a1a; --warn-bg: #3a2e12; --warn: #f2c25c;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141212; --surface: #1d1b1a; --surface-2: #232120; --line: #34312e;
  --text: #f1eee9; --text-2: #c4beb5; --muted: #8f8880;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s7: #9085e9;
  --good: #3cc23c; --good-bg: #16301a; --bad: #ef6b6b; --bad-bg: #3a1a1a; --warn-bg: #3a2e12; --warn: #f2c25c;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.gu { font-family: "Noto Sans Gujarati", var(--font); }
[hidden] { display: none !important; }

/* ---------- login / landing ---------- */
.landing { min-height: 100vh; display: grid; grid-template-columns: 1.2fr 1fr; background: #150507; color: #fff; }
.hero { position: relative; overflow: hidden; padding: 48px clamp(24px, 5vw, 72px); display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at 20% 0%, #7a0f1d 0%, transparent 60%), radial-gradient(800px 500px at 100% 100%, #4a0812 0%, transparent 60%), #150507; }
.hero::after { content: ""; position: absolute; inset: auto -10% -40% -10%; height: 60%; background: radial-gradient(closest-side, rgba(232, 176, 75, .18), transparent); pointer-events: none; }
.marquee { display: flex; gap: 10px; }
.marquee i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); animation: blink 1.6s infinite; }
.marquee i:nth-child(2n) { animation-delay: .8s; }
@keyframes blink { 50% { opacity: .25; box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .marquee i { animation: none; } }
.hero h1 { font-family: "Playfair Display", Georgia, serif; font-size: clamp(40px, 6vw, 72px); line-height: 1.02; margin: 24px 0 8px; letter-spacing: -.01em; }
.hero h1 span { color: var(--gold); }
.hero .gu-title { font-size: clamp(22px, 3vw, 32px); font-weight: 700; color: #ffd9de; margin: 0 0 24px; }
.hero p.lead { max-width: 520px; color: #e9d4d6; font-size: 16px; }
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 560px; margin-top: 36px; position: relative; z-index: 1; }
.feature { border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .04); border-radius: 12px; padding: 14px 16px; }
.feature b { display: block; font-size: 14px; margin-bottom: 2px; }
.feature span { color: #d6bfc2; font-size: 13px; }
.hero small.foot { color: #a4888c; margin-top: 32px; position: relative; z-index: 1; }
.login-side { display: grid; place-items: center; padding: 32px 16px; background: #fbf8f4; color: #1d1a17; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 26px; margin: 0 0 4px; }
.login-card p { color: #6a625a; margin: 0 0 24px; }
.login-card label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
.login-card input { width: 100%; padding: 12px 14px; border: 1px solid #ddd5cb; border-radius: 10px; background: #fff; color: #1d1a17; }
.login-card input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.login-card .btn { width: 100%; margin-top: 22px; padding: 12px; }
.login-err { color: #c22f2f; min-height: 20px; margin-top: 10px; font-size: 13px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: linear-gradient(180deg, #2a070d, #150507); color: #f4e6e8; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; font-family: "Playfair Display", serif; font-weight: 800; font-size: 20px; color: #fff; box-shadow: 0 0 0 3px rgba(232, 176, 75, .35); }
.brand b { display: block; font-size: 15px; line-height: 1.2; }
.brand small { color: #c9a9ae; font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: #e6cfd2; font-weight: 500; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.on { background: var(--brand); color: #fff; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 13px; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-foot .role { color: #c9a9ae; text-transform: capitalize; }
.side-foot button { margin-top: 10px; background: transparent; border: 1px solid rgba(255, 255, 255, .2); color: #f4e6e8; border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.main { padding: 24px clamp(16px, 3vw, 36px) 64px; min-width: 0; }
.topbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.topbar .sub { color: var(--text-2); margin-top: 2px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 10px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.pills { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.pills button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; color: var(--text-2); }
.pills button.on { background: var(--text); color: var(--bg); }
.input, .tools input, .tools select, td input, td select, .form input, .form select, .form textarea {
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 7px 10px; min-width: 0; }
.input:focus, input:focus, select:focus, textarea:focus { outline: 2px solid var(--s1); outline-offset: 0; border-color: transparent; }
.datenav { display: inline-flex; align-items: center; gap: 4px; }
.datenav input { width: 150px; }
.icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; display: inline-grid; place-items: center; }

/* ---------- cards & grid ---------- */
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card h3 { margin: 0 0 2px; font-size: 15px; }
.card .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.section { margin-top: 16px; }
.kpi { padding: 16px 18px; }
.kpi .lab { color: var(--text-2); font-size: 13px; font-weight: 500; }
.kpi .val { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi .delta b.up { color: var(--good); } .kpi .delta b.down { color: var(--bad); }
.kpi.hero-kpi { background: linear-gradient(135deg, #5a0b16, #b3122a); color: #fff; border: 0; }
.kpi.hero-kpi .lab, .kpi.hero-kpi .delta { color: #f6d7db; }
.kpi.hero-kpi .delta b.up, .kpi.hero-kpi .delta b.down { color: #fff; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.mute { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.banner { border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; }
.banner a { font-weight: 600; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; background: var(--surface-2); }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl td input { width: 84px; text-align: right; padding: 6px 8px; }
.tbl td input.wide { width: 100%; text-align: left; }
.tbl .name small { display: block; color: var(--muted); font-size: 12px; }
.occ { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.occ .bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.occ .bar i { display: block; height: 100%; background: var(--s1); border-radius: 4px; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.muted { color: var(--muted); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* canteen sheet */
.sheet-totals { display: grid; gap: 8px; }
.sheet-totals .line { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.sheet-totals .line.big { font-size: 18px; font-weight: 700; border-bottom: 0; padding-top: 10px; }
.cash-grid td input { width: 70px; }
.exp-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px 34px; gap: 6px; margin-bottom: 6px; }
.exp-row input { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 7px 10px; min-width: 0; }
.exp-row input.amt { text-align: right; }

/* ---------- charts ---------- */
.ch { position: relative; width: 100%; }
.ch svg { display: block; width: 100%; height: auto; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-zero { stroke: var(--muted); stroke-width: 1; }
.ch-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ch-cross { stroke: var(--muted); stroke-dasharray: 3 3; }
.ch-hover { fill: var(--text); fill-opacity: .05; }
.ch-empty { padding: 48px 0; text-align: center; color: var(--muted); }
.ch-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.ch-legend i, .ch-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ch-tip { position: absolute; display: none; pointer-events: none; z-index: 5; background: var(--text); color: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; min-width: 140px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.ch-tip div { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.ch-tip b { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.ch-tip-t { font-weight: 700; margin-bottom: 4px; }
.ch-tip-x { opacity: .8; margin-top: 4px; }
.hb-row { display: grid; grid-template-columns: minmax(90px, 150px) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; }
.hb-label { font-size: 13px; line-height: 1.25; }
.hb-label small, .hb-val small { display: block; color: var(--muted); font-size: 11.5px; }
.hb-track { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.hb-bar { height: 100%; border-radius: 0 4px 4px 0; }
.hb-val { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }

/* P&L statement */
.stmt .line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; gap: 10px; }
.stmt .line.indent { padding-left: 14px; color: var(--text-2); }
.stmt .line.total { font-weight: 700; font-size: 16px; border-bottom: 0; padding-top: 12px; }

/* modal / toast */
.modal { position: fixed; inset: 0; background: rgba(15, 8, 8, .5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-card { background: var(--surface); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal-card h3 { margin: 0 0 14px; font-size: 18px; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form textarea { min-height: 140px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.form-err { color: var(--bad); font-size: 13px; min-height: 18px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; opacity: 0; transition: .2s; pointer-events: none; z-index: 60; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--bad); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g-3-1 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .landing { grid-template-columns: 1fr; }
  .hero { padding-bottom: 32px; }
  .features { grid-template-columns: 1fr 1fr; }
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 8px 10px; gap: 8px; overflow-x: auto; }
  .brand { padding: 0 6px 0 0; } .brand div { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { padding: 8px 10px; white-space: nowrap; font-size: 13px; }
  .nav a svg { display: none; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; }
  .side-foot .who, .side-foot .role { display: none; }
  .side-foot button { margin: 0; white-space: nowrap; }
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 18px 16px 48px; }
}
@media (max-width: 520px) {
  .features { grid-template-columns: 1fr; }
  .g-kpi { grid-template-columns: 1fr 1fr; }
  .kpi .val { font-size: 21px; }
  .form .two { grid-template-columns: 1fr; }
}
@media print {
  .side, .tools, .btn, .row-actions { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* table polish */
.tbl td { white-space: nowrap; }
.tbl td.name { white-space: normal; min-width: 150px; }
.tbl th .gu { display: block; font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.tbl th.r .gu { text-align: right; }
#sheet td input { width: 68px; }

/* photo import */
.photo-drop { display: grid; place-items: center; min-height: 160px; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; background: var(--surface-2); font-weight: 600; color: var(--text-2); overflow: hidden; }
.photo-drop:hover { border-color: var(--brand); color: var(--brand); }
.photo-drop img { max-width: 100%; max-height: 260px; display: block; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-card.wide { max-width: 980px; }
.tbl.review td input { width: 86px; }
.tbl.review td input[data-f=movie] { width: 190px; text-align: left; }
.tbl.review td input[data-f=screen] { width: 96px; text-align: left; }
.tbl.review td input[data-f=time] { width: 110px; text-align: left; }
.banner ul { margin: 6px 0 0; padding-left: 18px; }
.photo-banner { background: #e8f0fc; color: #1c3f73; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .photo-banner { background: #18273d; color: #b9d2f5; } }
:root[data-theme="dark"] .photo-banner { background: #18273d; color: #b9d2f5; }
tr.from-photo td { background: #f1f6fd; }
tr.from-photo td:first-child { box-shadow: inset 3px 0 0 var(--s1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) tr.from-photo td { background: #18212e; } }
:root[data-theme="dark"] tr.from-photo td { background: #18212e; }

/* box office show sheet */
#boSheet td input { width: 80px; }
#boSheet td input[data-f=time] { width: 120px; text-align: left; }
#boSheet td input[data-f=movie] { width: 200px; text-align: left; }
#boSheet td input[data-f=gross], #boSheet td input[data-f=net] { width: 100px; }
#boSheet td select { min-width: 110px; }

/* sidebar footer buttons */
.side-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.side-btns button, .side-btns a { margin: 0; background: transparent; border: 1px solid rgba(255, 255, 255, .2); color: #f4e6e8; border-radius: 8px; padding: 6px 12px; cursor: pointer; text-decoration: none; font-size: 13px; }
.side-btns #installApp { background: var(--gold); color: #2a070d; border-color: var(--gold); font-weight: 600; }
@media (max-width: 860px) { .side-btns { margin: 0; flex-wrap: nowrap; } .side-btns a, .side-btns button { white-space: nowrap; } }
