:root {
    --brand: #b8741f;
    --ink: #1c1712;
    --side: #1f1a15;
    --side-2: #2a231c;
    --gold: #e8a33d;
    --champagne: #f7eaa8;
    --bg: #f5f3ef;
    --purple: #6f42c1;
}
html { font-size: 14.5px; }
body.office { background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: color-mix(in srgb, var(--brand) 85%, black); }
.btn-primary, .btn-brand { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: color-mix(in srgb, var(--brand) 85%, black); --bs-btn-hover-border-color: color-mix(in srgb, var(--brand) 85%, black); --bs-btn-active-bg: color-mix(in srgb, var(--brand) 75%, black); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); color: #fff; }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }
.text-brand { color: var(--brand) !important; }
.bg-brand { background: var(--brand) !important; color: #fff; }
.text-bg-purple { background: var(--purple) !important; color: #fff !important; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 25%, transparent); }
.nav-pills .nav-link.active { background: var(--brand); }
.nav-tabs .nav-link.active { border-top: 3px solid var(--brand); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.page-link { color: var(--brand); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 1030; height: 56px; display: flex; align-items: center; gap: 1rem; padding: 0 1rem; background: linear-gradient(90deg, #0f0c09, #241c14); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 2px 8px rgba(0,0,0,.25); }
.topbar .brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; width: 210px; }
.topbar .brand img { height: 30px; }
.topbar .brand span { font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: .8rem; color: var(--champagne); border-left: 1px solid rgba(255,255,255,.2); padding-left: .5rem; }
.topsearch { align-items: center; background: rgba(255,255,255,.08); border-radius: 8px; padding: 0 .6rem; width: min(420px, 35vw); }
.topsearch input { background: transparent; border: 0; color: #fff; padding: .4rem .5rem; width: 100%; outline: none; }
.topsearch input::placeholder { color: rgba(255,255,255,.45); }
.topsearch i { color: rgba(255,255,255,.5); }
.role-switch select { width: auto; background-color: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }
.role-switch select option { color: #000; }
.avatar-btn { color: #fff; border: 0; }
.avatar-btn:hover, .avatar-btn:focus, .avatar-btn.show { color: #fff; }
.avatar { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: 600; font-size: .8rem; }

/* shell */
.shell { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 226px; flex: 0 0 226px; background: var(--side); color: #d8d0c5; padding: .75rem 0; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(255,255,255,.4); padding: .9rem 1.1rem .3rem; }
.sidebar .nav-item { display: flex; align-items: center; gap: .65rem; padding: .42rem 1.1rem; color: #d8d0c5; text-decoration: none; border-left: 3px solid transparent; }
.sidebar .nav-item:hover { background: var(--side-2); color: #fff; }
.sidebar .nav-item.active { background: var(--side-2); color: #fff; border-left-color: var(--brand); }
.sidebar .nav-item i { width: 18px; text-align: center; color: color-mix(in srgb, var(--brand) 70%, white); }
.sidebar .nav-badge { margin-left: auto; background: #c0392b; color: #fff; border-radius: 10px; font-size: .7rem; padding: 0 .45rem; }
.sidebar-foot { margin-top: auto; padding: 1rem 1.1rem 0; font-size: .75rem; }
.content { flex: 1; padding: 1.25rem 1.5rem 3rem; min-width: 0; }
@media (max-width: 900px) { .sidebar { display: none; } .topbar .brand { width: auto; } }

/* page bits */
.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.45rem; font-weight: 650; margin: 0; }
.page-head .sub { color: #7a7067; font-size: .9rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.crumbs { font-size: .8rem; color: #8a8076; margin-bottom: .2rem; }
.crumbs a { color: #8a8076; text-decoration: none; }
.card { border: 1px solid #e6e0d7; border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card-header { background: #fff; font-weight: 600; border-bottom: 1px solid #eee7dd; border-radius: 10px 10px 0 0 !important; display: flex; align-items: center; gap: .5rem; }
.card-header .ms-auto { font-weight: 400; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #8a8076; font-weight: 600; border-bottom-width: 1px; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { --bs-table-bg-state: #faf7f2; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: .92em; }
.muted { color: #8a8076; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.filters .form-control, .filters .form-select { width: auto; min-width: 160px; }
.kpi { background: #fff; border: 1px solid #e6e0d7; border-radius: 10px; padding: .9rem 1rem; height: 100%; text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: var(--brand); }
.kpi .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #8a8076; }
.kpi .value { font-size: 1.7rem; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: .8rem; color: #8a8076; }
.kpi.alert-kpi .value { color: #b02a37; }
.stat-row { display: flex; justify-content: space-between; padding: .3rem 0; border-bottom: 1px dashed #eee7dd; }
.stat-row:last-child { border-bottom: 0; }
.stat-row .k { color: #7a7067; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.dl-grid dt { color: #7a7067; font-weight: 500; }
.dl-grid dd { margin: 0; }
.badge.text-bg-warning { color: #4a3500 !important; }
.empty { text-align: center; color: #8a8076; padding: 2rem; }

/* job board */
.board { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.board-col { flex: 0 0 245px; background: #ece7df; border-radius: 10px; padding: .5rem; }
.board-col h6 { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; margin: .25rem .25rem .6rem; display: flex; justify-content: space-between; color: #5c534a; }
.job-card { background: #fff; border-radius: 8px; padding: .6rem .7rem; margin-bottom: .5rem; border: 1px solid #e2dbd0; border-left: 4px solid var(--brand); display: block; text-decoration: none; color: inherit; font-size: .85rem; }
.job-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); color: inherit; }
.job-card .jn { font-weight: 650; }
.job-card .cust { color: #5c534a; }
.progress { height: 6px; }
.progress-bar { background: var(--brand); }
.milestones .ms { display: flex; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid #f0ebe3; align-items: flex-start; }
.milestones .ms:last-child { border-bottom: 0; }
.milestones .ms i { font-size: 1.15rem; }
.photo-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid #ddd; }

/* configurator */
.cfg-line { border: 1px solid #e6e0d7; border-radius: 10px; background: #fff; margin-bottom: 1rem; }
.cfg-line .cfg-head { padding: .75rem 1rem; border-bottom: 1px solid #eee7dd; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; background: #fbf9f6; border-radius: 10px 10px 0 0; }
.opt-row { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; border-bottom: 1px dashed #eee7dd; }
.opt-row:last-child { border-bottom: 0; }
.opt-row .opt-name { flex: 1; }
.opt-row .opt-price { width: 90px; text-align: right; color: #7a7067; font-size: .85rem; }
.opt-row.disabled { opacity: .45; }
.opt-row input[type=number] { width: 70px; }
.sticky-summary { position: sticky; top: 72px; }
.meter { height: 8px; background: #eee7dd; border-radius: 4px; overflow: hidden; }
.meter > div { height: 100%; background: #2e8b57; }
.meter > div.warn { background: #e0a100; }
.meter > div.over { background: #c0392b; }

/* timeline / activity */
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid #f0ebe3; font-size: .88rem; }
.feed li:last-child { border-bottom: 0; }
.feed i { color: var(--brand); }
.feed .t { margin-left: auto; color: #9a9087; white-space: nowrap; font-size: .78rem; }

/* print views */
.doc { background: #fff; max-width: 900px; margin: 0 auto; padding: 2.5rem 3rem; border: 1px solid #e6e0d7; border-radius: 6px; }
.doc .doc-head { display: flex; justify-content: space-between; border-bottom: 3px solid var(--brand); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.doc .doc-head img { height: 48px; background: #111; padding: 6px 10px; border-radius: 6px; }
.doc h2 { font-size: 1.6rem; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); }
@media print {
    body.office { background: #fff; }
    .topbar, .sidebar, .d-print-none { display: none !important; }
    .content { padding: 0; }
    .doc { border: 0; padding: 0; max-width: none; }
}

/* labels */
.label-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.part-label { border: 1px dashed #bbb; border-radius: 6px; padding: 8px 10px; background: #fff; text-align: center; page-break-inside: avoid; }
.part-label img { max-width: 100%; height: 56px; }
.part-label .d { font-size: .75rem; line-height: 1.2; height: 2.4em; overflow: hidden; }
.part-label .b { font-weight: 700; font-size: .8rem; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 30% 20%, #3a2c1d, #0f0c09 70%); padding: 1rem; }
.login-card { background: #fff; border-radius: 14px; width: 100%; max-width: 440px; padding: 2rem; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login-card .logo { background: #111; border-radius: 10px; padding: 14px; text-align: center; margin: -0.5rem -0.5rem 1.5rem; }
.login-card .logo img { height: 46px; }
.user-pick { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border: 1px solid #eee; border-radius: 8px; margin-bottom: .35rem; cursor: pointer; background: #fff; width: 100%; text-align: left; }
.user-pick:hover { border-color: var(--brand); background: #fdfaf5; }
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.photo-tile { position: relative; display: block; border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; background: #222; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.photo-tile:hover img { transform: scale(1.04); }
.photo-tile span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 7px; color: #fff; font-size: .72rem; line-height: 1.2; background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.photo-tile small { color: rgba(255,255,255,.75); }
.photo-grid.wide { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .photo-grid.wide { grid-template-columns: repeat(2, 1fr); } }
.viz-root { --surface-1: #ffffff; --text-primary: #1c1712; --text-secondary: #7a7067; --grid: #efe9e1;
    --series-0: #b8741f; --series-1: #257de0; --series-2: #f47230; --series-3: #00b894; --series-4: #f2a600; --series-9: #8a8076; }
.chart-card .card-header .sub { font-weight: 400; color: var(--text-secondary); font-size: .8rem; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 300px; }
.chart-table { display: none; max-height: 300px; overflow: auto; }
.chart-card.show-table .chart-box { display: none; }
.chart-card.show-table .chart-table { display: block; }

/* Assistant */
.ai-fab { position: fixed; right: 22px; bottom: 22px; z-index: 1040; border-radius: 28px; padding: .7rem 1.1rem; box-shadow: 0 6px 24px rgba(0,0,0,.22); background: #16120e; color: #fff; border: 0; display: flex; gap: .5rem; align-items: center; font-weight: 600; }
.ai-fab:hover { background: #2a231b; color: #fff; }
.ai-fab i { color: #d9a35c; font-size: 1.15rem; }
.ai-panel { position: fixed; right: 22px; bottom: 22px; z-index: 1045; width: 440px; max-width: calc(100vw - 30px); height: 640px; max-height: calc(100vh - 40px); display: none; flex-direction: column;
    background: #fff; border-radius: 14px; box-shadow: 0 12px 48px rgba(0,0,0,.28); overflow: hidden; }
.ai-panel.open { display: flex; }
.ai-panel.wide { width: 720px; height: calc(100vh - 40px); }
.ai-head { background: #16120e; color: #fff; padding: .7rem .9rem; display: flex; align-items: center; gap: .5rem; }
.ai-head .t { font-weight: 650; }
.ai-head .s { font-size: .72rem; color: #c9b9a3; }
.ai-head button { background: none; border: 0; color: #c9b9a3; font-size: 1.05rem; padding: .2rem .35rem; }
.ai-head button:hover { color: #fff; }
.ai-body { flex: 1; overflow-y: auto; padding: .9rem; background: #faf8f5; }
.ai-msg { margin-bottom: .75rem; display: flex; }
.ai-msg .b { padding: .55rem .8rem; border-radius: 12px; max-width: 92%; font-size: .9rem; line-height: 1.45; overflow-x: auto; }
.ai-msg.user { justify-content: flex-end; }
.ai-msg.user .b { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.bot .b { background: #fff; border: 1px solid #ebe4da; border-bottom-left-radius: 4px; }
.ai-msg.bot .b p { margin: 0 0 .45rem; }
.ai-msg.bot .b p:last-child { margin-bottom: 0; }
.ai-msg.bot .b ul, .ai-msg.bot .b ol { padding-left: 1.2rem; margin: .2rem 0 .45rem; }
.ai-msg.bot .b table { font-size: .8rem; border-collapse: collapse; margin: .3rem 0 .5rem; }
.ai-msg.bot .b th, .ai-msg.bot .b td { border-bottom: 1px solid #eee7dd; padding: .2rem .45rem; text-align: left; white-space: nowrap; }
.ai-msg.bot .b th { color: #7a7067; font-weight: 600; }
.ai-tools { font-size: .72rem; color: #8a8076; margin-top: .25rem; }
.ai-typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: #b8a58c; animation: aiblink 1.2s infinite; }
.ai-typing span:nth-child(2) { animation-delay: .2s; } .ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aiblink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ai-suggest { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.ai-suggest button { border: 1px solid #e3d9cb; background: #fff; border-radius: 16px; font-size: .78rem; padding: .25rem .65rem; color: #4a4037; }
.ai-suggest button:hover { border-color: var(--brand); color: var(--brand); }
.ai-foot { border-top: 1px solid #ebe4da; padding: .6rem; display: flex; gap: .4rem; background: #fff; }
.ai-foot textarea { resize: none; height: 42px; font-size: .9rem; }
.ai-mode { font-size: .7rem; padding: .3rem .9rem; background: #fff6e8; color: #8a5a12; border-bottom: 1px solid #f1e2c8; }
@media print { .ai-fab, .ai-panel { display: none !important; } }
