/* ==========================================================================
   MoneyDrop — CalorieDrop-Inspired Sleek Glass & Emerald UI
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg: #0f172a;
  --glass: rgba(30, 41, 59, 0.72);
  --hl: rgba(255, 255, 255, 0.05);
  --input-bg: rgba(15, 23, 42, 0.7);
  --border: #334155;
  --border-hover: #475569;

  --text: #f8fafc;
  --muted: #94a3b8;
  --dim: #64748b;

  --pri: #34d399;
  --pri-dark: #059669;
  --pri-d: rgba(52, 211, 153, 0.14);

  --acc: #fbbf24;
  --acc-d: rgba(251, 191, 36, 0.15);

  --red: #ef4444;
  --red-d: rgba(239, 68, 68, 0.15);

  --ring-track: rgba(255, 255, 255, 0.07);
  --radius: 20px;
  --rs: 12px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

[data-theme="light"] {
  --bg: #f0f4f8;
  --glass: rgba(255, 255, 255, 0.88);
  --hl: rgba(15, 23, 42, 0.04);
  --input-bg: #ffffff;
  --border: rgba(15, 23, 42, 0.11);
  --border-hover: rgba(15, 23, 42, 0.22);

  --text: #0f172a;
  --muted: #475569;
  --dim: #94a3b8;

  --pri: #10b981;
  --pri-dark: #059669;
  --pri-d: rgba(16, 185, 129, 0.12);

  --acc: #d97706;
  --acc-d: rgba(217, 119, 6, 0.12);

  --red: #dc2626;
  --red-d: rgba(220, 38, 38, 0.1);

  --ring-track: rgba(15, 23, 42, 0.08);
  --shadow: 0 6px 22px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(52, 211, 153, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(251, 191, 36, 0.05) 0%, transparent 60%),
    var(--bg);
}

.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

.num,
.input-num {
  font-variant-numeric: tabular-nums;
}

.text-emerald {
  color: var(--pri);
}

.text-red {
  color: var(--red);
}

.app {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.15rem 1rem 4rem;
}

/* ==========================================================================
   Header & Two-Tab Switcher
   ========================================================================== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
}

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

.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--pri);
  box-shadow: 0 0 12px var(--pri);
}

.brand-lockup h1 {
  font-size: 1.55rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--pri), var(--acc));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.main-tabs {
  display: inline-flex;
  background: var(--glass);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 999px;
  gap: 4px;
}

.main-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.main-tab:hover {
  color: var(--text);
}

.main-tab.active {
  background: var(--pri);
  color: #06281e;
  box-shadow: 0 4px 14px rgba(52, 211, 153, 0.3);
}

.icon-btn-sleek {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn-sleek:hover {
  border-color: var(--pri);
}

.tab-view {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* ==========================================================================
   Month Bar & CalorieDrop Date Scroller
   ========================================================================== */

.month-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-title {
  font-weight: 700;
  font-size: 1.05rem;
  min-width: 128px;
  text-align: center;
}

.nav-arrow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  line-height: 1;
}

.nav-arrow:hover {
  border-color: var(--pri);
}

.pill-btn-sm {
  background: var(--pri-d);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--pri);
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.pill-btn-sm:hover {
  background: var(--pri);
  color: #06281e;
}

.date-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  overflow: hidden;
  padding: 2px 2px 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.date-scroll::-webkit-scrollbar {
  display: none;
}

.date-pill {
  flex-shrink: 0;
  width: 54px;
  height: 74px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.date-pill:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.date-pill.active {
  background: var(--pri);
  border-color: var(--pri);
  box-shadow: 0 8px 20px rgba(52, 211, 153, 0.28);
}

.dp-day {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.dp-dow {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 5px;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.date-pill.active .dp-day,
.date-pill.active .dp-dow {
  color: #06281e;
}

.dp-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--acc);
  position: absolute;
  bottom: 7px;
}

.date-pill.active .dp-dot {
  background: #06281e;
}

/* ==========================================================================
   Bento Hero Card (CalorieDrop Style)
   ========================================================================== */

.bento-hero {
  padding: 1.35rem 1.4rem;
}

.bh-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
}

.bh-goal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--hl);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 7px 5px 13px;
}

.bh-goal-lbl {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.bh-unit {
  font-weight: 700;
  color: var(--pri);
}

.bh-goal-pill input {
  width: 96px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  text-align: right;
  outline: none;
}

.bh-goal-pill input:focus {
  border-color: var(--pri);
}

.bh-goal-set {
  background: var(--pri-d);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--pri);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.bh-goal-set:hover {
  background: var(--pri);
  color: #06281e;
}

.bh-income-btn {
  background: var(--pri);
  color: #06281e;
  border: none;
  font-weight: 800;
  font-size: 0.84rem;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(52, 211, 153, 0.25);
}

.bh-income-btn:hover {
  background: var(--pri-dark);
  color: #fff;
}

.bh-core {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.25rem;
  padding: 0.4rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 650px) {
  .bh-core {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

.bh-side-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.bh-stat-val {
  font-size: 1.55rem;
  font-weight: 800;
}

.bh-stat-lbl {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

.bh-ring-wrap {
  position: relative;
  width: 196px;
  height: 196px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring-svg {
  width: 100%;
  height: 100%;
}

#tracker-ring-fill {
  transition: stroke-dashoffset 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.ring-center-text {
  position: absolute;
  inset: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ring-val {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.ring-lbl {
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.ring-badge {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--pri-d);
  color: var(--pri);
}

.bh-side-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bh-mini-stat {
  background: var(--hl);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bh-mini-lbl {
  font-size: 0.78rem;
  color: var(--muted);
}

.bh-mini-val {
  font-size: 0.98rem;
  font-weight: 800;
}

.bh-cats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0 0.65rem;
}

.bh-cats-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.bh-macros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
}

.bh-macro-col {
  background: var(--hl);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 10px 12px;
}

.bh-macro-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.bh-macro-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.bh-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.bh-macro-nums {
  font-size: 0.8rem;
  color: var(--muted);
}

.bh-macro-nums strong {
  color: var(--text);
}

.bh-bar-track {
  width: 100%;
  height: 7px;
  border-radius: 99px;
  background: var(--ring-track);
  overflow: hidden;
}

.bh-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Cards, Quick Logger & Diary Feed
   ========================================================================== */

.card {
  padding: 1.35rem 1.4rem;
}

.card-heading {
  font-size: 1.1rem;
  font-weight: 800;
}

.helper-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 4px 0 14px;
}

.link-btn {
  background: transparent;
  border: none;
  color: var(--pri);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.logger-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.mode-switch {
  display: inline-flex;
  background: var(--hl);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 4px;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--text);
  color: var(--bg);
}

.mode-btn.mode-in.active {
  background: var(--pri);
  color: #06281e;
}

.logging-date-tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.field-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.field-lbl {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--hl);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.cat-pill:hover {
  border-color: var(--border-hover);
}

.cat-pill.selected {
  background: var(--pri-d);
  border-color: var(--pri);
}

.cat-pill.dashed {
  border-style: dashed;
  color: var(--muted);
}

.cat-pill.manage {
  padding-right: 8px;
  cursor: default;
}

.pill-act {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 2px 5px;
  border-radius: 50%;
  cursor: pointer;
}

.pill-act:hover {
  color: var(--text);
  background: var(--border);
}

.pill-act.del:hover {
  color: var(--red);
  background: var(--red-d);
}

.inline-editor-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--hl);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 9px 10px;
  margin-bottom: 12px;
}

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

.input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 13px;
  border-radius: var(--rs);
  font-size: 0.94rem;
  outline: none;
}

.input:focus {
  border-color: var(--pri);
}

.input-grow {
  flex: 1 1 220px;
}

.amount-wrap {
  display: inline-flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding-left: 11px;
  width: 145px;
}

.amount-wrap:focus-within {
  border-color: var(--pri);
}

.curr-prefix {
  color: var(--muted);
  font-weight: 700;
}

.amount-wrap .input {
  border: none;
  background: transparent;
  width: 100%;
  text-align: right;
  font-weight: 700;
  padding-left: 6px;
}

.color-dot-input {
  width: 38px;
  height: 38px;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  cursor: pointer;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border-radius: var(--rs);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-emerald {
  background: var(--pri);
  color: #06281e;
}

.btn-emerald:hover {
  background: var(--pri-dark);
  color: #fff;
}

.btn-soft {
  background: var(--pri-d);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--pri);
}

.btn-soft:hover {
  background: var(--pri);
  color: #06281e;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.82rem;
}

/* Diary List */
.diary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.scope-pills {
  display: inline-flex;
  gap: 5px;
}

.scope-pill {
  background: var(--hl);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.scope-pill.active {
  background: var(--pri-d);
  border-color: var(--pri);
  color: var(--pri);
}

.diary-list {
  display: flex;
  flex-direction: column;
}

.diary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}

.diary-row:last-child {
  border-bottom: none;
}

.diary-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.diary-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--hl);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.diary-label {
  font-weight: 600;
}

.diary-date {
  font-size: 0.76rem;
  color: var(--dim);
  margin-left: 6px;
}

.diary-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.diary-amt {
  font-weight: 800;
  font-size: 0.98rem;
}

.del-x {
  background: transparent;
  border: none;
  color: var(--dim);
  font-size: 0.95rem;
  padding: 4px 7px;
  border-radius: 6px;
  cursor: pointer;
}

.del-x:hover {
  color: var(--red);
  background: var(--red-d);
}

.empty-diary {
  padding: 24px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   TAB 2: Budget Blueprint & Targets
   ========================================================================== */

.budget-hero-grid {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 24px;
  align-items: center;
}

@media (max-width: 720px) {
  .budget-hero-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

.budget-donut-wrap {
  position: relative;
  width: 230px;
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.budget-donut-center {
  position: absolute;
  inset: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--muted);
}

.donut-val {
  font-size: 1.55rem;
  font-weight: 800;
  margin: 2px 0;
}

.donut-sub {
  font-size: 0.76rem;
  color: var(--muted);
}

.donut-slice {
  cursor: pointer;
  transition: stroke-width 0.16s ease;
}

.donut-slice:hover {
  stroke-width: 28px;
}

.expected-inc-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.expected-inc-row label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.expected-inc-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.blueprint-breakdown {
  background: var(--hl);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.88rem;
}

.bp-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.bp-row strong {
  color: var(--text);
}

.bp-total {
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  color: var(--text);
}

.add-budget-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.budget-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.budget-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--hl);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 10px 12px;
}

.bi-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 200px;
}

.bi-name-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 0.94rem;
  padding: 5px 8px;
  border-radius: 8px;
  width: 100%;
  max-width: 220px;
}

.bi-name-input:hover,
.bi-name-input:focus {
  background: var(--input-bg);
  border-color: var(--border);
  outline: none;
}

.bi-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bi-meta {
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 90px;
  text-align: right;
}

/* Toast */
#toast-box {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-left: 4px solid var(--pri);
  color: var(--text);
  padding: 10px 15px;
  border-radius: var(--rs);
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  font-weight: 600;
}

.toast.error {
  border-left-color: var(--red);
}


/* ==========================================================================
   Cloud edition: boot splash, auth screen, header actions
   ========================================================================== */

.boot-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1rem calc(1.5rem + env(safe-area-inset-bottom));
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-brand {
  justify-content: center;
}

.auth-sub {
  text-align: center;
  margin: 0 0 4px;
}

.auth-tabs {
  display: flex;
  width: 100%;
}

.auth-tabs .main-tab {
  flex: 1;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-btn {
  width: 100%;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--dim);
  font-size: 0.8rem;
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-forgot {
  align-self: center;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.account-note {
  text-align: center;
  color: var(--dim);
  font-size: 0.8rem;
}

/* Safe areas for the installed (home-screen) app */
.app {
  padding-top: calc(1.15rem + env(safe-area-inset-top));
  padding-bottom: calc(4rem + env(safe-area-inset-bottom));
}

#toast-box {
  bottom: calc(20px + env(safe-area-inset-bottom));
}

.date-scroll {
  touch-action: pan-y;
  user-select: none;
}

/* ==========================================================================
   Phone layout
   ========================================================================== */

@media (max-width: 640px) {
  .app {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .app-header {
    margin-bottom: 1rem;
  }

  .app-header .main-tabs {
    order: 3;
    width: 100%;
    display: flex;
  }

  .app-header .main-tab {
    flex: 1;
    padding: 9px 10px;
  }

  .date-pill {
    width: 46px;
    height: 66px;
    border-radius: 24px;
  }

  .date-scroll {
    gap: 0.45rem;
  }

  .bento-hero,
  .card {
    padding: 1.1rem 1rem;
  }

  .bh-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .bh-goal-pill {
    justify-content: space-between;
  }

  .bh-goal-pill input {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .bh-income-btn {
    padding: 11px 16px;
  }

  .bh-side-col {
    width: 100%;
  }

  .bh-macros-grid {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-btn {
    flex: 1;
  }

  .entry-inputs-row .input-grow {
    flex-basis: 100%;
  }

  .entry-inputs-row .amount-wrap {
    flex: 1;
    width: auto;
  }

  .add-budget-row .input-grow {
    flex: 1 1 calc(100% - 50px);
  }

  .add-budget-row .amount-wrap {
    flex: 1;
    width: auto;
  }

  .inline-editor-box {
    flex-wrap: wrap;
  }

  .inline-editor-box .input {
    flex: 1 1 calc(100% - 50px);
    min-width: 0;
  }

  .budget-item-row .bi-right {
    width: 100%;
    justify-content: flex-end;
  }

  .budget-item-row .amount-wrap {
    width: 120px;
  }

  .diary-row {
    align-items: flex-start;
  }

  .diary-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  /* iOS zooms into inputs smaller than 16px — keep everything at 16px */
  .input,
  .bh-goal-pill input,
  .bi-name-input {
    font-size: 16px;
  }
}
