/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--glass-border);
}
.site-header::after {
  content: ''; position: absolute; inset: 0;
  background: var(--bg-mesh); opacity: 0.5; pointer-events: none;
}
.site-header__inner {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: var(--space-4);
  height: 64px;
}
.logo {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 600; font-size: 22px; letter-spacing: 0em;
  color: var(--text); text-decoration: none !important;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.logo:hover { opacity: 0.82; text-decoration: none !important; }
.logo__mark {
  width: 32px; height: 32px;
}
.logo span { display: inline-flex; align-items: baseline; }
.logo__paisa { color: var(--brand); }
.logo__finder { color: var(--warning); }
.site-nav { display: flex; gap: var(--space-5); margin-left: var(--space-6); }
.site-nav a { color: var(--text-muted); font-weight: 500; font-size: var(--fs-sm); }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: var(--space-5); padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: var(--fs-sm);
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.back-link:hover { color: var(--text); background: var(--bg-muted); text-decoration: none; }
.header-spacer { flex: 1; }
.header-actions { display: flex; gap: var(--space-2); align-items: center; }

@media (max-width: 560px) {
  .site-header__inner { gap: var(--space-2); }
  .back-link { margin-left: 0; padding: 6px; }
  .back-link span { display: none; }
  .header-actions { gap: 6px; }
}

@media (max-width: 720px) {
  .site-nav { display: none; }
}

/* Icon button */
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text); cursor: pointer;
  display: grid; place-items: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--bg-elev); }
.icon-btn svg { width: 18px; height: 18px; }

/* Button */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-weight: 500; font-size: var(--fs-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
  background: var(--brand-grad);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-brand-sm);
}
.btn-primary:hover {
  background: var(--brand-grad);
  filter: brightness(1.05);
  box-shadow: var(--shadow-brand);
}
.btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-elev); }
.btn-ghost {
  background: transparent; color: var(--text-subtle);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); background: var(--bg-muted); border-color: var(--border-strong); }
.btn svg { width: 16px; height: 16px; }
@media (max-width: 560px) {
  #saveImageBtn span { display: none; }
  #saveImageBtn { padding: 10px; }
}

/* Card */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover { 
  box-shadow: var(--shadow-md); 
  transform: translateY(-2px);
}
.card-tight { padding: var(--space-4); }
.card-lg { padding: var(--space-8); }

/* Input + slider */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-3);
}
.field-label { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.field-hint { font-size: var(--fs-xs); color: var(--text-subtle); }
.field-value-wrap {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-muted); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 12px;
  transition: all var(--transition-fast);
  min-height: 40px;
}
.field-value-wrap:focus-within {
  background: var(--bg-card);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}
.field-prefix, .field-suffix {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-subtle); font-weight: 500;
}
.field-value {
  width: 9ch; padding: 0; background: transparent; border: 0;
  font-family: var(--font-mono); font-size: var(--fs-base);
  font-weight: 500; text-align: right; outline: 0;
  font-variant-numeric: tabular-nums; color: var(--text);
  -moz-appearance: textfield;
}
.field-value::-webkit-outer-spin-button,
.field-value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field-value.is-invalid {
  color: var(--danger);
}
.field-error {
  color: var(--danger);
  font-size: 11px;
  font-weight: 500;
  margin-top: -2px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Slider */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: var(--radius-full);
  background: var(--bg-muted);
  outline: none; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: var(--radius-full);
  background: linear-gradient(to right, var(--brand) var(--_pct, 0%), var(--bg-muted) var(--_pct, 0%));
}
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: var(--radius-full); background: var(--bg-muted);
}
input[type="range"]::-moz-range-progress {
  height: 6px; border-radius: var(--radius-full); background: var(--brand);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand);
  margin-top: -8px; cursor: pointer;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 6px var(--accent-ring);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand); cursor: pointer;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

/* Tag / chip */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-full);
  background: var(--bg-muted); color: var(--text-muted);
  font-size: var(--fs-xs); font-weight: 600;
}
.chip-brand { background: var(--brand-50); color: var(--brand-600); }

/* Table */
.table-wrap {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}
.table-scroll::-webkit-scrollbar { height: 4px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.table-wrap .table-fade {
  display: none;
  position: absolute;
  right: 0; top: 0; bottom: 0; width: 32px;
  background: linear-gradient(to right, transparent, var(--bg-card));
  pointer-events: none; z-index: 2;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.table-wrap.has-scroll .table-fade { display: block; }
.table-wrap.scrolled-end .table-fade { display: none; }
.table-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  gap: 12px;
}
.table-header__left {
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.table-header h3 {
  font-size: var(--fs-base); font-weight: 600; margin: 0;
  letter-spacing: -0.01em; color: var(--text);
}
.table-header .table-hint {
  font-size: var(--fs-xs); color: var(--text-subtle); font-weight: 400;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-sm svg { width: 14px; height: 14px; }
table.pf-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
table.pf-table th {
  text-align: right; padding: 10px 16px;
  font-weight: 600; color: var(--text-subtle);
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--bg-muted); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; white-space: nowrap;
}
table.pf-table td {
  padding: 12px 16px; text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap;
  font-size: 13px;
}
table.pf-table th:first-child, table.pf-table td:first-child { text-align: left; }
table.pf-table td:first-child { font-family: var(--font-sans); font-weight: 500; color: var(--text); }
table.pf-table tr:last-child td { border-bottom: 0; }
table.pf-table tbody tr:hover td { background: var(--bg-muted); }

/* Sticky first column on small screens */
@media (max-width: 720px) {
  table.pf-table th:first-child,
  table.pf-table td:first-child {
    position: sticky; left: 0; z-index: 1;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
  }
  table.pf-table th:first-child { background: var(--bg-muted); }
  table.pf-table .pf-table__child-row td:first-child { background: var(--bg-soft); }
  table.pf-table .pf-table__group-row:hover td:first-child,
  table.pf-table tbody tr:hover td:first-child { background: var(--bg-muted); }

  table.pf-table th { padding: 8px 10px; font-size: 10px; }
  table.pf-table td { padding: 10px; font-size: 12px; }
  table.pf-table th:first-child, table.pf-table td:first-child { padding-left: 36px; }
  .table-header { padding: 12px 14px; }
  .table-header__left .table-hint { display: none; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }
}

/* Collapsible Table */
.pf-table__group-row {
  cursor: pointer;
  background: var(--bg-card);
}
.pf-table__group-row td {
  font-weight: 500;
  color: var(--text);
  border-top: 1px solid var(--border);
}
.pf-table__group-row:hover td {
  background: var(--bg-muted);
}
.pf-table__toggle {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--text-subtle);
  transition: transform var(--transition-fast), color var(--transition-fast);
}
@media (max-width: 720px) {
  .pf-table__toggle { left: 8px; }
}
.pf-table__group-row[data-expanded="true"] .pf-table__toggle {
  transform: translateY(-50%) rotate(90deg);
  color: var(--brand);
}
.pf-table__child-row td {
  background: var(--bg-soft);
  color: var(--text-subtle);
  font-size: 12.5px;
}
.pf-table__child-row td:first-child {
  padding-left: 48px !important;
  color: var(--text-muted);
}
@media (max-width: 720px) {
  .pf-table__child-row td:first-child { padding-left: 36px !important; }
  .pf-table__child-row td { font-size: 11.5px; }
}
.pf-table__child-row:hover td {
  background: var(--bg-muted);
}


/* KPI */
.kpi-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
  margin-top: var(--space-5);
}
.kpi {
  background: var(--bg-card);
  padding: 14px 16px;
}
.kpi-label {
  font-size: 11px; color: var(--text-subtle); text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 600; margin-bottom: 6px; display: block;
}
.kpi-value {
  font-family: var(--font-mono); font-size: 18px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--text-muted); letter-spacing: -0.01em;
}
.kpi-c1 .kpi-value { color: var(--chart-1); }
.kpi-c2 .kpi-value { color: var(--chart-2); }
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 15px; }
  .kpi-label { font-size: 10px; letter-spacing: 0.04em; }
}

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  padding: 10px 18px; border-radius: var(--radius-full);
  background: var(--text); color: var(--text-inverse);
  font-size: var(--fs-sm); font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 100;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Footer */
.site-footer {
  margin-top: var(--space-16); padding: var(--space-10) 0;
  border-top: 1px solid var(--border); background: var(--bg-elev);
}
.site-footer--compact { margin-top: var(--space-16); padding: 0; background: transparent; border-top: 0; }
.site-footer--compact .site-footer__inner-simple {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-6) var(--space-5);
  gap: var(--space-4); flex-wrap: wrap;
  font-size: var(--fs-sm); color: var(--text-subtle);
  border-top: 1px solid var(--border);
}
.site-footer--compact .footer-note { flex: 1; text-align: center; min-width: 200px; }
.footer-links {
  display: flex; gap: var(--space-4); flex-wrap: wrap;
  flex: 1; justify-content: center;
  font-size: var(--fs-sm);
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}
.footer-links a:hover { color: var(--brand); }
@media (max-width: 640px) {
  .site-footer--compact .site-footer__inner-simple {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-5);
    padding: var(--space-8) var(--space-5);
  }
  .footer-links {
    width: 100%;
    justify-content: center;
    gap: var(--space-3) var(--space-5);
    order: -1; /* Links on their own row at the top */
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
  }
  .footer-year {
    font-size: 12px;
    margin-top: -4px;
  }
}
.site-footer__inner { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: var(--space-8); }
.site-footer h4 { font-size: var(--fs-sm); font-weight: 700; margin-bottom: var(--space-3); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: var(--space-2); }
.site-footer a { color: var(--text-muted); font-size: var(--fs-sm); }
.site-footer__legal {
  margin-top: var(--space-8); padding-top: var(--space-6); border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; color: var(--text-subtle); font-size: var(--fs-xs);
}
@media (max-width: 720px) {
  .site-footer__inner { grid-template-columns: 1fr 1fr; }
  .site-footer__legal { flex-direction: column; gap: var(--space-2); }
}

/* Search */
.search-box {
  position: relative;
  width: 100%;
}
.search-input {
  width: 100%; padding: 14px 14px 14px 44px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-card); color: var(--text);
  font-size: var(--fs-base); outline: 0;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-subtle); pointer-events: none;
}

/* PWA "Get App" header button */
.pf-get-app-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 18px;
  border: 0; border-radius: var(--radius-full);
  background: var(--brand-grad);
  color: #fff;
  font-weight: 600; font-size: 13px;
  cursor: pointer;
  box-shadow: var(--shadow-brand-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  white-space: nowrap;
}
.pf-get-app-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: var(--shadow-brand);
}
.pf-get-app-btn:active {
  transform: translateY(0) scale(0.97);
}
.pf-get-app-btn svg { flex-shrink: 0; }
@media (max-width: 380px) {
  .pf-get-app-btn span { display: none; }
  .pf-get-app-btn { padding: 8px; border-radius: var(--radius-sm); }
}

/* iOS install modal overlay */
.pf-ios-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.pf-ios-overlay.is-visible { opacity: 1; }

.pf-ios-sheet {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding: 24px 24px 28px;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.22, 0.68, 0, 1);
}
.pf-ios-overlay.is-visible .pf-ios-sheet {
  transform: translateY(0);
}

.pf-ios-sheet__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.pf-ios-sheet__header strong {
  font-size: 18px; font-weight: 700; color: var(--text);
}
.pf-ios-close {
  border: 0; background: var(--bg-muted);
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 20px; line-height: 1;
  color: var(--text-muted); cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s ease;
}
.pf-ios-close:hover { background: var(--border); color: var(--text); }

.pf-ios-sheet__subtitle {
  font-size: 13.5px; color: var(--text-muted); line-height: 1.45;
  margin: 0 0 20px;
}

.pf-ios-steps {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 16px;
  counter-reset: step;
}
.pf-ios-steps li {
  display: flex; align-items: flex-start; gap: 14px;
  counter-increment: step;
}
.pf-ios-step-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg-muted);
  display: grid; place-items: center;
  color: var(--brand);
  position: relative;
}
.pf-ios-step-icon::after {
  content: counter(step);
  position: absolute; top: -5px; right: -5px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}
.pf-ios-steps li > div { min-width: 0; }
.pf-ios-steps li > div strong {
  display: block; font-size: 14px; font-weight: 600;
  color: var(--text); margin-bottom: 2px;
}
.pf-ios-steps li > div span {
  font-size: 12.5px; color: var(--text-subtle); line-height: 1.4;
}

.pf-ios-sheet__footer {
  margin-top: 20px; padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px; color: var(--text-subtle); font-weight: 500;
}

/* Desktop: center the modal */
@media (min-width: 600px) {
  .pf-ios-overlay { align-items: center; }
  .pf-ios-sheet {
    border-radius: 20px;
    max-height: 90vh; overflow-y: auto;
  }
}

/* Tabs */
.tabs { display: inline-flex; gap: 4px; background: var(--bg-muted); padding: 4px; border-radius: var(--radius-full); }
.tab {
  padding: 8px 16px; border-radius: var(--radius-full); border: 0; background: transparent;
  font-weight: 500; font-size: var(--fs-sm); color: var(--text-muted); cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.tab[aria-selected="true"] { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow-sm); }
