/* Home Feghaly: forest ink, brass accent, mist ground. Phone first (360 px and up), light and dark. */
:root {
  --bg: #F2F5F2; --surface: #FFFFFF; --surface2: #E8EFEA; --ink: #15302A; --muted: #556F66; --line: #D5E0D8;
  --primary: #1E6B57; --on-primary: #FFFFFF; --accent: #D9921B; --on-accent: #1B1405;
  --good: #2E8B57; --warn: #B87800; --bad: #C2433A; --shadow: 0 1px 2px rgba(21,48,42,.08), 0 6px 18px rgba(21,48,42,.07);
  --bar: #BBD0C5; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1815; --surface: #16231F; --surface2: #1E2F2A; --ink: #E8F1EC; --muted: #93AEA5; --line: #2A3F38;
    --primary: #3DAA8C; --on-primary: #062018; --accent: #E3A83A; --on-accent: #1B1405;
    --good: #4CC38A; --warn: #E3A83A; --bad: #EE6B60; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3); --bar: #2D4A40; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding: env(safe-area-inset-top) 0 0; min-height: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.num, .money { font-variant-numeric: tabular-nums; }
.app { max-width: 520px; margin: 0 auto; padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* top bar */
.top { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .01em; }
.brand svg { width: 28px; height: 28px; flex: none; }
.top .who { margin-left: auto; font-size: 13px; color: var(--muted); }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.card + .card, .card + .sec, .sec + .card, .sec + .sec { margin-top: 14px; }
.sec h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 4px 8px; font-weight: 700; }
.hero { padding: 18px 18px 16px; }
.hero .lab { font-size: 13px; color: var(--muted); }
.hero .big { font-size: 44px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 10px; }
.hero .big.neg { color: var(--bad); }
.gauge { position: relative; height: 12px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.gauge i { position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); border-radius: 99px; background: var(--good); }
.gauge.warn i { background: var(--warn); } .gauge.bad i { background: var(--bad); }
.gauge::after { content: ""; position: absolute; left: 80%; top: 0; bottom: 0; width: 2px; background: var(--bg); opacity: .9; }
.hero .row { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 14px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; background: var(--surface2); font-size: 13px; }
.pill b { font-weight: 700; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.row2 { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); min-height: 56px; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.list li:first-child .row2, .row2.first { border-top: 0; }
.dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface2); color: var(--primary); flex: none; }
.row2 .mid { flex: 1; min-width: 0; }
.row2 .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row2 .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row2 .amt { font-weight: 700; flex: none; }
.day { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 4px 2px; font-weight: 700; }
.cam { width: 14px; height: 14px; vertical-align: -2px; margin-left: 6px; color: var(--muted); }
.catrow { padding: 9px 0; }
.catrow .top2 { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.catrow .top2 span:first-child { font-weight: 600; }
.catrow .mini { height: 6px; border-radius: 6px; background: var(--surface2); margin-top: 6px; overflow: hidden; }
.catrow .mini i { display: block; height: 100%; width: var(--w, 0%); background: var(--primary); border-radius: 6px; }
.catrow.over .mini i { background: var(--bad); }
.fixedtag { font-size: 12px; background: var(--surface2); border-radius: 6px; padding: 1px 6px; margin-left: 6px; color: var(--muted); font-weight: 600; }

/* buttons, inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 650; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.btn.accent { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 14px; }
.txt { background: none; border: 0; color: var(--primary); font-weight: 650; min-height: 44px; padding: 0 6px; }
.field { display: block; margin: 12px 0 0; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin: 0 2px 5px; font-weight: 600; }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; }
input:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.seg { display: flex; background: var(--surface2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 44px; border: 0; background: none; border-radius: 10px; font-weight: 650; color: var(--muted); }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.switch { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-height: 56px; }
.switch:first-of-type { border-top: 0; }
.switch .tx { flex: 1; } .switch .tx b { display: block; font-weight: 600; } .switch .tx small { color: var(--muted); font-size: 13px; }
.switch input { appearance: none; width: 52px; height: 32px; border-radius: 99px; background: var(--bar); position: relative; flex: none; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked { background: var(--primary); } .switch input:checked::after { transform: translateX(20px); }
.note { background: var(--surface2); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.note.warn { border: 1px solid var(--warn); }
.banner { margin: 0 0 12px; padding: 11px 14px; border-radius: 12px; background: var(--surface2); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.banner.pending { border: 1px solid var(--accent); }
.linkbox { word-break: break-all; font-size: 13px; background: var(--surface2); padding: 10px 12px; border-radius: 10px; user-select: all; margin-top: 8px; }

/* bottom bar + add button */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 76px 1fr; align-items: center; max-width: 520px; margin: 0 auto; z-index: 5; }
.tabs button.t { background: none; border: 0; min-height: 52px; display: grid; place-items: center; gap: 2px; font-size: 12px; font-weight: 650; color: var(--muted); }
.tabs button.t svg { width: 24px; height: 24px; }
.tabs button.t[aria-current=page] { color: var(--primary); }
.fab { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; margin: -26px auto 0; box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.fab svg { width: 30px; height: 30px; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(10px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet .in { max-width: 520px; margin: 0 auto; }
.sheet .bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; min-height: 48px; }
.sheet .bar h2 { font-size: 18px; }
.amtbox { display: flex; align-items: baseline; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 16px; }
.amtbox b { font-size: 30px; color: var(--muted); }
.amtbox input { border: 0; background: none; font-size: 40px; font-weight: 800; padding: 0; min-height: 56px; letter-spacing: -.02em; }
.amtbox input:focus-visible { outline: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 15px; }
.chip[aria-pressed=true] { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.photo { display: flex; align-items: center; gap: 12px; }
.photo img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.bigphoto { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 14px; background: var(--surface2); margin-top: 8px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 99px; font-size: 14px; font-weight: 600; z-index: 40; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.center { min-height: calc(100vh - 80px); display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.center .logo { width: 72px; height: 72px; border-radius: 18px; }
.center h1 { font-size: 30px; letter-spacing: -.02em; }
.steps { margin: 6px 0 0; padding-left: 20px; } .steps li { margin: 6px 0; }
.mcard { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.mcard + .mcard { margin-top: 10px; }
.mcard .top2 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mcard .nm { font-weight: 700; } .mcard .g { margin-top: 10px; }
.nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.nav button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 20px; }
.nav button[disabled] { opacity: .35; }
.nav h2 { font-size: 20px; }
.practice { background: var(--accent); color: var(--on-accent); border-radius: 12px; padding: 10px 14px; font-weight: 650; font-size: 14px; margin-bottom: 12px; }
@media (min-width: 560px) { .hero .big { font-size: 52px; } .app { padding-top: 24px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.row2 .t, .row2 .s { display: block; }

/* long names, long notes and big numbers must never push the page sideways */
html, body { overflow-x: clip; }
.app, .sheet, .toast { overflow-wrap: anywhere; }
.top .who { min-width: 0; max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { flex: none; }
.catrow .top2 > span:first-child, .mcard .top2 > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.catrow .top2 > span:last-child, .mcard .top2 > span:last-child { flex: none; white-space: nowrap; }
.hero .big { max-width: 100%; }
.hero .big.m { font-size: 36px; } .hero .big.s { font-size: 30px; } .hero .big.xs { font-size: 25px; }
.pill { max-width: 100%; }
.chip { max-width: 100%; white-space: normal; text-align: left; padding-top: 8px; padding-bottom: 8px; line-height: 1.25; }
.amtbox input { min-width: 0; width: 100%; }
.mcard .nm { min-width: 0; }
.center h1 { overflow-wrap: anywhere; }

