/* AstraTech admin + My Day PWA. Warm light work surface, navy sidebar, copper accent. Phone first. */
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url(/fonts/poppins-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url(/fonts/poppins-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(/fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(/fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format("woff2"); }

:root {
  --bg: #F5F1EC; --card: #fff; --line: #E8DFD5; --line2: #F0E9E1; --ink: #1B2A41; --ink2: #4E5B6E; --muted: #8A93A3;
  --nav: #0B1322; --nav2: #131E33; --navtext: #B7C2D1;
  --accent: #B76227; --accent2: #9E521E; --tint: #FCEBDD; --tint2: #FFF5EC;
  --ok: #2F8F5B; --ok-bg: #E4F4EA; --warn: #B7791F; --warn-bg: #FDF1DC; --bad: #C2462E; --bad-bg: #FBE6E1; --info: #2C5FA8; --info-bg: #E5EEFB;
  --display: "Poppins", "Segoe UI", system-ui, sans-serif; --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --r: 16px; --side: 248px; --appbar: 58px; --bottom: 66px;
  --shadow: 0 1px 2px rgba(27,42,65,.05), 0 8px 24px rgba(27,42,65,.06);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--body); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; line-height: 1.2; }
p { margin: 0; }
img, svg { display: block; max-width: 100%; }
.ico { width: 20px; height: 20px; flex: 0 0 auto; }
.star { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@view-transition { navigation: auto; }

/* ---------- shell ---------- */
.shell { min-height: 100svh; }
.sidebar { display: none; }
.appbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 8px; height: calc(var(--appbar) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 10px 0 14px; background: rgba(245,241,236,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.appbar h1 { font-size: 18px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; margin-left: -6px; }
.iconbtn { position: relative; width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px; color: var(--ink2); transition: background .2s; }
.iconbtn:hover { background: rgba(27,42,65,.06); }
.iconbtn .dot { position: absolute; right: 8px; top: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; }
.main { padding: 16px 14px calc(var(--bottom) + 28px + env(safe-area-inset-bottom)); max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h2 { font-size: 22px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; height: calc(var(--bottom) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.bottomnav a, .bottomnav button { position: relative; height: var(--bottom); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--muted); }
.bottomnav .ico { width: 23px; height: 23px; }
.bottomnav [aria-current="page"] { color: var(--accent); }
.bottomnav [aria-current="page"]::before { content: ""; position: absolute; top: 6px; width: 34px; height: 30px; border-radius: 10px; background: var(--tint); z-index: -1; }
.bottomnav .plus { align-self: center; }
.bottomnav .plus span { width: 54px; height: 54px; margin-top: -26px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(140deg, #C8702F, #B76227); color: #fff; box-shadow: 0 10px 24px rgba(183,98,39,.45); transition: transform .2s; }
.bottomnav .plus:active span { transform: scale(.92); }
.bottomnav .badge { position: absolute; top: 8px; left: 52%; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; display: grid; place-items: center; }

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100svh; overflow-y: auto; background: var(--nav); color: var(--navtext); padding: 18px 12px; scrollbar-width: thin; scrollbar-color: #26364F transparent; }
  .bottomnav { display: none; }
  .appbar { padding: 0 24px; height: 66px; }
  .appbar .back { display: none; }
  .main { padding: 24px 28px 48px; }
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.side-brand img { height: 38px; width: auto; }
.side-group { margin-top: 14px; }
.side-group > span { display: block; padding: 0 12px 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #6F7E95; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; font-size: 14.5px; color: var(--navtext); transition: background .2s, color .2s; }
.side-link .ico { width: 18px; height: 18px; }
.side-link:hover { background: var(--nav2); color: #fff; }
.side-link[aria-current="page"] { background: rgba(183,98,39,.18); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.side-link .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; display: grid; place-items: center; }
.side-foot { margin-top: auto; padding-top: 18px; display: grid; gap: 4px; }

/* ---------- sheets (create / more) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(11,19,34,.45); opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 86svh; overflow-y: auto; background: #fff; border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); transform: translateY(105%); visibility: hidden; transition: transform .32s cubic-bezier(.2,.8,.2,1), visibility 0s .32s; }
.sheet::before { content: ""; display: block; width: 42px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--line); }
.sheet h3 { font-size: 16px; margin: 4px 4px 14px; }
.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet.open { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.2,.8,.2,1); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 16px; background: var(--tint2); border: 1px solid var(--line2); font-size: 12.5px; font-weight: 500; text-align: center; }
.tile .ico { width: 24px; height: 24px; color: var(--accent); }
@media (min-width: 1024px) { .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; border-radius: 22px; transform: translate(-50%, -46%) scale(.96); opacity: 0; pointer-events: none; transition: all .22s; } .sheet.open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; } .sheet::before { display: none; } }

/* ---------- cards / kpis ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 16px; }
.card-head a { color: var(--accent); font-size: 13.5px; font-weight: 600; }
.grid { display: grid; gap: 14px; }
.g2 { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); } }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 14px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.kpi span { display: flex; align-items: center; gap: 8px; color: var(--ink2); font-size: 13px; font-weight: 500; }
.kpi span .ico { width: 16px; height: 16px; color: var(--accent); }
.kpi b { display: block; margin-top: 8px; font: 700 clamp(20px, 3vw, 26px)/1.1 var(--display); font-variant-numeric: tabular-nums; }
.kpi small { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.kpi.dark { background: linear-gradient(140deg, #142139, #0B1322); color: #fff; border-color: #0B1322; }
.kpi.dark span { color: #B7C2D1; }
.kpi.dark small { color: #8291A7; }
.up { color: var(--ok) !important; } .down { color: var(--bad) !important; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 600; font-size: 14.5px; border: 1px solid transparent; background: var(--accent); color: #fff; white-space: nowrap; transition: background .2s, transform .1s, box-shadow .2s; }
.btn:hover { background: var(--accent2); }
.btn:active { transform: scale(.98); }
.btn .ico { width: 18px; height: 18px; }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-light:hover { background: var(--tint2); }
.btn-soft { background: var(--tint); color: var(--accent2); }
.btn-soft:hover { background: #F9DCC5; }
.btn-danger { background: #fff; color: var(--bad); border-color: #F1C9C0; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-wa { background: #25A55F; } .btn-wa:hover { background: #1E8C50; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- chips / status ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; font-weight: 500; white-space: nowrap; color: var(--ink2); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { font-size: 11.5px; opacity: .7; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #EEF0F4; color: var(--ink2); }
.pill.New, .pill.Draft { background: var(--info-bg); color: var(--info); }
.pill.Contacted, .pill.Sent, .pill.Issued { background: var(--warn-bg); color: var(--warn); }
.pill.Quoted, .pill.Partiallypaid { background: #EFE7FB; color: #6A44B5; }
.pill.Won, .pill.Paid, .pill.Accepted { background: var(--ok-bg); color: var(--ok); }
.pill.Lost, .pill.Cancelled, .pill.Rejected, .pill.Spam, .pill.Overdue, .pill.Urgent, .pill.Reopened { background: var(--bad-bg); color: var(--bad); }
.pill.High { background: var(--bad-bg); color: var(--bad); } .pill.Low { background: #EEF0F4; }

/* ---------- lists (table on desktop, cards on phone) ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 220px; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search input { width: 100%; min-height: 44px; padding: 0 14px 0 40px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 16px; }
.dtable { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.dtable th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 14px; background: #FBF8F4; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dtable td { padding: 12px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable tbody tr { transition: background .15s; }
.dtable tbody tr:hover { background: #FFFBF7; }
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dtable .rowlink { font-weight: 600; }
.dtable .rowlink:hover { color: var(--accent); }
.dtable .muted { color: var(--muted); font-size: 13px; }
@media (max-width: 767px) {
  .dtable, .dtable tbody, .dtable tr, .dtable td { display: block; }
  .dtable { background: transparent; border: 0; box-shadow: none; }
  .dtable thead { display: none; }
  .dtable tr { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
  .dtable td { border: 0; padding: 2px 0; }
  .dtable td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12.5px; }
  .dtable td.num { text-align: left; }
  .dtable td.hide-m { display: none; }
  .dtable td.top-right { position: absolute; right: 14px; top: 12px; padding: 0; }
  .dtable td.big { font-size: 16px; font-weight: 700; font-family: var(--display); }
}
.empty { text-align: center; padding: 40px 16px; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--r); }
.empty .ico { width: 36px; height: 36px; margin: 0 auto 10px; color: var(--accent); }
.pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 16px; font-size: 14px; color: var(--muted); }

/* ---------- forms ---------- */
.form-card { max-width: 980px; }
.fgrid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .fgrid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fgrid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .span2 { grid-column: span 2; } .span3 { grid-column: 1 / -1; } }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 13.5px; font-weight: 600; color: var(--ink2); display: flex; justify-content: space-between; gap: 8px; }
.field .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 16px; transition: border-color .2s, box-shadow .2s; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(183,98,39,.15); }
.input.mono { font-family: Consolas, monospace; }
.field-validation-error, .text-danger { color: var(--bad); font-size: 12.5px; }
.input-validation-error { border-color: var(--bad) !important; }
.validation-summary-errors ul { margin: 0 0 14px; padding: 12px 16px 12px 30px; border-radius: 12px; background: var(--bad-bg); color: var(--bad); font-size: 14px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.switch b { display: block; font-size: 14.5px; }
.switch small { display: block; color: var(--muted); font-size: 12.5px; }
.switch input { appearance: none; width: 46px; height: 28px; flex: 0 0 46px; border-radius: 14px; background: #D9D2CA; position: relative; transition: background .2s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.savebar { position: sticky; bottom: calc(var(--bottom) + env(safe-area-inset-bottom) + 8px); z-index: 30; display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; padding: 10px; border-radius: 16px; background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(27,42,65,.12); }
@media (min-width: 1024px) { .savebar { bottom: 14px; } }
.savebar .btn { flex: 1 1 auto; max-width: 260px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }
.counter { font-size: 12px; color: var(--muted); font-weight: 400; }
.counter.over { color: var(--bad); }
.img-pick { display: grid; gap: 10px; }
.img-pick .preview { aspect-ratio: 16 / 10; border-radius: 12px; border: 1px dashed var(--line); background: #FBF8F4 center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 13px; overflow: hidden; }
.img-pick .preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- invoice editor ---------- */
.lines { display: grid; gap: 10px; }
.line { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: #FFFCF9; position: relative; }
.line .desc { grid-column: 1 / -1; }
.line .rm { position: absolute; right: 6px; top: 6px; }
.line .amt { grid-column: 1 / -1; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .line { grid-template-columns: minmax(0, 3fr) 90px 80px 120px 80px 110px 40px; align-items: end; } .line .desc { grid-column: auto; } .line .amt { grid-column: auto; padding-bottom: 12px; } .line .rm { position: static; } }
.totals { display: grid; gap: 6px; margin-left: auto; width: min(100%, 360px); font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; gap: 20px; }
.totals .grand { font: 700 20px var(--display); padding-top: 8px; border-top: 1px solid var(--line); }

/* ---------- my day ---------- */
.hello { padding: 18px; border-radius: 20px; background: linear-gradient(140deg, #142139, #0B1322); color: #fff; margin-bottom: 14px; position: relative; overflow: hidden; }
.hello::after { content: ""; position: absolute; right: -30px; top: -30px; width: 160px; height: 160px; background: #B76227; opacity: .25; clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); }
.hello h2 { font-size: 21px; }
.hello p { color: #B7C2D1; font-size: 14px; margin-top: 4px; }
.hello .row { display: flex; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.hello .row b { display: block; font: 700 20px var(--display); }
.hello .row span { font-size: 12px; color: #8291A7; }
.quickadd { display: flex; gap: 8px; margin-bottom: 12px; }
.quickadd input { flex: 1; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-size: 16px; }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line2); }
.task:last-child { border-bottom: 0; }
.task .tick { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; border: 2px solid #CFC5BA; display: grid; place-items: center; margin-top: 1px; transition: all .2s; }
.task .tick .ico { width: 14px; height: 14px; color: #fff; opacity: 0; }
.task.done .tick { background: var(--ok); border-color: var(--ok); }
.task.done .tick .ico { opacity: 1; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.task .t-body { flex: 1; min-width: 0; }
.task .t-title { font-weight: 600; display: block; }
.task .t-meta .ico { width: 13px; height: 13px; display: inline; vertical-align: -2px; }
.task .t-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--muted); font-size: 12.5px; margin-top: 2px; align-items: center; }
.task .t-meta .late { color: var(--bad); font-weight: 600; }
.feed-item { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line2); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .av { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); color: var(--accent); font: 600 15px var(--display); }
.feed-item .fi-body { flex: 1; min-width: 0; }
.feed-item b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-item small { color: var(--muted); font-size: 12.5px; }
.feed-item .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; font-size: 14px; }
.banner.warn { background: var(--warn-bg); color: #7A4F10; }
.banner.info { background: var(--info-bg); color: #1E4680; }
.banner .btn { margin-left: auto; }

/* detail view */
.dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; font-size: 14.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.timeline-note { white-space: pre-wrap; background: #FBF8F4; border-radius: 12px; padding: 12px; font-size: 14px; }

/* charts */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-row .track { height: 10px; border-radius: 6px; background: #F1EAE2; overflow: hidden; }
.bar-row .track i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #D98A52, #B76227); }
.insights { display: grid; gap: 8px; }
.insights li { list-style: none; display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.insights .star { width: 14px; height: 14px; margin-top: 4px; }
.insights ul { margin: 0; padding: 0; }

/* toasts + progress */
.toasts { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 14px 30px rgba(11,19,34,.3); animation: tin .3s cubic-bezier(.2,.8,.2,1); pointer-events: auto; }
.toast.error { background: var(--bad); }
.toast .ico { width: 18px; height: 18px; color: #9ED3A3; }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } }
.loadbar { position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 101; background: var(--accent); transform-origin: left; transform: scaleX(0); opacity: 0; }
.loading .loadbar { opacity: 1; transform: scaleX(.75); transition: transform 2s cubic-bezier(.1,.6,.2,1); }
.loaded .loadbar { opacity: 0; transform: scaleX(1); transition: transform .2s, opacity .3s .2s; }
.htmx-request .main { opacity: .7; transition: opacity .2s .15s; }

/* login */
.login { min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at 70% 20%, #1B2C4C, #0B1322 55%, #070B14); }
.login-card { width: min(100%, 400px); background: #fff; border-radius: 24px; padding: 28px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-card img { height: 54px; width: auto; margin: 0 auto 18px; }
.login-card h1 { font-size: 22px; text-align: center; }
.login-card p.sub { text-align: center; color: var(--muted); font-size: 14px; margin: 4px 0 20px; }
.alert { padding: 12px 14px; border-radius: 12px; background: var(--bad-bg); color: var(--bad); font-size: 14px; margin-bottom: 14px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }

/* print (invoice + reports) */
@media print {
  .sidebar, .appbar, .bottomnav, .no-print, .savebar, .toasts { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-page { break-after: page; }
}
.g2 > .card + .card, .grid > .card + .card { margin-top: 0; }
.validation-summary-valid { display: none; }

/* ---------- v2: searchable select, invoice form ---------- */
.combo { position: relative; }
.combo-native { position: absolute; inset: auto 0 0 0; opacity: 0; pointer-events: none; height: 1px; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow: auto; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 34px rgba(27,42,65,.16); }
.combo-list li { padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.combo-list li:hover, .combo-list li.act { background: #FBEBDD; }
.combo-list li.sel { font-weight: 600; color: var(--accent); }
.combo-list .combo-empty { color: var(--muted); cursor: default; }
.inv-head-grid { align-items: end; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
@media (min-width: 768px) { .fgrid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.dtable th.sortable { padding: 0; }
.dtable th.sortable a, .dtable th.sortable button { display: flex; align-items: center; gap: 6px; width: 100%; padding: inherit; padding: 12px 14px; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; background: none; border: 0; cursor: pointer; text-decoration: none; }
.dtable th.sortable.num a, .dtable th.sortable.num button { justify-content: flex-end; }
.dtable th.sortable span { opacity: .45; font-size: 11px; }
.dtable th.sortable.on { color: var(--accent); } .dtable th.sortable.on span { opacity: 1; }
.pager button[disabled] { opacity: .45; pointer-events: none; }
.month-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(56px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.month-bars .mb { display: grid; justify-items: center; gap: 6px; padding: 8px 4px; border-radius: 10px; color: inherit; text-decoration: none; }
.month-bars .mb:hover { background: var(--tint); }
.mb-bar { position: relative; width: 26px; height: 90px; border-radius: 8px; background: #F3ECE4; overflow: hidden; }
.mb-bar i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 8px; min-height: 2px; }
.mb-amt { font-size: 12px; font-weight: 700; } .mb-lbl { font-size: 12px; color: var(--muted); }
.mini-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.mini-field .input { min-height: 44px; width: auto; }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; } .row-actions form { margin: 0; }
.dayprog { height: 6px; border-radius: 6px; background: rgba(255,255,255,.18); margin-top: 16px; overflow: hidden; }
.dayprog i { display: block; height: 100%; background: #FFB547; border-radius: 6px; transition: width .4s; }
.hello .row b small { font-size: .55em; opacity: .7; font-weight: 600; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; margin-left: 6px; border-radius: 999px; background: var(--tint); color: var(--accent); font-size: 12px; font-weight: 700; vertical-align: 2px; }
.count-pill.ok { background: #E3F4EA; color: var(--ok); }
.card-warn { border-left: 3px solid var(--bad); }
.wrapup { margin-top: 12px; text-align: right; }
.done-card > summary { list-style: none; cursor: pointer; margin-bottom: 0; } .done-card > summary::-webkit-details-marker { display: none; }
.done-card[open] > summary { margin-bottom: 10px; } .done-card[open] > summary .hint { visibility: hidden; }
.task .shift { margin-left: auto; opacity: .55; } .task:hover .shift { opacity: 1; }
.day-bars { grid-auto-columns: minmax(22px, 1fr); gap: 4px; } .day-bars .mb-bar { width: 14px; height: 70px; } .day-bars .mb { padding: 4px 0; }
.report-tiles { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.report-tiles .tile { flex-direction: row; justify-content: flex-start; text-align: left; gap: 14px; padding: 18px; }
.report-tiles .tile span { display: grid; gap: 3px; } .report-tiles .tile small { color: var(--muted); font-weight: 400; font-size: 13px; }
.hbar { display: grid; grid-template-columns: 140px 1fr auto; gap: 12px; align-items: center; padding: 7px 6px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 14px; }
.hbar:hover, .hbar.on { background: var(--tint); }
.hbar i { height: 10px; border-radius: 6px; background: #F3ECE4; overflow: hidden; } .hbar i b { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.hbar em { font-style: normal; font-weight: 700; }
.chip small { opacity: .65; margin-left: 3px; }
/* radio cards (hero style) */
.pick-card { position: relative; display: grid; gap: 6px; align-content: start; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.pick-card input { position: absolute; opacity: 0; pointer-events: none; }
.pick-card:hover { border-color: #E3C3A8; }
.pick-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(183,98,39,.14); background: #FFFBF7; }
.pick-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pick-head b { font-size: 14.5px; }
.pick-dot { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid #CFC5BA; display: grid; place-items: center; }
.pick-card:has(input:checked) .pick-dot { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 5px, transparent 6px); }
.pick-card small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.pick-on { display: none; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--accent); }
.pick-on .ico { width: 14px; height: 14px; }
.pick-card:has(input:checked) .pick-on { display: inline-flex; }
.inline-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); } .inline-link .ico { width: 16px; height: 16px; }
.field > label.check { justify-content: flex-start; font-weight: 400; }

/* ---------- WhatsApp: tabs, templates, preview ---------- */
.wa-tabs { margin-bottom: 14px; }
.wa-tabs .chip { display: inline-flex; align-items: center; gap: 6px; } .wa-tabs .ico { width: 15px; height: 15px; }
.wa-snip { margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.wa-name { overflow-wrap: anywhere; }
.wa-table { table-layout: auto; }
.wa-table .wa-col-name { width: 55%; min-width: 0; }
.wa-meta { display: none; gap: 10px; align-items: center; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.wa-meta span + span::before { content: "·"; margin-right: 10px; }
.nowrap { white-space: nowrap; }
.dtable td { overflow-wrap: anywhere; }
/* medium screens: fold category / language / quality / date under the name instead of widening the page */
@media (min-width: 768px) and (max-width: 1199px) { .dtable .hide-md { display: none; } .wa-meta.show-md { display: flex; } }
@media (max-width: 767px) { .wa-table .wa-col-name { width: auto; } }
.wa-reason { display: flex; gap: 6px; align-items: center; margin-top: 4px; color: var(--bad); font-size: 13px; } .wa-reason .ico { width: 14px; height: 14px; flex: none; }
.wa-recent { padding-block: 6px; }
.qdot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.qdot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #CFC5BA; }
.qdot.q-green::before { background: #1F9D55; } .qdot.q-yellow::before { background: #E0A100; } .qdot.q-red::before { background: var(--bad); }
.pill.Sent { background: #EEF2F7; color: #44536A; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 12px 0 0; font-size: 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.wa-body-src { line-height: 1.6; white-space: normal; } .wa-body-src mark, .wa-tpl mark { background: #FBEBDD; color: var(--accent); border-radius: 4px; padding: 0 3px; }

.wa-tpl-grid { display: grid; gap: 16px; }
@media (min-width: 1100px) { .wa-tpl-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .wa-preview-col { position: sticky; top: calc(var(--appbar) + 16px); } }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.seg-sm { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt > span { display: grid; gap: 2px; height: 100%; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; transition: border-color .2s, background .2s; }
.seg-sm .seg-opt > span { text-align: center; padding: 9px 6px; }
.seg-opt b { font-size: 14px; } .seg-opt small { color: var(--muted); font-size: 12px; }
.seg-opt:has(input:checked) > span { border-color: var(--accent); background: #FFF6EE; }
.seg-opt:has(input:focus-visible) > span { outline: 2px solid var(--accent); outline-offset: 2px; }
.wa-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.wa-sample { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 8px; }
.wa-sample .mono { color: var(--accent); font-weight: 600; font-size: 13px; }
.wa-btn-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: #FBF8F4; }
.wa-btn-row .pill { grid-column: 1; grid-row: 1; } .wa-btn-row .wa-bt { grid-column: 2; grid-row: 1; } .wa-btn-row [data-remove-btn] { grid-column: 3; grid-row: 1; }
.wa-btn-row .wa-bx { grid-column: 1 / -1; }
.card-head h3 .hint { font-size: 12.5px; font-weight: 400; color: var(--muted); margin-left: 4px; }
[data-problems] { display: block; } [data-problems] div + div { margin-top: 4px; }
[data-count].over { color: var(--bad); }

.wa-phone { max-width: 340px; margin: 0 auto; border-radius: 28px; overflow: hidden; border: 8px solid #1B2A41; background: #EFE7DD; box-shadow: 0 20px 40px rgba(27,42,65,.18); }
.wa-phone-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #075E54; color: #fff; }
.wa-phone-top b { display: block; font-size: 14px; } .wa-phone-top small { font-size: 11.5px; opacity: .8; }
.wa-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #25D366; } .wa-av .ico { width: 18px; height: 18px; color: #fff; }
.wa-chat { min-height: 320px; padding: 16px 12px 20px; background: #EFE7DD radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px) 0 0 / 14px 14px; }
.wa-bubble { position: relative; max-width: 92%; padding: 8px 10px 20px; border-radius: 0 10px 10px 10px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.08); font-size: 14px; line-height: 1.45; color: #111B21; word-wrap: break-word; }
.wa-bubble .wa-h { font-weight: 700; margin-bottom: 4px; }
.wa-media { display: flex; align-items: center; gap: 8px; margin: -2px -4px 8px; padding: 12px; border-radius: 8px; background: #F0F2F5; color: #54656F; font-size: 13px; }
.wa-media.img { height: 120px; justify-content: center; background: linear-gradient(135deg, #DDE5EC, #C9D3DD); }
.wa-media .ico { width: 22px; height: 22px; }
.wa-f { margin-top: 6px; color: #667781; font-size: 12.5px; }
.wa-time { position: absolute; right: 8px; bottom: 4px; font-size: 11px; color: #667781; }
.wa-bubble code { background: #F0F2F5; padding: 0 3px; border-radius: 3px; }
.wa-pv-btns { display: grid; gap: 4px; max-width: 92%; margin-top: 4px; }
.wa-pv-btn { display: block; padding: 9px; border-radius: 10px; background: #fff; color: #027EB5; text-align: center; font-size: 14px; font-weight: 500; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.wa-map-warn { display: block; margin-top: 6px; color: var(--bad); font-size: 13px; }
.wa-account { display: grid; gap: 14px; margin-bottom: 14px; }
@media (min-width: 900px) { .wa-account { grid-template-columns: 1fr 1fr; } }
.wa-account .card { margin: 0; }
.wa-account .card-head h3 { display: flex; align-items: center; gap: 8px; } .wa-account .card-head .ico { width: 18px; height: 18px; color: var(--accent); flex: none; }
.wa-tpl-pill { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; } .wa-tpl-pill .ico { width: 13px; height: 13px; }

/* ---------- WhatsApp messages page ---------- */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #CFC5BA; margin-right: 7px; vertical-align: 1px; }
.status-dot.on { background: #25A55F; box-shadow: 0 0 0 3px rgba(37,165,95,.18); }
.wa-kpis { margin: 4px 0 18px; }
@media (min-width: 900px) { .wa-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.wa-kpis .kpi { color: inherit; text-decoration: none; transition: border-color .2s, transform .2s; }
.wa-kpis a.kpi:hover { border-color: #E3C3A8; transform: translateY(-2px); }
.wa-kpis .kpi .ico { width: 16px; height: 16px; color: var(--accent); }
.wa-kpis .kpi-bad b { color: var(--bad); } .wa-kpis .kpi-bad .ico { color: var(--bad); }
.wa-log { padding: 16px; }
.wa-log-tools { margin: 0 0 12px; }
.wa-log-tools .search { width: 100%; }
.wa-filter { margin-bottom: 14px; flex-wrap: wrap; }
.wa-log .dtable { box-shadow: none; }
.wa-log .empty { box-shadow: none; border: 0; }
.wa-msg-body { max-width: 520px; }
.wa-text { white-space: pre-line; overflow-wrap: anywhere; }
.wa-contact b { white-space: nowrap; }
.wa-dir { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; margin-right: 2px; }
.wa-dir.in { background: #E3F4EA; color: #1F7A45; } .wa-dir.out { background: #EEF2F7; color: #44536A; }
.wa-links { display: flex; gap: 10px; margin-top: 2px; } .wa-links a { color: var(--accent); font-size: 12.5px; font-weight: 600; } .wa-links:empty { display: none; }
.pill.Delivered { background: #E6F1FB; color: #1D5F99; }
@media (max-width: 767px) { .wa-log { padding: 12px; background: transparent; border: 0; box-shadow: none; } .wa-log .dtable tr { box-shadow: none; } .hide-xs { display: none; } }

/* ---------- modal dialog ---------- */
dialog.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100svh - 32px); padding: 0; border: 0; border-radius: 20px; background: #fff; color: var(--ink); box-shadow: 0 30px 80px rgba(27,42,65,.35); }
dialog.modal::backdrop { background: rgba(14,22,38,.45); }
dialog.modal[open] { animation: modalIn .22s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-box { display: flex; flex-direction: column; max-height: inherit; }
.modal-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 18px 18px 14px; border-bottom: 1px solid var(--line2); }
.modal-head h3 { margin: 2px 0 4px; font-size: 17px; } .modal-head small { color: var(--muted); font-size: 13px; line-height: 1.45; display: block; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line2); background: #FBF8F4; }
@media (max-width: 600px) {
  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92svh; }
  dialog.modal[open] { animation: sheetIn .25s ease-out; }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
  .modal-foot .btn { flex: 1; }
}

/* payment form in the invoice sidebar: fields stack when the column is narrow */
.pay-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; }
.pay-grid .input, .pay-grid .select { min-width: 0; width: 100%; }
.pay-grid input[type=date] { min-width: 0; max-width: 100%; }

/* ---------- chatbot + chat ---------- */
.bot-steps tr.off { opacity: .55; }
.bot-opts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.bot-opt { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink2); background: #FBF8F4; }
.pill.bot-buttons, .pill.bot-list { background: var(--info-bg); color: var(--info); }
.pill.bot-question { background: #EFE7FB; color: #6A44B5; }
.pill.bot-handover { background: var(--warn-bg); color: var(--warn); }
.pill.bot-action { background: var(--ok-bg); color: var(--ok); }
.bot-types { flex-wrap: wrap; }
.bot-opt-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.bot-opt-row { display: grid; gap: 8px; grid-template-columns: 1fr auto; align-items: center; padding: 10px; border: 1px solid var(--line2); border-radius: 12px; background: #FDFBF8; }
.bot-opt-row > * { min-width: 0; }
.bot-opt-row .iconbtn { grid-column: 2; grid-row: 1; }
.bot-opt-row .bo-desc, .bot-opt-row .bo-next, .bot-opt-row .bo-value { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .bot-opt-row { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, 1fr) auto; }
  .bot-opt-row .bo-desc, .bot-opt-row .bo-next, .bot-opt-row .bo-value { grid-column: auto; }
  .bot-opt-row .iconbtn { grid-column: auto; grid-row: auto; }
}
[hidden] { display: none !important; }
.chat-grid { display: grid; gap: 14px; }
@media (min-width: 1000px) { .chat-grid { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } }
.chat-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat-thread { display: flex; flex-direction: column; gap: 6px; padding: 16px; max-height: min(65vh, 680px); min-height: 240px; overflow-y: auto; background: #F4EFE8; }
.chat-day { align-self: center; margin: 8px 0; padding: 2px 10px; font-size: 12px; color: var(--muted); background: #fff; border-radius: 999px; }
.bubble { max-width: min(80%, 520px); padding: 8px 12px; border-radius: 14px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.06); overflow-wrap: anywhere; }
.bubble.in { align-self: flex-start; border-top-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: #DCF8C6; border-top-right-radius: 4px; }
.bubble.failed { background: #FDECEC; }
.bubble-text { white-space: pre-wrap; font-size: 14px; line-height: 1.45; }
.bubble-meta { margin-top: 3px; font-size: 11.5px; color: var(--muted); text-align: right; }
.bubble-meta a { color: var(--accent); }
.chat-doc { display: flex; gap: 6px; align-items: center; font-weight: 600; font-size: 13px; margin-bottom: 4px; } .chat-doc .ico { width: 16px; height: 16px; }
.chat-reply { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #fff; }
.chat-reply .textarea { flex: 1; min-width: 0; resize: vertical; }
.chat-reply .btn { align-self: flex-end; }
.chat-window { margin: 0; padding: 8px 14px 12px; }
.banner.chat-window { margin: 12px; }
.chat-side { display: grid; gap: 14px; }
.chat-side .card { margin: 0; }
.chat-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chat-ticket { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line2); }
.chat-ticket small { flex-basis: 100%; color: var(--muted); }
.wa-links { display: flex; gap: 10px; flex-wrap: wrap; }
/* ---------- client: contacts + projects ---------- */
.cl-person { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line2); }
.cl-person-main { min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cl-person-main small { flex-basis: 100%; color: var(--muted); overflow-wrap: anywhere; }
.cl-person-act { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.cl-add { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-top: 12px; }
.cl-add > * { min-width: 0; }
@media (min-width: 1100px) { .cl-add { grid-template-columns: 1fr 1fr 1fr auto; } }
.cl-project { border: 1px solid var(--line2); border-radius: 12px; margin-bottom: 8px; background: #FDFBF8; }
.cl-project summary { cursor: pointer; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; list-style: none; }
.cl-project summary::-webkit-details-marker { display: none; }
.cl-project summary small { flex-basis: 100%; color: var(--muted); }
.cl-project summary .ico { width: 16px; height: 16px; color: var(--accent); }
.cl-project-form { padding: 0 12px 12px; }
.cl-project-del { padding: 0 12px 12px; margin-top: -4px; }
.cl-sub { margin: 14px 0 4px; font-size: 14px; }
.pill.Open, .pill.Today { background: var(--info-bg); color: var(--info); }
.pill.Inprogress { background: var(--warn-bg); color: var(--warn); }
.pill.Resolved { background: var(--ok-bg); color: var(--ok); }
/* ---------- support tickets ---------- */
dialog.modal.drawer { margin: 0 0 0 auto; height: 100svh; max-height: 100svh; width: min(640px, 100vw); border-radius: 20px 0 0 20px; }
dialog.modal.drawer[open] { animation: drawerIn .22s ease-out; }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .modal-box { height: 100%; }
.drawer-head { display: flex; justify-content: flex-end; padding: 10px 12px 0; }
.drawer .modal-body { flex: 1; padding-top: 0; }
.tkt-tools { display: grid; gap: 8px; grid-template-columns: 1fr; }
.tkt-tools > * { min-width: 0; }
@media (min-width: 768px) { .tkt-tools { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); } }
tr.tkt-urgent td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.tkt-head h3 { margin: 6px 0 4px; font-size: 18px; }
.tkt-num { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tkt-desc { white-space: pre-wrap; padding: 12px 14px; margin: 12px 0; background: #FBF8F4; border-radius: 12px; border: 1px solid var(--line2); overflow-wrap: anywhere; }
.tkt-files { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tkt-file { display: grid; place-items: center; gap: 4px; width: 104px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: center; }
.tkt-file img { width: 92px; height: 70px; object-fit: cover; border-radius: 6px; }
.tkt-file .ico { width: 28px; height: 28px; color: var(--accent); margin: 18px 0; }
.tkt-file small { font-size: 11.5px; color: var(--muted); max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tkt-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.tkt-status { display: flex; gap: 6px; } .tkt-status .select { width: auto; }
.tkt-sec { margin-top: 18px; }
.tkt-sec h4 { margin: 0 0 8px; font-size: 14px; }
.tkt-thread { max-height: 360px; min-height: 120px; border-radius: 12px; }
.tkt-reply { padding: 10px 0 0; border: 0; background: none; }
.tkt-tpl { margin-top: 10px; }
.tkt-note { display: flex; gap: 8px; margin-bottom: 10px; } .tkt-note .input { flex: 1; min-width: 0; }
.tkt-n { padding: 8px 0; border-top: 1px solid var(--line2); } .tkt-n p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; } .tkt-n small { color: var(--muted); }
.nav-badge-bad { background: var(--bad) !important; color: #fff !important; }
.tkt-alert { display: flex; gap: 10px; align-items: center; }
/* ---------- broadcasts ---------- */
.pill.bc-Draft { background: #EEF0F4; } .pill.bc-Scheduled, .pill.bc-Sending { background: var(--info-bg); color: var(--info); }
.pill.bc-Paused { background: var(--warn-bg); color: var(--warn); } .pill.bc-Completed { background: var(--ok-bg); color: var(--ok); }
.pill.bc-Stopped, .pill.bc-Cancelled { background: var(--bad-bg); color: var(--bad); }
.bc-sources { flex-wrap: wrap; }
.bc-sub { margin-top: 14px; }
.bc-clients { display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-height: 260px; overflow: auto; margin-top: 10px; padding: 8px; border: 1px solid var(--line2); border-radius: 12px; }
.bc-client { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 8px; min-width: 0; } .bc-client span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-client:hover { background: #FBF8F4; }
.bc-tpl-body { white-space: pre-wrap; padding: 12px 14px; margin: 10px 0; border-radius: 12px; background: #F4EFE8; font-size: 14px; overflow-wrap: anywhere; }
.bc-map { display: grid; gap: 8px; grid-template-columns: 44px minmax(0, 1fr); align-items: center; margin-top: 8px; }
.bc-map .input { grid-column: 2; }
@media (min-width: 900px) { .bc-map { grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr); } .bc-map .input { grid-column: auto; } }
.bc-previews { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); padding: 12px; border-radius: 12px; background: #F4EFE8; }
.bc-prev { display: flex; flex-direction: column; gap: 4px; min-width: 0; } .bc-prev small { color: var(--muted); } .bc-prev .bubble { max-width: 100%; align-self: stretch; }
.bc-big { font: 700 28px/1.1 var(--display); margin: 0 0 6px; }
.bc-send { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; align-items: stretch; }
.bc-send > * { min-width: 0; } .bc-send .input, .bc-send .btn { grid-column: 1 / -1; }
@media (min-width: 900px) { .bc-send { grid-template-columns: auto auto minmax(0, 1fr) auto; } .bc-send .input, .bc-send .btn { grid-column: auto; } }
.bc-progress .bc-bar { height: 10px; border-radius: 999px; background: #EEE7DE; overflow: hidden; margin-bottom: 8px; }
.bc-progress .bc-bar span { display: block; height: 100%; background: linear-gradient(90deg, #25A55F, #1F8F51); transition: width .4s; }
.bc-kpis { margin: 12px 0; }
@media (min-width: 900px) { .bc-kpis, .wa-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.wab-row { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line2); }
