/* Fonts served with the app (no outside font service): Plus Jakarta Sans and IBM Plex Sans Arabic, both SIL Open Font License (fonts/LICENSE-*.txt). */
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap; src: url(fonts/plus-jakarta-sans-latin-ext-wght-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: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap; src: url(fonts/plus-jakarta-sans-latin-wght-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: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC,U+102E0-102FB,U+10E60-10E7E,U+10EC2-10EC4,U+10EFC-10EFF,U+1EE00-1EE03,U+1EE05-1EE1F,U+1EE21-1EE22,U+1EE24,U+1EE27,U+1EE29-1EE32,U+1EE34-1EE37,U+1EE39,U+1EE3B,U+1EE42,U+1EE47,U+1EE49,U+1EE4B,U+1EE4D-1EE4F,U+1EE51-1EE52,U+1EE54,U+1EE57,U+1EE59,U+1EE5B,U+1EE5D,U+1EE5F,U+1EE61-1EE62,U+1EE64,U+1EE67-1EE6A,U+1EE6C-1EE72,U+1EE74-1EE77,U+1EE79-1EE7C,U+1EE7E,U+1EE80-1EE89,U+1EE8B-1EE9B,U+1EEA1-1EEA3,U+1EEA5-1EEA9,U+1EEAB-1EEBB,U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-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: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-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: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC,U+102E0-102FB,U+10E60-10E7E,U+10EC2-10EC4,U+10EFC-10EFF,U+1EE00-1EE03,U+1EE05-1EE1F,U+1EE21-1EE22,U+1EE24,U+1EE27,U+1EE29-1EE32,U+1EE34-1EE37,U+1EE39,U+1EE3B,U+1EE42,U+1EE47,U+1EE49,U+1EE4B,U+1EE4D-1EE4F,U+1EE51-1EE52,U+1EE54,U+1EE57,U+1EE59,U+1EE5B,U+1EE5D,U+1EE5F,U+1EE61-1EE62,U+1EE64,U+1EE67-1EE6A,U+1EE6C-1EE72,U+1EE74-1EE77,U+1EE79-1EE7C,U+1EE7E,U+1EE80-1EE89,U+1EE8B-1EE9B,U+1EEA1-1EEA3,U+1EEA5-1EEA9,U+1EEAB-1EEBB,U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-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: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-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: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC,U+102E0-102FB,U+10E60-10E7E,U+10EC2-10EC4,U+10EFC-10EFF,U+1EE00-1EE03,U+1EE05-1EE1F,U+1EE21-1EE22,U+1EE24,U+1EE27,U+1EE29-1EE32,U+1EE34-1EE37,U+1EE39,U+1EE3B,U+1EE42,U+1EE47,U+1EE49,U+1EE4B,U+1EE4D-1EE4F,U+1EE51-1EE52,U+1EE54,U+1EE57,U+1EE59,U+1EE5B,U+1EE5D,U+1EE5F,U+1EE61-1EE62,U+1EE64,U+1EE67-1EE6A,U+1EE6C-1EE72,U+1EE74-1EE77,U+1EE79-1EE7C,U+1EE7E,U+1EE80-1EE89,U+1EE8B-1EE9B,U+1EEA1-1EEA3,U+1EEA5-1EEA9,U+1EEAB-1EEBB,U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-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: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-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: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2) format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC,U+102E0-102FB,U+10E60-10E7E,U+10EC2-10EC4,U+10EFC-10EFF,U+1EE00-1EE03,U+1EE05-1EE1F,U+1EE21-1EE22,U+1EE24,U+1EE27,U+1EE29-1EE32,U+1EE34-1EE37,U+1EE39,U+1EE3B,U+1EE42,U+1EE47,U+1EE49,U+1EE4B,U+1EE4D-1EE4F,U+1EE51-1EE52,U+1EE54,U+1EE57,U+1EE59,U+1EE5B,U+1EE5D,U+1EE5F,U+1EE61-1EE62,U+1EE64,U+1EE67-1EE6A,U+1EE6C-1EE72,U+1EE74-1EE77,U+1EE79-1EE7C,U+1EE7E,U+1EE80-1EE89,U+1EE8B-1EE9B,U+1EEA1-1EEA3,U+1EEA5-1EEA9,U+1EEAB-1EEBB,U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-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: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-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 {
  --bg: #f3f2ea;
  --card: #ffffff;
  --ink: #0f211b;
  --muted: #6b7a73;
  --line: #e6e5db;
  --soft: #eeede4;
  --brand: #0c8b7b;
  --brand-ink: #ffffff;
  --deep: #054a42;
  --hero-a: #13a08e;
  --hero-b: #05544b;
  --up: #0e9f5b;
  --down: #dc4f3a;
  --up-bg: #e3f5ea;
  --down-bg: #fbe8e3;
  --warn-bg: #fdf4e1;
  --warn-ink: #8a5a00;
  --bad-bg: #fbe8e3;
  --bad-ink: #a8301e;
  --good-bg: #e3f5ea;
  --good-ink: #0b7a46;
  --c-gold: #d4a23a;
  --c-funds: #0c8b7b;
  --c-stocks: #4f7fe0;
  --c-cert: #8b6fd0;
  --c-cash: #a3aca8;
  --s1: #0c8b7b;
  --s2: #d4a23a;
  --tk-bg: #e7eefc;
  --tk-ink: #3d64c4;
  --shadow: 0 1px 2px rgba(15, 33, 27, 0.04), 0 6px 20px rgba(15, 33, 27, 0.05);
  --radius: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08120f; --card: #0e1b17; --ink: #e9f2ee; --muted: #8ea39a; --line: #1b2c26; --soft: #13241f;
    --brand: #2fd1b4; --brand-ink: #04110f; --deep: #06352f; --hero-a: #138a79; --hero-b: #06352f;
    --up: #4ade80; --down: #ff8a65; --up-bg: rgba(74, 222, 128, 0.13); --down-bg: rgba(255, 138, 101, 0.14);
    --warn-bg: #2a2110; --warn-ink: #f5c56b; --bad-bg: #2c1512; --bad-ink: #ff9b8a; --good-bg: #0f2a1c; --good-ink: #7ddc9f;
    --c-gold: #e9bd5b; --c-funds: #2fd1b4; --c-stocks: #7ea2f0; --c-cert: #b09af0; --c-cash: #5f6d68; --s1: #2fd1b4; --s2: #e9bd5b;
    --tk-bg: #16263d; --tk-ink: #8fb0f5;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.02); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #08120f; --card: #0e1b17; --ink: #e9f2ee; --muted: #8ea39a; --line: #1b2c26; --soft: #13241f;
    --brand: #2fd1b4; --brand-ink: #04110f; --deep: #06352f; --hero-a: #138a79; --hero-b: #06352f;
    --up: #4ade80; --down: #ff8a65; --up-bg: rgba(74, 222, 128, 0.13); --down-bg: rgba(255, 138, 101, 0.14);
    --warn-bg: #2a2110; --warn-ink: #f5c56b; --bad-bg: #2c1512; --bad-ink: #ff9b8a; --good-bg: #0f2a1c; --good-ink: #7ddc9f;
    --c-gold: #e9bd5b; --c-funds: #2fd1b4; --c-stocks: #7ea2f0; --c-cert: #b09af0; --c-cash: #5f6d68; --s1: #2fd1b4; --s2: #e9bd5b;
    --tk-bg: #16263d; --tk-ink: #8fb0f5;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.02); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; overscroll-behavior-y: contain; } /* no browser pull-to-reload; the app's own pull-down refreshes prices */
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 "Plus Jakarta Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
html[lang="ar"] body { font-family: "IBM Plex Sans Arabic", "Plus Jakarta Sans", system-ui, sans-serif; }
h2 { font-size: 1.35rem; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 1rem; margin: 0 0 12px; }
a { color: var(--brand); cursor: pointer; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.num small, small { font-size: 0.78em; color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.warn-t { color: var(--warn-ink); }
.nowrap { white-space: nowrap; }
.r { text-align: end; }
.spacer { flex: 1; }
/* boot.js: shown instead of a blank page when the app can't start */
.boot-msg { max-width: 360px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 24px; text-align: center; color: var(--ink); }
.boot-msg p { margin: 0; color: var(--muted); }
.boot-msg .boot-title { color: var(--ink); font-size: 1.15rem; font-weight: 600; }
.boot-msg .boot-detail { font-size: 0.8rem; word-break: break-word; }
.boot-msg button { margin-top: 6px; justify-content: center; text-align: center; }
.splash { display: grid; place-items: center; height: 100vh; font-size: 40px; color: var(--brand); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* buttons & inputs */
button, .btn {
  font: inherit; border: 1px solid transparent; border-radius: 9px; padding: 8px 14px; cursor: pointer;
  background: var(--soft); color: var(--ink); display: inline-flex; align-items: center; gap: 6px; line-height: 1.2;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
button.ghost, .btn.ghost { background: transparent; border-color: var(--line); }
button.ghost:hover:not(:disabled), .btn.ghost:hover { background: var(--soft); }
button.danger { background: var(--down); color: #fff; }
button.danger.ghost { background: transparent; color: var(--down); border-color: var(--line); }
button.sm, select.sm { padding: 5px 10px; font-size: 0.85rem; }
button.icon { background: transparent; padding: 4px 8px; color: var(--muted); font-size: 1rem; }
button.icon:hover { color: var(--ink); background: var(--soft); }
button.link { background: none; border: 0; color: var(--brand); padding: 4px 0; }
button.lang { min-width: 38px; justify-content: center; font-weight: 600; }
input, select {
  font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; width: 100%; min-width: 0;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 1px; }
input[type="checkbox"] { width: auto; }
select.sm { width: auto; }

/* layout */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.logo { color: var(--brand); font-size: 1.2rem; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: transparent; color: var(--muted); padding: 8px 12px; white-space: nowrap; font-weight: 500; }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); border-color: var(--line); }
.tabs.small { margin-bottom: 16px; background: var(--soft); padding: 3px; border-radius: 10px; }
.tabs.small button { flex: 1; justify-content: center; }
.top-right { display: flex; align-items: center; gap: 8px; }
.save { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.save.error { color: var(--down); font-weight: 600; }
main { flex: 1; }
.page { max-width: 1180px; margin: 0 auto; padding: 22px 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.page.narrow { max-width: 760px; }
.foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 14px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.row-between h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cards3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.stat .label, .label { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.card.stat .v { font-size: 1.45rem; font-weight: 650; margin-bottom: 2px; }
.empty { color: var(--muted); padding: 10px 0; margin: 0; }
.note { color: var(--muted); font-size: 0.84rem; margin: 10px 0 0; }
ul.note { padding-inline-start: 18px; } ul.note li { margin: 4px 0; }
.sep { border-top: 1px solid var(--line); margin: 14px 0 6px; padding-top: 10px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }

/* hero */
.hero {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, var(--card)), var(--card) 70%);
  border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px;
}
.hero .big { font-size: clamp(2rem, 6vw, 3rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.hero .big small { font-size: 0.4em; }
.hero .sub { color: var(--muted); margin-top: 4px; }
.hero-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.hero-stats > div > span { font-size: 1.1rem; font-weight: 600; }
.welcome ol { margin: 6px 0; padding-inline-start: 20px; } .welcome li { margin: 6px 0; }

/* tables */
.tablewrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: start; font-weight: 500; color: var(--muted); font-size: 0.78rem; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 650; border-top: 2px solid var(--line); border-bottom: 0; }
td b, td .small, td > span:not(.num):not(.pill) { unicode-bidi: plaintext; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--soft); }
.pill { font-size: 0.75rem; padding: 2px 8px; border-radius: 99px; background: var(--soft); white-space: nowrap; }
.pill.buy, .pill.salary, .pill.income { background: var(--good-bg); color: var(--good-ink); }
.pill.sell, .pill.expense { background: var(--bad-bg); color: var(--bad-ink); }
details.closed { margin-top: 12px; }
details summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; }

/* allocation */
.alloc { display: flex; height: 10px; border-radius: 99px; overflow: hidden; margin: 16px 0 8px; background: var(--soft); gap: 2px; }
.alloc .seg { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--s1); }
.c-gold { background: var(--c-gold); } .c-funds { background: var(--c-funds); } .c-stocks { background: var(--c-stocks); } .c-cert { background: var(--c-cert); } .c-cash { background: var(--c-cash); }
.sw.s2 { background: var(--s2); }

/* prices */
.prices { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.prices > div { background: var(--soft); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.prices span { font-size: 0.76rem; color: var(--muted); }
.prices b { font-size: 1.15rem; }
.chg { font-size: 0.74rem; margin-top: 3px; white-space: nowrap; }
.chg.up { color: var(--up); } .chg.down { color: var(--down); }
.gold-chg { margin: 2px 0 4px; }
.periodic-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--soft); }
.periodic-box .note { margin-top: 4px; }
.row-gap.grow { display: flex; width: 100%; } .row-gap.grow select { flex: 1; min-width: 0; }
.dist-tag { color: var(--brand); margin-top: 2px; }
.pill.d-est { background: color-mix(in srgb, #d97706 16%, var(--card)); color: #b45309; }
.pill.d-ok { background: color-mix(in srgb, var(--up) 16%, var(--card)); color: var(--up); }
.pill.d-rev { background: color-mix(in srgb, #2563eb 14%, var(--card)); color: #1d4ed8; }
.pill.d-off { background: var(--soft); color: var(--muted); }
tr.dim td { opacity: 0.55; }
.dist-head { margin-bottom: 4px; }
.dist-calc { background: var(--soft); border-radius: 8px; padding: 8px 10px; margin: 8px 0 12px; font-size: 0.86rem; }
.actions.wrap { flex-wrap: wrap; }
.section-checks { display: grid; gap: 10px; margin: 12px 0 4px; }
.check.sec { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.check.sec input { margin-top: 3px; flex: none; }
.check.sec span { display: flex; flex-direction: column; gap: 2px; }
.check.sec input:disabled + span { opacity: 0.75; }
.cert-line { color: var(--brand); margin-top: 2px; }
.row-gap { display: inline-flex; align-items: center; gap: 6px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; margin: 6px 0 4px; }

/* chart */
.chart { position: relative; width: 100%; user-select: none; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .line { fill: none; stroke: var(--s1); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s2 { stroke: var(--s2); stroke-dasharray: 5 4; }
.chart .cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .dot { fill: var(--card); stroke: var(--s1); stroke-width: 2; } .chart .dot.s2 { stroke: var(--s2); }
.chart .tip { position: absolute; top: 6px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 7px 10px; font-size: 0.8rem; pointer-events: none; min-width: 150px; }
.chart .legend { margin-top: 6px; }
.chart-empty { color: var(--muted); padding: 50px 0; text-align: center; font-size: 0.9rem; }
.seg, .seg2 { display: inline-flex; background: var(--soft); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button, .seg2 button { background: transparent; padding: 5px 11px; font-size: 0.85rem; color: var(--muted); }
.seg button.on, .seg2 button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg2 { display: flex; } .seg2 button { flex: 1; justify-content: center; padding: 8px; font-weight: 600; }
.seg2 button.on.buy { color: var(--up); } .seg2 button.on.sell { color: var(--down); }

/* banners */
.banner { padding: 10px 12px; border-radius: 9px; background: var(--soft); font-size: 0.88rem; margin-top: 10px; }
.banner.warn { background: var(--warn-bg); color: var(--warn-ink); }
.banner.bad { background: var(--bad-bg); color: var(--bad-ink); }
.banner.good { background: var(--good-bg); color: var(--good-ink); }
.banner.slim { margin: 0; border-radius: 0; text-align: center; padding: 7px 12px; }

/* modal & forms */
.overlay { position: fixed; inset: 0; background: rgba(8, 12, 10, 0.45); display: grid; place-items: center; z-index: 20; padding: 16px; overflow-y: auto; }
.modal { background: var(--card); border-radius: 14px; padding: 20px; width: min(560px, 100%); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal p { margin-top: 0; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form.inner { margin-top: 10px; }
.form .wide, .form details { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.field > em { font-size: 0.76rem; color: var(--muted); font-style: normal; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin: 6px 0; cursor: pointer; }
.actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.actions.left { justify-content: flex-start; }
.total { background: var(--soft); padding: 10px 12px; border-radius: 9px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.code { font: 600 1.05rem/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.04em; background: var(--soft); border: 1px dashed var(--brand); padding: 14px; border-radius: 10px; text-align: center; direction: ltr; word-break: break-all; }
.danger-zone { border-color: color-mix(in srgb, var(--down) 35%, var(--line)); }

/* auth */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 14px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: min(420px, 100%); box-shadow: var(--shadow); }
.auth-card .brand { margin-bottom: 18px; font-size: 1.1rem; }
.auth-card h2 { margin-bottom: 6px; }
.fine { color: var(--muted); font-size: 0.8rem; max-width: 420px; text-align: center; margin: 0; }

/* ---- v2: icons, flags, hide mode, + button, pull to refresh ---- */
.ic { display: block; flex: none; }
.iconbtn { background: transparent; border: 1px solid var(--line); padding: 7px; border-radius: 9px; color: var(--muted); }
.iconbtn:hover { color: var(--ink); background: var(--soft); }
.iconbtn.on { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.langs { display: inline-flex; gap: 2px; background: var(--soft); border-radius: 9px; padding: 3px; }
.langs button { background: transparent; padding: 4px 6px; border-radius: 7px; opacity: 0.55; }
.langs button.on { background: var(--card); opacity: 1; box-shadow: var(--shadow); }
.flag { display: block; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12); }
.auth-card .langs { margin-inline-start: auto; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
.tab-ic, .tab-short { display: none; }
.karat-tot div + div { margin-top: 2px; }
.demo-cta { margin-top: 4px; }
.demo-cta .or { margin: 6px 0 10px; }
a.demo-btn { width: 100%; justify-content: center; padding: 11px; text-decoration: none; color: var(--ink); font-weight: 600; }
.demo-bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 12px; }
.demo-bar .link { padding: 0; font-weight: 600; }
.tabs button { gap: 6px; }
.privacy-note { background: color-mix(in srgb, var(--brand) 10%, var(--card)); color: var(--ink); }
.app.private .hero .big { letter-spacing: 0.08em; }
button.bio { width: 100%; justify-content: center; padding: 12px; }
.or { text-align: center; color: var(--muted); font-size: 0.82rem; margin: 10px 0; }

.fab-wrap { position: fixed; inset-inline-end: 20px; bottom: 24px; z-index: 15; display: none; }
.fab { width: 56px; height: 56px; border-radius: 50%; justify-content: center; background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 18px rgba(15, 118, 110, 0.35); }
.fab .ic { width: 26px; height: 26px; transition: transform 0.15s; }
.fab-wrap.open .fab .ic { transform: rotate(45deg); }
.fab-scrim { position: fixed; inset: 0; background: rgba(8, 12, 10, 0.3); }
.fab-menu { position: absolute; bottom: 66px; inset-inline-end: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.fab-menu button { background: var(--card); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); padding: 11px 14px; white-space: nowrap; font-weight: 500; }
.pull { display: flex; align-items: flex-end; justify-content: center; overflow: hidden; color: var(--muted); }
.pull span { padding-bottom: 6px; transition: transform 0.15s, color 0.15s; }
.pull span.ready { color: var(--brand); transform: rotate(180deg); }

/* phone */
@media (max-width: 760px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .top { padding-top: max(8px, env(safe-area-inset-top)); flex-wrap: nowrap; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .top .brand { min-width: 0; flex: 1; }
  .top-right { gap: 6px; }
  /* phone header: one flag only — the language you'd switch TO; one tap switches */
  .top .langs { background: transparent; padding: 0; }
  .top .langs button.on { display: none; }
  .top .langs button { opacity: 1; padding: 7px 6px; border: 1px solid var(--line); border-radius: 9px; }
  .save { font-size: 0.9rem; }
  /* bottom tab bar */
  .top .tabs {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 10; order: 0; flex-basis: auto;
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; overflow: visible;
    background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
  }
  .top .tabs button { flex-direction: column; gap: 2px; padding: 6px 0; font-size: 0.68rem; border-radius: 10px; box-shadow: none; border: 0; background: transparent; justify-content: center; }
  .top .tabs button.on { color: var(--brand); background: transparent; }
  .top .tabs button.on .tab-ic { background: color-mix(in srgb, var(--brand) 14%, transparent); }
  .tab-ic { display: grid; place-items: center; width: 44px; height: 26px; border-radius: 13px; }
  .tab-full { display: none; }
  .tab-short { display: inline; }
  .fab-wrap { display: block; bottom: calc(76px + env(safe-area-inset-bottom)); inset-inline-end: 16px; }
  .hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; width: 100%; }
  .auth-card h2 { margin-top: 16px; }
  .foot { padding-bottom: 80px; }
  /* tables as cards */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tfoot { display: block; }
  table.cards tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
  table.cards tbody tr:last-child { border-bottom: 0; }
  table.cards td { display: block; padding: 0; border: 0; text-align: start; min-width: 0; }
  table.cards td.hide-s { display: block; }
  table.cards td:first-child { grid-column: 1 / -1; }
  table.cards td[data-l]::before { content: attr(data-l); display: block; font-size: 0.7rem; color: var(--muted); font-weight: 400; margin-bottom: 1px; }
  table.cards td.actions-cell { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
  table.cards td.actions-cell .ghost.sm { flex: 1; justify-content: center; padding: 8px; }
  table.cards td.empty-c { display: none; }
  table.cards tfoot tr { background: var(--soft); border-radius: 10px; padding: 12px; margin-top: 8px; border: 0; }
}
@media (max-width: 760px) {
  .top { padding-inline: 12px; padding-bottom: 8px; gap: 8px; }
  .page { padding: 16px 16px 32px; }
  .grid2, .cards3 { grid-template-columns: 1fr; }
  .form, .form.three { grid-template-columns: 1fr; }
  .hide-s { display: none; }
  .hero { padding: 18px; }
  .card { padding: 14px; }
  td, th { padding: 8px 5px; }
}

/* =====================================================================
   v3 · Emerald (زمرد): calmer, deeper take on the teal & gold identity
   ===================================================================== */
body { letter-spacing: -0.005em; }
h2 { font-weight: 800; letter-spacing: -0.02em; }
h3 { font-weight: 700; }
button, .btn, input, select { border-radius: 12px; }
button { transition: transform 120ms ease-out, background-color 160ms, color 160ms; }
button:active:not(:disabled) { transform: scale(0.97); }
.card { border-color: transparent; }
:root[data-theme="dark"] .card { border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card { border-color: var(--line); } }
.card.stat .v { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }

/* header */
.top { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%); border-bottom: 0; }
.brand { font-size: 1.15rem; font-weight: 800; gap: 10px; }
.logo-mark { display: block; flex: none; border-radius: 10px; box-shadow: 0 4px 12px rgba(5, 74, 66, 0.25); }
.iconbtn { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border-radius: 13px; border: 0; background: var(--card); box-shadow: var(--shadow); color: var(--ink); }
.iconbtn.on { color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--card)); }
.splash { animation: none; }
.splash .logo-mark { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(0.92); opacity: 0.7; } }

/* chips & number motion */
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 9px; border-radius: 99px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; direction: ltr; unicode-bidi: isolate; background: var(--soft); color: var(--muted); }
.chip.up { background: var(--up-bg); color: var(--up); }
.chip.down { background: var(--down-bg); color: var(--down); }
.gain { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 700; }
.gain small.chip { font-size: 0.72rem; }
.num.anim { border-radius: 6px; }
.flash-up { animation: flashUp 1s ease-out; }
.flash-down { animation: flashDown 1s ease-out; }
@keyframes flashUp { 0%, 25% { background: color-mix(in srgb, var(--up) 26%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 26%, transparent); } 100% { background: transparent; box-shadow: 0 0 0 3px transparent; } }
@keyframes flashDown { 0%, 25% { background: color-mix(in srgb, #f08a3c 30%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, #f08a3c 30%, transparent); } 100% { background: transparent; box-shadow: 0 0 0 3px transparent; } }

/* hero */
.hero {
  position: relative; overflow: hidden; display: block; color: #fff; border: 0; border-radius: 28px; padding: 22px 24px 18px;
  background: radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.12), transparent 60%), linear-gradient(160deg, var(--hero-a), var(--hero-b));
  box-shadow: 0 18px 40px -18px rgba(5, 74, 66, 0.55);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255, 255, 255, 0.07); }
.hero::before { width: 220px; height: 220px; inset-inline-end: -60px; top: -90px; }
.hero::after { width: 120px; height: 120px; inset-inline-start: -40px; top: 60px; background: rgba(255, 255, 255, 0.05); }
.hero > * { position: relative; }
.hero .label { color: rgba(255, 255, 255, 0.82); margin: 0; }
.hero-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); color: rgba(255, 255, 255, 0.9); }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: #6ff0b0; box-shadow: 0 0 0 3px rgba(111, 240, 176, 0.25); }
.hero .big { font-size: clamp(2.3rem, 9vw, 3.4rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; margin: 8px 0 10px; font-family: "Plus Jakarta Sans", "IBM Plex Sans Arabic", sans-serif; direction: ltr; text-align: start; }
html[dir="rtl"] .hero .big { text-align: end; }
.hero .big small { color: rgba(255, 255, 255, 0.75); font-size: 0.38em; font-weight: 600; }
.hero-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero .chip { background: rgba(255, 255, 255, 0.16); color: #fff; }
.hero .chip.down { background: rgba(255, 150, 120, 0.22); color: #ffe2d8; }
.hero .usd { color: rgba(255, 255, 255, 0.8); font-size: 0.88rem; margin-inline-start: auto; }
.hero .flash-up, .hero .flash-down { animation-name: flashHero; }
@keyframes flashHero { 0%, 25% { background: rgba(255, 255, 255, 0.22); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.22); } 100% { background: transparent; box-shadow: 0 0 0 4px transparent; } }
.spark { margin: 14px -6px 4px; }
.spark svg { display: block; overflow: visible; }
.spark-line { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { animation: fadeIn 1.1s ease-out; }
.spark-dot { fill: #fff; stroke: rgba(255, 255, 255, 0.35); stroke-width: 6; animation: fadeIn 0.4s 0.9s ease-out backwards; }
.spark-empty { color: rgba(255, 255, 255, 0.75); font-size: 0.85rem; padding: 26px 0; text-align: center; }
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes fadeIn { from { opacity: 0; } }
.hero-range { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.hero-range button { background: transparent; color: rgba(255, 255, 255, 0.75); padding: 6px 14px; border-radius: 99px; font-size: 0.84rem; font-weight: 600; }
.hero-range button.on { background: rgba(255, 255, 255, 0.92); color: var(--hero-b); }
.hero-range .hero-more { margin-inline-start: auto; font-weight: 500; font-size: 0.8rem; padding-inline: 6px; }
.hero-stats { display: flex; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.14); gap: 22px; flex-wrap: wrap; }
.hero-stats .label { font-size: 0.76rem; margin-bottom: 2px; }
.hero .gain, .hero .up, .hero .down { color: #fff; }
.app.private .hero .big { letter-spacing: 0.06em; }

/* price tiles */
.prices { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.prices > div.tile { background: var(--soft); border-radius: 18px; padding: 12px 14px; gap: 2px; }
.prices .tile b span, .prices .chip span { font-size: inherit; color: inherit; }
.prices .tile b { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.chg { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chg small { font-size: 0.74rem; }

/* donut */
.donut-wrap { display: flex; align-items: center; gap: 22px; margin: 6px 0 14px; }
.donut { position: relative; width: 150px; flex: none; }
.donut svg { display: block; width: 100%; transform: rotate(-90deg); }
html[dir="rtl"] .donut svg { transform: rotate(-90deg) scaleY(-1); }
.donut-bg { fill: none; stroke: var(--soft); stroke-width: 13; }
.donut-seg { fill: none; stroke-width: 13; transition: stroke-dasharray 0.8s cubic-bezier(0.22, 1, 0.36, 1), stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1); animation: fadeIn 0.6s ease-out; }
.donut-seg.c-gold { stroke: var(--c-gold); } .donut-seg.c-funds { stroke: var(--c-funds); } .donut-seg.c-stocks { stroke: var(--c-stocks); } .donut-seg.c-cert { stroke: var(--c-cert); } .donut-seg.c-cash { stroke: var(--c-cash); }
.donut-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-mid b { font-size: 1.5rem; font-weight: 800; }
.donut-mid span { font-size: 0.74rem; color: var(--muted); max-width: 90px; line-height: 1.2; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.donut-legend > div { display: flex; justify-content: space-between; gap: 10px; font-size: 0.88rem; }
.donut-legend span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.donut-legend .sw { border-radius: 50%; width: 9px; height: 9px; flex: none; }

/* holdings */
.hold-name { display: flex; align-items: center; gap: 12px; }
.tk { flex: none; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--tk-bg); color: var(--tk-ink); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.02em; direction: ltr; overflow: hidden; }
.tab-gap { display: none; }

/* phone */
@media (max-width: 760px) {
  body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  /* no backdrop-filter here: it would trap the fixed bottom bar inside the header */
  .top { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .top .langs { display: none; }
  .save .hide-s { display: none; }
  .top .tabs {
    inset-inline: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); border-radius: 26px; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    display: flex; padding: 6px; background: color-mix(in srgb, var(--card) 86%, transparent); backdrop-filter: blur(20px) saturate(170%); -webkit-backdrop-filter: blur(20px) saturate(170%);
    box-shadow: 0 10px 30px -8px rgba(15, 33, 27, 0.22);
  }
  .top .tabs button { flex: 1; min-width: 0; font-size: 0.64rem; padding: 4px 0; }
  .tab-ic { width: 40px; height: 28px; border-radius: 12px; transition: background-color 200ms; }
  .tab-gap { display: block; flex: 0 0 64px; }
  .top .tabs.n4 button, .top .tabs.n5 button { font-size: 0.7rem; }
  .top .tabs.n7 .tab-gap { flex-basis: 58px; }
  .top .tabs.n7 .tab-ic { width: 32px; }
  .top .tabs.n7 button { font-size: 0.56rem; letter-spacing: -0.01em; }
  /* full-width, no transform: a transform here would shrink the fixed scrim to half the screen */
  .fab-wrap { inset-inline: 0; left: 0; right: 0; bottom: calc(26px + env(safe-area-inset-bottom)); z-index: 12; display: flex; justify-content: center; pointer-events: none; }
  .fab-wrap > * { pointer-events: auto; }
  .fab-wrap .fab { position: relative; }
  .fab { width: 58px; height: 58px; border-radius: 20px; background: linear-gradient(160deg, var(--hero-a), var(--hero-b)); color: #fff; box-shadow: 0 10px 24px -6px rgba(5, 74, 66, 0.6); }
  .fab-menu { inset-inline-end: auto; left: 50%; transform: translateX(-50%); bottom: 72px; align-items: center; animation: menuIn 220ms cubic-bezier(0.22, 1, 0.36, 1); }
  .fab-menu button { border-radius: 16px; }
  .hero { padding: 20px 18px 16px; border-radius: 26px; }
  .donut { width: 128px; }
  .donut-wrap { gap: 16px; }
  /* holdings as separate rounded cards */
  .card:has(> .tablewrap > table.cards) { background: transparent; box-shadow: none; padding: 0; border: 0; }
  .card:has(> .tablewrap > table.cards) > h3 { padding: 0 4px; }
  table.cards tbody tr { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; border: 0; }
  table.cards tfoot tr { border-radius: 20px; }
  table.cards td.hold-name { display: flex; }
  .prices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .prices > div.tile { padding: 10px; border-radius: 16px; }
  .prices .tile b { font-size: 1.05rem; }
  .prices .chg small { display: none; }
}
@keyframes menuIn { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.96); } }
@media (max-width: 760px) {
  :root[data-theme="dark"] table.cards tbody tr { border: 1px solid var(--line); }
}
@media (max-width: 760px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) table.cards tbody tr { border: 1px solid var(--line); } }

@media (prefers-reduced-motion: reduce) {
  .spark-line, .spark-area, .spark-dot, .donut-seg, .fab-menu, .splash .logo-mark { animation: none; }
  .donut-seg { transition: none; }
  .flash-up, .flash-down, .hero .flash-up, .hero .flash-down { animation-duration: 0.6s; }
  button:active:not(:disabled) { transform: none; }
}

/* ---- v3.1: compact rows, details sheet, side-by-side stat cards ---- */
:root { --ease-out: cubic-bezier(0.23, 1, 0.32, 1); --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); }
.list-sec { display: flex; flex-direction: column; gap: 10px; }
.list-sec > h3, .list-sec > .row-between { margin: 4px 4px 0; }
.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; padding: 12px 14px; border-radius: 20px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow); border: 1px solid transparent; min-height: 72px;
  transition: transform 140ms var(--ease-out), background-color 160ms;
}
:root[data-theme="dark"] .row { border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .row { border-color: var(--line); } }
.row:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) { .row:hover { background: color-mix(in srgb, var(--brand) 4%, var(--card)); } }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-main b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
.row-main small { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small .cert-line { display: inline; color: var(--brand); }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.row-end b { font-size: 1.05rem; font-weight: 800; }
.row-end .chip { font-size: 0.72rem; padding: 2px 8px; }
.row .tk { width: 44px; height: 44px; border-radius: 14px; }
.tk.fund { background: color-mix(in srgb, var(--brand) 14%, var(--card)); color: var(--brand); }
.tk.gold { background: color-mix(in srgb, var(--c-gold) 20%, var(--card)); color: color-mix(in srgb, var(--c-gold) 70%, var(--ink)); }
.tk.cash { background: color-mix(in srgb, var(--c-cash) 22%, var(--card)); color: var(--ink); }
.tk.cert { background: color-mix(in srgb, var(--c-cert) 18%, var(--card)); color: var(--c-cert); }
.tk.buy { background: var(--up-bg); color: var(--up); font-size: 1.2rem; }
.tk.sell { background: var(--down-bg); color: var(--down); font-size: 1.2rem; }
.tk.dim { background: var(--soft); color: var(--muted); }
/* company / fund logos (js/logos.js): white tile in light theme, the usual dark tile in dark theme */
.tk.logo { background: #fff; border: 1px solid var(--line); }
.tk.logo img { display: block; width: 72%; height: 72%; object-fit: contain; }
.tk.logo .lg-d { display: none; }
.tk.logo.dim img { opacity: 0.55; }
:root[data-theme="dark"] .tk.logo { background: var(--tk-bg); border-color: transparent; }
:root[data-theme="dark"] .tk.logo .lg-l { display: none; }
:root[data-theme="dark"] .tk.logo .lg-d { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tk.logo { background: var(--tk-bg); border-color: transparent; }
  :root:not([data-theme="light"]) .tk.logo .lg-l { display: none; }
  :root:not([data-theme="light"]) .tk.logo .lg-d { display: block; }
}
button.more { align-self: center; border-radius: 99px; padding: 8px 18px; }
.seg-full { display: flex; width: 100%; padding: 4px; border-radius: 14px; }
.seg-full button { flex: 1; justify-content: center; padding: 9px; font-weight: 600; border-radius: 11px; }
details.closed { margin-top: 2px; }
details.closed > summary { padding: 4px; }
details.closed .rows { margin-top: 10px; }

/* stat cards: always three across */
.cards3.stats { gap: 12px; }
.stat-split { margin-top: 2px; line-height: 1.5; }
.karat-w { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; line-height: 1.4; }
.karat-w > small { color: var(--muted); font-weight: 600; } .karat-w b { font-size: 1.15rem; font-weight: 800; }

/* gold price strip */

/* details sheet */
.sheet-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sheet-title > span:last-child { display: flex; flex-direction: column; min-width: 0; unicode-bidi: plaintext; }
.sheet-title small { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.sheet-hero { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px; border-radius: 16px; background: var(--soft); margin-bottom: 6px; }
.sheet-hero > b { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.details { margin: 0; display: grid; grid-template-columns: 1fr 1fr; }
.details > div { padding: 11px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.details > div:nth-last-child(-n + 2) { border-bottom: 0; }
.details dt { font-size: 0.76rem; color: var(--muted); margin-bottom: 2px; }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sheet-actions { margin-top: 12px; }
.sheet-actions button { flex: 1; justify-content: center; padding: 12px; }
.grabber { display: none; }
.modal.sheet { animation: modalIn 200ms var(--ease-out); }
@keyframes modalIn { from { opacity: 0; transform: scale(0.97); } }

@media (max-width: 760px) {
  .cards3.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .cards3.stats .card.stat { padding: 12px 10px; border-radius: 18px; }
  .cards3.stats .card.stat .label { font-size: 0.7rem; line-height: 1.25; min-height: 2.5em; }
  .cards3.stats .card.stat .v { font-size: 1.08rem; letter-spacing: -0.01em; }
  .cards3.stats .chip { font-size: 0.68rem; padding: 2px 6px; }
  .cards3.stats .small { font-size: 0.68rem; }
  .karat-w b { font-size: 0.98rem; }
  .toolbar { gap: 8px; }
  .toolbar button { white-space: nowrap; font-size: 0.88rem; padding-inline: 8px; }
  .toolbar h2 { width: 100%; }
  .toolbar .spacer { display: none; }
  .toolbar button { flex: 1; justify-content: center; }
  /* details open as a bottom sheet */
  .overlay.sheet-ov { place-items: end stretch; padding: 0; animation: fadeIn 200ms ease-out; }
  .modal.sheet {
    width: 100%; max-height: 88vh; border-radius: 26px 26px 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
    animation: sheetUp 380ms var(--ease-drawer);
  }
  .grabber { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 2px auto 10px; }
}
@keyframes sheetUp { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) {
  .modal.sheet, .overlay.sheet-ov { animation: fadeIn 200ms ease-out; }
  .row:active { transform: none; }
}

@media (min-width: 900px) {
  .rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- v3.2: tab motion, row today line, saved button, sell summary ---- */
.tab-in.fwd, .tab-in.back { animation: tabIn 260ms var(--ease-out); }
.tab-in.fwd { --tab-from: 22px; } .tab-in.back { --tab-from: -22px; }
html[dir="rtl"] .tab-in.fwd { --tab-from: -22px; } html[dir="rtl"] .tab-in.back { --tab-from: 22px; }
@keyframes tabIn { from { opacity: 0; transform: translateX(var(--tab-from)); } }
.row-main small.sub2 { font-size: 0.76rem; font-weight: 600; }
.row-total { display: flex; align-items: center; gap: 6px; }
.row-total small { font-size: 0.74rem; font-weight: 700; }
.save-btn { min-width: 96px; justify-content: center; transition: background-color 200ms ease, color 200ms ease, transform 120ms var(--ease-out); }
.save-btn.saved:disabled { opacity: 1; background: var(--up-bg); color: var(--up); cursor: default; }
.save-in { display: inline-block; animation: popIn 220ms var(--ease-out); }
@keyframes popIn { from { opacity: 0; transform: scale(0.9); filter: blur(2px); } }
.sell-sum { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--soft); display: grid; gap: 6px; }
.sell-sum > div { display: flex; justify-content: space-between; gap: 10px; }
.sell-sum span { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .tab-in.fwd, .tab-in.back { animation: fadeIn 160ms ease-out; } .save-in { animation: none; } }
.tab-half { display: contents; }
@media (max-width: 760px) {
  .tab-half { display: flex; flex: 1; min-width: 0; }
  .tab-half > button { flex: 1; min-width: 0; }
}
.row-main b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
/* The tab slide must never widen the page: on phones that briefly shifts/zooms the fixed bottom bar. */
html, body { overflow-x: clip; }
.app { overflow-x: clip; }
.row-main small > .up, .row-main small > .down { font-weight: 600; }

/* ---- v3.3: sign-in / sign-up in the Emerald look ---- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 36px clamp(28px, 5vw, 64px); display: flex; flex-direction: column; gap: 40px;
  background: radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, 0.12), transparent 60%), linear-gradient(160deg, var(--hero-a), var(--hero-b));
}
.auth-hero::before, .auth-hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.06); pointer-events: none; }
.auth-hero::before { width: 420px; height: 420px; inset-inline-end: -140px; top: -160px; }
.auth-hero::after { width: 260px; height: 260px; inset-inline-start: -90px; bottom: -80px; background: rgba(255, 255, 255, 0.05); }
.auth-hero > * { position: relative; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-lockup { display: flex; align-items: center; gap: 12px; }
.auth-lockup .logo-mark { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); border-radius: 14px; }
.auth-lockup > span { display: flex; flex-direction: column; line-height: 1.1; }
.auth-lockup b { font-family: "IBM Plex Sans Arabic", sans-serif; font-size: 1.7rem; font-weight: 700; }
.auth-lockup small { font-size: 0.64rem; letter-spacing: 0.32em; opacity: 0.75; font-weight: 600; color: #fff; }
.auth-hero .langs { background: rgba(255, 255, 255, 0.14); }
.auth-hero .langs button.on { background: rgba(255, 255, 255, 0.9); }
.auth-pitch { margin-block: auto; max-width: 460px; }
.auth-pitch h1 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; margin: 0 0 26px; text-wrap: balance; }
html[lang="ar"] .auth-pitch h1 { letter-spacing: 0; line-height: 1.35; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-size: 0.98rem; color: rgba(255, 255, 255, 0.9); }
.auth-ic { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.14); }
.auth-ic .ic { width: 18px; height: 18px; }
.auth-ic.sm { width: 22px; height: 22px; border-radius: 7px; background: var(--soft); color: var(--brand); display: inline-grid; vertical-align: middle; margin-inline-end: 6px; }
.auth-ic.sm .ic { width: 13px; height: 13px; }

.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px 20px; }
.auth-card { width: min(420px, 100%); background: var(--card); border: 1px solid transparent; border-radius: 26px; padding: 28px; box-shadow: 0 24px 60px -30px rgba(15, 33, 27, 0.35), var(--shadow); }
:root[data-theme="dark"] .auth-card { border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-card { border-color: var(--line); } }
.auth-head { margin-bottom: 18px; }
.auth-head h2 { font-size: 1.55rem; margin: 0 0 4px; }
.auth-head p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.auth-seg { margin-bottom: 18px; }
.auth-card .stack { gap: 14px; }
.auth-card input { padding: 12px 14px; font-size: 1rem; border-radius: 14px; background: var(--bg); }
.auth-card input:focus { background: var(--card); }
.pw { position: relative; display: block; }
.pw input { padding-inline-end: 48px; }
.pw-eye { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; padding: 0; justify-content: center; background: transparent; color: var(--muted); border-radius: 11px; }
.pw-eye:active:not(:disabled) { transform: translateY(-50%) scale(0.94); }
.link.forgot { align-self: flex-end; margin-top: -6px; font-size: 0.86rem; font-weight: 600; }
button.primary.big { width: 100%; justify-content: center; padding: 14px; font-size: 1rem; border-radius: 14px; margin-top: 4px; }
.auth-card .demo-cta .or { display: flex; align-items: center; gap: 10px; }
.auth-card .demo-cta .or::before, .auth-card .demo-cta .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-card a.demo-btn { border-radius: 14px; padding: 12px; }
.auth-android { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.auth-android a.demo-btn { display: flex; align-items: center; gap: 8px; }
.auth-card .bio { border-radius: 14px; padding: 14px; }
.auth .fine { max-width: 420px; line-height: 1.5; }
.auth-card .banner { margin-top: 0; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; align-content: start; }
  .auth-hero { padding: max(18px, env(safe-area-inset-top)) 20px 56px; gap: 22px; border-radius: 0 0 30px 30px; }
  .auth-pitch { margin: 0; }
  .auth-pitch h1 { font-size: 1.45rem; margin: 0; }
  .auth-points { display: none; }
  .auth-lockup .logo-mark { width: 42px; height: 42px; }
  .auth-lockup b { font-size: 1.45rem; }
  .auth-main { justify-content: flex-start; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); margin-top: -36px; position: relative; }
  .auth-card { padding: 22px 18px; border-radius: 24px; }
  .auth-head h2 { font-size: 1.35rem; }
}
.auth-card { animation: authIn 420ms var(--ease-out) both; }
@keyframes authIn { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: fadeIn 200ms ease-out; } }
.auth-lockup .auth-name { font-size: 1.7rem; font-weight: 800; line-height: 1; letter-spacing: -0.01em; }
html[lang="ar"] .auth-lockup .auth-name { font-family: "IBM Plex Sans Arabic", sans-serif; font-weight: 700; letter-spacing: 0; }
@media (max-width: 860px) { .auth-lockup .auth-name { font-size: 1.45rem; } }

/* ---- v3.4: Home breakdown list, plan bars, small polish ---- */
.donut-wrap:not(:has(.donut-legend)) { justify-content: center; margin: 4px 0 8px; }
.donut-wrap:not(:has(.donut-legend)) .donut { width: 168px; }
.mix { display: flex; flex-direction: column; }
.mix-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 4px; background: none; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); color: var(--ink); text-align: start; }
.mix-row:last-child { border-bottom: 0; }
.mix-row .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
button.mix-row:active { transform: none; background: var(--soft); }
@media (hover: hover) and (pointer: fine) { button.mix-row:hover { background: var(--soft); } }
.mix-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mix-name b { font-weight: 600; } .mix-name small { color: var(--muted); font-size: 0.78rem; }
.mix-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.mix-end b { font-weight: 800; }
.mix-row.total { padding-top: 14px; padding-inline-start: 26px; }
.mix-row.total .mix-name b { font-weight: 800; }
.plan { display: flex; flex-direction: column; gap: 18px; margin-top: 4px; }
.plan-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.plan-top > b { font-weight: 600; } .plan-top small { color: var(--muted); }
.plan-bar { position: relative; height: 10px; border-radius: 99px; background: var(--soft); }
.plan-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px; transition: width 0.8s var(--ease-out); }
.plan-fill.c-gold { background: var(--c-gold); } .plan-fill.c-funds { background: var(--c-funds); } .plan-fill.c-cash { background: var(--c-cash); }
.plan-target { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-inline-start: -1.5px; border-radius: 2px; background: var(--ink); }
.plan-need { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; }
.plan-need .num { color: var(--muted); }
.iconbtn.sm { width: 34px; height: 34px; border-radius: 11px; }
.iconbtn.sm .ic { width: 17px; height: 17px; }
@media (max-width: 760px) { .form.three.keep { grid-template-columns: repeat(3, minmax(0, 1fr)); } .form.three.keep .field > span { font-size: 0.74rem; min-height: 2.4em; } }

/* Chart reveal: a wipe in reading direction (the old dash trick drew only part of the line). */
.spark svg { animation: wipe 1s var(--ease-out); }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
html[dir="rtl"] .spark svg { animation-name: wipeRtl; }
@keyframes wipeRtl { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) { .spark svg { animation: fadeIn 200ms ease-out; } }

.link.fix-link { display: block; margin: 10px auto 0; font-size: 0.88rem; font-weight: 600; }

/* Home: one line under the hero when the main currency isn't the pound */
.hero-note { margin: 10px 0 0; font-size: 0.78rem; opacity: 0.75; }
.month-pick { width: auto; min-width: 0; padding: 6px 10px; font-size: 0.9rem; }

/* ---- US stocks (2.42) ---- */
:root { --c-us: #d9773a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c-us: #f0a061; } }
:root[data-theme="dark"] { --c-us: #f0a061; }
.c-us { background: var(--c-us); } .donut-seg.c-us { stroke: var(--c-us); } .plan-fill.c-us { background: var(--c-us); }
.tk.us { background: color-mix(in srgb, var(--c-us) 16%, var(--card)); color: var(--c-us); }
.tk.logo.on-dark, :root[data-theme="dark"] .tk.logo.on-dark { background: #14211d; border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tk.logo.on-dark { background: #14211d; } }

/* ---- Am I really winning? (2.42) ---- */
.perf-rows { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
.perf-row { display: grid; grid-template-columns: minmax(92px, 34%) 1fr auto; align-items: center; gap: 10px; }
.perf-row.is-mine .perf-label { font-weight: 800; } .perf-row.is-mine .perf-v { font-size: 1.05rem; }
.perf-label { font-size: 0.88rem; }
.perf-bar { height: 10px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.perf-bar i { display: block; height: 100%; border-radius: 99px; transition: width 0.8s var(--ease-out); }
.perf-bar i.mine { background: var(--brand); } .perf-bar i.neg { opacity: 0.55; background: var(--down); }
.perf-v { min-width: 62px; text-align: end; }
.perf-why { grid-column: 2 / -1; color: var(--muted); font-size: 0.74rem; margin-top: -6px; }
.perf-verdict { margin: 12px 0 0; font-weight: 600; font-size: 0.9rem; line-height: 1.6; }

/* ---- Alerts (2.44) ---- */
.alert-add { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 8px; margin: 8px 0 4px; }
@media (max-width: 560px) { .alert-add { grid-template-columns: 1fr 1fr; } .alert-add button { grid-column: 1 / -1; justify-content: center; } }
.alert-list { display: flex; flex-direction: column; margin: 8px 0; }
.alert-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: 0; }
.alert-what { flex: 1; min-width: 0; font-weight: 600; }
.alert-row.fired .alert-what { color: var(--muted); }
.alert-state { color: var(--muted); white-space: nowrap; }

/* ---- other assets & debts (2.5) ---- */
:root { --c-other: #c0397a; --c-debt: #c2410c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c-other: #f07ab0; --c-debt: #fb8a5a; } }
:root[data-theme="dark"] { --c-other: #f07ab0; --c-debt: #fb8a5a; }
.c-other { background: var(--c-other); } .donut-seg.c-other { stroke: var(--c-other); }
.c-debt { background: var(--c-debt); }
.tk.other { background: color-mix(in srgb, var(--c-other) 16%, var(--card)); color: var(--c-other); }
.tk.debt { background: color-mix(in srgb, var(--c-debt) 16%, var(--card)); color: var(--c-debt); }

.week .row-between { margin-bottom: 6px; }
.wk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 4px 12px; }
.wk-stats > div { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; } /* values sit under their label (right in Arabic), not stretched to the left */
.wk-stats .label { max-width: 100%; font-size: 0.74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-stats b { font-size: 1.05rem; }
.wk-stats .gain { gap: 4px; }
.wk-moves { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.move-list { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.card.moves .move-list { justify-content: flex-start; margin-top: 6px; }
.move-set { flex-wrap: wrap; }
.move-set label { flex: 1 1 220px; display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.move-set input { width: 72px; }

/* ---- PDF report (2.5): a full page on screen, the only thing printed ---- */
.report-actions { flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.print-report { position: fixed; inset: 0; z-index: 200; overflow: auto; background: #fff; color: #111; padding: 20px max(16px, calc(50vw - 380px)) 60px; font-size: 13px; }
.print-report .pr-bar { position: sticky; top: 0; display: flex; gap: 8px; justify-content: flex-end; padding: 8px 0 14px; background: #fff; }
.print-report .pr-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #0f766e; padding-bottom: 10px; margin-bottom: 12px; }
.print-report h1 { font-size: 22px; margin: 0 0 4px; color: #0f5f57; }
.print-report h2 { font-size: 15px; margin: 18px 0 6px; color: #0f5f57; }
.print-report p { margin: 0; color: #444; }
.print-report .pr-meta { text-align: end; font-size: 12px; }
.print-report table { width: 100%; border-collapse: collapse; }
.print-report th, .print-report td { padding: 5px 6px; border-bottom: 1px solid #e5e5e5; text-align: start; font-variant-numeric: tabular-nums; }
.print-report td + td, .print-report thead th + th { text-align: end; }
.print-report .pr-kv th { font-weight: 500; color: #333; width: 60%; }
.print-report .pr-kv td { text-align: end; font-weight: 600; }
.print-report small { color: #777; }
.print-report .pr-total td { font-weight: 700; border-top: 2px solid #333; }
.print-report .pr-note { margin-top: 14px; font-size: 11px; color: #666; }
body.printing { overflow: hidden; }
@media print {
  @page { margin: 14mm; }
  body.printing { overflow: visible; background: #fff; padding: 0 !important; }
  body.printing .app > :not(.print-report) { display: none !important; }
  body.printing .print-report { position: static; overflow: visible; padding: 0; }
  .print-report .no-print { display: none !important; }
  .print-report section { break-inside: avoid; }
  .print-report tr { break-inside: avoid; }
}
.backup-nudge { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

/* ---- 3.0: choose your features, Edit Home, More, grouped Settings, short forms ---- */
.tab-more { display: none; }
@media (max-width: 760px) {
  .top .tabs .tab-over { display: none; }
  .top .tabs .tab-more { display: flex; }
}
.more-list { display: flex; flex-direction: column; gap: 6px; }
.more-item, .set-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 12px; background: transparent; border: 0; text-align: start; color: var(--ink); font-weight: 500; }
.more-item:hover, .set-row:hover { background: var(--soft); }
.more-item.on { color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.more-item .tab-ic, .set-ic { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--soft); color: var(--brand); flex: none; }
.more-item .tab-ic .ic, .set-ic .ic { width: 20px; height: 20px; }
.more-item > span:nth-child(2), .set-txt { flex: 1; min-width: 0; }
.more-go { color: var(--muted); font-size: 1.3rem; line-height: 1; }
[dir="rtl"] .more-go { transform: scaleX(-1); }
.set-index { padding: 6px; display: flex; flex-direction: column; }
.set-index .set-row + .set-row { border-top: 1px solid var(--line); border-radius: 0; }
.set-txt { display: flex; flex-direction: column; gap: 2px; }
.set-txt small { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-head { display: flex; align-items: center; gap: 10px; }
.set-head h2 { margin: 0; }

.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.home-cell { grid-column: 1 / -1; min-width: 0; display: flex; flex-direction: column; }
.home-cell > .card { flex: 1; }
.home-cell.half { grid-column: auto; }
.home-cell:empty { display: none; }
@media (max-width: 760px) { .home-grid { grid-template-columns: 1fr; } .home-cell.half { grid-column: 1 / -1; } }
.home-edit { display: flex; justify-content: center; }
.home-edit .ic { width: 16px; height: 16px; }
.edit-home { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 8px; }
.edit-home li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.edit-home li.off { opacity: 0.6; }
.edit-home .check { flex: 1; display: flex; gap: 10px; align-items: center; }
.edit-home .check span { display: flex; flex-direction: column; }
.eh-move { display: flex; gap: 4px; }

.presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 12px; }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; text-align: start; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); white-space: normal; }
.preset small { color: var(--muted); font-weight: 400; line-height: 1.35; }
.preset.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--card)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
@media (max-width: 560px) { .presets { grid-template-columns: 1fr; } }
.simple-switch { margin-bottom: 4px; }
.check.sec.dim > span { opacity: 0.65; }
.modal.setup { width: min(720px, 100%); }

details.more-opts { border-top: 1px dashed var(--line); padding-top: 8px; }
details.more-opts > summary { cursor: pointer; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; color: var(--brand); font-weight: 600; font-size: 0.9rem; list-style: none; padding: 4px 0; }
details.more-opts > summary::-webkit-details-marker { display: none; }
details.more-opts > summary::before { content: "+"; display: inline-block; width: 1em; }
details.more-opts[open] > summary::before { content: "−"; }
details.more-opts > summary small { font-weight: 400; }
details.more-opts > .form.inner { margin-top: 8px; }

.checklist .ck-bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin: 10px 0 6px; }
.checklist .ck-bar span { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width 300ms ease-out; }
.ck-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.ck-list li { display: flex; align-items: center; gap: 10px; }
.ck-list li.done { color: var(--muted); text-decoration: line-through; }
.ck-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: inline-grid; place-items: center; font-size: 0.7rem; }
.ck-dot.ok { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); text-decoration: none; }

.new-for-you { border: 1.5px solid color-mix(in srgb, var(--brand) 40%, var(--line)); }
.nfy-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.nfy-item { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 10px 12px; border-radius: 10px; background: var(--soft); }
.nfy-item > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.whats-new { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 12px; }
.whats-new li { display: flex; gap: 10px; align-items: flex-start; }
.whats-new li > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.whats-new small { color: var(--muted); line-height: 1.4; }
.wn-dot { color: var(--brand); flex: none; margin-top: 1px; }
.fab-hint { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; color: var(--muted); max-width: 240px; white-space: normal; text-align: center; }

/* ---- Gold tab: today's gram price per karat. The tile's gold deepens with purity. ---- */
.gold-prices { display: flex; flex-direction: column; gap: 10px; }
.gp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-inline: 2px; }
.gp-head h3 { margin: 0; font-size: 1rem; }
.gp-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.gp-tile {
  --gp: var(--c-gold); --gp-mix: 16%;
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 12px;
  border-radius: 16px; border: 1px solid color-mix(in srgb, var(--gp) 34%, var(--line));
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--gp) calc(var(--gp-mix) + 8%), transparent) 0%, transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--gp) var(--gp-mix), var(--card)) 0%, var(--card) 85%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 55%, transparent), 0 1px 2px rgba(60, 40, 0, 0.06);
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms ease-out;
}
.gp-tile.k21 { --gp-mix: 11%; }
.gp-tile.k18 { --gp-mix: 7%; }
.gp-tile.kpound { --gp-mix: 13%; }
.gp-unit { font-size: 0.72rem; margin-top: -4px; }
.gp-note { margin: 0; padding-inline: 2px; }
@media (hover: hover) and (pointer: fine) { .gp-tile:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 55%, transparent), 0 8px 20px -10px color-mix(in srgb, var(--gp) 60%, transparent); } }
.gp-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.gp-k { display: inline-flex; align-items: baseline; gap: 1px; padding: 2px 8px; border-radius: 99px; font-weight: 800; font-size: 0.85rem; letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--gp) 55%, #3a2600); background: color-mix(in srgb, var(--gp) 26%, var(--card)); }
.gp-k small { font-size: 0.7em; font-weight: 700; }
.gp-price { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); line-height: 1.1; }
.gp-chg { font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.gp-chg i { font-style: normal; font-weight: 500; opacity: 0.75; margin-inline-start: 2px; }
.gp-chg.flat { color: var(--muted); }
@media (max-width: 560px) { .gp-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } } /* 2 × 2 on phones, so prices stay big */
@media (max-width: 420px) {
  .gp-row { gap: 8px; }
  .gp-tile { padding: 12px 10px 10px; border-radius: 14px; }
  .gp-price { font-size: 1.35rem; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .gp-tile { box-shadow: inset 0 1px 0 color-mix(in srgb, var(--gp) 22%, transparent); }
  :root:not([data-theme="light"]) .gp-k { color: color-mix(in srgb, var(--gp) 85%, #fff); background: color-mix(in srgb, var(--gp) 18%, var(--card)); }
}
:root[data-theme="dark"] .gp-tile { box-shadow: inset 0 1px 0 color-mix(in srgb, var(--gp) 22%, transparent); }
:root[data-theme="dark"] .gp-k { color: color-mix(in srgb, var(--gp) 85%, #fff); background: color-mix(in srgb, var(--gp) 18%, var(--card)); }
@media (prefers-reduced-motion: reduce) { .gp-tile { transition: none; } .gp-tile:hover { transform: none; } }

/* ---- instalments (3.1) ---- */
.inst-plan { margin-top: 14px; }
.plan-prog { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.plan-prog i { display: block; height: 100%; border-radius: inherit; background: var(--up); transition: width .3s cubic-bezier(.2, .8, .2, 1); }
.plan-cap { display: flex; justify-content: space-between; gap: 8px; margin: 6px 0 10px; }
.inst-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.inst { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.inst.late { border-color: color-mix(in srgb, var(--down) 45%, var(--line)); }
.inst.paid .inst-main b { color: var(--muted); }
.inst-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-size: .78rem; color: var(--muted); }
.inst.paid .inst-n { background: var(--up-bg); color: var(--up); }
.inst-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inst-main small { overflow-wrap: anywhere; }
.inst-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.inst-btn { flex: none; padding: 6px 11px; font-size: .82rem; border-radius: 9px; background: var(--ink); color: var(--card); white-space: nowrap; min-height: 32px; }
.inst-btn.done { background: var(--up-bg); color: var(--up); }
.inst-btn:active { transform: scale(.97); }
.due-tag { font-size: .72rem; font-weight: 600; padding: 2px 7px; border-radius: 99px; white-space: nowrap; background: var(--soft); color: var(--muted); }
.due-tag.late { background: var(--down-bg); color: var(--down); }
.due-tag.today, .due-tag.soon { background: var(--warn-bg); color: var(--warn-ink); }
.due-soon .due-rows { display: grid; gap: 4px; }
.due-soon.compact { padding: 0; border: 0; box-shadow: none; background: transparent; margin: 0; }
.due-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.due-row:first-child { border-top: 0; }
.due-what { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; background: none; padding: 2px 0; text-align: start; color: inherit; }
.due-what b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
textarea.paste { width: 100%; box-sizing: border-box; font: .8rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; margin-bottom: 10px; }
.plan-sum { margin: 0; }

/* ---- Gold: which price shows (you sell at / you buy at). The lit side and a tag on every price say which. ---- */
.gold-side button { font-weight: 700; }
.gold-side button.on.sell { color: var(--down); }
.gold-side button.on.buy { color: var(--up); }
.side-tag { font-style: normal; font-size: 0.68rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; white-space: nowrap; margin-inline-start: 6px; }
.side-tag.sell { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.side-tag.buy { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); }
.gp-top .side-tag { margin-inline-start: 0; }
.prices .tile small .side-tag { display: table; font-size: 0.66rem; margin: 3px 0 1px; }

/* Loading: a spinner while signing in / unlocking / opening, so the screen never looks stuck. */
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--brand) 22%, transparent); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.splash { grid-auto-flow: row; align-content: center; gap: 22px; }
.spinner.light { border-color: rgba(255, 255, 255, 0.3); border-top-color: #fff; width: 22px; height: 22px; border-width: 3px; flex: none; }
/* App skeleton while signing in / unlocking: the real header, tab bar and cards, with grey placeholders. */
.skel .sk { display: block; height: 12px; border-radius: 7px; background: linear-gradient(90deg, var(--soft) 0%, color-mix(in srgb, var(--line) 70%, var(--soft)) 50%, var(--soft) 100%) 0 0 / 200% 100%; animation: skShine 1.4s ease-in-out infinite; }
.skel .sk-light { height: 12px; background: linear-gradient(90deg, rgba(255,255,255,0.14), rgba(255,255,255,0.28), rgba(255,255,255,0.14)) 0 0 / 200% 100%; }
.skel .sk-btn { width: 36px; height: 36px; border-radius: 12px; }
.skel .sk-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.skel .sk-title { width: 45%; height: 16px; } .skel .w70 { width: 70%; } .skel .w88 { width: 88%; } .skel .w60 { width: 60%; }
@keyframes skShine { from { background-position: 100% 0; } to { background-position: -100% 0; } }
/* laid over the sign-in form (kept underneath, so password managers don't think a wrong password worked) */
.app.skel { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: var(--bg); }
.skel .tabs button[disabled] { opacity: 1; cursor: default; }
.skel .hero { display: flex; flex-direction: column; align-items: stretch; gap: 14px; min-height: 200px; }
.skel .hero > .sk:first-child { width: 38%; max-width: 220px; }
.skel-step { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.skel-step b { font-size: 1.25rem; font-weight: 700; }
.skel-hint { color: rgba(255, 255, 255, 0.78); line-height: 1.5; max-width: 340px; }
.skel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: auto; }
.skel-card { display: flex; flex-direction: column; gap: 18px; }
.skel-line { display: flex; align-items: center; gap: 12px; }
.skel, .skel .hero, .skel-card { animation: fadeIn 220ms ease-out; }
.skel-boot, .skel-boot .hero, .skel-boot .skel-card { animation: none; }
@media (prefers-reduced-motion: reduce) { .skel .sk { animation: none; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.6s; } }

/* Settings → Android app */
.android-card a.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.android-card a.btn.primary { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
