:root {
  --navy: #0B173D; --navy2: #13306E; --ink: #071029; --teal: #00C9AD; --teal-d: #00806F; --teal-h: #009C87; --blue: #0055FF;
  --mint: #E6FAF5; --pale: #EEF3FF; --cloud: #F7F9FC; --bg: #F3F6FA; --slate: #5B6B82; --line: #E2E8F0; --line2: #EEF2F6;
  --red: #B42318; --red-bg: #FDECEC; --amber: #8A4B00; --amber-bg: #FFF4E5; --purple: #6B21A8; --purple-bg: #F3E8FF;
  --hf: 'Plus Jakarta Sans', Inter, system-ui, sans-serif; --shadow: 0 1px 2px rgba(11,23,61,.04), 0 8px 24px rgba(11,23,61,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, sans-serif; color: var(--navy); background: var(--bg); -webkit-font-smoothing: antialiased; font-size: 14px; }
a { color: var(--blue); text-decoration: none; } a:hover { color: #0040C2; }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: var(--navy); }
h1, h2, h3 { font-family: var(--hf); letter-spacing: -0.02em; margin: 0; }
.muted { color: var(--slate); } .small { font-size: 12px; } .bold { font-weight: 700; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.hidden { display: none !important; }

/* layout */
.shell { min-height: 100vh; padding: 14px; display: flex; gap: 18px; align-items: flex-start; }
.side { position: sticky; top: 14px; width: 248px; flex: none; background: var(--navy); border-radius: 24px; padding: 20px 12px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; height: calc(100vh - 28px); }
.side::after { content: ''; position: absolute; left: -60px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%; background: var(--navy2); z-index: 0; }
.side > * { position: relative; z-index: 1; }
.side .logo { padding: 0 10px; } .side .logo img { height: 30px; display: block; }
.side nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; margin-right: -6px; padding-right: 6px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: #A9B6CE; font-size: 14px; }
.side nav a svg { color: #7F8EAB; }
.side nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side nav a.on { background: rgba(0,201,173,.14); color: #fff; font-weight: 600; } .side nav a.on svg { color: var(--teal); }
.side nav .grp { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: #6F7F9E; padding: 12px 12px 4px; }
.side .badge { margin-left: auto; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.wsbtn { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 9px 11px; color: #fff; text-align: left; cursor: pointer; width: 100%; }
.wsbtn .n { display: block; font-size: 13px; font-weight: 700; } .wsbtn .s { font-size: 11px; color: #8FA0BF; }
.side .usage { margin-top: auto; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 18px; padding: 14px; color: #fff; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.side .usage .row { display: flex; justify-content: space-between; } .side .usage .row span { color: #B8C3D9; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; padding: 8px 6px 40px; }
.top { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.top .t .sub { font-size: 13px; color: var(--slate); } .top h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin-top: 2px; }
.top .r { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; color: var(--slate); min-width: 240px; }
.search input { border: 0; outline: none; background: transparent; flex: 1; font-size: 13px; }
.iconbtn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--navy); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.iconbtn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; }
.impbar { background: var(--amber-bg); color: var(--amber); border-radius: 14px; padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.mobilebar { display: none; }


/* cards */
.card { background: #fff; border-radius: 22px; padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card h3 { font-size: 18px; font-weight: 800; }
.card .ch { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.row { display: flex; flex-wrap: wrap; gap: 18px; align-items: stretch; } .row.top { align-items: flex-start; }
.row > .card { flex: 1 1 300px; } .grow2 { flex: 2 1 520px !important; } .grow3 { flex: 3 1 600px !important; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.hero { position: relative; overflow: hidden; background: var(--navy); color: #fff; border-radius: 24px; padding: 26px 28px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.hero::before { content: ''; position: absolute; right: -40px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: var(--teal); opacity: .9; }
.hero::after { content: ''; position: absolute; right: 200px; top: 30px; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); }
.hero > * { position: relative; z-index: 1; }
.hero .big { font-family: var(--hf); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; } .hero .s { color: #B8C3D9; font-size: 14px; }
.kpi .l { font-size: 13px; color: var(--slate); } .kpi .v { font-family: var(--hf); font-size: 30px; font-weight: 800; letter-spacing: -0.03em; } .kpi .d { font-size: 12px; font-weight: 600; color: var(--teal-d); }
.kpi .wrap { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 10px; }
.kpis { display: flex; flex-wrap: wrap; gap: 18px; } .kpis > .card { flex: 1 1 200px; }
.sec { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--slate); text-transform: uppercase; }
.empty { text-align: center; padding: 36px 16px; color: var(--slate); } .empty h3 { color: var(--navy); margin-bottom: 6px; }
.note { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 12px 16px; font-size: 13px; line-height: 1.5; }
.note.blue { background: var(--pale); color: #1E3A8A; } .note.mint { background: var(--mint); color: #0B4F45; } .note.amber { background: var(--amber-bg); color: var(--amber); } .note.red { background: var(--red-bg); color: var(--red); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; min-height: 42px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; border: 1px solid transparent; background: none; color: var(--navy); }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: var(--navy); } .btn.primary:hover { background: #00B39A; }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; } .btn.dark:hover { background: #142456; }
.btn.outline { background: #fff; border-color: #C9D3E1; } .btn.outline:hover { border-color: var(--navy); }
.btn.ghost:hover { background: var(--cloud); }
.btn.danger { background: #fff; color: var(--red); border-color: #F3C4C6; } .btn.danger:hover { background: var(--red-bg); }
.btn.blue { background: var(--blue); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.icon { padding: 0; width: 34px; min-height: 34px; }
.link { background: none; border: 0; color: var(--blue); font-weight: 700; cursor: pointer; padding: 0; font-size: 13px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #F1F5F9; color: #36435C; }
.chip .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.mint { background: var(--mint); color: var(--teal-d); } .chip.blue { background: var(--pale); color: var(--blue); } .chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.red { background: var(--red-bg); color: var(--red); } .chip.purple { background: var(--purple-bg); color: var(--purple); } .chip.navy { background: var(--navy); color: #fff; } .chip.green { background: #E8F7EE; color: #166534; }
.chip.sel { cursor: pointer; border: 0; padding: 4px 8px 4px 12px; font-weight: 700; }

/* tabs */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px; align-self: flex-start; }
.tabs button { border: 0; background: transparent; color: #36435C; display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 36px; }
.tabs button.on { background: var(--navy); color: #fff; } .tabs button .n { opacity: .7; font-weight: 500; }

/* tables */
.tbl { overflow-x: auto; } table { width: 100%; border-collapse: collapse; min-width: 600px; }
th { text-align: left; padding: 11px 12px; font-size: 12px; font-weight: 600; color: var(--slate); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; font-size: 13px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--cloud); }
.person { display: flex; gap: 10px; align-items: center; } .person b { display: block; } .person span { font-size: 12px; color: var(--slate); }

/* forms */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; min-width: 0; }
label.f .h { font-size: 12px; color: var(--slate); font-weight: 400; }
.in, select.in, textarea.in { border: 1px solid #CBD5E1; border-radius: 12px; padding: 11px 14px; background: #fff; font-weight: 500; width: 100%; outline: none; }
.in:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,201,173,.18); }
textarea.in { line-height: 1.6; resize: vertical; }
.fgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tog { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.tog input { opacity: 0; width: 0; height: 0; position: absolute; }
.tog span { position: absolute; inset: 0; border-radius: 999px; background: #CBD5E1; transition: .15s; cursor: pointer; }
.tog span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(11,23,61,.25); transition: .15s; }
.tog input:checked + span { background: var(--teal); } .tog input:checked + span::after { left: 20px; }
.tog input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.setline { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line2); }
.setline .x { flex: 1; } .setline b { display: block; font-weight: 600; } .setline span.h { font-size: 12px; color: var(--slate); }
.check { width: 18px; height: 18px; accent-color: var(--teal); cursor: pointer; }

/* bars and charts */
.bar { height: 8px; background: #EDF1F6; border-radius: 999px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--teal); border-radius: 999px; }
.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; flex: none; }
.ibox { display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(7,16,41,.45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 24px; padding: 26px; width: 100%; max-width: 560px; box-shadow: 0 40px 100px rgba(7,16,41,.35); }
.modal.wide { max-width: 820px; }
.modal .mh { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 16px; } .modal .mh h2 { font-size: 22px; font-weight: 800; }
.modal .mf { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 14px; box-shadow: 0 10px 30px rgba(7,16,41,.3); max-width: 380px; }
.toast.err { background: var(--red); }
.menu { position: absolute; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 40px rgba(11,23,61,.15); padding: 6px; min-width: 200px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.menu button:hover { background: var(--cloud); }

/* auth */
.auth { min-height: 100vh; display: flex; }
.auth .l { flex: 1 1 50%; background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth .l::before { content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: var(--teal); opacity: .9; }
.auth .l::after { content: ''; position: absolute; right: 230px; bottom: 230px; width: 40px; height: 40px; border-radius: 50%; background: var(--blue); }
.auth .l > * { position: relative; z-index: 1; }
.auth .r { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: #fff; }
.auth form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.auth h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
@media (max-width: 860px) { .auth .l { display: none; } }

/* inbox */
.ilist { display: flex; flex-direction: column; gap: 8px; flex: 1 1 320px; max-width: 430px; min-width: 0; }
.iitem { background: #fff; border: 0; border-radius: 16px; padding: 14px; text-align: left; display: flex; gap: 12px; cursor: pointer; box-shadow: 0 1px 2px rgba(11,23,61,.05); width: 100%; }
.iitem.on { box-shadow: 0 0 0 2px var(--teal), 0 10px 30px rgba(11,23,61,.08); } .iitem.unread b.n::after { content: ''; display: inline-block; width: 7px; height: 7px; background: var(--blue); border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.iitem .c { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.iitem .p { font-size: 12px; color: var(--slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg { background: var(--cloud); border-radius: 16px; padding: 16px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.msg.out { background: #fff; border: 1px solid var(--line); color: #3C4A63; font-size: 13px; }
.draft { border-radius: 14px; padding: 12px 14px; text-align: left; font-size: 13px; line-height: 1.55; background: #fff; border: 1px solid var(--line); cursor: pointer; }
.draft.on { background: var(--mint); border: 1.5px solid var(--teal); } .draft .k { display: block; color: var(--teal-d); font-size: 11px; font-weight: 800; letter-spacing: .12em; margin-bottom: 4px; }

/* kanban */
.kan { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.col { flex: 1 0 230px; background: #E9EEF5; border-radius: 20px; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.col.over { outline: 2px dashed var(--teal); }
.col .h { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; padding: 4px; }
.deal { background: #fff; border-radius: 16px; padding: 14px; box-shadow: 0 1px 2px rgba(11,23,61,.05), 0 8px 20px rgba(11,23,61,.05); display: flex; flex-direction: column; gap: 6px; cursor: grab; }

/* sequence editor */
.flow { flex: 1.6 1 520px; min-width: 0; border-radius: 24px; padding: 26px; background-image: radial-gradient(#DCE3EE 1px, transparent 1px); background-size: 20px 20px; background-color: #FAFBFD; box-shadow: inset 0 0 0 1px var(--line); }
.node { width: 100%; max-width: 640px; background: #fff; border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.node.on { box-shadow: 0 0 0 3px var(--teal), 0 18px 40px rgba(11,23,61,.10); }
.wait { display: flex; flex-direction: column; align-items: center; } .wait i { width: 2px; height: 20px; background: #CBD5E1; }
.wait span { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; }
.wait input { width: 46px; border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; text-align: center; font-weight: 700; }
.vtabs { display: flex; flex-wrap: wrap; gap: 8px; }
.vtab { display: inline-flex; gap: 8px; align-items: center; border-radius: 12px; padding: 7px 12px; font-size: 13px; font-weight: 700; background: var(--cloud); border: 1px solid var(--line); cursor: pointer; }
.vtab.on { background: #fff; border: 1.5px solid var(--navy); }
.vl { width: 22px; height: 22px; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.vars { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.vars button { background: var(--pale); color: #1E3A8A; border: 0; border-radius: 8px; padding: 4px 8px; font-size: 12px; font-family: ui-monospace, Menlo, monospace; cursor: pointer; }
.code { background: var(--navy); color: #E2E8F0; border-radius: 14px; padding: 14px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.7; border: 0; width: 100%; }
.preview { background: var(--cloud); border-radius: 14px; padding: 16px; font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.stepper { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stepper .s { display: flex; gap: 10px; align-items: center; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.stepper .dotn { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex: none; border: 2px solid #CBD5E1; color: var(--slate); }
.stepper .s.done .dotn { background: var(--teal); border-color: var(--teal); color: var(--navy); }
.stepper .s.on .dotn { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 0 0 5px var(--pale); }
.stepper .ln { flex: 1 1 20px; height: 2px; background: var(--line); min-width: 14px; }
.days { display: flex; gap: 6px; } .days button { width: 38px; height: 38px; border-radius: 10px; border: 0; background: #F1F5F9; color: var(--slate); font-weight: 700; cursor: pointer; }
.days button.on { background: var(--navy); color: #fff; }
.hours { display: flex; gap: 2px; } .hours i { flex: 1; height: 24px; border-radius: 4px; background: #EDF1F6; } .hours i.on { background: var(--teal); }
.mbtile { border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 11px; }
.qr { width: 160px; height: 160px; }

/* ── phones and tablets ── */
.mobile-only, .bnav, .mobilebar { display: none; }
.mono { word-break: break-all; }
.note > span { min-width: 0; }
body.noscroll { overflow: hidden; }
@media (max-width: 960px) {
  .mobile-only { display: inline-flex; }
  .shell { display: block; padding: 0 0 calc(84px + env(safe-area-inset-bottom)); }
  .main { padding: 0 12px 20px; gap: 14px; }
  #page { gap: 14px !important; }
  /* top bar */
  .mobilebar { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; justify-content: space-between; background: var(--navy); margin: 0 -12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .mobilebar img { height: 26px; }
  .mobilebar .me { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--teal); color: var(--navy); font-weight: 800; font-size: 15px; cursor: pointer; }
  .impbar, .main > .note { margin-top: 4px; }
  /* drawer menu */
  .side { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 280px; height: 100%; border-radius: 0 24px 24px 0; transform: translateX(-105%); transition: transform .22s ease; padding-top: calc(20px + env(safe-area-inset-top)); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(7,16,41,.5); }
  .side nav a { padding: 12px; font-size: 15px; }
  /* bottom bar */
  .bnav { display: flex; position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(11,23,61,.06); }
  .bnav a, .bnav button { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; border: 0; background: none; color: #6B7A90; font-size: 11px; font-weight: 600; cursor: pointer; border-radius: 14px; }
  .bnav .on { color: var(--navy); } .bnav .on svg { color: var(--teal-d); }
  .bnav b { position: absolute; top: 4px; left: 50%; margin-left: 6px; background: var(--blue); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 6px; }
  /* page header */
  .main, #page, .top, .top > * { min-width: 0; max-width: 100%; }
  .top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 6px; }
  .top h1 { font-size: 26px; }
  .top .r { flex-wrap: nowrap; overflow-x: auto; gap: 8px; margin: 0 -12px; padding: 0 12px 2px; max-width: none; width: auto; scrollbar-width: none; }
  .top .r::-webkit-scrollbar { display: none; }
  .top .r > * { flex: none; }
  .top .r .search { flex: 1 0 220px; }
  #bell, .top #meMenu { display: none; }
  /* layout */
  .tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; }
  .row { gap: 14px; }
  .row > .card, .row > div, .grow2, .grow3, #drawer { flex: 1 1 100% !important; max-width: 100% !important; }
  .kpis { gap: 10px; }
  .kpis > .card { flex: 1 1 calc(50% - 5px); }
  .ilist { max-width: 100%; flex: 1 1 100%; }
  .inboxrow.has-open .ilist { display: none; }
  .inboxrow:not(.has-open) #thread { display: none; }
  .flow { padding: 16px; }
  .col { flex: 0 0 84%; }
  .grid { grid-template-columns: 1fr; }
  /* touch + no zoom on iPhone */
  .in, select.in, textarea.in, .search input, input, select, textarea { font-size: 16px !important; }
  .btn { min-height: 44px; } .btn.sm { min-height: 38px; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 24px 24px 0 0; max-height: 92vh; overflow-y: auto; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  .modal .mf { position: sticky; bottom: -20px; background: #fff; padding-top: 12px; }
  .modal .mf .btn { flex: 1 1 auto; }
  #toasts { left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .menu { max-width: calc(100vw - 20px); }
}
@media (max-width: 640px) {
  .card { padding: 16px; border-radius: 18px; }
  .card h3 { font-size: 17px; }
  .kpi .v { font-size: 24px; }
  .kpi .wrap { flex-direction: column; align-items: stretch; gap: 6px; }
  .kpi .wrap svg { width: 100%; height: 30px; }
  .kpi .l { font-size: 12px; }
  .hero { padding: 20px; border-radius: 20px; flex-direction: column; align-items: stretch; }
  .hero::before { width: 150px; height: 150px; right: -70px; top: -70px; opacity: .55; }
  .hero::after { display: none; }
  .hero .big { font-size: 20px; }
  .hero > div:last-child, .hero > div:last-child .btn { width: 100%; }
  .fgrid { grid-template-columns: 1fr; }
  .days button { width: 36px; height: 36px; }
  .stepper .ln { display: none; }
  .iitem { padding: 12px; }
  .msg { padding: 12px; font-size: 14px; }
  .auth .r { padding: 28px 18px; align-items: flex-start; }
  .auth h1 { font-size: 28px; }
  /* tables become cards */
  .tbl { overflow: visible; }
  .tbl table { min-width: 0; }
  .tbl thead { display: none; }
  .tbl tbody, .tbl tr { display: block; }
  .tbl tr { border: 1px solid var(--line); border-radius: 16px; padding: 6px 12px; margin-bottom: 10px; background: #fff; }
  .tbl tr.click:active { background: var(--cloud); }
  .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line2); text-align: right; min-height: 40px; }
  .tbl td:last-child { border-bottom: 0; }
  .tbl td::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--slate); text-align: left; flex: none; max-width: 45%; }
  .tbl td[data-label=""]::before { display: none; }
  .tbl td[data-label=""] { justify-content: flex-end; }
  .tbl td:first-child { text-align: left; justify-content: flex-start; font-size: 15px; }
  .tbl td:first-child::before { display: none; }
  .tbl td > div[style*="min-width"] { min-width: 0 !important; flex: 1; max-width: 60%; }
  .tbl td[colspan] { display: block; text-align: center; }
  .tbl td[colspan]::before { display: none; }
}
@media (max-width: 640px) {
  .tbl tr { position: relative; }
  .tbl td:first-child:has(> input[type=checkbox]) { position: absolute; right: 12px; top: 14px; border: 0; padding: 0; min-height: 0; }
  .tbl td:first-child:has(> input[type=checkbox]) + td { text-align: left; justify-content: flex-start; padding-right: 36px; font-size: 15px; }
  .tbl td:first-child:has(> input[type=checkbox]) + td::before { display: none; }
}
@media (max-width: 960px) { .side .usage { display: none; } .side nav { flex: 1 1 auto; min-height: 0; } }

