/* ─────────────────────────────────────────────
   STYLE.CSS — macOS Dark Mode UI
───────────────────────────────────────────── */

/* ── Tokens ──────────────────────────────── */
:root {
  --bg:           #000000;
  --bg-2:         #1c1c1e;
  --bg-3:         #2c2c2e;
  --bg-4:         #3a3a3c;
  --label:        #ffffff;
  --label-2:      rgba(255,255,255,0.60);
  --label-3:      rgba(255,255,255,0.30);
  --sep:          rgba(255,255,255,0.10);
  --blue:         #0a84ff;
  --blue-dim:     rgba(10,132,255,0.18);
  --green:        #30d158;
  --green-dim:    rgba(48,209,88,0.15);
  --orange:       #ff9f0a;
  --orange-dim:   rgba(255,159,10,0.15);
  --red:          #ff453a;
  --red-dim:      rgba(255,69,58,0.15);
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-xl:    20px;
  --shadow:       0 4px 24px rgba(0,0,0,0.6);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --font:         -apple-system, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ───────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--label);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────── */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ── Header ──────────────────────────────── */
.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 28px;
  padding-top: 12px;
}
.app-header h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.app-header p  { font-size: 13px; color: var(--label-2); }

.header-link {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--label-3);
  background: var(--bg-2);
  padding: 6px 14px;
  border-radius: 100px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.header-link:hover { background: var(--bg-3); color: var(--label-2); }

/* ── Tab Bar ─────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-2);
  border-radius: var(--radius-xl);
  padding: 4px;
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--label-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
  white-space: nowrap;
}
.tab-btn.active { background: var(--bg-4); color: var(--label); font-weight: 600; }

/* ── Panels ──────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel.active > * { animation: fadeUp 0.22s ease forwards; }

/* ── Card ────────────────────────────────── */
.card {
  background: var(--bg-2);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--label-3);
  margin-bottom: 14px;
}

/* ── Input Row ───────────────────────────── */
.input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.input-row label { font-size: 15px; color: var(--label); flex: 1; }
.input-row input, .pay-input-row input {
  background: var(--bg-3);
  border: none;
  border-radius: var(--radius-md);
  color: var(--label);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  padding: 9px 14px;
  outline: none;
  transition: background 0.2s, box-shadow 0.2s;
  -moz-appearance: textfield;
}
.input-row input::-webkit-outer-spin-button,
.input-row input::-webkit-inner-spin-button,
.pay-input-row input::-webkit-outer-spin-button,
.pay-input-row input::-webkit-inner-spin-button { -webkit-appearance: none; }
.input-row input { width: 130px; text-align: right; }
.input-row input:focus, .pay-input-row input:focus {
  background: var(--bg-4);
  box-shadow: 0 0 0 2px var(--blue);
}
.input-hint { font-size: 12px; color: var(--label-3); margin-top: 8px; text-align: right; }

/* ── Stat Grid ───────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-cell {
  background: var(--bg-2);
  border-radius: var(--radius-xl);
  padding: 16px;
}
.stat-cell .s-label { font-size: 11px; font-weight: 500; color: var(--label-3); margin-bottom: 6px; letter-spacing: 0.2px; }
.stat-cell .s-val   { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; line-height: 1; }
.stat-cell .s-sub   { font-size: 12px; color: var(--label-3); margin-top: 3px; }

/* Value colors */
.val-blue   { color: var(--blue); }
.val-green  { color: var(--green); }
.val-orange { color: var(--orange); }
.val-red    { color: var(--red); }
.val-white  { color: var(--label); }

/* ── Calendar ────────────────────────────── */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.nav-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-3);
  color: var(--label);
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.nav-btn:hover  { background: var(--bg-4); }
.nav-btn:active { transform: scale(0.91); }
.month-label { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }

.cal-wrap {
  background: var(--bg-2);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 16px;
}
.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--sep);
}
.cal-dow span {
  text-align: center;
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--label-3);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }

.day-cell {
  aspect-ratio: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: 0.15s;
  min-height: 44px;
  gap: 2px;
}
.day-cell.empty   { cursor: default; }
.day-cell.weekend { cursor: default; opacity: 0.28; }
.day-cell:not(.empty):not(.weekend):hover .day-inner { background: var(--bg-4); }
.day-cell:not(.empty):not(.weekend):active .day-inner { transform: scale(0.86); }

.day-inner {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 400;
  transition: background 0.15s, transform 0.12s;
}
.day-cell.today  .day-inner { background: var(--bg-3); font-weight: 600; }
.day-cell.marked .day-inner { background: var(--blue); color: #fff; font-weight: 600; }
.day-cell.marked.today .day-inner { box-shadow: 0 0 0 3px rgba(10,132,255,0.38); }

.day-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--blue); opacity: 0; transition: opacity 0.15s; }
.day-cell.marked .day-dot { opacity: 1; }

/* ── Month Strip ─────────────────────────── */
.month-strip {
  display: flex; gap: 8px;
  overflow-x: auto; padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.month-strip::-webkit-scrollbar { display: none; }
.month-chip {
  flex-shrink: 0;
  background: var(--bg-2);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1.5px solid transparent;
  min-width: 90px;
}
.month-chip.active { border-color: var(--blue); }
.month-chip:hover  { background: var(--bg-3); }
.month-chip .mc-name { font-size: 12px; font-weight: 600; color: var(--label-2); margin-bottom: 3px; }
.month-chip .mc-val  { font-size: 14px; font-weight: 700; }

/* ── Person Block ────────────────────────── */
.person-block {
  background: var(--bg-2);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 12px;
}
.person-header {
  display: flex; align-items: center;
  gap: 10px; margin-bottom: 16px;
}
.person-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.avatar-blue   { background: var(--blue-dim);   color: var(--blue); }
.avatar-orange { background: var(--orange-dim); color: var(--orange); }
.person-name  { font-size: 17px; font-weight: 600; }
.person-badge {
  margin-left: auto;
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px; letter-spacing: 0.3px;
}
.badge-paid    { background: var(--green-dim);  color: var(--green); }
.badge-partial { background: var(--orange-dim); color: var(--orange); }
.badge-pending { background: var(--red-dim);    color: var(--red); }

.person-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 14px;
}
.p-stat {
  background: var(--bg-3);
  border-radius: var(--radius-md);
  padding: 12px 10px; text-align: center;
}
.p-stat .ps-label { font-size: 10px; font-weight: 500; color: var(--label-3); margin-bottom: 4px; letter-spacing: 0.3px; }
.p-stat .ps-val   { font-size: 15px; font-weight: 700; }

/* ── Pay Input Row ───────────────────────── */
.pay-input-row { display: flex; gap: 8px; align-items: center; }
.pay-input-row input { flex: 1; padding: 10px 14px; font-weight: 400; }
.pay-input-row input::placeholder { color: var(--label-3); }

.btn-primary {
  background: var(--blue);
  color: #fff; border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14px; font-weight: 600;
  padding: 10px 18px; cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  white-space: nowrap;
}
.btn-primary:hover  { opacity: 0.85; }
.btn-primary:active { transform: scale(0.95); }

/* ── Payment History ─────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.history-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-3);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.hi-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.hi-dot-blue   { background: var(--blue); }
.hi-dot-orange { background: var(--orange); }
.hi-dot-green  { background: var(--green); }
.hi-desc { flex: 1; font-size: 13px; color: var(--label-2); }
.hi-val  { font-size: 13px; font-weight: 600; color: var(--green); }
.hi-date { font-size: 11px; color: var(--label-3); }
.btn-icon {
  background: none; border: none; color: var(--label-3);
  cursor: pointer; font-size: 14px; padding: 4px 6px;
  border-radius: 6px; line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover { color: var(--red); background: var(--red-dim); }

/* ── Auto-pay note ───────────────────────── */
.autopay-note {
  font-size: 11px;
  color: var(--label-3);
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg-3);
  border-radius: var(--radius-md);
  display: flex; align-items: center; gap: 6px;
}
.autopay-note span { color: var(--green); }

/* ── Gas Block ───────────────────────────── */
.gas-block {
  background: var(--bg-2);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 12px;
}
.gas-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.gas-icon   { font-size: 20px; }
.gas-title  { font-size: 15px; font-weight: 600; }
.gas-sub    { font-size: 12px; color: var(--label-3); margin-bottom: 12px; }

/* ── Month Selector (payments nav) ──────── */
.month-selector {
  display: flex; align-items: center;
  justify-content: space-between;
  background: var(--bg-2);
  border-radius: var(--radius-xl);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.ms-label { font-size: 17px; font-weight: 600; }

/* ── Annual ──────────────────────────────── */
.year-section {
  background: var(--bg-2);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 14px;
}
.year-label { font-size: 13px; font-weight: 600; color: var(--label-3); margin-bottom: 14px; letter-spacing: 0.4px; }
.year-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ys-cell {
  background: var(--bg-3);
  border-radius: var(--radius-md);
  padding: 14px 12px; text-align: center;
}
.ys-cell .ys-label { font-size: 10px; font-weight: 500; color: var(--label-3); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.3px; }
.ys-cell .ys-val   { font-size: 16px; font-weight: 700; }

/* ── Toast ───────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%; transform: translateX(-50%) translateY(70px);
  background: var(--bg-3);
  color: var(--label);
  font-family: var(--font);
  font-size: 13px; font-weight: 500;
  padding: 11px 20px;
  border-radius: 100px;
  pointer-events: none; opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Empty State ─────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--label-3); font-size: 14px; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 480px) {
  .app { padding: 16px 12px 60px; }
  .stat-cell .s-val { font-size: 18px; }
  .p-stat .ps-val { font-size: 13px; }
  .day-inner { width: 30px; height: 30px; font-size: 13px; }
}
@media (max-width: 360px) {
  .stat-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .year-stats  { grid-template-columns: repeat(2, 1fr); }
}
