/* Shared look of the tools: Challan Analyser, TDS Extractor, FS Builder frame, Clients, Account.
   Quiet and compact: system font, hairlines, one accent, no movement beyond a short fade. */
:root {
  /* a softer ground and clearer edges between panels than plain white on near-white */
  --bg: #e9ecef; --surface: #fbfbfc; --surface-2: #f3f5f7; --sunk: #e3e7eb;
  --ink: #15191d; --ink-2: #39424b; --muted: #5f6873; --faint: #8e97a0;
  --line: #d3d8de; --line-2: #e1e5e9;
  --accent: #0e4a63; --accent-ink: #ffffff; --accent-soft: #e6eef2; --link: #0d5b7d;
  --crit: #b42318; --crit-bg: #fbecea; --warn: #8a5300; --warn-bg: #fbf1e1;
  --ok: #1d6b3a; --ok-bg: #e8f3ec; --info: #2d5d86; --info-bg: #eaf0f6;
  /* chart and series colours */
  --tds: #2f6f9f; --adv: #c4682c; --sat: #2b8a63; --other: #6a5aa8; --late: #c0392b; --early: #2f6f9f; --neutral-mark: #c7ccd1; --grid: #edf0f2;
  --good: #2b8a63; --warn-mark: #d9a21b;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
  --r: 6px; --r-sm: 4px; --head: 48px; --ctl: 30px;
  --pop: 0 6px 24px rgba(16, 24, 32, .14);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #101316; --surface: #171b1f; --surface-2: #1c2126; --sunk: #13171a;
  --ink: #e7eaed; --ink-2: #c2c8ce; --muted: #8d969f; --faint: #646d76;
  --line: #2a3036; --line-2: #23292e;
  --accent: #6aaecb; --accent-ink: #0b1418; --accent-soft: #15303b; --link: #7cbad4;
  --crit: #f0857b; --crit-bg: #3a1d1b; --warn: #e3b25c; --warn-bg: #33281a; --ok: #6cc28f; --ok-bg: #16291e; --info: #8db8df; --info-bg: #182633;
  --tds: #5a9fd0; --adv: #e08a52; --sat: #4fb38a; --other: #9a8ce0; --late: #ec7063; --early: #5a9fd0; --neutral-mark: #4a5057; --grid: #22282d;
  --good: #4fb38a; --warn-mark: #d9a21b;
  --pop: 0 8px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 13px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: 0; }
h1 { font-size: 18px; } h2 { font-size: 14px; } h3 { font-size: 13px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.crit { color: var(--crit); } .warn { color: var(--warn); } .ok { color: var(--ok); }

/* ---------- header ---------- */
.hd { position: sticky; top: 0; z-index: 30; height: var(--head); background: var(--surface); border-bottom: 1px solid var(--line); }
.hd-in { height: 100%; display: flex; align-items: center; gap: 10px; padding: 0 20px; max-width: 1440px; margin: 0 auto; }
.hd-logo { font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; }
.hd-logo:hover { text-decoration: none; }
.hd-logo b { color: #1d4ed8; font-weight: 700; }
:root[data-theme="dark"] .hd-logo b { color: #7aa2ff; }
.hd-sep { color: var(--faint); }
.hd-tool { font-weight: 600; color: var(--ink); white-space: nowrap; }
a.hd-tool { color: var(--ink); }
.hd-ctx { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hd-end { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.hd-status { color: var(--muted); font-size: 12px; white-space: nowrap; margin-right: 4px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--ctl); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; font-size: 13px; line-height: 1; text-decoration: none; }
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--sunk); }
.btn.icon { width: var(--ctl); padding: 0; }
.btn i { font-size: 15px; }
.link { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font-size: inherit; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--crit); }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
  height: var(--ctl); padding: 0 9px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); max-width: 100%; }
textarea { height: auto; padding: 7px 9px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin-right: auto; }
.blank { text-align: center; padding: 56px 20px; color: var(--muted); }
.blank h2 { color: var(--ink); font-size: 15px; margin-bottom: 12px; }
.blank .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- tables ---------- */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line-2); white-space: nowrap; vertical-align: middle; }
th { font-weight: 500; color: var(--muted); font-size: 12px; background: var(--surface); }
td.r, th.r { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); background: var(--surface); padding: 0 20px; overflow-x: auto; }
.tabs button, .tabs a { border: 0; background: none; padding: 11px 10px 10px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 13px; }
.tabs button:hover, .tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs .on, .tabs [aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.tabs .count { color: var(--crit); font-size: 11px; margin-left: 4px; }

/* ---------- small status marks ---------- */
.mark { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.mark::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- dialogs, menus, toast ---------- */
.hy-modal { position: fixed; inset: 0; z-index: 300; background: rgba(16, 20, 24, .42); display: grid; place-items: center; padding: 16px; }
.hy-modal > form, .hy-modal > .dlg { width: min(420px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); color: var(--ink);
  border-radius: 8px; box-shadow: var(--pop); padding: 20px; display: grid; gap: 12px; font-size: 13px; }
.hy-modal .wide { width: min(600px, 100%); }
@media (prefers-reduced-motion: no-preference) {
  .hy-modal, .pop, .menu { animation: hy-fade .1s ease-out; }
}
@keyframes hy-fade { from { opacity: 0; } to { opacity: 1; } }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 400; background: var(--ink); color: var(--bg);
  padding: 8px 14px; border-radius: var(--r-sm); font-size: 12.5px; max-width: min(560px, calc(100vw - 32px)); display: flex; gap: 14px; align-items: center; }
.toast .link { color: var(--bg); text-decoration: underline; }

@media (max-width: 640px) {
  .hd-in { padding: 0 12px; }
  .hd-ctx, .hd-status { display: none; }
  .btn .lbl { display: none; }
}
