/* ============================================================================
   GST Rate Finder — styles.  Brand: deep purple #3D2B7A, vibrant #6B4ECC,
   lavender #C9BFFF, Inter typeface. Clean, modern, responsive, read-only.
   ============================================================================ */
:root {
  --deep:      #3D2B7A;
  --vibrant:   #6B4ECC;
  --lavender:  #C9BFFF;
  --lav-soft:  #F1EEFF;
  --ink:       #1c1830;
  --muted:     #6b6785;
  --line:      #e7e3f5;
  --white:     #ffffff;
  --goods:     #2563a8;   /* blue-ish badge for goods */
  --service:   #0f7a5a;   /* green-ish badge for services */
  --warn-bg:   #fff6e6;
  --warn-line: #f0c98a;
  --radius:    14px;
  --shadow:    0 6px 24px rgba(61, 43, 122, 0.10);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, var(--lav-soft) 0%, #ffffff 340px);
  min-height: 100vh;
  line-height: 1.5;
}

/* ---------- header ---------- */
.site-header {
  background: linear-gradient(120deg, var(--deep), var(--vibrant));
  color: var(--white);
  padding: 22px clamp(16px, 4vw, 48px);
  display: flex; flex-wrap: wrap; gap: 16px;
  align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: rgba(255,255,255,.16); backdrop-filter: blur(4px);
  display: grid; place-items: center; font-size: 24px; font-weight: 700;
}
.site-header h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.tagline { margin: 2px 0 0; font-size: .9rem; opacity: .85; }
.asof { text-align: right; max-width: 340px; }
.asof-badge {
  display: inline-block; background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  padding: 5px 14px; font-weight: 600; font-size: .9rem;
}
.disclaimer { margin: 6px 0 0; font-size: .74rem; opacity: .8; }

/* ---------- layout ---------- */
main { max-width: 940px; margin: 0 auto; padding: clamp(16px, 3vw, 32px); }

/* single search box + results beneath */
.search-hero { margin-bottom: 20px; }
.search-input.big { font-size: 1.12rem; padding: 16px 20px; box-shadow: var(--shadow);
                    border-color: var(--lavender); }
.search-hero .hint { margin: 9px 2px 0; }
#results.standalone { margin-top: 14px; }
.browse-panel { margin-top: 20px; }
.browse-panel h2 { margin-top: 0; }

.panel {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; position: relative;
}
.panel h2 { margin: 0 0 12px; font-size: 1.02rem; color: var(--deep); }

/* ---------- inputs ---------- */
.search-input {
  width: 100%; padding: 13px 16px; font-size: 1rem;
  border: 2px solid var(--line); border-radius: 11px; outline: none;
  transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
.search-input:focus { border-color: var(--vibrant); box-shadow: 0 0 0 4px rgba(107,78,204,.14); }
.hint { color: var(--muted); font-size: .8rem; margin: 8px 2px 0; }

/* ---------- suggestion / result lists ---------- */
.suggest-list { list-style: none; margin: 6px 0 0; padding: 0; }
.suggest-list.standalone { margin-top: 12px; }
.suggest-list li {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 9px 12px; border: 1px solid var(--line); border-top: none; cursor: pointer;
  background: var(--white);
}
.suggest-list li:first-child { border-top: 1px solid var(--line); border-radius: 9px 9px 0 0; }
.suggest-list li:last-child { border-radius: 0 0 9px 9px; }
.suggest-list li:hover { background: var(--lav-soft); }
.s-left { flex: 1 1 auto; min-width: 0; }
.s-code { display: block; font-weight: 700; color: var(--deep); font-variant-numeric: tabular-nums; }
.s-desc { display: block; color: var(--muted); font-size: .84rem; overflow: hidden;
          text-overflow: ellipsis; white-space: nowrap; }
.s-rate { flex: 0 0 auto; max-width: 42%; font-weight: 600; font-size: .82rem; color: var(--ink);
          text-align: right; }
.s-rate.multi { color: var(--vibrant); }

/* ---------- search match cards (accordion) ---------- */
.suggest-list li.match-card {
  display: block; padding: 0; cursor: default; background: var(--white);
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden;
}
.suggest-list li.match-card:first-child { border-radius: 12px; }
.suggest-list li.match-card:hover { background: var(--white); }
.match-card.open { border-color: var(--lavender); box-shadow: var(--shadow); }
.mc-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; cursor: pointer; }
.mc-head:hover { background: var(--lav-soft); }
.mc-main { flex: 1 1 auto; min-width: 0; }
.mc-code-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mc-desc { margin-top: 3px; color: var(--ink); font-weight: 600; font-size: .95rem; }
.mc-why { margin-top: 3px; color: var(--vibrant); font-size: .76rem; }
.mc-side { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.mc-toggle { color: var(--lavender); font-size: 1rem; width: 1em; text-align: center; }
.also { font-size: .72rem; color: var(--muted); background: var(--lav-soft);
        border: 1px solid var(--line); padding: 1px 7px; border-radius: 999px; }
.mc-body { padding: 0 14px 14px; }
.headline .entry-label { margin: 0 0 8px; font-weight: 600; color: var(--deep); font-size: .9rem; }

/* other rate entries under a code */
.other-entries { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.other-entries > summary { cursor: pointer; color: var(--muted); font-size: .84rem; font-weight: 600; }
.other-entries > summary:hover { color: var(--deep); }
.oe-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.oe-item { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.oe-head { display: flex; align-items: baseline; gap: 10px; padding: 8px 11px; cursor: pointer; }
.oe-head:hover { background: var(--lav-soft); }
.oe-rate { flex: 0 0 auto; font-weight: 700; color: var(--deep); font-variant-numeric: tabular-nums; min-width: 64px; }
.oe-desc { flex: 1; color: var(--ink); font-size: .86rem; }
.oe-detail { padding: 0 11px 11px; }
/* ---------- exemptions: an exempt supply is NOT a 0% rate (no GST, no ITC) — SPEC §2.4 / §4.4 ---- */
/* the "Exempt" tag shown in an entry line instead of a percentage */
.oe-rate.exempt-rate { color: var(--service); min-width: 64px; }
.oe-item.exempt { border-color: #cdeadd; background: #fafffc; }
/* the expanded "Exempt — no GST" card (replaces the CGST/SGST/Total panel for exemptions) */
.exempt-card { margin-top: 12px; border: 1px solid #bfe6d4; border-radius: 12px; overflow: hidden;
               background: #f4fbf7; }
.exempt-card .ex-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px;
                        padding: 12px 16px; background: #eafaf3; border-bottom: 1px solid #cdeadd; }
.ex-badge { font-size: .82rem; font-weight: 800; color: #fff; background: var(--service);
            padding: 3px 12px; border-radius: 999px; }
.ex-line { color: #0c6349; font-size: .86rem; font-weight: 600; }
.ex-cond { margin: 12px 16px 0; color: var(--ink); }
.exempt-card .rc-foot { border-top: none; background: transparent; }
/* the "Exemptions" category block, kept below the taxable bands */
.exemptions-cat { margin-top: 18px; border-top: 2px solid #cdeadd; padding-top: 12px; }
.exemptions-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 8px; }
.ex-cat-badge { font-size: .82rem; font-weight: 800; color: #fff; background: var(--service);
                padding: 3px 12px; border-radius: 999px; }
.ex-cat-note { color: var(--muted); font-size: .82rem; }

/* ---------- sub-headings drill-down (a heading's own rates show first, then these) — Part B ---- */
.subheadings { margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 12px; }
.sub-title { margin: 0 2px 8px; color: var(--deep); font-weight: 700; font-size: .92rem; }
.sub-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; }
.sub-list li { display: flex; align-items: center; gap: 8px; padding: 8px 12px;
               border-bottom: 1px solid var(--line); cursor: pointer; }
.sub-list li:last-child { border-bottom: none; }
.sub-list li:hover { background: var(--lav-soft); }

/* ---------- multi-rate BUNDLE view (a heading with no single rate, SPEC §4.4) ---------- */
.bundle { margin-top: 16px; }
.bundle-spread { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px 12px; }
.bundle-range { font-size: 1.5rem; font-weight: 800; color: var(--deep);
                font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.bundle-tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
              color: var(--vibrant); background: var(--lav-soft); border: 1px solid var(--line);
              padding: 2px 9px; border-radius: 999px; }
/* all-exempt code: the headline is green "Exempt — no GST", not a purple rate range */
.bundle-range.exempt { color: var(--service); }
.bundle-tag.exempt { color: var(--service); background: #eafaf3; border-color: #cdeadd; }
.bundle-note { margin: 8px 0 4px; color: var(--muted); font-size: .84rem; }
.bundle-group { margin-top: 14px; }
.bundle-group-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 6px;
                     padding-bottom: 4px; border-bottom: 1px dashed var(--line); }
.bg-rate { font-weight: 800; color: var(--deep); font-variant-numeric: tabular-nums; }
.bg-count { color: var(--muted); font-size: .78rem; }
.bundle-group .oe-item { margin-bottom: 6px; }

/* kind badges */
.badge { flex: none; font-size: .68rem; font-weight: 700; text-transform: uppercase;
         letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; color: #fff; }
.badge.goods { background: var(--goods); }
.badge.service { background: var(--service); }

/* ---------- breadcrumbs + tree ---------- */
.browse { margin-top: 18px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 4px; font-size: .84rem; margin-bottom: 8px; }
.breadcrumbs a { color: var(--vibrant); cursor: pointer; text-decoration: none; font-weight: 600; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { color: var(--muted); }
.tree { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto;
        border: 1px solid var(--line); border-radius: 10px; }
.tree li {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.tree li:last-child { border-bottom: none; }
.tree li:hover { background: var(--lav-soft); }
.tree .t-code { font-weight: 700; color: var(--deep); font-variant-numeric: tabular-nums; min-width: 92px; }
.tree .t-desc { flex: 1; color: var(--ink); font-size: .88rem; overflow: hidden;
                text-overflow: ellipsis; white-space: nowrap; }
.tree .t-rate { color: var(--muted); font-size: .82rem; flex: none; }
.tree .chev { color: var(--lavender); font-weight: 700; flex: none; }

/* ---------- result panel ---------- */
.result-panel { margin-top: 22px; scroll-margin-top: 12px; }
.close-x { position: absolute; top: 12px; right: 14px; border: none; background: none;
           font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; }
.close-x:hover { color: var(--ink); }

.result-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; padding-right: 28px; }
.result-head .code { font-size: 1.6rem; font-weight: 800; color: var(--deep);
                     font-variant-numeric: tabular-nums; }
.result-desc { color: var(--ink); margin: 8px 0 0; }

/* the disambiguation controls */
.disambig { margin: 18px 0 6px; padding: 16px; background: var(--lav-soft);
            border: 1px solid var(--line); border-radius: 12px; }
.disambig .q { font-weight: 700; color: var(--deep); margin: 0 0 10px; }
.variant-list { display: flex; flex-direction: column; gap: 8px; }
.variant-btn, .toggle-btn {
  text-align: left; padding: 11px 14px; border: 2px solid var(--line); background: #fff;
  border-radius: 10px; cursor: pointer; font-family: inherit; font-size: .92rem; transition: .12s;
}
.variant-btn:hover, .toggle-btn:hover { border-color: var(--lavender); }
.variant-btn.active, .toggle-btn.active { border-color: var(--vibrant); background: #fff;
            box-shadow: 0 0 0 3px rgba(107,78,204,.14); }
.toggle-row { display: flex; gap: 10px; flex-wrap: wrap; }
.toggle-btn { flex: 1; min-width: 120px; text-align: center; font-weight: 600; }
.thr-input { padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px;
             font-size: 1rem; width: 180px; font-family: inherit; }
.thr-input:focus { outline: none; border-color: var(--vibrant); }

/* value-band resolver (both bands visible, applicable one highlighted) */
.vband-explain { margin: 2px 0 12px; font-size: .8rem; color: var(--muted); }
.disambig.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.disambig.warn .q { color: #9a6a12; }
.vband-input-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.vband-label { font-size: .82rem; font-weight: 600; color: var(--deep); }
.vband .thr-input { width: 200px; max-width: 100%; }
.band-list { display: flex; flex-direction: column; gap: 8px; }
.band-card { border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; transition: .15s; }
/* the band that applies to the entered value — highlighted, on top */
.band-card.applicable { border-color: var(--service); background: #f2fbf7;
                        box-shadow: 0 0 0 3px rgba(15,122,90,.15); }
.band-card.applicable .band-rate { color: var(--service); }
/* the other band(s) — de-emphasised for reference (reveal on hover) */
.band-card.dim { opacity: .5; }
.band-card.dim:hover { opacity: 1; }
.band-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
             padding: 11px 14px; cursor: pointer; }
.band-head:hover { background: var(--lav-soft); }
.band-head-left { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.band-badge { display: inline-block; background: var(--service); color: #fff; font-size: .7rem;
              font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.band-label { font-weight: 600; color: var(--ink); }
.band-rate { flex: none; font-weight: 800; color: var(--deep); font-variant-numeric: tabular-nums; }
.band-detail { padding: 0 14px 14px; }

/* the resolved rate card */
.rate-card { margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.rate-card .rc-top { display: flex; flex-wrap: wrap; }
.rc-cell { flex: 1; min-width: 90px; padding: 16px; text-align: center; border-right: 1px solid var(--line); }
.rc-cell:last-child { border-right: none; }
.rc-cell.total { background: linear-gradient(120deg, var(--deep), var(--vibrant)); color: #fff; }
.rc-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; opacity: .8; }
.rc-value { font-size: 1.5rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.rc-foot { padding: 14px 16px; border-top: 1px solid var(--line); background: #fbfaff; }
.rc-cite { font-size: .9rem; }
.rc-cite b { color: var(--deep); }
.rc-meta { color: var(--muted); font-size: .82rem; margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { background: var(--lav-soft); border: 1px solid var(--line); color: var(--deep);
        font-size: .76rem; padding: 3px 9px; border-radius: 999px; }
.selected-desc { color: var(--muted); font-size: .86rem; margin: 6px 0 0; }

/* gap / not-found cards */
.gap-card { margin-top: 14px; padding: 16px 18px; background: var(--warn-bg);
            border: 1px solid var(--warn-line); border-radius: 12px; }
.gap-card .g-title { font-weight: 700; color: #9a6a12; margin: 0 0 4px; }

.empty { color: var(--muted); padding: 10px 2px; font-size: .9rem; }
.footer-note { color: var(--muted); font-size: .78rem; margin: 26px 2px 40px; text-align: center; }

/* ---------- license / trial (license_check.py) ---------- */
/* the strip under the header: trial countdown, or a near-expiry renewal warning */
.license-banner { text-align: center; padding: 9px 16px; font-size: .9rem; }
.license-banner.trial { background: var(--lav-soft); color: var(--deep);
                        border-bottom: 1px solid var(--line); }
.license-banner.warn { background: var(--warn-bg); color: #9a6a12;
                       border-bottom: 1px solid var(--warn-line); }
.lic-link { margin-left: 12px; font-weight: 700; color: var(--vibrant); text-decoration: none; }
.lic-link:hover { text-decoration: underline; }

/* the license screen (templates/license.html) */
.license-panel { max-width: 640px; margin: 32px auto; }
.lic-why { color: #9a6a12; background: var(--warn-bg); border: 1px solid var(--warn-line);
           border-radius: 10px; padding: 10px 14px; font-size: .9rem; }
.lic-why:empty { display: none; }
.lic-input { width: 100%; padding: 12px 14px; font-size: .9rem; font-family: ui-monospace,
             Consolas, monospace; border: 2px solid var(--line); border-radius: 11px;
             resize: vertical; word-break: break-all; }
.lic-input:focus { outline: none; border-color: var(--vibrant);
                   box-shadow: 0 0 0 4px rgba(107,78,204,.14); }
.lic-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.lic-btn { flex: none; background: var(--vibrant); color: #fff; border-color: var(--vibrant); }
.lic-btn:hover { background: var(--deep); border-color: var(--deep); }
.lic-result { font-size: .88rem; }
.lic-result.bad { color: #b3261e; font-weight: 600; }
.lic-result.good { color: var(--service); font-weight: 600; }
