:root {
  --primary: #1e3a5f;
  --primary-hover: #17304f;
  --primary-soft: #e8eef6;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1f2933;
  --muted: #6b7480;
  --faint: #9aa2ad;
  --green: #1f7a4d; --green-bg: #e3f4ea;
  --yellow: #8a6100; --yellow-bg: #fdf3d7;
  --red: #b42318; --red-bg: #fde8e6;
  --grey: #4b5563; --grey-bg: #eef0f3;
  --blue: #1e3a5f; --blue-bg: #e8eef6;
  --radius: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.hidden { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius);
  cursor: pointer; white-space: nowrap; font-weight: 500;
}
.btn:hover { background: #f0f2f5; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--red); }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #962017; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #eef0f3; }
.btn svg { width: 15px; height: 15px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff;
}
textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30, 58, 95, .12); }
.invalid { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(180, 35, 24, .1) !important; }

/* ---------- login ---------- */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 28px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p { margin: 0 0 20px; color: var(--muted); }
.login-card label { display: block; font-weight: 500; margin: 12px 0 4px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 18px; height: 38px; }
.login-err { color: var(--red); margin-top: 10px; min-height: 20px; }
.login-demo { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- layout ---------- */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.brand { padding: 18px 18px 14px; font-weight: 700; font-size: 15px; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.brand svg { width: 20px; height: 20px; }
.nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent;
  border-radius: var(--radius); cursor: pointer; color: var(--grey); text-align: left; margin-bottom: 2px;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: #f0f2f5; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; border-radius: 10px; padding: 1px 7px; }
.user-box { border-top: 1px solid var(--border); padding: 12px 14px; font-size: 12px; color: var(--muted); }
.user-box select { margin: 4px 0 8px; height: 30px; font-size: 13px; }
.user-box .btn { width: 100%; justify-content: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 16px 24px 12px; flex-wrap: wrap; }
.topbar h2 { margin: 0; font-size: 19px; font-weight: 650; margin-right: auto; }
.menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 0 24px 32px; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
  cursor: pointer; text-align: left; border-left: 3px solid var(--border);
}
.stat:hover { border-color: var(--border-strong); }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--faint); }
.stat.alert { border-left-color: var(--red); }
.stat.alert .value { color: var(--red); }
.stat.info { border-left-color: var(--primary); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar input[type=search] { width: 230px; }
.toolbar select { width: auto; min-width: 130px; }
.check-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--grey); user-select: none; }
.bulkbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--primary-soft); border: 1px solid #cdd9e8;
  padding: 7px 10px; border-radius: var(--radius); margin-bottom: 10px;
}
.bulkbar select { width: auto; height: 28px; font-size: 13px; }
.bulkbar strong { margin-right: 6px; }

/* ---------- table ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
.list th {
  text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: #fafbfc; cursor: pointer; user-select: none; position: sticky; top: 0;
}
.list th.nosort { cursor: default; }
.list th .arrow { color: var(--faint); font-size: 10px; margin-left: 3px; }
.list td { padding: 9px 10px; border-bottom: 1px solid #eef0f3; vertical-align: middle; white-space: nowrap; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: #f7f9fc; }
.list tbody tr.selected { background: var(--primary-soft); }
.list tbody tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.list td.num, .list th.num { text-align: right; font-variant-numeric: tabular-nums; }
.list td.wrap { white-space: normal; min-width: 180px; max-width: 280px; }
.list .co { font-weight: 600; }
.list .sub { color: var(--muted); font-size: 12px; }
.list .chk { width: 34px; }
.red-text { color: var(--red); font-weight: 600; }
.more-row { text-align: center; padding: 10px; color: var(--muted); }

/* ---------- tags ---------- */
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-yellow { background: var(--yellow-bg); color: var(--yellow); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-grey { background: var(--grey-bg); color: var(--grey); }
.tag-blue { background: var(--blue-bg); color: var(--blue); }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty p { margin: 0 0 14px; }

/* ---------- overview ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel-card { padding: 14px 16px; }
.panel-card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 650; }
.panel-card .hint { color: var(--muted); font-size: 12px; margin: -6px 0 10px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: var(--muted); }
.todo-item { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid #eef0f3; cursor: pointer; }
.todo-item:last-child { border-bottom: 0; }
.todo-item:hover { background: #f7f9fc; }
.todo-item .grow { flex: 1; min-width: 0; }
.todo-item .grow .sub { color: var(--muted); font-size: 12px; }

/* ---------- side panel ---------- */
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%; background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; z-index: 20;
  transform: translateX(100%); transition: transform .18s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 14px 18px 0; border-bottom: 1px solid var(--border); }
.drawer-title { display: flex; align-items: flex-start; gap: 10px; }
.drawer-title h3 { margin: 0; font-size: 16px; flex: 1; }
.drawer-title .sub { color: var(--muted); font-size: 12px; font-weight: 400; display: block; margin-top: 2px; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 4px; border-radius: 6px; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: #eef0f3; color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.tabs { display: flex; gap: 18px; margin-top: 12px; }
.tab { border: 0; background: transparent; padding: 8px 0; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; flex: 0 0 auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.drawer-foot { border-top: 1px solid var(--border); padding: 12px 18px; display: flex; gap: 8px; align-items: center; }
.drawer-foot .spacer { flex: 1; }
.alert-box { border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.alert-box.warn { background: var(--yellow-bg); color: var(--yellow); }
.alert-box.bad { background: var(--red-bg); color: var(--red); }
.alert-box.ok { background: var(--green-bg); color: var(--green); }
.alert-box .grow { flex: 1; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; padding: 0; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f.full { grid-column: 1 / -1; }
.f label { font-size: 12.5px; font-weight: 500; color: var(--grey); }
.f label .req { color: var(--red); }
.f .check-label { height: 34px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--border); margin-left: 5px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--primary); }
.timeline .meta { font-size: 12px; color: var(--muted); }
.note-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.note-box .row { display: flex; gap: 8px; align-items: center; }
.note-box .row .hint { flex: 1; font-size: 12px; color: var(--muted); }

/* ---------- modal / toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(16, 24, 40, .35); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); max-height: 90vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 760px; }
.modal-head { padding: 16px 18px 6px; display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-body { padding: 6px 18px 12px; overflow-y: auto; }
.modal-foot { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; }
.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 10px 0; }
.preview { font-size: 12px; }
.preview td, .preview th { padding: 5px 8px; }
.toasts { position: fixed; top: 60px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1f2933; color: #fff; padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 13px; max-width: 320px; animation: tin .15s ease; }
.toast.err { background: var(--red); }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--grey-bg); border-radius: 12px; padding: 2px 4px 2px 10px; font-size: 13px; }
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 15px; line-height: 1; }
.chip button:hover { color: var(--red); }
.chip.locked { padding-right: 10px; }
.add-row { display: flex; gap: 6px; }
.add-row input { height: 30px; }
.rule-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rule-row label { flex: 1; }
.rule-row input { width: 110px; height: 30px; }

/* ---------- quotations ---------- */
.drawer.wide { width: 640px; }
.qitem { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; background: #fafbfc; }
.qitem-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.qitem-head .grow { flex: 1; }
.qgrid { display: grid; grid-template-columns: 1.4fr .7fr 1fr .8fr 1fr; gap: 8px; align-items: end; }
.qgrid .f.desc { grid-column: 1 / -1; }
.qamount { font-weight: 650; text-align: right; padding-bottom: 8px; white-space: nowrap; }
.totals { margin-left: auto; max-width: 320px; font-size: 13.5px; }
.totals .trow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.totals .trow input { width: 110px; height: 30px; text-align: right; }
.totals .grand { border-top: 2px solid var(--primary); margin-top: 4px; padding-top: 8px; font-weight: 700; font-size: 16px; color: var(--primary); }
.link-btn { border: 0; background: transparent; color: var(--primary); text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.linked-quotes { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 12px; font-size: 13px; }
.linked-quotes .lq { display: flex; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.linked-quotes .lq:hover { color: var(--primary); }
.linked-quotes .lq .grow { flex: 1; }
.settings-wide { grid-column: 1 / -1; }
.settings-wide .fgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- AI helpers ---------- */
.ai-box { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; background: var(--primary-soft); font-size: 13px; }
.ai-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-row .grow { flex: 1; min-width: 160px; }
.ai-row select { height: 30px; }
.ai-badge { background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 1px 6px; letter-spacing: .04em; }
.ai-wait { color: var(--muted); margin: 8px 0 0; }
.ai-done { color: var(--green); margin: 8px 0 0; }
.ai-list { margin-top: 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.ai-item { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.ai-item:last-child { border-bottom: 0; }
.ai-item .sub { color: var(--muted); font-size: 12px; }
.ai-advice { margin: 8px 0; padding-left: 18px; }
.ai-filled { background: #fffbe6 !important; border-color: #e0b400 !important; }
label.btn.disabled { opacity: .5; pointer-events: none; }

/* ---------- AI Sales Coach ---------- */
.coach-tips { margin-bottom: 16px; }
.tips-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; font-size: 13px; }
.tips-grid p { margin: 4px 0 0; color: var(--grey); }
.coach-tabs { margin: 0 0 16px; border-bottom: 1px solid var(--border); }
.coach-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ai-result { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; font-size: 13.5px; }
.ai-result p { margin: 4px 0 0; }
.kv { margin-top: 4px; }
.kv span { display: inline-block; min-width: 130px; color: var(--muted); font-size: 12px; }
.help-label { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--primary); }
.ai-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.score-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.score { font-size: 28px; font-weight: 700; color: var(--primary); }
.score small { font-size: 14px; color: var(--muted); font-weight: 500; }
.coach-stats { margin-top: 16px; }
.topbar .check-label { margin-left: auto; }
.topbar #cLang { height: 32px; width: auto; flex: 0 0 auto; }
.topbar .check-label { white-space: nowrap; }

/* ---------- client files, photos, visits ---------- */
.thumb { width: 96px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--grey-bg); cursor: zoom-in; flex: 0 0 auto; }
.empty-thumb { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--faint); cursor: default; }
.photo-big { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 6px; }
.card-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-row .grow { flex: 1; min-width: 160px; }
.contact-card, .visit-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.contact-card .grow, .visit-card .grow { flex: 1; min-width: 0; }
.contact-card a, .visit-card a { color: var(--primary); }
.contact-actions { display: flex; flex-direction: column; gap: 6px; }
.wa { font-size: 12px; margin-left: 4px; }
.contact-form { border: 1px solid var(--primary); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; background: #fff; }
.note-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; font-size: 13px; }
.note-card p { margin: 6px 0; }
.note-card details { margin-top: 6px; }
.transcript { white-space: pre-wrap; color: var(--grey); font-size: 12.5px; }
.client-link { font-size: 13px; margin-bottom: 12px; }
.gps-line { min-height: 34px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.shot-choice { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; height: auto !important; }
.shot-choice input { margin-top: 3px; }
#vText { width: 100%; }
.visit-card .tags { margin: 4px 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- planning, guide, commission, forecast ---------- */
.plan-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.plan-table td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; }
.plan-table td.when { white-space: nowrap; font-weight: 600; color: var(--primary); width: 1%; }
.guide-rec h3 { color: var(--primary); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.fc-table td .fc { color: var(--grey); }
.fc-table th.cur { color: var(--primary); }
.fc-table tr.total td { border-top: 2px solid var(--primary); background: var(--primary-soft); }
.claim-actions { white-space: nowrap; }
.claim-actions .btn { margin-left: 4px; }

/* ---------- users, log, phone menu ---------- */
.me-line { margin-bottom: 8px; font-size: 13px; }
.user-box .ai-row .btn { flex: 1; justify-content: center; }
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-card { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-size: 13.5px; }
.user-card.off { opacity: .6; }
.user-card .grow { flex: 1; min-width: 0; }
.user-actions { display: flex; gap: 6px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; margin-top: 4px; }
.bottom-nav { display: none; }

/* ---------- mobile ---------- */
.backdrop { display: none; }
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(16, 24, 40, .3); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px 10px; }
  .topbar h2 { font-size: 17px; }
  .topbar .hide-sm { display: none; }
  .content { padding: 0 16px 24px; }
  .toolbar input[type=search] { width: 100%; }
  .toolbar select { flex: 1; min-width: 0; }
  .drawer { position: fixed; width: 100%; border-left: 0; z-index: 45; }
  .fgrid { grid-template-columns: 1fr; }
  .drawer.wide { width: 100%; }
  .drawer-foot { flex-wrap: wrap; }
  /* bottom menu bar for outdoor salespeople: one thumb, big targets */
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(16, 24, 40, .06); padding-bottom: env(safe-area-inset-bottom); }
  .bn-item { flex: 1; border: 0; background: transparent; padding: 8px 2px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 500; position: relative; min-height: 56px; cursor: pointer; }
  .bn-item svg { width: 22px; height: 22px; }
  .bn-item.active { color: var(--primary); }
  .bn-item.active::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
  .bn-badge { position: absolute; top: 4px; left: 54%; background: var(--red); color: #fff; font-style: normal; font-size: 10px; border-radius: 8px; padding: 0 5px; line-height: 16px; }
  .content { padding-bottom: 84px; }
  .toasts { top: 12px; left: 12px; right: 12px; }
  .toast { max-width: none; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }
  input, select, textarea { font-size: 16px; }
  .user-card { flex-wrap: wrap; }
  .modal { max-height: 92vh; }
  .tips-grid, .coach-3 { grid-template-columns: 1fr; }
  .kv span { display: block; }
  .contact-card, .visit-card { flex-wrap: wrap; }
  .contact-actions { flex-direction: row; }
  .plan-table td.when { white-space: normal; }
  .claim-actions { white-space: normal; }
  .qgrid { grid-template-columns: 1fr 1fr; }
  .qamount { grid-column: 1 / -1; padding-bottom: 0; }
  .totals { max-width: none; }
  .settings-wide .fgrid { grid-template-columns: 1fr; }
  .map-grid { grid-template-columns: 1fr; }
  table.list thead { display: none; }
  table.list, .list tbody, .list tr, .list td { display: block; width: 100%; }
  .list tbody tr { border-bottom: 1px solid var(--border); padding: 8px 10px; position: relative; }
  .list td { border: 0; padding: 2px 0; white-space: normal; text-align: left !important; }
  .list td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
  .list td.chk { position: absolute; right: 8px; top: 8px; width: auto; }
  .list td.co-cell::before { content: none; }
  .list tbody tr.overdue { box-shadow: inset 3px 0 0 var(--red); }
  .list tbody tr.overdue td:first-child { box-shadow: none; }
}

/* PO & bank-in slips */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 12px; max-width: 100%; }
.seg button { border: 0; background: #fff; padding: 9px 14px; font: inherit; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--primary); color: #fff; font-weight: 600; }
.doc-drop { border: 1px dashed var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; background: #fafbfc; }
.doc-thumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#pdFiles { margin-top: 10px; }
#pdFiles:empty { display: none; }
.doc-thumbs .thumb { width: 64px; height: 64px; }
.doc-pdf { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 6px; border: 1px solid var(--border); background: var(--red-bg); color: var(--red); font-weight: 700; font-size: 13px; text-decoration: none; }
.doc-file { position: relative; display: inline-block; }
.doc-rm { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: #fff; padding: 3px; cursor: pointer; color: var(--muted); }
.doc-rm svg { width: 14px; height: 14px; display: block; }
.modal-foot .spacer { flex: 1; }
.kv-list .kv { padding: 3px 0; }
@media (max-width: 768px) { .seg { display: flex; } .seg button { flex: 1; padding: 11px 8px; } }

/* Price list + PO price check */
.modal.xwide { max-width: 1080px; }
.pl-search { min-width: 260px; flex: 1; }
.pl-match { margin-bottom: 16px; padding: 12px 16px; }
.pl-match select { max-width: 340px; }
.muted-row td { opacity: .55; }
.po-tools { margin-bottom: 10px; align-items: center; }
.po-lines input { width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 14px; background: #fff; }
.po-lines input:disabled { background: var(--grey-bg); }
.po-lines td { vertical-align: top; }
.po-lines td:nth-child(1) { min-width: 180px; }
.po-lines td:nth-child(2) { min-width: 220px; }
.po-lines td:nth-child(3) { width: 70px; }
.po-lines td:nth-child(4) { width: 120px; }
.po-lines td:nth-child(5) { width: 90px; }
.po-lines .num input { text-align: right; }
.po-lines tbody tr { cursor: default; }
.po-lines tbody tr:hover { background: transparent; }
.po-sum { margin-top: 14px; }
.po-sum .alert-box { margin-bottom: 8px; }
@media (max-width: 768px) {
  .pl-search { min-width: 0; width: 100%; }
  .pl-match .ai-row { flex-wrap: wrap; }
  .pl-match select { max-width: 100%; width: 100%; }
  .po-lines td { min-width: 0 !important; width: auto !important; }
  .po-lines .num input { text-align: left; }
}
@media (max-width: 768px) {
  .po-lines tbody tr { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 0 8px; }
  .po-lines tbody td:nth-child(1), .po-lines tbody td:nth-child(2) { grid-column: 1 / -1; }
  .po-lines tbody td:nth-child(6) { grid-column: 1 / 3; }
  .po-lines tbody td:nth-child(8) { position: absolute; top: 4px; right: 4px; padding: 0; }
  .po-lines tbody td:nth-child(1) { padding-right: 34px; }
}
