/* ===========================================================================
   Plaka for Students by ERAS DEV - ERAS brand system
   "Two worlds": violet = here (Netherlands), coral = home (the islands)
   =========================================================================== */

:root {
  /* ERAS core */
  --eras-violet:   #5B2A86;   /* primary brand */
  --signal-violet: #7B4FB5;   /* lighter accent */
  --ledger-green:  #2E7D4F;   /* income / positive */
  --deep-navy:     #16173A;   /* dark anchor */

  /* Two-worlds accents */
  --home-coral:    #FF6B4A;   /* the islands, money home */
  --home-coral-dk: #E24E2E;
  --sun-gold:      #F5A623;   /* life / leisure */

  /* Neutrals */
  --ink:      #1B1C33;
  --muted:    #6B6E86;
  --line:     #E7E7F0;
  --bg:       #F4F5F9;
  --card:     #FFFFFF;
  --card-2:   #FBFBFE;

  --ok:       #2E7D4F;
  --warn:     #F5A623;
  --danger:   #E24E2E;

  --radius:   16px;
  --radius-s: 10px;
  --shadow:   0 1px 2px rgba(22,23,58,.04), 0 8px 24px rgba(22,23,58,.06);
  --shadow-lg:0 12px 40px rgba(22,23,58,.14);

  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-feature-settings: "tnum" 1, "cv05" 1;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; margin: 0; }
a { color: inherit; text-decoration: none; }

.tnum { font-variant-numeric: tabular-nums; }

/* ---- Layout shell ------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--deep-navy);
  color: #EDEDF7;
  padding: 26px 18px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--signal-violet), var(--home-coral));
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; color: #fff; font-size: 19px;
  box-shadow: 0 6px 18px rgba(123,79,181,.4);
}
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand-name small { display: block; font-family: var(--font-body); font-weight: 500;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #8A8CB8; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 11px; color: #B9BAD8; font-weight: 500; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav a .ico { width: 20px; text-align: center; font-size: 16px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: linear-gradient(100deg, var(--eras-violet), var(--signal-violet)); color: #fff; }

.sidebar-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.08); }
.userchip { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--home-coral), var(--sun-gold));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
}
.userchip .who { font-size: 13px; line-height: 1.2; }
.userchip .who small { color: #8A8CB8; }
.logout { color: #8A8CB8; font-size: 12.5px; margin-top: 10px; display: inline-block; }
.logout:hover { color: var(--home-coral); }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 34px 6px; gap: 16px; flex-wrap: wrap;
}
.topbar h1 { font-size: 26px; }
.topbar .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.content { padding: 18px 34px 60px; }

/* ---- Month switcher ----------------------------------------------------- */
.monthnav { display: inline-flex; align-items: center; gap: 4px; background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.monthnav a, .monthnav .cur { display: grid; place-items: center; }
.monthnav a { width: 34px; height: 34px; border-radius: 50%; color: var(--muted); font-size: 18px; }
.monthnav a:hover { background: var(--bg); color: var(--ink); }
.monthnav .cur { padding: 0 16px; height: 34px; font-family: var(--font-display); font-weight: 600; font-size: 14.5px; }

/* ---- Cards -------------------------------------------------------------- */
.grid { display: grid; gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.card h3 { font-size: 15px; }
.card .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600; }

/* ---- Two-worlds hero ---------------------------------------------------- */
.worlds {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto; gap: 0;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg);
}
.world { padding: 26px 26px 30px; color: #fff; position: relative; overflow: hidden;
  display: grid; grid-template-rows: subgrid; grid-row: span 3; align-content: start; }
.world::after {
  content: ""; position: absolute; right: -40px; bottom: -40px;
  width: 160px; height: 160px; border-radius: 50%; opacity: .18;
  background: radial-gradient(circle at center, #fff, transparent 70%);
}
.world .whead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; align-self: start; }
.world .tag { display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .92; }
.world .big { font-family: var(--font-display); font-weight: 800; font-size: 28px;
  letter-spacing: -.02em; margin: 12px 0 3px; white-space: nowrap; }
.world .note { font-size: 13px; opacity: .82; }
.world.here { background: linear-gradient(150deg, var(--eras-violet), var(--deep-navy)); }
.world.home { background: linear-gradient(150deg, var(--home-coral), var(--home-coral-dk)); }
.world .flag { font-size: 20px; opacity: .9; flex-shrink: 0; display: inline-flex; }
.world .flag img { width: 28px; height: 19px; object-fit: cover; border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); display: block; }

/* ---- Wallets ------------------------------------------------------------ */
.wallet-edit { display: none; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.wallet-edit.open { display: block; }

/* ---- Wallets dashboard widget ------------------------------------------- */
.wallet-widget-total { display: flex; justify-content: space-between; align-items: baseline;
  padding: 4px 0 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.wallet-widget-total .lbl { font-size: 13px; color: var(--muted); }
.wallet-widget-total b { font-size: 20px; }
.wallet-widget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin-top: 14px; }
.wallet-chip { display: flex; gap: 11px; align-items: center; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
  color: inherit; transition: border-color .15s, box-shadow .15s; }
.wallet-chip:hover { border-color: var(--brand, #5B2A86); box-shadow: var(--shadow); }
.wallet-chip .wc-ic { font-size: 22px; flex-shrink: 0; line-height: 1; }
.wallet-chip .wc-meta { min-width: 0; }
.wallet-chip .wc-name { font-size: 12.5px; color: var(--muted); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wallet-chip .wc-bal { font-size: 16px; font-weight: 700; margin-top: 2px; }
.wallet-chip .wc-bal.neg { color: var(--coral, #FF6B4A); }
.wallet-chip .wc-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ---- FX trend widget ---------------------------------------------------- */
.fx-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-top: 6px; }
.fx-now { display: flex; align-items: baseline; gap: 8px; }
.fx-now .fx-pair { font-size: 13px; color: var(--muted); }
.fx-now b { font-size: 22px; }
.fx-change { font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 3px 9px; border-radius: 999px; background: var(--line); white-space: nowrap; }
.fx-change.up { color: #2E7D4F; background: rgba(46,125,79,.12); }
.fx-change.down { color: #FF6B4A; background: rgba(255,107,74,.12); }

/* ---- Audit / change history --------------------------------------------- */
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.audit-item:last-child { border-bottom: none; }
.audit-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%;
  margin-top: 5px; background: var(--muted); }
.audit-dot.created { background: var(--brand, #5B2A86); }
.audit-dot.updated { background: #d98324; }
.audit-body { flex: 1; min-width: 0; }
.audit-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.audit-action { font-weight: 600; font-size: 13.5px; }
.audit-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.audit-summary { margin-top: 4px; font-size: 13px; color: var(--muted); line-height: 1.5;
  word-break: break-word; }

/* ---- Stat tiles --------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); }
.stat .lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat .val { font-family: var(--font-display); font-weight: 700; font-size: 25px; margin-top: 8px; letter-spacing: -.02em; }
.stat.income .val { color: var(--ledger-green); }
.stat.expense .val { color: var(--eras-violet); }
.stat.remit .val { color: var(--home-coral); }
.list-tools { display: flex; align-items: center; gap: 12px; }
.wallet-filter-sel { padding: 7px 30px 7px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 13px; font-family: inherit; cursor: pointer; max-width: 210px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%237a7a86' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 10px; }
.wallet-filter-sel:focus { outline: none; border-color: var(--signal-violet); }

.chart-box { position: relative; width: 100%; }
.chart-box canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

.stat .dot { width: 9px; height: 9px; border-radius: 50%; }
.stat.income .dot { background: var(--ledger-green); }
.stat.expense .dot { background: var(--eras-violet); }
.stat.remit .dot { background: var(--home-coral); }
.stat.net .dot { background: var(--deep-navy); }
.pos { color: var(--ledger-green); } .neg { color: var(--danger); }

/* ---- Section head ------------------------------------------------------- */
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 2px; }
.sec-head h3 { font-size: 16px; }
.sec-head a { font-size: 13px; color: var(--signal-violet); font-weight: 600; }

/* ---- Transaction list --------------------------------------------------- */
.txn { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.txn:last-child { border-bottom: 0; }
.txn .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: 18px; flex-shrink: 0; background: var(--bg); }
.txn .meta { flex: 1; min-width: 0; }
.txn .meta .t { font-weight: 600; font-size: 14.5px; }
.txn .meta .d { font-size: 12.5px; color: var(--muted); }
.txn .amt { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.txn .amt small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 11.5px; color: var(--muted); text-align: right; }
.txn .amt.in { color: var(--ledger-green); }
.txn .amt.out { color: var(--ink); }
.remit-pill { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--home-coral); background: rgba(255,107,74,.12); padding: 2px 7px; border-radius: 999px; }

/* ---- Progress bars ------------------------------------------------------ */
.bar { height: 9px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--signal-violet), var(--eras-violet)); }
.bar.over > span { background: linear-gradient(90deg, var(--sun-gold), var(--danger)); }
.budget-row { padding: 13px 0; border-bottom: 1px solid var(--line); }
.budget-row:last-child { border-bottom: 0; }
.budget-row .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.budget-row .name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.budget-row .figs { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.budget-row .figs b { color: var(--ink); }

/* ---- Goals -------------------------------------------------------------- */
.goals-layout, .wallets-layout { grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.budgets-layout { grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
.goals-list, .wallet-cards { grid-template-columns: repeat(2, 1fr); gap: 18px; align-content: start; }
.goal-add-row { display: flex; gap: 8px; }
.goal-add-row input { flex: 1; min-width: 0; }
.goal-card { position: relative; }
.goal-card .icon { font-size: 26px; }
.goal-card .ring { --p: 0; width: 78px; height: 78px; border-radius: 50%;
  background: conic-gradient(var(--home-coral) calc(var(--p) * 1%), var(--bg) 0);
  display: grid; place-items: center; }
.goal-card .ring i { width: 60px; height: 60px; border-radius: 50%; background: var(--card);
  display: grid; place-items: center; font-style: normal; font-family: var(--font-display); font-weight: 700; }

/* ---- Buttons & forms ---------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 11px;
  font-family: var(--font-display); font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid transparent;
  transition: transform .06s, box-shadow .15s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(100deg, var(--eras-violet), var(--signal-violet)); color: #fff;
  box-shadow: 0 6px 16px rgba(91,42,134,.28); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(91,42,134,.4); }
.btn-coral { background: linear-gradient(100deg, var(--home-coral), var(--home-coral-dk)); color: #fff;
  box-shadow: 0 6px 16px rgba(255,107,74,.3); }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 8px 13px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px;
  font-family: var(--font-body); font-size: 14.5px; color: var(--ink); background: var(--card-2);
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--signal-violet);
  box-shadow: 0 0 0 3px rgba(123,79,181,.15); background: #fff; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 10px; align-items: end; }

/* segmented control */
.seg { display: inline-flex; background: var(--bg); border-radius: 11px; padding: 4px; gap: 4px; }
.seg a, .seg label { padding: 7px 15px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg a.active, .seg input:checked + label { background: #fff; color: var(--eras-violet); box-shadow: var(--shadow); }
.seg input { display: none; }

/* island pick chips */
.islands { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.island { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; transition: border .15s, background .15s; }
.island input { display: none; }
.island .n { font-weight: 700; font-family: var(--font-display); }
.island .c { font-size: 12.5px; color: var(--muted); }
.island:has(input:checked) { border-color: var(--home-coral); background: rgba(255,107,74,.06); }

/* ---- Table -------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
tr:last-child td { border-bottom: 0; }
.tag-cat { display: inline-flex; align-items: center; gap: 7px; }
.tag-cat .sw { width: 9px; height: 9px; border-radius: 3px; }

/* ---- Flash -------------------------------------------------------------- */
.flashwrap { position: fixed; top: 18px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
  background: #fff; border-left: 4px solid var(--signal-violet); animation: pop .25s ease; }
.flash.ok { border-color: var(--ledger-green); }
.flash.error { border-color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }

/* ---- Empty state -------------------------------------------------------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ---- Auth pages --------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: linear-gradient(155deg, var(--eras-violet), var(--deep-navy) 65%);
  color: #fff; padding: 54px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-art .sun { position: absolute; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--home-coral), transparent 68%); opacity: .55;
  right: -120px; bottom: -120px; }
.auth-art .brand { padding: 0; }
.auth-art h2 { font-size: 38px; line-height: 1.08; margin-top: auto; max-width: 12ch; }
.auth-art p { max-width: 34ch; color: #C9C9EA; margin-top: 14px; font-size: 15px; }
.auth-art .worlds-mini { display: flex; gap: 12px; margin-top: 26px; }
.auth-art .wm { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: 12px 16px; font-size: 13px; }
.auth-art .wm b { display: block; font-family: var(--font-display); font-size: 17px; }
.auth-form { display: grid; place-items: center; padding: 40px; }
.auth-form .inner { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 27px; margin-bottom: 6px; }
.auth-form .lede { color: var(--muted); margin-bottom: 26px; font-size: 14.5px; }
.auth-form .alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-form .alt a { color: var(--signal-violet); font-weight: 600; }

/* ---- Landing ------------------------------------------------------------ */
.land-nav { display: flex; align-items: center; justify-content: space-between; padding: 22px 40px; max-width: 1120px; margin: 0 auto; }
.land-nav-actions { display: flex; gap: 10px; align-items: center; }
.land-hero { max-width: 1120px; margin: 0 auto; padding: 40px 40px 70px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 50px; align-items: center; }
.land-hero .kicker { display: inline-flex; align-items: center; gap: 8px; background: rgba(91,42,134,.08);
  color: var(--eras-violet); font-weight: 600; font-size: 12px; padding: 7px 14px; border-radius: 999px;
  white-space: nowrap; max-width: 100%; }
.land-hero h1 { font-size: 52px; line-height: 1.03; margin: 18px 0; letter-spacing: -.03em; }
.land-hero h1 .co { color: var(--home-coral); }
.land-hero p { font-size: 17px; color: var(--muted); max-width: 46ch; }
.land-cta { display: flex; gap: 12px; margin-top: 26px; }
.demo-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 8px; }
.demo-card .world { padding: 22px; }
.land-foot { text-align: center; padding: 30px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.feature-grid { max-width: 1120px; margin: 0 auto; padding: 0 40px 80px; display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.feature { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.feature .fi { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 21px; margin-bottom: 14px; }
.feature h4 { font-size: 16.5px; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 14px; margin: 0; }

/* ---- Convert widget ----------------------------------------------------- */
.convert { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.convert .swap { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; cursor: pointer; margin-bottom: 2px; }
.convert-out { font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--home-coral); }

/* ===========================================================================
   Responsive system (mobile-first breakpoints)
   Phone:   <= 767px  — single column, hamburger drawer nav
   Tablet:  768-1023px — condensed sidebar, 1-2 column layout
   Desktop: >= 1024px  — full layout (styles above are the desktop baseline)
   =========================================================================== */

/* Mobile-only chrome, hidden by default (tablet & desktop) */
.mobile-topbar { display: none; }
.nav-overlay { display: none; }
.nav-toggle { display: none; }

img, svg, video, canvas { max-width: 100%; }

/* ---- Landing & auth (own pages, no sidebar) ------------------------------ */
@media (max-width: 1023px) {
  .land-hero { gap: 34px; }
  .land-hero h1 { font-size: 42px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .land-hero, .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .land-hero h1 { font-size: 40px; }
}

/* ---- Tablet: 768-1023px --------------------------------------------------- */
@media (max-width: 1023px) {
  .sidebar { width: 198px; padding: 20px 12px; }
  .brand { gap: 9px; padding: 0 6px 20px; }
  .brand-mark { width: 34px; height: 34px; font-size: 17px; border-radius: 10px; }
  .brand-name { font-size: 16px; }
  .nav a { padding: 10px 11px; font-size: 13.5px; gap: 10px; }
  .topbar { padding: 18px 24px 6px; }
  .content { padding: 14px 24px 50px; }
  .topbar h1 { font-size: 24px; }

  .stats { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 18px; }
  .goals-layout, .wallets-layout, .budgets-layout { grid-template-columns: 1fr 280px; gap: 16px; }
  .goals-list, .wallet-cards { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .worlds { grid-template-columns: 1fr; }
  .dash-2col { grid-template-columns: 1fr !important; }
  .stats { gap: 12px; }
  .goals-layout, .wallets-layout, .budgets-layout { grid-template-columns: 1fr; }
}

/* ---- Phone: <= 767px ------------------------------------------------------ */
@media (max-width: 767px) {
  html, body { overflow-x: hidden; }

  /* Top bar with hamburger */
  .shell { display: block; }
  .mobile-topbar {
    display: flex; align-items: center; gap: 6px;
    position: sticky; top: 0; z-index: 95;
    background: var(--deep-navy); color: #EDEDF7;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .mobile-topbar .brand { padding: 0; gap: 9px; }
  .mobile-topbar .brand-mark { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }
  .mobile-topbar .brand-name { font-size: 17px; color: #EDEDF7; }
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 10px;
    background: none; border: 0; border-radius: 10px; cursor: pointer;
  }
  .nav-toggle span { display: block; height: 2px; border-radius: 2px; background: #EDEDF7;
    transition: transform .2s, opacity .2s; }
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(300px, 85vw); height: 100dvh;
    padding: 18px 16px;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 120; overflow-y: auto;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(22,23,58,.5); }
  body.nav-open { overflow: hidden; }
  body.nav-open .nav-overlay {
    display: block; position: fixed; inset: 0; z-index: 110;
    background: rgba(22,23,58,.55);
  }
  .nav a { padding: 13px 13px; font-size: 15px; min-height: 44px; }

  /* Layout & spacing */
  .topbar { padding: 14px 16px 4px; }
  .content { padding: 12px 16px; padding-bottom: max(56px, calc(40px + env(safe-area-inset-bottom))); }
  .topbar h1 { font-size: 22px; }
  .card { padding: 16px; }
  .grid { gap: 14px; }

  .stats { grid-template-columns: 1fr; gap: 10px; }
  .stat .val { font-size: 22px; }
  .worlds { grid-template-columns: 1fr; }
  .world { padding: 20px 20px 24px; }
  .world .big { font-size: 24px; }
  .row2, .row3, .convert { grid-template-columns: 1fr; }
  .wallet-widget-grid { grid-template-columns: 1fr; }
  .list-tools { flex-wrap: wrap; }
  .wallet-filter-sel { max-width: 100%; }

  /* Touch targets & inputs */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 44px; }
  input, select, textarea { min-height: 44px; font-size: 16px; } /* 16px stops iOS zoom-on-focus */
  .monthnav a { width: 40px; height: 40px; }
  .seg a, .seg label { padding: 10px 15px; }
  .lang-switch a { padding: 8px 14px; }

  /* Wide tables scroll inside their card, not the page */
  .card table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }

  .flashwrap { left: 12px; right: 12px; }

  /* Landing & legal pages */
  .land-nav { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
  .land-nav .brand-name { font-size: 16px; }
  .land-nav-actions { flex-wrap: wrap; row-gap: 8px; margin-left: auto; }
  .land-hero { padding: 20px 16px 42px; gap: 26px; }
  .land-hero .kicker { white-space: normal; line-height: 1.5; padding: 8px 14px; }
  .land-hero h1 { font-size: clamp(28px, 8.4vw, 32px); }
  .land-hero p { font-size: 15.5px; }
  .land-cta { flex-wrap: wrap; }
  .land-cta .btn { flex: 1 1 140px; justify-content: center; text-align: center; }
  .demo-card { border-radius: 18px; }
  .demo-card .world { padding: 18px; }
  .demo-card .world .big { font-size: 26px; }
  .feature-grid { grid-template-columns: 1fr; padding: 0 16px 50px; gap: 14px; }
  .feature { padding: 20px; }
  .pricing-band { padding: 40px 16px 48px; }
  .pricing-band h2 { font-size: 22px; }
  .legal-wrap { padding: 28px 18px 50px; }
  .auth-form { padding: 26px 18px; }
  .islands { grid-template-columns: 1fr; }
  .price-card { padding: 24px 22px; width: 100%; max-width: 360px; }
  .land-foot { padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); line-height: 1.9; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- PWA install banner -------------------------------------------------- */
.pwa-banner[hidden] { display: none; }
.pwa-banner {
  position: fixed; left: 14px; right: 14px; bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 90; display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 12px 14px;
  max-width: 460px; margin: 0 auto;
}
.pwa-banner img { border-radius: 10px; flex-shrink: 0; }
.pwa-banner .pwa-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.pwa-banner .pwa-txt b { font-family: var(--font-display); font-size: 14.5px; }
.pwa-banner .pwa-txt span { font-size: 12.5px; color: var(--muted); }
.pwa-banner .pwa-close {
  background: none; border: 0; color: var(--muted); font-size: 15px; cursor: pointer;
  padding: 8px; line-height: 1; flex-shrink: 0;
}

/* ---- Transaction attachments ---------------------------------------- */
.attach-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
  color: var(--muted); background: var(--chip, #f0f0f4);
  border: 1px solid var(--line); border-radius: 999px; text-decoration: none;
}
.attach-badge:hover { color: var(--text); border-color: var(--muted); }

.attach-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.attach-item {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--card-2, #fafafc); display: flex; flex-direction: column;
}
.attach-thumb {
  display: flex; align-items: center; justify-content: center;
  height: 120px; background: #fff; border-bottom: 1px solid var(--line);
  overflow: hidden; text-decoration: none;
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-icon { font-size: 46px; }
.attach-meta { padding: 9px 11px; display: flex; flex-direction: column; gap: 7px; }
.attach-name {
  font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attach-name:hover { text-decoration: underline; }
.attach-actions { display: flex; align-items: center; gap: 12px; }
.attach-actions form { margin: 0; }
.attach-link, .attach-del {
  font-size: 12px; font-weight: 600; background: none; border: none;
  padding: 0; cursor: pointer; text-decoration: none;
}
.attach-link { color: var(--brand, #4b5bd4); }
.attach-del { color: #c0392b; }
.attach-link:hover, .attach-del:hover { text-decoration: underline; }

.attach-add {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.file-input {
  font-size: 13px; color: var(--muted); max-width: 100%;
}
.file-input::file-selector-button {
  margin-right: 10px; padding: 8px 13px; font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--chip, #f0f0f4);
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
}
.file-input::file-selector-button:hover { border-color: var(--muted); }

/* ---- Upload choice buttons (attach vs camera) ----------------------- */
.upload-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.upload-btn {
  display: inline-flex; align-items: center; gap: 7px; flex: 1 1 auto;
  justify-content: center; padding: 11px 14px; font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--chip, #f0f0f4);
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  text-align: center; transition: border-color .15s, background .15s;
}
.upload-btn:hover { border-color: var(--muted); background: #fff; }
.upload-btn input[type=file] {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.attach-add .upload-names { margin: 4px 0 2px; }

/* ---- Camera capture modal ---- */
.cam-modal{position:fixed;inset:0;background:rgba(20,12,32,.72);display:flex;align-items:center;justify-content:center;z-index:1000;padding:20px;}
.cam-modal[hidden]{display:none;}
.cam-box{background:#fff;border-radius:18px;padding:16px;width:100%;max-width:min(92vw,560px);box-shadow:0 24px 60px rgba(0,0,0,.35);}
.cam-box video{width:100%;max-height:60vh;border-radius:12px;background:#000;display:block;object-fit:contain;}
.cam-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:14px;}

/* ---- Budget coach ---- */
.coach-note { background: linear-gradient(150deg, #FFF8F0, #FFF1E6); border: 1px solid rgba(255,107,74,.18); }
.cn-title { font-family: var(--font-display); font-weight: 800; font-size: 19px; margin-top: 10px; color: var(--eras-violet); }
.cn-body { font-size: 13.5px; line-height: 1.55; margin: 7px 0 12px; color: #4a3f56; }
.cn-habit { font-size: 13px; line-height: 1.5; background: #fff; border: 1px dashed rgba(226,78,46,.4); border-radius: 12px; padding: 10px 12px; color: #3c3247; }
.cn-habit-tag { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--home-coral-dk); margin-bottom: 3px; }
.coach-tips { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.coach-tip { display: flex; gap: 11px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; background: #faf8fc; border-left: 3px solid #d8d2e2; }
.coach-tip p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.coach-tip .ct-icon { font-size: 17px; line-height: 1.3; flex-shrink: 0; }
.coach-tip.alert { background: #fdf1ef; border-left-color: #d64541; }
.coach-tip.warn  { background: #fdf6ec; border-left-color: #e8a13c; }
.coach-tip.good  { background: #eff7f1; border-left-color: var(--ledger-green); }
.coach-tip.info  { background: #f3f0f9; border-left-color: var(--eras-violet); }

/* ---- Help & FAQ ---- */
.help-search-card { padding: 16px 18px; }
.help-search { display: flex; align-items: center; gap: 10px; background: #f5f2fa;
  border: 1.5px solid #e2dbee; border-radius: 14px; padding: 11px 15px; }
.help-search:focus-within { border-color: var(--eras-violet); background: #fff;
  box-shadow: 0 0 0 3px rgba(91,42,134,.10); }
.help-search .hs-icon { font-size: 16px; opacity: .7; }
.help-search input { flex: 1; border: 0; background: transparent; outline: none;
  font: inherit; font-size: 15px; color: inherit; }
.hs-meta { font-size: 12.5px; color: #7a6f8a; margin-top: 8px; min-height: 1em; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px; margin-top: 14px; }
.help-topic { background: #faf8fc; border: 1px solid #eee9f5; border-radius: 14px;
  padding: 15px 16px; }
.help-topic .ht-head { font-weight: 700; font-size: 14.5px; color: var(--eras-violet);
  margin-bottom: 7px; }
.help-topic p { margin: 0; font-size: 13px; line-height: 1.55; color: #4a3f56; }
.faq-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.faq { background: #faf8fc; border: 1px solid #eee9f5; border-radius: 12px;
  padding: 0 15px; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 13px 0;
  list-style: none; position: relative; padding-right: 26px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 2px; top: 50%;
  transform: translateY(-50%); font-size: 18px; font-weight: 700; color: var(--eras-violet); }
.faq[open] summary::after { content: "–"; }
.faq[open] { background: #fff; border-color: #ded4ec; }
.faq p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.55; color: #4a3f56; }

/* ---- Legal pages ---- */
.legal-wrap { max-width: 780px; margin: 0 auto; padding: 44px 24px 60px; }
.legal-wrap h1 { font-family: var(--font-display); font-weight: 800; font-size: 34px;
  color: var(--eras-violet); margin: 0 0 6px; }
.legal-meta { font-size: 12.5px; color: #7a6f8a; margin: 0 0 22px; }
.legal-wrap h2 { font-family: var(--font-display); font-weight: 700; font-size: 19px;
  color: var(--eras-violet); margin: 26px 0 8px; }
.legal-wrap p, .legal-wrap li { font-size: 14px; line-height: 1.65; color: #3c3247; }
.legal-wrap ul { padding-left: 20px; margin: 8px 0; }
.legal-wrap li { margin-bottom: 7px; }

/* Brand as a link back to the main page */
a.brand { text-decoration: none; color: inherit; cursor: pointer; }

/* ---- Language switcher ---------------------------------------------------- */
.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(22, 23, 58, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lang-switch a {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-switch a:hover { color: var(--ink); }
.lang-switch a.active {
  background: var(--eras-violet);
  color: #fff;
}
.sidebar .lang-switch {
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}
.sidebar .lang-switch a { color: #A9AAD8; }
.sidebar .lang-switch a:hover { color: #fff; }
.sidebar .lang-switch a.active { background: var(--eras-violet); color: #fff; }

/* Registration confirmation checkbox */
.confirm-check{ display:flex; align-items:flex-start; gap:10px; font-size:13px; line-height:1.45; color:var(--ink,#2b2b45); cursor:pointer; }
.confirm-check input[type=checkbox]{ margin-top:2px; width:16px; height:16px; flex:0 0 auto; accent-color:#2E7D4F; }

/* Landing pricing band */
.pricing-band{ text-align:center; padding:54px 24px 60px; border-top:1px solid var(--line); }
.pricing-band h2{ font-size:26px; margin-bottom:22px; }
.price-card{ display:inline-block; background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:30px 46px; box-shadow:var(--shadow-lg); }
.price-free{ display:inline-block; background:var(--eras-mint,#DFF5EC); color:#0B6B4F; font-weight:700; font-size:13px; padding:4px 12px; border-radius:999px; margin-bottom:10px; }
.price-intro{ font-family:var(--font-display); font-weight:800; font-size:42px; letter-spacing:-.02em; color:var(--eras-violet); }
.price-label{ font-size:14px; font-weight:600; margin-top:2px; }
.price-then{ font-size:13px; color:var(--muted); margin-top:6px; }

.price-cards{ display:flex; justify-content:center; gap:18px; flex-wrap:wrap; }
