/* Asistente de Ventas — admin. Warm paper, ink text, one green accent, line icons. */
:root {
  --bg: #f6f4ef; --surface: #ffffff; --surface-2: #f1eee7; --border: #e6e1d7; --border-2: #d9d3c7;
  --text: #1c1b19; --muted: #706b62; --faint: #9a958b;
  --brand: #0f5640; --brand-ink: #ffffff; --brand-soft: #e2eee7; --brand-2: #2f7d5b;
  --warn: #8f5304; --warn-soft: #fbefd9; --err: #b3261e; --err-soft: #fbe8e5; --ok: #1d7443; --ok-soft: #e2f1e7;
  --bot: #ecf0f5; --staff: #dcf2e2; --cust: #ffffff;
  --series-1: #2f7d5b; --grid: #ece7de;
  --radius: 14px; --shadow-pop: 0 2px 4px rgb(28 27 25 / .06), 0 16px 40px rgb(28 27 25 / .16);
  --font: "Archivo", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131311; --surface: #1c1b18; --surface-2: #24221e; --border: #2e2c27; --border-2: #3b3832;
    --text: #efece5; --muted: #a7a197; --faint: #7d786f;
    --brand: #6cc7a0; --brand-ink: #06231a; --brand-soft: #17302a; --brand-2: #6cc7a0;
    --warn: #f0b25a; --warn-soft: #372a14; --err: #ff8a7a; --err-soft: #3a1d1a; --ok: #6fd39b; --ok-soft: #173022;
    --bot: #222833; --staff: #1c3526; --cust: #24221e; --series-1: #6cc7a0; --grid: #2a2824; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
.ic { flex: none; display: block; }
h1 { font-size: 28px; margin: 0; font-weight: 800; font-stretch: 80%; letter-spacing: -.005em; line-height: 1.1; }
h2 { font-size: 18px; margin: 0; font-weight: 700; }
h3 { font-size: 15px; margin: 0 0 10px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--border-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgb(28 27 25 / .08); }
input[type="search"] { padding-left: 36px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239a958b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px 50%; }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
label.check input { width: auto; accent-color: var(--brand); }
.muted { color: var(--muted); } .sm { font-size: 13px; } .error { color: var(--err); }
.warn-text { color: var(--warn); } .ok-text { color: var(--ok); display: flex; align-items: center; gap: 6px; }
.row { display: flex; gap: 8px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; margin-top: 10px; }
.row.center { align-items: center; } .stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap; font-weight: 550;
  transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--border-2); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 650; }
.btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.block { width: 100%; } .btn.danger { color: var(--err); } .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.flagged { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); background: var(--err-soft); }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 6px; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.linklike { border: 0; background: none; color: var(--brand); cursor: pointer; padding: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 550;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.stock-in_stock, .badge.os-delivered { background: var(--ok-soft); color: var(--ok); }
.badge.stock-low, .badge.st-pending_human, .badge.warn, .badge.order, .badge.os-pending { background: var(--warn-soft); color: var(--warn); }
.badge.stock-out, .badge.err { background: var(--err-soft); color: var(--err); }
.badge.st-human, .badge.os-confirmed { background: var(--brand-soft); color: var(--brand); }
.badge.feat { color: var(--warn); background: var(--warn-soft); padding: 0 6px; }
.badge.src { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.loading { padding: 48px; text-align: center; color: var(--faint); }
code.url { background: var(--surface-2); padding: 7px 10px; border-radius: 8px; font-size: 13px; word-break: break-all; }

/* login */
.login-page #app { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(380px, 100%); display: grid; gap: 14px; background: var(--surface); padding: 32px 28px; border-radius: 20px; border: 1px solid var(--border); }
.login label { text-align: left; } .login h1 { font-size: 30px; } .login p { margin: -8px 0 6px; }
.login .logo { width: 48px; height: 48px; border-radius: 13px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.login .btn { height: 44px; margin-top: 4px; }

/* shell */
header.top { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  height: 58px; padding: 0 16px 0 18px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; font-size: 15px; }
.logo-sm { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 13px; font-weight: 800; font-stretch: 78%; letter-spacing: .03em; flex: none; }
.store-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-pick { width: auto; height: 34px; padding: 0 10px; font-weight: 650; }
.top-right { display: flex; align-items: center; gap: 4px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); padding: 0 6px 0 8px; font-weight: 550; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; background: var(--brand-soft); color: var(--brand); }
#notif-btn.on { color: var(--brand); }
.layout { display: grid; grid-template-columns: 216px 1fr; min-height: calc(100vh - 58px); }
nav.side { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 58px; align-self: start; height: calc(100vh - 58px); }
.nav-item { display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--muted); text-decoration: none; position: relative; font-weight: 550; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgb(28 27 25 / .05); }
.nav-item.active .nav-icon { color: var(--brand); }
.nav-icon { display: grid; place-items: center; }
.nav-badge { display: none; margin-left: auto; background: var(--err); color: #fff; border-radius: 999px; font-size: 11px; min-width: 20px; height: 20px; padding: 0 6px; font-weight: 700; place-items: center; }
.nav-badge.show { display: grid; }
main { padding: 26px 32px 90px; min-width: 0; max-width: 1360px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 .muted { font-size: 16px; font-weight: 500; font-stretch: 100%; margin-left: 6px; }
.tabs { display: inline-flex; gap: 2px; overflow-x: auto; padding: 3px; margin-bottom: 14px; scrollbar-width: none; background: var(--surface-2); border-radius: 11px; max-width: 100%; }
.tabs.inline { margin: 0; }
.tab { border: 0; background: transparent; padding: 0 13px; height: 30px; border-radius: 8px; cursor: pointer; white-space: nowrap; font-size: 13px; color: var(--muted); font-weight: 550; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(28 27 25 / .1), 0 0 0 1px var(--border); }
.filters { display: flex; gap: 8px; margin-bottom: 16px; } .filters select { max-width: 220px; }
.section { margin: 22px 0 10px; color: var(--muted); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; }

/* inbox */
main[data-view="inbox"] { padding: 0; max-width: none; }
.inbox { display: grid; grid-template-columns: 360px 1fr; height: calc(100vh - 58px); border-left: 1px solid var(--border); }
.conv-col { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.conv-col .tabs { margin: 12px 12px 6px; display: flex; }
.conv-col .tab { flex: 1 0 auto; }
.conv-list { overflow-y: auto; flex: 1; padding: 4px 6px; }
.conv-row { display: flex; gap: 11px; padding: 11px 10px; border-radius: 11px; color: var(--text); text-decoration: none; position: relative; }
.conv-row:hover { background: var(--surface-2); } .conv-row.active { background: var(--brand-soft); }
.conv-row.urgent::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 2px; background: var(--warn); }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-top strong { font-weight: 650; }
.preview { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.conv-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.unread { margin-left: auto; background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: 11px; min-width: 20px; height: 20px; padding: 0 6px; font-weight: 700; display: grid; place-items: center; }
.conv-pane { min-width: 0; min-height: 0; display: flex; background: var(--bg); }
.conv-pane > .empty { margin: auto; }
.conv-open { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.thread-head .back { display: none; color: var(--text); }
.who-block { flex: 1; min-width: 160px; } .who-block strong { font-size: 15.5px; }
.head-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.thread-wrap { flex: 1; display: flex; min-height: 0; }
.thread-wrap .thread { flex: 1; min-width: 0; }
.thread { overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.msg { display: flex; } .msg.out { justify-content: flex-end; }
.bubble { max-width: min(74%, 540px); padding: 8px 12px 6px; border-radius: 14px; background: var(--cust); box-shadow: 0 0 0 1px var(--border); }
.msg.system .bubble { background: var(--bot); box-shadow: none; } .msg.staff .bubble { background: var(--staff); box-shadow: none; }
.msg.in .bubble { border-top-left-radius: 4px; } .msg.out .bubble { border-top-right-radius: 4px; }
.bubble .text { white-space: normal; word-wrap: break-word; line-height: 1.45; }
.bubble .meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 11px; color: var(--faint); margin-top: 3px; }
.media-note { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.msg-img { max-width: 100%; max-height: 260px; border-radius: 10px; display: block; margin: 2px 0 6px; }
.send-fail { color: var(--err); display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; }
.thread-side { flex: 0 0 280px; border-left: 1px solid var(--border); padding: 16px; overflow-y: auto; background: var(--surface); }
.thread-side.empty { display: none; }
.thread-side h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.prev-link { display: block; font-size: 13px; padding: 3px 0; }
.composer { border-top: 1px solid var(--border); padding: 10px 16px 14px; background: var(--surface); }
.quick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; height: 30px; padding: 0 12px; font-size: 12.5px; cursor: pointer; white-space: nowrap; color: var(--text); }
.chip:hover { background: var(--surface-2); }
.chip.alt { border-color: transparent; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.compose-row { display: flex; gap: 8px; align-items: flex-end; } .compose-row textarea { resize: none; border-radius: 12px; }
.compose-row .btn { height: 44px; }
.window-note { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 8px; }

/* orders */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.order-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 7px; margin-bottom: 0; align-content: start; }
.order-card.st-pending { box-shadow: inset 3px 0 0 var(--warn); }
.order-top { display: flex; gap: 8px; align-items: center; } .order-top strong { font-size: 15px; } .order-top .muted { margin-left: auto; }
.order-sum { font-size: 14px; }
.order-total { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin: 2px 0 4px; }
.ometa { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.ometa .ic { color: var(--faint); }
.ometa .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); margin: 0 2px; }
.order-card .row { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }

/* products */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.prod-card { text-align: left; padding: 0; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; color: var(--text); }
.prod-card .prod-img { border-radius: 12px; transition: transform .2s; }
.prod-card:hover .prod-img { transform: translateY(-2px); box-shadow: 0 8px 20px rgb(28 27 25 / .1); }
.prod-card.inactive { opacity: .5; }
.prod-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); display: block; }
.prod-img.noimg { display: grid; place-items: center; align-content: center; gap: 6px; color: var(--faint); border: 1.5px dashed var(--border-2); background: transparent; }
.prod-img.noimg small { font-size: 12px; }
.prod-info { padding: 10px 2px 0; display: grid; gap: 3px; }
.prod-name { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod-price { font-weight: 700; font-variant-numeric: tabular-nums; } .prod-price s { margin-left: 6px; font-weight: 400; color: var(--faint); }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.ph, .ph-add { position: relative; flex: 0 0 100px; height: 100px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.ph img { width: 100%; height: 100%; object-fit: cover; } .ph.primary { box-shadow: 0 0 0 2px var(--brand); border-color: transparent; }
.ph-tag { position: absolute; left: 5px; bottom: 5px; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; }
.ph-btn, .ph-del { position: absolute; top: 5px; border: 0; border-radius: 7px; background: rgb(0 0 0 / .55); color: #fff; cursor: pointer; width: 26px; height: 26px; display: grid; place-items: center; }
.ph-btn { left: 5px; } .ph-del { right: 5px; }
.ph-add { display: grid; place-items: center; align-content: center; gap: 4px; background: transparent; cursor: pointer; border: 1.5px dashed var(--border-2); color: var(--muted); }
.ph-add:hover { border-color: var(--text); color: var(--text); }
.ph-add small { font-size: 12px; }
.qa-photo { height: 220px; border: 1.5px dashed var(--border-2); border-radius: 14px; display: grid; place-items: center; align-content: center; gap: 8px; cursor: pointer; color: var(--muted); overflow: hidden; }
.qa-photo:hover { border-color: var(--text); color: var(--text); }
.qa-photo small { font-size: 13px; } .qa-photo img { width: 100%; height: 100%; object-fit: contain; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; height: 34px; padding: 0 14px; cursor: pointer; border-radius: 8px; color: var(--muted); font-weight: 550; }
.seg.sm .seg-btn { height: 30px; padding: 0 10px; font-size: 13px; }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(28 27 25 / .1), 0 0 0 1px var(--border); }
.seg-btn.on.stock-in_stock { color: var(--ok); } .seg-btn.on.stock-low { color: var(--warn); } .seg-btn.on.stock-out { color: var(--err); }
.qty-in { width: 90px; }
.stock-box { display: grid; gap: 10px; }

/* stock check */
.stock-list { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stock-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; }
.stock-row + .stock-row { border-top: 1px solid var(--border); }
.stock-row img, .stock-row .noimg { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); }
.sr-ctrl { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; background: var(--surface-2); border-radius: 11px; padding: 3px; }
.stepper button { width: 40px; height: 40px; border: 0; background: transparent; font-size: 20px; cursor: pointer; border-radius: 9px; color: var(--text); }
.stepper button:hover { background: var(--surface); }
.qty-big { width: 56px; border: 0; background: transparent; text-align: center; font-size: 17px; font-weight: 700; height: 40px; padding: 0; font-variant-numeric: tabular-nums; }
.qty-big:focus { box-shadow: none; background: var(--surface); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table-wrap .tbl th:first-child, .table-wrap .tbl td:first-child { padding-left: 16px; }
.table-wrap .tbl th:last-child, .table-wrap .tbl td:last-child { padding-right: 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--faint); font-size: 12px; padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-prod { display: flex; gap: 10px; align-items: center; line-height: 1.3; } .cell-prod img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; }

/* dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tile { background: var(--surface); padding: 16px 18px 18px; box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border); }
.tile.alert { background: var(--warn-soft); }
.tile.alert .tile-value { color: var(--warn); }
.tile-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile-value { font-size: 30px; font-weight: 750; font-stretch: 85%; font-variant-numeric: tabular-nums; margin: 4px 0 2px; letter-spacing: -.01em; line-height: 1.1; }
.tile-sub { font-size: 12px; color: var(--faint); }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.chart-card { margin-bottom: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chart { position: relative; margin-top: 6px; } .chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar { fill: var(--series-1); } .chart .axis { stroke: var(--border-2); stroke-width: 1; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .tick { fill: var(--faint); font-size: 11px; font-family: var(--font); } .chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: rgb(127 127 127 / .07); }
.chart-tip { position: absolute; top: -6px; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 7px; pointer-events: none; opacity: 0; white-space: nowrap; transition: opacity .12s; }
.chart-tip.show { opacity: 1; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.two-col .card { margin-bottom: 0; }
.two-col + .card, .charts + .two-col { margin-top: 16px; }
.reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.reason { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 10px; height: 36px; padding: 0 12px; font-size: 13.5px; }
.reason strong { font-variant-numeric: tabular-nums; }
.card.missed { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); margin-top: 16px; }
.card.missed h3 { color: var(--warn); }

/* settings */
.settings { max-width: 780px; }
.hour-row { display: grid; grid-template-columns: 110px 1fr auto 1fr; gap: 8px; align-items: center; }
.cover-prev { height: 160px; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; margin: 6px 0; }
.cover-prev img { width: 100%; height: 100%; object-fit: cover; }
.sticky-save { position: sticky; bottom: 20px; display: flex; justify-content: flex-end; }
.sticky-save .btn { box-shadow: var(--shadow-pop); height: 44px; padding: 0 22px; }
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 12px; width: max-content; border: 1px solid var(--border); }

/* sheet */
.sheet-wrap { position: fixed; inset: 0; background: rgb(20 19 17 / .45); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.sheet { background: var(--surface); border-radius: 18px; width: min(540px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-pop); animation: pop .2s cubic-bezier(.2, .8, .2, 1); }
.sheet.wide { width: min(780px, 100%); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 12px 22px; }
.sheet-head h2 { font-size: 22px; font-weight: 800; font-stretch: 82%; }
.sheet-body { padding: 4px 22px 22px; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.pick-list { display: grid; gap: 2px; margin-top: 10px; max-height: 55vh; overflow-y: auto; }
.pick-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; text-align: left; border: 0; background: transparent; border-radius: 10px; padding: 6px; cursor: pointer; }
.pick-row:hover { background: var(--surface-2); }
.pick-row img, .pick-row .noimg { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); }

#toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 6px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 11px; opacity: 0; transform: translateY(-8px); transition: .22s; max-width: 90vw; font-weight: 550; box-shadow: var(--shadow-pop); }
.toast.show { opacity: 1; transform: none; } .toast.error { background: var(--err); color: #fff; }

/* tablet */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 68px 1fr; }
  .nav-label { display: none; } .nav-item { justify-content: center; padding: 0; }
  .nav-badge { position: absolute; top: 2px; right: 6px; margin: 0; min-width: 17px; height: 17px; font-size: 10px; }
  .thread-side { display: none; }
  main { padding: 22px 22px 90px; }
}
/* phone */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  nav.side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 30; flex-direction: row; overflow-x: auto;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); gap: 0; scrollbar-width: none; }
  .nav-item { flex: 1 0 64px; flex-direction: column; justify-content: center; gap: 2px; height: 54px; padding: 0 4px; font-size: 11px; border-radius: 12px; }
  .nav-label { display: block; }
  .nav-item.active { background: transparent; box-shadow: none; color: var(--brand); }
  .nav-badge { top: 3px; right: calc(50% - 22px); }
  main { padding: 18px 16px 100px; }
  h1 { font-size: 26px; }
  header.top { padding: 0 10px 0 14px; } header.top .who { display: none; }
  .inbox { grid-template-columns: 1fr; height: calc(100vh - 58px - 68px); border-left: 0; }
  .inbox.has-open .conv-col { display: none; } .inbox:not(.has-open) .conv-pane { display: none; }
  .thread-head { padding: 8px 12px; gap: 10px; } .thread-head .back { display: grid; }
  .thread-head .avatar { display: none; }
  .thread { padding: 14px; }
  .thread-wrap { display: flex; flex-direction: column; }
  .thread { flex: 1; }
  .thread-side { display: block; order: -1; border-left: 0; border-bottom: 1px solid var(--border); max-height: 32vh; padding: 10px 14px; }
  .thread-side.empty { display: none; }
  .filters { flex-wrap: wrap; } .filters input[type="search"] { flex: 1 1 100%; } .filters select { max-width: none; }
  .head-actions .btn.sm { height: 30px; padding: 0 9px; }
  .grid2, .grid3, .charts, .two-col { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile { padding: 12px 14px 14px; } .tile-value { font-size: 25px; }
  .prod-grid { grid-template-columns: repeat(2, 1fr); gap: 14px 10px; }
  .stock-row { grid-template-columns: 52px 1fr; } .sr-ctrl { grid-column: 1 / -1; justify-content: space-between; }
  .sheet-wrap { place-items: end center; padding: 0; } .sheet, .sheet.wide { width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .hour-row { grid-template-columns: 80px 1fr auto 1fr; }
  .bubble { max-width: 86%; }
  .order-grid { grid-template-columns: 1fr; }
  .sticky-save { bottom: 84px; }
  #toasts { top: 66px; }
}
.who-block .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticks { display: inline-flex; margin-left: 3px; color: var(--faint); }
.ticks .t1 { margin-right: -8px; }
.ticks.read { color: #2f9e6a; }
.send-fail { cursor: help; }
.msg-audio { display: block; width: 260px; max-width: 100%; height: 38px; margin: 2px 0 4px; }
a.media-note { text-decoration: none; color: var(--brand); font-weight: 600; }
.wa-card h3 .ic { color: #1f9d55; }
.tbl.kv td:first-child { color: var(--muted); width: 220px; white-space: nowrap; }
.wa-test { display: grid; grid-template-columns: 200px 240px auto auto; gap: 10px; align-items: end; margin-top: 16px; }
@media (max-width: 760px) { .wa-test { grid-template-columns: 1fr; } .tbl.kv td:first-child { width: auto; white-space: normal; } }
