/* Poppins, kept with the app so it works offline and nothing is fetched from another site (SIL Open Font License) */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/poppins-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/poppins-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/poppins-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/poppins-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/poppins-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/poppins-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/poppins-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/poppins-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  /* Navy and gold, taken from the family logo */
  --ground: #08121D; --card: #101C2B; --line: #26384F; --line2: #1B2A3D;
  --ink: #F4EEE2; --muted: #A7B2C2; --faint: #6F7C8E;
  --teal: #D9A65A; --teal-d: #E9BE76; --on-accent: #0A1420;
  --teal-soft: #2A2B2A; --teal-line: #5E4C2E; --gold-text: #F0C67E;
  --warn: #F5B48E; --warn-soft: #3A2219; --warn-line: #6B3A26; --warn-fill: #E07A4A;
  --chip: #1C2B3E; --chip-ink: #D9E0EA;
  --danger: #FF8E7E; --danger-line: #6B2E28;
  --blue: #2C455A; --blue-l: #3E5B76;
  --serif: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sans: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
  --wash-xs: rgba(255, 255, 255, .025); --wash-s: rgba(255, 255, 255, .035); --wash-m: rgba(255, 255, 255, .06); --wash-l: rgba(255, 255, 255, .1);
  --field: rgba(8, 18, 29, .7); --field-solid: #0C1724; --well: #050C14;
  --hero: linear-gradient(160deg, #1A2E45, #10202F); --hero2: linear-gradient(135deg, #14243A, #0F1B2B);
  --glow: #15293F; --glass: rgba(14, 25, 40, .78); --glass-line: rgba(60, 82, 110, .55); --card-line: rgba(54, 74, 100, .6);
  --scroll: #243750; --toast-bg: rgba(244, 238, 226, .97); --toast-ink: #0A1420; --scrim: rgba(3, 8, 14, .6);
  --drawer: linear-gradient(180deg, #112033, #0D1A2A); --tile-hover: rgba(94, 76, 46, .8);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.45 var(--sans); -webkit-tap-highlight-color: transparent; }
body { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
#app { max-width: 560px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top, 0px)) 18px 24px; display: flex; flex-direction: column; gap: 16px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 19px; line-height: 1.25; }
h3 { font-size: 16px; }
a { color: var(--gold-text); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 8px; }
.kicker { font-size: 13px; color: var(--muted); font-weight: 500; }
.row { display: flex; align-items: center; gap: 12px; }
.gap8 { gap: 8px; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.sec { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 12px; }
.sec a { font-size: 14px; font-weight: 600; text-decoration: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 2px 16px; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line2); color: inherit; text-decoration: none; min-height: 56px; }
.list > .li:first-child, .list > :first-child .li { border-top: none; }
a.li:hover .t, .li a.grow:hover .t { color: var(--teal); }
.li a.grow { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
.t { font-size: 15px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 13px; }
.when { width: 50px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; padding: 14px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--chip-ink); white-space: nowrap; border: none; font-family: var(--sans); }
.chip.ok { background: var(--teal-soft); color: var(--gold-text); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
button.chip, label.chip { min-height: 36px; cursor: pointer; }
button.chip[aria-pressed="true"] { background: var(--teal); color: var(--on-accent); }
.av { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 600; flex-shrink: 0; border: 2px solid var(--card); }
.avs { display: inline-flex; flex-shrink: 0; }
.avs .av + .av { margin-left: -7px; }
.btn, .btn2 { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; font: 600 14px var(--sans); text-decoration: none; cursor: pointer; }
.btn { border: none; background: var(--teal); color: var(--on-accent); }
.btn:hover { background: var(--teal-d); }
.btn2 { border: 1px solid var(--teal-line); background: var(--card); color: var(--gold-text); }
.btn2:hover { background: var(--teal-soft); }
.btn.danger { background: var(--danger); color: var(--on-accent); }
.small { min-height: 36px; padding: 0 12px; }
.full { width: 100%; }
.ib { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer; flex-shrink: 0; text-decoration: none; }
.ib.solid { background: var(--teal); border-color: var(--teal); color: var(--on-accent); }
.tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--teal-line); background: var(--card); cursor: pointer; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--teal); padding: 0; }
.tick:hover { border-color: var(--teal); background: var(--teal-soft); }
.tick svg { opacity: 0; } .tick:hover svg { opacity: 1; }
input, select, textarea { font: 15px var(--sans); color: var(--ink); }
.inp, .field input:not([type=checkbox]):not([type=color]):not([type=file]), .field select, .field textarea { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--field-solid); }
.field textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 6px; border: none; margin: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0; }
.field input[type=color] { width: 64px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 4px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; cursor: pointer; }
.cb, .check input { width: 22px; height: 22px; accent-color: var(--teal); margin: 0; flex-shrink: 0; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px 0 4px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; font-size: 14px; }
.pchip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pchip:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.pchip:has(input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 2px; }
.pchip .av { width: 26px; height: 26px; border: none; }
.seg { display: flex; background: var(--chip); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button, .seg a { flex: 1; min-height: 40px; border: none; border-radius: 9px; background: transparent; font: 600 14px var(--sans); color: var(--chip-ink); cursor: pointer; text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; }
.seg [aria-pressed="true"], .seg [aria-current] { background: var(--card); color: var(--ink); }
.digest { background: var(--hero); border: 1px solid var(--teal-line); color: var(--ink); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.digest .kicker { color: var(--gold-text); }
.digest .big { font-family: var(--serif); font-size: 22px; line-height: 1.25; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats > div { background: var(--field); border-radius: 12px; padding: 10px; }
.stats b { display: block; font-size: 18px; }
.stats span { font-size: 12px; color: var(--muted); }
.hero { border-radius: 18px; padding: 18px; color: var(--ink); display: flex; flex-direction: column; gap: 6px; background: linear-gradient(160deg, var(--blue-l), var(--blue)); }
.hero .kicker { color: var(--gold-text); } .hero h2 { color: var(--ink); font-size: 26px; }
.alert { background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn); border-radius: 16px; padding: 14px 16px; }
.alert b { display: block; margin-bottom: 2px; }
.note { background: var(--teal-soft); border: 1px solid var(--teal-line); color: var(--gold-text); border-radius: 16px; padding: 12px 16px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px; min-height: 96px; overflow-wrap: normal; word-break: keep-all; hyphens: none; }
.tile:hover { border-color: var(--teal-line); }
.tile .t { font-weight: 600; overflow-wrap: normal; word-break: keep-all; }
.bar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.bar > div { height: 8px; background: var(--teal); border-radius: 4px; }
.bar > div.over { background: var(--warn-fill); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; border-radius: 12px; border: none; background: var(--card); color: var(--ink); font-family: var(--sans); cursor: pointer; min-height: 64px; }
.day small { font-size: 11px; font-weight: 600; color: var(--muted); }
.day b { font-size: 17px; }
.day.sel { background: var(--teal); color: var(--on-accent); } .day.sel small { color: var(--on-accent); }
.day.today:not(.sel) { box-shadow: inset 0 0 0 2px var(--teal-line); }
.day.out { opacity: .45; }
.dots { display: flex; gap: 2px; height: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.stripe { width: 6px; align-self: stretch; border-radius: 3px; flex-shrink: 0; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--teal); color: var(--on-accent); border-bottom-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.scanbox { border-radius: 18px; background: var(--well); border: 1px solid var(--line); min-height: 220px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 600; overflow: hidden; }
.scanbox img { max-width: 100%; max-height: 380px; display: block; }
.thumb { width: 44px; height: 54px; border-radius: 6px; background: var(--chip); object-fit: cover; flex-shrink: 0; }
.docimg { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 96px; }
.chart > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; justify-content: flex-end; height: 100%; }
.chart i { width: 100%; background: var(--blue-l); border-radius: 6px 6px 2px 2px; display: block; }
.chart i.last { background: var(--teal); }
.chart span { font-size: 11px; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pre { white-space: pre-line; }
.center { text-align: center; }
#nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 6px 8px calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 5; }
#nav:empty { display: none; }
#nav .inner { display: flex; width: 100%; max-width: 560px; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; font-size: 11px; font-weight: 600; text-decoration: none; color: var(--muted); min-height: 52px; }
.tab.on { color: var(--teal); }
#toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--ink); color: var(--on-accent); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 10; max-width: calc(100% - 36px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.lock { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
/* list badges, money and key-value rows */
.badge { border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; flex-shrink: 0; font-family: var(--serif); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bigmoney { font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stackbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--chip); }
.stackbar i { display: block; height: 100%; }
.stackbar i + i { border-left: 2px solid var(--card); }
.legend { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.legend > div { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.legend b { color: var(--ink); font-weight: 600; }
.kvs { display: grid; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; min-height: 44px; padding: 6px 0; border-top: 1px solid var(--line2); font-size: 15px; }
.kvs > .kv:first-child { border-top: none; }
.kv > span:first-child { color: var(--muted); }
.kv > span:last-child { text-align: right; justify-self: end; max-width: 100%; }
.kv .av { vertical-align: middle; }
/* compact rows for utilities and purchases */
.urow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line2); color: inherit; text-decoration: none; min-height: 64px; }
.list > .urow:first-child { border-top: none; }
.umain { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; min-width: 0; }
.umain .chip { margin-top: 4px; white-space: normal; max-width: 100%; }
.uamt { display: grid; text-align: right; }
.uamt .muted { font-size: 12px; }
.uend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.urow:hover .t { color: var(--teal); }
.secr { flex-shrink: 0; }
.sec h2 { min-width: 0; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; }
.checks svg { color: var(--teal); flex-shrink: 0; margin-top: 3px; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: '+'; margin-left: auto; color: var(--muted); font-size: 20px; }
details[open] > summary::after { content: '–'; }
/* receipts */
.receipt { background: #FBF6EC; color: #1F2328; border: 1px solid var(--line); border-radius: 16px; padding: 20px 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 0 var(--line2); }
.receipt .center { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.receipt .rule { border-top: 2px dashed var(--line); margin: 8px 0; }
.rline { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; font-variant-numeric: tabular-nums; }
.rline > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.rline > span:last-child { flex-shrink: 0; }
.rline.total { font-weight: 700; font-size: 18px; }
.rawtext { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; color: var(--muted); max-height: 420px; overflow-y: auto; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line2); }

.receipt h1, .receipt .rline { color: #1F2328; }
.receipt .muted { color: #5E5A52; }
.receipt .rule { border-top-color: #D9CFBE; }
.av { border-color: var(--card); }
.tick:hover { background: var(--teal-soft); }
.tab.on { color: var(--teal); }
.tile:hover, .card:hover { border-color: var(--line); }
::selection { background: rgba(217, 166, 90, 0.35); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select option { background: var(--field-solid); color: var(--ink); }
/* home: quick menu, actions, quick contacts */
.qgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.qtile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; background: var(--card); border: 1px solid var(--line2); color: var(--ink); text-decoration: none; font-size: 12px; font-weight: 600; text-align: center; min-height: 80px; line-height: 1.2; }
.qtile:hover { border-color: var(--teal-line); }
.qicon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--teal-soft); color: var(--gold-text); }
.action { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--blue-l); border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; }
.action.lvl1 { border-left-color: var(--warn-fill); }
.action.lvl2 { border-left-color: var(--teal); }
.action .btn2 svg { flex-shrink: 0; }
.linkbtn { background: none; border: none; color: var(--muted); font: 600 13px var(--sans); cursor: pointer; padding: 8px 6px; min-height: 36px; text-decoration: underline; }
.qcontacts { display: grid; grid-auto-flow: column; grid-auto-columns: 84px; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.qc { display: grid; justify-items: center; gap: 4px; text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 600; min-width: 0; text-align: center; }
.qc .muted { font-size: 11px; max-width: 100%; }
.qc .ellipsis { max-width: 100%; }
/* scanned pages */
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.pages figure { margin: 0; display: grid; gap: 4px; }
.pages img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--well); }
.pages figcaption { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.pages .linkbtn { padding: 4px; min-height: 28px; font-size: 12px; }
/* passports and IDs */
.idcard { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--hero2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; color: var(--ink); text-decoration: none; }
.idthumb { width: 64px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--chip); }
.idicon { display: flex; align-items: center; justify-content: center; color: var(--gold-text); }
.sec h2 .av { vertical-align: middle; margin-right: 4px; }
/* travel tickets */
.ticket { background: var(--hero); border: 1px solid var(--teal-line); border-radius: 18px; padding: 16px; display: grid; gap: 12px; }
.ticket .ref { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: 0.06em; color: var(--gold-text); }
.route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.route b { display: block; font-size: 18px; overflow-wrap: anywhere; }
.route span { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; }
.route .arrow { color: var(--teal); }
/* spending analysis */
.catrow { display: grid; gap: 6px; width: 100%; background: none; border: none; padding: 0; color: var(--ink); font: 15px var(--sans); text-align: left; cursor: pointer; }
.catrow[aria-pressed="true"] { outline: 2px solid var(--teal-line); outline-offset: 4px; border-radius: 6px; }
.catrow .bar > div { background: var(--teal); }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.mchart { display: flex; align-items: flex-end; gap: 8px; height: 130px; }
.mchart > div { flex: 1; display: grid; grid-template-rows: 1fr auto; gap: 4px; height: 100%; min-width: 0; }
.mchart .bars { display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.mchart i { flex: 1; border-radius: 4px 4px 1px 1px; display: block; min-height: 2px; }
.mchart i.in { background: #6FAE8C; } .mchart i.out { background: var(--teal); }
.mchart > div > span:last-child { font-size: 11px; color: var(--muted); text-align: center; }
.minisel { min-height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--field-solid); color: var(--muted); font: 12px var(--sans); max-width: 110px; }

.hijri { display: block; font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--gold-text); letter-spacing: 0.01em; margin-top: 2px; }
h2 .hijri { font-size: 13px; }
.doctype { display: inline-flex; align-items: center; justify-content: center; color: var(--gold-text); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }

/* Voice commands */
.voiceview { position: fixed; inset: 0; z-index: 55; background: var(--well); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; padding-top: calc(24px + env(safe-area-inset-top, 0px)); padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); text-align: center; gap: 18px; }
.voiceview .mic-circle { width: 92px; height: 92px; border-radius: 50%; background: var(--teal-soft); border: 2px solid var(--teal-line); display: flex; align-items: center; justify-content: center; color: var(--gold-text); flex-shrink: 0; }
.voiceview .mic-circle.listening { animation: micpulse 1.4s ease-in-out infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 166, 90, 0.35); } 50% { box-shadow: 0 0 0 18px rgba(217, 166, 90, 0); } }
.voiceview .transcript { font-size: 18px; min-height: 28px; color: var(--ink); max-width: 480px; }
.voiceview .status { color: var(--muted); font-size: 14px; }
.voiceview .vresult { max-width: 480px; }
.voiceview .vresult .t { font-size: 19px; font-weight: 600; }
.voiceview .vbtns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.micbtn { color: var(--gold-text); }

/* PDF preview */
body.noscroll { overflow: hidden; }
.pdfview { position: fixed; inset: 0; z-index: 50; background: var(--well); display: grid; grid-template-rows: auto 1fr auto; padding-top: env(safe-area-inset-top, 0px); }
.pdfview header { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.pdfview footer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--line); }
.pdfpages { overflow: auto; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; -webkit-overflow-scrolling: touch; }
.pdfpages canvas { background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); max-width: 100%; height: auto; }
.pdfthumb { display: block; width: 100%; padding: 10px; background: var(--well); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; position: relative; min-height: 120px; }
.pdfthumb [data-pdfthumb] { display: flex; justify-content: center; align-items: center; min-height: 100px; }
.pdfthumb canvas { background: #fff; border-radius: 4px; max-width: 100%; height: auto; max-height: 460px; object-fit: contain; }
.pdfpages-chip { position: absolute; right: 16px; bottom: 16px; }

.field input.filled, .field textarea.filled { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-soft); }
.ocrnote { font-size: 13px; color: var(--gold-text); }

.mrow { grid-template-columns: minmax(0, 1fr) auto; }
.mlink { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; color: inherit; text-decoration: none; min-width: 0; }
.mrow .ib { width: 40px; height: 40px; color: var(--muted); }

.day .hday { font-size: 10px; font-weight: 600; color: var(--gold-text); line-height: 1; }
.day.sel .hday { color: var(--on-accent); }

/* weather: the day's forecast under a date, and a small icon and high on each calendar day */
.hijri.wxl { color: var(--ink); font-weight: 500; opacity: .9; }
.day .wxd { font-size: 10px; font-weight: 600; line-height: 1.1; color: var(--muted); white-space: nowrap; }
.day.sel .wxd { color: var(--on-accent); }

/* ===================== v2: Poppins, calmer surfaces, motion ===================== */
:root {
  --ease: cubic-bezier(.22, .8, .24, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
  --shadow: 0 10px 30px rgba(0, 0, 0, .34); --shadow-sm: 0 2px 12px rgba(0, 0, 0, .22);
  --r: 18px;
}
html, body { font-family: var(--sans); font-size: 14.5px; line-height: 1.5; font-synthesis: none; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { background: radial-gradient(900px 420px at 50% -140px, var(--glow) 0%, var(--ground) 62%) fixed, var(--ground); }
h1 { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
h3 { font-size: 15px; font-weight: 600; }
.kicker { font-size: 12.5px; letter-spacing: 0.01em; }
.t { font-weight: 500; }
.muted { font-size: 12.5px; }
.bigmoney, .badge, .ticket .ref, .digest .big { font-family: var(--sans); }
.bigmoney { letter-spacing: -0.02em; }

/* surfaces */
.card, .list, .tile, .qtile, .action, .ticket, .idcard { border-radius: var(--r); }
.card, .list { box-shadow: var(--shadow-sm); border-color: var(--card-line); transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.tile, .qtile { transition: border-color .2s var(--ease), transform .15s var(--ease), background-color .2s var(--ease); }
.tile:hover, .qtile:hover { transform: translateY(-2px); }
.urow, .li { transition: background-color .15s var(--ease); border-radius: 10px; }
.urow:hover, a.li:hover { background: var(--wash-xs); }
.digest, .hero { border-radius: 22px; box-shadow: var(--shadow); }
.sec h2 { font-size: 16px; }

/* controls: everything responds under a finger */
.btn, .btn2, .ib, .chip, .tab, .tick, .day, .catrow { transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .14s var(--ease), box-shadow .2s var(--ease); }
.btn { background: linear-gradient(180deg, var(--teal-d), var(--teal)); box-shadow: 0 6px 18px rgba(217, 166, 90, .22); border-radius: 14px; }
.btn:hover { background: linear-gradient(180deg, #F0CB86, var(--teal-d)); }
.btn2, .ib { border-radius: 14px; }
.btn:active, .btn2:active, .ib:active, .chip:active, .day:active, .tile:active, .qtile:active, .tab:active, .urow:active, .li:active { transform: scale(.97); }
button.chip[aria-pressed="true"] { box-shadow: 0 4px 14px rgba(217, 166, 90, .25); }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(217, 166, 90, .16); }
.field input, .field select, .field textarea, .inp { transition: border-color .18s var(--ease), box-shadow .2s var(--ease); border-radius: 14px; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; } ::-webkit-scrollbar-track { background: transparent; }

/* the header: a menu button, then the title */

/* the bottom bar floats on frosted glass */
#nav { background: var(--card); border-top: 1px solid var(--glass-line); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 28px rgba(0, 0, 0, .3); }
.tab { position: relative; border-radius: 14px; }
.tab svg { transition: transform .3s var(--spring); }
.tab.on svg { transform: translateY(-2px) scale(1.1); }
.tab.on::after { content: ''; position: absolute; bottom: 2px; width: 18px; height: 3px; border-radius: 3px; background: var(--teal); }

/* moving between pages */
#app.enter > * { animation: pageIn .42s var(--ease) both; }
#app.enter > *:nth-child(2) { animation-delay: 40ms; } #app.enter > *:nth-child(3) { animation-delay: 80ms; } #app.enter > *:nth-child(4) { animation-delay: 120ms; }
#app.enter > *:nth-child(5) { animation-delay: 150ms; } #app.enter > *:nth-child(6) { animation-delay: 180ms; } #app.enter > *:nth-child(7) { animation-delay: 205ms; }
#app.enter > *:nth-child(8) { animation-delay: 230ms; } #app.enter > *:nth-child(n+9) { animation-delay: 250ms; }
#app.enter.back > * { animation-name: pageBack; }
#nav.enter .tab.on svg { animation: tabPop .5s var(--spring); }
#app.enter, #nav.enter { will-change: transform, opacity; }
@keyframes pageIn { from { opacity: 0; transform: translateY(16px) scale(.992); } to { opacity: 1; transform: none; } }
@keyframes pageBack { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
@keyframes tabPop { 0% { transform: translateY(4px) scale(.8); } 60% { transform: translateY(-4px) scale(1.18); } 100% { transform: translateY(-2px) scale(1.1); } }

/* a confirmation: slides up, the tick draws itself */
#toast { display: flex; align-items: center; gap: 10px; background: var(--toast-bg); color: var(--toast-ink); padding: 9px 18px 9px 9px; border-radius: 22px; box-shadow: var(--shadow); font-weight: 500; transform: translate(-50%, 28px) scale(.92); transition: opacity .25s var(--ease), transform .5s var(--spring); }
#toast.show { transform: translate(-50%, 0) scale(1); }
#toast .ticon { width: 28px; height: 28px; border-radius: 50%; background: var(--teal); color: #0A1420; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
#toast.show .ticon { animation: tickPop .55s var(--spring) both; }
#toast .tpath { stroke-dasharray: 24; stroke-dashoffset: 24; }
#toast.show .tpath { animation: tickDraw .45s .15s var(--ease) forwards; }
#toast.bad .ticon { background: var(--warn-fill); color: #fff; }
#toast.bad.show .ticon { animation: tickShake .5s ease both; }
#toast .ttxt { line-height: 1.3; }
@keyframes tickPop { 0% { transform: scale(.2); opacity: 0; } 60% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(1); } }
@keyframes tickDraw { to { stroke-dashoffset: 0; } }
@keyframes tickShake { 0% { transform: scale(.4); opacity: 0; } 30% { transform: scale(1.1) rotate(-8deg); opacity: 1; } 55% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } 100% { transform: none; } }

/* the sidebar */
.scrim { position: fixed; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .32s var(--ease); z-index: 60; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(86vw, 330px); z-index: 61; background: var(--drawer); border-right: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); transform: translateX(-104%); visibility: hidden; transition: transform .4s var(--ease), visibility 0s linear .4s; overscroll-behavior: contain; }
.drawer.open { transform: none; visibility: visible; transition: transform .4s var(--ease), visibility 0s; }
.dhead { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; }
.dlogo { width: 44px; height: 44px; border-radius: 14px; background: var(--teal-soft); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dwho { display: flex; flex-direction: column; min-width: 0; flex: 1; } .dwho b { font-size: 16px; } .dwho small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dnav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 2px; -webkit-overflow-scrolling: touch; }
.dgroup { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 4px; }
.ditem { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; color: var(--ink); text-decoration: none; font-weight: 500; min-height: 48px; transition: background-color .15s var(--ease), transform .12s var(--ease); }
.ditem:hover, .ditem:focus-visible { background: var(--wash-m); }
.ditem:active { transform: scale(.98); }
.ditem[aria-current="page"] { background: var(--teal-soft); color: var(--gold-text); }
.ditem .qicon { width: 36px; height: 36px; border-radius: 11px; }
.dlabel { flex: 1; } .dchev { color: var(--faint); }
.dfoot { padding: 8px 10px 14px; border-top: 1px solid var(--line2); }
.drawer.open .dhead, .drawer.open .ditem, .drawer.open .dgroup { animation: dIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 24ms + 90ms); }
@keyframes dIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }

/* Settings, in categories that open and close */
.setcats { display: flex; flex-direction: column; gap: 10px; }
.setcat { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; transition: border-color .25s var(--ease); }
.setcat.open { border-color: var(--teal-line); }
.setcat > .sh { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: none; border: none; color: var(--ink); font: 500 15px var(--sans); text-align: left; cursor: pointer; min-height: 68px; transition: background-color .15s var(--ease); }
.setcat > .sh:hover { background: var(--wash-xs); }
.sico { width: 42px; height: 42px; border-radius: 13px; background: var(--teal-soft); color: var(--gold-text); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background-color .25s var(--ease), color .25s var(--ease); }
.setcat.open .sico { background: var(--teal); color: var(--on-accent); }
.stx { display: flex; flex-direction: column; min-width: 0; flex: 1; } .stx b { font-weight: 600; } .stx small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.chev { color: var(--muted); display: inline-flex; transition: transform .35s var(--ease); } .setcat.open .chev { transform: rotate(90deg); }
.sbody { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .38s var(--ease); }
.setcat.open .sbody { grid-template-rows: 1fr; }
.sbody > div { overflow: hidden; min-height: 0; visibility: hidden; transition: visibility 0s linear .38s; }
.setcat.open .sbody > div { visibility: visible; transition: visibility 0s; }
.sin { padding: 2px 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.sin > .card { background: var(--field); box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
  #app.enter > * { animation: none; }
}

/* ===================== v3: a calmer top ===================== */
/* Ghost icon buttons: no boxes, just the glyph, with a soft disc under a finger. */
.gbtn { width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; flex-shrink: 0; transition: background-color .18s var(--ease), transform .14s var(--ease); -webkit-tap-highlight-color: transparent; }
.gbtn:hover { background: var(--wash-m); } .gbtn:active { transform: scale(.92); background: var(--wash-l); }
.topbar { display: flex; justify-content: space-between; align-items: center; margin: -8px -8px 0; }

/* Today's head: the greeting, then one quiet line of date on the left and weather on the right. */
.thead { display: flex; flex-direction: column; gap: 10px; }
.thead h1 { font-size: 27px; line-height: 1.15; letter-spacing: -0.025em; text-wrap: balance; }
.tinfo { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.tdate { margin: 0; display: flex; flex-direction: column; gap: 1px; font-size: 14px; color: var(--muted); font-weight: 500; }
.tdate span { color: var(--gold-text); font-size: 13px; font-weight: 500; }
.twx { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--gold-text); text-align: right; flex-shrink: 0; }
.twx span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.twx b { font-size: 22px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.twx small { font-size: 12px; color: var(--muted); font-weight: 400; }
.wxs { flex-shrink: 0; vertical-align: -3px; }
.hijri.wxl { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; opacity: 1; }
.day .wxd { display: inline-flex; align-items: center; gap: 3px; }

/* A problem worth knowing about is one line of text, not a badge. */
.statusrow { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: -4px; }
.statusline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); text-decoration: none; min-height: 28px; }
.statusline:hover { color: var(--ink); }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex-shrink: 0; } .sdot.warn { background: var(--warn-fill); }

/* Quick add is one field with its two actions inside it. */
.quickadd { display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 16px; border-radius: 20px; border: 1px solid var(--line); background: var(--field); transition: border-color .18s var(--ease), box-shadow .2s var(--ease); }
.quickadd:focus-within { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(217, 166, 90, .14); }
.qin { flex: 1; min-width: 0; min-height: 44px; border: none; background: transparent; color: var(--ink); font: 15px var(--sans); outline: none; }
.qin::placeholder { color: var(--faint); }
.quickadd .gbtn { color: var(--gold-text); }
.qgo { width: 44px; height: 44px; border-radius: 16px; border: none; background: linear-gradient(180deg, var(--teal-d), var(--teal)); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: transform .14s var(--ease); }
.qgo:active { transform: scale(.94); }

/* Noticeboard with nothing on it takes one line. */
.nbline { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; font-size: 16px; }
.nbline .muted { flex: 1; font-weight: 400; }

/* The week: a sentence and one line of numbers. */
.week { padding: 2px 2px 0; }
.wk-line { margin: 0 0 4px; font-size: 17px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.35; }
.wk-stats { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.wk-stats b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.wk-stats i { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); margin: 0 10px; vertical-align: middle; }

/* One entrance for the whole page, rather than every block arriving separately. */
#app.enter > * { animation: none; }
#app.enter { animation: pageIn .4s var(--ease) both; }
#app.enter.back { animation-name: pageBack; }

/* Needs-attention rows: a dot says how urgent, instead of a thick coloured edge. */
.action { position: relative; border-left: 1px solid var(--line); padding-left: 34px; }
.action::before { content: ''; position: absolute; left: 15px; top: 19px; width: 9px; height: 9px; border-radius: 50%; background: var(--blue-l); }
.action.lvl1::before { background: var(--warn-fill); } .action.lvl2::before { background: var(--teal); }
.action.lvl1, .action.lvl2 { border-left-color: var(--line); }

/* ===================== v4: one design language, everywhere ===================== */
/* Every page opens the same way: a slim bar, the title, one quiet line. */
.thead { gap: 8px; }
.tcap { margin: 0; display: flex; flex-direction: column; gap: 1px; font-size: 14px; font-weight: 500; color: var(--muted); }
.tcap .hijri { margin: 0; font-size: 13px; font-weight: 500; }
.topbar .ib { background: transparent; color: var(--ink); }
.topbar .ib:hover { background: var(--wash-m); }
.topbar .ib.solid { background: linear-gradient(180deg, var(--teal-d), var(--teal)); color: var(--on-accent); box-shadow: 0 6px 16px rgba(217, 166, 90, .22); }
.topbar .btn2.small { min-height: 38px; }

/* Controls: filled, not outlined. One gold primary; everything else is a soft tint. */
.btn2 { border: none; background: rgba(217, 166, 90, .12); }
.btn2:hover { background: rgba(217, 166, 90, .22); }
.ib { border: none; border-radius: 50%; background: var(--wash-m); }
.ib:hover { background: var(--wash-l); }
.ib.solid { background: linear-gradient(180deg, var(--teal-d), var(--teal)); color: var(--on-accent); }
.chip { border: none; }

/* Surfaces: quiet. No shadows on cards, and a card inside a card is a tint, not another outline. */
.card, .list, .tile, .qtile { box-shadow: none; border-color: var(--card-line); }
.card .card, .list .card { background: var(--wash-s); border-color: transparent; }
.tile:hover, .qtile:hover { border-color: var(--tile-hover); }

/* A field with its actions inside it, wherever there's something to add or search for. */
.qsel { border: none; background: var(--wash-m); color: var(--muted); border-radius: 12px; min-height: 36px; padding: 0 8px; font: 500 12.5px var(--sans); max-width: 38%; flex-shrink: 1; min-width: 0; cursor: pointer; }
.qin[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
form.quickadd { margin: 0; }
.thead.pname { flex-direction: row; align-items: center; gap: 16px; }

/* Places to go: rows in one list */
.menurow { display: flex; align-items: center; gap: 14px; padding: 10px 0; min-height: 64px; color: inherit; text-decoration: none; border-top: 1px solid var(--line2); transition: background-color .15s var(--ease); }
.list > .menurow:first-child { border-top: none; }
.menurow:hover { background: var(--wash-xs); }
.menurow .umain { flex: 1; min-width: 0; }
.menurow .qicon { width: 40px; height: 40px; flex-shrink: 0; }
.menurow .dchev { color: var(--faint); display: inline-flex; }

/* Checkboxes in the app's own colours, rather than the browser's grey square */
.cb, .check input[type=checkbox] { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--teal-line); background: transparent center / 16px no-repeat; cursor: pointer; flex-shrink: 0; margin: 0; transition: background-color .18s var(--ease), border-color .18s var(--ease), transform .16s var(--spring); }
.cb:hover, .check input[type=checkbox]:hover { border-color: var(--teal); }
.cb:active, .check input[type=checkbox]:active { transform: scale(.86); }
.cb:checked, .check input[type=checkbox]:checked { background-color: var(--teal); border-color: var(--teal); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A1420' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.cb:focus-visible, .check input[type=checkbox]:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ===================== the welcome ===================== */
#splash { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(720px 560px at 50% 50%, #15293F 0%, #08121D 64%); cursor: pointer; transition: opacity .55s var(--ease), transform .55s var(--ease), visibility 0s linear .55s; }
html.nosplash #splash { display: none; }
#splash.out { opacity: 0; transform: scale(1.035); visibility: hidden; pointer-events: none; }
.sp-halo { position: absolute; top: calc(50% - 190px); width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(closest-side, rgba(217, 166, 90, .30), rgba(217, 166, 90, 0)); opacity: 0; transform: scale(.55); animation: spHalo 2.6s .15s var(--ease) forwards; pointer-events: none; }
.sp-logo { position: relative; width: 150px; height: 150px; opacity: 0; transform: scale(.82); animation: spTile .75s .1s var(--spring) forwards; }
.sp-logo svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .55)); }
.sp-orn { opacity: 0; animation: spFade .9s .45s var(--ease) forwards; }
/* the lettering is written from right to left, as it reads */
.sp-gold { clip-path: inset(0 0 0 100%); animation: spWrite 1.3s .6s cubic-bezier(.65, 0, .2, 1) forwards; }
@keyframes spTile { to { opacity: 1; transform: none; } }
@keyframes spFade { to { opacity: 1; } }
@keyframes spWrite { to { clip-path: inset(0 0 0 0); } }
@keyframes spHalo { 0% { opacity: 0; transform: scale(.55); } 45% { opacity: 1; } 100% { opacity: .8; transform: scale(1.12); } }

/* ===================== light and dark ===================== */
/* Dark is the base. Light replaces the colours (and only the colours). The welcome screen, the voice screen and the PDF viewer
   stay dark whichever is chosen. */
:root[data-theme="light"] {
  color-scheme: light;
  --ground: #F6F2E9; --card: #FFFFFF; --line: #D8D2C3; --line2: #ECE7DB; --ink: #18212D; --muted: #566273; --faint: #8791A0;
  --teal: #B9822B; --teal-d: #D2A04A; --on-accent: #0A1420; --teal-soft: #F7EBD3; --teal-line: #E3CD9D; --gold-text: #8A5A0E;
  --warn: #A8470F; --warn-soft: #FCEBDF; --warn-line: #F0C6A8; --warn-fill: #D9622B; --chip: #EDF0F4; --chip-ink: #2B394B;
  --danger: #BE3A2A; --danger-line: #F0BCB4; --blue: #D6E4F0; --blue-l: #7FA6C8;
  --wash-xs: rgba(20, 30, 45, .03); --wash-s: rgba(20, 30, 45, .045); --wash-m: rgba(20, 30, 45, .06); --wash-l: rgba(20, 30, 45, .1);
  --field: #F1EEE6; --field-solid: #FFFFFF; --well: #E6E2D8;
  --hero: linear-gradient(160deg, #FFF6E2, #F6E9CC); --hero2: linear-gradient(135deg, #F4F6F9, #E8ECF2);
  --glow: #FFFFFF; --glass: rgba(255, 255, 255, .86); --glass-line: rgba(30, 45, 65, .12); --card-line: rgba(30, 45, 65, .13);
  --scroll: #C7CCD6; --toast-bg: #1B2838; --toast-ink: #F4EEE2; --scrim: rgba(20, 30, 45, .42);
  --drawer: linear-gradient(180deg, #FFFFFF, #F4EFE3); --tile-hover: rgba(185, 130, 43, .45);
  --shadow: 0 10px 30px rgba(30, 40, 60, .14); --shadow-sm: 0 1px 8px rgba(30, 40, 60, .08);
}
.voiceview, .pdfview, #splash, .on-dark {
  color-scheme: dark;
  --ground: #08121D; --card: #101C2B; --line: #26384F; --line2: #1B2A3D; --ink: #F4EEE2; --muted: #A7B2C2; --faint: #6F7C8E;
  --teal: #D9A65A; --teal-d: #E9BE76; --on-accent: #0A1420; --teal-soft: #2A2B2A; --teal-line: #5E4C2E; --gold-text: #F0C67E;
  --warn: #F5B48E; --warn-soft: #3A2219; --warn-line: #6B3A26; --warn-fill: #E07A4A; --chip: #1C2B3E; --chip-ink: #D9E0EA;
  --danger: #FF8E7E; --danger-line: #6B2E28; --blue: #2C455A; --blue-l: #3E5B76;
  --wash-xs: rgba(255, 255, 255, .025); --wash-s: rgba(255, 255, 255, .035); --wash-m: rgba(255, 255, 255, .06); --wash-l: rgba(255, 255, 255, .1);
  --field: rgba(8, 18, 29, .7); --field-solid: #0C1724; --well: #050C14;
}
/* a change of theme is a short cross-fade, not a flash */
html.themeswap, html.themeswap * { transition: background-color .3s ease, color .3s ease, border-color .3s ease, fill .3s ease !important; }
.themerow { display: flex; gap: 8px; flex-wrap: wrap; }
.dtheme { display: flex; align-items: center; gap: 8px; padding: 6px 4px 10px; }
.dtheme .chip { flex: 1; justify-content: center; min-height: 38px; }
.dbadge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--teal); color: var(--on-accent); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* Something that's due: a tile of its own */
.duecard { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--card-line); }
.duecard.late { background: var(--warn-soft); border-color: var(--warn-line); }
.duecard > a.grow { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dueico { width: 42px; height: 42px; border-radius: 13px; background: var(--teal-soft); color: var(--gold-text); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.duecard.late .dueico { background: var(--warn-fill); color: #fff; }
.duelate { color: var(--warn); font-weight: 600; }

/* a holiday's summary line */
.holsum { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.holsum b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.holsum i { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); margin: 0 10px; vertical-align: middle; }
.holrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line2); }
.list > .holrow:first-child { border-top: none; }
.holdoc { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.holdoc .umain { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.holrow .btn2 { flex-shrink: 0; }

.dlogo { background: transparent; }
.dlogo img { border-radius: 10px; }

/* ===================== the Burhani logo ===================== */
.sp-logo { width: min(240px, 62vw); height: min(240px, 62vw); filter: drop-shadow(0 18px 34px rgba(0, 0, 0, .55)); }
.sp-logo svg { width: 100%; height: 100%; display: block; }
.k-tile { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(.86); animation: spTile .7s .1s var(--spring) forwards; }
/* the arch is drawn from the bottom up, then the lettering is written from right to left, then a gold light passes over it */
.k-dome { clip-path: inset(100% 0 0 0); animation: kDome 1.2s .55s cubic-bezier(.65, 0, .2, 1) forwards; }
.k-let { clip-path: inset(0 0 0 100%); animation: spWrite 1.2s 1.45s cubic-bezier(.65, 0, .2, 1) forwards; }
@keyframes kDome { to { clip-path: inset(0 0 0 0); } }
.k-sheen { transform: translateX(0); animation: kSheen 1.3s 2.7s cubic-bezier(.45, 0, .25, 1) forwards; }
@keyframes kSheen { to { transform: translateX(1450px); } }
@media (prefers-reduced-motion: reduce) { .sp-logo, .sp-halo, .k-tile, .k-dome, .k-let { animation: none !important; opacity: 1; transform: none; clip-path: none; } .k-sheen { display: none; } }

/* ===================== colour swatches (events and occasions) ===================== */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { --c: transparent; position: relative; width: 32px; height: 32px; border-radius: 50%; background: var(--c); border: 2px solid var(--line); cursor: pointer; display: inline-flex; }
.sw:first-child { background: conic-gradient(#D9A65A, #2F5DA8, #2E8B57, #C0392B, #D9A65A); }
.sw input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.sw:has(input:checked) { box-shadow: 0 0 0 3px var(--ground), 0 0 0 5px var(--teal); }
.sw:has(input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 3px; }

/* ===================== weather that moves ===================== */
.wxs * { transform-box: fill-box; transform-origin: center; }
.wxs.big.wx-sun path { animation: wxSpin 14s linear infinite; transform-box: view-box; }
.wxs.big.wx-sun circle, .wxs.big.wx-part circle { animation: wxGlow 3s ease-in-out infinite; }
.wxs.big.wx-part path:last-child, .wxs.big.wx-cloud path { animation: wxDrift 4s ease-in-out infinite alternate; }
.wxs.big.wx-fog path { animation: wxDrift 3s ease-in-out infinite alternate; }
.wxs.big.wx-rain path:last-child, .wxs.big.wx-snow path:last-child { animation: wxFall 1.1s linear infinite; }
.wxs.big.wx-snow path:last-child { animation-duration: 2.4s; }
.wxs.big.wx-storm path:last-child { animation: wxFlash 2.6s ease-in-out infinite; }
@keyframes wxSpin { to { transform: rotate(360deg); } }
@keyframes wxGlow { 50% { transform: scale(1.12); } }
@keyframes wxDrift { from { transform: translateX(-1px); } to { transform: translateX(1.5px); } }
@keyframes wxFall { from { transform: translateY(-2px); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(2.5px); opacity: 0; } }
@keyframes wxFlash { 0%, 70%, 100% { opacity: 1; } 75%, 85% { opacity: .15; } 80% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .wxs * { animation: none !important; } }

/* ===================== screensaver ===================== */
#saver { position: fixed; inset: 0; z-index: 300; background: #000; opacity: 0; transition: opacity .5s ease; cursor: pointer; overflow: hidden; }
#saver.in { opacity: 1; }
#saver::before { content: ''; position: absolute; inset: -40px; background: var(--bg) center / cover; filter: blur(30px) brightness(.55); transition: background-image 1.6s ease; }
#saver img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 1.6s ease; }
#saver img.on { opacity: 1; }
#saver img.kb { animation: svZoom 9s ease-out forwards; }
@keyframes svZoom { from { transform: scale(1); } to { transform: scale(1.06); } }
.svclock { position: absolute; left: 24px; bottom: calc(24px + env(safe-area-inset-bottom)); color: #F4EEE2; text-shadow: 0 2px 12px rgba(0, 0, 0, .7); display: flex; flex-direction: column; gap: 2px; }
.svclock b { font: 600 44px/1 'Poppins', sans-serif; letter-spacing: -.5px; }
.svclock span { font-size: 15px; opacity: .9; }
@media (prefers-reduced-motion: reduce) { #saver img.kb { animation: none; } }
.svclock i { font-style: normal; font-size: 15px; color: #F0C67E; }
.svclock i:empty { display: none; }

/* ===================== sideways on a phone: a short screen ===================== */
/* A slimmer bottom bar (icon beside its label) and tighter headings, so the page itself keeps most of the height,
   and room left for the camera notch on whichever side it is. */
@media (orientation: landscape) and (max-height: 520px) {
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
  #app { padding: calc(8px + env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) 16px max(18px, env(safe-area-inset-left, 0px)); gap: 12px; }
  #nav { padding: 3px max(8px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); border-radius: 16px 16px 0 0; }
  .tab { flex-direction: row; justify-content: center; gap: 6px; min-height: 42px; padding: 4px 0; font-size: 12px; }
  .tab.on svg, #nav.enter .tab.on svg { transform: none; }
  h1 { font-size: 22px; }
  .topbar { margin-top: -4px; }
  .sp-logo { width: min(200px, 48vh); height: min(200px, 48vh); }
  .svclock b { font-size: 34px; }
  .dhead { padding: 8px 16px 6px; }
  .dfoot { padding: 4px 10px 6px; }
  .dtheme { padding: 2px 4px 4px; }
  .dtheme .chip { min-height: 32px; }
}

/* ===================== polls ===================== */
.popt { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--field); color: var(--ink); font: inherit; text-align: left; cursor: pointer; overflow: hidden; transition: border-color .18s var(--ease), transform .14s var(--ease); }
.popt:active:not(:disabled) { transform: scale(.98); }
.popt[aria-pressed="true"] { border-color: var(--teal); }
.popt:disabled { cursor: default; }
.pbar { position: absolute; inset: 0 auto 0 0; background: var(--teal-soft); transition: width .4s var(--ease); }
.popt[aria-pressed="true"] .pbar { background: color-mix(in srgb, var(--teal) 28%, transparent); }
.ptext, .pwho { position: relative; }
.ptext { flex: 1; font-weight: 500; }
.pwho { display: inline-flex; align-items: center; gap: 6px; }
.pwho b { min-width: 14px; text-align: right; font-variant-numeric: tabular-nums; }

/* ===================== countdowns ===================== */
.cdrow { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 2px 18px; }
.cdrow::-webkit-scrollbar { display: none; }
.cdchip { flex-shrink: 0; display: flex; align-items: baseline; gap: 6px; padding: 10px 14px; border-radius: 14px; background: var(--hero, var(--card)); border: 1px solid var(--teal-line); color: var(--ink); text-decoration: none; font: inherit; }
.cdchip b { font-size: 22px; font-weight: 700; color: var(--gold-text); font-variant-numeric: tabular-nums; }
.cdchip span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.cdadd { align-items: center; justify-content: center; min-width: 46px; color: var(--gold-text); cursor: pointer; }

/* ===================== Qibla ===================== */
.qcard { align-items: center; gap: 16px; transition: box-shadow .3s var(--ease), border-color .3s var(--ease); }
.qcard.aligned { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.qwrap { position: relative; width: min(300px, 78vw, 62vh); aspect-ratio: 1; margin-top: 10px; }
.qpointer { position: absolute; left: 50%; top: -10px; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 14px solid var(--teal); transform: translateX(-50%); z-index: 1; }
.qdial { width: 100%; height: 100%; transition: transform .25s linear; }
.qring { fill: var(--card); stroke: var(--line); stroke-width: 2; }
.qtick { stroke: var(--faint); stroke-width: 1.2; }
.qcard-l { fill: var(--muted); font: 600 14px var(--sans, 'Poppins', sans-serif); text-anchor: middle; }
.qcard-l.qn { fill: var(--danger); }
.qline { stroke: var(--teal); stroke-width: 3; stroke-linecap: round; }
.qkaaba { fill: #14181F; stroke: var(--teal); stroke-width: 1.5; }
.qband { fill: #D9A65A; }
.qhub { fill: var(--teal); }
.qdeg { font-size: 15px; color: var(--muted); }
.qdeg b { font-size: 30px; color: var(--ink); font-variant-numeric: tabular-nums; }
.qcard.aligned .qdeg b { color: var(--gold-text); }
@media (prefers-reduced-motion: reduce) { .qdial, .pbar { transition: none; } }
[hidden] { display: none !important; }

/* ===================== Namaaz ===================== */
.nmz { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); }
.nmzk { font-size: 13px; font-weight: 600; color: var(--gold-text); }
.nmzn { font-size: 14px; } .nmzn b { font-variant-numeric: tabular-nums; }
.nmzrow { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
.nmzrow::-webkit-scrollbar { display: none; }
.nmzc { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border-radius: 10px; background: var(--wash-s, rgba(0,0,0,.03)); min-width: 74px; }
.nmzc small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.nmzc b { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nmzc.on { background: var(--teal); } .nmzc.on small, .nmzc.on b { color: var(--on-accent); }
.nmzline { padding: 12px 4px; border-top: 1px solid var(--line2); } .nmzline:first-child { border-top: none; }
.nmzline b { font-variant-numeric: tabular-nums; }
.nmzline.on { color: var(--gold-text); font-weight: 600; }
.nmztable { overflow-x: auto; border-radius: var(--r, 16px); border: 1px solid var(--card-line, var(--line)); background: var(--card); }
.nmztable table { border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nmztable th, .nmztable td { padding: 7px 9px; text-align: center; border-bottom: 1px solid var(--line2); }
.nmztable thead th { position: sticky; top: 0; background: var(--card); font-size: 11px; color: var(--muted); font-weight: 600; }
.nmztable tbody th { text-align: left; position: sticky; left: 0; background: var(--card); font-weight: 600; }
.nmztable tbody th small { color: var(--muted); font-weight: 400; }
.nmztable tr.on td, .nmztable tr.on th { background: var(--teal-soft); }
.nmzpick select { flex: 1; min-width: 0; }
.nmztable { max-height: 60vh; }
.nmztable tbody tr { cursor: pointer; }
.nmzsel { max-width: 52%; min-height: 38px; padding: 6px 10px; }
label.nmzline { cursor: pointer; padding: 8px 4px; }
.digestline { gap: 12px; align-items: center; text-decoration: none; color: var(--ink); font-size: 14px; line-height: 1.45; }
.digestline .muted { font-size: 12px; font-weight: 600; }
.dgwx { font-weight: 600; }

/* ===================== notes ===================== */
.note { gap: 6px; text-decoration: none; color: var(--ink); }
.notemonth { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin: 6px 2px -4px; }
.noteday { flex-shrink: 0; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.notepre { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
form[data-kind="note"] textarea { min-height: 45vh; line-height: 1.6; }
