:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e2433;
  --muted: #6b7385;
  --line: #e4e8f0;
  --line2: #eef1f6;
  --primary: #4f46e5;
  --primary-d: #4338ca;
  --primary-l: #eef0ff;
  --green: #16a34a; --green-l: #e8f7ee;
  --red: #dc2626; --red-l: #fdecec;
  --amber: #d97706; --amber-l: #fff4e0;
  --blue: #2563eb; --blue-l: #e8f0ff;
  --cyan: #0891b2; --cyan-l: #e3f6fa;
  --violet: #7c3aed; --violet-l: #f1eaff;
  --gray: #64748b; --gray-l: #eef1f5;
  --side: #151a2d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 40px rgba(16,24,40,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: #f7f8fc; border-color: #d5dae5; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: #f3c9c9; }
.btn.danger:hover { background: var(--red-l); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--gray-l); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn.wa { color: #128c4b; border-color: #bfe8cf; }
.btn.wa:hover { background: #e9f9ef; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; cursor: pointer; font-size: 16px; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: rgba(127,127,127,.15); }

input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
input, select { height: 38px; }
textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.14); }
label { display: block; font-size: 12.5px; font-weight: 600; color: #4a5263; }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; }
.rq { color: var(--red); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 10%, #e0e3ff, transparent 50%), radial-gradient(circle at 90% 90%, #dff5ec, transparent 45%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: #fff; padding: 30px 28px; border-radius: 18px; box-shadow: var(--shadow-lg); display: grid; gap: 16px; }
.err { color: var(--red); font-size: 13px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 16px; }
.brand small { display: block; font-size: 11.5px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.brand.big b { font-size: 20px; }
.brand.big small { max-width: none; font-size: 12.5px; }
.logo { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; background: var(--side); color: #c8cde0; display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; z-index: 40; }
.side .brand { padding: 4px 8px 18px; color: #fff; }
.side nav { display: grid; gap: 2px; flex: 1; align-content: start; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: #c8cde0; font-weight: 550; }
.side nav a i { font-style: normal; width: 20px; text-align: center; opacity: .85; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.active { background: rgba(99,102,241,.22); color: #fff; }
.side nav a .badge { margin-left: auto; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; border-top: 1px solid rgba(255,255,255,.08); }
.me-info { flex: 1; min-width: 0; }
.me-info b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-info small { font-size: 11.5px; opacity: .7; text-transform: capitalize; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #3b3f9a; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; background: rgba(244,246,251,.92); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); }
.top h1 { font-size: 18px; flex: none; }
.gsearch { flex: 1; max-width: 420px; margin-left: auto; }
.gsearch input { background: #fff; }
.menu-btn { display: none; }
.view { padding: 20px 24px 40px; max-width: 1500px; width: 100%; }
.backdrop { display: none; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--gray-l); color: var(--gray); line-height: 18px; }
.badge.red { background: var(--red); color: #fff; }
.st-New { background: var(--blue-l); color: var(--blue); }
.st-Contacted { background: var(--cyan-l); color: var(--cyan); }
.st-Quoted { background: var(--violet-l); color: var(--violet); }
.st-Negotiation { background: var(--amber-l); color: var(--amber); }
.st-Won { background: var(--green-l); color: var(--green); }
.st-Lost { background: var(--red-l); color: var(--red); }
.st-On.Hold, .st-OnHold { background: var(--gray-l); color: var(--gray); }
.pr-Hot { background: #ffe9e4; color: #e0431b; }
.pr-Warm { background: var(--amber-l); color: var(--amber); }
.pr-Cold { background: #e7f1fb; color: #3b7bbf; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.fu-over { color: var(--red); font-weight: 650; }
.fu-today { color: var(--amber); font-weight: 650; }
.fu-soon { color: var(--blue); font-weight: 600; }

/* Cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line2); }
.card-h h3 { font-size: 14.5px; }
.card-h .sp { flex: 1; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid > *, .row > *, .card, .main, .view { min-width: 0; }
.list, .bars, .timeline, .disp-list { grid-template-columns: minmax(0, 1fr); }
code { word-break: break-all; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.sb { justify-content: space-between; }
.sp { flex: 1; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 16px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .val { font-size: 25px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--primary)); }

.alerts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.alert { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; cursor: pointer; transition: transform .1s, box-shadow .15s; color: inherit; }
.alert:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.alert .n { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; }
.alert .t { font-weight: 650; }
.alert small { display: block; color: var(--muted); font-size: 12px; }
.alert.red { background: #fff5f5; border-color: #f6d0d0; } .alert.red .n { color: var(--red); }
.alert.amber { background: #fffaf0; border-color: #f4dfb5; } .alert.amber .n { color: var(--amber); }
.alert.blue { background: #f5f8ff; border-color: #d3defa; } .alert.blue .n { color: var(--blue); }
.alert.gray { background: #f8f9fb; border-color: var(--line); } .alert.gray .n { color: var(--gray); }

/* Bars */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 56px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; background: var(--line2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--primary); min-width: 2px; }
.chart { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding: 8px 4px 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart .pair { display: flex; align-items: flex-end; gap: 4px; height: 100%; width: 100%; justify-content: center; }
.chart .b { width: 40%; max-width: 26px; border-radius: 5px 5px 0 0; position: relative; min-height: 2px; }
.chart .b span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 650; color: var(--muted); }
.chart .m { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Lists */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line2); cursor: pointer; }
.li:last-child { border-bottom: 0; }
.li:hover { background: #fafbff; }
.li .main-t { flex: 1; min-width: 0; }
.li .ttl { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .acts { display: flex; gap: 6px; flex: none; }
.empty { padding: 30px 16px; text-align: center; color: var(--muted); }
.empty .ic { font-size: 30px; display: block; margin-bottom: 6px; opacity: .6; }

/* Table */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 650; padding: 10px 12px; background: #fafbfd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: #fafbff; }
.tbl.plain tbody tr { cursor: default; }
.tbl .t1 { font-weight: 600; }
.tbl .t2 { font-size: 12.5px; color: var(--muted); }
.tbl tfoot td { font-weight: 650; background: #fafbfd; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 14px 16px; }
.filters > * { flex: 1 1 140px; }
.filters .q { flex: 2 1 220px; }
.filters .btns { flex: 0 0 auto; display: flex; gap: 8px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text); }
.chip b { font-weight: 700; color: var(--muted); font-size: 12px; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.on b { color: #dfe0ff; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.on { color: var(--primary); border-color: var(--primary); }
.tab .badge { margin-left: 4px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .s2 { grid-column: span 2; }
.form-grid .s4 { grid-column: 1 / -1; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.items-tbl td { padding: 6px 4px; border-bottom: 0; vertical-align: top; }
.items-tbl th { padding: 6px 4px; background: none; }
.items-tbl input, .items-tbl select { height: 36px; }
.items-tbl .amt { padding-top: 14px; text-align: right; font-weight: 600; white-space: nowrap; }
.totals { margin-left: auto; width: 100%; max-width: 360px; display: grid; gap: 8px; }
.totals .tr { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.totals .tr input, .totals .tr select { width: 120px; height: 34px; text-align: right; }
.totals .grand { font-size: 17px; font-weight: 750; border-top: 1px solid var(--line); padding-top: 10px; }
.sticky-bar { position: sticky; bottom: 0; background: rgba(244,246,251,.95); backdrop-filter: blur(6px); padding: 12px 0; margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); z-index: 5; }

/* Detail */
.d-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.d-head h2 { font-size: 21px; }
.d-head .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; color: var(--muted); font-size: 13px; }
.d-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.status-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.status-steps button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.status-steps button.on { border-color: transparent; }
.status-steps button:hover:not(.on) { border-color: var(--primary); color: var(--primary); }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 9px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.pre { white-space: pre-wrap; }
.next-fu { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 10px; background: var(--primary-l); margin-bottom: 14px; }
.next-fu .big { font-size: 18px; font-weight: 700; }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; position: relative; }
.tl::before { content: ""; position: absolute; left: 12px; top: 26px; bottom: 0; width: 2px; background: var(--line2); }
.tl:last-child::before { display: none; }
.tl .ic { width: 26px; height: 26px; border-radius: 50%; background: var(--primary-l); color: var(--primary); display: grid; place-items: center; font-size: 12px; }
.tl.sys .ic { background: var(--gray-l); color: var(--gray); }
.tl .hd { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tl .hd b { color: var(--text); }
.tl .bd { margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.tl.sys .bd { color: var(--muted); font-size: 12.5px; }
.tl .del { opacity: 0; }
.tl:hover .del { opacity: 1; }

/* Pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.lane { background: #eceff6; border-radius: var(--radius); padding: 10px; min-height: 200px; }
.lane.over { background: #e1e4ff; outline: 2px dashed var(--primary); }
.lane-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.lane-h b { flex: 1; }
.lane-h small { color: var(--muted); font-weight: 600; }
.kcard { background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; border: 1px solid var(--line); }
.kcard:active { cursor: grabbing; }
.kcard.drag { opacity: .4; }
.kcard .ttl { font-weight: 600; }
.kcard .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kcard .ft { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; gap: 6px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,20,35,.45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-lg); animation: pop .18s; }
.modal.wide { max-width: 760px; }
.modal-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line2); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-h h3 { flex: 1; font-size: 16px; }
.modal-b { padding: 18px 20px; display: grid; gap: 14px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--line2); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; }
.toast { background: #1e2433; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 550; animation: pop .2s; max-width: 340px; }
.toast.err { background: var(--red); }
.toast.ok { background: #15803d; }

.loading { padding: 50px; text-align: center; color: var(--muted); }
.spin { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: sp .7s linear infinite; margin: 0 auto 10px; }
@keyframes sp { to { transform: rotate(360deg); } }
.hint { background: #fffbea; border: 1px solid #f3e3a6; color: #7a5b00; padding: 10px 14px; border-radius: 10px; font-size: 13px; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 550; cursor: pointer; }
.switch input { width: 18px; height: 18px; }

/* Print / Quotation */
.print-page { background: #e9ecf2; min-height: 100vh; padding: 20px 16px; }
.print-bar { max-width: 820px; margin: 0 auto 14px; display: flex; gap: 10px; justify-content: flex-end; }
.quote-doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 40px 44px; box-shadow: var(--shadow-lg); color: #111; font-size: 13px; }
.q-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--primary); padding-bottom: 16px; }
.q-head h1 { font-size: 22px; color: var(--primary); }
.q-head .co { font-size: 12.5px; color: #444; line-height: 1.55; }
.q-title { text-align: right; }
.q-title h2 { font-size: 24px; letter-spacing: 2px; color: #222; }
.q-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0; }
.q-meta h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #777; margin-bottom: 6px; }
.q-tbl { width: 100%; border-collapse: collapse; margin-top: 8px; }
.q-tbl th { background: #f0f1fa; text-align: left; padding: 8px; font-size: 12px; border: 1px solid #dde; }
.q-tbl td { padding: 8px; border: 1px solid #e3e3ec; vertical-align: top; }
.q-tot { margin-left: auto; width: 300px; margin-top: 10px; }
.q-tot div { display: flex; justify-content: space-between; padding: 5px 8px; }
.q-tot .g { background: var(--primary); color: #fff; font-weight: 700; font-size: 15px; border-radius: 4px; }
.q-terms { margin-top: 22px; }
.q-terms h4 { font-size: 13px; margin: 12px 0 4px; }
.q-sign { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 50px; }

/* Responsive */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .g-main, .g3 { grid-template-columns: minmax(0, 1fr); }
  .alerts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .top { padding: 10px 16px; gap: 8px; }
  .top h1 { font-size: 16px; }
  .gsearch { display: none; }
  .top .btn.primary { margin-left: auto; }
  .view { padding: 16px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .quote-doc { padding: 22px 18px; }
  .q-meta { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .s2 { grid-column: auto; }
  .alerts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi .val { font-size: 21px; }
  .d-acts { margin-left: 0; }
  .li .acts .hide-xs { display: none; }
  .bar-row { grid-template-columns: 90px minmax(0, 1fr) 44px; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .print-page { background: #fff; padding: 0; }
  .print-bar, .toasts { display: none !important; }
  .quote-doc { box-shadow: none; padding: 0; max-width: none; }
  .q-tot .g, .q-tbl th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
