/* FASTag Statement Portal
 *
 * Colour roles come from a validated palette: the two bank identity colours are
 * categorical slots 1 (blue) and 2 (orange), assigned in fixed order and always
 * shown next to the bank's name, so identity is never carried by colour alone.
 * Status colours (good / warning / critical) are reserved for transaction state
 * and always ship with a text label.
 */

:root {
  color-scheme: light;

  --surface-1:      #fcfcfb;   /* cards */
  --page-plane:     #f9f9f7;   /* page background */
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --hairline:       #e1e0d9;
  --border-ring:    rgba(11, 11, 11, 0.10);
  --baseline:       #c3c2b7;

  --bank-axis:      #2a78d6;   /* categorical slot 1 */
  --bank-icici:     #eb6834;   /* categorical slot 2 */

  --status-good:    #0ca30c;
  --status-warning: #fab219;
  --status-critical:#d03b3b;
  --success-text:   #006300;

  --accent:         #2a78d6;
  --accent-ink:     #ffffff;
  --wash:           rgba(42, 120, 214, 0.08);

  --radius:   10px;
  --radius-sm: 6px;
  --shadow:   0 1px 2px rgba(11, 11, 11, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --surface-1:      #1a1a19;
    --page-plane:     #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --hairline:       #2c2c2a;
    --border-ring:    rgba(255, 255, 255, 0.10);
    --baseline:       #383835;

    --bank-axis:      #3987e5;   /* same slots, stepped for the dark surface */
    --bank-icici:     #d95926;

    --success-text:   #0ca30c;

    --accent:         #3987e5;
    --accent-ink:     #0d0d0d;
    --wash:           rgba(57, 135, 229, 0.14);

    --shadow:         0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only a UA-stylesheet `display: none`, so any author
 * rule that sets `display` silently defeats it -- `.btn` did exactly that, and
 * the download links showed up before a search with no href to follow. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- masthead ---------- */

.masthead {
  background: var(--surface-1);
  border-bottom: 1px solid var(--hairline);
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-block: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.masthead h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-sub {
  margin: 1px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.bank-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--border-ring);
  border-radius: 999px;
  background: var(--surface-1);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.chip-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  flex: none;
}

.chip-axis .chip-dot, .chip-dot-axis { background: var(--bank-axis); }
.chip-icici .chip-dot, .chip-dot-icici { background: var(--bank-icici); }

/* ---------- cards ---------- */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-ring);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.search-card { margin-top: 24px; }

/* ---------- form ---------- */

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field-inline { flex-direction: row; align-items: center; }

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.req { color: var(--status-critical); }

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}

input[type="text"], input[type="date"], input[type="time"],
input[type="number"], input[type="search"], select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--baseline);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
}

input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input::placeholder { color: var(--text-muted); }

.banks-field {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.banks-field legend { padding: 0; margin-bottom: 6px; }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox input { accent-color: var(--accent); }

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary[disabled] { opacity: 0.6; cursor: progress; }

.btn-ghost {
  background: transparent;
  border-color: var(--baseline);
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--wash); }

.samples {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.sample-list { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.sample {
  padding: 3px 9px;
  border: 1px solid var(--border-ring);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.sample:hover { background: var(--wash); }

.alert {
  margin: 16px 0 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.alert-error {
  border: 1px solid var(--status-critical);
  background: transparent;
  color: var(--text-primary);
}

.alert-error::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 17px; height: 17px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--status-critical);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  vertical-align: -3px;
}

/* ---------- account header ---------- */

.account-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.account-vehicle {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.account-name { margin: 2px 0 0; color: var(--text-secondary); }

.account-meta { font-size: 13px; text-align: right; }
.account-meta p { margin: 0 0 4px; }

.meta-key {
  display: inline-block;
  min-width: 90px;
  color: var(--text-muted);
}

.account-meta .chip { margin-left: 4px; padding: 2px 9px; font-size: 12px; }

/* ---------- stat tiles ---------- */

.stat-row {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 1000px) {
  .stat-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

.stat-tile { margin-bottom: 0; display: flex; flex-direction: column; }

.stat-label {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Proportional figures on purpose: tabular-nums looks loose at display sizes. */
.stat-value {
  margin: 8px 0 0;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-value-hero { font-size: 48px; }

.stat-sub {
  margin: auto 0 0;
  padding-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- bank breakdown ---------- */

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.breakdown-item {
  border: 1px solid var(--border-ring);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.breakdown-item[data-bank="AXIS"]  { border-left-color: var(--bank-axis); }
.breakdown-item[data-bank="ICICI"] { border-left-color: var(--bank-icici); }

.breakdown-bank {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 650;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 3px 0;
}

.breakdown-row span:first-child { color: var(--text-secondary); }
.breakdown-row span:last-child { font-variant-numeric: tabular-nums; }

/* ---------- table ---------- */

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.table-head .card-title { margin: 0; }

.count-pill {
  margin-left: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--wash);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.table-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.table-filters select, .table-filters input { width: auto; min-width: 150px; }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}

.txn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.txn-table th {
  position: sticky;
  top: 0;
  background: var(--surface-1);
  text-align: left;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}

.txn-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text-primary);
}

.txn-table tbody tr:last-child td { border-bottom: 0; }
.txn-table tbody tr:hover { background: var(--wash); }

/* Columns of numbers align vertically, so these do get tabular figures. */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.dim { color: var(--text-secondary); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }

.bank-cell { display: inline-flex; align-items: center; gap: 7px; }

.amount-debit::before  { content: "\2212\A0"; }  /* minus */
.amount-credit::before { content: "+\A0"; }
.amount-credit { color: var(--success-text); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-success::before  { background: var(--status-good); }
.status-failed::before   { background: var(--status-critical); }
.status-pending::before  { background: var(--status-warning); }

.empty-note {
  margin: 16px 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- format map ---------- */

.format-card summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 15px;
}

.format-map {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.format-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.format-table caption {
  text-align: left;
  font-weight: 650;
  font-size: 13px;
  padding-bottom: 8px;
}

.format-table th, .format-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

.format-table th { color: var(--text-muted); font-weight: 600; }
.format-table td { color: var(--text-secondary); }

.disclaimer {
  margin: 28px 0 40px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* First-run state: the portal holds nothing until the admin console fills it. */
.notice-empty {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border-ring);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--wash);
  font-size: 14px;
  color: var(--text-secondary);
}

.notice-empty a { color: var(--accent); }
