/* Personal Assistant — design system v1
   Plain CSS, works alongside Bootstrap 5 + Bootstrap Icons.
   Theme: set data-theme="dark" (default) or "light" on <html> or any wrapper. */

/* ---------- 1. Tokens ---------- */
.pa, [data-theme="dark"] {
  /* surfaces */
  --bg: #0B0C0F;
  --surface: #14161B;
  --surface-2: #1B1E24;
  --surface-3: #23272E;
  --border: #262A31;
  --border-strong: #353A43;
  /* text */
  --text: #EEF0F3;
  --text-2: #A9AEB8;
  --text-3: #8A909B;
  /* accent (one) */
  --accent: #8E95FF;
  --accent-ink: #0B0C0F;      /* text on accent */
  --accent-soft: #1F2140;     /* tinted bg */
  --accent-text: #B3B8FF;     /* accent used as text on surfaces */
  /* semantic */
  --success: #45C486; --success-soft: #12291D;
  --warning: #E8AA3F; --warning-soft: #2C2210;
  --danger:  #F07171; --danger-soft:  #2E1517;
  /* categorical (charts, categories, module icons) */
  --c1: #5B9DFF; --c1-soft: #14233A;   /* blue   */
  --c2: #F2994A; --c2-soft: #2E1F12;   /* orange */
  --c3: #2EC4A6; --c3-soft: #102923;   /* teal   */
  --c4: #E86AA6; --c4-soft: #2E1523;   /* pink   */
  --c5: #E2C044; --c5-soft: #2A2410;   /* yellow */
  --c6: #A98BFA; --c6-soft: #221B38;   /* violet */
  /* elevation */
  --shadow-1: 0 1px 0 rgba(255,255,255,0.03) inset;
  --shadow-2: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-3: 0 -12px 40px rgba(0,0,0,0.6);
  --scrim: rgba(0,0,0,0.6);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F0F2F5;
  --surface-3: #E6E9EE;
  --border: #E2E5EA;
  --border-strong: #CDD2D9;
  --text: #14161B;
  --text-2: #4F5560;
  --text-3: #646A75;
  --accent: #4A50D4;
  --accent-ink: #FFFFFF;
  --accent-soft: #ECEDFE;
  --accent-text: #3F45C2;
  --success: #1C7F4C; --success-soft: #E5F5EC;
  --warning: #9A6200; --warning-soft: #FDF2DC;
  --danger:  #C23838; --danger-soft:  #FCE9E9;
  --c1: #2F6FDB; --c1-soft: #E7F0FD;
  --c2: #C96A16; --c2-soft: #FDEFE2;
  --c3: #0F8C74; --c3-soft: #E0F5F0;
  --c4: #C2407F; --c4-soft: #FBE8F1;
  --c5: #9A7B00; --c5-soft: #FAF3D6;
  --c6: #6D4FD8; --c6-soft: #EFEAFD;
  --shadow-1: 0 1px 2px rgba(20,22,27,0.05);
  --shadow-2: 0 8px 24px rgba(20,22,27,0.10);
  --shadow-3: 0 -12px 40px rgba(20,22,27,0.16);
  --scrim: rgba(20,22,27,0.45);
  color-scheme: light;
}
.pa, [data-theme] {
  /* type */
  --font-display: "Outfit", system-ui, sans-serif;
  --font-text: "Inter", system-ui, sans-serif;
  /* spacing (4-pt) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  /* radii */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;
  --tap: 44px;
}

/* ---------- 2. Base ---------- */
.pa { background: var(--bg); color: var(--text); font-family: var(--font-text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
.pa *, .pa *::before, .pa *::after { box-sizing: border-box; }
.pa h1, .pa h2, .pa h3, .pa h4, .pa p { margin: 0; }
.pa a { color: var(--accent-text); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* type scale */
.t-display { font-family: var(--font-display); font-size: 34px; line-height: 40px; font-weight: 600; letter-spacing: -0.6px; }
.t-h1 { font-family: var(--font-display); font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.4px; }
.t-h2 { font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -0.2px; }
.t-h3 { font-family: var(--font-display); font-size: 17px; line-height: 22px; font-weight: 600; }
.t-body { font-size: 15px; line-height: 22px; }
.t-sm { font-size: 13px; line-height: 18px; }
.t-xs { font-size: 12px; line-height: 16px; }
.t-label { font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text-3); }
.t-num-xl { font-family: var(--font-display); font-size: 40px; line-height: 44px; font-weight: 600; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.t-num-lg { font-family: var(--font-display); font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.t-num-md { font-family: var(--font-display); font-size: 20px; line-height: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.c-ok { color: var(--success); } .c-warn { color: var(--warning); } .c-bad { color: var(--danger); } .c-accent { color: var(--accent-text); }
.w5 { font-weight: 500; } .w6 { font-weight: 600; }

/* layout helpers */
.stack { display: flex; flex-direction: column; }
.row-x { display: flex; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.wrap { flex-wrap: wrap; }
.g1 { gap: 4px; } .g2 { gap: 8px; } .g3 { gap: 12px; } .g4 { gap: 16px; } .g5 { gap: 20px; } .g6 { gap: 24px; }
.trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* ---------- 3. App shell (phone) ---------- */
.phone { width: 390px; height: 844px; position: relative; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.phone.tall { height: auto; min-height: 844px; }
.statusgap { height: 44px; flex: 0 0 auto; }
.appbar { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 16px; min-height: 56px; flex: 0 0 auto; }
.appbar .title { flex: 1; min-width: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.appbar.back { padding-left: 4px; }
.screen { flex: 1; min-height: 0; overflow: hidden; padding: 4px 16px 112px; display: flex; flex-direction: column; gap: 20px; }
.screen.scroll { overflow-y: auto; }
.screen.flush { padding-left: 0; padding-right: 0; }

/* bottom tab bar */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 6px 24px; background: var(--surface); border-top: 1px solid var(--border); z-index: 5; }
.tab { height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-3); font-size: 11px; font-weight: 500; text-decoration: none; border-radius: 12px; }
.pa a.tab { color: var(--text-3); }
.tab .bi { font-size: 20px; line-height: 28px; width: 56px; height: 28px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.pa a.tab.active { color: var(--text); font-weight: 600; }
.tab.active .bi { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- 4. Buttons ---------- */
.btn-pa { height: var(--tap); padding: 0 18px; border-radius: var(--r-md); border: 1px solid transparent; font-family: var(--font-text); font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn-pa .bi { font-size: 17px; }
.btn-primary-pa { background: var(--accent); color: var(--accent-ink); }
.btn-secondary-pa { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost-pa { background: transparent; color: var(--accent-text); }
.btn-danger-pa { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-ok-pa { background: var(--success); color: #0B0C0F; }
.btn-sm-pa { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg-pa { height: 52px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.icon-btn { width: var(--tap); height: var(--tap); flex: 0 0 auto; border-radius: 22px; border: 0; background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; text-decoration: none; }
.pa a.icon-btn { color: var(--text); }
.icon-btn.filled { background: var(--surface-2); border: 1px solid var(--border); }
.icon-btn.sm { width: 36px; height: 36px; font-size: 17px; }

/* ---------- 5. Chips, badges ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chip { height: 36px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-family: var(--font-text); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: 0 0 auto; cursor: pointer; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .count { font-variant-numeric: tabular-nums; color: var(--text-3); }
.chip.active .count { color: var(--bg); opacity: 0.7; }
.badge-pa { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-pa.ok { background: var(--success-soft); color: var(--success); }
.badge-pa.warn { background: var(--warning-soft); color: var(--warning); }
.badge-pa.bad { background: var(--danger-soft); color: var(--danger); }
.badge-pa.info { background: var(--accent-soft); color: var(--accent-text); }
.badge-pa.neutral { background: var(--surface-3); color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 4px; display: inline-block; flex: 0 0 auto; }

/* ---------- 6. Cards, sections ---------- */
.card-pa { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 0; }
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.sec-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.sec-head a { font-size: 13px; font-weight: 600; }

/* icon tile */
.ico { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 19px; background: var(--surface-3); color: var(--text-2); }
.ico.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 16px; }
.ico.lg { width: 48px; height: 48px; border-radius: 14px; font-size: 22px; }
.ico.c1 { background: var(--c1-soft); color: var(--c1); } .ico.c2 { background: var(--c2-soft); color: var(--c2); }
.ico.c3 { background: var(--c3-soft); color: var(--c3); } .ico.c4 { background: var(--c4-soft); color: var(--c4); }
.ico.c5 { background: var(--c5-soft); color: var(--c5); } .ico.c6 { background: var(--c6-soft); color: var(--c6); }
.ico.accent { background: var(--accent-soft); color: var(--accent-text); }
.ico.ok { background: var(--success-soft); color: var(--success); } .ico.warn { background: var(--warning-soft); color: var(--warning); } .ico.bad { background: var(--danger-soft); color: var(--danger); }

/* list rows */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.pa a.li { color: var(--text); }
.li:last-child { border-bottom: 0; }
.li .body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.li .title { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: 0 0 auto; }
.li .amt { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.li .chev { color: var(--text-3); font-size: 14px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 2px; }

/* stat tile */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .v { font-family: var(--font-display); font-size: 24px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.4px; }
.stat .s { font-size: 12px; color: var(--text-2); }

/* progress */
.bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.bar.thin { height: 6px; }
.bar.thick { height: 12px; border-radius: 6px; }
.bar > span.ok { background: var(--success); } .bar > span.warn { background: var(--warning); } .bar > span.bad { background: var(--danger); }
.bar > span.c1 { background: var(--c1); } .bar > span.c2 { background: var(--c2); } .bar > span.c3 { background: var(--c3); } .bar > span.c4 { background: var(--c4); } .bar > span.c5 { background: var(--c5); } .bar > span.c6 { background: var(--c6); }
.ring { --p: 60; --size: 64px; --track: var(--surface-3); --fill: var(--accent); width: var(--size); height: var(--size); border-radius: 50%; background: conic-gradient(var(--fill) calc(var(--p) * 1%), var(--track) 0); display: grid; place-items: center; flex: 0 0 auto; }
.ring::after { content: ""; grid-area: 1 / 1; width: calc(var(--size) - 12px); height: calc(var(--size) - 12px); border-radius: 50%; background: var(--surface); }
.ring > * { grid-area: 1 / 1; z-index: 1; }

/* ---------- 7. Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input-pa { height: 48px; width: 100%; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-family: var(--font-text); font-size: 16px; outline: none; }
.input-pa::placeholder { color: var(--text-3); }
.input-pa:focus, .input-pa.focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-pa.invalid { border-color: var(--danger); }
.help { font-size: 12px; color: var(--text-3); } .help.bad { color: var(--danger); }
.search-pa { height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.search-pa input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font-family: var(--font-text); font-size: 16px; outline: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 4px; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.seg button, .seg a { height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-family: var(--font-text); font-size: 14px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg .on { background: var(--surface-3); color: var(--text); font-weight: 600; }
[data-theme="light"] .seg .on { background: var(--surface); box-shadow: 0 1px 3px rgba(20,22,27,0.12); }
.switch { width: 48px; height: 28px; border-radius: 14px; background: var(--surface-3); position: relative; flex: 0 0 auto; border: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: var(--text-2); }
.switch.on { background: var(--accent); }
.switch.on::after { left: 23px; background: var(--accent-ink); }
.amount-input { font-family: var(--font-display); font-size: 44px; font-weight: 600; letter-spacing: -1px; font-variant-numeric: tabular-nums; text-align: center; }

/* ---------- 8. Overlays ---------- */
.scrim { position: absolute; inset: 0; background: var(--scrim); z-index: 10; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 11; background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-3); padding: 8px 16px 28px; display: flex; flex-direction: column; gap: 16px; }
.handle { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 2px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.toast-pa { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-2); }
.toast-pa .act { margin-left: auto; color: var(--accent); font-weight: 700; }
[data-theme="light"] .toast-pa .act { color: #B3B8FF; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 16px; }
.empty .ico { width: 56px; height: 56px; border-radius: 18px; font-size: 26px; }

/* ---------- 9. Media ---------- */
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.photos.desk { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px; }
.ph { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--surface-3); display: block; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .star { position: absolute; top: 6px; right: 6px; color: #F5C451; font-size: 13px; }
.memory { position: relative; border-radius: var(--r-lg); overflow: hidden; display: block; }
.memory img { width: 100%; height: 100%; object-fit: cover; display: block; }
.memory .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 14px 12px; background: linear-gradient(to top, rgba(0,0,0,0.72), rgba(0,0,0,0)); color: #FFFFFF; }

/* ---------- 10. Salat ---------- */
.prayer { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.prayer .p { width: 52px; height: 52px; border-radius: 26px; border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--text-3); background: transparent; }
.prayer .p.done { background: var(--success); border-color: var(--success); color: #0B0C0F; }
.prayer .p.late { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.prayer .p.now { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.prayer .n { font-size: 12px; font-weight: 600; }
.heat { display: grid; grid-template-rows: repeat(7, 10px); grid-auto-flow: column; grid-auto-columns: 10px; gap: 3px; }
.heat i { display: block; width: 10px; height: 10px; border-radius: 2px; background: var(--surface-3); }
.heat i.l1 { background: color-mix(in srgb, var(--success) 30%, var(--surface-3)); }
.heat i.l2 { background: color-mix(in srgb, var(--success) 55%, var(--surface-3)); }
.heat i.l3 { background: color-mix(in srgb, var(--success) 78%, var(--surface-3)); }
.heat i.l4 { background: var(--success); }

/* ---------- 11. Charts (CSS only) ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .b span { width: 100%; max-width: 28px; border-radius: 6px 6px 3px 3px; background: var(--surface-3); display: block; }
.bars .b span.on { background: var(--accent); }
.bars .b small { font-size: 11px; color: var(--text-3); }
.stack-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; }
.stack-bar span { display: block; height: 100%; }

/* ---------- 12. Desktop shell ---------- */
.desk { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; background: var(--bg); }
.side { flex: 1 1 240px; max-width: 264px; padding: 20px 14px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; background: var(--bg); }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.side a.nav { height: 42px; padding: 0 12px; border-radius: 10px; display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.side a.nav .bi { font-size: 18px; }
.side a.nav.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.side a.nav.active .bi { color: var(--accent-text); }
.side .grp { padding: 16px 12px 6px; }
.main { flex: 999 1 640px; min-width: 0; padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 24px; }
.main-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.cols { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 900px) { .cols > * { grid-column: span 12; } .side { max-width: none; flex-basis: 100%; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); } }
