/* LEXIS Sales — mobile-first UI in the navy / blue card style of the reference template */
:root {
  --navy: #0E1A3A; --navy-2: #1A2B5E; --navy-3: #24397A; --blue: #2B6BF3; --blue-2: #4C8DFF; --sky: #E9F0FF;
  --bg: #F2F5FA; --card: #FFFFFF; --ink: #101828; --ink-2: #344054; --muted: #667085; --line: #E4E8F0;
  --good: #12B76A; --good-bg: #E7F8EF; --warn: #DC8A0A; --warn-bg: #FEF4E2; --bad: #E5372B; --bad-bg: #FDECEB;
  --r: 18px; --r-sm: 12px; --shadow: 0 6px 22px rgba(16, 24, 40, .07); --tab-h: 72px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: #E3E9F3; -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--blue-2); outline-offset: 2px; border-radius: 8px; }
.ico { width: 22px; height: 22px; flex: none; }

/* ---------- App frame ---------- */
.app { max-width: 480px; min-height: 100vh; margin: 0 auto; background: var(--bg); position: relative; box-shadow: 0 0 40px rgba(16, 24, 40, .08); }
.app:not(.public) { padding-bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
.app.report-mode { max-width: 1180px; }
.app.public { background: #fff; }
#view { padding: 4px 16px 16px; outline: none; }
.public #view { padding: 0; }
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; background: var(--navy); color: #c9d6ff; gap: 12px; }
.demo-banner { background: #FFE9A8; color: #6B4E00; text-align: center; font-size: 12px; font-weight: 600; padding: 4px; }

/* ---------- Top bar & tab bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 16px 10px; background: rgba(242, 245, 250, .92); backdrop-filter: blur(10px); }
.top-title { font-size: 18px; font-weight: 700; flex: 1; text-align: center; }
.hello { flex: 1; display: flex; flex-direction: column; }
.hello b { font-size: 18px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.avatar.sm { width: 36px; height: 36px; font-size: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #fff; box-shadow: var(--shadow); flex: none; }
.icon-btn.light { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: #fff; border-radius: 22px 22px 0 0; box-shadow: 0 -6px 24px rgba(16, 24, 40, .08);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; z-index: 30; }
.report-mode .tabbar { max-width: 480px; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); padding: 8px 0; }
.tab.on { color: var(--blue); font-weight: 600; }
.fab { justify-self: center; width: 56px; height: 56px; border-radius: 18px; background: var(--navy); color: #fff; display: grid; place-items: center; transform: translateY(-16px); box-shadow: 0 10px 22px rgba(14, 26, 58, .35); }
.fab .ico { width: 26px; height: 26px; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--blue); color: #fff; font-weight: 600; border-radius: 14px; padding: 13px 18px; min-height: 48px; box-shadow: 0 6px 14px rgba(43, 107, 243, .25); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.dark { background: var(--navy); box-shadow: 0 6px 14px rgba(14, 26, 58, .25); }
.btn.light { background: #fff; color: var(--navy); box-shadow: none; }
.btn.ghost { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: var(--bad-bg); color: var(--bad); box-shadow: none; }
.btn.small { min-height: 38px; padding: 8px 14px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn .ico { width: 18px; height: 18px; }
.link { color: var(--blue); font-weight: 600; padding: 6px; }
.link.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.around { justify-content: space-around; gap: 16px; width: 100%; }
.row.gap > .btn { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.inline { min-width: 120px; flex: 1; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); }
.input { width: 100%; font: inherit; color: var(--ink); background: #F5F7FB; border: 1.5px solid transparent; border-radius: 12px; padding: 12px 14px; min-height: 46px; }
.input:focus { border-color: var(--blue-2); background: #fff; outline: none; }
textarea.input { resize: vertical; min-height: 84px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #667085 50%), linear-gradient(135deg, #667085 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.form-error { color: var(--bad); font-size: 13px; min-height: 0; margin: 0; }
.form-error:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px 12px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips.scroll-y { max-height: 170px; overflow-y: auto; padding: 2px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span, .chip-btn { display: inline-block; padding: 9px 14px; border-radius: 999px; background: #F2F4F8; color: var(--ink-2); font-size: 13.5px; font-weight: 500; white-space: nowrap; border: 1.5px solid transparent; }
.chip-btn:not(.on) { background: #fff; border-color: var(--line); }
.chip input:checked + span, .chip-btn.on { background: var(--navy); color: #fff; }
.chip input:focus-visible + span { border-color: var(--blue-2); }
.toggle { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--blue); flex: none; margin-top: 1px; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--sky); color: var(--navy); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13px; }
.tag button { width: 22px; height: 22px; border-radius: 50%; background: #fff; font-weight: 700; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.filter-row { margin: 10px 0; }
.search { position: relative; margin-bottom: 12px; }
.search > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.search .input { padding-left: 44px; background: #fff; box-shadow: var(--shadow); }
.seg { display: flex; background: #E6EBF3; border-radius: 14px; padding: 4px; margin-bottom: 12px; }
.seg a { flex: 1; text-align: center; padding: 9px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg a.on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }

/* ---------- Cards & lists ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.card-head .card-title { margin: 0; }
.section-title { font-size: 15px; font-weight: 700; margin: 18px 2px 10px; color: var(--ink-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list.card { padding: 6px 12px; }
.list > li + li { border-top: 1px solid var(--line); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 2px; width: 100%; text-align: left; }
.li-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--sky); color: var(--blue); display: grid; place-items: center; flex: none; }
.li-ico .ico { width: 20px; height: 20px; }
.li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.li-main b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-main small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-side { font-size: 12.5px; color: var(--muted); text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #EEF2F8; color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.light { background: rgba(255, 255, 255, .14); color: #fff; }
.pill.good { background: var(--good-bg); color: var(--good); } .pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.good-text { color: var(--good); } .bad-text { color: var(--bad); }
.muted { color: var(--muted); } .muted-light { color: #AFC0EA; } .small { font-size: 13px; } .tiny { font-size: 12px; } .center { text-align: center; } .pad { padding: 20px; }
.lead { font-size: 16px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; } .big { font-size: 20px; font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .ico { width: 34px; height: 34px; color: #B4BFD3; }
.empty p { margin: 0; max-width: 280px; }
.detail { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0 0 16px; font-size: 14px; }
.detail dt { color: var(--muted); } .detail dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ---------- Hero, promo, KPIs ---------- */
.hero-card { background: linear-gradient(150deg, var(--navy) 0%, var(--navy-2) 70%, var(--navy-3) 100%); color: #fff; border-radius: 22px; padding: 18px; margin-bottom: 14px; box-shadow: 0 14px 30px rgba(14, 26, 58, .25); }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.hero-line { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; }
.hero-line span { color: #C7D3F5; font-size: 14px; }
.hero-line b { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.hero-line small { font-size: 14px; color: #8FA3D6; font-weight: 600; }
.hero-card .bar { background: rgba(255, 255, 255, .12); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.hero-stats div { background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; }
.hero-stats span { font-size: 11.5px; color: #C7D3F5; } .hero-stats b { font-size: 22px; font-weight: 800; } .hero-stats small { font-size: 11px; color: #8FA3D6; }
.promo { display: flex; align-items: center; gap: 12px; background: linear-gradient(120deg, var(--blue) 0%, var(--blue-2) 100%); color: #fff; border-radius: 18px; padding: 14px 16px; margin-bottom: 14px; box-shadow: 0 10px 20px rgba(43, 107, 243, .25); }
.promo.danger { background: linear-gradient(120deg, #D92D20, #F04438); }
.promo > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.promo small { color: rgba(255, 255, 255, .85); }
.promo-ico { width: 44px; height: 44px; border-radius: 14px; background: rgba(255, 255, 255, .2); display: grid; place-items: center; flex: none; }
.quick-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.quick { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; text-align: center; }
.quick .ico { color: var(--blue); width: 24px; height: 24px; }
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi-grid.four { grid-template-columns: repeat(4, 1fr); margin-bottom: 10px; }
.kpi { background: #F6F8FC; border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.kpi.wide { grid-column: 1 / -1; }
.kpi span { font-size: 12px; color: var(--muted); } .kpi b { font-size: 19px; font-weight: 800; } .kpi b small { font-size: 13px; color: var(--muted); font-weight: 600; }
.bar { height: 7px; border-radius: 99px; background: #E8EDF5; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--blue-2); transition: width .4s; }
.bar i.good { background: var(--good); } .bar i.warn { background: #F5A524; } .bar i.bad { background: #F97066; }

/* ---------- Rep cards (credit-card style) ---------- */
.cards-scroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px 14px; padding: 4px 16px 8px; scrollbar-width: none; }
.rep-card { flex: 0 0 84%; scroll-snap-align: center; border-radius: 20px; padding: 16px; color: #fff; min-height: 170px; display: flex; flex-direction: column; box-shadow: 0 12px 26px rgba(14, 26, 58, .25); }
.rep-card.v0 { background: linear-gradient(135deg, #1D4ED8, #4C8DFF); }
.rep-card.v1 { background: linear-gradient(135deg, #0E1A3A, #2A3F80); }
.rep-card.v2 { background: linear-gradient(135deg, #0B2A3F, #1F6C8F); }
.rc-top { display: flex; justify-content: space-between; font-size: 12px; letter-spacing: 1px; font-weight: 700; opacity: .9; }
.rc-amt { font-size: 28px; font-weight: 800; margin-top: 18px; letter-spacing: -.5px; }
.rc-sub { font-size: 12px; opacity: .85; }
.rc-bottom { margin-top: auto; display: flex; justify-content: space-between; font-size: 12px; gap: 8px; padding-top: 14px; opacity: .95; }

/* ---------- Graphic menu ---------- */
.graphic-menu { display: grid; gap: 10px; margin-bottom: 14px; }
.graphic-menu.two { grid-template-columns: 1fr 1fr; }
.gm-item { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; border-radius: 16px; padding: 14px; text-align: left; width: 100%; box-shadow: 0 8px 18px rgba(14, 26, 58, .18); }
.gm-item .ico { color: var(--blue-2); }
.gm-item span { display: flex; flex-direction: column; min-width: 0; }
.gm-item b { font-size: 14px; } .gm-item small { color: #A9B8E3; font-size: 11.5px; }

/* ---------- Calendar ---------- */
.cal-card { background: var(--navy); color: #fff; border-radius: 22px; padding: 14px; box-shadow: 0 14px 30px rgba(14, 26, 58, .25); }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; background: #fff; color: var(--ink); border-radius: 16px; padding: 10px 8px; }
.cal-wd { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.cal-day { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; font-size: 14px; font-weight: 500; }
.cal-day.today { color: var(--blue); font-weight: 800; }
.cal-day.sel { background: var(--blue); color: #fff; }
.cal-day i { position: absolute; bottom: 2px; right: 3px; font-style: normal; font-size: 9px; background: var(--navy); color: #fff; border-radius: 99px; min-width: 15px; height: 15px; display: grid; place-items: center; padding: 0 3px; }
.cal-day.sel i { background: #fff; color: var(--blue); }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 170px); }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 0 12px; }
.bubble { max-width: 80%; background: #fff; border-radius: 16px 16px 16px 4px; padding: 10px 12px; box-shadow: var(--shadow); align-self: flex-start; }
.bubble.mine { align-self: flex-end; background: var(--sky); border-radius: 16px 16px 4px 16px; }
.bubble p { margin: 2px 0; white-space: pre-wrap; word-break: break-word; }
.bubble .who { font-size: 12px; font-weight: 700; color: var(--blue); }
.bubble time { font-size: 11px; color: var(--muted); }
.chat-input { display: flex; gap: 8px; padding-top: 8px; }
.chat-input .input { background: #fff; box-shadow: var(--shadow); }
.send { width: 48px; height: 48px; border-radius: 14px; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; }

/* ---------- Catalog ---------- */
.goods { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.good { background: #fff; border-radius: 16px; padding: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.good-img { background: linear-gradient(135deg, #E9F0FF, #F6F8FC); border-radius: 12px; height: 92px; display: grid; place-items: center; color: var(--blue); }
.good-img .ico { width: 34px; height: 34px; }
.good b { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.good small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.good-cat { font-size: 10.5px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .3px; }
.product-hero { height: 200px; border-radius: 22px; background: linear-gradient(135deg, #E9F0FF, #fff); display: grid; place-items: center; color: var(--blue); margin-bottom: 14px; box-shadow: var(--shadow); }
.product-hero .ico { width: 80px; height: 80px; }
.product-name { font-size: 20px; margin: 10px 0 4px; }

/* ---------- Map & stats & charts ---------- */
.map { height: 320px; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); margin-bottom: 14px; background: #DDE5F2; }
.stat-card { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.donut { width: 190px; height: 190px; }
.d-bg { fill: none; stroke: #EEF2F8; stroke-width: 12; }
.d-fg { fill: none; stroke: var(--blue); stroke-width: 12; stroke-linecap: round; transition: stroke-dasharray .6s; }
.d-fg.good { stroke: var(--good); } .d-fg.warn { stroke: #F5A524; } .d-fg.bad { stroke: #F97066; }
.d-val { font-size: 26px; font-weight: 800; fill: var(--ink); } .d-lbl { font-size: 10px; fill: var(--muted); }
.stat-row { padding: 8px 0; } .stat-row + .stat-row { border-top: 1px solid var(--line); }
.status { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 12px; letter-spacing: .4px; background: #EEF2F8; }
.status.good { background: var(--good-bg); color: var(--good); } .status.warn { background: var(--warn-bg); color: var(--warn); } .status.bad { background: var(--bad-bg); color: var(--bad); }
.chart-box { position: relative; height: 240px; } .chart-box.small { height: 200px; }

/* ---------- Welcome / auth / PIN ---------- */
.screen-dark { min-height: 100vh; background: radial-gradient(120% 80% at 50% 0%, #22357A 0%, var(--navy) 60%); color: #fff; display: flex; flex-direction: column; padding: 48px 28px calc(36px + env(safe-area-inset-bottom)); }
.welcome-logo { flex: 1; display: grid; place-items: center; }
.welcome-logo svg { width: 140px; height: 140px; filter: drop-shadow(0 12px 30px rgba(76, 141, 255, .45)); }
.welcome-copy h1 { font-size: 30px; letter-spacing: 2px; font-weight: 800; }
.welcome-copy p { color: #B8C6EE; }
.dots { display: flex; gap: 6px; margin: 14px 0 28px; } .dots i { width: 8px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .3); } .dots i.on { width: 22px; background: #fff; }
.welcome-actions { text-align: center; } .welcome-actions .tiny { margin-top: 10px; }
.screen-light { min-height: 100vh; background: #fff; padding: calc(24px + env(safe-area-inset-top)) 24px 32px; display: flex; flex-direction: column; }
.auth { gap: 14px; } .auth .back { align-self: flex-start; }
.auth.center { justify-content: center; align-items: center; text-align: center; }
.avatar-xl { width: 92px; height: 92px; border-radius: 50%; background: #F2F4F8; color: #98A2B3; display: grid; place-items: center; align-self: center; margin: 18px 0; font-size: 30px; font-weight: 800; }
.card .avatar-xl { margin: 6px auto 10px; background: var(--navy); color: #fff; }
.avatar-xl .ico { width: 44px; height: 44px; }
.title-center { text-align: center; font-size: 22px; }
.demo-box { background: #FFF7DD; border-radius: 14px; padding: 12px; font-size: 14px; display: flex; flex-direction: column; gap: 10px; }
.pin { align-items: center; gap: 10px; }
.pin-head { align-self: stretch; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; }
.pin-title { font-size: 18px; margin-top: 40px; font-weight: 600; color: var(--ink-2); }
.pin-dots { display: flex; gap: 16px; margin: 18px 0 6px; } .pin-dots i { width: 16px; height: 16px; border-radius: 50%; background: #E4E8F0; } .pin-dots i.on { background: var(--blue); }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px 26px; margin-top: auto; margin-bottom: 18px; }
.key { width: 72px; height: 72px; border-radius: 50%; background: #F2F4F8; font-size: 26px; font-weight: 600; display: grid; place-items: center; }
.key:active { background: var(--sky); } .key.ghost { background: transparent; font-size: 15px; color: var(--muted); }

/* ---------- Sheet, toast, loading ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(14, 26, 58, .45); opacity: 0; transition: opacity .2s; }
.sheet { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 100%); width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; background: #fff; border-radius: 24px 24px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom)); transition: transform .25s ease; }
.sheet-wrap.open .sheet { transform: translate(-50%, 0); } .sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-grip { width: 40px; height: 5px; border-radius: 9px; background: #D0D5DD; margin: 4px auto 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; } .sheet-head h2 { font-size: 18px; }
.sheet .icon-btn { box-shadow: none; background: #F2F4F8; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 30px); transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; opacity: 0; transition: all .25s; z-index: 80; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.bad { background: var(--bad); }
.loading { display: flex; justify-content: center; gap: 6px; padding: 60px 0; }
.loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--blue-2); animation: pulse 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- Reports ---------- */
.report { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.rpt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; border-bottom: 3px solid var(--navy); padding-bottom: 10px; }
.rpt-head h2 { font-size: 20px; color: var(--navy); }
.rpt-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .rpt-controls .input { width: auto; min-height: 38px; padding: 6px 10px; }
.rpt-date { font-weight: 700; margin: 10px 0 0; }
.report h3 { font-size: 14px; color: var(--navy); background: #E9EFFA; padding: 7px 10px; border-radius: 8px; margin: 18px 0 10px; text-transform: uppercase; letter-spacing: .3px; }
.table-wrap { overflow-x: auto; }
table.rpt { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rpt th, .rpt td { border: 1px solid #D9DFEA; padding: 6px 7px; }
.rpt thead th { background: var(--navy); color: #fff; font-weight: 700; text-align: center; }
.rpt thead th small { display: block; font-weight: 500; opacity: .8; font-size: 10.5px; }
.rpt thead tr.sub th { background: #E9EFFA; color: var(--navy); font-size: 11px; }
.rpt tbody th { text-align: left; background: #F8FAFD; white-space: nowrap; }
.rpt .num { text-align: right; white-space: nowrap; } .rpt .b { font-weight: 700; } .rpt .muted { color: var(--muted); }
.rpt td.pc { text-align: center; font-weight: 700; } .rpt td.pc.good { background: var(--good-bg); color: var(--good); } .rpt td.pc.warn { background: var(--warn-bg); color: var(--warn); } .rpt td.pc.bad { background: var(--bad-bg); color: var(--bad); }
.rpt td.na { background: #F4F6FA; } .rpt tr.total th, .rpt tr.total td { background: #EEF3FC; font-weight: 800; } .rpt .num.big { font-size: 16px; }
.rpt.list-t td { font-size: 12px; }
.rpt.edit .input { min-height: 38px; padding: 6px 8px; min-width: 76px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.tile { border: 1px solid #D9DFEA; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.tile span { font-size: 11px; color: var(--muted); font-weight: 600; } .tile b { font-size: 17px; color: var(--navy); }
.tile.warn b { color: var(--warn); } .tile.bad b { color: var(--bad); }
.signs { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: 26px; font-weight: 600; font-size: 13px; }


/* ---------- Side menu (shown on wide screens only) ---------- */
.sidenav { display: none; }
.sn-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.sn-brand svg { width: 38px; height: 38px; flex: none; }
.sn-brand span { display: flex; flex-direction: column; }
.sn-brand b { font-size: 18px; letter-spacing: 3px; } .sn-brand small { color: #8FA3D6; font-size: 12px; }
.sn-new { margin: 2px 0 8px; }
.sn-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sn-group { margin: 16px 12px 6px; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: #7F93C9; font-weight: 700; }
.sn-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: #C9D6FF; font-size: 14px; font-weight: 500; }
.sn-link .ico { width: 20px; height: 20px; color: #7FA6FF; }
.sn-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sn-link.on { background: var(--blue); color: #fff; font-weight: 600; } .sn-link.on .ico { color: #fff; }
.sn-user { display: flex; align-items: center; gap: 10px; padding: 14px 8px 2px; margin-top: 14px; border-top: 1px solid rgba(255, 255, 255, .1); color: #fff; }
.sn-user .avatar { background: var(--blue); }
.sn-user > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.sn-user b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-user small { color: #8FA3D6; font-size: 12px; text-transform: capitalize; }

/* ---------- Responsive: the app grows with the screen (like AppSheet) ----------
   Phone (<600px): one column, bottom tab bar.
   Tablet (600–999px): full width, bottom tab bar, two-column dashboards and lists.
   Laptop / desktop (1000px+): navy side menu, wide content, multi-column lists. */
#view { container-type: inline-size; }

@media (min-width: 600px) {
  .app:not(.public), .app.report-mode { max-width: none; box-shadow: none; }
  .tabbar, .report-mode .tabbar { max-width: none; border-radius: 0; grid-template-columns: repeat(5, minmax(0, 132px)); justify-content: center; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  #view { padding: 8px 24px 28px; }
  .app.public { max-width: 440px; min-height: 0; margin: 32px auto; border-radius: 28px; overflow: hidden; box-shadow: 0 24px 60px rgba(16, 24, 40, .18); }
  .public .screen-dark, .public .screen-light { min-height: min(820px, calc(100vh - 64px)); }
  .sheet { top: 50%; bottom: auto; max-width: 560px; max-height: 86vh; border-radius: 24px; padding: 14px 22px 22px; opacity: 0; transform: translate(-50%, -46%); transition: transform .2s ease, opacity .2s ease; }
  .sheet-wrap.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-grip { display: none; }
}

@media (min-width: 1000px) {
  .app:not(.public) { display: grid; grid-template-columns: 248px minmax(0, 1fr); align-items: start; padding-bottom: 0; }
  .demo-banner { grid-column: 1 / -1; }
  .sidenav { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy); padding: 20px 14px 16px; scrollbar-width: thin; }
  .main-col { min-width: 0; min-height: 100vh; }
  .tabbar { display: none; }
  .topbar { padding: 18px max(32px, calc((100% - 1320px) / 2 + 32px)) 12px; }
  .top-title { text-align: left; font-size: 22px; }
  #view { padding: 6px 32px 40px; max-width: 1320px; margin: 0 auto; }
  .toast { bottom: 32px; }
  .chat { height: calc(100vh - 130px); max-width: 920px; margin: 0 auto; }
}

/* Login screens on laptops / desktops: navy brand panel on the left, form on the right */
.auth-brand { display: none; }
.auth-head { text-align: center; margin: -6px 0 4px; }
.auth-title { font-size: 24px; }
.wide-only { display: none; }
@media (min-width: 900px) {
  .app.public { max-width: none; min-height: 100vh; margin: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .auth-split { display: grid; grid-template-columns: minmax(420px, 46%) minmax(0, 1fr); min-height: 100vh; }
  .auth-brand { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; position: sticky; top: 0; height: 100vh;
    padding: 48px clamp(40px, 5vw, 84px); color: #fff; background: radial-gradient(110% 70% at 15% 0%, #22357A 0%, var(--navy) 62%); overflow: hidden; }
  .ab-logo { display: flex; align-items: center; gap: 12px; }
  .ab-logo svg { width: 48px; height: 48px; filter: drop-shadow(0 8px 20px rgba(76, 141, 255, .45)); }
  .ab-logo span { display: flex; flex-direction: column; } .ab-logo b { font-size: 20px; letter-spacing: 4px; } .ab-logo small { color: #8FA3D6; font-size: 13px; }
  .ab-copy { max-width: 540px; }
  .ab-copy h2 { font-size: clamp(30px, 3vw, 44px); line-height: 1.15; font-weight: 800; letter-spacing: -.5px; }
  .ab-copy p { color: #B8C6EE; font-size: 17px; margin: 16px 0 30px; }
  .ab-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
  .ab-list li { display: flex; align-items: center; gap: 14px; font-size: 16px; font-weight: 500; }
  .ab-ico { width: 44px; height: 44px; border-radius: 14px; background: rgba(255, 255, 255, .08); display: grid; place-items: center; color: var(--blue-2); flex: none; }
  .ab-foot { color: #8FA3D6; font-size: 13px; margin: 0; }
  .public #view { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 48px; background: #fff; margin: 0; max-width: none; width: 100%; container-type: normal; }
  .public #view > section { width: 100%; max-width: 420px; min-height: 0; padding: 0; background: transparent; }
  .public .welcome { color: var(--ink); background: none; gap: 22px; }
  .public .welcome-logo, .public .welcome .dots { display: none; }
  .public .welcome-copy h1 { font-size: 34px; color: var(--navy); }
  .public .welcome-copy p { color: var(--muted); font-size: 16px; }
  .public .welcome-actions .btn.light { background: var(--navy); color: #fff; box-shadow: 0 6px 14px rgba(14, 26, 58, .25); }
  .public .welcome-actions .muted-light { color: var(--muted); }
  .public .auth-login .avatar-xl { display: none; }
  .public .auth-head { text-align: left; margin: 10px 0 8px; }
  .public .auth-title { font-size: 30px; color: var(--navy); }
  .public .pin-title { margin-top: 28px; }
  .public .keypad { margin-top: 28px; margin-bottom: 8px; }
  .wide-only { display: block; }
}

/* Content layouts follow the width of the content area itself */
@container (min-width: 640px) {
  .dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
  .dash > * { margin: 0; min-width: 0; }
  .dash > .full { grid-column: 1 / -1; }
  .dash-col { display: flex; flex-direction: column; gap: 14px; } .dash-col > * { margin: 0; }
  .cards-scroll { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; overflow: visible; margin: 0; padding: 0; }
  .rep-card { min-height: 180px; }
  .goods { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
  #view > .graphic-menu.two { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .chips.scroll { flex-wrap: wrap; overflow: visible; margin: 0 0 12px; padding: 0; }
  .filters .field.inline { flex: 0 1 230px; }
  #view > ul.list.card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; padding: 6px 18px; }
  #view > ul.list.card > li { border-top: 1px solid var(--line); }
  #view > ul.list.card > li:nth-child(-n+2) { border-top: 0; }
  #view > ul.list.card > li:only-child { grid-column: 1 / -1; }
}
@container (min-width: 1120px) {
  #view > ul.list.card { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #view > ul.list.card > li:nth-child(3) { border-top: 0; }
}

/* Forms and detail pages stay at a comfortable reading width */
@media (min-width: 760px) {
  #view:is([data-route="log"], [data-route="account"], [data-route="quote"], [data-route="order"], [data-route="collection"],
    [data-route="eval"], [data-route="product"], [data-route="profile"], [data-route="import"]) > * { max-width: 820px; margin-left: auto; margin-right: auto; }
  #view[data-route="calendar"] { display: grid; grid-template-columns: minmax(320px, 460px) minmax(0, 1fr); gap: 24px; align-items: start; }
  #view[data-route="calendar"] .cal-side > .section-title { margin-top: 4px; }
  #view[data-route="calendar"] > .cal-card { position: sticky; top: 88px; }
  #view[data-route="stats"] { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
  #view[data-route="stats"] > .chips, #view[data-route="stats"] > .empty { grid-column: 1 / -1; }
  #view[data-route="stats"] > .card { margin: 0; }
  #view[data-route="stats"] > .btn { grid-column: 2; justify-self: start; width: auto; }
  #view[data-route="charts"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
  #view[data-route="charts"] > :first-child { grid-column: 1 / -1; }
  #view[data-route="charts"] > .card { margin: 0; }
  #view[data-route="charts"] .chart-box { height: 300px; }
  .map { height: 55vh; min-height: 360px; }
}

@media (min-width: 900px) and (max-width: 999px) { .report-mode #view { padding: 16px 24px; } }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body, .app { background: #fff !important; box-shadow: none; }
  .app { max-width: none; padding: 0 !important; }
  .topbar, .tabbar, .sidenav, .demo-banner, .no-print, .skip { display: none !important; }
  .app:not(.public) { display: block !important; }
  #view { container-type: normal; max-width: none !important; }
  #view { padding: 0 !important; }
  .report { box-shadow: none; padding: 0; }
  .rpt thead th, .rpt td.pc, .report h3, .rpt tbody th, .tile { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table-wrap { overflow: visible; } table.rpt { font-size: 10.5px; } tr { break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 360px) { .kpi-grid.four { grid-template-columns: 1fr 1fr; } .keypad { grid-template-columns: repeat(3, 64px); gap: 12px 20px; } .key { width: 64px; height: 64px; } }
