/* Alsoniceso Finance OS — design tokens & components */
:root {
  --bg: #F3F4F7;
  --sidebar: #F8F9FB;
  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --surface-3: #F1F2F5;
  --border: #E6E8EE;
  --border-strong: #D5D9E2;
  --text: #0E1A33;
  --text-2: #4A5468;
  --text-3: #8B93A5;
  --primary: #14213D;
  --primary-hover: #1F2F55;
  --focus: #3E63DD;
  --pos: #067647; --pos-bg: #ECFDF3; --pos-line: #17B26A;
  --neg: #B42318; --neg-bg: #FEF3F2; --neg-line: #F0645A;
  --warn: #B54708; --warn-bg: #FFFAEB;
  --info: #1D4ED8; --info-bg: #EFF4FF;
  --owner: #6941C6; --owner-bg: #F4F3FF;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.num, .money { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--text-3); }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn-t { color: var(--warn); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 4px; }
.grow { flex: 1; min-width: 0; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.hide-mobile { } .show-mobile { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--primary); display: grid; place-items: center; color: #fff; flex: none; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }
.nav-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); text-decoration: none; font-weight: 500; border: 1px solid transparent; cursor: pointer; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow); }
.nav-item svg { flex: none; color: var(--text-3); }
.nav-item.active svg { color: var(--text); }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--neg-bg); color: var(--neg); border-radius: 99px; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; padding-top: 16px; }
.sync-card { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 10px 12px; font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(243, 244, 247, .86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; padding: 14px 28px; display: flex; align-items: center; gap: 12px; }
.topbar.scrolled { border-bottom-color: var(--border); }
.page-title { font-size: 19px; font-weight: 650; letter-spacing: -0.015em; margin: 0; }
.page-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.content { padding: 8px 28px 48px; max-width: 1440px; width: 100%; }
.btn.menu-btn { display: none; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-title { font-size: 14.5px; font-weight: 600; margin: 0; letter-spacing: -0.005em; }
.card-sub { font-size: 12px; color: var(--text-3); }
.card-body { padding: 14px 20px 18px; }
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 24px 0 10px; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi-label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 24px; font-weight: 650; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value.sm { font-size: 19px; }
.kpi-foot { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi.hero { background: var(--primary); color: #fff; border-color: var(--primary); }
.kpi.hero .kpi-label, .kpi.hero .kpi-foot { color: rgba(255,255,255,.7); }

.stat-list { display: flex; flex-direction: column; }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.stat-row:last-child { border-bottom: 0; }
.stat-row .lbl { color: var(--text-2); display: flex; align-items: center; gap: 8px; min-width: 0; }
.stat-row .val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-row.total { border-top: 1px solid var(--border-strong); border-bottom: 0; margin-top: 4px; padding-top: 12px; }
.stat-row.total .lbl { color: var(--text); font-weight: 600; }
.stat-row.indent .lbl { padding-left: 14px; }
.dot { width: 8px; height: 8px; border-radius: 99px; flex: none; display: inline-block; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 550; padding: 2px 8px; border-radius: 6px; border: 1px solid transparent; white-space: nowrap; line-height: 1.5; }
.badge.pos { background: var(--pos-bg); color: var(--pos); border-color: #ABEFC6; }
.badge.neg { background: var(--neg-bg); color: var(--neg); border-color: #FECDCA; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: #FEDF89; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: #C7D7FE; }
.badge.owner { background: var(--owner-bg); color: var(--owner); border-color: #D9D6FE; }
.badge.neutral { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }
.badge.muted { background: var(--surface-2); color: var(--text-3); border-color: var(--border); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.pos { background: #fff; color: var(--pos); border-color: #ABEFC6; }
.btn.pos:hover { background: var(--pos-bg); }
.btn.neg { background: #fff; color: var(--neg); border-color: #FECDCA; }
.btn.neg:hover { background: var(--neg-bg); }
.btn.danger { background: #D92D20; color: #fff; border-color: #D92D20; }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn.block { width: 100%; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.input, .select, .textarea { height: 38px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 0 12px; background: var(--surface); width: 100%; outline: none; transition: border-color .12s, box-shadow .12s; }
.textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B93A5' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(62, 99, 221, .14); }
.input.err, .select.err, .textarea.err { border-color: #F97066; }
.err-text { font-size: 12px; color: var(--neg); }
.hint { font-size: 12px; color: var(--text-3); }
.amount-input { position: relative; }
.amount-input .prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 600; pointer-events: none; }
.amount-input .input { padding-left: 42px; font-size: 22px; font-weight: 650; height: 54px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13px; }
.check input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--primary); }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 550; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 0 0 1px var(--border); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--text-2); }
.chip:hover { border-color: var(--text-3); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 550; font-size: 12px; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:hover td { background: #FBFBFD; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); background: var(--surface-2); }
.tbl.compact td { padding: 9px 14px; }
.day-head td { background: var(--surface-2) !important; font-size: 12px; color: var(--text-2); font-weight: 600; padding: 8px 14px; }
.tx-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.tx-icon.income { background: var(--pos-bg); color: var(--pos); border-color: #D1FADF; }
.tx-icon.expense { background: var(--neg-bg); color: var(--neg); border-color: #FEE4E2; }
.tx-icon.owner { background: var(--owner-bg); color: var(--owner); border-color: #EBE9FE; }
.tx-icon.transfer { background: var(--info-bg); color: var(--info); border-color: #D1E0FF; }

/* tx list (mobile) */
.tx-list { display: flex; flex-direction: column; }
.tx-item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.tx-item:last-child { border-bottom: 0; }

/* ---------- progress ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .3s; }
.progress.pos > span { background: var(--pos-line); }
.progress.warn > span { background: #F79009; }
.progress.neg > span { background: var(--neg-line); }

/* ---------- alerts ---------- */
.alert { display: flex; gap: 10px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; align-items: flex-start; }
.alert .ic { flex: none; margin-top: 1px; }
.alert.danger { background: var(--neg-bg); border-color: #FECDCA; } .alert.danger .ic { color: var(--neg); }
.alert.warn { background: var(--warn-bg); border-color: #FEDF89; } .alert.warn .ic { color: var(--warn); }
.alert.info { background: var(--info-bg); border-color: #D1E0FF; } .alert.info .ic { color: var(--info); }
.alert.ok { background: var(--pos-bg); border-color: #ABEFC6; } .alert.ok .ic { color: var(--pos); }
.alert-title { font-weight: 600; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(14, 26, 51, .38); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: fade .12s ease-out; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; display: flex; flex-direction: column; max-height: 88vh; }
.modal.wide { max-width: 860px; }
.modal.narrow { max-width: 440px; }
.modal-head { padding: 18px 22px 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 650; margin: 0; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--primary); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; display: flex; align-items: center; gap: 10px; max-width: 380px; animation: fade .15s; }
.toast.error { background: #B42318; }
.toast button { background: none; border: 0; color: #fff; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--text-3); }
.empty svg { color: var(--border-strong); margin-bottom: 8px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.acc-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: border-color .12s; }
.acc-card:hover { border-color: var(--border-strong); }
.acc-sub { border-top: 1px dashed var(--border); padding-top: 10px; }
.kbd { font-size: 11px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--text-3); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search .input { padding-left: 34px; }
.health { display: flex; align-items: center; gap: 12px; }
.health-ring { width: 54px; height: 54px; flex: none; }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 10px; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 10px; font-size: 13px; }
.steps li::before { content: counter(s); flex: none; width: 22px; height: 22px; border-radius: 99px; background: var(--surface-3); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-2); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.fab { display: none; }
.drawer-bg { display: none; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 12px; font-weight: 550; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--primary); }

/* ---------- notification bell ---------- */
.notif { position: relative; }
.notif-btn { position: relative; }
.notif-count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #F79009; color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); line-height: 1; }
.notif-count.urgent { background: #D92D20; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 45; overflow: hidden; animation: fade .12s; }
.notif-head { padding: 12px 16px; font-weight: 650; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 12px 16px; cursor: pointer; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-ic { flex: none; margin-top: 1px; }
.notif-title { display: block; font-weight: 600; font-size: 13px; }
.notif-text { display: block; font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--text-3); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; }
@media (max-width: 600px) { .notif-panel { position: fixed; left: 12px; right: 12px; top: 58px; width: auto; } }

/* ---------- PIN lock ---------- */
.lock { position: fixed; inset: 0; z-index: 100; background: #FAFAFA; display: grid; place-items: center; padding: 24px 16px; }
.lock-inner { width: 100%; max-width: 320px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.lock-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-top: 10px; }
.pin-dots { display: flex; gap: 14px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 99px; border: 2px solid #111; transition: background .12s; }
.pin-dots span.on { background: #111; }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-8px) } 75% { transform: translateX(8px) } }
.lock-error { min-height: 18px; font-size: 13px; color: var(--neg); }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.keypad button { width: 72px; height: 72px; border-radius: 99px; border: 1px solid var(--border-strong); background: #fff; font-size: 24px; font-weight: 500; color: #111; cursor: pointer; display: grid; place-items: center; }
.keypad button:active { background: var(--surface-3); }
.keypad button:disabled { opacity: .4; }
.keypad .kp-back { border-color: transparent; background: transparent; }
.bio-btn { height: 50px; font-size: 15px; border-radius: 12px; background: #111; border-color: #111; margin-top: 8px; }
.bio-badge { width: 64px; height: 64px; border-radius: 20px; background: #111; color: #fff; display: grid; place-items: center; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .drawer-bg.open { display: block; position: fixed; inset: 0; background: rgba(14,26,51,.3); z-index: 55; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .content { padding: 4px 16px 96px; }
  .g-3 { grid-template-columns: minmax(0, 1fr); }
  .hide-mobile { display: none !important; }
  .show-mobile { display: initial !important; }
  .fab { display: flex; position: fixed; left: 16px; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 40; gap: 8px; }
  .fab .btn { flex: 1; height: 46px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; }
  .toasts { bottom: 80px; left: 16px; right: 16px; }
}
@media (max-width: 600px) {
  .g-4, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .g-4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 20px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 16px 16px 0 0; }
  .modal-foot { border-radius: 0; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .page-title { font-size: 17px; }
}
@media print {
  .sidebar, .topbar .actions, .fab, .no-print { display: none !important; }
  .app { display: block; } body { background: #fff; } .card { box-shadow: none; }
}

/* ---------- Stok barang ---------- */
.mb-16 { margin-bottom: 16px; }
.stock-low { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.stock-low-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); border-left-width: 4px; background: var(--surface); }
.stock-low-item.neg { border-left-color: var(--neg-line); background: var(--neg-bg); }
.stock-low-item.warn { border-left-color: #F79009; background: var(--warn-bg); }
.stock-low-item .r { text-align: right; flex: none; }
.stock-qty { font-size: 22px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stock-list { display: flex; flex-direction: column; }
.stock-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); }
.stock-row:first-child { border-top: 0; }
.stock-pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stock-pill { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 10px; border-radius: 99px; border: 1px solid; font-size: 12.5px; white-space: nowrap; }
.stock-pill b { font-size: 14px; font-variant-numeric: tabular-nums; }
.stock-pill.pos { background: var(--pos-bg); color: var(--pos); border-color: #ABEFC6; }
.stock-pill.warn { background: var(--warn-bg); color: var(--warn); border-color: #FEDF89; }
.stock-pill.neg { background: var(--neg-bg); color: var(--neg); border-color: #FECDCA; }
.stock-pill-l { font-weight: 550; }
@media (max-width: 640px) {
  .stock-row { padding: 12px 14px; align-items: flex-start; flex-direction: column; gap: 8px; }
  .stock-pills { justify-content: flex-start; }
}
.stock-color { white-space: nowrap; font-weight: 650; }
.att-cell { min-width: 54px; text-align: right; }
.profit-preview { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.profit-lines { display: flex; flex-direction: column; }
.profit-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.profit-line:first-child { border-top: 0; }
.profit-line.total { font-weight: 650; border-top: 1px solid var(--border-strong); }
.profit-line.grand { font-weight: 700; font-size: 16px; border-top: 2px solid var(--text); padding-top: 12px; }
.profit-line .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid.g-kpi5 { display: grid; gap: 16px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1200px) { .grid.g-kpi5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.g-kpi5 { grid-template-columns: minmax(0, 1fr); } }
.link { color: var(--focus); font-weight: 550; }
.cash-split { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; font-size: 12.5px; }
.cash-split b { font-variant-numeric: tabular-nums; }
.cash-bar { height: 5px; border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden; margin-top: 3px; }
.cash-bar span { display: block; height: 100%; background: #4ADE80; border-radius: 99px; }
.profit-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.profit-tile { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.profit-tile.accent { background: var(--primary); border-color: var(--primary); color: #fff; }
.profit-tile.accent .xs { color: rgba(255,255,255,.75); }
.profit-big { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
@media (max-width: 640px) { .profit-tiles { grid-template-columns: minmax(0, 1fr); } .profit-big { font-size: 20px; } }

/* ---------------------------------------------------------------- Alsoniceso AI (floating glass bubble) */
.ai-bubble { position: fixed; right: 24px; bottom: 24px; z-index: 45; width: 60px; height: 60px; border-radius: 50%; border: 1px solid rgba(255,255,255,.55);
  background: linear-gradient(140deg, rgba(20,33,61,.62), rgba(60,40,130,.55)); backdrop-filter: blur(14px) saturate(1.6); -webkit-backdrop-filter: blur(14px) saturate(1.6);
  box-shadow: 0 10px 30px -6px rgba(20,33,61,.45), inset 0 1px 0 rgba(255,255,255,.35); display: grid; place-items: center; cursor: pointer; color: #fff; transition: transform .15s, box-shadow .15s; animation: aiFloat 3.6s ease-in-out infinite; }
.ai-bubble:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 34px -6px rgba(60,40,130,.5), inset 0 1px 0 rgba(255,255,255,.4); }
.ai-bubble-label { position: absolute; right: -4px; top: -4px; font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 6px; border-radius: 999px; background: rgba(255,255,255,.85); color: #3B2A8C; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
@keyframes aiFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }

.ai-panel { position: fixed; right: 24px; bottom: 24px; z-index: 46; width: 400px; height: min(640px, calc(100vh - 110px)); display: flex; flex-direction: column; overflow: hidden;
  border-radius: 22px; border: 1px solid rgba(255,255,255,.65); background: rgba(250,250,253,.74); backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7);
  box-shadow: 0 24px 60px -14px rgba(20,33,61,.38), inset 0 1px 0 rgba(255,255,255,.7); animation: aiIn .18s ease-out; }
@keyframes aiIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.ai-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px 14px; border-bottom: 1px solid rgba(20,33,61,.08); }
.ai-avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; background: linear-gradient(140deg, #14213D, #4B32A8); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.ai-avatar.big { width: 58px; height: 58px; border-radius: 18px; }
.ai-title { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.ai-sub { font-size: 12px; color: var(--text-3); }
.ai-icon { width: 32px; height: 32px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--text-2); font-size: 16px; }
.ai-icon:hover { background: rgba(20,33,61,.07); }
.ai-menu { position: absolute; right: 48px; top: 46px; z-index: 2; background: rgba(255,255,255,.96); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; display: flex; flex-direction: column; min-width: 190px; }
.ai-menu button { border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ai-menu button:hover { background: var(--surface-3); }

.ai-list { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.ai-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 10px; }
.ai-msg { max-width: 88%; padding: 9px 12px; border-radius: 16px; font-size: 14px; line-height: 1.5; word-wrap: break-word; }
.ai-msg.user { align-self: flex-end; background: linear-gradient(140deg, #14213D, #2B2F7A); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.ai-msg.ai { align-self: flex-start; background: rgba(255,255,255,.82); border: 1px solid rgba(20,33,61,.07); border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.ai-msg.ai.err { background: var(--neg-bg); color: var(--neg); }
.ai-md p { margin: 0 0 6px; } .ai-md p:last-child { margin-bottom: 0; }
.ai-md ul { margin: 2px 0 6px; padding-left: 18px; } .ai-md li { margin: 2px 0; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.ai-chip { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--owner-bg); color: var(--owner); }
.ai-dots { display: flex; gap: 4px; padding: 4px 2px; } .ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: #8B7CD8; animation: aiDot 1.1s infinite; }
.ai-dots i:nth-child(2) { animation-delay: .15s; } .ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-note { font-size: 12px; color: var(--text-3); text-align: center; padding: 4px 8px; }

.ai-suggest { display: flex; gap: 6px; overflow-x: auto; padding: 6px 12px 2px; scrollbar-width: none; }
.ai-suggest::-webkit-scrollbar { display: none; }
.ai-suggest button { flex: none; border: 1px solid rgba(91,63,208,.22); background: rgba(255,255,255,.7); color: #4B32A8; border-radius: 999px; padding: 6px 11px; font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ai-suggest button:hover { background: #fff; }
.ai-input { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px 12px; }
.ai-input textarea { flex: 1; resize: none; border: 1px solid rgba(20,33,61,.12); background: rgba(255,255,255,.9); border-radius: 14px; padding: 10px 12px; font-size: 15px; line-height: 1.4; max-height: 120px; outline: none; }
.ai-input textarea:focus { border-color: #7C5CFF; box-shadow: 0 0 0 3px rgba(124,92,255,.15); }
.ai-send { width: 42px; height: 42px; flex: none; border-radius: 14px; border: 0; cursor: pointer; color: #fff; font-size: 16px; background: linear-gradient(140deg, #14213D, #5B3FD0); }
.ai-send:disabled { opacity: .35; cursor: default; }
.ai-send.stop { background: #B42318; font-size: 13px; }

.ai-setup { flex: 1; overflow-y: auto; padding: 18px 18px 16px; font-size: 13.5px; color: var(--text-2); }
.ai-setup-ic { width: 64px; height: 64px; margin: 4px auto 10px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(140deg, #14213D, #4B32A8); }
.ai-setup p { margin: 10px 0; } .ai-setup ol { margin: 0 0 12px; padding-left: 20px; } .ai-setup li { margin: 4px 0; }
.ai-setup a { color: #4B32A8; font-weight: 600; }

@media (max-width: 900px) {
  .ai-bubble { right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); width: 54px; height: 54px; }
  .ai-panel { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; height: min(78vh, calc(100vh - 80px)); border-radius: 20px; }
  .ai-msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) { .ai-bubble, .ai-panel, .ai-dots i { animation: none; } }
.ai-upgrade { margin-top: 8px; border: 1px dashed rgba(91,63,208,.45); background: rgba(255,255,255,.65); color: #4B32A8; border-radius: 12px; padding: 9px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; max-width: 290px; }
.ai-upgrade:hover { background: #fff; }
.ai-md em { color: var(--text-3); font-style: italic; }
