/* =====================================================================
   Bloom Bank — design system
   Matched to the mobile app screenshots: soft green + cream, rounded
   cards, gentle shadows, fixed bottom navigation.
   ===================================================================== */

:root {
    --green-900: #0B3A22;
    --green-700: #0F5D36;   /* Forest Green — primary accents */
    --green-btn: #0E4A2C;   /* Deep green — primary buttons in the mockups */
    --green-500: #2E8B57;
    --green-300: #7BBE7B;   /* Soft Green */
    --green-100: #E4F0E4;
    --green-050: #F1F7F0;

    --cream:     #F3F3ED;   /* Light warm cream — app background */
    --surface:   #FFFFFF;
    --hero-tint: #DBE7CF;   /* balance-hero base (themeable) */
    --hero-grad: linear-gradient(135deg, #DBE7CF 0%, #E9EDDD 52%, #E7EFDB 100%);
    --promo-grad: linear-gradient(135deg, #E4EDD9, #EEF1E4);
    --ink:       #1A1A1A;   /* Dark Text */
    --ink-600:   #565D68;
    --ink-400:   #8C929B;
    --line:      #ECECE5;

    --red:       #E2483B;
    --amber:     #E8943B;
    --blue:      #4D8DF0;
    --purple:    #8A6FE0;

    --radius-lg: 26px;
    --radius:    20px;
    --radius-sm: 14px;

    --shadow-card: 0 10px 26px -18px rgba(16, 60, 36, 0.22), 0 1px 3px rgba(17, 24, 39, 0.04);
    --shadow-soft: 0 6px 18px -12px rgba(17, 24, 39, 0.16);

    --app-max: 460px;
    --nav-h: 78px;

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(1100px 520px at 50% -8%, var(--green-050) 0%, transparent 55%),
        var(--cream);
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------------------------------------------------------------------
   App shell — centred phone-width column on desktop, full width on mobile
   --------------------------------------------------------------------- */
.app-shell {
    max-width: var(--app-max);
    margin: 0 auto;
    min-height: 100vh;
    background: transparent;
    position: relative;
    padding: 18px 18px calc(var(--nav-h) + 28px);
}
@media (min-width: 480px) {
    .app-shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* ---------------------------------------------------------------------
   Top bar + logo
   --------------------------------------------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 2px 14px;
}
.topbar .icon-btn { color: var(--ink); }

.brand {
    text-align: center;
    line-height: 1;
    user-select: none;
}
.brand .brand-name {
    font-family: "Fraunces", Georgia, "Times New Roman", serif;
    font-size: 31px;
    font-weight: 500;
    color: var(--green-700);
    letter-spacing: -0.5px;
}
.brand .brand-sub {
    display: block;
    font-size: 10px;
    letter-spacing: 7px;
    font-weight: 600;
    color: var(--green-700);
    margin-top: 3px;
    padding-left: 7px;
}

.icon-btn {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border: none; background: transparent;
    border-radius: 50%;
    cursor: pointer;
    color: var(--ink);
    position: relative;
}
.icon-btn:hover { background: rgba(15,93,54,0.06); }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    object-fit: cover; border: 2px solid var(--green-100);
}
.badge-dot {
    position: absolute; top: 8px; right: 9px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--red); border: 2px solid var(--cream);
}

/* ---------------------------------------------------------------------
   Page heading
   --------------------------------------------------------------------- */
.page-head { margin: 8px 2px 18px; }
.page-head h1 {
    font-size: 30px; font-weight: 800; letter-spacing: -0.8px; margin: 0;
}
.page-head p { margin: 6px 0 0; color: var(--ink-600); font-size: 14px; }

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 18px;
    margin-bottom: 16px;
}
.card.flush { padding: 6px 18px; }

.list-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; margin-bottom: 16px; }

/* glassy hero balance card (Home) */
.balance-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--hero-grad);
    box-shadow: var(--shadow-card);
    padding: 22px;
    margin-bottom: 18px;
}
/* keep all textual content above the decorative art */
.balance-hero .label,
.balance-hero .amount,
.balance-hero .delta,
.balance-hero .hero-split { position: relative; z-index: 1; }

/* decorative leaf sprigs bleeding from the top-right corner */
.balance-hero .hero-leaves {
    position: absolute; right: -6px; top: -14px;
    width: 168px; height: 168px; z-index: 0; pointer-events: none;
}
/* white circular emblem with the leaf sprig (the "flower") */
.balance-hero .hero-badge {
    position: absolute; right: 18px; top: 48px;
    width: 90px; height: 90px; border-radius: 50%;
    background: #fff; z-index: 2;
    box-shadow: 0 12px 26px -12px rgba(16, 60, 36, 0.45);
    display: grid; place-items: center;
}
.balance-hero .hero-badge svg { width: 54px; height: 54px; }
/* leaf art follows the theme; presentation-attribute fills remain as fallback
   for browsers without color-mix support */
.balance-hero .hero-badge .lf-stem { stroke: var(--green-700); }
.balance-hero .hero-badge .lf-vein { stroke: var(--green-900); }
.balance-hero .hero-badge .lf-a { fill: var(--green-700); }
.balance-hero .hero-badge .lf-b { fill: color-mix(in srgb, var(--green-700) 68%, #fff); }
.balance-hero .hero-badge .lf-c { fill: color-mix(in srgb, var(--green-700) 78%, #fff); }
.balance-hero .hero-leaves .lf-stem-l { stroke: color-mix(in srgb, var(--green-700) 50%, #fff); }
.balance-hero .hero-leaves .lf-dec  { fill: color-mix(in srgb, var(--green-700) 42%, #fff); }
.balance-hero .hero-leaves .lf-dec2 { fill: color-mix(in srgb, var(--green-700) 30%, #fff); }

.balance-hero .label { display: flex; align-items: center; gap: 8px; color: var(--green-900); font-weight: 600; padding-right: 108px; }
.balance-hero .amount { font-size: clamp(30px, 7.8vw, 42px); font-weight: 800; letter-spacing: -1.5px; margin: 6px 0 4px; color: var(--ink); padding-right: 108px; white-space: nowrap; }
.balance-hero .amount .cents { font-size: 0.58em; color: var(--ink-600); }
.balance-hero .delta { color: var(--green-700); font-weight: 600; font-size: 14px; padding-right: 108px; }

/* narrow phones: shrink the emblem and reserved space so the balance never
   runs underneath it */
@media (max-width: 400px) {
    .balance-hero .hero-badge { width: 70px; height: 70px; right: 14px; top: 50px; }
    .balance-hero .hero-badge svg { width: 42px; height: 42px; }
    .balance-hero .hero-leaves { width: 128px; height: 128px; }
    .balance-hero .label,
    .balance-hero .amount,
    .balance-hero .delta { padding-right: 84px; }
    .balance-hero .amount { font-size: clamp(26px, 8.4vw, 34px); }
}
@media (max-width: 330px) {
    .balance-hero .hero-badge { width: 58px; height: 58px; }
    .balance-hero .hero-badge svg { width: 34px; height: 34px; }
    .balance-hero .label,
    .balance-hero .amount,
    .balance-hero .delta { padding-right: 70px; }
    .balance-hero .amount { font-size: 24px; }
}
.hero-split {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0;
    margin-top: 18px; background: rgba(255,255,255,0.78);
    backdrop-filter: blur(6px); border-radius: var(--radius-sm);
    padding: 14px 16px;
}
.hero-split .col + .col { border-left: 1px solid var(--line); padding-left: 16px; }
.hero-split .k { font-size: 13px; color: var(--ink-600); }
.hero-split .v { font-size: 20px; font-weight: 700; margin: 2px 0 8px; }
.mini-bar { height: 6px; border-radius: 99px; background: var(--green-100); overflow: hidden; }
.mini-bar > span { display: block; height: 100%; background: var(--green-700); border-radius: 99px; }

/* ---------------------------------------------------------------------
   Section headers
   --------------------------------------------------------------------- */
.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin: 22px 2px 12px;
}
.section-head h2 { font-size: 19px; font-weight: 700; margin: 0; }
.section-head a { color: var(--green-700); font-weight: 600; font-size: 14px; }

/* ---------------------------------------------------------------------
   Account / transaction rows
   --------------------------------------------------------------------- */
.row-item {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}
.row-item:last-child { border-bottom: none; }
.row-item .r-icon {
    width: 46px; height: 46px; border-radius: 14px;
    display: grid; place-items: center; flex: 0 0 auto;
    background: var(--green-100); color: var(--green-700);
}
.row-item .r-icon.tint-savings { background: var(--green-700); color: #fff; }
.row-item .r-icon.tint-sage   { background: color-mix(in srgb, var(--green-700) 20%, #fff); color: var(--green-700); }
.row-item .r-icon.tint-purple { background: #EFEAFB; color: var(--purple); }
.row-item .r-icon.tint-amber  { background: #FBEAD0; color: var(--amber); }
.row-item .r-icon.tint-blue   { background: #E1EDFB; color: var(--blue); }
.row-item .r-icon img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.row-item .r-main { flex: 1 1 auto; min-width: 0; }
.row-item .r-title { font-weight: 700; font-size: 15px; }
.row-item .r-sub { color: var(--ink-400); font-size: 13px; margin-top: 2px; }
.row-item .r-amount { text-align: right; font-weight: 700; font-size: 15px; white-space: nowrap; }
.row-item .r-amount .r-amt-sub { display: block; color: var(--ink-400); font-size: 12px; font-weight: 500; }
.amt-pos { color: var(--green-700); }
.amt-neg { color: var(--ink); }
.chev { color: var(--ink-400); flex: 0 0 auto; }

/* ---------------------------------------------------------------------
   Quick actions
   --------------------------------------------------------------------- */
.quick-actions { display: flex; justify-content: space-between; gap: 10px; }
.qa {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    flex: 1; cursor: pointer;
}
.qa .qa-circle {
    width: 60px; height: 60px; border-radius: 18px;
    background: var(--surface); box-shadow: var(--shadow-soft);
    display: grid; place-items: center; color: var(--green-700);
}
/* Mockup shows every quick action as a white tile with a green icon. */
.qa.solid .qa-circle { background: var(--surface); color: var(--green-700); }
.qa .qa-label { font-size: 12px; color: var(--ink-600); font-weight: 600; }

/* key / value rows (e.g. card details) */
.kv { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; gap: 16px; }
.kv:last-child { border-bottom: 0; }
.kv .muted { white-space: nowrap; }
.kv strong { text-align: right; }

/* pop-up notification modal */
.np-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(8, 24, 16, .55);
    display: flex; align-items: center; justify-content: center;
    padding: 24px; opacity: 1; transition: opacity .2s ease;
}
.np-overlay.np-hide { opacity: 0; }
.np-modal {
    background: var(--surface, #fff); border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
    width: 100%; max-width: 360px; padding: 26px 22px; text-align: center;
    animation: npPop .22s ease;
}
@keyframes npPop { from { transform: translateY(12px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.np-icon {
    width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 12px;
    display: grid; place-items: center;
    background: var(--green-050); color: var(--green-700);
}
.np-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; color: var(--ink-800); }
.np-body { margin: 0 0 18px; font-size: 14px; color: var(--ink-600); }
.np-modal .np-dismiss { margin-top: 4px; }

/* ---------------------------------------------------------------------
   Tabs / pills
   --------------------------------------------------------------------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 2px; margin-bottom: 6px; }
.tabs::-webkit-scrollbar { display: none; }
.pill {
    border: none; background: transparent; color: var(--ink-600);
    padding: 9px 16px; border-radius: 99px; font-weight: 600; font-size: 14px;
    white-space: nowrap; cursor: pointer;
}
.pill.active { background: var(--green-700); color: #fff; }

.tabs-underline { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab-u {
    padding: 12px 2px; font-weight: 600; color: var(--ink-400);
    border-bottom: 2px solid transparent; cursor: pointer; font-size: 15px;
}
.tab-u.active { color: var(--green-700); border-bottom-color: var(--green-700); }

/* ---------------------------------------------------------------------
   Promo banner
   --------------------------------------------------------------------- */
.promo {
    display: flex; align-items: center; gap: 12px;
    background: var(--promo-grad);
    border-radius: var(--radius); padding: 18px; margin: 8px 0 4px;
    position: relative;
}
.promo .promo-text { flex: 1; }
.promo h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.promo p { margin: 0 0 12px; color: var(--ink-600); font-size: 13px; }

/* ---------------------------------------------------------------------
   Buttons + forms
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--green-btn); color: #fff; border: none;
    padding: 14px 22px; border-radius: 14px; font-weight: 700; font-size: 15px;
    cursor: pointer; transition: transform .06s ease, background .2s ease;
}
.btn:hover { background: var(--green-900); }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--green-700); box-shadow: var(--shadow-soft); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--green-050); }
.btn.sm { padding: 9px 16px; font-size: 13px; border-radius: 11px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-600); margin-bottom: 7px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 14px 15px; border: 1px solid var(--line);
    border-radius: 14px; font-size: 15px; background: var(--surface); color: var(--ink);
    outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--green-300);
    box-shadow: 0 0 0 4px rgba(123, 190, 123, 0.18);
}

/* ---------------------------------------------------------------------
   Alerts / flash
   --------------------------------------------------------------------- */
.alert { padding: 13px 16px; border-radius: 14px; font-size: 14px; margin-bottom: 14px; }
.alert-error   { background: #FCEBEA; color: #B23227; }
.alert-success { background: var(--green-100); color: var(--green-900); }
.alert-info    { background: #E9F1FB; color: #2B5C9E; }

/* ---------------------------------------------------------------------
   Summary stat trio
   --------------------------------------------------------------------- */
.stat-trio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; }
.stat-trio .s + .s { border-left: 1px solid var(--line); padding-left: 14px; }
.stat-trio .s { padding-right: 8px; }
.stat-trio .s-k { font-size: 12px; color: var(--ink-600); }
.stat-trio .s-v { font-size: 18px; font-weight: 800; margin: 4px 0; }
.trend-up { color: var(--green-700); font-size: 12px; font-weight: 600; }
.trend-down { color: var(--red); font-size: 12px; font-weight: 600; }

/* ---------------------------------------------------------------------
   Bottom navigation
   --------------------------------------------------------------------- */
.bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: var(--app-max);
    height: var(--nav-h);
    background: #fff;
    border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -8px 26px -18px rgba(16, 60, 36, 0.28);
    display: flex; justify-content: space-around; align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 50;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    color: var(--ink-400); font-size: 11px; font-weight: 600; flex: 1;
}
.nav-item.active { color: var(--green-700); }
.nav-item svg { width: 24px; height: 24px; }

/* ---------------------------------------------------------------------
   Auth pages
   --------------------------------------------------------------------- */
.auth-wrap { max-width: 420px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; }
.auth-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 30px 26px; }
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 14px; color: var(--ink-600); }
.auth-foot a { color: var(--green-700); font-weight: 700; }
.auth-foot a.btn { color: #fff; }
.auth-foot a.btn.ghost { color: var(--green-700); }
.muted { color: var(--ink-400); }
.text-green { color: var(--green-700); }
.fw-700 { font-weight: 700; }

/* Privacy: blur monetary amounts when balances are hidden */
.maskable { transition: filter .15s ease; }
.balances-hidden .maskable {
  filter: blur(7px);
  -webkit-filter: blur(7px);
  user-select: none;
}

/* Bank picker combobox */
.combo-list{display:none;position:absolute;left:0;right:0;top:calc(100% + 4px);max-height:260px;overflow-y:auto;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow-card);z-index:30}
.combo-list.open{display:block}
.combo-item{padding:12px 14px;cursor:pointer;font-size:15px;border-bottom:1px solid var(--line)}
.combo-item:last-child{border-bottom:none}
.combo-item:hover,.combo-item.active{background:var(--green-050)}
.combo-item small{display:block;color:var(--ink-600);font-size:12px;margin-top:2px}
.combo-head{padding:8px 14px;font-size:11px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;color:var(--ink-600);background:var(--cream)}

/* Slide-in navigation drawer (top menu) */
.drawer-overlay{position:fixed;inset:0;background:rgba(0,0,0,.42);opacity:0;visibility:hidden;transition:opacity .2s ease;z-index:90}
.drawer-overlay.open{opacity:1;visibility:visible}
.drawer{position:fixed;top:0;left:0;bottom:0;width:80%;max-width:300px;background:#fff;transform:translateX(-100%);transition:transform .25s ease;z-index:100;display:flex;flex-direction:column;box-shadow:2px 0 24px rgba(0,0,0,.18)}
.drawer.open{transform:translateX(0)}
.drawer-head{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:1px solid var(--line)}
.drawer-nav{display:flex;flex-direction:column;padding:8px;overflow-y:auto}
.drawer-nav a{display:flex;align-items:center;gap:14px;padding:13px 14px;border-radius:12px;color:var(--ink-800,#16241c);text-decoration:none;font-weight:600;font-size:15px}
.drawer-nav a:hover,.drawer-nav a:active{background:var(--green-050)}
.drawer-nav a svg{color:var(--green-700);flex-shrink:0}

/* =====================================================================
   Responsive — fit all screen sizes
   ===================================================================== */
html, body { overflow-x: hidden; }
img, svg, video, canvas { max-width: 100%; height: auto; }
input, select, textarea { max-width: 100%; }

/* Slide-in drawer: align to the centred app column on wider screens,
   and stay a sensible width on phones (it was sized to the whole viewport). */
@media (min-width: 480px) {
  .drawer { left: calc(50% - (var(--app-max) / 2)); width: var(--app-max); max-width: var(--app-max); }
}
@media (max-width: 479px) {
  .drawer { width: 84%; max-width: 320px; }
}

/* Admin: scroll wide tables, stack grid forms, tighten padding on phones. */
@media (max-width: 640px) {
  .admin { padding: 16px 14px; }
  table.atable { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin [style*="grid-template-columns"] { display: block !important; }
  .admin [style*="grid-template-columns"] > * { margin-bottom: 10px; }
  .admin-top { gap: 10px; }
}

/* =====================================================================
   Responsive layout — phone-first, with a proper desktop experience.
   Tablets get a roomier centred column; desktops (>=900px) get a fixed
   left sidebar and a wide, centred content area instead of a phone column.
   ===================================================================== */
@media (min-width: 600px) and (max-width: 899px) {
  :root { --app-max: 600px; }
}

@media (min-width: 900px) {
  /* Repurpose the fixed bottom bar as a left sidebar. */
  .bottom-nav {
    top: 0; bottom: 0; left: 0; transform: none;
    width: 244px; max-width: 244px; height: 100vh;
    flex-direction: column; justify-content: flex-start; align-items: stretch;
    gap: 4px; padding: 20px 14px 24px;
    border-top: none; border-radius: 0; box-shadow: none;
    border-right: 1px solid var(--line);
    background: #fff; backdrop-filter: none; overflow-y: auto;
  }
  .nav-item {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 14px;
    font-size: 15px; padding: 12px 16px; border-radius: 12px;
  }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item.active { background: var(--green-050); }

  /* Content flows to the right of the sidebar, centred and comfortably wide.
     Scoped to .app-shell so sidebar-less pages (login/register) stay centred. */
  .app-shell {
    max-width: 900px; min-height: 100vh;
    margin-left: max(244px, calc((100vw - 900px) / 2));
    margin-right: auto;
    padding: 26px 34px 56px;
    background: transparent; box-shadow: none;
    border-left: none; border-right: none;
  }

  /* The hamburger + slide-in drawer aren't needed alongside the sidebar. */
  [data-menu-open] { display: none; }
  .drawer, .drawer-overlay { display: none !important; }

  /* Opt-in helper so pages can use the extra width for two-column blocks. */
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
}

/* Very large screens — cap content width for readability. */
@media (min-width: 1400px) {
  .app-shell { max-width: 1040px; margin-left: max(244px, calc((100vw - 1040px) / 2)); }
}

/* Segmented choice control (e.g. account type at registration) */
.seg{display:flex;gap:10px}
.seg-opt{flex:1;position:relative;cursor:pointer}
.seg-opt input{position:absolute;opacity:0;inset:0;cursor:pointer}
.seg-opt span{display:flex;flex-direction:column;gap:2px;padding:12px 14px;border:1.5px solid var(--line);border-radius:12px;transition:border-color .15s,background .15s}
.seg-opt span strong{font-size:15px}
.seg-opt span small{color:var(--muted, #6b7280);font-size:12px}
.seg-opt input:checked + span{border-color:var(--green-500);background:var(--green-050)}
