/* ============ Design tokens (Kiya orange + navy, light only) ============ */
:root {
    --bg: #f2f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f7;
    --border: #e3e8ef;
    --border-strong: #cfd7e3;
    --text: #0f1b2d;
    --text-2: #33415a;
    --muted: #64748b;
    --navy: #13284a;
    --navy-2: #2a4a7f;
    --orange: #f7941d;
    --orange-hover: #ea860f;
    --primary: #f7941d;
    --primary-hover: #ea860f;
    --primary-soft: #fff4e5;
    --primary-text: #b45f06;
    --ring: rgba(247, 148, 29, .28);
    --shadow-sm: 0 1px 2px rgba(15, 27, 45, .04);
    --shadow: 0 1px 3px rgba(15, 27, 45, .06), 0 12px 32px -14px rgba(15, 27, 45, .18);
    --viewer-a: #ffffff; --viewer-b: #e6ebf2;
    --green: #16a34a; --green-soft: #dcfce7; --green-text: #166534;
    --amber: #d97706; --amber-soft: #fef3c7; --amber-text: #92400e;
    --blue: #2563eb; --blue-soft: #dbeafe; --blue-text: #1e40af;
    --rose: #e11d48; --rose-soft: #ffe4e6; --rose-text: #9f1239;
    --gray-soft: #eef2f7; --gray-text: #475569;
}
/* Map Bootstrap onto the tokens */
:root {
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-body-font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --f-head: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
    --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    --bs-body-font-size: .9rem;
    --bs-border-color: var(--border);
    --bs-secondary-color: var(--muted);
    --bs-tertiary-bg: var(--surface-2);
    --bs-secondary-bg: var(--surface-3);
    --bs-emphasis-color: var(--text);
    --bs-primary: var(--primary);
    --bs-primary-rgb: 247, 148, 29;
    --bs-link-color: var(--primary-text);
    --bs-link-hover-color: var(--primary);
    --bs-link-color-rgb: 180, 95, 6;
    --bs-link-hover-color-rgb: 234, 134, 15;
    --bs-border-radius: 10px;
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: 14px;
    --bs-focus-ring-color: var(--ring);
}
body { background: var(--bg); color: var(--text); letter-spacing: -.005em; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
h1, h2, h3, h4, h5, h6, .modal-title, .card-header, .brand, .kpi-v, .stat .v, .section-title, .ring span, .fs-5 { font-family: var(--f-head); }
h1, h2, h3, h4, h5, h6 { letter-spacing: -.02em; color: var(--text); }
.muted, .text-muted, .text-secondary { color: var(--muted) !important; }
.min-w-0 { min-width: 0; }
.bg-white, .bg-light { background: var(--surface-2) !important; }
.border { border-color: var(--border) !important; }
.text-bg-light { background: var(--surface-3) !important; color: var(--text-2) !important; }
hr { border-color: var(--border); opacity: 1; }
::selection { background: var(--ring); }

/* Buttons */
.btn { --bs-btn-font-weight: 500; --bs-btn-padding-y: .45rem; --bs-btn-padding-x: .85rem; --bs-btn-font-size: .875rem; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-sm { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .6rem; --bs-btn-font-size: .8rem; border-radius: 8px; }
.btn-lg { --bs-btn-padding-y: .7rem; --bs-btn-font-size: .95rem; border-radius: 12px; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-active-bg: var(--primary-hover); --bs-btn-active-border-color: var(--primary-hover); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); --bs-btn-color: var(--navy); --bs-btn-hover-color: var(--navy); --bs-btn-active-color: var(--navy); --bs-btn-disabled-color: var(--navy); font-weight: 600; box-shadow: 0 1px 2px rgba(247, 148, 29, .35), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-dark { --bs-btn-bg: var(--navy); --bs-btn-border-color: var(--navy); --bs-btn-hover-bg: #0b1a33; --bs-btn-hover-border-color: #0b1a33; --bs-btn-active-bg: #0b1a33; --bs-btn-color: #fff; font-weight: 600; }
.btn-light, .btn-outline-secondary { --bs-btn-bg: var(--surface); --bs-btn-color: var(--text-2); --bs-btn-border-color: var(--border-strong); --bs-btn-hover-bg: var(--surface-3); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--border-strong); --bs-btn-active-bg: var(--surface-3); --bs-btn-active-color: var(--text); --bs-btn-active-border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-outline-primary { --bs-btn-color: var(--primary-text); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-active-bg: var(--primary); }
.btn-link { --bs-btn-color: var(--primary-text); --bs-btn-hover-color: var(--primary); text-decoration: none; }
.btn-success { --bs-btn-bg: var(--green); --bs-btn-border-color: var(--green); --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d; }
.btn-close { filter: none; }

/* Forms */
.form-control, .form-select { background-color: var(--surface); border-color: var(--border-strong); color: var(--text); border-radius: 10px; padding: .5rem .75rem; font-size: .875rem; box-shadow: var(--shadow-sm); }
.form-control::placeholder { color: var(--muted); opacity: .8; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); background-color: var(--surface); color: var(--text); }
.form-control-sm, .form-select-sm { padding: .3rem .6rem; font-size: .8rem; border-radius: 8px; }
/* Keep room for the dropdown arrow (the generic padding above would otherwise cover it). */
.form-select { padding-right: 2.25rem; background-position: right .7rem center; }
.form-select-sm { padding-right: 1.9rem; background-position: right .55rem center; }
.form-control-lg { padding: .7rem .9rem; font-size: 1rem; border-radius: 12px; }
.form-label { font-weight: 500; font-size: .82rem; color: var(--text-2); margin-bottom: .35rem; }
.form-text { color: var(--muted); font-size: .78rem; }
.form-check-input { border-color: var(--border-strong); background-color: var(--surface); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--ring); border-color: var(--primary); }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--muted); }
.req::after { content: " *"; color: var(--rose); }

/* Cards, modals, dropdowns, alerts */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); --bs-card-bg: var(--surface); --bs-card-cap-bg: transparent; }
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-weight: 600; padding: .85rem 1.1rem; font-size: .9rem; }
.card-header:first-child { border-radius: 14px 14px 0 0; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 14px 14px !important; }
.list-group { --bs-list-group-bg: transparent; --bs-list-group-border-color: var(--border); --bs-list-group-color: var(--text); --bs-list-group-action-hover-bg: var(--surface-2); --bs-list-group-action-hover-color: var(--text); }
.modal { --bs-modal-bg: var(--surface); --bs-modal-border-color: var(--border); --bs-modal-border-radius: 18px; --bs-modal-header-border-color: var(--border); --bs-modal-footer-border-color: var(--border); }
.modal-content { box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .35); }
.modal-title { font-weight: 600; font-size: 1.05rem; }
.modal-backdrop { --bs-backdrop-opacity: .4; backdrop-filter: blur(2px); }
.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--border); --bs-dropdown-link-color: var(--text-2); --bs-dropdown-link-hover-bg: var(--surface-3); --bs-dropdown-link-hover-color: var(--text); border-radius: 12px; padding: .35rem; font-size: .875rem; }
.dropdown-item { border-radius: 8px; padding: .45rem .7rem; }
.alert { border-radius: 12px; border: 1px solid transparent; font-size: .875rem; align-items: flex-start; }
.alert-success { background: var(--green-soft); color: var(--green-text); border-color: transparent; }
.alert-danger { background: var(--rose-soft); color: var(--rose-text); }
.alert-warning { background: var(--amber-soft); color: var(--amber-text); }
.alert-info { background: var(--blue-soft); color: var(--blue-text); }
.alert .bi { margin-top: .1rem; }
.toast { border-radius: 12px; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); }
.progress-bar { background: linear-gradient(90deg, var(--orange), #fbb040); border-radius: 99px; }

/* ============ Shell ============ */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 1040; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.15rem 1.25rem .9rem; color: var(--text); font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; display: inline-grid; place-items: center; flex-shrink: 0; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { color: var(--navy); } .brand-name b { color: var(--orange); font-weight: inherit; }
.brand-sm { padding: 0; }
.org-chip { display: flex; align-items: center; gap: .55rem; margin: 0 .9rem .6rem; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 10px; font-size: .82rem; font-weight: 500; color: var(--text-2); background: var(--surface-2); }
.org-dot { width: 22px; height: 22px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; font-size: .72rem; font-weight: 700; flex-shrink: 0; }
.sidebar nav { flex: 1; padding: .5rem .75rem; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-label { font-size: .7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: .6rem .7rem .35rem; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 9px; color: var(--text-2); font-weight: 500; font-size: .875rem; transition: background .12s, color .12s; }
.sidebar nav a i { font-size: 1.05rem; width: 1.15rem; text-align: center; color: var(--muted); }
.sidebar nav a:hover { background: var(--surface-3); color: var(--text); }
.sidebar nav a.active { background: var(--navy); color: #fff; font-weight: 600; box-shadow: 0 6px 16px -8px rgba(19, 40, 74, .55); }
.sidebar nav a.active i { color: var(--orange); }
.sidebar-foot { display: flex; align-items: center; gap: .4rem; padding: .75rem; border-top: 1px solid var(--border); }
.sidebar-foot .me { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; color: var(--text); padding: .35rem; border-radius: 10px; font-size: .85rem; }
.sidebar-foot .me:hover { background: var(--surface-3); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); display: inline-grid; place-items: center; font-size: .74rem; font-weight: 600; flex-shrink: 0; }
.avatar.light { width: 32px; height: 32px; }
.avatar-btn { border: 0; background: none; padding: 0; border-radius: 50%; }
.avatar-btn:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.icon-btn { border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; font-size: 1.1rem; flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.main { margin-left: 248px; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem; height: 60px; padding: 0 2rem; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1; max-width: 460px; margin-right: auto; }
.search > i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.search input { width: 100%; height: 38px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 0 4.2rem 0 2.2rem; font-size: .85rem; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; }
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.search kbd { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); background: var(--surface-3); color: var(--muted); border: 1px solid var(--border); font-size: .68rem; padding: .1rem .35rem; border-radius: 6px; font-family: inherit; }
.content { padding: 1.75rem 2rem 4rem; max-width: 1560px; margin: 0 auto; }
.sidebar-backdrop { display: none; }
.bottom-nav { display: none; }
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
    .nav-open .sidebar { transform: none; }
    .nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 1030; backdrop-filter: blur(2px); }
    .main { margin-left: 0; }
    .topbar { padding: 0 .75rem; gap: .4rem; }
    .search { max-width: none; }
    .search input { padding-right: .8rem; }
    .content { padding: 1.1rem 1rem calc(5.5rem + env(safe-area-inset-bottom)); }
    .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1025; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
    .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem 0 .45rem; color: var(--muted); font-size: .68rem; font-weight: 500; }
    .bottom-nav a i { font-size: 1.2rem; }
    .bottom-nav a.active { color: var(--primary-text); }
}

/* ============ Page bits ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; letter-spacing: -.03em; }
.page-head .sub { color: var(--muted); margin: .35rem 0 0; font-size: .875rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary-text); }
.section-title { font-size: 1.05rem; font-weight: 600; }
.small-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: .5rem .8rem; font-size: .875rem; }
.kv dt { color: var(--muted); font-weight: 500; } .kv dd { margin: 0; }
.empty { text-align: center; padding: 3.5rem 1.25rem; color: var(--muted); }
.empty > i { font-size: 1.6rem; color: var(--primary-text); background: var(--primary-soft); width: 56px; height: 56px; border-radius: 16px; display: inline-grid; place-items: center; margin-bottom: .9rem; }
.empty h5, .empty h6 { color: var(--text); font-weight: 600; }
.empty p { max-width: 440px; margin: .35rem auto 1.1rem; }

/* Stat cards (dashboard, vendor) */
.stat { padding: 1.1rem 1.2rem; display: flex; flex-direction: row; gap: .9rem; align-items: center; height: 100%; }
.stat .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.1rem; flex-shrink: 0; }
.stat .v { font-size: 1.4rem; font-weight: 700; line-height: 1.15; letter-spacing: -.03em; }
.stat .l { color: var(--muted); font-size: .8rem; }
.ic-blue { background: var(--blue-soft); color: var(--blue-text); } .ic-green { background: var(--green-soft); color: var(--green-text); }
.ic-amber { background: var(--amber-soft); color: var(--amber-text); } .ic-violet { background: var(--primary-soft); color: var(--primary-text); } .ic-rose { background: var(--rose-soft); color: var(--rose-text); }

/* KPI strip (project page) */
.kpis { display: grid; grid-template-columns: 1.3fr repeat(4, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); overflow: hidden; }
.kpi { padding: 1rem 1.25rem; border-left: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; gap: .25rem; color: var(--text); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-l { font-size: .78rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.kpi-v { font-size: 1.45rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-v-sm { font-size: 1.05rem; }
.kpi-s { font-size: .8rem; color: var(--muted); }
.kpi-ring { flex-direction: row; align-items: center; justify-content: flex-start; gap: .9rem; }
.kpi-link:hover { background: var(--surface-2); color: var(--text); }
.ring { --p: 0; width: 54px; height: 54px; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; flex-shrink: 0; }
.ring span { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: .78rem; font-weight: 700; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-pending { background: var(--muted); } .dot-sent { background: var(--blue); }

/* Project cards */
.project-card { display: block; color: inherit; transition: box-shadow .2s, transform .2s, border-color .2s; height: 100%; }
.project-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; border-color: var(--border-strong); }
.project-card h6 { font-size: .98rem; }

/* Pills, tags, status */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 99px; font-size: .72rem; font-weight: 600; background: var(--gray-soft); color: var(--gray-text); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill-active { background: var(--green-soft); color: var(--green-text); } .pill-planning { background: var(--primary-soft); color: var(--primary-text); }
.pill-on_hold { background: var(--amber-soft); color: var(--amber-text); } .pill-completed { background: var(--gray-soft); color: var(--gray-text); }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 6px; font-size: .72rem; font-weight: 500; color: var(--tag); background: color-mix(in srgb, var(--tag) 10%, transparent); border: 1px solid color-mix(in srgb, var(--tag) 22%, transparent); margin: 1px 3px 1px 0; white-space: nowrap; }
.st { display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.st-pending { background: var(--gray-soft); color: var(--gray-text); } .st-sent { background: var(--blue-soft); color: var(--blue-text); }
.st-partial { background: var(--amber-soft); color: var(--amber-text); } .st-done { background: var(--green-soft); color: var(--green-text); }
.mb { display: inline-flex; gap: .3rem; align-items: center; padding: .12rem .5rem; border-radius: 6px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.mb-make { background: color-mix(in srgb, #0891b2 12%, transparent); color: #0e7490; } .mb-buy { background: color-mix(in srgb, #c026d3 12%, transparent); color: #a21caf; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 12px; padding: 4px; background: var(--surface-3); gap: 4px; }
.seg input { display: none; }
.seg label { padding: .45rem 1rem; border-radius: 9px; cursor: pointer; font-weight: 500; font-size: .85rem; color: var(--muted); margin: 0; transition: background .15s, color .15s; }
.seg input:checked + label { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.badge { font-weight: 600; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); --bs-table-hover-bg: var(--surface-2); --bs-table-hover-color: var(--text); }
.table-pm { margin: 0; white-space: nowrap; font-size: .865rem; }
.table-pm thead th { background: var(--surface-2); font-size: .75rem; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); padding: .6rem .8rem; position: sticky; top: 0; z-index: 1; }
.table-pm td { padding: .6rem .8rem; vertical-align: middle; border-color: var(--border); }
.table-pm tbody tr { transition: background .1s; }
.table-pm tbody tr:hover > td { background: var(--surface-2); }
.table-pm tbody tr:last-child td { border-bottom: 0; }
.table-pm .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-warning > td { background: var(--amber-soft) !important; }
.part-no { font-family: var(--f-mono); font-size: .82rem; font-weight: 600; color: var(--primary-text); }
a.part-no:hover { text-decoration: underline; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); padding: 0; transition: all .12s; }
.file-btn:hover { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }
.file-btn.none { color: var(--border-strong); border-style: dashed; pointer-events: none; background: transparent; }
.qty-ctl { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.qty-ctl button { border: 0; background: transparent; width: 26px; height: 28px; color: var(--muted); padding: 0; font-size: 1rem; }
.qty-ctl button:hover { background: var(--primary-soft); color: var(--primary-text); }
.qty-ctl input { width: 44px; border: 0; text-align: center; height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; background: transparent; color: var(--text); -moz-appearance: textfield; }
.qty-ctl input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty-ctl input:focus { outline: none; background: var(--surface-2); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.filters .form-control, .filters .form-select { max-width: 200px; }
.bulk-bar { display: none; align-items: center; gap: .5rem; padding: .6rem 1rem; background: var(--primary-soft); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.bulk-bar.show { display: flex; }

/* Tabs */
.nav-tabs-pm { border-bottom: 1px solid var(--border); gap: .25rem; margin-bottom: 1.25rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav-tabs-pm::-webkit-scrollbar { display: none; }
.nav-tabs-pm .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; padding: .65rem .85rem; border-radius: 0; white-space: nowrap; font-size: .875rem; display: inline-flex; gap: .4rem; align-items: center; background: none; }
.nav-tabs-pm .nav-link:hover { color: var(--text); }
.nav-tabs-pm .nav-link.active { color: var(--navy); font-weight: 600; border-bottom-color: var(--orange); }
.nav-tabs-pm .nav-link .badge { background: var(--surface-3); color: var(--muted); font-weight: 600; font-size: .68rem; }
.nav-tabs-pm .nav-link.active .badge { background: var(--primary-soft); color: var(--primary-text); }

/* Versions timeline */
.final-card { border-color: color-mix(in srgb, var(--green) 35%, var(--border)); background: linear-gradient(135deg, var(--green-soft), var(--surface) 60%); }
.final-badge { width: 48px; height: 48px; border-radius: 14px; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 1.4rem; flex-shrink: 0; box-shadow: 0 6px 16px -6px rgba(22, 163, 74, .6); }
.timeline { position: relative; padding-left: 2.6rem; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; background: var(--border); border-radius: 2px; }
.tl-item { position: relative; margin-bottom: .9rem; }
.tl-dot { position: absolute; left: -2.6rem; top: .9rem; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: var(--muted); }
.tl-item:first-child .tl-dot { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }
.tl-item.is-final .tl-dot { border-color: var(--green); background: var(--green); color: #fff; }
.tl-desc { margin-top: .7rem; white-space: pre-line; font-size: .875rem; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .85rem; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1.6rem 1rem; border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); cursor: pointer; text-align: center; transition: all .15s; margin: 0; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--primary); }
.dropzone > i { font-size: 1.8rem; color: var(--primary-text); }
.dz-title { font-weight: 600; font-size: .9rem; word-break: break-all; }
.dz-sub { font-size: .78rem; color: var(--muted); }

/* Search results */
.result-group { margin-bottom: 1.5rem; }
.result-item { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
.result-item:last-child { border-bottom: 0; }
.result-item:hover { background: var(--surface-2); color: var(--text); }
.result-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--primary-soft); color: var(--primary-text); }
mark { background: color-mix(in srgb, #facc15 40%, transparent); color: inherit; padding: 0 .1em; border-radius: 3px; }

/* 3D viewer */
.viewer-box { position: relative; background: radial-gradient(ellipse at 50% 30%, var(--viewer-a), var(--viewer-b)); border-radius: 14px; overflow: hidden; min-height: 420px; }
.viewer-box canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }
.viewer-toolbar { position: absolute; top: 12px; left: 12px; display: flex; gap: 2px; z-index: 5; flex-wrap: wrap; padding: 3px; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-sm); }
.viewer-toolbar button { background: transparent; border: 0; border-radius: 8px; padding: .3rem .55rem; font-size: .78rem; font-weight: 500; color: var(--text-2); }
.viewer-toolbar button:hover { background: var(--surface-3); }
.viewer-toolbar button.on { background: var(--navy); color: #fff; }
.viewer-status { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); z-index: 4; pointer-events: none; padding: 1rem; }
.viewer-hint { position: absolute; bottom: 10px; left: 12px; font-size: .72rem; color: var(--muted); z-index: 5; pointer-events: none; }
.viewer-pick { position: absolute; bottom: 12px; right: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .45rem .75rem; font-size: .8rem; z-index: 5; max-width: 60%; box-shadow: var(--shadow); }
.node-list { max-height: 520px; overflow: auto; }
.node-item { display: flex; align-items: center; gap: .55rem; padding: .5rem .85rem; border-bottom: 1px solid var(--border); cursor: pointer; font-size: .83rem; }
.node-item:hover { background: var(--surface-2); }
.node-item.sel { background: var(--amber-soft); box-shadow: inset 3px 0 0 #f97316; }
.node-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawing-frame { width: 100%; height: 70vh; border: 0; background: var(--surface-2); display: block; }
.viewer-page { margin: 0; background: var(--bg); overflow: hidden; }
.viewer-bar { height: 52px; display: flex; align-items: center; gap: .6rem; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }

/* ============ Auth ============ */
.auth { min-height: 100vh; background:
    radial-gradient(900px 500px at 10% -10%, color-mix(in srgb, #f7941d 16%, transparent), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, color-mix(in srgb, #13284a 10%, transparent), transparent 60%), var(--bg); }
.auth::before { content: ""; position: fixed; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle at 50% 30%, black, transparent 70%); -webkit-mask-image: radial-gradient(circle at 50% 30%, black, transparent 70%); opacity: .5; pointer-events: none; }
.auth-wrap { position: relative; max-width: 440px; margin: 0 auto; padding: 8vh 1rem 2rem; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .6rem; font-size: 1.25rem; font-weight: 700; margin-bottom: 1.6rem; letter-spacing: -.02em; }
.auth-brand .brand-mark { width: 38px; height: 38px; }
.auth-card { background: var(--surface); border-radius: 20px; padding: 2rem; box-shadow: var(--shadow); border: 1px solid var(--border); }
.auth-card h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.03em; }
.auth-foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 1.4rem; }
.otp-input { font-size: 1.8rem; letter-spacing: .6rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ============ Phones ============ */
@media (max-width: 1199px) {
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .kpi { border-left: 0; border-top: 1px solid var(--border); }
    .kpi-ring { grid-column: 1 / -1; border-top: 0; }
    .kpi:nth-child(odd):not(.kpi-ring) { border-left: 1px solid var(--border); }
}
@media (max-width: 767px) {
    .page-head { align-items: flex-start; margin-bottom: 1.1rem; }
    .page-head h1 { font-size: 1.3rem; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1 1 auto; }
    .stat { padding: .85rem; gap: .65rem; }
    .stat .ic { width: 34px; height: 34px; font-size: .95rem; border-radius: 10px; }
    .stat .v { font-size: 1.15rem; }
    .kpi { padding: .8rem 1rem; }
    .kpi-v { font-size: 1.2rem; }
    .filters .form-control, .filters .form-select, .filters .input-group { max-width: none !important; flex: 1 1 45%; }
    .filters .input-group { flex-basis: 100%; }
    .table-wrap { max-height: none !important; }
    .table-pm.stack { white-space: normal; }
    .table-pm.stack thead { display: none; }
    .table-pm.stack, .table-pm.stack tbody, .table-pm.stack tfoot { display: block; }
    .table-pm.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: .15rem .9rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); position: relative; }
    .table-pm.stack tr[hidden] { display: none; }
    .table-pm.stack td { display: flex; flex-direction: column; align-items: flex-start; border: 0; padding: .25rem 0; text-align: left !important; max-width: none !important; min-width: 0; background: transparent !important; }
    .table-pm.stack td::before { content: attr(data-label); font-size: .68rem; color: var(--muted); font-weight: 500; margin-bottom: .1rem; }
    .table-pm.stack td:first-child, .table-pm.stack td.full { grid-column: 1 / -1; }
    .table-pm.stack td[data-label=""]::before { display: none; }
    .table-pm.stack td:has(> input.sel) { position: absolute; top: .9rem; right: 1rem; padding: 0; }
    .table-pm.stack td:has(> input.sel) + td { grid-column: 1 / -1; padding-right: 2rem; }
    .table-pm.stack tfoot tr { display: flex; justify-content: space-between; }
    .table-pm.stack tfoot td::before { display: none; }
    .qty-ctl button { width: 36px; height: 36px; }
    .qty-ctl input { height: 36px; width: 52px; }
    .file-btn { width: 38px; height: 38px; }
    .bulk-bar { position: sticky; top: 60px; z-index: 5; }
    .viewer-toolbar button { padding: .4rem .6rem; }
    .viewer-pick { max-width: calc(100% - 24px); left: 12px; }
    .kv { grid-template-columns: 105px 1fr; }
    .auth-card { padding: 1.5rem; border-radius: 18px; }
    .seg { display: flex; } .seg label { flex: 1; text-align: center; padding: .5rem .4rem; }
    .drawing-frame { height: 60vh; }
    .timeline { padding-left: 2.2rem; }
    .tl-dot { left: -2.2rem; width: 28px; height: 28px; }
    .timeline::before { left: 13px; }
}

/* Platform: sign-up bars */
.signup-chart { display: flex; align-items: flex-end; gap: 10px; height: 160px; }
.sc-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.sc-bar { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--orange), #fbb040); border-radius: 6px 6px 2px 2px; }
.sc-n { font: 600 .78rem var(--f-head); color: var(--navy); }
.sc-m { font-size: .72rem; color: var(--muted); }

/* Support access banner (platform admin viewing a company) */
.support-bar { position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 1060; display: flex; align-items: center; gap: .6rem; padding: 0 1rem; background: var(--orange); color: var(--navy); font-size: .875rem; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.support-bar > i { font-size: 1.1rem; }
.impersonating .sidebar { top: 44px; }
.impersonating .main { padding-top: 44px; }
.impersonating .topbar { top: 44px; }
.viewer-note { position: absolute; top: 56px; left: 12px; right: 12px; max-width: 560px; z-index: 5; background: var(--amber-soft); color: var(--amber-text); border-radius: 10px; padding: .45rem .7rem; font-size: .8rem; box-shadow: var(--shadow-sm); }
