/* ================= Tokens (light) ================= */
:root {
  /* Palette derived from the Chughtai Lab logo blue #2C3890 (hue 233) */
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --ink: #161b3d;            /* navy text with a hint of logo blue */
  --ink-2: #3d4466;
  --muted: #6e7593;
  --line: #e4e6f0;
  --line-2: #d4d8e6;
  --brand: #2c3890;          /* logo blue: buttons, key figures */
  --brand-hover: #232d78;
  --brand-2: #4654c0;        /* lighter logo blue: small labels, tags */
  --accent-grad: linear-gradient(135deg, #4a58c4 0%, #2c3890 58%, #222b72 100%);
  --brand-soft: #eef0fa;     /* tints for backgrounds */
  --brand-tint: #f3f4fc;
  --brand-line: #d9ddf3;
  --teal-soft: #eef0fa;
  --error: #c62828;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(22, 27, 61, .05);
  --shadow: 0 1px 2px rgba(22, 27, 61, .04), 0 8px 24px -12px rgba(22, 27, 61, .12);
  --shadow-lg: 0 2px 4px rgba(22, 27, 61, .04), 0 24px 60px -24px rgba(44, 56, 144, .30);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}


* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden;
}
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2 { margin: 0; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.r { text-align: right; }

/* ================= Background (login only shows the full effect) ================= */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.orb { position: absolute; border-radius: 50%; filter: blur(100px); opacity: .55; animation: drift 24s ease-in-out infinite alternate; }
.o1 { width: 560px; height: 560px; background: #cdd3f6; top: -220px; left: -160px; }
.o2 { width: 620px; height: 620px; background: #d6dcf7; bottom: -300px; right: -200px; animation-delay: -8s; }
.o3 { width: 360px; height: 360px; background: #e4e1f7; top: 35%; left: 58%; opacity: .35; animation-delay: -14s; }
@keyframes drift { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(50px, 30px) scale(1.1); } }
.gridlines { position: absolute; inset: 0;
  background-image: linear-gradient(rgba(44,56,144,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(44,56,144,.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 75% 65% at 50% 40%, #000 25%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 40%, #000 25%, transparent 80%); }
body.in-app .orb, body.in-app .gridlines { display: none; }
body.in-app .bg { background: linear-gradient(180deg, #eef0f8 0, var(--bg) 320px); }
@media (prefers-reduced-motion: reduce) { .orb { animation: none; } }

/* ================= Surfaces ================= */
.glass, .card-surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--brand-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-2); box-shadow: 0 0 0 4px rgba(70,84,192,.15);
  animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(70,84,192,.05); } }

/* ================= Brand ================= */
.brandmark img { display: block; width: 96px; height: 96px; border-radius: 20px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255,255,255,.7), 0 14px 34px -10px rgba(37,56,170,.45); }
.brandmark.sm img { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 4px 12px -4px rgba(37,56,170,.4); }
.adv-brand { display: flex; align-items: center; gap: 16px; }
.adv-logo { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; }
.company-line { font-weight: 600; font-size: 15px; color: var(--ink-2); }
.company-line.sm { font-size: 13.5px; color: var(--ink); font-weight: 700; }
.company-line .sep { color: var(--line-2); margin: 0 7px; }
.company-line .ntn { color: var(--brand); font-family: var(--mono); font-size: .9em; white-space: nowrap; }
.product { font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--brand-2); }
.grad { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ================= Login ================= */
.login { flex: 1; display: grid; grid-template-columns: 1.15fr 1fr; gap: 64px; align-items: center;
  max-width: 1180px; width: 100%; margin: 0 auto; padding: 56px 32px; }
.login-brand { display: flex; flex-direction: column; gap: 18px; animation: rise .7s ease both; }
.hero { font-size: clamp(36px, 4.6vw, 58px); line-height: 1.05; font-weight: 800; margin-top: 6px; color: var(--ink); }
.lead { color: var(--ink-2); font-size: 16.5px; max-width: 480px; margin: 0; }
.features { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 14px; }
.features li { display: flex; gap: 14px; align-items: flex-start; }
.features b { display: block; font-weight: 700; font-size: 14.5px; }
.features span:not(.fi) { color: var(--muted); font-size: 13.5px; }
.fi { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--brand);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }

.login-card { position: relative; padding: 38px 36px 26px; overflow: hidden; box-shadow: var(--shadow-lg); animation: rise .7s .12s ease both;
  background: rgba(255,255,255,.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.login-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent-grad); }
.card-glow { display: none; }
.login-card h2 { font-size: 28px; margin: 12px 0 6px; }
.login-card > p.muted { margin: 0 0 26px; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px; }
.card-foot svg { width: 15px; height: 15px; color: var(--brand-2); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ================= Forms ================= */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .ic { position: absolute; left: 14px; color: var(--muted); pointer-events: none; transition: color .2s; }
input { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 12px; padding: 12px 14px; outline: none; transition: border-color .2s, box-shadow .2s; }
.input-wrap input { padding-left: 44px; padding-right: 44px; height: 50px; }
input::placeholder { color: #9aa5b8; }
input:hover { border-color: #b8bed6; }
input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(44,56,144,.14); }
.input-wrap:focus-within .ic { color: var(--brand); }
.eye { position: absolute; right: 8px; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent;
  color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.eye:hover, .eye.on { color: var(--brand); background: var(--brand-soft); }
.hint { color: #b45309; font-size: 12.5px; margin: 6px 0 0; }
.error { color: var(--error); font-size: 13.5px; margin: 14px 0 0; padding: 10px 12px; border-radius: 10px;
  background: #fdecec; border: 1px solid #f6c9c9; }
.meter { height: 4px; border-radius: 4px; background: var(--line); margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .25s, background .25s; }

/* ================= Buttons ================= */
.btn { font: inherit; font-weight: 600; cursor: pointer; border-radius: 12px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, color .2s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.primary { color: #fff; background: var(--accent-grad); background-size: 160% 160%;
  box-shadow: 0 8px 20px -8px rgba(44,56,144,.45); }
.btn.primary:hover { background-position: 100% 0; background-color: var(--brand-hover); box-shadow: 0 12px 28px -10px rgba(44,56,144,.55); }
.btn.ghost { color: var(--ink-2); background: var(--surface); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; height: 52px; font-size: 15.5px; margin-top: 6px; }
.btn .arrow { transition: transform .2s; }
.btn:hover .arrow { transform: translateX(4px); }
.btn .spinner { display: none; }
.btn.busy { pointer-events: none; opacity: .85; }
.btn.busy .spinner { display: inline-block; }
.btn.busy .arrow { display: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite; }
.spinner.big { width: 34px; height: 34px; border-color: #dbe4f3; border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ================= App shell (after sign-in): simple & clean ================= */
.appbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap; padding: 12px 32px; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.appbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent-grad); opacity: .85; }
.appbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.appbar-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vendor-chip { display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-size: 13.5px; max-width: 340px; }
.vendor-chip #vendorName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  color: #fff; background: var(--accent-grad); flex: none; }
.app { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 32px; }
.app > section:not([hidden]) { animation: rise .35s ease both; }
.center-wrap { display: grid; place-items: center; min-height: 60vh; }
.card { padding: 32px; }
.narrow { width: 100%; max-width: 460px; }
.card h2 { font-size: 24px; margin: 10px 0 6px; }
.card > p.muted { margin: 0 0 22px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { font-size: 26px; font-weight: 800; margin: 0 0 4px; }
.page-head p { margin: 0; font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 0; background: none; border: 0; box-shadow: none; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field.grow { min-width: 190px; }
.filters label { font-size: 12px; margin-bottom: 5px; }
.filters input { height: 42px; padding: 9px 12px; }
.filters .btn { height: 42px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi.accent { background: linear-gradient(135deg, var(--brand-tint), var(--brand-soft)); border-color: var(--brand-line); }
.k-label { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.k-val { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--ink); }
.kpi.accent .k-val { color: var(--brand); }

/* ================= WHT certificate ================= */
.wht-card { display: flex; align-items: center; gap: 16px; padding: 14px 16px 14px 14px; margin-bottom: 18px; text-decoration: none; color: inherit;
  background: linear-gradient(100deg, var(--brand-tint), #fff 60%); border-color: var(--brand-line); transition: box-shadow .2s, border-color .2s, transform .15s; }
.wht-card:hover { border-color: #b9c0ea; box-shadow: var(--shadow-lg); }
.wht-card:hover .wht-btn svg { transform: translate(2px, -2px); }
.wht-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; background: var(--accent-grad);
  box-shadow: 0 6px 16px -6px rgba(44,56,144,.55); }
.wht-ic svg { width: 20px; height: 20px; }
.wht-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wht-text b { font-size: 14.5px; color: var(--ink); }
.wht-text span { font-size: 13px; color: var(--muted); }
.wht-btn { flex: none; }
.wht-btn svg { width: 15px; height: 15px; transition: transform .15s; }
.wht-link { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  color: var(--ink-2); text-decoration: none; background: var(--brand-tint); border: 1px solid var(--brand-line); transition: border-color .2s, color .2s; }
.wht-link b { color: var(--brand); }
.wht-link svg { width: 16px; height: 16px; color: var(--brand); }
.wht-link:hover { border-color: var(--brand-2); }
@media (max-width: 640px) {
  .wht-card { flex-wrap: wrap; }
  .wht-btn { width: 100%; }
}

/* ================= Tables ================= */
.table-card { padding: 0; overflow: hidden; }
.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th, .grid td { padding: 13px 16px; white-space: nowrap; text-align: left; }
.grid th { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--line); }
.grid td { border-bottom: 1px solid var(--line); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid th.r, .grid td.r { text-align: right; font-variant-numeric: tabular-nums; }
.grid .c { text-align: center; }
.grid .mono { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.grid .net { font-weight: 700; color: var(--ink); }
.grid .chev { color: #a8b3c7; width: 28px; padding-left: 0; }
#tblPayments tbody tr[data-id] { cursor: pointer; transition: background .15s; }
#tblPayments tbody tr[data-id]:hover { background: var(--brand-tint); }
#tblPayments tbody tr[data-id]:hover .chev { color: var(--brand); }
#tblPayments tbody tr[data-id]:hover .chev svg { transform: translateX(3px); }
#tblPayments tbody tr[data-id]:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.chev svg { transition: transform .15s; }
.grid tfoot td { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 0; background: var(--surface-2); }
.inv-count { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 24px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--brand); background: var(--brand-soft); }
.mode { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px;
  color: var(--brand-2); background: var(--teal-soft); }
.empty td { text-align: center; color: var(--muted); padding: 44px 14px; }
.skeleton td span { display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, #eff0f6, #e3e6f1, #eff0f6); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ================= Advice ================= */
.advice-actions { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.advice { padding: 34px; position: relative; overflow: hidden; }
.advice::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent-grad); }
.advice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap;
  padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.adv-company { font-weight: 700; font-size: 14.5px; color: var(--ink-2); }
.adv-company .ntn { color: var(--brand); font-family: var(--mono); }
.adv-company .sep { color: var(--line-2); margin: 0 7px; }
.adv-title { font-size: 28px; font-weight: 800; margin-top: 6px; }
.adv-sub { margin-top: 4px; font-size: 13.5px; }
.adv-amount { text-align: right; display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-tint), var(--brand-soft)); border: 1px solid var(--brand-line); }
.adv-net { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; color: var(--brand); }
.meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.meta div { padding: 12px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.meta div:nth-child(4n) { border-right: 0; }
.meta div:nth-last-child(-n+4) { border-bottom: 0; }
.meta dt { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 3px; }
.meta dd { margin: 0; font-weight: 600; font-size: 14px; }
.lines-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.lines-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.lines-wrap { border: 1px solid var(--line); border-radius: 12px; }
.lines th, .lines td { padding: 10px 12px; }
.lines td { font-size: 13.5px; }
.lines th { white-space: normal; line-height: 1.3; }
.lines td.cat { white-space: normal; min-width: 130px; max-width: 190px; color: var(--ink-2); font-size: 12.5px; }
.lines tbody tr:nth-child(even) td { background: #fbfcfe; }
.adv-foot { margin: 20px 0 0; line-height: 1.6; }

/* ================= Misc ================= */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 22px 16px 26px; }

/* ================= Responsive ================= */
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; gap: 36px; padding: 36px 20px; max-width: 560px; }
  .features { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .meta { grid-template-columns: repeat(2, 1fr); }
  .meta div:nth-child(4n) { border-right: 1px solid var(--line); }
  .meta div:nth-child(2n) { border-right: 0; }
  .meta div:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .meta div:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 640px) {
  .login { padding: 24px 16px; }
  .login-card { padding: 28px 20px 20px; }
  .hero { font-size: 34px; }
  .lead { font-size: 15px; }
  .appbar { padding: 10px 16px; }
  .appbar-user { width: 100%; }
  .vendor-chip { flex: 1; min-width: 0; }
  .app { padding: 20px 16px; }
  .page-title { font-size: 22px; }
  .filters { width: 100%; }
  .filters .field { flex: 1 1 130px; min-width: 0; }
  .filters .btn { width: 100%; }
  .kpis { gap: 10px; }
  .kpi { padding: 12px 14px; }
  .k-val { font-size: 17px; }
  .advice { padding: 20px; }
  .adv-amount { text-align: left; width: 100%; }
  .adv-title { font-size: 22px; }
  .adv-logo { width: 48px; height: 48px; }
  .brandmark img { width: 76px; height: 76px; border-radius: 16px; }
  .adv-net { font-size: 26px; }
}

/* ================= Print: clean A4 document ================= */
@media print {
  body { background: #fff; color: #111; font-size: 10.5px; display: block; }
  .no-print, .bg, .boot, .foot, .appbar { display: none !important; }
  .app { padding: 0; max-width: none; }
  .glass { border: 0; box-shadow: none; }
  .advice { padding: 0; }
  .advice::before { display: none; }
  .advice-head { border-bottom: 2px solid #111; }
  .adv-amount { background: #fff; border: 1px solid #999; }
  .adv-logo { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .adv-net, .adv-company .ntn { color: #111; }
  .meta { border-color: #bbb; }
  .meta div { border-color: #bbb !important; padding: 6px 8px; }
  .lines-wrap { border: 0; }
  .grid th { background: #eee !important; color: #111; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .grid th, .grid td { padding: 4px 6px; white-space: normal; border-bottom: 1px solid #ccc; }
  .lines tbody tr:nth-child(even) td { background: #fff; }
  .grid thead { display: table-header-group; }   /* repeat headings on every printed page */
  .grid tr { break-inside: avoid; }
  .grid tfoot td { background: #f3f3f3 !important; border-top: 2px solid #111; }
  @page { size: A4 landscape; margin: 12mm; }
}
