/* My Monzo — uses the JMWS shared design tokens (ShopSmart blue primary)
   verbatim. Only Monzo-specific compositions live below. */

:root {
  --primary: #1976D2;
  --primary-dark: #1565C0;
  --primary-light: #BBDEFB;
  --bg: #F4F6F9;
  --bg2: #FFFFFF;
  --bg3: #EDF1F6;
  --card: #FFFFFF;
  --card2: #F8FAFC;
  --border: #E2E8F0;
  --text: #1E293B;
  --text2: #64748B;
  --text3: #94A3B8;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
  --pos: #16A34A;
  --neg: #DC2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --nav-height: 60px;   /* same compact height as the other JMWS apps */
  --header-height: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body {
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
  /* Stop iOS Safari from re-scaling text on its own (which manifests
     as the whole page looking zoomed-in on first load). 100% = "use
     the font size we specified, don't auto-bump it". */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
/* iOS Safari zooms in on any <input> whose computed font-size < 16px
   the moment the user taps it (auto-zoom-to-input). The fix is to
   keep input fonts at ≥16px. Apply on mobile widths only so desktop
   doesn't get oversized form text. */
@media (max-width: 899px) {
  input, select, textarea, button { font-size: 16px; }
}

/* ─── LOGIN ──────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #BBDEFB 0%, #F4F6F9 60%);
}
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 28px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(25,118,210,0.10);
}
.login-logo { text-align: center; margin-bottom: 16px; }
.login-logo img { width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.login-card h1 { font-size: 24px; font-weight: 800; color: var(--primary); text-align: center; margin-bottom: 4px; }
.login-card p.muted { text-align: center; margin-bottom: 24px; }
#login-form { display: flex; flex-direction: column; gap: 14px; }
#login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}
#login-form input {
  border: 1.5px solid var(--border);
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
}
#login-form input:focus { outline: none; border-color: var(--primary); background: #fff; }
.login-submit { margin-top: 4px; justify-content: center; }
.login-error {
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.30);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: center;
}

/* ─── APP CHROME ────────────────────────────────────────────── */
.app-header {
  height: var(--header-height);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 8px; }
#page-title { font-size: 18px; font-weight: 700; color: var(--primary); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: transparent; border: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text2); cursor: pointer; text-decoration: none;
}
.icon-btn i { font-size: 22px; }

.conn-pill {
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 99px; letter-spacing: 0.4px; text-transform: uppercase;
}
.conn-pill-off { background: var(--bg3); color: var(--text3); }
.conn-pill-on  { background: var(--primary-light); color: var(--primary-dark); }

/* Bottom nav — HourAdmin 1:1 */
.bottom-nav {
  display: flex;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  background: var(--bg2);
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-btn {
  flex: 1; height: var(--nav-height);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: none; color: var(--text3);
  cursor: pointer; padding: 0 4px;
  font-family: inherit;
  transition: color 0.35s ease;
}
.nav-btn i.nav-icon { font-size: 22px; line-height: 1; }
.nav-btn span {
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  text-transform: capitalize;
  white-space: nowrap;
  opacity: 0; transition: opacity 0.35s ease;
}
.nav-btn.active { color: var(--primary); }
.nav-btn.active span { opacity: 1; }

.app-header-nav { display: none; }

@media (min-width: 900px) {
  .bottom-nav { display: none; }
  .app-header { height: 64px; padding: 0 28px; justify-content: flex-start; gap: 0; }
  #page-title { margin-right: 8px; }
  .app-header-nav {
    display: flex; flex: 0 0 auto; align-items: stretch; gap: 0;
    margin: 0 0 0 16px; height: 100%;
  }
  .header-right { margin-left: auto; }
  .app-header-nav .nav-btn {
    background: transparent; border: none; cursor: pointer;
    color: var(--text); font-weight: 500; font-size: 15px;
    padding: 0 16px;
    border-radius: 0;
    display: flex; align-items: center; justify-content: center;
    flex-direction: row; flex: 0 0 auto;
    height: 100%;
  }
  .app-header-nav .nav-btn i, .app-header-nav .nav-btn .nav-icon { display: none; }
  .app-header-nav .nav-btn span {
    opacity: 1 !important; height: auto; line-height: 1;
    font-size: 15px; font-weight: 500; text-transform: none; letter-spacing: 0;
    color: var(--primary);
  }
  .app-header-nav .nav-btn.active span {
    font-weight: 700; text-decoration: underline;
    text-decoration-thickness: 2px; text-underline-offset: 10px;
  }
}

/* Pages */
#page-content {
  width: 100%; max-width: 1100px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-height) + 24px) 16px;
}
@media (min-width: 900px) {
  #page-content { padding-bottom: 32px; }
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card.danger-card { border-color: rgba(239,68,68,0.30); }
.connect-card { text-align: center; padding: 36px 20px; }
.connect-card h2 { font-size: 22px; font-weight: 700; margin: 12px 0 8px; }
.connect-card .btn { margin-top: 12px; }
.connect-card p { max-width: 420px; margin: 0 auto; }

.section-title { font-size: 14px; font-weight: 700; color: var(--text2); margin: 18px 0 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.section-title.nm { margin-top: 0; }

.muted { color: var(--text2); }
.muted.small, .small { font-size: 12.5px; }
.center { text-align: center; }
.pad { padding: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; background: var(--bg3); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--primary-light); color: var(--primary-dark); }
.btn-secondary:hover { background: #95C8F1; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-mini { padding: 6px 10px; font-size: 12px; }

/* Hero */
.hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(25,118,210,0.18);
}
.hero-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.85; }
.hero-value { font-size: 44px; font-weight: 800; line-height: 1.05; margin: 6px 0 4px; letter-spacing: -0.5px; }
.hero-sub   { font-size: 13px; opacity: 0.9; }

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 600px) { .stat-grid { grid-template-columns: 1fr 1fr; } }
.stat { padding: 14px; }
.stat-label { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
.stat-value { font-size: 22px; font-weight: 800; line-height: 1.1; margin: 4px 0; }
.stat-sub { font-size: 11px; color: var(--text3); }

/* Cards list — used for sources, merchants, transactions */
.cards-list { display: flex; flex-direction: column; gap: 8px; }

/* Transactions: day-grouped headers */
.tx-day-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 4px 6px;
  border-bottom: 1px solid var(--border);
  margin-top: 6px;
}
.tx-day-header:first-child { margin-top: 0; padding-top: 4px; }
.tx-day-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
}
.tx-day-count { font-size: 11px; color: var(--text3); flex: 1; }
.tx-day-total { font-size: 13px; font-weight: 700; }

.list-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.list-row .lr-left { flex: 1; min-width: 0; }
.list-row .lr-name { font-weight: 700; color: var(--text); }
.list-row .lr-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.list-row .lr-right { flex-shrink: 0; text-align: right; }
.list-row .lr-amount { font-weight: 700; }
.list-row.income .lr-amount { color: var(--pos); }
.list-row.spend  .lr-amount { color: var(--neg); }

.pill {
  font-size: 10.5px; font-weight: 700; padding: 2px 8px;
  border-radius: 99px; letter-spacing: 0.3px; display: inline-block;
}
.pill-monthly  { background: var(--primary-light); color: var(--primary-dark); }
.pill-biweekly { background: #FEF3C7;             color: #92400E; }
.pill-weekly   { background: #DCFCE7;             color: #166534; }
.pill-4weekly  { background: #E0E7FF;             color: #3730A3; }
.pill-irregular{ background: var(--bg3);          color: var(--text3); }
.pill-unknown  { background: var(--bg3);          color: var(--text3); }

/* Approve-banner (Monzo's "tap Allow in the app" prompt) */
.approve-banner {
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  color: #78350F;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.approve-banner i { font-size: 22px; flex-shrink: 0; color: #92400E; }
.approve-banner .small { display: block; margin-top: 4px; color: #92400E; }

/* Filter card on Income sources */
.filter-card { padding: 14px; }
.filter-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.filter-row:last-of-type { margin-bottom: 0; }
.filter-row label { font-size: 13px; color: var(--text2); font-weight: 600; }
.filter-row input[type="search"] {
  flex: 1; min-width: 180px;
  background: var(--bg3); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; font: inherit; color: var(--text);
}
.filter-row input[type="search"]:focus { outline: none; border-color: var(--primary); background: #fff; }
#merch-count { margin-top: 6px; }

/* Segmented control */
.seg {
  display: inline-flex; background: var(--bg3);
  border-radius: 999px; padding: 4px; gap: 4px;
}
.seg button {
  background: transparent; border: none; font: inherit;
  font-size: 12px; font-weight: 700; color: var(--text2);
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.seg button.active {
  background: var(--card); color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
