:root {
  --navy1: #0B2F7A; --navy2: #123C9C;
  --bg: #F3F6FB; --card: #fff; --line: #E3E8F2; --line2: #EEF2F8;
  --text: #0F1B33; --muted: #64708A; --faint: #8A94A8;
  --blue: #1E63D8; --blue-d: #1752B8; --blue-t: #EAF1FD;
  --green: #16A34A; --green-t: #E8F7EE;
  --amber: #D97706; --amber-t: #FEF3E2;
  --purple: #7C3AED; --purple-t: #F1EBFE;
  --red: #DC2626; --red-t: #FDECEC;
  --teal: #0E9488; --teal-t: #E5F6F4;
  --r: 12px; --r-lg: 14px; --r-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 30, 60, .04), 0 1px 3px rgba(16, 30, 60, .06);
  --sideW: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.num, td.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ic { flex: none; display: block; }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sideW); flex: none; background: linear-gradient(180deg, var(--navy1), var(--navy2)); color: #DCE6FF; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 20px; font-weight: 700; padding: 4px 8px 22px; letter-spacing: -.02em; }
.brand b { color: #7FB0FF; font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #C9D6F5; font-weight: 500; transition: background .15s, color .15s; }
.nav-item small { display: block; font-size: 11px; color: #93A8D8; font-weight: 400; margin-top: 1px; }
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item.active { background: #fff; color: var(--navy2); font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.nav-item.active small { color: var(--muted); }
.side-foot { margin-top: auto; padding-top: 14px; }
.side-card { display: flex; gap: 10px; align-items: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--r); padding: 12px; font-size: 13px; }
.side-card small { display: block; color: #9FB3E0; font-size: 11.5px; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 18px; padding: 0 28px; }
.biz { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.biz:hover { border-color: #C8D3E8; }
.biz .ic:first-child { color: var(--blue); }
.top-search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--faint); }
.top-search input { border: 0; background: transparent; outline: 0; height: 38px; width: 100%; color: var(--text); }
.top-search:focus-within { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px var(--blue-t); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 10px; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
.user { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 12px; margin-left: 6px; cursor: pointer; color: var(--muted); }
.user:hover { background: var(--bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #3D7BEA, #1E4FB8); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.u-meta b { display: block; color: var(--text); font-size: 13.5px; }
.u-meta small { font-size: 11.5px; }
.content { padding: 24px 28px 40px; outline: 0; min-width: 0; }

/* ---------- page header & buttons ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }
.head-left { display: flex; align-items: center; gap: 12px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; color: var(--text); transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: #C5D0E6; background: #FAFBFE; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 2px 6px rgba(30, 99, 216, .25); }
.btn-primary:hover { background: var(--blue-d); border-color: var(--blue-d); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #128A3E; border-color: #128A3E; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-outline-blue { color: var(--blue); border-color: #BFD3F6; background: #fff; }
.btn-outline-blue:hover { background: var(--blue-t); border-color: var(--blue); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-ghost { border-color: transparent; background: transparent; }
.back-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--text); }
.back-btn:hover { background: var(--bg); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line2); }
.card-head h3 { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.card-head h3 .hi { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--blue-t); color: var(--blue); }

.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { display: flex; gap: 12px; align-items: center; padding: 16px; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.stat:hover { border-color: #C9D6EE; box-shadow: 0 6px 18px rgba(16, 30, 60, .07); }
.stat .sq { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat .lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; line-height: 1.3; }
.stat .val { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.t-blue { background: var(--blue-t); color: var(--blue); } .t-green { background: var(--green-t); color: var(--green); }
.t-amber { background: var(--amber-t); color: var(--amber); } .t-purple { background: var(--purple-t); color: var(--purple); }
.t-red { background: var(--red-t); color: var(--red); } .t-teal { background: var(--teal-t); color: var(--teal); }
.t-indigo { background: #ECEBFE; color: #4F46E5; }

/* ---------- tabs & toolbar ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 14px 12px 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--blue); border-color: var(--blue); }
.tab .cnt { font-size: 11.5px; background: var(--bg); color: var(--muted); padding: 2px 7px; border-radius: 20px; font-variant-numeric: tabular-nums; }
.tab.active .cnt { background: var(--blue-t); color: var(--blue); }
.toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 16px; flex-wrap: wrap; }
.input-ic { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; height: 40px; color: var(--faint); background: #fff; min-width: 280px; }
.input-ic input { border: 0; outline: 0; width: 100%; height: 100%; background: transparent; color: var(--text); }
.input-ic:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-t); }
.toolbar .spacer { flex: 1; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; max-height: calc(100vh - 210px); }
.table-wrap.short { max-height: 520px; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; z-index: 2; background: #F7F9FD; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: none; text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; white-space: nowrap; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #F8FAFE; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .c, .tbl th.c { text-align: center; }
.tbl .strong { font-weight: 600; }
.tbl a.link { font-weight: 600; }
.tbl .sub-t { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .ic { margin: 0 auto 10px; color: #B4BFD3; }
.tfoot-note { padding: 12px 16px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line2); display: flex; justify-content: space-between; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-grey { background: #EEF1F6; color: #55617A; } .st-green { background: var(--green-t); color: var(--green); }
.st-amber { background: var(--amber-t); color: var(--amber); } .st-blue { background: var(--blue-t); color: var(--blue); }
.st-purple { background: var(--purple-t); color: var(--purple); } .st-teal { background: var(--teal-t); color: var(--teal); }
.st-red { background: var(--red-t); color: var(--red); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.icon-sq { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-sq:hover { background: var(--bg); color: var(--text); }
.icon-sq.danger:hover { background: var(--red-t); color: var(--red); border-color: #F5C2C2; }

.thumb { width: 34px; height: 34px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: hsl(var(--h) 60% 35%); background: linear-gradient(135deg, hsl(var(--h) 85% 93%), hsl(var(--h) 70% 85%)); border: 1px solid hsl(var(--h) 50% 85%); }
.prod-cell { display: flex; gap: 10px; align-items: center; min-width: 210px; }
.prod-cell b { font-weight: 600; display: block; white-space: normal; line-height: 1.3; }

/* ---------- menus, modal, toasts ---------- */
.menu { position: fixed; z-index: 100; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 30, 60, .16); padding: 6px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; font-size: 13.5px; }
.menu button:hover:not(:disabled) { background: var(--bg); }
.menu button:disabled { color: #B6BECD; cursor: default; }
.menu button.danger { color: var(--red); }
.menu button.danger:hover { background: var(--red-t); }
.menu .ic { color: var(--muted); } .menu .danger .ic { color: var(--red); }
.menu-div { height: 1px; background: var(--line2); margin: 5px 4px; }
.modal-wrap { position: fixed; inset: 0; z-index: 90; background: rgba(12, 22, 48, .42); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line2); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; gap: 10px; align-items: center; background: #0F1B33; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-weight: 500; animation: up .2s; transition: opacity .3s, transform .3s; }
.toast.ok .ic { color: #4ADE80; } .toast.err .ic { color: #F87171; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

/* ---------- forms ---------- */
.grid { display: grid; gap: 14px 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl-t { font-size: 12.5px; font-weight: 600; color: #3A4660; }
.req { color: var(--red); }
.ctl, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea { height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; outline: 0; width: 100%; transition: border-color .15s, box-shadow .15s; }
.field textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.field select, select.ctl { appearance: none; background-image: 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='%2364708A' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.field input:focus, .field select:focus, .field textarea:focus, .ctl:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-t); }
.field input[readonly] { background: var(--bg); color: var(--muted); }
.field.invalid input, .field.invalid select, .field.invalid textarea, .field.invalid .drop { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-t); }
.err { color: var(--red); font-size: 12px; font-weight: 500; }
.with-btn { display: flex; gap: 8px; } .with-btn > :first-child { flex: 1; min-width: 0; }
.with-btn .icon-sq { width: 40px; height: 40px; border-radius: 10px; color: var(--blue); }
.prefix { position: relative; } .prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.prefix input { padding-left: 28px !important; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); }
.radio-group { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--bg); }
.radio-group label { padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; }
.radio-group input { display: none; }
.radio-group label:has(input:checked) { background: #fff; color: var(--blue); box-shadow: var(--shadow); }

/* estimate form */
.est-number { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.est-number input.num-edit { font-size: 22px; font-weight: 700; border: 1px dashed transparent; border-radius: 8px; padding: 2px 6px; width: 140px; background: transparent; outline: 0; }
.est-number input.num-edit:hover { border-color: var(--line); }
.est-number input.num-edit:focus { border-color: var(--blue); background: #fff; }
.date-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.date-chip input { border: 1px solid var(--line); border-radius: 8px; height: 32px; padding: 0 8px; }
.filters-bar { display: flex; align-items: flex-end; gap: 14px; padding: 14px 18px; margin-bottom: 16px; flex-wrap: wrap; }
.filters-bar .fb-title { display: flex; align-items: center; gap: 8px; font-weight: 700; align-self: center; padding-right: 6px; border-right: 1px solid var(--line); margin-right: 2px; height: 40px; }
.filters-bar .field { width: 140px; }
.filters-bar .field.disc { width: 96px; }
.est-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.est-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.est-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }
.prod-search { position: relative; flex: 1; min-width: 260px; }
.suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 30, 60, .14); max-height: 320px; overflow: auto; padding: 4px; }
.suggest button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 8px; text-align: left; cursor: pointer; }
.suggest button:hover, .suggest button.hl { background: var(--blue-t); }
.suggest .s-meta { color: var(--muted); font-size: 12px; }
.suggest .s-price { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.stepper button { width: 28px; height: 30px; border: 0; background: var(--bg); cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.stepper button:hover { background: var(--blue-t); color: var(--blue); }
.stepper input { width: 46px; height: 30px; border: 0; text-align: center; outline: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.cell-in { width: 70px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; text-align: right; outline: 0; font-variant-numeric: tabular-nums; }
.cell-in.wide { width: 96px; }
.cell-in:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-t); }
.pos { color: var(--green); font-weight: 600; } .neg { color: var(--red); font-weight: 600; }
.sum-rows { padding: 6px 20px 18px; }
.sum-row { display: flex; justify-content: space-between; padding: 9px 0; font-variant-numeric: tabular-nums; color: #3A4660; }
.sum-row b { color: var(--text); }
.sum-row + .sum-row { border-top: 1px dashed var(--line2); }
.sum-total { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 14px 16px; background: var(--blue-t); border-radius: 12px; }
.sum-total span { font-weight: 600; color: var(--blue-d); }
.sum-total b { font-size: 24px; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }
.profit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px 20px 20px; }
.pbox { border-radius: 12px; padding: 12px; }
.pbox small { display: block; font-size: 12px; font-weight: 600; opacity: .85; }
.pbox b { display: block; font-size: 17px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.bottom-bar { display: flex; gap: 16px; align-items: center; padding: 14px 18px; flex-wrap: wrap; }
.bottom-bar .field { flex: 1; min-width: 260px; }
.bottom-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.kpill { display: flex; flex-direction: column; padding: 8px 14px; border-radius: 12px; min-width: 110px; }
.kpill small { font-size: 11.5px; font-weight: 600; opacity: .8; } .kpill b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* bill form */
.bill-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.section { padding: 18px 20px 20px; }
.section + .section { border-top: 1px solid var(--line2); }
.section h4 { margin: 0 0 14px; font-size: 14.5px; display: flex; align-items: center; gap: 10px; }
.section h4 .n { width: 24px; height: 24px; border-radius: 7px; background: var(--blue-t); color: var(--blue); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.drop { border: 1.5px dashed #BCCBE6; border-radius: 12px; background: #F8FAFF; padding: 28px 16px; text-align: center; cursor: pointer; transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { background: var(--blue-t); border-color: var(--blue); }
.drop .ic { margin: 0 auto 10px; color: var(--blue); }
.drop b { display: block; margin-bottom: 4px; }
.file-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 12px; }
.file-row .fi { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--red-t); color: var(--red); font-size: 10px; font-weight: 800; flex: none; }
.file-row .fi.img { background: var(--green-t); color: var(--green); }
.file-row .fm { flex: 1; min-width: 0; } .file-row .fm b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-row .fm small { color: var(--muted); font-size: 12px; }
.summary-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 0; align-items: center; padding: 6px; margin-top: 16px; }
.summary-strip .ss { padding: 10px 16px; border-right: 1px solid var(--line2); min-width: 0; }
.summary-strip .ss small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.summary-strip .ss b { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.summary-strip .ss.big b { color: var(--blue); font-size: 18px; }
.summary-strip .acts { display: flex; gap: 10px; padding: 0 10px; }
.linked-note { display: flex; gap: 10px; align-items: flex-start; background: var(--blue-t); color: var(--blue-d); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 12px; }

/* dashboard */
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: box-shadow .15s, border-color .15s; color: inherit; }
.kpi:hover { box-shadow: 0 8px 22px rgba(16, 30, 60, .08); border-color: #C9D6EE; }
.kpi .top { display: flex; justify-content: space-between; align-items: center; }
.kpi .val { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .lbl { color: var(--muted); font-weight: 500; }
.kpi .foot { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dash-two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.pipe { padding: 8px 20px 18px; }
.pipe-row { display: grid; grid-template-columns: 160px 1fr 40px; gap: 12px; align-items: center; padding: 8px 0; font-size: 13px; }
.bar { height: 8px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px 20px 20px; }
.quick a { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-weight: 600; color: var(--text); }
.quick a:hover { border-color: var(--blue); background: var(--blue-t); }
.quick .sq { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }

/* placeholder */
.placeholder { max-width: 640px; margin: 40px auto; text-align: center; padding: 40px 32px; }
.ph-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--blue-t); color: var(--blue); display: grid; place-items: center; margin: 0 auto 16px; }
.placeholder h2 { font-size: 20px; margin-bottom: 8px; }
.placeholder p { line-height: 1.6; }
.ph-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* products */
.prod-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.prod-layout .form-card { position: sticky; top: 84px; }

/* print view of an estimate */
.print-only { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1500px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-strip .acts { grid-column: 1 / -1; justify-content: flex-end; padding: 10px; }
}
@media (max-width: 1360px) {
  :root { --sideW: 220px; }
  .est-layout { grid-template-columns: minmax(0, 1fr) 290px; }
  .bill-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  :root { --sideW: 74px; }
  .brand span, .nav-item span, .side-card div { display: none; }
  .nav-item { justify-content: center; padding: 11px; }
  .brand { justify-content: center; padding: 4px 0 22px; }
  .side-card { justify-content: center; }
  .est-layout, .bill-layout, .prod-layout, .dash-two { grid-template-columns: minmax(0, 1fr); }
  .est-side, .prod-layout .form-card { position: static; }
  .u-meta { display: none; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .biz span { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .input-ic { min-width: 0; flex: 1; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .sidebar, .topbar, .toasts, .no-print, .menu { display: none !important; }
  .content { padding: 0; }
  .print-only { display: block; }
  .card { box-shadow: none; border-color: #ccc; }
  .est-layout { grid-template-columns: 1fr; }
  .est-side { position: static; }
  .table-wrap { max-height: none; overflow: visible; }
  .tbl th { position: static; }
  input, select, textarea { border: 0 !important; box-shadow: none !important; background: none !important; appearance: none; padding: 0 !important; }
  .stepper button, .icon-sq { display: none !important; }
  .stepper { border: 0; }
  .print-internal { display: none !important; }
}
.sq { display: grid; place-items: center; border-radius: 12px; flex: none; }
@media print { .modal-wrap { position: static; background: none; padding: 0; } body:has(.modal-wrap) .app { display: none; } .modal { box-shadow: none; width: 100% !important; max-height: none; } .modal-head button, .modal-actions { display: none; } }
.tbl td.wrap { white-space: normal; min-width: 170px; line-height: 1.35; }
.filters-bar { gap: 12px; }
.filters-bar .field { width: 118px; }
.filters-bar .field.disc { width: 84px; }
.prod-search { min-width: 220px; }
#items-card .card-head h3 { flex: none; }
.filters-bar .field { width: 106px; } .filters-bar { gap: 10px; }
.tabs { overflow-y: hidden; scrollbar-width: thin; }
