/* Layout: a narrow site bar, then a two-column worksheet (inputs left, broker-bill style result right)
   that stacks to one column on phones. Numbers are set in tabular figures so rupee columns line up. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #142231;
  --muted: #5a6876;
  --line: #dce2e8;
  --chip: #edf1f5;
  --accent: #1d4e89;
  --accent-ink: #ffffff;
  --gain: #12704f;
  --loss: #b42318;
  --display: "Bricolage Grotesque", "Public Sans", system-ui, sans-serif;
  --body: "Public Sans", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif;
  --deva: "Noto Sans Devanagari", "Public Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e141a; --surface: #151d26; --ink: #e6ebf0; --muted: #98a5b2; --line: #26313d; --chip: #1c2631;
    --accent: #7fb0ef; --accent-ink: #0e141a; --gain: #4cc79a; --loss: #ff8f80; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e141a; --surface: #151d26; --ink: #e6ebf0; --muted: #98a5b2; --line: #26313d; --chip: #1c2631;
  --accent: #7fb0ef; --accent-ink: #0e141a; --gain: #4cc79a; --loss: #ff8f80; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
.wrap { max-width: 1040px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.bar { border-bottom: 1px solid var(--line); background: var(--surface); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.brand { font: 700 20px/1 var(--display); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.nav a[aria-current="page"] { color: var(--ink); background: var(--chip); }

main { padding-block: 28px 48px; }
h1 { font: 700 clamp(28px, 4vw, 38px)/1.1 var(--display); margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
.np { font-family: var(--deva); color: var(--muted); font-weight: 500; }
h1 + .np { display: block; margin-top: 6px; font-size: 17px; }
.intro { color: var(--muted); max-width: 62ch; margin: 12px 0 0; }

.sheet { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; margin-top: 24px; align-items: start; }
@media (max-width: 820px) { .sheet { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0; }
.panel h2 { font: 700 15px/1.2 var(--body); margin: 0 0 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .legend { font-weight: 600; font-size: 15px; }
.field label .np, .legend .np { font-size: 13px; margin-left: 6px; }
.hint { font-size: 13px; color: var(--muted); }
input[type="number"], input[type="text"], select {
  font: 500 17px/1.2 var(--body); font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; width: 100%; min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--chip); padding: 4px; border-radius: 12px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { text-align: center; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg input:checked + label { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg input:focus-visible + label { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); }

.headline { display: flex; flex-direction: column; gap: 2px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.headline .label { font-weight: 600; color: var(--muted); font-size: 14px; }
.big { font: 700 clamp(30px, 5vw, 42px)/1.1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding-block: 16px; border-bottom: 1px solid var(--line); }
.stat small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; }

.bill { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
.bill caption { text-align: left; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 16px 0 6px; }
.bill td { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.bill td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; }
.bill tr.total td { border-bottom: 0; font-weight: 700; padding-top: 8px; }
.bill .muted { color: var(--muted); font-size: 13px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn { font: 600 15px/1 var(--body); border-radius: 10px; padding: 11px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 8px 12px; font-size: 14px; }
#shareText { width: 100%; margin-top: 10px; font-size: 14px; }

.example { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); background: var(--chip); padding: 3px 8px; border-radius: 6px; }

.lots { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lots th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0 6px 8px 0; font-weight: 700; }
.lots td { padding: 4px 6px 4px 0; vertical-align: middle; }
.lots td.avg { text-align: right; white-space: nowrap; color: var(--muted); font-size: 14px; }
.lots input, .lots select { padding: 9px 8px; font-size: 15px; }
.lots select { min-width: 7.2em; }
.lots input { min-width: 4.5em; }
@media (max-width: 480px) {
  .panel { padding: 16px 12px; }
  .lots td { padding-right: 4px; }
  .lots select { min-width: 0; width: 5.9em; padding: 8px 4px; font-size: 14px; }
  .lots input { min-width: 0; width: 3.9em; padding: 8px 5px; font-size: 14px; }
  .lots td.avg { font-size: 12px; }
  .lots .rm { padding: 4px 2px; }
}
.lots .rm { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 6px; border-radius: 8px; }
.scroll { overflow-x: auto; }
.warn { color: var(--loss); font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 24px; }
.card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.card:hover { border-color: var(--accent); }
.card h2 { font: 700 21px/1.2 var(--display); margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .go { margin-top: auto; font-weight: 700; color: var(--accent); }

.rates { margin-top: 28px; font-size: 14px; color: var(--muted); max-width: 72ch; }
.rates h2 { font: 700 15px/1.2 var(--body); color: var(--ink); margin: 0 0 8px; }
.rates ul { margin: 6px 0 0; padding-left: 18px; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer .wrap { padding-block: 18px 28px; }
