/* =====================================================================
   ToolSetu — "Bahi-Khata" Design System
   A warm ivory ledger in ink & deep emerald. Editorial. Instrument-grade.
   Light (default) + warm olive-ink Dark. Vanilla. No build.
   Type: DM Sans everywhere (tabular-nums on figures)
   ===================================================================== */

/* ------------------------------- TOKENS ------------------------------ */
:root {
  /* warm paper light mode (default, SEO-facing) */
  --bg:        #f4f0e6;
  --bg-2:      #ebe5d6;   /* recessed wells, table stripes */
  --surface:   #fbf9f2;   /* card ivory, lifted above bg */
  --surface-2: #f1ecdf;
  --ink:       #1a1c1a;
  --ink-2:     #4b4f49;
  --ink-3:     #837e70;

  --accent:        #0b5d3b;  /* deep emerald — the single accent */
  --accent-press:  #084a2f;
  --accent-tint:   rgba(11, 93, 59, 0.08);
  --accent-line:   rgba(11, 93, 59, 0.22);
  --accent-ink:    #fbf9f2;  /* text on a solid accent fill */

  --gold:      #a6792e;  /* bookmark / trending / export ONLY */
  --terracotta:#b4451f;  /* negative deltas / interest / destructive */

  --rule:        #ddd5c2;  /* hairline dividers, card borders */
  --rule-strong: #c2b89e;  /* input borders, focus tracks */

  --shadow-1: 0 1px 2px rgba(26, 28, 26, 0.05);
  --shadow-2: 0 8px 24px rgba(26, 28, 26, 0.08);
  --shadow-3: 0 20px 48px rgba(26, 28, 26, 0.12);

  --grain-opacity: 0.018;

  /* radii — deliberately mixed by role (anti "one-radius-fits-all") */
  --r-input: 3px;
  --r-chip:  3px;
  --r-tile:  6px;
  --r-card:  8px;

  /* type — DM Sans everywhere; numbers use tabular-nums for column alignment */
  --font-display: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body:    'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* motion */
  --ease-settle: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-rule:   cubic-bezier(0.65, 0, 0.35, 1);
  --ease-expo:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:     cubic-bezier(0.4, 0, 1, 1);
  --t-micro: 140ms;
  --t-ui:    280ms;

  --container: 1160px;
  --header-h: 72px;
}

[data-theme="dark"] {
  --bg:        #14160f;   /* deep olive-ink, NOT blue-black */
  --bg-2:      #1c1e15;
  --surface:   #20231a;
  --surface-2: #262a1d;
  --ink:       #ece7d6;   /* warm off-white, never pure #fff */
  --ink-2:     #b6b09a;
  --ink-3:     #837e6c;

  --accent:        #3d9b6e;
  --accent-press:  #2e7d57;
  --accent-tint:   rgba(61, 155, 110, 0.13);
  --accent-line:   rgba(61, 155, 110, 0.30);
  --accent-ink:    #14160f;

  --gold:      #c99a4a;
  --terracotta:#d9663c;

  --rule:        #34372a;
  --rule-strong: #474b39;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 10px 28px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 24px 56px rgba(0, 0, 0, 0.6);

  --grain-opacity: 0.028;
}

/* ------------------------------- RESET ------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--t-ui) var(--ease-settle), color var(--t-ui) var(--ease-settle);
}
/* static paper grain — one fixed layer, never animated */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.013em; line-height: 1.08; color: var(--ink); }
h4, h5 { font-family: var(--font-body); font-weight: 700; letter-spacing: -0.005em; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--accent-tint); }

.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.icon-sm { width: 18px; height: 18px; }

.skip-link { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; }
.skip-link:focus { left: 0; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 22px; }

/* ledger-rule band texture (hero & section breaks only) */
.ledger-bg {
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, var(--rule) 27px, var(--rule) 28px);
  background-position: 0 6px;
}
[data-theme="dark"] .ledger-bg { opacity: 1; }

/* --------------------------- TYPOGRAPHY ------------------------------ */
.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.kicker::before { content: ""; width: 22px; height: 2px; background: var(--accent); }
.eyebrow { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.lede { font-size: 1.16rem; color: var(--ink-2); line-height: 1.6; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.text-center { text-align: center; }

/* --------------------------- BUTTONS --------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-input); font-weight: 600; font-size: 0.94rem;
  border: 1px solid transparent; transition: transform var(--t-micro) var(--ease-settle),
    background var(--t-micro) var(--ease-settle), border-color var(--t-micro) var(--ease-settle),
    color var(--t-micro) var(--ease-settle); white-space: nowrap; letter-spacing: -0.005em;
}
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-press); }
.btn-primary:hover { background: var(--accent-press); color: var(--accent-ink); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--rule-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-tint); color: var(--ink); }
.btn-ghost .icon { color: var(--ink-2); }
.btn-export { background: transparent; border-color: var(--rule-strong); color: var(--ink); }
.btn-export .icon { color: var(--gold); }
.btn-export:hover { border-color: var(--gold); background: rgba(166, 121, 46, 0.08); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 0.84rem; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* tertiary text link with growing underline */
.link-wipe { color: var(--ink); font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
  background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0% 1.5px;
  background-position: 0 100%; background-repeat: no-repeat; transition: background-size var(--t-ui) var(--ease-settle); padding-bottom: 2px; }
.link-wipe:hover { background-size: 100% 1.5px; color: var(--ink); }
.link-wipe .icon { color: var(--accent); transition: transform var(--t-micro) var(--ease-settle); }
.link-wipe:hover .icon { transform: translateX(3px); }

/* ----------------------------- HEADER -------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-bottom: 1px solid var(--rule);
  transition: height var(--t-ui) var(--ease-settle), background var(--t-ui) var(--ease-settle);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header { -webkit-backdrop-filter: blur(11px) saturate(1.3); backdrop-filter: blur(11px) saturate(1.3); }
}
@supports not (background: color-mix(in srgb, white, black)) {
  .site-header { background: var(--surface); }
}
.site-header.is-scrolled { height: 58px; box-shadow: var(--shadow-1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); }
.brand-mark-svg { color: var(--accent); flex-shrink: 0; }
.brand-text { font-family: var(--font-display); font-weight: 600; font-size: 1.34rem; letter-spacing: -0.02em; }
.brand-text b { color: var(--accent); font-weight: 600; }

.main-nav { display: flex; align-items: center; gap: 2px; }
.main-nav a {
  position: relative; color: var(--ink-2); font-weight: 500; font-size: 0.9rem; padding: 8px 11px;
  transition: color var(--t-micro) var(--ease-settle);
}
.main-nav a::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 2px; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform var(--t-ui) var(--ease-settle);
}
.main-nav a:hover { color: var(--ink); }
.main-nav a:hover::after { transform: scaleX(0.4); }
.main-nav a.active { color: var(--ink); }
.main-nav a.active::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle, .nav-toggle {
  width: 40px; height: 40px; border-radius: var(--r-input); display: grid; place-items: center;
  background: transparent; border: 1px solid var(--rule); color: var(--ink-2);
  transition: border-color var(--t-micro) var(--ease-settle), color var(--t-micro) var(--ease-settle), background var(--t-micro);
}
.theme-toggle:hover, .nav-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: inline-block; }
.nav-toggle { display: none; }

/* mobile drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(20, 22, 15, 0.45); opacity: 0; visibility: hidden;
  transition: opacity var(--t-ui) var(--ease-settle), visibility var(--t-ui); z-index: 60; }
.drawer-scrim.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(82vw, 320px); z-index: 61;
  background: var(--surface); border-left: 1px solid var(--rule); padding: 22px;
  transform: translateX(100%); transition: transform var(--t-ui) var(--ease-settle);
  display: flex; flex-direction: column; gap: 4px;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.drawer a { color: var(--ink); padding: 13px 12px; border-radius: var(--r-input); font-weight: 500; display: flex; align-items: center; gap: 12px; }
.drawer a .icon { color: var(--ink-3); }
.drawer a:hover { background: var(--accent-tint); }
.drawer a.active { color: var(--accent); }
.drawer a.active .icon { color: var(--accent); }

/* ------------------------------ CARDS -------------------------------- */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-card); box-shadow: var(--shadow-1); position: relative; min-width: 0; }
.card-pad { padding: 24px; }
.card-hover { transition: transform var(--t-ui) var(--ease-settle), border-color var(--t-ui) var(--ease-settle), box-shadow var(--t-ui) var(--ease-settle); overflow: hidden; }
.card-hover::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform var(--t-ui) var(--ease-settle);
}
.card-hover:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-2); }
.card-hover:hover::before { transform: scaleX(1); }

/* icon tile — colourful: each tile may set its own --tc colour (defaults to emerald) */
.tile { --tc: var(--accent); width: 42px; height: 42px; border-radius: var(--r-tile); display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent); flex-shrink: 0; transition: transform var(--t-micro) var(--ease-settle); }
@supports (background: color-mix(in srgb, red, blue)) {
  .tile { background: color-mix(in srgb, var(--tc) 14%, var(--surface)); color: var(--tc); }
  [data-theme="dark"] .tile { background: color-mix(in srgb, var(--tc) 22%, var(--surface)); }
}
.tile .icon { width: 22px; height: 22px; }
.tile-lg { width: 54px; height: 54px; border-radius: 13px; }
.tile-lg .icon { width: 28px; height: 28px; }
.card-hover:hover .tile { transform: scale(1.06) rotate(-3deg); }
.tile-gold { --tc: var(--gold); }

/* ------------------------------- HERO -------------------------------- */
.hero { position: relative; padding: 64px 0 30px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 3.75rem); margin: 18px 0 18px; line-height: 1.06; }
.hero .lede { max-width: 47ch; margin-bottom: 24px; }
.hero-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.hero-trust { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 22px; }
.hero-trust span { display: inline-flex; align-items: center; gap: 7px; font-size: 0.84rem; color: var(--ink-3); }
.hero-trust .icon { color: var(--accent); width: 16px; height: 16px; }
.hero-rule { height: 1px; background: var(--rule); margin-top: 46px; }

/* rotating headline word */
.rotator { display: inline-block; }
.rot-word { display: inline-block; color: var(--rot-color, var(--accent)); position: relative;
  transition: opacity 0.36s var(--ease-settle), transform 0.36s var(--ease-settle); will-change: transform, opacity; }
.rot-word::after { content: ""; position: absolute; left: -2px; right: -2px; bottom: 0.08em; height: 0.36em; z-index: -1;
  background: var(--rot-color, var(--accent)); opacity: 0.16; transform: skewX(-11deg); border-radius: 2px; }
.rot-word.out { opacity: 0; transform: translateY(-16px); }
.rot-word.in-prep { opacity: 0; transform: translateY(16px); transition: none; }

/* animated floating tool cluster */
.hero-cluster { position: relative; min-height: 450px; }
.float-tile { position: absolute; left: var(--x); top: var(--y);
  transform: translate(calc(var(--mx, 0) * var(--depth, 14) * 1px), calc(var(--my, 0) * var(--depth, 14) * 1px));
  transition: transform 0.45s ease-out; }
.float-bob { display: block; animation: floatBob var(--d, 5s) ease-in-out calc(var(--i, 0) * 0.2s + 0.6s) infinite alternate; }
.float-card { display: grid; place-items: center; width: var(--s, 58px); height: var(--s, 58px); border-radius: 18px;
  background: var(--accent-tint); color: var(--tc); border: 1px solid var(--rule); box-shadow: var(--shadow-2);
  animation: tileIn 0.6s var(--ease-settle) backwards; animation-delay: calc(var(--i, 0) * 0.1s);
  transition: transform 0.2s var(--ease-settle), box-shadow 0.2s var(--ease-settle); }
@supports (background: color-mix(in srgb, red, blue)) {
  .float-card { background: color-mix(in srgb, var(--tc) 15%, var(--surface)); border-color: color-mix(in srgb, var(--tc) 28%, var(--rule)); }
}
.float-card .icon { width: calc(var(--s, 58px) * 0.46); height: calc(var(--s, 58px) * 0.46); }
.float-tile:hover { z-index: 5; }
.float-tile:hover .float-card { transform: scale(1.14); box-shadow: var(--shadow-3); }
@keyframes floatBob { from { transform: translateY(-9px) rotate(-2.2deg); } to { transform: translateY(9px) rotate(2.2deg); } }
@keyframes tileIn { from { opacity: 0; transform: scale(0.35); } to { opacity: 1; transform: scale(1); } }

/* --------------------------- SECTIONS -------------------------------- */
.section { padding: 56px 0; }
.section-head { max-width: 60ch; margin-bottom: 34px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 10px 0 10px; }
.section-head p { color: var(--ink-2); font-size: 1.05rem; }

/* a 1px rule that "draws itself in" on scroll */
.rule-draw { height: 1px; background: var(--rule); transform: scaleX(0); transform-origin: left; }
.rule-draw.accent { background: var(--accent); }
.rule-draw.in { transform: scaleX(1); transition: transform 600ms var(--ease-rule); }

/* ------------------------------ GRID --------------------------------- */
.grid { display: grid; gap: 18px; }
/* minmax(0,1fr) lets columns shrink below content width (prevents overflow) */
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* fluid tool grid — reflows smoothly at any width (no hard 4→2→1 jumps) */
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
/* 5 homepage modules — uniform cards, never stretch a lone wrapped card */
.grid-modules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px)  { .grid-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .grid-modules { grid-template-columns: 1fr; } }

/* module + tool cards */
.module-card { padding: 26px; display: flex; flex-direction: column; gap: 14px; color: var(--ink); }
.module-card h3 { font-size: 1.28rem; }
.module-card p { color: var(--ink-2); font-size: 0.95rem; flex: 1; line-height: 1.55; }
.module-card .mc-foot { display: flex; align-items: center; justify-content: space-between; }
.module-card .mc-stat { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-3); letter-spacing: 0.04em; }
.module-card .mc-go { color: var(--accent); display: inline-flex; }

.tool-tile { padding: 20px; display: flex; align-items: flex-start; gap: 15px; color: var(--ink); min-width: 0; }
.tool-tile > div { min-width: 0; }
.tool-tile h4 { font-size: 1.02rem; margin-bottom: 3px; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; overflow-wrap: break-word; }
.tool-tile p { color: var(--ink-3); font-size: 0.85rem; line-height: 1.45; overflow-wrap: break-word; }
.module-card h3, .module-card p { overflow-wrap: break-word; }

/* ------------------------ PAGE HEAD / CRUMBS ------------------------- */
.page-head { padding: 44px 0 8px; }
.breadcrumb { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-3); margin-bottom: 12px; letter-spacing: 0.02em; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.breadcrumb a { color: var(--ink-3); } .breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: 0.5; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
.page-head p { color: var(--ink-2); margin-top: 11px; max-width: 70ch; font-size: 1.05rem; }

/* ------------------------------ FORMS -------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--r-input); border: 1px solid var(--rule-strong);
  background: var(--surface); color: var(--ink); font-size: 0.95rem;
  transition: border-color var(--t-micro) var(--ease-settle), box-shadow var(--t-micro) var(--ease-settle);
}
.input:focus, .select:focus, .textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}
.input:focus, .select:focus, .textarea:focus { box-shadow: 0 0 0 2px var(--accent-tint); }
.textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
.field-hint { font-size: 0.78rem; color: var(--ink-3); margin-top: 5px; }
.input-currency { position: relative; display: flex; align-items: stretch; }
.input-currency .cur { display: grid; place-items: center; padding: 0 11px; background: var(--bg-2); border: 1px solid var(--rule-strong); border-right: none; border-radius: var(--r-input) 0 0 var(--r-input); font-family: var(--font-mono); color: var(--ink-3); font-size: 0.9rem; }
.input-currency .input { border-radius: 0 var(--r-input) var(--r-input) 0; }

/* sliders */
.range-field .range-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.range-field label { margin: 0; }
.range-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; color: var(--accent); font-size: 0.96rem; }
.range-val .unit { color: var(--ink-3); font-size: 0.8rem; margin-left: 2px; }
.range-val .cur { color: var(--ink-3); margin-right: 1px; }
.mini-num { width: 92px; text-align: right; background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--r-input); padding: 4px 8px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; color: var(--accent); font-size: 0.92rem; -moz-appearance: textfield; }
.mini-num::-webkit-outer-spin-button, .mini-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mini-num:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.range-field { margin-bottom: 22px; }
.range-field:last-child { margin-bottom: 0; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px;
  background: var(--bg-2); outline: none; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--bg-2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin-top: -7px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--rule-strong); box-shadow: var(--shadow-1); cursor: pointer; transition: border-color var(--t-micro), transform var(--t-micro); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 1px solid var(--rule-strong); box-shadow: var(--shadow-1); cursor: pointer; }
input[type=range]::-webkit-slider-thumb:hover { border-color: var(--accent); transform: scale(1.08); }
input[type=range]:focus-visible::-webkit-slider-thumb { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }

/* ----------------------------- ALERTS -------------------------------- */
.alert { padding: 12px 15px; border-radius: var(--r-input); margin: 0 auto 14px; max-width: var(--container); font-size: 0.92rem; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--accent-tint); color: var(--accent); border-color: var(--accent-line); }
.alert-error, .alert-danger { background: rgba(180, 69, 31, 0.1); color: var(--terracotta); border-color: rgba(180,69,31,0.3); }
.alert-info { background: var(--bg-2); color: var(--ink-2); border-color: var(--rule-strong); }

/* ----------------------------- BADGES -------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-chip); font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--rule); }
.badge-accent { background: var(--accent-tint); color: var(--accent); border-color: var(--accent-line); }
.badge-trending { background: rgba(166,121,46,0.12); color: var(--gold); border-color: rgba(166,121,46,0.3); }

/* --------------------------- CALCULATOR ------------------------------ */
.calc-layout { display: grid; grid-template-columns: 0.85fr 1fr; gap: 24px; align-items: start; }
.calc-inputs { padding: 24px; }
.calc-result { padding: 26px; position: sticky; top: 88px; }
.result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.result-label { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.result-main { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: clamp(2rem, 5vw, 2.9rem); font-weight: 500; color: var(--accent); letter-spacing: -0.015em; line-height: 1.05; }
.result-chart { display: flex; align-items: center; gap: 22px; margin: 22px 0; }
.chart-legend { display: flex; flex-direction: column; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 0.86rem; color: var(--ink-2); }
.legend-dot { width: 11px; height: 11px; border-radius: 2px; flex-shrink: 0; }
.legend-row .lv { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); margin-left: auto; font-size: 0.84rem; }
.breakdown { border-top: 1px solid var(--rule); }
.breakdown .row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.breakdown .row:last-child { border-bottom: none; }
.breakdown .k { color: var(--ink-2); font-size: 0.92rem; }
.breakdown .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; color: var(--ink); }
.breakdown .v.pos { color: var(--accent); } .breakdown .v.neg { color: var(--terracotta); }
.calc-actions { display: flex; gap: 10px; margin-top: 20px; }

.chart-svg { width: 132px; height: 132px; flex-shrink: 0; }
.chart-svg circle { transition: stroke-dashoffset 900ms var(--ease-rule); }

/* mobile sticky result bar */
.calc-mobilebar { display: none; }

/* ------------------------------ TABLES ------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-card); }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { padding: 11px 15px; text-align: left; border-bottom: 1px solid var(--rule); font-size: 0.9rem; }
table.data th { background: var(--bg-2); color: var(--ink-3); font-family: var(--font-mono); font-weight: 500; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; }
table.data td.num, table.data th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:nth-child(even) td { background: var(--bg-2); }

/* --------------------------- PROMPT CARDS ---------------------------- */
.search-bar { position: relative; margin-bottom: 20px; }
.search-bar .input { padding-left: 44px; height: 50px; font-size: 1rem; }
.search-bar .s-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.chip { padding: 7px 14px; border-radius: var(--r-chip); background: var(--surface); border: 1px solid var(--rule); color: var(--ink-2); font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: border-color var(--t-micro), color var(--t-micro), background var(--t-micro); display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-press); }

.prompt-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pc-title { font-family: var(--font-display); font-size: 1.08rem; font-weight: 600; letter-spacing: -0.01em; }
.pc-tags { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.pc-body { color: var(--ink-2); font-size: 0.88rem; line-height: 1.55; max-height: 118px; overflow: hidden; position: relative; font-family: var(--font-mono); }
.pc-body::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 34px; background: linear-gradient(transparent, var(--surface)); }
.pc-actions { display: flex; gap: 8px; align-items: center; margin-top: auto; }
.pc-actions .count { margin-left: auto; font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-3); }
.icon-btn { width: 38px; height: 38px; border-radius: var(--r-input); display: grid; place-items: center; background: transparent; border: 1px solid var(--rule); color: var(--ink-2); transition: border-color var(--t-micro), color var(--t-micro), background var(--t-micro); }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.js-bookmark.active { color: var(--gold); border-color: var(--gold); background: rgba(166,121,46,0.08); }
.js-bookmark.active .icon { fill: var(--gold); }
.js-bookmark.inked .icon { animation: inkSoak 320ms var(--ease-settle); }
@keyframes inkSoak { 0% { transform: scaleY(0.85); } 55% { transform: scaleY(1.04); } 100% { transform: scaleY(1); } }
.js-copy { position: relative; overflow: hidden; }
.js-copy::after { content: ""; position: absolute; left: 0; bottom: 0; height: 1.5px; width: 100%; background: var(--gold); transform: scaleX(0); transform-origin: left; }
.js-copy.copied { color: var(--gold); border-color: var(--gold); }
.js-copy.copied .icon { color: var(--gold); }
.js-copy.copied::after { animation: copySweep 260ms var(--ease-settle) forwards; }
@keyframes copySweep { to { transform: scaleX(1); } }

/* --------------------------- SCHEME FINDER --------------------------- */
.wizard-rail { display: flex; gap: 6px; margin-bottom: 26px; }
.wizard-rail .seg { flex: 1; height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.wizard-rail .seg.done { background: var(--accent); }
.scheme-card { padding: 24px; }
.scheme-card h3 { font-size: 1.2rem; }
.scheme-card h4 { font-size: 0.78rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin: 18px 0 8px; }
.reason { display: flex; gap: 9px; align-items: flex-start; color: var(--ink-2); font-size: 0.92rem; padding: 3px 0; }
.reason .icon { color: var(--accent); margin-top: 2px; }
.match-reveal { opacity: 0; transform: translateY(14px); }
.match-reveal.in { opacity: 1; transform: translateY(0); transition: opacity 420ms var(--ease-settle), transform 420ms var(--ease-settle); }

.scheme-meta { font-size: 0.74rem; color: var(--ink-3); letter-spacing: 0.02em; margin-top: 5px; font-family: var(--font-mono); }
.scheme-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.scheme-when { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; color: var(--ink-2); margin-top: 11px; font-family: var(--font-mono); }
.scheme-when .icon { width: 15px; height: 15px; color: var(--accent); }
.badge-new { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-press); }
.badge-deadline { background: rgba(180,69,31,0.1); color: var(--terracotta); border-color: rgba(180,69,31,0.3); }
.apply-box { margin-top: 14px; border: 1px solid var(--rule); border-radius: var(--r-tile); overflow: hidden; }
.apply-box summary { cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; justify-content: space-between; list-style: none; background: var(--bg-2); }
.apply-box summary::-webkit-details-marker { display: none; }
.apply-box summary .chev { transition: transform var(--t-ui) var(--ease-settle); color: var(--ink-3); }
.apply-box[open] summary .chev { transform: rotate(90deg); }
.apply-body { padding: 14px; }
.apply-mode { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); margin-bottom: 12px; }
.apply-steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 12px; }
.apply-steps li { counter-increment: step; position: relative; padding: 7px 0 7px 32px; color: var(--ink-2); font-size: 0.91rem; border-bottom: 1px solid var(--rule); }
.apply-steps li:last-child { border-bottom: none; }
.apply-steps li::before { content: counter(step); position: absolute; left: 0; top: 6px; width: 21px; height: 21px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); font-size: 0.72rem; font-weight: 700; display: grid; place-items: center; }
.apply-docs { font-size: 0.86rem; color: var(--ink-2); background: var(--bg-2); padding: 10px 12px; border-radius: var(--r-input); }
.apply-docs strong { color: var(--ink); }
.filter-bar { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr) auto; gap: 10px; margin-bottom: 18px; align-items: end; }
.filter-bar .field { margin: 0; }
.filter-bar .field label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.scheme-count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-3); margin-bottom: 16px; }
@media (max-width: 860px) { .filter-bar { grid-template-columns: 1fr 1fr; } }
.scheme-sub { font-size: 0.78rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); margin: 16px 0 6px; }
.cmp-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--ink-2); cursor: pointer; }
.cmp-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.doc-checklist { margin-top: 4px; }
.doc-checklist > strong { display: block; font-size: 0.82rem; margin-bottom: 6px; color: var(--ink); }
.doc-check { display: flex; align-items: flex-start; gap: 9px; padding: 4px 0; font-size: 0.9rem; color: var(--ink-2); cursor: pointer; }
.doc-check input { margin-top: 3px; accent-color: var(--accent); }
.doc-check input:checked + span { text-decoration: line-through; color: var(--ink-3); }
.cmp-bar { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(160%); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-3); z-index: 60; transition: transform var(--t-ui) var(--ease-settle); font-size: 0.9rem; }
.cmp-bar.show { transform: translateX(-50%) translateY(0); }
.cmp-bar .btn-ghost { color: var(--bg); border-color: rgba(255,255,255,0.3); }
.cmp-bar .btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--bg); }
.cmp-modal { position: fixed; inset: 0; background: rgba(20,22,15,0.55); display: none; place-items: center; z-index: 70; padding: 20px; }
.cmp-modal.open { display: grid; }
.cmp-panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-card); max-width: 920px; width: 100%; max-height: 86vh; overflow: auto; padding: 24px; }
.cmp-table { width: 100%; border-collapse: collapse; }
.cmp-table th, .cmp-table td { border: 1px solid var(--rule); padding: 10px 12px; text-align: left; vertical-align: top; font-size: 0.9rem; }
.cmp-table thead th { background: var(--bg-2); font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.cmp-table td.rowlabel { font-weight: 600; background: var(--surface-2); white-space: nowrap; }

/* --------------------------- DOCUMENTS ------------------------------- */
.doc-layout { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.doc-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.doc-paper {
  background: #ffffff; color: #1a1a1a; width: 100%; max-width: 794px; min-height: 700px; margin: 0 auto;
  padding: 56px 60px; border-radius: var(--r-card); box-shadow: var(--shadow-3);
  font-family: 'DM Sans', system-ui, sans-serif; line-height: 1.7; font-size: 15px;
}
.doc-paper h2 { font-family: inherit; color: #111; }
.doc-paper .doc-title { text-align: center; font-size: 1.5rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 24px; }
.doc-paper .doc-right { text-align: right; } .doc-paper .doc-sign { margin-top: 48px; }
.doc-paper p { margin-bottom: 12px; color: #1a1a1a; }
.doc-paper .tok { background: #fff7d6; padding: 0 2px; border-radius: 2px; }
.doc-paper .flash { animation: diffFlash 700ms var(--ease-out, ease) ; }
@keyframes diffFlash { 0% { background: var(--accent-tint); box-shadow: -6px 0 0 var(--accent-tint); } 100% { background: transparent; box-shadow: none; } }
.doc-paper[contenteditable="true"]:focus { outline: 2px dashed var(--accent); outline-offset: 6px; }

/* --------------------------- GST INVOICE ----------------------------- */
.inv-items { width: 100%; border-collapse: collapse; margin-top: 6px; }
.inv-items th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); padding: 4px 5px; font-weight: 600; }
.inv-items td { padding: 3px 4px; vertical-align: top; }
.inv-items .input, .inv-items .select { padding: 7px 8px; font-size: 0.85rem; }
.inv-items .inv-del { width: 30px; height: 30px; font-size: 1.1rem; }
.inv-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.inv-table th, .inv-table td { border: 1px solid #ddd; padding: 6px 8px; }
.inv-table th { background: #f3f0e8; text-align: left; }
.inv-table .r, .inv-table td.r, .inv-table th.r { text-align: right; }
.inv-totals { font-size: 14px; min-width: 240px; }
.inv-totals td { padding: 4px 10px; }
.inv-totals .grand td { font-weight: 700; font-size: 16px; border-top: 2px solid #333; padding-top: 8px; }

/* ------------------------------ ADS ---------------------------------- */
.ad-slot { margin: 22px auto; max-width: var(--container); }
.ad-well { border: 1px solid var(--rule); border-radius: var(--r-card); background: var(--bg-2); min-height: 116px; display: grid; place-items: center; position: relative; }
.ad-well::before { content: "ADVERTISEMENT"; position: absolute; top: 8px; left: 12px; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.12em; color: var(--ink-3); opacity: 0.7; }
.ad-mobile-sticky { display: none; }

/* ----------------------------- FOOTER -------------------------------- */
.site-footer { margin-top: 64px; background: var(--surface); border-top: 1px solid var(--rule); padding: 52px 0 26px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 34px; }
.footer-tagline { color: var(--ink-3); font-size: 0.92rem; margin-top: 13px; max-width: 30ch; }
.footer-col h4 { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 14px; font-weight: 500; }
.footer-col a { display: block; color: var(--ink-2); font-size: 0.92rem; padding: 5px 0; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--rule); }
.footer-bottom p { color: var(--ink-3); font-size: 0.83rem; }

/* --------------------------- PDF TOOLS ------------------------------- */
.tool-group-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-body);
  font-size: 0.92rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2);
  margin: 44px 0 18px; }
.tool-group-title::before { content: ""; width: 16px; height: 3px; border-radius: 2px; background: var(--accent); }
.tool-group-title:first-of-type { margin-top: 10px; }
.pdf-tool, .img-tool { max-width: 720px; margin: 0 auto; }
.img-preview { margin-top: 16px; border: 1px solid var(--rule); border-radius: var(--r-card); padding: 14px; background: var(--bg-2); text-align: center; min-height: 120px; display: grid; place-items: center; }
.img-preview img { max-width: 100%; max-height: 360px; border-radius: var(--r-input); }
.img-meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3); margin-top: 10px; }
.qr-layout { display: grid; grid-template-columns: 1fr 300px; gap: 26px; align-items: start; }
.qr-box { display: grid; place-items: center; background: #fff; border: 1px solid var(--rule); border-radius: var(--r-card); padding: 22px; min-height: 284px; color: #837e70; }
.qr-box img, .qr-box canvas { display: block; }
.qr-actions { margin-top: 14px; }
@media (max-width: 760px) { .qr-layout { grid-template-columns: 1fr; } }
.pdf-drop { border: 2px dashed var(--rule-strong); border-radius: var(--r-card); padding: 46px 20px; text-align: center; cursor: pointer; transition: border-color var(--t-micro) var(--ease-settle), background var(--t-micro) var(--ease-settle); background: var(--surface); }
.pdf-drop:hover, .pdf-drop.drag { border-color: var(--accent); background: var(--accent-tint); }
.pdf-drop .pd-ic { color: var(--accent); margin: 0 auto 12px; width: 40px; height: 40px; }
.pdf-drop h4 { font-size: 1.08rem; }
.pdf-drop p { color: var(--ink-3); font-size: 0.86rem; margin-top: 5px; }
.pdf-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r-input); margin-top: 8px; background: var(--surface); }
.pdf-file .pf-name { font-weight: 500; font-size: 0.9rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-file .pf-size { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-3); }
.pdf-file .pf-x { width: 26px; height: 26px; border-radius: 6px; color: var(--ink-3); font-size: 1.2rem; line-height: 1; }
.pdf-file .pf-x:hover { color: var(--terracotta); background: var(--bg-2); }
.pdf-opts { margin-top: 18px; }
.pdf-actions { margin-top: 18px; }
.pdf-done { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid var(--accent-line); background: var(--accent-tint); border-radius: var(--r-card); margin-top: 18px; }
.pdf-done .pd-ico { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex-shrink: 0; }
.pdf-done a { margin-left: auto; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.pdf-note { font-size: 0.82rem; color: var(--ink-3); margin-top: 16px; display: flex; gap: 8px; align-items: flex-start; }
.pdf-note .icon { color: var(--accent); flex-shrink: 0; margin-top: 1px; }

/* interactive page thumbnails */
.pdf-tool.has-thumbs .pdf-opts { display: none; }
.pdf-interactive { margin-top: 18px; }
.pdf-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.pdf-toolbar .pt-hint { font-size: 0.85rem; color: var(--ink-2); }
.pdf-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px; }
.pdf-page { position: relative; border: 1px solid var(--rule); border-radius: var(--r-input); padding: 8px; background: var(--surface); text-align: center; cursor: pointer; transition: border-color var(--t-micro) var(--ease-settle), box-shadow var(--t-micro) var(--ease-settle), transform var(--t-micro) var(--ease-settle); }
.pdf-page:hover { border-color: var(--accent); }
.pdf-page canvas { width: 100%; height: auto; border-radius: 3px; display: block; background: #fff; transition: transform var(--t-ui) var(--ease-settle); }
.pdf-page .pp-num { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-3); margin-top: 6px; }
.pdf-page .pp-badge { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: none; place-items: center; box-shadow: var(--shadow-1); }
.pdf-page .pp-badge .icon { width: 13px; height: 13px; }
.pdf-page.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.pdf-page.sel .pp-badge { display: grid; }
[data-interactive="select-remove"] .pdf-page.sel { border-color: var(--terracotta); box-shadow: 0 0 0 2px rgba(180,69,31,.16); }
[data-interactive="select-remove"] .pdf-page.sel canvas { opacity: .45; }
[data-interactive="select-remove"] .pdf-page.sel .pp-badge { background: var(--terracotta); }
.pp-rot { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 7px; background: var(--surface); border: 1px solid var(--rule); display: grid; place-items: center; color: var(--ink-2); cursor: pointer; box-shadow: var(--shadow-1); }
.pp-rot:hover { color: var(--accent); border-color: var(--accent); }
.pp-rot .icon { width: 15px; height: 15px; }
.pdf-page[draggable="true"] { cursor: grab; }
.pdf-page.dragging { opacity: .4; }
.pdf-page.dragover { border-color: var(--accent); box-shadow: -3px 0 0 var(--accent); }
.pdf-page .pp-handle { position: absolute; top: 6px; left: 6px; color: var(--ink-3); pointer-events: none; }
.pdf-page .pp-handle .icon { width: 15px; height: 15px; }

/* ---------------------------- e-SIGN PDF ----------------------------- */
.sign-cols { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.sign-stage-wrap { overflow: auto; }
#signStage { position: relative; margin: 0 auto; border: 1px solid var(--rule); border-radius: var(--r-input); background: #fff; }
#signPage { display: block; }
.sig-overlay { position: absolute; cursor: move; border: 1px dashed var(--accent); box-shadow: 0 0 0 9999px rgba(11,93,59,0.02); touch-action: none; }
.sig-overlay img { width: 100%; height: 100%; display: block; pointer-events: none; }
.sig-pad { width: 100%; height: 150px; border: 1px solid var(--rule-strong); border-radius: var(--r-input); background: var(--surface-2); touch-action: none; cursor: crosshair; display: block; }
.sign-pagenav { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 12px; }
.sign-pagenav .pg { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-3); }
@media (max-width: 860px) { .sign-cols { grid-template-columns: 1fr; } }

/* ----------------------------- REVEAL -------------------------------- */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: translateY(0); transition: opacity 560ms var(--ease-settle), transform 560ms var(--ease-settle); }

/* ----------------------------- TOAST --------------------------------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(140%); background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: var(--r-input); font-size: 0.88rem; font-weight: 600; z-index: 200; box-shadow: var(--shadow-3); transition: transform var(--t-ui) var(--ease-settle); display: flex; align-items: center; gap: 8px; }
.toast.show { transform: translateX(-50%) translateY(0); }

/* empty / prose */
.empty-state { text-align: center; padding: 56px 20px; color: var(--ink-3); }
.empty-state .icon { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--rule-strong); }
.prose { max-width: 70ch; }
.prose h2 { margin: 30px 0 12px; font-size: 1.5rem; }
.prose h3 { margin: 22px 0 9px; font-size: 1.18rem; }
.prose p, .prose li { color: var(--ink-2); margin-bottom: 12px; }
.prose ul { list-style: disc; padding-left: 22px; margin-bottom: 14px; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

/* utility */
.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:36px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.flex{display:flex}.between{justify-content:space-between}.center{align-items:center}.gap{gap:12px}.wrap{flex-wrap:wrap}
.hidden{display:none !important}

/* ----------------------------- ADMIN --------------------------------- */
.admin-body { background: var(--bg-2); }
.admin-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--surface); border-right: 1px solid var(--rule); padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-sidebar .brand { margin-bottom: 26px; padding: 0 8px; }
.admin-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: var(--r-input); color: var(--ink-2); font-weight: 500; font-size: 0.92rem; margin-bottom: 3px; }
.admin-nav a .icon { color: var(--ink-3); width: 18px; height: 18px; }
.admin-nav a:hover { background: var(--accent-tint); color: var(--accent); }
.admin-nav a:hover .icon { color: var(--accent); }
.admin-nav a.active { background: var(--accent); color: var(--accent-ink); }
.admin-nav a.active .icon { color: var(--accent-ink); }
.admin-main { min-width: 0; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; padding: 15px 28px; background: var(--surface); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 10; }
.admin-content { padding: 28px; }
.admin-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.admin-login .card { width: 100%; max-width: 410px; }
.admin-actions { display: flex; gap: 6px; }
.admin-actions a, .admin-actions button { font-size: 0.8rem; padding: 6px 11px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { padding: 20px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--accent); }
.stat .label { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.stat .value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.8rem; font-weight: 500; margin-top: 6px; color: var(--ink); }
.stat.danger { border-left-color: var(--terracotta); }

/* ----------------------- ADMIN ANALYTICS ----------------------------- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.metric { position: relative; padding: 18px 20px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--rule); overflow: hidden; transition: transform var(--t-micro) var(--ease-settle), box-shadow var(--t-micro) var(--ease-settle); }
.metric::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: 0.55; }
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.metric-live { border-color: var(--accent-line); background: linear-gradient(135deg, var(--accent-tint), var(--surface)); }
.metric-live::before { background: #16a34a; opacity: 1; }
.metric-label { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; display: flex; align-items: center; gap: 7px; }
.metric-label .icon { width: 14px; height: 14px; }
.metric-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 2.15rem; font-weight: 600; line-height: 1.1; margin: 8px 0 2px; color: var(--ink); letter-spacing: -0.01em; }
.metric-live .metric-num { color: var(--accent); }
.metric-sub { font-size: 0.78rem; color: var(--ink-3); }
.delta { font-family: var(--font-body); font-size: 0.66rem; font-weight: 600; padding: 1px 6px; border-radius: 999px; margin-left: auto; text-transform: none; letter-spacing: 0; }
.delta.up { color: #15803d; background: rgba(22,163,74,0.13); }
.delta.down { color: #b91c1c; background: rgba(220,38,38,0.12); }
.delta.flat { color: var(--ink-3); background: var(--bg-2); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22,163,74,0.5); animation: livePulse 1.8s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,0.5); } 70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }

/* bar chart */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; cursor: default; }
.bar-val { font-size: 0.62rem; color: var(--ink-3); font-family: var(--font-mono); margin-bottom: 3px; }
.bar { width: 100%; max-width: 30px; background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 60%, var(--surface))); border-radius: 5px 5px 0 0; transition: height 0.5s var(--ease-settle), filter 0.15s, transform 0.15s; }
@supports not (background: color-mix(in srgb, red, blue)) { .bar { background: var(--accent); } }
.bar-col.on .bar { filter: brightness(1.12) saturate(1.1); transform: scaleY(1.02); }
.bar-day { font-size: 0.6rem; color: var(--ink-3); font-family: var(--font-mono); margin-top: 5px; white-space: nowrap; }

/* donut / pie charts */
.chart-host { min-height: 200px; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-box { position: relative; flex-shrink: 0; }
.donut-svg { width: 100%; height: 100%; display: block; }
.donut-slice { cursor: pointer; transition: opacity 0.18s var(--ease-settle), transform 0.18s var(--ease-settle); transform-origin: center; transform-box: fill-box; }
.donut-slice:hover { transform: scale(1.04); }
.donut-c-val { font-family: var(--font-mono); font-weight: 600; font-size: 1.25rem; fill: var(--ink); }
.donut-c-lbl { font-family: var(--font-mono); font-size: 0.6rem; fill: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.donut-legend { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 4px; }
.donut-leg { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 8px; font-size: 0.85rem; cursor: pointer; transition: background var(--t-micro); }
.donut-leg:hover, .donut-leg.on { background: var(--bg-2); }
.leg-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.leg-name { color: var(--ink); }
.leg-val { margin-left: auto; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 0.78rem; }
.chart-tip { position: absolute; pointer-events: none; z-index: 20; background: var(--ink); color: var(--bg); font-size: 0.78rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap; box-shadow: var(--shadow-2); line-height: 1.4; }
.chart-tip .muted { color: rgba(255,255,255,0.6); }
.ct-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

.ubar { margin-bottom: 11px; }
.ubar:last-child { margin-bottom: 0; }
.ubar-top { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 4px; }
.ubar-track { height: 7px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.ubar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.5s var(--ease-settle); }

/* --------------------------- RESPONSIVE ------------------------------ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .calc-result { position: static; }
}
/* Keep the hero two-column down to tablets (avoids a tall empty band); stack on phones */
@media (max-width: 700px) {
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero { padding-top: 36px; }
  /* On the stacked layout the absolute scatter overlaps — lay tiles out as a tidy centered row */
  .hero-cluster { min-height: 0; max-width: 300px; margin: 12px auto 0; display: flex; flex-wrap: wrap;
    justify-content: center; align-items: center; gap: 18px; }
  .float-tile { position: static; transform: none; }
  .float-card { --s: 60px; }
}
@media (max-width: 760px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .main-nav { display: none; }
  .nav-toggle { display: grid; }
  .calc-layout { grid-template-columns: 1fr; }
  .doc-layout { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-nav a { margin: 0; }
  .ad-mobile-sticky { display: block; position: fixed; bottom: 0; left: 0; right: 0; margin: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--rule); min-height: 56px; }
  /* mobile sticky result bar for calculators */
  .calc-mobilebar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; background: var(--surface); border-top: 1px solid var(--rule); padding: 11px 18px; align-items: center; justify-content: space-between; box-shadow: 0 -6px 20px rgba(0,0,0,0.06); }
  .calc-mobilebar .cm-label { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
  .calc-mobilebar .cm-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.3rem; font-weight: 500; color: var(--accent); }
}
@media (max-width: 560px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .float-card { --s: 54px; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .doc-paper { padding: 30px 22px; }
}

/* ------------------- MOBILE & TABLET OPTIMIZATION -------------------- */
/* Kill the phantom horizontal scroll from the off-canvas drawer + never let
   anything overflow the page width. overflow-x:clip (not hidden) keeps the
   sticky calc result panel working. */
body { overflow-x: clip; }

/* Headings & intro text must shrink/wrap inside their row, never clip */
.page-head .flex { flex-wrap: wrap; }
.page-head .flex > div { min-width: 0; }
.page-head h1 { min-width: 0; overflow-wrap: break-word; }
.page-head p { max-width: min(70ch, 100%); overflow-wrap: break-word; }
.pdf-drop h4, .pdf-drop p { overflow-wrap: break-word; }
.card { max-width: 100%; }

/* Admin login: center without an auto-sized (max-content) track that overflowed */
.admin-login { display: flex; align-items: center; justify-content: center; }

@media (max-width: 900px) {
  /* Thumb-friendly tap targets */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 42px; padding: 9px 15px; }
  .icon-btn { width: 44px; height: 44px; }
  .nav-toggle, .theme-toggle { width: 44px; height: 44px; }
  .chip { padding: 9px 15px; }
  .drawer a { padding: 15px 12px; }
  .inv-items .inv-del { width: 40px; height: 40px; font-size: 1.2rem; }
  /* Bigger checkboxes + comfortable rows for checklists / compare */
  .doc-check { min-height: 40px; padding: 6px 0; }
  .doc-check input.js-doc { width: 20px; height: 20px; }
  .cmp-check { min-height: 40px; }
  .cmp-check input.js-compare { width: 20px; height: 20px; }
  /* Prevent iOS zoom-on-focus — text controls must render at >=16px */
  .input, .select, .textarea, .mini-num,
  .inv-items .input, .inv-items .select { font-size: 16px; }
  /* Keep the slider value box from pushing the row past the edge */
  .range-field .range-top { gap: 12px; }
  .range-val { flex-shrink: 0; }
  .mini-num { width: 96px; max-width: 42vw; }
  /* Result panel can't exceed available width */
  .calc-inputs, .calc-result { max-width: 100%; }
  .result-head { gap: 10px; }
  .result-main { overflow-wrap: anywhere; }
  /* QR preview shorter empty state on tablet */
  .qr-box { min-height: 220px; }
}

/* GST invoice: scroll wide tables instead of overflowing the page */
.inv-items-wrap, .doc-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.doc-scroll { padding-bottom: 4px; }
@media (max-width: 760px) {
  .inv-items { min-width: 520px; }
  .inv-items td:first-child .input { min-width: 120px; }
  #invPreview { min-width: 560px; }
  .inv-table { font-size: 12px; }
  .inv-table th, .inv-table td { padding: 5px 6px; }
}

/* Phones: stack + shrink the calculator chart, tighten panels, compact modal */
@media (max-width: 560px) {
  .page-head h1 { font-size: clamp(1.5rem, 6.2vw, 1.95rem); }
  .page-head p { font-size: 0.98rem; }
  .result-chart { flex-wrap: wrap; gap: 16px; }
  .chart-svg { width: 120px; height: 120px; }
  .chart-legend { width: 100%; }
  .calc-inputs, .calc-result { padding: 18px; }
  .container { padding-left: 16px; padding-right: 16px; }
  .cmp-modal { padding: 10px; }
  .cmp-panel { padding: 16px; }
  .cmp-table th, .cmp-table td { font-size: 0.82rem; padding: 8px 9px; }
}

@media print {
  .site-header, .site-footer, .ad-slot, .nav-toggle, .theme-toggle, .no-print,
  .page-head, .doc-form, .doc-toolbar, .breadcrumb, .calc-mobilebar { display: none !important; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .doc-layout { display: block; }
  .doc-paper { box-shadow: none; max-width: 100%; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * , *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .reveal, .match-reveal { opacity: 1 !important; transform: none !important; }
  .rule-draw { transform: scaleX(1) !important; }
}
