:root {
  --bg: #08090a;
  --bg-card: #121315;
  --bg-card-raised: #17181b;
  --border: rgba(237, 237, 240, 0.09);
  --border-strong: rgba(237, 237, 240, 0.16);
  --text: #ededf0;
  --text-dim: #8b8b93;
  --lime: #c8ff3c;
  --lime-dim: #8fb82b;
  --green: #34d399;
  --blue: #6fa8dc;
  --grid-line: rgba(200, 255, 60, 0.035);
  --font-display: 'Space Grotesk', 'Hind Siliguri', sans-serif;
  --font-body: 'Hind Siliguri', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 20%, black 40%, transparent 90%);
}

.hidden { display: none !important; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Small chevron accent used before panel headings — echoes the brand mark */
.head-chevron {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  background: var(--lime);
  clip-path: polygon(100% 0, 100% 100%, 0 50%);
  vertical-align: middle;
}

/* ===================== LOGIN SCREEN ===================== */
.login-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 52px 44px 44px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}

.corner-mark {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--lime);
  opacity: 0.8;
}
.corner-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.corner-br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.login-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-bottom: 18px;
}

.login-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
  color: #fff;
}

.login-tag {
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--lime);
  margin: 0 0 20px;
}

.login-sub {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.65;
  margin: 0 0 32px;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--lime);
  color: #0a0a0a;
  border: none;
  border-radius: 4px;
  padding: 13px 22px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-google:hover {
  transform: translateY(-1px);
  background: #d4ff5e;
  box-shadow: 0 10px 28px rgba(200, 255, 60, 0.22);
}

.login-error {
  margin-top: 18px;
  color: #f28b82;
  font-size: 13.5px;
  background: rgba(242, 139, 130, 0.08);
  border: 1px solid rgba(242, 139, 130, 0.25);
  border-radius: 4px;
  padding: 10px 14px;
}

/* ===================== DASHBOARD ===================== */
.dashboard-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 36px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 14px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.shop-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.site-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  margin: 0;
  color: #fff;
}

.shop-switcher {
  background: var(--bg-card-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.site-sub {
  margin: 2px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

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

.user-email {
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font-mono);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 4px;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
  background: rgba(200, 255, 60, 0.06);
  border-color: var(--lime);
  color: var(--lime);
}

.main-content {
  flex: 1;
  padding: 32px 36px 10px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

/* ---- Totals / receipt cards ---- */
.totals-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.total-card.receipt {
  position: relative;
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  padding: 22px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.total-card.receipt::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--lime) 0 8px, transparent 8px 16px);
  opacity: 0.6;
}

.total-card.accent-green::before { background: repeating-linear-gradient(90deg, var(--green) 0 8px, transparent 8px 16px); }
.total-card.accent-blue::before { background: repeating-linear-gradient(90deg, var(--blue) 0 8px, transparent 8px 16px); }

.total-label {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.total-value {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  color: var(--lime);
}

.accent-green .total-value { color: var(--green); }
.accent-blue .total-value { color: var(--blue); }

/* ---- Panels ---- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 24px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.panel-head h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: #fff;
  display: flex;
  align-items: center;
}

.last-updated {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 340px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

@media (max-width: 720px) {
  .chart-wrap { height: 260px; }
}

@media (max-width: 420px) {
  .chart-wrap { height: 220px; }
}

/* ---- Ledger table ---- */
.ledger-table-wrap {
  overflow-x: auto;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ledger-table thead th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border-strong);
}

.ledger-table td {
  padding: 12px 10px;
  border-bottom: 1px dashed var(--border);
}

.ledger-table th.num, .ledger-table td.num {
  text-align: right;
}

.ledger-table tbody tr:hover {
  background: rgba(200, 255, 60, 0.035);
}

.empty-state, .loading-state {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 0 8px;
  font-size: 14px;
}

.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 20px 0 34px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .main-content { max-width: 100%; }
}

@media (max-width: 720px) {
  .grid-overlay { background-size: 28px 28px; }

  .topbar {
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-left { width: 100%; }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .site-title { font-size: 18px; }
  .site-sub { font-size: 12px; }
  .user-email { display: none; }

  .main-content { padding: 20px 14px 6px; }

  .totals-row {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 22px;
  }

  .total-card.receipt { padding: 16px 18px 20px; }
  .total-value { font-size: 24px; }

  .panel {
    padding: 16px;
    margin-bottom: 16px;
  }

  .panel-head h2 { font-size: 14.5px; }
  .last-updated { font-size: 11px; }

  .ledger-table { font-size: 12.5px; }
  .ledger-table thead th { font-size: 11px; padding: 0 6px 8px; white-space: nowrap; }
  .ledger-table td { padding: 9px 6px; }

  .btn-google {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
  }

  .login-card { padding: 34px 22px; }
  .login-title { font-size: 22px; }
}

@media (max-width: 420px) {
  .btn-ghost { padding: 7px 10px; font-size: 12.5px; }
  .ledger-table-wrap { -webkit-overflow-scrolling: touch; }
}
