:root {
  --font-ui: "Roboto", Arial, sans-serif;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #fbfdff;
  --ink: #14213d;
  --ink-strong: #0b4d99;
  --muted: #64748b;
  --line: #c8d8ef;
  --line-strong: #b8d4f5;
  --brand: #0757b8;
  --brand-soft: #edf5ff;
  --brand-muted: #4f9ceb;
  --blue: #0757b8;
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --violet: #6d28d9;
  --shadow: 0 14px 32px rgba(25, 55, 95, 0.12);
  --shadow-soft: 0 8px 18px rgba(22, 52, 88, 0.12);
  /* Capacitor SystemBars supplies the custom values on Android; env() keeps
     standalone Web/PWA and future iOS safe-area support intact. */
  --bms-safe-area-top: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
  --bms-safe-area-right: max(env(safe-area-inset-right, 0px), var(--safe-area-inset-right, 0px));
  --bms-safe-area-bottom: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
  --bms-safe-area-left: max(env(safe-area-inset-left, 0px), var(--safe-area-inset-left, 0px));
}

/* Internal feedback center */
.feedback-nav-item{display:flex;align-items:center;justify-content:space-between;gap:8px}.feedback-nav-badge,.task-nav-badge{min-width:20px;padding:2px 6px;border-radius:999px;background:var(--bms-danger);color:white;font-size:10px;font-weight:800;line-height:16px;text-align:center}
.feedback-nav-item[hidden],.feedback-nav-badge[hidden],.task-nav-badge[hidden]{display:none}
.flow-strip[hidden]{display:none!important}
.feedback-center-panel{position:relative}.feedback-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:16px}.feedback-metrics article{padding:16px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}.feedback-metrics span{display:block;color:var(--muted);font-size:12px}.feedback-metrics strong{display:block;margin-top:5px;font-size:24px}
.feedback-filters{display:grid;grid-template-columns:repeat(4,minmax(150px,1fr));gap:12px;margin-bottom:16px;padding:16px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}.feedback-filters label,.feedback-admin-form label{display:grid;gap:6px;color:var(--muted);font-size:12px;font-weight:700}.feedback-filters input,.feedback-filters select,.feedback-admin-form input,.feedback-admin-form select,.feedback-admin-form textarea{width:100%;padding:9px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink)}.feedback-filter-actions{display:flex;align-items:end;gap:8px}
.feedback-table th button{border:0;background:none;color:inherit;font:inherit;font-weight:700;cursor:pointer}.feedback-table tbody tr{cursor:pointer}.feedback-table tbody tr:hover{background:rgba(37,99,235,.06)}.feedback-table tbody tr.feedback-unread td:first-child{border-left:3px solid #2563eb}.feedback-table td small{display:block;color:var(--muted)}
.feedback-status,.feedback-severity{display:inline-flex;padding:4px 8px;border-radius:999px;background:#e5e7eb;color:#374151;font-size:11px;font-weight:800;white-space:nowrap}.feedback-status.new{background:#dbeafe;color:#1d4ed8}.feedback-status.received,.feedback-status.analyzing{background:#fef3c7;color:#92400e}.feedback-status.planned,.feedback-status.in_progress{background:#ede9fe;color:#6d28d9}.feedback-status.waiting_test{background:#cffafe;color:#0e7490}.feedback-status.completed{background:#dcfce7;color:#166534}.feedback-status.rejected,.feedback-status.duplicate{background:#fee2e2;color:#991b1b}.feedback-severity.low{background:#ecfdf5;color:#047857}.feedback-severity.medium{background:#fef3c7;color:#92400e}.feedback-severity.high,.feedback-severity.blocking{background:#fee2e2;color:#b91c1c}
.feedback-pagination{display:flex;align-items:center;justify-content:center;gap:12px;margin-top:14px}.feedback-detail{position:fixed;z-index:1002;inset:3vh 3vw;overflow:auto;padding:20px;border:1px solid var(--line);border-radius:16px;background:var(--surface);box-shadow:0 24px 80px rgba(15,23,42,.28)}.feedback-detail>header{position:sticky;z-index:2;top:-20px;display:flex;align-items:start;justify-content:space-between;margin:-20px -20px 18px;padding:20px;background:var(--surface);border-bottom:1px solid var(--line)}.feedback-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.feedback-facts>div{padding:10px;border:1px solid var(--line);border-radius:9px}.feedback-facts span{display:block;color:var(--muted);font-size:11px}.feedback-facts strong{display:block;margin-top:4px;overflow-wrap:anywhere}.feedback-content-card{margin:16px 0;padding:16px;border:1px solid var(--line);border-radius:12px}.feedback-content-card p{white-space:pre-wrap;overflow-wrap:anywhere}.feedback-attachments{display:flex;flex-wrap:wrap;gap:8px}.feedback-attachments button{padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);cursor:pointer}.feedback-admin-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:18px 0;padding:16px;border:1px solid var(--line);border-radius:12px}.feedback-admin-form .feedback-wide{grid-column:1/-1}.feedback-history{display:grid;gap:9px;padding:0;list-style:none}.feedback-history li{padding:11px;border-left:3px solid #93c5fd;background:rgba(219,234,254,.25)}.feedback-history li>div{display:flex;justify-content:space-between;gap:12px}.feedback-history p{margin:5px 0;white-space:pre-wrap}.feedback-history small{color:#b45309}
@media(max-width:900px){.feedback-metrics{grid-template-columns:repeat(2,1fr)}.feedback-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.feedback-facts{grid-template-columns:1fr 1fr}.feedback-detail{inset:1vh 2vw}.feedback-table-wrap{overflow:auto}.feedback-table{min-width:1050px}}
@media(max-width:560px){.feedback-metrics,.feedback-filters,.feedback-facts,.feedback-admin-form{grid-template-columns:1fr}.feedback-admin-form .feedback-wide{grid-column:auto}.feedback-detail{inset:0;padding:14px;border-radius:0}.feedback-detail>header{top:-14px;margin:-14px -14px 14px;padding:14px}.feedback-filter-actions{align-items:stretch}}

.fg-panel{position:relative}.fg-header,.fg-toolbar,.fg-batches>header{display:flex;align-items:center;justify-content:space-between;gap:18px}.fg-header{padding:4px 2px 18px}.fg-header h2{margin:3px 0 5px;color:#074b9b}.fg-header p{margin:0;color:#64748b}.fg-header-actions{display:flex;align-items:end;gap:10px}.fg-header-actions label,.fg-delivery-panel label{display:grid;gap:5px;color:#64748b;font-size:12px;font-weight:700}.fg-header-actions select{min-width:260px}.fg-metrics{display:grid;grid-template-columns:repeat(5,minmax(130px,1fr));gap:12px;margin-bottom:14px}.fg-metric{padding:14px 16px;border:1px solid #c9dcf5;border-radius:12px;background:linear-gradient(145deg,#fff,#f4f8ff)}.fg-metric span{display:block;color:#64748b;font-size:12px}.fg-metric strong{display:block;margin-top:5px;color:#073b78;font-size:24px}.fg-workspace{display:grid;grid-template-columns:minmax(0,1fr) 290px;gap:14px}.fg-main-card,.fg-delivery-panel,.fg-batches{border:1px solid #c9dcf5;border-radius:12px;background:#fff}.fg-main-card{min-width:0}.fg-toolbar{padding:12px}.fg-table-wrap{max-height:480px}.fg-table{min-width:1520px}.fg-table thead{position:sticky;top:0;z-index:2}.fg-table th,.fg-table td{font-size:12px;white-space:nowrap}.fg-table td:nth-child(n+5):nth-child(-n+12){text-align:right}.fg-product-cell{display:grid;gap:2px;white-space:normal;min-width:190px}.fg-product-cell small{color:#64748b}.fg-actions{display:flex;gap:5px;flex-wrap:wrap}.fg-actions .btn{padding:6px 9px;font-size:11px}.fg-delivery-panel{padding:17px;display:flex;flex-direction:column;gap:12px;background:linear-gradient(160deg,#f4f8ff,#fff)}.fg-delivery-icon{display:grid;place-items:center;width:42px;height:42px;border-radius:12px;background:#dbeafe;font-size:22px}.fg-delivery-panel h3{margin:0;color:#0b4f9f}.fg-delivery-summary{display:grid;grid-template-columns:1fr 1fr;gap:8px}.fg-delivery-summary div{padding:9px;border:1px solid #d8e5f7;border-radius:8px}.fg-delivery-summary span{display:block;color:#64748b;font-size:11px}.fg-delivery-summary strong{font-size:17px;color:#12305b}.fg-batches{margin-top:14px;padding:14px}.fg-batches h3{margin:0;color:#0b4f9f}.fg-batch-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:10px;margin-top:12px}.fg-batch{border:1px solid #d8e5f7;border-radius:10px;padding:12px;display:grid;gap:7px}.fg-batch header{display:flex;justify-content:space-between}.fg-batch p{margin:0;color:#64748b;font-size:12px}.fg-batch .toolbar{gap:6px;flex-wrap:wrap}.fg-status{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:4px 8px;background:#eef2f7;color:#334155;font-weight:700;font-size:11px}.fg-status.available,.fg-status.dispatched{background:#dcfce7;color:#166534}.fg-status.blocked{background:#fee2e2;color:#991b1b}.fg-status.partially_reserved,.fg-status.reserved,.fg-status.ready_to_dispatch{background:#dbeafe;color:#1d4ed8}.fg-drawer-form{display:grid;gap:12px}.fg-drawer-form .form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.fg-history{display:grid;gap:8px}.fg-movement{padding:10px;border:1px solid #d8e5f7;border-radius:8px}.fg-movement strong,.fg-movement span{display:block}.fg-movement small{color:#64748b}
@media(max-width:1100px){.fg-metrics{grid-template-columns:repeat(3,1fr)}.fg-workspace{grid-template-columns:1fr}.fg-delivery-panel{display:grid;grid-template-columns:repeat(2,1fr)}.fg-delivery-panel>*{min-width:0}}@media(max-width:720px){.fg-header,.fg-header-actions,.fg-toolbar{align-items:stretch;flex-direction:column}.fg-metrics{grid-template-columns:repeat(2,1fr)}.fg-delivery-panel{display:flex}.fg-drawer-form .form-grid{grid-template-columns:1fr}}

.ar-panel{position:relative}
.ar-header,.ar-toolbar{display:flex;justify-content:space-between;align-items:center;gap:14px}
.ar-header{padding:4px 2px 18px}
.ar-header h2{margin:3px 0}
.ar-header p{margin:0;color:var(--muted)}
.ar-header-actions{display:flex;gap:8px;flex-wrap:wrap}
.ar-metrics{display:grid;grid-template-columns:repeat(5,minmax(125px,1fr));gap:10px;margin-bottom:14px}
.ar-metric{padding:13px 15px;border:1px solid var(--line);border-radius:11px;background:var(--surface)}
.ar-metric span{display:block;color:var(--muted);font-size:11px}
.ar-metric strong{display:block;margin-top:4px;font-size:20px}
.ar-workspace{display:block;min-width:0}
.ar-main-card{min-width:0;overflow:hidden;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.ar-toolbar{padding:12px}
.ar-detail-nav{display:flex;align-items:end;justify-content:space-between;gap:14px;padding:0 12px;border-bottom:1px solid var(--line);background:var(--surface-soft)}
.ar-tabs{display:flex;flex:1 1 auto;gap:5px;overflow:auto}
.ar-tabs button{padding:10px 12px;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--muted);font-weight:700;white-space:nowrap}
.ar-tabs button.active{border-bottom-color:var(--bms-primary);color:var(--bms-primary)}
.ar-tab-content{min-height:120px}
.ar-schedule-table-wrap,.ar-payment-table-wrap{max-width:100%;overflow:auto}
.ar-schedule-table,.ar-payment-table{width:100%;min-width:1080px;border-collapse:collapse;background:var(--surface)}
.ar-schedule-table th,.ar-schedule-table td,.ar-payment-table th,.ar-payment-table td{font-size:12px;white-space:nowrap}
.ar-empty-state{padding:28px;color:var(--muted);text-align:center}
.ar-form-note{margin:0;padding:12px;border:1px solid var(--line);border-radius:10px;color:var(--muted);background:var(--surface-soft)}
.ar-metric small{display:block;margin-top:4px;color:var(--muted);font-size:11px}
.ar-metric.overdue strong{color:var(--bms-danger)}
.ar-metric.due strong{color:var(--bms-warning)}
.ar-payment-documents-card{margin-bottom:14px;overflow:hidden;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.ar-payment-documents-card>header{display:flex;align-items:start;justify-content:space-between;gap:16px;padding:14px 16px;border-bottom:1px solid var(--line)}
.ar-payment-documents-card h3{margin:3px 0;font-size:16px}.ar-payment-documents-card p{margin:0;color:var(--muted);font-size:12px}
.ar-payment-documents{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
.ar-payment-document{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:start;gap:10px;padding:14px 16px;border-right:1px solid var(--line)}
.ar-payment-document:last-child{border-right:0}.ar-payment-document-state{display:grid;width:24px;height:24px;place-items:center;border-radius:50%;color:var(--muted);background:var(--bms-neutral-soft);font-weight:800}
.ar-payment-document.is-complete .ar-payment-document-state{color:var(--bms-success);background:var(--bms-success-soft)}
.ar-payment-document strong,.ar-payment-document small{display:block}.ar-payment-document small{margin-top:3px;color:var(--muted);font-size:11px}.ar-payment-document>.btn{min-height:32px;padding:5px 10px}
.ar-payment-document-files{display:grid;gap:5px;margin-top:9px}.ar-payment-document-file{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:5px}.ar-payment-document-file>span{overflow:hidden;color:var(--muted);font-size:11px;text-overflow:ellipsis;white-space:nowrap}
.ar-status{display:inline-flex;padding:4px 8px;border-radius:999px;background:var(--bms-neutral-soft);color:var(--bms-neutral);font-size:11px;font-weight:700}
.ar-status.paid{background:var(--bms-success-soft);color:var(--bms-success)}
.ar-status.overdue,.ar-status.on_hold{background:var(--bms-danger-soft);color:var(--bms-danger)}
.ar-status.partially_paid,.ar-status.due{background:var(--bms-warning-soft);color:var(--bms-warning)}
.ar-form{display:grid;gap:12px}
.ar-form .form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.ar-ledger-entry{display:grid;grid-template-columns:110px 1fr 120px 120px 140px;gap:8px;padding:9px;border-bottom:1px solid var(--line);font-size:12px}
.ar-ledger-entry strong{text-align:right}
.ar-warning{padding:10px;border-radius:8px;color:var(--bms-warning);background:color-mix(in srgb,var(--surface) 88%,var(--bms-warning))}
.ar-payment-actions{display:flex;gap:6px;flex-wrap:wrap}
@media(max-width:1150px){.ar-metrics{grid-template-columns:repeat(3,1fr)}.ar-payment-documents{grid-template-columns:1fr}.ar-payment-document{border-right:0;border-bottom:1px solid var(--line)}.ar-payment-document:last-child{border-bottom:0}}
@media(max-width:720px){.ar-header,.ar-header-actions,.ar-toolbar,.ar-detail-nav{align-items:stretch;flex-direction:column}.ar-metrics{grid-template-columns:repeat(2,1fr)}.ar-form .form-grid{grid-template-columns:1fr}.ar-payment-document{grid-template-columns:auto minmax(0,1fr)}.ar-payment-document>.btn{grid-column:2;width:100%}}

.topbar { display:flex; justify-content:space-between; align-items:center; gap:20px; }
.current-user { display:grid; grid-template-columns:auto auto; gap:2px 10px; align-items:center; color:#fff; text-align:right; }
.current-user small { opacity:.8; }
.current-user button { grid-row:1 / span 2; grid-column:2; }
.login-overlay { position:fixed; inset:0; z-index:1000; display:grid; place-items:center; padding:24px; background:linear-gradient(135deg,#0752a2,#07806f); }
.login-overlay[hidden] { display:none; }
.login-card { width:min(420px,100%); display:grid; gap:16px; padding:30px; border-radius:18px; background:#fff; box-shadow:0 24px 70px #001a3a55; }
.login-card label,.user-form label { display:grid; gap:6px; font-weight:700; }
.form-error { min-height:20px; color:#b91c1c; margin:0; }
.flow-step { position:relative; }
.permission-label { display:inline-flex; margin-top:8px; padding:3px 8px; border-radius:999px; font-size:11px; font-weight:800; background:#e0f2fe; color:#075985; }
.flow-step.permission-none { opacity:.56; cursor:not-allowed; background:#eef2f7; }
.flow-step.permission-none .permission-label { background:#fee2e2; color:#991b1b; }
.flow-step.permission-view .permission-label { background:#fef3c7; color:#92400e; }
.panel.read-only input:not([type=search]),.panel.read-only textarea,.panel.read-only select { pointer-events:none; background:#f1f5f9; }
.panel.read-only button:not(.nav-item) { display:none; }
.panel.read-only .project-document-actions button { display:inline-flex; }
.user-admin-grid { display:grid; grid-template-columns:minmax(0,1fr) 380px; gap:20px; }
.user-form { display:grid; align-content:start; gap:13px; padding:20px; border:1px solid #d6e2f2; border-radius:14px; background:#f8fbff; }
.user-form[hidden] { display:none; }
.check-label { display:flex !important; grid-template-columns:auto 1fr; align-items:center; }
.permission-matrix { display:grid; gap:10px; padding-top:8px; border-top:1px solid #d6e2f2; }
.permission-row { display:grid; grid-template-columns:1fr 150px; align-items:center; gap:10px; }
#permissionMatrix .permission-scope { border:1px solid var(--bms-border); border-radius:var(--bms-radius-2); min-width:0; overflow:hidden; }
#permissionMatrix .permission-scope h4 { margin:0; padding:var(--bms-space-3) var(--bms-space-4); background:var(--surface-soft); font-size:14px; }
#permissionMatrix .permission-row { grid-template-columns:minmax(0,1fr) 240px; padding:var(--bms-space-3) var(--bms-space-4); gap:var(--bms-space-4); border-top:1px solid var(--bms-border); }
#permissionMatrix .permission-row label { margin:0; font-size:14px; line-height:1.5; font-weight:600; }
#permissionMatrix .permission-row small { display:block; overflow-wrap:anywhere; font-size:12px; font-weight:400; }
#permissionMatrix .permission-step { color:var(--muted); margin-bottom:var(--bms-space-1); }
#permissionMatrix .permission-choice { display:grid; gap:var(--bms-space-1); min-width:0; }
#permissionMatrix [data-effective] { color:var(--muted); }
#permissionMatrix [data-effective][data-allowed="true"] { color:var(--bms-success); }
#permissionMatrix .permission-help { display:none; color:var(--muted); font-size:13px; font-weight:400; line-height:1.5; }
#permissionMatrix.show-permission-help .permission-help { display:block; }
#permissionMatrix .permission-help p { margin:var(--bms-space-1) 0; }
#permissionMatrix .permission-help code { overflow-wrap:anywhere; font-size:12px; }
#permissionMatrix .permission-editor-intro h3 { margin:var(--bms-space-2) 0; }
#permissionMatrix .permission-editor-intro p,#permissionMatrix [data-permission-count] { margin:0; color:var(--muted); font-size:13px; font-weight:400; }
#permissionMatrix .permission-filters { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto; align-items:end; gap:var(--bms-space-4); padding:var(--bms-space-3) 0; }
#permissionMatrix .permission-filters label { margin:0 0 var(--bms-space-1); font-size:13px; }
#permissionMatrix .bms-search-box { width:100%; }
#permissionMatrix [data-permission-warning]:not(:empty) { padding:var(--bms-space-3); margin:0; color:var(--bms-warning); background:var(--bms-warning-soft); font-weight:400; }
#permissionMatrix [hidden] { display:none !important; }
#permissionMatrix [data-permission-warning]:empty { display:none; }
#permissionMatrix .permission-basic-section { margin-top:var(--bms-space-3); border:1px solid var(--bms-border); border-radius:var(--bms-radius-2); overflow:hidden; }
#permissionMatrix .permission-basic-section > summary { cursor:pointer; padding:var(--bms-space-3) var(--bms-space-4); background:var(--surface-soft); font-weight:600; }
#permissionMatrix .permission-basic-note { font-size:13px; color:var(--muted); line-height:1.5; }
#permissionMatrix [data-basic-status] { color:var(--muted); }
/* Category accents, not success/warning/denial colors. Text retains theme contrast. */
#permissionMatrix [data-module-tone="workflow"] { --permission-accent:var(--bms-permission-workflow); }
#permissionMatrix [data-module-tone="purchasing"] { --permission-accent:var(--bms-permission-purchasing); }
#permissionMatrix [data-module-tone="crm"] { --permission-accent:var(--bms-permission-crm); }
#permissionMatrix [data-module-tone="people"] { --permission-accent:var(--bms-permission-people); }
#permissionMatrix [data-module-tone="maintenance"] { --permission-accent:var(--bms-permission-maintenance); }
#permissionMatrix [data-module-tone="finance"] { --permission-accent:var(--bms-permission-finance); }
#permissionMatrix [data-module-tone="administration"] { --permission-accent:var(--bms-permission-administration); }
#permissionMatrix :is(.permission-basic-section,.permission-scope) {
  border-color:color-mix(in srgb,var(--permission-accent) 40%,var(--bms-border));
  border-inline-start:var(--bms-space-1) solid var(--permission-accent);
  margin-bottom:var(--bms-space-4);
}
#permissionMatrix :is(.permission-basic-section > summary,.permission-scope > h4) {
  background:color-mix(in srgb,var(--permission-accent) 17%,var(--bms-surface));
  color:var(--bms-text);
}
#permissionMatrix .permission-row[data-module-tone] {
  background:color-mix(in srgb,var(--permission-accent) 5%,var(--bms-surface));
  border-inline-start:var(--bms-space-1) solid color-mix(in srgb,var(--permission-accent) 55%,var(--bms-surface));
}
#permissionMatrix .permission-row:focus-within {
  outline:2px solid var(--bms-focus);
  outline-offset:-2px;
}
@media(max-width:900px) { #permissionMatrix .permission-filters { grid-template-columns:minmax(0,1fr); } }
@media(max-width:720px) { #permissionMatrix .permission-row { grid-template-columns:minmax(0,1fr); gap:var(--bms-space-2); } }
@media (max-width:1000px){ .user-admin-grid{grid-template-columns:1fr;} }

:root[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #111c31;
  --surface-soft: #17243a;
  --ink: #e5edf8;
  --ink-strong: #8cc4ff;
  --muted: #a7b4c7;
  --line: #2d405c;
  --line-strong: #3d5f88;
  --brand: #60a5fa;
  --brand-soft: #142845;
  --brand-muted: #93c5fd;
  --blue: #2563eb;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #dc2626;
  --violet: #a78bfa;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

:root[data-theme="dark"] body {
  color-scheme: dark;
}

button,
input,
select,
textarea,
dialog {
  font: inherit;
  font-family: var(--font-ui);
}

.app-shell {
  min-height: 100vh;
  max-width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  padding: 22px 28px;
  color: #ffffff;
  background: linear-gradient(120deg, #063f89, #0f766e);
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 26px);
  letter-spacing: 0;
  line-height: 1.18;
}

.eyebrow {
  margin: 0;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar .eyebrow {
  opacity: 0.8;
}

.topbar-actions,
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-user-actions { display:flex; align-items:center; gap:12px; margin-left:auto; }
.notification-center { position:relative; }
.notification-bell { position:relative; width:42px; height:42px; border:1px solid rgba(255,255,255,.45); border-radius:50%; color:#fff; background:rgba(255,255,255,.12); cursor:pointer; font-size:19px; }
.notification-bell:focus-visible { outline:3px solid #fbbf24; outline-offset:2px; }
.notification-bell span { position:absolute; top:-5px; right:-6px; min-width:20px; height:20px; padding:0 5px; border-radius:999px; display:grid; place-items:center; color:#fff; background:#dc2626; border:2px solid #075985; font-size:11px; font-weight:800; }
.notification-dropdown { position:absolute; z-index:1400; top:calc(100% + 10px); right:0; width:min(390px,calc(100vw - 24px)); max-height:min(520px,70vh); overflow:hidden; color:#17233c; background:#fff; border:1px solid #cbdcf5; border-radius:12px; box-shadow:0 22px 52px rgba(15,23,42,.28); }
.notification-dropdown header { display:flex; justify-content:space-between; align-items:center; padding:14px 16px; border-bottom:1px solid #dbe7f5; }
.notification-dropdown header button { border:0; color:#075fbd; background:transparent; cursor:pointer; font-weight:700; }
.notification-list { max-height:430px; overflow:auto; }
.notification-item { display:block; width:100%; padding:13px 16px; border:0; border-bottom:1px solid var(--bms-border); text-align:left; color:inherit; background:var(--bms-surface); cursor:pointer; transition:background-color .15s ease,box-shadow .15s ease; }
.notification-item.unread { background:var(--bms-primary-soft); box-shadow:inset 4px 0 var(--bms-primary); }
.notification-item.read { background:var(--bms-surface); }
.notification-item.unread>strong { color:var(--bms-primary-active); font-weight:800; }
.notification-item.read>strong { color:var(--bms-text); font-weight:650; }
.notification-item strong,.notification-item span,.notification-item small { display:block; }
.notification-item span { margin-top:4px; line-height:1.35; }
.notification-item small { margin-top:6px; color:var(--bms-text-muted); }
.notification-meta { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:8px; }
.notification-meta small { margin-top:0; }
.notification-read-state { display:inline-flex !important; align-items:center; gap:5px; width:max-content; margin-top:0 !important; padding:3px 8px; border:1px solid var(--bms-border); border-radius:999px; color:var(--bms-text-muted); background:var(--bms-surface-subtle); font-size:11px; font-weight:750; line-height:1.2 !important; white-space:nowrap; }
.notification-read-state::before { content:"✓"; font-size:10px; font-weight:900; }
.notification-read-state[data-read-state="unread"] { border-color:color-mix(in srgb,var(--bms-primary) 45%,var(--bms-border)); color:var(--bms-primary-active); background:var(--bms-primary-soft); }
.notification-read-state[data-read-state="unread"]::before { content:""; width:7px; height:7px; border-radius:50%; background:var(--bms-primary); }
.notification-message{display:flex;align-items:center;gap:7px}.notification-message>span{flex:1;min-width:0}.notification-project-link{display:inline-flex;flex:0 0 26px;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:1px solid color-mix(in srgb,var(--bms-primary) 35%,var(--bms-border));border-radius:999px;color:var(--bms-primary-active);background:var(--bms-surface);box-shadow:none;cursor:pointer;transition:border-color .15s ease,background .15s ease,color .15s ease}.notification-project-link svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8}.notification-project-link:hover{border-color:var(--bms-primary);color:var(--bms-primary-active);background:var(--bms-primary-soft)}.notification-project-link:focus-visible{outline:3px solid var(--bms-warning);outline-offset:2px}
.notification-preference-list { display:grid; gap:8px; min-width:240px; }
.notification-preference-list label { display:flex; justify-content:space-between; gap:16px; align-items:center; }
.notification-preference-list label[hidden] { display:none !important; }
.telegram-user-actions,.telegram-admin-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}
@media (max-width:700px) { .topbar-user-actions { width:100%; justify-content:flex-end; } .notification-dropdown { position:fixed; top:76px; right:12px; left:12px; width:auto; max-height:calc(100dvh - 96px); } }

.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease, background-color 120ms ease;
}

.btn:hover {
  filter: brightness(0.98);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.btn:active,
.btn.clicked {
  transform: translateY(1px) scale(0.98);
  box-shadow: inset 0 2px 5px rgba(15, 23, 42, 0.16);
}

.btn:focus-visible,
.nav-item:focus-visible,
.segment:focus-visible,
.icon-btn:focus-visible {
  outline: 3px solid rgba(7, 87, 184, 0.22);
  outline-offset: 2px;
}

.btn.primary {
  color: #ffffff;
  background: var(--blue);
}

.btn.secondary {
  color: var(--blue);
  background: var(--brand-soft);
  border-color: var(--line-strong);
}

.btn.success {
  color: #ffffff;
  background: var(--green);
}

.btn.danger {
  color: #ffffff;
  background: var(--red);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.save-pulse {
  animation: savePulse 620ms ease;
}

.btn.is-busy {
  opacity: 0.75;
  cursor: progress;
}

@keyframes savePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(21, 128, 61, 0);
  }

  45% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(21, 128, 61, 0.18);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(21, 128, 61, 0);
  }
}

.workspace {
  display: grid;
  grid-template-columns: minmax(168px, 216px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  max-width: 100%;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-subtabs{display:flex;gap:4px;margin:0 0 14px;padding:4px;border:1px solid var(--line);border-radius:10px;background:var(--surface-soft);overflow-x:auto;scrollbar-width:thin}
.settings-subtab{flex:0 0 auto;min-height:40px;padding:8px 14px;border:1px solid transparent;border-radius:8px;background:transparent;color:var(--muted);cursor:pointer;font:inherit;font-weight:700;white-space:nowrap}
.settings-subtab:hover{color:var(--ink-strong);background:var(--surface)}
.settings-subtab:focus-visible{outline:2px solid var(--bms-info);outline-offset:1px}
.settings-subtab.active{border-color:var(--line);background:var(--surface);color:var(--ink-strong);box-shadow:var(--bms-shadow-xs)}
.settings-tab-pane{min-width:0}
.settings-tab-pane[hidden]{display:none}
.settings-tab-pane>.settings-card,.settings-tab-pane>.telegram-settings-hub,.settings-tab-pane>.notification-settings-hub{margin-top:0}
[data-settings-pane="general"]{display:grid;gap:12px}
[data-settings-pane="general"] .settings-grid{gap:10px}
[data-settings-pane="general"] .settings-grid .settings-card{min-height:64px;padding:12px 14px}
[data-settings-pane="general"] .settings-grid .settings-card h3{margin-bottom:2px;font-size:15px}
[data-settings-pane="general"] .settings-grid .settings-card p{font-size:12px}
[data-settings-pane="general"] .branding-settings{display:grid;grid-template-columns:minmax(170px,.45fr) minmax(0,1.55fr);align-items:start;gap:16px;padding:14px}
[data-settings-pane="general"] .branding-settings>div p{font-size:12px}
[data-settings-pane="general"] .branding-form{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-width:none;width:100%}
[data-settings-pane="general"] .branding-form>button{justify-self:start}
[data-settings-pane="mobile"] .pwa-settings-card{display:block;margin:0;padding:18px}
[data-settings-pane="notifications"] .pwa-actions{margin-bottom:8px}
[data-settings-pane="notifications"] .notification-settings-hub,[data-settings-pane="telegram"] .telegram-settings-hub,[data-settings-pane="ai-knowledge"] .ai-knowledge-settings,[data-settings-pane="pop-nexus"] .ai-knowledge-settings,[data-settings-pane="templates"] .document-template-settings{margin-top:0}
[data-settings-pane="templates"] .template-library-wrap{overflow-x:hidden}
[data-settings-pane="templates"] .template-library-table{width:100%;min-width:0;table-layout:fixed}
[data-settings-pane="templates"] .template-library-table th:first-child{width:24%}
[data-settings-pane="templates"] .template-library-table th:not(:first-child){width:25.333%}
[data-settings-pane="templates"] .template-library-table :is(th,td){padding:10px 8px;vertical-align:top}
[data-settings-pane="templates"] .template-library-table td:first-child{min-width:0;overflow-wrap:anywhere}
[data-settings-pane="templates"] .template-asset-cell{grid-template-columns:minmax(0,1fr);align-items:start;justify-items:start;min-width:0}
[data-settings-pane="templates"] .template-asset-cell .btn{width:100%;min-width:0;min-height:36px;height:auto;padding-inline:8px;white-space:normal}
[data-settings-pane="templates"] .template-asset-cell small{max-width:100%}

.settings-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.settings-card h3 {
  margin: 0 0 6px;
  color: var(--ink-strong);
  font-size: 17px;
}

.settings-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.setting-control {
  flex: 0 0 auto;
}

.document-template-settings {
  margin-top: 16px;
  display: grid;
  align-items: stretch;
  gap: 14px;
}

.branding-settings {
  margin-top: 16px;
  align-items: flex-start;
}

.telegram-settings-hub { display:block; margin-top:16px; padding:0; overflow:hidden; }
.telegram-hub-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:20px 22px; background:linear-gradient(135deg,rgba(37,99,235,.1),rgba(13,148,136,.08)); border-bottom:1px solid var(--line); }
.telegram-hub-header h3 { margin-bottom:4px; font-size:21px; }
.telegram-hub-section { padding:18px 22px; }
.telegram-hub-section + .telegram-hub-section { border-top:1px solid var(--line); }
.telegram-section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.telegram-section-heading h4 { margin:0 0 5px; color:var(--ink-strong); font-size:16px; }
.telegram-user-actions,.telegram-admin-actions { flex:0 0 auto; }
.telegram-master-switch { display:flex; align-items:center; gap:9px; width:max-content; margin-top:14px; padding:9px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface-soft); font-weight:700; }
.telegram-status-badge { flex:0 0 auto; display:inline-block; padding:5px 10px; border-radius:999px; background:#fef3c7; color:#92400e; font-size:12px; font-weight:700; }
.telegram-link-flow,.telegram-unlink-confirmation{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:14px;padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--surface-soft)}
.telegram-link-flow[hidden],.telegram-unlink-confirmation[hidden]{display:none}.telegram-link-flow>div{flex:1 1 280px}.telegram-link-flow p{margin:3px 0;color:var(--muted)}.telegram-link-flow small{color:var(--muted)}.telegram-unlink-confirmation span{flex:1 1 220px;font-weight:700}.telegram-account-message{min-height:1.3em;margin:10px 0 0;color:var(--muted)}
.notification-settings-hub{display:block;padding:0;overflow:hidden}
.notification-settings-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:20px 22px;border-bottom:1px solid var(--line);background:linear-gradient(135deg,var(--bms-info-soft),var(--surface-soft))}
.notification-settings-header h3{margin:0 0 4px;font-size:21px}.notification-settings-header p{margin:0;color:var(--muted)}
.system-broadcast-card{padding:18px 22px;border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--bms-info-soft) 45%,var(--surface))}.system-broadcast-card[hidden]{display:none}.system-broadcast-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}.system-broadcast-heading h4{margin:2px 0 5px;color:var(--ink-strong);font-size:17px}.system-broadcast-heading p{margin:0;color:var(--muted);font-size:13px}.system-broadcast-badge{flex:0 0 auto;padding:5px 10px;border:1px solid color-mix(in srgb,var(--bms-info) 48%,var(--line));border-radius:999px;color:var(--bms-info);font-size:12px;font-weight:700}.system-broadcast-form{display:grid;grid-template-columns:minmax(220px,.8fr) minmax(280px,1.2fr);gap:12px;margin-top:15px}.system-broadcast-form label{display:grid;align-content:start;gap:6px;margin:0;color:var(--ink-strong);font-size:13px;font-weight:700}.system-broadcast-form :is(input,textarea){width:100%;font-weight:400}.system-broadcast-body{grid-row:span 2}.system-broadcast-form textarea{min-height:104px;resize:vertical}.system-broadcast-actions{display:flex;align-items:center;justify-content:space-between;gap:12px}.system-broadcast-actions small{color:var(--muted)}
.notification-device-controls{padding:18px 22px;border-bottom:1px solid var(--line)}.notification-device-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.notification-device-heading h4{margin:0 0 4px;color:var(--ink-strong)}.notification-device-heading p{margin:0;color:var(--muted);font-size:13px}
.notification-channel-legend{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px 14px;color:var(--muted);font-size:12px;font-weight:700}.notification-channel-legend span{display:flex;align-items:center;gap:6px;white-space:nowrap}.notification-channel-legend i{width:8px;height:8px;border-radius:50%;background:var(--muted)}
.notification-channel-legend [data-channel-state="ready"],.notification-channel-legend [data-available="true"] i{background:var(--green)}.notification-channel-legend [data-available="false"]{opacity:.65}
.notification-preferences-card{padding:18px 22px}.notification-preference-heading{display:flex;align-items:end;justify-content:space-between;gap:16px;margin-bottom:12px}.notification-preference-heading h4{margin:0;color:var(--ink-strong)}.notification-preference-heading p{margin:0;color:var(--muted);font-size:13px}
.notification-preference-list{display:grid;gap:0;min-width:0;border:1px solid var(--line);border-radius:12px;overflow:hidden}.notification-preference-row{display:grid;grid-template-columns:minmax(160px,1fr) repeat(3,minmax(92px,.42fr));align-items:center;min-height:46px;border-top:1px solid var(--line)}
.notification-preference-row:first-child{border-top:0}.notification-preference-row>strong,.notification-preference-row>span,.notification-preference-row>label{padding:10px 14px}.notification-preference-row>label{display:grid;place-items:center;margin:0;border-left:1px solid var(--line)}.notification-preference-columns{min-height:38px;background:var(--surface-soft);color:var(--muted);font-size:12px;font-weight:700}.notification-preference-columns span:not(:first-child){text-align:center;border-left:1px solid var(--line)}.notification-preference-row input:disabled{cursor:not-allowed;opacity:.38}
.native-push-status{grid-column:1/-1;margin:0;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface-soft);color:var(--muted);font-size:13px}.native-push-status[data-state="granted"]{border-color:color-mix(in srgb,var(--green) 42%,var(--line));color:var(--green)}.native-push-status[data-state="denied"]{border-color:color-mix(in srgb,var(--red) 42%,var(--line));color:var(--red)}
.telegram-admin-settings { display:block; background:color-mix(in srgb,var(--surface-soft) 58%,transparent); }
.telegram-admin-content { display:grid; grid-template-columns:minmax(420px,1.45fr) minmax(280px,.75fr); gap:20px; align-items:start; }
.telegram-admin-status { display:grid; grid-template-columns:max-content minmax(0,1fr); gap:6px 14px; margin:16px 0 0; padding:14px; border:1px solid var(--line); border-radius:12px; background:var(--surface); font-size:14px; }
.telegram-admin-status dt { color:var(--muted); }.telegram-admin-status dd { margin:0; font-weight:700; overflow-wrap:anywhere; }
.telegram-admin-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.telegram-credential-form { margin-top:16px; padding:14px; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.telegram-credential-form > label { display:block; margin-bottom:8px; font-weight:700; }
.telegram-credential-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.telegram-credential-row input { min-width:min(360px,100%); flex:1 1 280px; }
.telegram-credential-form .field-hint { margin:8px 0 0; color:var(--muted); font-size:13px; }
.ai-knowledge-settings{display:block;margin-top:16px;padding:0;overflow:hidden;border-top:3px solid var(--bms-info)}
.ai-knowledge-settings-header,.integration-section-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.ai-knowledge-settings-header{padding:20px 22px;background:linear-gradient(135deg,var(--bms-info-soft),var(--surface-soft));border-bottom:1px solid var(--line)}
.ai-knowledge-settings-header h3,.integration-section-heading h4{margin:0 0 5px;color:var(--ink-strong)}
.integration-status-badge{flex:0 0 auto;padding:5px 10px;border-radius:999px;background:var(--surface);border:1px solid var(--line);font-size:12px;font-weight:700}
.integration-status-badge[data-state="ready"]{border-color:color-mix(in srgb,var(--green) 55%,var(--line));color:var(--green)}
.integration-status-badge[data-state="partial"]{border-color:color-mix(in srgb,var(--bms-warning) 55%,var(--line));color:var(--bms-warning)}
.integration-message{margin:16px 22px;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.integration-message.error{border-color:color-mix(in srgb,var(--red) 55%,var(--line));color:var(--red)}
.ai-knowledge-settings-content{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(320px,.85fr)}
.integration-section{min-width:0;padding:18px 22px;border-top:1px solid var(--line)}
.integration-section:first-child{grid-row:span 2;border-top:0;border-right:1px solid var(--line)}
.integration-section:nth-child(2){border-top:0}
.integration-form,.integration-endpoint-list{display:grid;gap:12px;margin-top:16px}
.integration-form label,.integration-endpoint-list label{display:grid;gap:6px;font-weight:700}
.integration-form.compact-form{grid-template-columns:minmax(220px,1fr) minmax(220px,.75fr) auto;align-items:end;padding:14px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.integration-copy-row,.integration-actions{display:flex;align-items:center;gap:8px}
.integration-copy-row input{min-width:0;flex:1 1 auto;font-family:var(--bms-font-data)}
.integration-switch{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center;width:max-content;max-width:100%}
.one-time-token{margin-top:14px;padding:14px;border:1px solid color-mix(in srgb,var(--bms-warning) 60%,var(--line));border-radius:12px;background:var(--bms-warning-soft)}
.one-time-token .integration-copy-row{margin-top:10px}.one-time-token p{margin-top:8px}
.integration-token-table-wrap{margin-top:14px}.integration-token-table{width:100%;border-collapse:collapse}.integration-token-table th,.integration-token-table td{padding:10px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}.integration-token-table td small{display:block;margin-top:4px;color:var(--muted)}
.integration-status-list{display:grid;grid-template-columns:minmax(130px,.8fr) minmax(0,1.2fr);margin:16px 0 0}.integration-status-list :is(dt,dd){margin:0;padding:9px;border-bottom:1px solid var(--line);overflow-wrap:anywhere}.integration-status-list dt{color:var(--muted);background:var(--surface-soft)}.integration-status-list dd{font-weight:700}
@media (max-width: 900px) {
  .telegram-admin-content { grid-template-columns:1fr; }
  .ai-knowledge-settings-content{grid-template-columns:1fr}.integration-section:first-child{grid-row:auto;border-right:0}.integration-section:nth-child(2){border-top:1px solid var(--line)}
  .integration-form.compact-form{grid-template-columns:1fr 1fr}.integration-form.compact-form .btn{grid-column:1/-1;width:max-content}
  .telegram-section-heading, .telegram-admin-heading { flex-direction:column; }
  .telegram-user-actions, .telegram-admin-actions { width:100%; justify-content:flex-start; }
}
@media (max-width: 700px) {
  .telegram-hub-header, .telegram-hub-section { padding:16px; }
  .telegram-hub-header { align-items:flex-start; }
  .notification-settings-header,.notification-preference-heading,.system-broadcast-heading{align-items:flex-start;flex-direction:column}.notification-channel-legend{justify-content:flex-start}.notification-preference-row{grid-template-columns:minmax(120px,1fr) repeat(3,minmax(68px,.46fr))}.notification-preference-row>strong,.notification-preference-row>span,.notification-preference-row>label{padding:9px 7px}.notification-preference-columns span{font-size:10px}.system-broadcast-card{padding:16px}.system-broadcast-form{grid-template-columns:1fr}.system-broadcast-body{grid-row:auto}.system-broadcast-actions{align-items:stretch;flex-direction:column}.system-broadcast-actions .btn{width:100%}
  .telegram-user-actions .btn, .telegram-admin-actions .btn { flex:1 1 100%; width:100%; }
  .telegram-master-switch { width:100%; }
  .telegram-credential-row input { min-width:100%; }
  .telegram-credential-row .btn { width:100%; }
  .ai-knowledge-settings-header,.integration-section-heading,.integration-copy-row,.integration-actions{align-items:stretch;flex-direction:column}
  .ai-knowledge-settings-header,.integration-section{padding:16px}.integration-form.compact-form{grid-template-columns:1fr}.integration-form.compact-form .btn,.integration-copy-row .btn,.integration-actions .btn{width:100%}
  .integration-status-list{grid-template-columns:minmax(110px,.8fr) minmax(0,1.2fr)}
  .settings-subtabs{margin-inline:-4px}.settings-subtab{min-height:44px;padding-inline:13px}
  [data-settings-pane="general"] .settings-grid{grid-template-columns:1fr}
  [data-settings-pane="general"] .settings-grid .settings-card{align-items:flex-start;flex-direction:column}
  [data-settings-pane="general"] .setting-control{width:100%}
  [data-settings-pane="general"] .setting-control .segment{flex:1 1 50%}
  [data-settings-pane="general"] .branding-settings{grid-template-columns:1fr}
  [data-settings-pane="general"] .branding-form{grid-template-columns:1fr}
  [data-settings-pane="templates"] .template-library-wrap{overflow:visible}
  [data-settings-pane="templates"] .template-library-table,[data-settings-pane="templates"] .template-library-table tbody,[data-settings-pane="templates"] .template-library-table tr,[data-settings-pane="templates"] .template-library-table td{display:block;width:100%}
  [data-settings-pane="templates"] .template-library-table thead{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
  [data-settings-pane="templates"] .template-library-table tbody{display:grid;gap:12px}
  [data-settings-pane="templates"] .template-library-table tr{overflow:hidden;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
  [data-settings-pane="templates"] .template-library-table td{border-bottom:1px solid var(--line)}
  [data-settings-pane="templates"] .template-library-table td:last-child{border-bottom:0}
  [data-settings-pane="templates"] .template-library-table td:first-child{padding:12px;background:var(--surface-soft)}
  [data-settings-pane="templates"] .template-library-table td:nth-child(n+2){display:grid;grid-template-columns:86px minmax(0,1fr);gap:10px;align-items:start}
  [data-settings-pane="templates"] .template-library-table td:nth-child(2)::before{content:"Excel"}
  [data-settings-pane="templates"] .template-library-table td:nth-child(3)::before{content:"JSON"}
  [data-settings-pane="templates"] .template-library-table td:nth-child(4)::before{content:"Hướng dẫn"}
  [data-settings-pane="templates"] .template-library-table td:nth-child(n+2)::before{padding-top:9px;color:var(--muted);font-size:12px;font-weight:700}
  [data-settings-pane="templates"] .template-asset-cell{grid-template-columns:minmax(0,1fr) auto;align-items:center}
  [data-settings-pane="templates"] .template-asset-cell small{grid-column:1/-1}
}

.branding-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.4fr);
  gap: 12px;
  width: min(760px, 100%);
}

.branding-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.branding-form input {
  width: 100%;
}

.branding-logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.branding-logo-row img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.template-settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.template-library-wrap {
  width: 100%;
}

.template-library-table td:first-child {
  min-width: 190px;
}

.template-library-table td:first-child small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.package-upload-btn {
  display: block;
  margin-top: 9px;
}

.package-version {
  color: var(--brand-muted) !important;
  font-weight: 700;
}

.package-lifecycle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.template-asset-cell {
  display: grid;
  grid-template-columns: max-content max-content;
  align-items: center;
  gap: 7px;
  min-width: 190px;
}

.template-asset-cell small {
  grid-column: 1 / -1;
  max-width: 230px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace > *,
.content > *,
.costing-layout > *,
.two-column > *,
.approval-grid > *,
.document-grid > *,
.deal-context > *,
.deal-settings > *,
.metric-grid > *,
.automation-flow > * {
  min-width: 0;
}

.sidebar,
.panel,
.flow-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 16px;
  padding: 14px;
}

.brand-block {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 2px 2px 16px;
  border-bottom: 1px solid #d9e5f4;
}

.brand-block [hidden] { display:none !important; }

.brand-block strong {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: #ffffff;
  background: var(--blue);
  border:1px solid color-mix(in srgb,var(--blue) 35%,var(--line));
  border-radius: 10px;
  box-shadow:0 5px 14px rgba(7,87,184,.14);
}

.brand-logo {
  width: 56px;
  height: 56px;
  padding:6px;
  object-fit: contain;
  border:1px solid var(--line-strong);
  border-radius:20px;
  background:var(--surface);
  box-shadow:0 5px 14px rgba(15,23,42,.1);
}

.brand-block span {
  color:var(--ink-strong);
  font-size:15px;
  font-weight:800;
  line-height:1.25;
  overflow-wrap:anywhere;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.nav-item {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.nav-item:active {
  transform: translateX(2px);
}

.nav-item.active,
.nav-item:hover {
  color: var(--blue);
  background: var(--brand-soft);
  border-color: var(--line-strong);
}

.content {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.flow-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 12px;
  min-width: 0;
}

.flow-step {
  position: relative;
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  cursor: pointer;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.flow-step:hover,
.flow-step:focus-visible {
  border-color: #4f9ceb;
  box-shadow: 0 0 0 3px rgba(79, 156, 235, 0.16);
  transform: translateY(-1px);
}

.flow-step span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #ffffff;
  background: #5f7897;
  font-weight: 700;
}

.flow-step strong {
  color: var(--ink-strong);
}

.flow-step small {
  color: var(--muted);
  line-height: 1.35;
}

.flow-step.active {
  border-color: #4f9ceb;
  background: var(--brand-soft);
}

.flow-step.done span,
.flow-step.active span {
  background: var(--blue);
}

.workflow-13 {
  display: block;
  overflow-x: auto;
  padding: 12px;
  scrollbar-width: thin;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}

.workflow-13.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.workflow-track {
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  min-width: 100%;
}

.workflow-node {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 2px 8px;
  width: 150px;
  min-height: 78px;
  padding: 11px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.workflow-node::after {
  content: "→";
  position: absolute;
  right: -10px;
  top: 50%;
  color: #8aa2bf;
  transform: translateY(-50%);
}

.workflow-node:last-child::after { display: none; }

.workflow-node-number {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #fff;
  border-radius: 50%;
  background: #6b7f99;
  font-weight: 800;
}

.workflow-node strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: break-word;
}
.workflow-node small { color: var(--muted); font-size: 11px; }
.workflow-node:hover:not(:disabled) { box-shadow: 0 5px 14px rgba(30,74,125,.13); transform:translateY(-1px); }
.workflow-node:focus-visible { outline:3px solid color-mix(in srgb,var(--brand) 38%,transparent); outline-offset:3px; }
.workflow-node.is-current { z-index:2; transform:translateY(-2px); box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--brand),0 8px 18px rgba(7,87,184,.18); }
.workflow-node.is-current:hover:not(:disabled) { transform:translateY(-2px); }
.workflow-current-bar { position:absolute; left:50%; bottom:-1px; display:block; width:0; height:4px; border-radius:999px; background:linear-gradient(90deg,var(--brand),var(--brand-muted)); transform:translateX(-50%); transition:width 200ms ease; }
.workflow-node.is-current .workflow-current-bar { width:calc(100% - 16px); }
.workflow-node.status-completed { border-color: #9bd4b2; background: #f0fbf4; }
.workflow-node.status-completed .workflow-node-number { background: var(--green); }
.workflow-node.status-in_progress { border-color: #91bff1; background: var(--brand-soft); }
.workflow-node.status-in_progress .workflow-node-number { background: var(--blue); }
.workflow-node.status-blocked { border-color: #efb4b4; background: #fff5f5; }
.workflow-node.status-blocked .workflow-node-number { background: var(--red); }
.workflow-node.status-skipped, .workflow-node.permission-none { opacity: .48; cursor: not-allowed; }
@media (prefers-reduced-motion:reduce) {
  .workflow-node,.workflow-current-bar { transition:none; }
  .workflow-13 { scroll-behavior:auto; }
}

.workflow-stage-layout {
  display: grid;
  grid-template-columns: minmax(260px,.8fr) minmax(420px,1.2fr);
  gap: 20px;
  margin-top: 14px;
}

.workflow-stage-summary, .workflow-stage-form {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.workflow-stage-summary > div { display:flex; justify-content:space-between; gap:16px; padding:9px 0; border-bottom:1px solid var(--line); }
.workflow-stage-summary span { color:var(--muted); font-size:12px; }
.workflow-stage-summary p { color:var(--muted); line-height:1.5; }
.workflow-stage-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.workflow-stage-form label { display:grid; gap:6px; color:var(--muted); font-size:12px; font-weight:700; }
.workflow-stage-form input, .workflow-stage-form select, .workflow-stage-form textarea { width:100%; border:1px solid var(--line); border-radius:6px; padding:9px; background:var(--surface); color:var(--ink); }
.workflow-stage-form .span-2 { grid-column:1 / -1; }

.document-workflow-context {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--brand-soft);
}
.document-workflow-context[hidden] { display:none; }
.document-grid[hidden] { display:none !important; }
.document-workflow-context > div { display:grid; margin-right:auto; }
.document-workflow-context span { color:var(--muted); font-size:11px; }
.workflow-linked-document { background:#eef7ff; box-shadow:inset 3px 0 0 var(--blue); }

@media (max-width: 900px) {
  .workflow-stage-layout { grid-template-columns:1fr; }
}

.flow-strip.workflow-13 { display:block; }

.panel {
  display: none;
  padding: 14px;
  min-width: 0;
  max-width: 100%;
}

.panel.active {
  display: block;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-title.compact {
  margin-bottom: 10px;
}

.section-title .eyebrow {
  color: var(--blue);
}

h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  color: #0b4d99;
}

h3 {
  font-size: 15px;
}

.search-box input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.toolbar select {
  width: 100%;
  border: 1px solid #cbd8e6;
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
}

.search-box input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.toolbar select:focus,
.cost-input:focus,
.cost-select:focus,
.deal-input:focus,
.mail-grid input:focus,
.mail-grid textarea:focus {
  border-color: #4f9ceb;
  box-shadow: 0 0 0 3px rgba(79, 156, 235, 0.16);
  outline: none;
}

.toolbar select {
  width: auto;
  min-width: 210px;
  height: 36px;
  padding: 0 10px;
}

.search-box input {
  width: min(360px, 100%);
  height: 38px;
  padding: 0 12px;
}

.dashboard-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;min-width:min(520px,100%)}
.dashboard-actions .btn{min-height:38px;white-space:nowrap;box-shadow:0 5px 12px rgba(7,87,184,.16)}
.cost-page-title{flex:1 1 auto;min-width:0}.cost-project-context{display:flex;align-items:center;gap:8px;margin-top:4px;color:var(--muted);font-size:12px}.cost-project-context strong{color:var(--blue);font-size:13px}.cost-project-context span{overflow:hidden;max-width:620px;text-overflow:ellipsis;white-space:nowrap}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric {
  padding: 14px;
  border: 1px solid #d4e2f1;
  border-radius: 7px;
  background: #fbfdff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.metric:hover {
  border-color: #94bfe9;
  box-shadow: 0 8px 18px rgba(25, 55, 95, 0.08);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #d7e3f2;
  border-radius: 7px;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #e3ebf5;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #234569;
  background: #f3f7fc;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f7fbff;
}

.status {
  display: inline-block;
  min-width: 84px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.status.review { color: #075985; background: #e0f2fe; }
.status.doing { color: #854d0e; background: #fef3c7; }
.status.approved { color: #166534; background: #dcfce7; }
.status.rejected { color: #991b1b; background: #fee2e2; }
.status.revise { color: #6d28d9; background: #ede9fe; }

.dashboard-panel .status {
  justify-content: center;
  min-width: 92px;
  max-width: 170px;
  white-space: normal;
  text-align: center;
}

.dashboard-panel table {
  min-width: 1040px;
}

.dashboard-project-row {
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.dashboard-project-row[data-active="true"] {
  background: linear-gradient(90deg, rgba(59,130,246,0.06) 0%, rgba(59,130,246,0.015) 40%, transparent 100%);
  box-shadow: inset 3px 0 0 0 #3b82f6;
}

.dashboard-project-row[data-active="true"]:hover {
  background: linear-gradient(90deg, rgba(59,130,246,0.09) 0%, rgba(59,130,246,0.025) 40%, rgba(0,0,0,0.02) 100%);
}

.dashboard-project-row[data-active="true"] td:first-child {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dashboard-project-cell {
  position: relative;
}

.dashboard-active-badge {
  position: absolute;
  top: -8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(5,150,105,0.3), 0 0 0 2px #fff;
  z-index: 1;
}

.dashboard-financial-scope-notice {
  margin: -2px 0 14px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  color: #1e40af;
  background: #eff6ff;
  font-size: 13px;
  line-height: 1.45;
}

.dashboard-financial-redacted {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

/* SRM Purchasing */
.srm-purchasing-back { margin-bottom: 12px; }
.srm-plan-detail { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; overflow: hidden; }
.srm-plan-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.srm-plan-header h3 { margin: 0; font-size: 15px; }
.srm-plan-detail table { min-width: 760px; }
.srm-plan-qty, .srm-plan-reason { width: 100%; max-width: 140px; padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; }
.srm-plan-reason { max-width: 220px; }
.srm-plan-qty:focus, .srm-plan-reason:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
.srm-plan-allocations { padding: 16px 20px; border-top: 1px solid #e2e8f0; }
.srm-plan-allocations h4 { margin: 0 0 8px; font-size: 13px; color: #64748b; }
.srm-allocation-row { display: flex; gap: 12px; font-size: 13px; padding: 4px 0; }
.srm-allocation-row strong { margin-left: auto; }
.srm-purchasing-plans h3 { margin: 0 0 12px; font-size: 15px; }

.two-column {
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
}

.two-column.active {
  display: grid;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.form-grid label {
  display: grid;
  gap: 5px;
  color: #38536f;
  font-size: 12px;
  font-weight: 700;
}

.form-grid input,
.form-grid select {
  height: 36px;
  padding: 0 10px;
}

.form-grid textarea {
  padding: 10px;
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.info-panel {
  padding: 14px;
  border: 1px solid #d5e2f1;
  border-radius: 7px;
  background: #fbfdff;
}

.project-documents-panel{display:flex;min-height:360px;max-height:calc(100dvh - 160px);flex-direction:column;gap:12px}
.project-documents-panel>header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.project-documents-panel h3{margin:0;color:var(--ink)}
.project-documents-panel header p{margin:5px 0 0;color:var(--muted);font-size:12px;line-height:1.4}
.project-document-count{display:grid;place-items:center;flex:0 0 auto;min-width:28px;height:28px;padding:0 7px;border-radius:999px;background:var(--brand-soft);color:var(--brand);font-size:12px;font-weight:800}
.project-document-form{display:grid;gap:9px;padding:11px;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.project-document-form label{display:grid;gap:5px;color:#38536f;font-size:12px;font-weight:700}
.project-document-form textarea{width:100%;min-height:72px;padding:9px;border:1px solid var(--line);border-radius:8px;resize:vertical;color:var(--ink);background:var(--surface);font-size:13px;line-height:1.4}
.project-document-form small{color:var(--muted);font-size:10px;line-height:1.35}
.project-document-add{display:flex;align-items:center;justify-content:center;gap:6px;width:100%}
.project-document-add>span:first-child{font-size:18px;line-height:1}
.project-document-status{min-height:18px;color:var(--muted);font-size:11px}
.project-document-status.error{color:var(--red)}
.project-document-list{display:grid;min-height:0;gap:8px;overflow-y:auto;overscroll-behavior:contain;padding-right:2px}
.project-document-empty{display:grid;min-height:92px;place-items:center;padding:16px;border:1px dashed var(--line);border-radius:9px;color:var(--muted);font-size:12px;text-align:center}
.project-document-item{display:grid;grid-template-columns:36px minmax(0,1fr);gap:8px;padding:10px;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.project-document-icon{display:grid;place-items:center;width:36px;height:36px;border-radius:9px;background:var(--brand-soft);font-size:19px}
.project-document-item>div:nth-child(2){min-width:0}
.project-document-item strong{display:block;overflow:hidden;color:var(--ink);font-size:12px;text-overflow:ellipsis;white-space:nowrap}
.project-document-item p{margin:4px 0;color:#38536f;font-size:11px;line-height:1.35;overflow-wrap:anywhere;white-space:pre-wrap}
.project-document-item small{display:block;color:var(--muted);font-size:9px;line-height:1.35}
.project-document-actions{grid-column:2;display:flex;flex-wrap:wrap;gap:6px}
.project-document-actions .btn{min-height:28px;padding:0 9px;font-size:10px}

.costing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
  gap: 12px;
}

.costing-context {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.context-chip {
  padding: 10px 12px;
  border: 1px solid #d5e2f1;
  border-radius: 7px;
  background: #fbfdff;
}

.context-chip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.context-chip strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.cost-input,
.cost-select {
  width: 100%;
  min-width: 92px;
  height: 32px;
  border: 1px solid #cbd8e6;
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
  padding: 0 8px;
}

.cost-input.wide {
  min-width: 170px;
}
.cost-name-suggestions{position:fixed;z-index:190;display:grid;max-height:260px;overflow:auto;border:1px solid #9fc4ef;border-radius:8px;background:var(--surface);box-shadow:0 14px 34px rgba(15,23,42,.22)}
.cost-name-suggestions[hidden]{display:none}
.cost-name-suggestions button{display:grid;gap:2px;width:100%;padding:8px 10px;border:0;border-bottom:1px solid var(--line);color:var(--ink);background:transparent;text-align:left;cursor:pointer}
.cost-name-suggestions button:last-child{border-bottom:0}
.cost-name-suggestions button:hover,.cost-name-suggestions button.active{background:#eaf4ff}
.cost-name-suggestions strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
.cost-name-suggestions span{overflow:hidden;color:var(--muted);text-overflow:ellipsis;white-space:nowrap;font-size:10px}
:root[data-theme="dark"] .cost-name-suggestions button:hover,:root[data-theme="dark"] .cost-name-suggestions button.active{background:#18304f}

.cost-input.supplier {
  min-width: 150px;
}

.cost-select.group {
  min-width: 150px;
}

.cost-select.method {
  min-width: 220px;
}

.suggested-price-control { display:flex; align-items:center; gap:5px; min-width:150px; }
.suggested-price-control .cost-input { min-width:118px; }
.history-suggestion { color:var(--muted); font-style:italic; background:#f8fafc; }
.price-confirm-btn { flex:0 0 28px; width:28px; height:28px; padding:0; color:#fff; border:0; border-radius:6px; background:var(--green); cursor:pointer; font-weight:800; }
.temporary-price-badge { display:block; margin-top:3px; color:var(--amber); font-size:10px; font-weight:700; white-space:nowrap; }
:root[data-theme="dark"] .history-suggestion { background:#111c31; }
.cost-supplier-control{display:flex;align-items:center;gap:4px;min-width:150px}.cost-supplier-control .cost-input.supplier{flex:1 1 auto;min-width:0}.cost-map-btn{display:grid;place-items:center;flex:0 0 30px;width:30px;height:30px;padding:0;border:1px solid #9fc4ef;border-radius:6px;background:#eff6ff;color:#0757b8;cursor:pointer;font-size:16px;line-height:1}.cost-map-btn.mapped{border-color:#86d5a2;background:#ecfdf3;color:#148447}.cost-map-btn.no-permission{opacity:.42;cursor:not-allowed}.cost-mapping-status{display:block;max-width:180px;margin-top:3px;overflow:hidden;color:#a16207;font-size:10px;text-overflow:ellipsis;white-space:nowrap}.cost-mapping-status.mapped{color:#148447}.cost-mapping-status.purchase{color:#c05a00;font-weight:700}
.cost-mapping-modal{position:fixed;inset:0;z-index:150;display:grid;place-items:center;padding:20px;background:rgba(15,23,42,.42)}.cost-mapping-modal[hidden]{display:none}.cost-mapping-card{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;width:min(760px,100%);max-height:min(760px,92vh);overflow:hidden;border:1px solid var(--line);border-radius:14px;background:var(--surface);box-shadow:0 28px 80px rgba(15,23,42,.3)}.cost-mapping-card>header{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:15px 17px;border-bottom:1px solid var(--line)}.cost-mapping-card h3{margin:0;color:var(--blue)}.cost-mapping-card header p{margin:4px 0 0;color:var(--muted);font-size:12px}.cost-mapping-search{display:grid;gap:5px;padding:13px 17px;color:var(--muted);font-size:11px;font-weight:700}.cost-mapping-search input{width:100%;min-height:38px}.cost-mapping-results{display:grid;gap:9px;padding:0 17px 14px;overflow:auto}.cost-mapping-option{padding:11px;border:1px solid var(--line);border-radius:9px;background:var(--surface-soft)}.cost-mapping-item-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.cost-mapping-item-head strong,.cost-mapping-item-head span{display:block}.cost-mapping-item-head span{margin-top:2px;color:var(--ink);font-size:12px}.cost-mapping-item-head .btn.compact{min-height:30px;padding:5px 9px;font-size:11px;white-space:nowrap}.cost-mapping-facts{display:grid;grid-template-columns:1fr .55fr 1fr;gap:7px;margin:9px 0}.cost-mapping-facts span{padding:7px;border-radius:6px;background:var(--surface);font-size:11px}.cost-mapping-facts b{display:block;margin-bottom:2px;color:var(--muted);font-size:9px;text-transform:uppercase}.cost-mapping-option details{font-size:11px}.cost-mapping-option summary{color:var(--blue);cursor:pointer;font-weight:700}.cost-price-history{display:grid;gap:4px;margin:7px 0 0;padding:0;list-style:none}.cost-price-history li{display:flex;justify-content:space-between;gap:10px;padding:5px 7px;border-radius:5px;background:var(--surface)}.cost-price-history span{color:var(--muted)}.cost-mapping-empty{padding:32px 12px;text-align:center;color:var(--muted)}.cost-mapping-card>footer{display:flex;justify-content:flex-end;padding:12px 17px;border-top:1px solid var(--line)}
.btgv-revision-modal{position:fixed;inset:0;z-index:170;display:grid;place-items:center;padding:20px;background:rgba(15,23,42,.54);backdrop-filter:blur(2px)}
.btgv-revision-modal[hidden]{display:none}
.btgv-revision-card{width:min(680px,100%);max-height:min(780px,94vh);overflow:auto;border:1px solid var(--line);border-radius:16px;background:var(--surface);box-shadow:0 28px 90px rgba(15,23,42,.36)}
.btgv-revision-card>header{padding:18px 20px;border-bottom:1px solid var(--line);background:linear-gradient(135deg,rgba(31,111,235,.1),rgba(14,165,164,.06))}
.btgv-revision-card h3{margin:2px 0 0;color:var(--blue);font-size:20px}.btgv-revision-kicker{margin:0;color:var(--green);font-size:10px;font-weight:800;letter-spacing:.12em}
.btgv-revision-card form{display:grid;gap:16px;padding:18px 20px}.btgv-revision-message{margin:0;padding:12px 14px;border-left:4px solid #f59e0b;border-radius:8px;background:#fff8e8;color:var(--ink);line-height:1.5}
.btgv-impact-section{display:grid;gap:9px}.btgv-impact-section h4{margin:0;color:var(--ink)}.btgv-impact-list{display:grid;gap:7px;margin:0;padding:0;list-style:none}
.btgv-impact-list li{display:grid;grid-template-columns:minmax(145px,.75fr) minmax(0,1.25fr);gap:10px;padding:9px 11px;border:1px solid var(--line);border-radius:8px;background:var(--surface-soft);font-size:12px}.btgv-impact-list strong{color:var(--ink)}.btgv-impact-list span{color:var(--muted)}
.btgv-reason-field{display:grid;gap:7px;color:var(--ink);font-size:12px;font-weight:700}.btgv-reason-field b{color:#dc2626}.btgv-reason-field textarea{width:100%;min-height:96px;resize:vertical}.btgv-revision-error{min-height:16px;color:#b42318;font-weight:600}
.btgv-revision-card footer{display:flex;justify-content:flex-end;gap:9px;padding-top:4px}
@media(max-width:700px){.cost-supplier-control{min-width:130px}.cost-mapping-modal{padding:8px}.cost-mapping-card{max-height:96vh}.cost-mapping-item-head{align-items:stretch;flex-direction:column}.cost-mapping-facts{grid-template-columns:1fr 1fr}.cost-mapping-facts span:last-child{grid-column:1/-1}.cost-price-history li{align-items:flex-start;flex-direction:column;gap:2px}.btgv-revision-modal{align-items:stretch;padding:6px}.btgv-revision-card{max-height:calc(100dvh - 12px);border-radius:10px}.btgv-revision-card>header,.btgv-revision-card form{padding:14px}.btgv-impact-list li{grid-template-columns:1fr;gap:3px}.btgv-revision-card footer{flex-direction:column-reverse}.btgv-revision-card footer .btn{width:100%}}

.product-overview {
 margin-bottom: 12px;
}

.planned-info-section {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--surface);
  border-radius: 7px;
}
.planned-info-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.planned-info-grid label {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.planned-info-grid label span {
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.btgv-input {
  width: 100%;
  height: 32px;
  border: 1px solid #cbd8e6;
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
  padding: 0 8px;
  font-size: 14px;
}
.btgv-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-shadow);
}

.product-table-wrap {
  max-height: 220px;
  cursor:grab;
  overscroll-behavior-inline:contain;
}
.product-table-wrap.is-dragging{cursor:grabbing;user-select:none}.match-label{display:inline-block!important;margin-top:4px;padding:2px 6px;border-radius:999px;background:#e8f3ff;color:#0757b8;font-size:9px!important;font-weight:700}.reference-product{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:8px;padding:8px;border-radius:7px;background:var(--surface)}.cost-mapping-facts{grid-template-columns:1fr .55fr 1fr .65fr}
.costing-layout>.table-wrap{cursor:grab;overscroll-behavior-inline:contain}.costing-layout>.table-wrap.is-dragging{cursor:grabbing;user-select:none}
.cost-reference-panel{margin-top:16px;padding:16px;border:1px solid #bfd5ee;border-radius:12px;background:#f5f9fe}.cost-reference-panel>header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.reference-title-line{display:flex;align-items:center;gap:8px}.reference-title-line h3{margin:0;color:var(--blue)}.readonly-badge{padding:3px 7px;border-radius:999px;background:#e2e8f0;color:#475569;font-size:10px;font-weight:800}.cost-reference-panel header p{margin:4px 0 0;color:var(--muted);font-size:12px}.cost-reference-search{display:grid;gap:5px;margin:13px 0;color:var(--muted);font-size:11px;font-weight:700}.cost-reference-search input{height:36px}.cost-reference-results{display:grid;gap:10px}.reference-project-option{display:grid;gap:4px;width:100%;padding:11px;text-align:left;border:1px solid var(--line);border-radius:8px;background:var(--surface);cursor:pointer}.reference-project-option span{color:var(--muted);font-size:11px}.reference-product-card{overflow:hidden;border:1px solid var(--line);border-radius:9px;background:var(--surface)}.reference-product-card>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px;cursor:pointer}.reference-product-card>summary div{display:grid;gap:3px}.reference-product-card>summary span{color:var(--muted);font-size:11px}.reference-cost-table{border-top:1px solid var(--line);cursor:grab}.reference-cost-table table{min-width:1180px}.reference-cost-table th,.reference-cost-table td{white-space:nowrap}.reference-cost-table.is-dragging{cursor:grabbing;user-select:none}
@media(max-width:600px){.cost-reference-panel{padding:10px}.reference-product-card>summary{align-items:stretch;flex-direction:column}}

.product-table th,
.product-table td {
  white-space: nowrap;
}

.product-input {
  width: 100%;
  min-width: 86px;
  height: 32px;
  border: 1px solid #cbd8e6;
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
  padding: 0 8px;
}

.product-input.code {
  min-width: 120px;
  font-weight: 700;
}

.product-input.wide {
  min-width: 220px;
}

.product-input.number {
  min-width: 90px;
}

.product-table tr.selected td {
  background: #eaf4ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.add-row-inline {
  width: 100%;
  justify-content: center;
}

tfoot td {
  background: #f8fbff;
  border-bottom: 0;
}

.row-action {
  min-height: 30px;
  border: 1px solid #fecaca;
  border-radius: 5px;
  color: var(--red);
  background: #fff5f5;
  cursor: pointer;
  font-weight: 700;
}

.row-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.product-clone-action {
  min-width: 78px;
  margin-right: 6px;
  color: var(--blue);
  background: #eef6ff;
  border-color: #b8d4f5;
}

.product-delete-action {
  min-width: 58px;
  padding: 0 12px;
}

.summary-box {
  padding: 14px;
  border: 1px solid #d5e2f1;
  border-radius: 7px;
  background: #fbfdff;
}

.method-help {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #dbe6f2;
}

.method-help h4 {
  margin: 0;
  color: #244966;
  font-size: 13px;
}

.method-help p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.breakdown-line,
.summary-total,
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e0e9f4;
}

.summary-total {
  margin-top: 6px;
  border-top: 2px solid #bed4ec;
  border-bottom: 0;
  font-weight: 700;
}

.summary-table {
  border: 1px solid #d7e3f2;
  border-radius: 7px;
  overflow: hidden;
}

.summary-row {
  padding: 11px 14px;
  background: #ffffff;
}

.summary-row.strong {
  color: #0b4d99;
  font-weight: 700;
  background: #f2f8ff;
}

.mini-table td {
  font-size: 12px;
}

.deal-context {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.deal-context div {
  padding: 12px;
  border: 1px solid #d5e2f1;
  border-radius: 7px;
  background: #fbfdff;
}

.deal-context span,
.deal-settings span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.deal-context strong {
  display: block;
  margin-top: 5px;
  font-size: 14px;
}

.deal-settings {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: start;
  gap: 10px;
  margin-bottom: 12px;
}

.deal-settings label {
  display: grid;
  position: relative;
  gap: 6px;
  padding: 10px;
  border: 1px solid #d5e2f1;
  border-radius: 7px;
  background: #ffffff;
}

.deal-input {
  width: 100%;
  height: 34px;
  border: 1px solid #cbd8e6;
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
  padding: 0 8px;
}

.deal-input.price {
  min-width: 130px;
  font-weight: 700;
}

.deal-table .deal-sale-price-cell {
  min-width: 170px;
}

.deal-table .deal-sale-price-cell .deal-input.price {
  width: 100%;
  min-width: 0;
}

.deal-table .deal-sale-price-cell small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  white-space: normal;
}

.deal-table .deal-profit-before-tax {
  min-width: 112px;
}

.deal-table-wrap {
  max-height: 58vh;
}

.deal-table {
  min-width: 1500px;
}

.deal-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.deal-table td {
  white-space: nowrap;
}

.commercial-products-card {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--bms-border);
  border-radius: 10px;
  background: var(--bms-surface-subtle);
}

.commercial-products-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.commercial-products-card h3,
.commercial-products-card p { margin: 0; }
.commercial-products-card h3 { margin: 2px 0 4px; font-size: 16px; }
.commercial-products-card header p:last-child { color: var(--muted); font-size: 12px; }
.commercial-products-table { min-width: 860px; }
.commercial-products-table th { color: var(--bms-text-muted); font-size: 11px; }
.commercial-products-table th,
.commercial-products-table td { padding: 9px 10px; vertical-align: middle; }
.commercial-products-table th:first-child { width: 34%; }
.commercial-product-select,
.commercial-quantity-input { width: 100%; height: 36px; border: 1px solid var(--bms-border); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 0 9px; }
.commercial-quantity-input { min-width: 100px; }
.commercial-product-warning { display: block; margin-top: 4px; color: var(--bms-danger); font-size: 11px; }
.commercial-products-empty { padding: 18px; color: var(--muted); text-align: center; }

@media (max-width: 760px) {
  .commercial-products-card { padding: 11px; }
  .commercial-products-card > header { align-items: stretch; flex-direction: column; }
  .commercial-products-card > header .btn { width: 100%; }
}

.quotation-form {
  display: block;
}

.product-semi-heading,
.product-semi-cell {
  min-width: 118px;
  text-align: center;
}

.product-semi-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.product-semi-checkbox:disabled {
  cursor: not-allowed;
}

.sub-bom-mapping-modal .cost-mapping-card {
  width: min(720px, 100%);
}
.finished-goods-mapping-modal .cost-mapping-card{width:min(1120px,100%)}.finished-goods-mapping-modal .cost-mapping-results{display:block}.finished-goods-mapping-modal .table-wrap{max-height:52vh}.finished-goods-mapping-modal .cost-mapping-card>footer{gap:8px}

.sub-bom-mapping-modal .cost-mapping-facts {
  grid-template-columns: .55fr .7fr 1fr;
}

.deal-setting-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.deal-setting-input-row .deal-input { min-width: 0; }
.deal-interest-setting { grid-column: span 1; }
.deal-settings .deal-input-affix {
  position: relative;
  display: block;
  flex: 1 1 0;
  min-width: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-transform: none;
}
.deal-settings .deal-input-affix .deal-input { padding-right: 42px; }
.deal-settings .deal-input-affix em {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  pointer-events: none;
}
.deal-settings .deal-money-affix .deal-input { padding-right: 48px; }
.deal-rate-updated {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.deal-rate-refresh,
.deal-cost-detail-toggle {
  border: 1px solid #b9cde1;
  border-radius: 5px;
  background: #f5faff;
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

.deal-rate-refresh { width: 34px; height: 34px; font-size: 18px; line-height: 1; }
.deal-cost-detail-toggle {
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 3px 6px;
  font-size: 10px;
}
.deal-selling-cost-setting > span { padding-right: 68px; }
.deal-selling-cost-setting { align-self: start; }
.deal-cost-detail {
  display: grid;
  gap: 4px;
  margin-top: 3px;
  padding: 8px;
  border-radius: 5px;
  background: #f4f8fc;
  color: #38516a;
  font-size: 11px;
  line-height: 1.35;
}
.deal-cost-detail p { margin: 1px 0 0; }

.quotation-card {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(24, 61, 107, 0.05);
}

.quotation-document {
  min-width: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(28, 55, 90, .11);
}
.quotation-document-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  align-items: start;
  gap: 24px;
  padding: 26px 28px 22px;
  border-bottom: 2px solid #163f6c;
}
.quotation-document-kicker {
  margin: 0 0 3px;
  color: #557086;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
}
.quotation-heading-block h3 {
  margin: 0 0 18px;
  color: #103f72;
  font-size: clamp(25px, 2.2vw, 34px);
  letter-spacing: .04em;
}
.quotation-document-meta,
.quotation-party-grid {
  display: grid;
  gap: 8px 14px;
}
.quotation-document-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 13px; }
.quotation-document-meta > label:nth-child(1) { grid-column: 1; }
.quotation-document-meta > label:nth-child(2) { grid-column: 2; }
.quotation-document-meta > label:nth-child(3) { grid-column: 3 / 5; }
.quotation-party-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quotation-field-wide { grid-column: 1 / -1; }
.quotation-document label,
.quotation-customer-approval label {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.quotation-document label > span:first-child,
.quotation-customer-approval label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.quotation-document input,
.quotation-document textarea,
.quotation-document select {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-bottom-color: #d7e0e9;
  border-radius: 4px;
  padding: 5px 6px;
  color: #14253d;
  background: transparent;
  font: inherit;
  font-weight: 650;
  line-height: 1.35;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.quotation-document textarea { min-height: 38px; overflow: hidden; resize: none; }
.quotation-document input:hover,
.quotation-document textarea:hover,
.quotation-document select:hover { background: #f8fbff; }
.quotation-document input:focus,
.quotation-document textarea:focus,
.quotation-document select:focus {
  outline: 0;
  border-color: #6da4dd;
  background: #f5faff;
  box-shadow: 0 0 0 3px rgba(21, 89, 172, .1);
}
.quotation-inline-unit { position:relative; display:block; min-width:0; }
.quotation-inline-unit input { width:100%; min-width:0; padding-right:52px; }
.quotation-inline-unit em { position:absolute; top:50%; right:13px; color:var(--muted); font-size:11px; font-style:normal; line-height:1; white-space:nowrap; pointer-events:none; transform:translateY(-50%); }
.quotation-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid #d8e2ec;
  color: #123f6d;
  background: #f3f6f9;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .05em;
}
.quotation-section-title small { color: #718096; font-size: 11px; font-weight: 600; letter-spacing: 0; }
.quotation-items-section {
  --quotation-table-font-size: 15px;
  border-bottom: 1px solid #cfdbe7;
}
.quotation-items-section .quotation-section-title,
.quotation-items-section .quotation-section-title small {
  font-size: var(--quotation-table-font-size);
}
.quotation-table-wrap { max-width: 100%; border: 0; border-radius: 0; }
.quotation-items-table { width: 100%; min-width: 780px; table-layout: fixed; font-size: var(--quotation-table-font-size); }
.quotation-items-table th { padding: 9px 7px; color: #223b57; background: #e9edf2; font-size: var(--quotation-table-font-size); line-height: 1.25; text-align: center; }
.quotation-items-section .quotation-items-table td {
  padding: 9px 7px;
  border-color: #d8e0e8;
  font-size: var(--quotation-table-font-size);
  line-height: 1.35;
  vertical-align: middle;
}
.quotation-items-table th:nth-child(1) { width: 44px; }
.quotation-items-table th:nth-child(2) { width: 34%; }
.quotation-items-table th:nth-child(3) { width: 76px; }
.quotation-items-table th:nth-child(4) { width: 62px; }
.quotation-items-table th:nth-child(5),
.quotation-items-table th:nth-child(6) { width: 125px; }
.quotation-items-table th:nth-child(7) { width: 16%; }
.quotation-items-table .quotation-line-input { min-height: 42px; padding: 5px 6px; font-size: var(--quotation-table-font-size); font-weight: 600; }
.quotation-items-table .number { text-align: right; white-space: nowrap; }
.quotation-items-table .center { text-align: center; }
.quotation-totals {
  display: grid;
  width: min(410px, 100%);
  margin: 0 0 0 auto;
  padding: 8px 20px 12px;
}
.quotation-totals > div {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(120px, auto);
  align-items: center;
  gap: 18px;
  padding: 7px 0;
  border-bottom: 1px solid #d8e2ec;
}
.quotation-totals > div > span,
.quotation-totals label > span { color: #52677d; font-size: var(--quotation-table-font-size); font-weight: 800; }
.quotation-totals label { grid-template-columns: auto 78px; align-items: center; gap: 8px; }
.quotation-totals input { min-height: 30px; padding: 3px 5px; font-size: var(--quotation-table-font-size); text-align: right; }
.quotation-totals strong { font-size: var(--quotation-table-font-size); text-align: right; white-space: nowrap; }
.quotation-totals > div:last-child { color: #0d4f8f; font-size: var(--quotation-table-font-size); font-weight: 850; }
.quotation-export-section{border-top:1px solid var(--line);background:var(--surface-soft)}.quotation-export-section[hidden]{display:none}.quotation-export-section .quotation-section-title.compact{padding-block:9px}.quotation-export-grid,.quotation-export-costs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:12px 20px 16px}.quotation-export-costs{grid-template-columns:repeat(5,minmax(0,1fr))}.quotation-export-wide{grid-column:span 2}.quotation-export-section label{display:grid;gap:5px}.quotation-export-section label>span{color:var(--muted);font-size:10px;font-weight:800;text-transform:uppercase}.quotation-export-section input,.quotation-export-section textarea{background:var(--surface)}.quotation-export-section input[readonly]{color:var(--bms-info);background:var(--bms-info-soft);font-weight:800}
.quotation-terms-section { padding-bottom: 8px; }
.quotation-terms-list { display: grid; padding: 5px 20px 8px; }
.quotation-terms-list > label {
  grid-template-columns: minmax(170px, 24%) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid #e2e8ef;
}
.quotation-terms-list > label > span:first-child,
.quotation-terms-list > label > select:first-child { margin-top: 6px; }
.quotation-terms-list > label > select:first-child { color: #52677d; font-size: 11px; text-transform: uppercase; }
.quotation-bank-fields { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(160px, .7fr); gap: 10px; }
.quotation-document-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid #ccd9e5;
  background: #f8fafc;
}
.quotation-document-actions p { margin: 0; color: var(--muted); font-size: 11px; }
.quotation-document-actions > div { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
#quotationSaveState[data-state="saving"] { color:#8a6200; }
#quotationSaveState[data-state="saved"] { color:#167445; }
#quotationSaveState[data-state="error"] { color:#b42318; }
.quotation-roadmap-card {
  width:100%; min-width:0; margin:0 0 14px; padding:12px;
  border:1px solid #cfe0f2; border-radius:10px; background:linear-gradient(180deg,#fbfdff,#f4f8fd);
}
.quotation-roadmap-card > header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.quotation-roadmap-card > header div { display:flex; align-items:center; gap:10px; }
.quotation-roadmap-card > header small { color:#60758c; font-size:10px; font-weight:800; letter-spacing:.08em; }
.quotation-roadmap-card > header strong { color:#0b5bb3; font-size:12px; }
.quotation-roadmap-card > header > span { color:#718096; font-size:11px; }
.quotation-roadmap-scroll { max-width:100%; overflow-x:auto; overscroll-behavior-inline:contain; scrollbar-width:thin; }
.quotation-roadmap-track { display:grid; grid-template-columns:repeat(5,minmax(112px,1fr)); align-items:stretch; gap:6px; width:100%; min-width:620px; padding:14px 2px 9px; }
.quotation-roadmap-step {
  position:relative; display:grid; place-items:center;
  min-width:0; min-height:70px; margin-bottom:18px; padding:9px 12px 12px; border:1px solid #d5e1ee; border-radius:9px;
  color:#17233b; background:#fff; text-align:center; cursor:pointer; transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;
}
.quotation-roadmap-step:not(:last-child)::after { content:""; position:absolute; left:100%; top:50%; width:7px; height:2px; background:#b8c8d9; }
.quotation-roadmap-step:hover,.quotation-roadmap-step:focus-visible { z-index:2; transform:translateY(-2px); border-color:#4d91d8; box-shadow:0 7px 16px rgb(16 65 112 / 15%); outline:none; }
.quotation-roadmap-step:disabled { cursor:not-allowed; }
.quotation-roadmap-step:disabled:hover { z-index:auto; transform:none; border-color:#d5e1ee; box-shadow:none; }
.quotation-roadmap-step[aria-disabled="true"] { cursor:not-allowed; opacity:.55; }
.quotation-roadmap-step[aria-disabled="true"]:hover { z-index:auto; transform:none; border-color:#d5e1ee; box-shadow:none; }
.quotation-roadmap-step.is-current { border:2px solid #0b66c3; box-shadow:0 0 0 3px rgb(11 102 195 / 10%); }
.quotation-roadmap-copy { display:grid; place-items:center; gap:4px; width:100%; min-width:0; }
.quotation-roadmap-copy strong { display:-webkit-box; overflow:hidden; color:#17233b; font-size:10px; line-height:1.2; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.quotation-roadmap-step > em { position:absolute; right:5px; top:3px; color:#58718a; font-size:9px; font-style:normal; }
.quotation-roadmap-step.status-completed { border-color:#69ad87; background:#e8f6ee; }
.quotation-roadmap-step.status-in_progress { border-color:#6da5dd; background:#eaf4ff; }
.quotation-roadmap-step.status-waiting_internal,
.quotation-roadmap-step.status-waiting_director_approval,
.quotation-roadmap-step.status-waiting_director_signature,
.quotation-roadmap-step.status-waiting_customer,
.quotation-roadmap-step.status-needs_revision { border-color:#9d82d2; background:#f0eafd; }
.quotation-roadmap-step.status-waiting_internal.is-current,
.quotation-roadmap-step.status-waiting_director_approval.is-current,
.quotation-roadmap-step.status-waiting_director_signature.is-current,
.quotation-roadmap-step.status-waiting_customer.is-current,
.quotation-roadmap-step.status-needs_revision.is-current { border-color:#8057c7; box-shadow:0 0 0 3px rgb(128 87 199 / 13%); }
.quotation-roadmap-step.status-rejected,
.quotation-roadmap-step.status-blocked { border-color:#e18d8d; background:#fff1f1; }
.quotation-roadmap-step.status-waiting_document { border-color:#d5a62f; background:#fff8dd; }
.quotation-roadmap-step.is-document-missing { border-color:#d5a62f; background:#fff8dd; }
.quotation-roadmap-step.is-document-missing.is-current { border-color:#c28b09; box-shadow:0 0 0 3px rgb(194 139 9 / 15%); }
.quotation-roadmap-warning { position:absolute; z-index:2; top:-10px; left:50%; padding:3px 7px; transform:translateX(-50%); border:1px solid #b87800; border-radius:999px; background:#fff1b8; color:#604000; font-size:8px; font-weight:800; line-height:1.2; white-space:nowrap; box-shadow:0 3px 7px rgb(91 67 8 / 18%); }
.quotation-roadmap-quick-check { position:absolute; z-index:3; left:50%; bottom:-14px; display:grid; place-items:center; width:28px; height:28px; padding:0; transform:translateX(-50%); border:2px solid #7b8997; border-radius:50%; background:#eef2f6; color:#526170; font-size:14px; font-weight:800; line-height:1; cursor:pointer; opacity:1; filter:none; box-shadow:0 0 0 2px #fff; transition:transform .16s ease,border-color .16s ease,background-color .16s ease,color .16s ease; }
.quotation-roadmap-quick-check svg { width:15px; height:15px; overflow:visible; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.quotation-roadmap-quick-check:not(:disabled):hover { transform:translate(-50%,-2px) scale(1.06); border-color:#1764c0; color:#1764c0; background:#eef5fd; }
.quotation-roadmap-quick-check:disabled { cursor:default; opacity:1; filter:none; }
.quotation-roadmap-quick-check.is-confirmed { border-color:#075b32; background:#079447; color:#fff; box-shadow:0 0 0 3px #9fe1bc; }
.quotation-roadmap-quick-check.is-confirmed:disabled { border-color:#075b32; background-color:#079447; color:#fff; opacity:1; filter:none; }
.quotation-roadmap-quick-check.is-confirmed.is-warning { border-color:#744700; background:#d28b00; color:#fff; box-shadow:0 0 0 3px #ffd66f; }
.quotation-roadmap-quick-check.is-confirmed.is-warning:disabled { border-color:#744700; background-color:#d28b00; color:#fff; opacity:1; filter:none; }
.quotation-roadmap-step.status-rejected.is-current,
.quotation-roadmap-step.status-blocked.is-current { border-color:#c52d2d; box-shadow:0 0 0 3px rgb(197 45 45 / 12%); }
.workflow-action-dot { position:absolute; top:6px; right:7px; width:10px; height:10px; border:2px solid #fff; border-radius:50%; background:#e02424; box-shadow:0 0 0 1px rgb(224 36 36 / 25%); }
.quotation-roadmap-dialog { width:min(560px,calc(100vw - 24px)); padding:0; border:0; border-radius:12px; box-shadow:0 24px 70px rgb(9 34 60 / 28%); }
.quotation-roadmap-dialog::backdrop,.quotation-pdf-dialog::backdrop { background:rgb(11 30 50 / 48%); }
.quotation-roadmap-dialog-card { display:grid; gap:13px; padding:18px; }
.quotation-roadmap-dialog-card > header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.quotation-roadmap-dialog-card header small { color:#0b5bb3; font-size:10px; font-weight:800; letter-spacing:.08em; }
.quotation-roadmap-dialog-card header h3 { margin:3px 0 0; }
.quotation-roadmap-dialog-card header button { border:0; background:transparent; font-size:24px; cursor:pointer; }
.quotation-roadmap-dialog-card label { display:grid; gap:6px; }
.quotation-roadmap-dialog-card .roadmap-internal-field[hidden] { display:none !important; }
.quotation-roadmap-dialog-card label > span { font-size:12px; font-weight:750; }
.quotation-roadmap-dialog-card label > small { color:#718096; font-size:10px; }
.quotation-roadmap-dialog-card select,.quotation-roadmap-dialog-card textarea,.quotation-roadmap-dialog-card input { width:100%; border:1px solid #cbd9e8; border-radius:7px; padding:9px; background:#fff; }
.quotation-roadmap-dialog-card #quotationRoadmapUploadBtn { justify-self:start; }
.quotation-roadmap-dialog-card footer { display:flex; justify-content:flex-end; gap:8px; }
.quotation-roadmap-dialog-card footer .roadmap-dialog-revoke { margin-right:auto; }
.quotation-roadmap-dialog-card button[hidden] { display:none !important; }
.director-decision-dialog { width:min(520px,calc(100vw - 24px)); }
.director-decision-dialog-card { gap:14px; }
.director-decision-message { margin:0; color:var(--bms-text-muted,var(--muted)); font-size:13px; line-height:1.5; }
.director-decision-dialog-card textarea { min-height:104px; resize:vertical; }
.director-decision-dialog-card textarea[aria-invalid="true"] { border-color:var(--bms-danger,var(--red)); box-shadow:0 0 0 3px color-mix(in srgb,var(--bms-danger,var(--red)) 12%,transparent); }
.director-decision-error { margin:0; padding:8px 10px; border-radius:7px; color:var(--bms-danger,var(--red)); background:var(--bms-danger-soft,var(--surface-soft)); font-size:12px; font-weight:700; }
.approval-actions[hidden] { display:none !important; }
.quotation-roadmap-attachments { display:grid; gap:7px; max-height:180px; overflow:auto; }
.quotation-roadmap-attachments article { display:flex; align-items:center; gap:8px; padding:8px; border:1px solid #dce6f0; border-radius:7px; }
.quotation-roadmap-attachments article div { display:grid; min-width:0; margin-right:auto; }
.quotation-roadmap-attachments strong { overflow:hidden; font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.quotation-roadmap-attachments small { color:#718096; font-size:10px; }
.quotation-roadmap-attachments button { border:0; color:#0b5bb3; background:transparent; cursor:pointer; font-weight:700; }
.quotation-pdf-dialog { width:min(1180px,calc(100vw - 24px)); height:min(92vh,900px); padding:0; border:0; border-radius:12px; }
.quotation-pdf-dialog > section { display:grid; grid-template-rows:auto 1fr; height:100%; background:#e9eef4; }
.quotation-pdf-dialog > section > header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; background:#fff; border-bottom:1px solid #ccd8e4; }
.quotation-pdf-dialog > section > header h3 { margin:0; }
.quotation-pdf-dialog > section > header div { display:flex; gap:8px; }
#quotationPdfPreview { overflow:auto; padding:20px; }
#quotationPdfPreview .quotation-document { width:min(1050px,100%); margin:auto; background:#fff; box-shadow:0 8px 30px rgb(20 50 80 / 12%); }
.quotation-print-value { min-height:24px; white-space:pre-wrap; }
.quotation-approval-card { position: static; align-self: start; }
.quotation-customer-approval { display: grid; grid-template-columns: 1fr; gap: 9px; }
.quotation-customer-approval input,
.quotation-customer-approval select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 36px;
  padding: 6px 8px;
  color: var(--ink);
  background: var(--surface);
}

.quotation-approval-card {
  border: 1px solid color-mix(in srgb, var(--blue) 45%, var(--line));
  border-top: 3px solid var(--blue);
  background: linear-gradient(145deg, color-mix(in srgb, var(--blue) 8%, var(--surface)), var(--surface) 58%);
  box-shadow: 0 10px 26px rgba(21, 89, 172, 0.13);
}

.quotation-approval-header {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 11px;
}

.quotation-approval-header h3 {
  margin: 0 0 2px;
  color: var(--blue);
}

.quotation-approval-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.quotation-approval-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 5px 12px rgba(21, 89, 172, 0.25);
}

.quotation-approval-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Material warehouse */
.warehouse-panel{position:relative;min-width:0}.warehouse-title{align-items:center;margin-bottom:14px;border-bottom:1px solid var(--line)}.warehouse-section-tabs{display:flex;gap:4px;overflow:auto}.warehouse-section-tabs button{padding:11px 16px;border:0;border-bottom:3px solid transparent;color:var(--muted);background:transparent;font-weight:800;white-space:nowrap;cursor:pointer}.warehouse-section-tabs button.active{color:var(--blue);border-bottom-color:var(--blue)}.warehouse-section-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin:-2px 0 12px}.warehouse-metrics{margin-bottom:14px}.warehouse-metrics .metric{pointer-events:none;user-select:none}.warehouse-card{border:1px solid var(--line);border-radius:10px;background:var(--surface);overflow:hidden}.warehouse-toolbar{display:flex;align-items:end;justify-content:space-between;gap:12px;padding:12px 14px;border-bottom:1px solid var(--line);background:var(--surface-soft)}.warehouse-toolbar .inventory-filters{padding:3px;border:1px solid var(--line);border-radius:8px;background:var(--surface)}.warehouse-toolbar .inventory-filter{min-height:32px;border:0;border-radius:6px;padding:0 13px}.warehouse-toolbar .inventory-filter.active{box-shadow:0 3px 8px color-mix(in srgb,var(--blue) 18%,transparent)}.warehouse-table{min-width:1080px}.warehouse-fg-table{min-width:1380px}.warehouse-table td small{display:block;margin-top:3px;color:var(--muted)}.warehouse-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px}.warehouse-panel>.inventory-drawer{position:absolute;inset:0 0 0 auto;width:min(560px,100%);height:100%;z-index:35}
#warehouseMaterialSection .warehouse-table{width:100%;min-width:1540px;table-layout:fixed}#warehouseMaterialSection .warehouse-table th,#warehouseMaterialSection .warehouse-table td{overflow-wrap:anywhere}#warehouseMaterialSection .warehouse-table th:nth-child(1){width:7%}#warehouseMaterialSection .warehouse-table th:nth-child(2){width:17%}#warehouseMaterialSection .warehouse-table th:nth-child(3){width:6%}#warehouseMaterialSection .warehouse-table th:nth-child(4){width:4%}#warehouseMaterialSection .warehouse-table th:nth-child(5){width:7%}#warehouseMaterialSection .warehouse-table th:nth-child(6){width:7%}#warehouseMaterialSection .warehouse-table th:nth-child(7),#warehouseMaterialSection .warehouse-table th:nth-child(8),#warehouseMaterialSection .warehouse-table th:nth-child(9),#warehouseMaterialSection .warehouse-table th:nth-child(10){width:5%}#warehouseMaterialSection .warehouse-table th:nth-child(11){width:8%}#warehouseMaterialSection .warehouse-table th:nth-child(12){width:10%}#warehouseMaterialSection .warehouse-table th:nth-child(13){width:7%}#warehouseMaterialSection .warehouse-table th:nth-child(14){width:292px}#warehouseMaterialSection .warehouse-table td:nth-child(2)>*,#warehouseMaterialSection .warehouse-table td:nth-child(5),#warehouseMaterialSection .warehouse-table td:nth-child(13){display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2}#warehouseMaterialSection .inventory-row-actions{flex-wrap:nowrap}#warehouseMaterialSection .inventory-row-actions .btn{flex:0 0 auto;min-width:62px;overflow-wrap:normal;word-break:normal}
body[data-business-profile="XOP_ME_LINH"] #warehouseMaterialSection.xop-warehouse-simple .warehouse-table{min-width:880px;table-layout:auto}body[data-business-profile="XOP_ME_LINH"] #warehouseMaterialSection.xop-warehouse-simple .warehouse-table th:nth-child(n){width:auto}body[data-business-profile="XOP_ME_LINH"] #warehouseMaterialSection.xop-warehouse-simple .warehouse-table th:first-child{width:25%}body[data-business-profile="XOP_ME_LINH"] #warehouseMaterialSection.xop-warehouse-simple .warehouse-table th:last-child{width:240px}body[data-business-profile="XOP_ME_LINH"] #warehouseFinishedSection.xop-warehouse-simple .warehouse-fg-table{min-width:940px}body[data-business-profile="XOP_ME_LINH"] .xop-warehouse-simple .warehouse-date-filter,body[data-business-profile="XOP_ME_LINH"] #warehouseFinishedSection.xop-warehouse-simple #warehouseFgCreateBtn[hidden],body[data-business-profile="XOP_ME_LINH"] #warehouseFinishedSection.xop-warehouse-simple #warehouseFgImportBtn[hidden]{display:none!important}body[data-business-profile="XOP_ME_LINH"] .xop-warehouse-simple .warehouse-table th{white-space:nowrap}body[data-business-profile="XOP_ME_LINH"] .xop-warehouse-simple .warehouse-table td{vertical-align:middle}body[data-business-profile="XOP_ME_LINH"] .xop-warehouse-simple .inventory-row-actions{flex-wrap:wrap;gap:5px}body[data-business-profile="XOP_ME_LINH"] .xop-warehouse-simple .inventory-row-actions .btn{min-width:0;padding:7px 9px;white-space:nowrap}body[data-business-profile="XOP_ME_LINH"] .xop-warehouse-quantity>strong,body[data-business-profile="XOP_ME_LINH"] .xop-warehouse-quantity>small{display:block;white-space:nowrap}body[data-business-profile="XOP_ME_LINH"] .xop-warehouse-blocked{color:var(--danger)!important;font-weight:700}.xop-warehouse-form-summary{display:flex;flex-direction:column;gap:4px;padding:12px;border:1px solid var(--line);border-radius:9px;background:var(--surface-soft)}.xop-warehouse-form-summary span,.xop-warehouse-form-summary small{color:var(--muted);font-size:12px}.xop-warehouse-form-summary strong{font-size:15px}
.warehouse-toolbar-fields{display:flex;align-items:end;gap:10px}.warehouse-toolbar-fields>label{display:grid;gap:4px;color:var(--muted);font-size:10px;font-weight:800;text-transform:uppercase}.warehouse-toolbar-fields select{min-width:150px;min-height:38px;padding:7px 30px 7px 9px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink)}.warehouse-reference-form{display:grid;gap:10px;margin-top:12px;padding:12px;border:1px solid var(--line);border-radius:8px;background:var(--surface-soft)}.warehouse-reference-form h4{margin:0;color:var(--ink)}.warehouse-reference-form>label{display:grid;gap:5px;color:var(--muted);font-size:11px;font-weight:700}.warehouse-reference-form textarea{width:100%;resize:vertical}.warehouse-image-preview{display:flex;align-items:center;gap:10px}.warehouse-image-preview img{width:88px;height:68px;object-fit:cover;border:1px solid var(--line);border-radius:7px;background:var(--surface)}.warehouse-image-preview span{color:var(--muted);font-size:11px}.warehouse-product-link{display:inline-flex;align-items:center;gap:4px;color:var(--blue);font-size:12px;font-weight:800;text-decoration:none}.warehouse-product-link:hover{text-decoration:underline}
.warehouse-material-cell{display:grid;grid-template-columns:minmax(120px,1fr) auto;align-items:start;gap:8px;min-width:240px}.warehouse-material-reference{display:flex;align-items:flex-start;gap:7px}.warehouse-material-reference>div{display:grid;gap:3px;max-width:180px}.warehouse-material-image{display:block;width:76px;height:42px}.warehouse-material-thumb{width:76px;height:42px;flex:0 0 76px;object-fit:cover;border:1px solid var(--line);border-radius:6px;background:var(--surface-soft)}.warehouse-material-thumb.placeholder{display:flex;align-items:center;justify-content:center;gap:5px;padding:5px;color:var(--muted);font-size:10px;line-height:1.1;text-align:left}.warehouse-material-thumb.placeholder[hidden]{display:none}.warehouse-material-thumb.placeholder svg{width:17px;height:17px;flex:0 0 17px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.warehouse-material-thumb.placeholder small{color:inherit;font-size:9px;font-weight:700}.warehouse-purchase-note{display:-webkit-box!important;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:1.35}.warehouse-purchase-note strong{color:var(--ink)}
.warehouse-import-dialog{width:min(760px,calc(100vw - 28px));max-width:none;max-height:min(90dvh,820px);padding:0;overflow:auto;border:1px solid var(--line);border-radius:14px;color:var(--ink);background:var(--surface)}.warehouse-import-dialog::backdrop{background:rgba(15,29,46,.5);backdrop-filter:blur(2px)}.warehouse-import-dialog>header{position:sticky;z-index:2;top:0;display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--line);background:var(--surface)}.warehouse-import-dialog h3{margin:3px 0 0;color:var(--ink-strong)}.warehouse-import-body{display:grid;gap:14px;padding:18px}.warehouse-import-dropzone{display:grid;place-items:center;gap:5px;min-height:150px;padding:20px;border:2px dashed #8bb7e6;border-radius:12px;background:var(--surface-soft);text-align:center;cursor:pointer;transition:.18s ease}.warehouse-import-dropzone:hover,.warehouse-import-dropzone.dragging,.warehouse-import-dropzone:focus-visible{border-color:var(--brand);background:color-mix(in srgb,var(--brand-soft) 70%,var(--surface));outline:0;box-shadow:0 0 0 3px color-mix(in srgb,var(--brand) 18%,transparent)}.warehouse-import-dropzone strong{color:var(--brand);font-size:16px}.warehouse-import-dropzone span,.warehouse-import-dropzone small{color:var(--muted)}.warehouse-import-file{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 13px;border:1px solid var(--line);border-radius:9px;background:var(--surface-soft)}.warehouse-import-file[hidden],.warehouse-import-preview[hidden]{display:none!important}.warehouse-import-file strong,.warehouse-import-file small{display:block}.warehouse-import-file small{margin-top:3px;color:var(--muted)}.warehouse-import-help{position:relative;padding:13px 160px 13px 15px;border:1px solid var(--line);border-radius:10px}.warehouse-import-help p{margin:0}.warehouse-import-help ol{margin:7px 0 0;padding-left:20px;color:var(--muted);line-height:1.55}.warehouse-import-help .btn{position:absolute;right:13px;top:13px}.warehouse-import-preview{display:grid;gap:12px}.warehouse-import-stat-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.warehouse-import-stat{padding:10px;border:1px solid var(--line);border-radius:9px;background:var(--surface-soft)}.warehouse-import-stat span,.warehouse-import-stat strong{display:block}.warehouse-import-stat span{color:var(--muted);font-size:11px}.warehouse-import-stat strong{margin-top:4px;font-size:18px}.warehouse-import-messages{max-height:180px;overflow:auto;border:1px solid var(--line);border-radius:9px}.warehouse-import-message{padding:8px 10px;border-bottom:1px solid var(--line);font-size:12px}.warehouse-import-message:last-child{border-bottom:0}.warehouse-import-message.error{color:#a61b1b;background:#fff3f3}.warehouse-import-message.warning{color:#7a4a00;background:#fff9e9}.warehouse-import-error{min-height:18px;margin:0;color:#b91c1c;font-weight:700}.warehouse-import-dialog>footer{position:sticky;bottom:0;display:flex;justify-content:flex-end;gap:8px;padding:13px 18px;border-top:1px solid var(--line);background:var(--surface)}
.warehouse-reserved-value{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;white-space:nowrap}.warehouse-reservation-button{display:inline-grid;place-items:center;width:30px;height:30px;padding:0;border:1px solid #b9d5f7;border-radius:7px;color:#0757b8;background:#eff6ff;font-size:14px;line-height:1;cursor:pointer}.warehouse-reservation-button:hover,.warehouse-reservation-button:focus-visible{border-color:#0757b8;background:#dbeafe;outline:2px solid rgba(7,87,184,.18);outline-offset:1px}.reservation-summary{display:grid;gap:3px;margin:14px 0 10px;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--surface-soft)}.reservation-summary span{color:var(--muted);font-size:11px}.reservation-detail-wrap{max-width:100%;border:1px solid var(--line);border-radius:8px}.reservation-detail-table{min-width:820px}.reservation-detail-table th,.reservation-detail-table td{padding:8px;font-size:12px;vertical-align:top}.reservation-detail-table td small{display:block;margin-top:3px;color:var(--muted)}
@media(max-width:700px){.warehouse-title,.warehouse-toolbar,.dashboard-actions{align-items:stretch;flex-direction:column}.warehouse-toolbar-fields{align-items:stretch;flex-direction:column}.warehouse-toolbar-fields select{width:100%}.dashboard-actions{min-width:0;width:100%}.dashboard-actions .search-box input{width:100%}.warehouse-form-grid{grid-template-columns:1fr}.warehouse-section-actions{justify-content:stretch}.warehouse-section-actions .btn{flex:1}.warehouse-reservation-button{width:36px;height:36px}.reservation-detail-table{min-width:760px}.warehouse-import-dialog{width:100vw;height:100dvh;max-height:none;border:0;border-radius:0}.warehouse-import-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.warehouse-import-help{padding:13px}.warehouse-import-help .btn{position:static;margin-top:10px;width:100%}.warehouse-import-dialog>footer{padding-bottom:max(13px,var(--bms-safe-area-bottom))}.warehouse-import-dialog>footer .btn{flex:1;padding-inline:8px}}
@media(max-width:700px){.quotation-export-grid,.quotation-export-costs{grid-template-columns:minmax(0,1fr);padding-inline:14px}.quotation-export-wide{grid-column:auto}}
@media print{body *{visibility:hidden}.warehouse-panel,.warehouse-panel *{visibility:visible}.warehouse-panel{display:block!important;position:absolute;inset:0;width:100%;padding:0}.warehouse-panel .toolbar,.warehouse-toolbar,.inventory-row-actions,.warehouse-panel>.inventory-drawer{display:none!important}.warehouse-table{min-width:0;font-size:9px}.warehouse-card{border:0}}
.inventory-panel { position: relative; overflow: hidden; }
.inventory-panel.active { display: block; }
.inventory-header { display:flex; justify-content:space-between; align-items:flex-end; gap:18px; margin-bottom:14px; }
.inventory-header .eyebrow { color:var(--blue); }
.inventory-context { margin:5px 0 0; color:var(--muted); font-size:13px; }
.inventory-selector { display:flex; align-items:end; gap:8px; }
.inventory-selector label,.inventory-search { display:grid; gap:5px; color:var(--muted); font-size:11px; font-weight:700; text-transform:uppercase; }
.inventory-selector select,.inventory-search input,.inventory-drawer input,.inventory-drawer select,.inventory-drawer textarea { min-height:36px; padding:7px 9px; color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:6px; }
.inventory-selector select { min-width:260px; }
.inventory-alert { margin-bottom:12px; padding:10px 12px; color:#92400e; background:#fffbeb; border:1px solid #f3cf77; border-radius:7px; font-size:13px; }
.inventory-alert[hidden] { display:none; }
.inventory-metrics { display:grid; grid-template-columns:repeat(5,minmax(120px,1fr)); gap:9px; margin-bottom:12px; }
.inventory-metric { padding:12px; border:1px solid var(--line); border-radius:7px; background:var(--surface-soft); }
.inventory-metric span { display:block; color:var(--muted); font-size:11px; font-weight:700; }
.inventory-metric strong { display:block; margin-top:5px; font-size:20px; }
.inventory-metric.fulfilment { color:#fff; border-color:transparent; background:linear-gradient(135deg,#0757b8,#0f766e); }
.inventory-metric.fulfilment span { color:#dbeafe; }
.inventory-workspace { display:grid; grid-template-columns:minmax(0,1fr) 270px; gap:12px; align-items:start; }
.inventory-main-card,.purchase-panel { border:1px solid var(--line); border-radius:8px; background:var(--surface-soft); }
.inventory-toolbar { display:flex; justify-content:space-between; align-items:end; gap:12px; padding:10px; }
.inventory-filters { display:flex; flex-wrap:wrap; gap:5px; }
.inventory-filter { min-height:30px; padding:0 9px; color:var(--muted); background:var(--surface); border:1px solid var(--line); border-radius:999px; cursor:pointer; font-size:11px; font-weight:700; }
.inventory-filter.active { color:#fff; background:var(--blue); border-color:var(--blue); }
.inventory-search input { min-width:210px; text-transform:none; }
.inventory-table-wrap { border-width:1px 0 0; border-radius:0 0 8px 8px; max-height:480px; }
.inventory-table { min-width:1050px; }
.inventory-table th { position:sticky; top:0; z-index:1; }
.inventory-table td { vertical-align:middle; }
.inventory-material-cell { display:grid; gap:2px; min-width:180px; }
.inventory-material-cell small { color:var(--muted); }
.inventory-number { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
.inventory-status { display:inline-flex; align-items:center; gap:5px; padding:4px 8px; border-radius:999px; font-size:11px; font-weight:800; white-space:nowrap; }
.inventory-status.sufficient,.inventory-status.reserved { color:#166534; background:#dcfce7; }
.inventory-status.shortage,.inventory-status.out_of_stock { color:#991b1b; background:#fee2e2; }
.inventory-status.unmapped { color:#92400e; background:#fef3c7; }
.inventory-status.purchase_additional { color:#9a3412; background:#ffedd5; border:1px solid #fdba74; }
.inventory-row-actions { display:flex; gap:5px; }
.inventory-row-actions .btn { min-height:30px; padding:0 9px; font-size:11px; }
.purchase-panel { position:relative; display:grid; gap:10px; padding:14px; border-color:#9ec7ef; background:linear-gradient(180deg,var(--brand-soft),var(--surface)); }
.purchase-panel-update { position:absolute; top:12px; right:12px; min-height:34px; padding:0 12px; }
.purchase-panel-icon { display:grid; place-items:center; width:34px; height:34px; color:#fff; background:var(--blue); border-radius:50%; font-size:19px; }
.inventory-kicker { color:var(--blue); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.05em; }
.purchase-panel p { margin:0; color:var(--muted); font-size:12px; line-height:1.45; }
.purchase-lines { display:grid; gap:6px; }
.purchase-line { display:flex; justify-content:space-between; gap:8px; padding:7px 0; border-bottom:1px solid var(--line); font-size:11px; }
.inventory-footer { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-top:12px; padding:11px 12px; border:1px solid var(--line); border-radius:8px; background:var(--surface-soft); }
.inventory-footer > div:first-child { display:grid; gap:3px; }
.inventory-footer span { color:var(--muted); font-size:11px; }
.inventory-drawer { position:absolute; z-index:20; top:0; right:0; width:min(430px,100%); height:100%; padding:16px; overflow:auto; background:var(--surface); border-left:1px solid var(--line); box-shadow:-18px 0 38px rgba(15,23,42,.16); }
.inventory-drawer[hidden] { display:none; }
.inventory-drawer header { display:flex; justify-content:space-between; gap:12px; align-items:start; padding-bottom:12px; border-bottom:1px solid var(--line); }
.inventory-drawer-form { display:grid; gap:11px; margin-top:14px; }
.inventory-drawer-form label { display:grid; gap:5px; color:var(--muted); font-size:11px; font-weight:700; }
.inventory-item-option { display:grid; grid-template-columns:1fr auto; gap:8px; align-items:center; padding:10px 0; border-bottom:1px solid var(--line); }
.inventory-item-option small { display:block; color:var(--muted); margin-top:3px; }
#inventoryHandoffs { min-width:0; margin-top:var(--space-4,16px); }
#inventoryHandoffs .inventory-item-option { grid-template-columns:minmax(0,1fr); }
#inventoryHandoffs .inventory-item-option > div { min-width:0; }
#inventoryHandoffs summary { cursor:pointer; padding:var(--space-2,8px) 0; }
#inventoryHandoffs .toolbar { flex-wrap:wrap; }
#inventoryHandoffs .table-wrap,#inventoryHandoffConfirm .table-wrap { max-width:100%; max-height:360px; overflow:auto; }
#inventoryHandoffs table,#inventoryHandoffConfirm table { min-width:420px; width:100%; }
.inventory-empty { padding:34px 18px !important; color:var(--muted); text-align:center; }
@media (max-width:1100px){.inventory-metrics{grid-template-columns:repeat(3,1fr)}.inventory-workspace{grid-template-columns:1fr}.purchase-panel{grid-template-columns:auto 1fr;}.purchase-panel p,.purchase-lines,.purchase-panel .btn{grid-column:1/-1}}
@media (max-width:700px){.inventory-header,.inventory-footer{align-items:stretch;flex-direction:column}.inventory-selector{align-items:stretch;flex-direction:column}.inventory-selector select{min-width:0;width:100%}.inventory-metrics{grid-template-columns:repeat(2,1fr)}.inventory-toolbar{align-items:stretch;flex-direction:column}.inventory-search input{width:100%;min-width:0}}

/* QC approval */
.qc-panel { position:relative; overflow:hidden; }
.qc-header,.qc-detail>header { display:flex; justify-content:space-between; align-items:flex-end; gap:18px; margin-bottom:12px; }
.qc-header .eyebrow { color:var(--blue); }
.qc-header p,.qc-detail header p { margin:4px 0 0; color:var(--muted); font-size:12px; }
.qc-metrics { display:grid; grid-template-columns:repeat(5,minmax(120px,1fr)); gap:9px; margin-bottom:12px; }
.qc-metric { padding:12px; border:1px solid var(--line); border-radius:8px; background:var(--surface-soft); }
.qc-metric span { display:block; color:var(--muted); font-size:11px; font-weight:700; }
.qc-metric strong { display:block; margin-top:5px; font-size:20px; }
.qc-project-empty { display:grid; justify-items:center; gap:7px; padding:28px 18px; border:1px dashed var(--line); border-radius:8px; background:var(--surface-soft); text-align:center; }
.qc-project-empty[hidden] { display:none; }
.qc-project-empty h3,.qc-project-empty p { margin:0; }
.qc-project-empty p { max-width:520px; color:var(--muted); font-size:12px; }
.qc-toolbar { display:flex; gap:10px; margin-bottom:10px; padding:10px; border:1px solid var(--line); border-radius:8px; background:var(--surface-soft); }
.qc-toolbar label { display:grid; gap:4px; color:var(--muted); font-size:10px; font-weight:800; text-transform:uppercase; }
.qc-toolbar input,.qc-toolbar select,.qc-form input,.qc-form select,.qc-form textarea { min-height:36px; padding:7px 9px; color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:6px; }
.qc-toolbar input { min-width:280px; }
.qc-table,.qc-item-table { min-width:1100px; }
.qc-progress { display:grid; gap:4px; min-width:90px; }
.qc-progress-bar { height:6px; overflow:hidden; border-radius:999px; background:#dbe5f1; }
.qc-progress-bar i { display:block; height:100%; background:var(--green); }
.qc-status { display:inline-flex; align-items:center; gap:5px; padding:4px 8px; border-radius:999px; font-size:10px; font-weight:800; white-space:nowrap; }
.qc-status.not_ready { color:#475569;background:#e2e8f0 }.qc-status.waiting_qc {color:#075985;background:#e0f2fe}.qc-status.inspecting {color:#854d0e;background:#fef9c3}.qc-status.has_issues,.qc-status.failed,.qc-status.rework_required {color:#991b1b;background:#fee2e2}.qc-status.waiting_reinspection {color:#9a3412;background:#ffedd5}.qc-status.partially_passed {color:#075985;background:#dbeafe}.qc-status.passed,.qc-status.completed {color:#166534;background:#dcfce7}
.qc-detail { padding:13px; border:1px solid var(--line); border-radius:8px; background:var(--surface-soft); }
.qc-detail[hidden] { display:none; }
.qc-summary { display:grid; grid-template-columns:repeat(5,minmax(130px,1fr)); gap:8px; margin-bottom:10px; }
.qc-summary div { display:grid; gap:3px; padding:9px; border:1px solid var(--line); border-radius:6px; background:var(--surface); }
.qc-summary span { color:var(--muted); font-size:10px; text-transform:uppercase; }.qc-summary strong{font-size:12px}
.qc-actions { display:flex; flex-wrap:wrap; gap:5px; }.qc-actions .btn{min-height:29px;padding:0 8px;font-size:10px}
.qc-drawer-backdrop { position:fixed; z-index:90; inset:0; background:rgba(15,23,42,.42); backdrop-filter:blur(2px); }
.qc-drawer-backdrop[hidden]{display:none}.qc-drawer { position:fixed; z-index:91; inset:0 0 0 auto; width:min(760px,100vw); max-width:100%; padding:0 16px; overflow-y:auto; overflow-x:hidden; background:var(--surface); border-left:1px solid var(--line); box-shadow:-18px 0 38px rgba(15,23,42,.22); }
.qc-drawer[hidden]{display:none}.qc-drawer>header{position:sticky;z-index:2;top:0;display:flex;justify-content:space-between;gap:12px;padding:16px 0 11px;background:var(--surface);border-bottom:1px solid var(--line)}
.qc-form { display:grid; gap:13px; margin:14px 0 0; padding-bottom:16px; }.qc-form>label,.qc-form-section>label{display:grid;gap:5px;min-width:0;color:var(--muted);font-size:11px;font-weight:700}.qc-form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.qc-form-grid>label{display:grid;gap:5px;min-width:0}.qc-form-grid input,.qc-form-grid select,.qc-form-grid textarea{box-sizing:border-box;width:100%;min-width:0}.qc-form-section{display:grid;gap:10px;padding:13px;border:1px solid var(--line);border-radius:9px;background:var(--surface-soft)}.qc-form-section>h3{margin:0;color:var(--ink);font-size:13px}.qc-section-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px}.qc-section-heading h3{margin:0;font-size:13px}.qc-section-heading span{color:var(--muted);font-size:10px}.qc-defect-fields{border-color:#fecaca;background:#fffafa}.qc-drawer-actions{position:sticky;z-index:2;bottom:0;display:flex;justify-content:flex-end;gap:8px;margin:0 -16px -16px;padding:12px 16px;background:var(--surface);border-top:1px solid var(--line);box-shadow:0 -8px 18px rgba(15,23,42,.06)}
.qc-checklist { display:grid; gap:8px; min-width:0; }.qc-checklist-item{display:grid;gap:4px;min-width:0}.qc-criterion { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(0,1fr) minmax(70px,.55fr) minmax(120px,.8fr) 34px; gap:7px; align-items:end; padding:9px; border:1px solid var(--line); border-radius:7px; background:var(--surface-soft); min-width:0; }.qc-criterion label{display:grid;gap:4px;min-width:0;color:var(--muted);font-size:10px;font-weight:700}.qc-criterion input,.qc-criterion select{width:100%;min-width:0}.qc-criterion.qc-criterion-attention{border-color:#f59e0b;background:#fffbeb;box-shadow:0 0 0 2px rgba(245,158,11,.16)}.qc-row-delete{width:34px;height:36px;border:1px solid #fecaca;border-radius:6px;background:#fff;color:#b91c1c;font-size:20px;line-height:1;cursor:pointer}.qc-row-delete:hover{background:#fef2f2}.qc-add-test{justify-self:start;padding:2px 7px;border:0;background:transparent;color:var(--primary);font-size:11px;font-weight:700;cursor:pointer}.qc-add-test:hover{text-decoration:underline}.qc-empty-checklist{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px;border:1px dashed var(--line);border-radius:7px;color:var(--muted);font-size:12px}.qc-evidence-list{display:flex;flex-wrap:wrap;gap:7px;color:var(--muted);font-size:11px}.qc-history-card{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px;border:1px solid var(--line);border-radius:7px;background:var(--surface-soft)}.qc-history-card>div{min-width:0}.qc-history-card p{margin:4px 0}.qc-history-card small{color:var(--muted)}.qc-history-back{justify-self:start}.qc-history-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.qc-history-facts>div{padding:9px;border:1px solid var(--line);border-radius:7px;background:var(--surface)}.qc-history-facts span,.qc-history-facts strong{display:block}.qc-history-facts span{color:var(--muted);font-size:10px}.qc-history-results{display:grid;gap:7px}.qc-history-results article{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px;border:1px solid var(--line);border-radius:7px;background:var(--surface)}.qc-history-results strong,.qc-history-results small{display:block}.qc-history-results small{margin-top:3px;color:var(--muted)}.qc-history-attachments{margin:0;padding-left:20px}
@media(max-width:1000px){.qc-metrics{grid-template-columns:repeat(3,1fr)}.qc-summary{grid-template-columns:repeat(2,1fr)}.qc-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.qc-criterion{grid-template-columns:repeat(2,minmax(0,1fr))}.qc-row-delete{grid-column:2;justify-self:end}}
@media(max-width:700px){.qc-header,.qc-detail>header,.qc-toolbar{align-items:stretch;flex-direction:column}.qc-toolbar input{min-width:0;width:100%}.qc-metrics{grid-template-columns:repeat(2,1fr)}.qc-drawer{width:100vw;padding:0 12px}.qc-drawer>header{padding-top:12px}.qc-form-grid,.qc-criterion,.qc-history-facts{grid-template-columns:minmax(0,1fr)}.qc-row-delete{grid-column:auto;justify-self:end}.qc-add-test{padding-left:0}.qc-drawer-actions{margin:0 -12px -16px;padding:10px 12px}.qc-drawer-actions .btn{flex:1}.qc-section-heading{align-items:flex-start;flex-direction:column;gap:3px}.qc-history-card{align-items:stretch;flex-direction:column}.qc-history-card .btn{width:100%}}

@media (max-width: 1050px) {
  .quotation-form { grid-template-columns: 1fr; }
  .quotation-card { grid-column: 1 / -1; }
  .quotation-field-groups { grid-template-columns: 1fr; }
  .quotation-terms-group { grid-column: 1; }
}

@media (max-width: 680px) {
  .quotation-auto-grid,
  .quotation-customer-approval,
  .quotation-fields { grid-template-columns: 1fr; }
  .quotation-fields .span-2 { grid-column: 1; }
}

.product-name {
  min-width: 170px;
}

.product-name small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.approval-grid.active {
  display: grid;
}

.approval-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.approval-card {
  min-height: 160px;
  padding: 18px;
  border: 1px solid #d5e2f1;
  border-radius: 7px;
  background: #fbfdff;
}

.approval-card p {
  color: #38536f;
  line-height: 1.45;
}

.approval-summary {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.approval-summary > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e6edf5;
}

.approval-summary > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.approval-summary span {
  color: var(--muted);
  font-size: 12px;
}

.approval-summary strong {
  max-width: 65%;
  text-align: right;
  font-size: 13px;
}

.approval-summary > .approval-product-list {
  display: grid;
  gap: 9px;
  padding: 2px 0 0;
  border: 0;
}

.approval-product-item {
  padding: 10px 12px;
  border: 1px solid #dce7f2;
  border-radius: 6px;
  background: #f5f9fd;
}

.approval-product-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.approval-product-heading strong {
  max-width: 72%;
  text-align: right;
}

.approval-product-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
  margin-top: 7px;
}

.approval-product-meta span {
  color: #38536f;
  font-size: 11px;
}

.approval-grid.active {
  display: block;
}

.approval-sheet {
  overflow: hidden;
  border: 1px solid #d5e2f1;
  border-radius: 10px;
  background: #ffffff;
}

.approval-sheet-header,
.approval-sheet-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
}

.approval-sheet-header {
  border-bottom: 1px solid #e1eaf4;
  background: #f7faff;
}

.approval-sheet-header h2,
.approval-section h3 {
  margin: 0;
}

.approval-sheet-header .eyebrow {
  margin: 0 0 3px;
}

.approval-sheet-body {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.35fr);
}

.approval-section {
  padding: 18px 20px;
}

.approval-section h3 {
  color: #0b4e9b;
  font-size: 15px;
}

.approval-project-section {
  grid-row: span 2;
  border-right: 1px solid #e1eaf4;
}

.approval-cost-section {
  border-bottom: 1px solid #e1eaf4;
}

.approval-product-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.approval-product-heading,
.approval-product-meta {
  justify-content: flex-start;
}

.approval-product-heading {
  flex-direction: column;
  gap: 3px;
}

.approval-product-heading strong {
  max-width: none;
  text-align: left;
}

.approval-sheet-footer {
  border-top: 1px solid #e1eaf4;
  background: #f7faff;
}

.approval-sheet-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.approval-sheet-footer .approval-actions {
  margin: 0;
  gap: 8px;
}

.approval-actions .btn {
  min-width: 92px;
}

.approval-actions .approve {
  color: #ffffff;
  border-color: #17864a;
  background: #17864a;
}

.approval-actions .revise {
  color: #6d4bd1;
  border-color: #cfc4f5;
  background: #f4f0ff;
}

.approval-actions .reject {
  color: #b42318;
  border-color: #f0b8b4;
  background: #fff3f2;
}

.srm-recall-btn {
  color: #fff !important;
  border: 1px solid #b42318 !important;
  background: linear-gradient(135deg, #d92d20, #b42318) !important;
  box-shadow: 0 5px 12px rgba(180, 35, 24, .2);
  font-weight: 750;
}
.srm-recall-btn::before { content: "↶"; margin-right: 5px; font-size: 15px; line-height: 1; }
.srm-recall-btn:hover { border-color:#912018 !important; background:linear-gradient(135deg,#c7271c,#912018) !important; box-shadow:0 7px 16px rgba(180,35,24,.3); transform:translateY(-1px); }
.srm-recall-btn:focus-visible { outline:3px solid rgba(217,45,32,.28); outline-offset:2px; }
.srm-quotation-upload { margin-top:4px; padding:12px; border:1px dashed #93b4d4; border-radius:10px; background:#f7fbff; }
.srm-quotation-upload input { margin-top:7px; }
.srm-quotation-upload small,.srm-quotation-file-form small { display:block; margin-top:5px; color:var(--muted); }
.srm-quotation-files { display:grid; gap:9px; }
.srm-quotation-files article { display:flex; align-items:center; gap:8px; padding:11px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.srm-quotation-files article>div { display:grid; min-width:0; margin-right:auto; }
.srm-quotation-files strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.srm-quotation-files small { color:var(--muted); }
.srm-quotation-files .srm-file-delete { color:#b42318; border-color:#f0b8b4; background:#fff3f2; }
.srm-quotation-file-form { display:flex; align-items:end; gap:12px; margin-top:16px; padding:14px; border:1px dashed #93b4d4; border-radius:11px; background:#f7fbff; }
.srm-quotation-file-form label { display:grid; flex:1; gap:5px; }
.srm-demand-check { width:19px; height:19px; accent-color:#16a34a; cursor:pointer; }
.srm-demand-check:disabled { opacity:1; cursor:default; filter:none; }
.srm-demand-processed { background:linear-gradient(90deg,rgba(220,252,231,.55),transparent 38%); }
.srm-demand-processed td:first-child { position:relative; }
.srm-demand-processed td:first-child::after { content:"Đã xử lý"; display:block; margin-top:3px; color:#15803d; font-size:9px; font-weight:800; white-space:nowrap; }
.srm-early-approval-bar { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:14px; padding:15px 17px; border:1px solid #c4b5fd; border-radius:13px; background:linear-gradient(135deg,#f5f3ff,#eef2ff); box-shadow:0 5px 15px rgba(79,70,229,.08); }
.srm-early-approval-bar>div { display:grid; gap:3px; }
.srm-early-approval-bar small { color:#6d28d9; font-weight:850; letter-spacing:.08em; }
.srm-early-approval-bar strong { color:#312e81; font-size:15px; }
.srm-early-approval-bar span { color:var(--muted); font-size:12px; }
.srm-approval-role-note { padding:7px 10px; border:1px solid #ddd6fe; border-radius:999px; background:#fff; color:#6d28d9 !important; font-weight:750; white-space:nowrap; }
.srm-early-approved { color:#166534; border-color:#86efac; background:#dcfce7; }
.srm-early-pending { color:#92400e; border-color:#fcd34d; background:#fef3c7; }
.srm-early-rejected { color:#991b1b; border-color:#fca5a5; background:#fee2e2; }
.srm-early-not-requested { color:#475569; border-color:#cbd5e1; background:#f1f5f9; }
.srm-early-not-applicable { color:#1d4ed8; border-color:#bfdbfe; background:#dbeafe; }

@media (max-width: 900px) {
  .approval-sheet-body {
    grid-template-columns: 1fr;
  }

  .approval-project-section {
    grid-row: auto;
    border-right: 0;
    border-bottom: 1px solid #e1eaf4;
  }

  .approval-product-list {
    grid-template-columns: 1fr;
  }

  .approval-sheet-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

.approval-mail-card {
  grid-column: 1 / -1;
}

.mail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.mail-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mail-grid input,
.mail-grid textarea {
  width: 100%;
  border: 1px solid #cbd8e6;
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
  padding: 9px 10px;
}

.mail-grid input {
  height: 36px;
}

.mail-hint,
.mail-preview {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.approval-actions {
  display: flex;
  gap: 14px;
  margin-top: 22px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid #c9d8e9;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  font-size: 26px;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.icon-btn:hover {
  background: #f8fbff;
  box-shadow: 0 8px 18px rgba(22, 52, 88, 0.12);
  transform: translateY(-1px);
}

.icon-btn:active,
.icon-btn.clicked {
  transform: translateY(1px) scale(0.96);
}

.icon-btn.approve { color: var(--green); }
.icon-btn.reject { color: var(--red); }
.icon-btn.revise { color: var(--violet); }

.documents-panel.active {
  display: block;
}

.document-checklist { margin: 0 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.document-checklist > header { display:flex; gap:12px; align-items:flex-start; justify-content:space-between; margin-bottom:12px; }
.document-checklist h3,.document-checklist h4,.document-checklist p { margin:0; }
.document-checklist h3 { color:var(--blue); font-size:18px; }
.document-checklist header p,.document-checklist-item p { color:var(--muted); margin-top:4px; font-size:13px; }
.document-checklist-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:10px; }
.document-checklist-item { min-height:128px; padding:11px; border:1px solid var(--line); border-radius:9px; background:var(--surface-soft); display:flex; flex-direction:column; }
.document-checklist-item > div,.document-checklist-item footer { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.document-checklist-item > div strong { color:var(--blue); font-size:12px; }
.document-checklist-item > div span,.document-checklist-item small { color:var(--muted); font-size:11px; }
.document-checklist-item h4 { margin-top:8px; font-size:14px; }
.document-checklist-item p { flex:1; }
.document-checklist-item.ready_for_template { border-color:#a7d9bd; }
.document-checklist-loading { padding:12px; color:var(--muted); font-size:14px; }
.document-summary { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; }
.document-metrics { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.document-metrics span { border:1px solid var(--line); border-radius:999px; padding:5px 9px; font-size:12px; color:var(--muted); }
.document-metrics b { color:var(--ink); }
.document-master-detail{display:grid;grid-template-columns:minmax(240px,280px) minmax(0,1fr);gap:14px;align-items:start}.document-step-list{display:grid;gap:5px;max-height:620px;overflow:auto;padding-right:3px}.document-step{display:flex;align-items:flex-start;gap:9px;width:100%;min-height:52px;padding:8px 9px;text-align:left;border:1px solid transparent;border-radius:8px;background:transparent;cursor:pointer}.document-step:hover{background:var(--surface-soft)}.document-step.selected{border-color:#b9d5fb;border-left:3px solid var(--blue);padding-left:7px;background:#edf5ff}.document-step b{flex:0 0 23px;width:23px;height:23px;display:grid;place-items:center;border-radius:50%;background:#e5edf8;color:var(--blue);font-size:11px}.document-step.selected b{background:var(--blue);color:#fff}.document-step span{min-width:0}.document-step strong,.document-step small{display:block}.document-step strong{font-size:13px;line-height:1.25}.document-step small{margin-top:3px;color:var(--muted);font-size:11px;line-height:1.25}.document-step.not-applicable{opacity:.58}.document-step.attention small{color:#a65b00}.document-step-detail{min-width:0;min-height:332px;border:1px solid var(--line);border-radius:10px;padding:14px;background:var(--surface)}.document-step-detail>header{display:flex;justify-content:space-between;gap:12px;margin-bottom:12px}.document-step-detail h4{margin:2px 0;font-size:18px}.document-step-detail p{margin:0;color:var(--muted);font-size:13px}.document-step-status{align-self:flex-start;white-space:nowrap;border-radius:999px;padding:4px 8px;background:#edf3fa;color:#526174;font-size:11px}.document-step-status.attention{background:#fff3cd;color:#8a5c00}.document-step-status.in-progress{background:#e8f1ff;color:#0757b8}.document-step-status.completed{background:#dcfce7;color:#166534}.document-table-wrap{max-height:500px;overflow:auto;border:1px solid var(--line);border-radius:8px}.document-master-table{width:100%;min-width:720px;border-collapse:collapse;font-size:12px}.document-master-table th{position:sticky;top:0;z-index:1;background:#f1f6fd;color:#36506e;text-align:left;font-size:11px}.document-master-table th,.document-master-table td{padding:9px 10px;border-bottom:1px solid var(--line);vertical-align:top}.document-master-table tbody tr:hover{background:#f8fbff}.document-master-table strong,.document-master-table small{display:block}.document-master-table small{margin-top:3px;color:var(--muted);font-size:11px;line-height:1.25}.document-master-table td:first-child{width:48px;text-align:center}.document-master-table td:nth-child(2){min-width:155px}.document-master-table td:nth-child(3){min-width:86px}.document-master-table td:nth-child(4){min-width:145px}.document-master-table td:nth-child(5){min-width:105px}.document-master-table td:last-child{min-width:86px}.doc-badge{display:inline-block;font-size:11px;padding:3px 6px;border-radius:999px;background:#fff3cd;color:#8a5c00}.doc-badge.ready{background:#dcfce7;color:#166534}.doc-badge.waiting_event{background:#e8f1ff;color:#0757b8}.doc-badge.not_applicable,.doc-badge.life{background:#eef2f7;color:#526174}.document-action-empty,.document-use-note{color:var(--muted);font-size:11px}.document-empty{padding:18px;color:var(--muted);border:1px dashed var(--line);border-radius:8px}.document-checklist:has(.document-master-detail){padding:16px}
.document-detail-actions{display:flex;align-items:flex-start;justify-content:flex-end;gap:8px;flex-wrap:wrap}
@media (max-width:640px) { .document-checklist { padding:11px; } .document-checklist > header { align-items:stretch; flex-direction:column; } .document-checklist-grid { grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:8px; } .document-checklist-item { min-height:118px; padding:9px; } }
@media (max-width:760px){.document-summary{flex-direction:column}.document-metrics{justify-content:flex-start}.document-master-detail{display:block}.document-step-list{display:flex;max-height:none;overflow-x:auto;overflow-y:hidden;padding:0 0 8px;scroll-snap-type:x proximity}.document-step{flex:0 0 175px;min-height:58px;scroll-snap-align:start}.document-step-detail{min-height:0;padding:12px}.document-table-wrap{max-height:none}.document-master-table{min-width:0}.document-master-table thead{display:none}.document-master-table,.document-master-table tbody,.document-master-table tr,.document-master-table td{display:block;width:100%}.document-master-table tr{padding:10px;border-bottom:1px solid var(--line)}.document-master-table td{padding:3px 0;border:0}.document-master-table td:first-child{display:none}.document-master-table td:nth-child(n+3):before{display:inline-block;min-width:100px;margin-right:6px;color:var(--muted);font-size:11px}.document-master-table td:nth-child(3):before{content:"Định dạng"}.document-master-table td:nth-child(4):before{content:"Dữ liệu nguồn"}.document-master-table td:nth-child(5):before{content:"Trạng thái"}.document-master-table td:nth-child(6):before{content:"Xem / Xuất"}.document-master-table td:nth-child(n+3) small{display:inline}.document-master-table td:nth-child(2){min-width:0}.document-master-table td:last-child{min-width:0}}
@media (max-width:760px){body .document-master-table td[data-label]:before{content:attr(data-label)!important;display:inline-block;min-width:100px;margin-right:6px;color:var(--muted);font-size:11px}.document-master-table .document-name-cell:before{display:none!important;content:none!important}.document-step-detail>header{align-items:flex-start;flex-direction:column}.document-detail-actions{justify-content:flex-start}}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.segment {
  min-height: 32px;
  border: 0;
  border-radius: 5px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .cost-input,
:root[data-theme="dark"] .cost-select,
:root[data-theme="dark"] .product-input,
:root[data-theme="dark"] .deal-input {
  color: var(--ink);
  background: #0b1324;
  border-color: var(--line);
}

:root[data-theme="dark"] table,
:root[data-theme="dark"] .summary-table,
:root[data-theme="dark"] .mini-table {
  background: var(--surface);
}

:root[data-theme="dark"] th,
:root[data-theme="dark"] tfoot td {
  color: var(--ink);
  background: #17243a;
}

:root[data-theme="dark"] td {
  border-color: var(--line);
}

:root[data-theme="dark"] tr:hover td,
:root[data-theme="dark"] .product-table tr.selected td {
  background: #142845;
}

:root[data-theme="dark"] .context-chip,
:root[data-theme="dark"] .summary-box,
:root[data-theme="dark"] .metric,
:root[data-theme="dark"] .info-panel,
:root[data-theme="dark"] .deal-context div,
:root[data-theme="dark"] .deal-setting-card,
:root[data-theme="dark"] .approval-card,
:root[data-theme="dark"] .process-step,
:root[data-theme="dark"] .summary-row,
:root[data-theme="dark"] .automation-flow span {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line);
}

:root[data-theme="dark"] .summary-box h3,
:root[data-theme="dark"] .method-help h4,
:root[data-theme="dark"] .approval-card h3,
:root[data-theme="dark"] .approval-card p,
:root[data-theme="dark"] .automation-flow span {
  color: var(--ink);
}

:root[data-theme="dark"] .breakdown-line,
:root[data-theme="dark"] .summary-total,
:root[data-theme="dark"] .method-help {
  border-color: var(--line);
}

:root[data-theme="dark"] .summary-row.strong {
  color: var(--brand-muted);
  background: var(--brand-soft);
}

.segment.active {
  color: #ffffff;
  background: var(--blue);
}

.document-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 12px;
}

.process-lane {
  display: grid;
  gap: 10px;
  align-content: start;
}

.process-step {
  padding: 13px;
  border: 1px solid #d5e2f1;
  border-radius: 7px;
  background: #fbfdff;
}

.doc-check {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.doc-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 260px;
}

.document-master-table .doc-actions{min-width:0;align-items:flex-start}
.document-summary-tools{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap}

.digital-document-dialog{width:min(920px,calc(100vw - 32px));max-height:calc(100vh - 32px);padding:0;border:0;border-radius:16px;background:transparent;color:var(--bms-text);box-shadow:var(--bms-shadow-overlay)}
.digital-document-dialog::backdrop{background:color-mix(in srgb,var(--bms-text) 54%,transparent);backdrop-filter:blur(2px)}
.digital-document-card{display:flex;max-height:calc(100vh - 32px);flex-direction:column;overflow:hidden;border:1px solid var(--bms-border-strong);border-radius:16px;background:var(--bms-surface)}
.digital-document-card>header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:20px 22px 16px;border-bottom:1px solid var(--line)}
.digital-document-card>header h2{margin:2px 0 4px;font-size:22px}.digital-document-card>header p{margin:0;color:var(--muted);font-size:13px}
.digital-document-close{flex:0 0 42px;width:42px;height:42px;border:1px solid var(--bms-border-strong);border-radius:12px;background:var(--bms-surface);color:var(--bms-text);font-size:24px;font-weight:700;cursor:pointer}
.digital-document-meta{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1px;background:var(--line);border-bottom:1px solid var(--line)}
.digital-document-meta>div{min-width:0;padding:11px 16px;background:var(--bms-surface-subtle)}.digital-document-meta span,.digital-document-meta strong{display:block}.digital-document-meta span{color:var(--muted);font-size:10px;text-transform:uppercase;letter-spacing:.04em}.digital-document-meta strong{margin-top:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
.digital-document-content{display:grid;gap:12px;padding:16px 22px 22px;overflow:auto;background:var(--bms-surface-subtle)}
.digital-document-content>section{overflow:hidden;border:1px solid var(--line);border-radius:12px;background:var(--surface)}.digital-document-content h3{margin:0;padding:12px 14px;border-bottom:1px solid var(--line);font-size:14px}
.digital-document-content dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));margin:0}.digital-document-content dl>div{min-width:0;padding:10px 14px;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}.digital-document-content dl>div:nth-child(2n){border-right:0}.digital-document-content dt{color:var(--muted);font-size:11px}.digital-document-content dd{margin:4px 0 0;overflow-wrap:anywhere;font-size:13px;font-weight:600;line-height:1.4}
.digital-document-table-wrap{overflow:auto}.digital-document-table-wrap table{width:100%;min-width:600px;border-collapse:collapse;font-size:12px}.digital-document-table-wrap th,.digital-document-table-wrap td{padding:9px 12px;border-bottom:1px solid var(--line);text-align:left}.digital-document-table-wrap th{background:var(--bms-surface-subtle);color:var(--bms-text-muted);font-size:10px;text-transform:uppercase}.digital-document-table-wrap tbody tr:last-child td{border-bottom:0}
.digital-markdown-document{overflow:hidden;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.digital-markdown-document h2{margin:0;padding:16px 18px 8px;font-size:19px}.digital-markdown-document h3{margin:12px 18px 0;padding:14px 0 8px;border-bottom:1px solid var(--line);font-size:14px}.digital-markdown-document h4{margin:12px 18px 6px;font-size:13px}
.digital-markdown-document p{margin:8px 18px;color:var(--bms-text);font-size:13px;line-height:1.55}.digital-markdown-document .digital-markdown-lead{margin:0;padding:0 18px 15px;color:var(--muted);border-bottom:1px solid var(--line)}
.digital-markdown-document ul{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));margin:0;padding:4px 18px 10px;list-style:none}.digital-markdown-document li{min-width:0;padding:9px 12px 9px 0;border-bottom:1px solid var(--line);overflow-wrap:anywhere;font-size:13px;line-height:1.45}.digital-markdown-document li:nth-child(odd){padding-right:18px}.digital-markdown-document li:nth-child(even){padding-left:18px;border-left:1px solid var(--line)}
.digital-markdown-table{margin-top:4px;overflow:auto}.digital-markdown-table table{width:100%;min-width:620px;border-collapse:collapse;font-size:12px}.digital-markdown-table th,.digital-markdown-table td{padding:10px 14px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}.digital-markdown-table th{background:var(--bms-surface-subtle);color:var(--bms-text-muted);font-size:10px;text-transform:uppercase}.digital-markdown-table tbody tr:last-child td{border-bottom:0}
.digital-markdown-document hr{margin:12px 18px 4px;border:0;border-top:1px solid var(--line)}
.digital-markdown-source{border:1px solid var(--line);border-radius:12px;background:var(--surface)}.digital-markdown-source summary{padding:12px 14px;color:var(--bms-primary);font-size:12px;font-weight:700;cursor:pointer}.digital-markdown-source pre{max-height:300px;margin:0;padding:14px;overflow:auto;border-top:1px solid var(--line);background:var(--bms-surface-subtle);color:var(--bms-text);font:12px/1.55 var(--bms-font-data);white-space:pre-wrap;overflow-wrap:anywhere}
.digital-document-card>footer{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 22px;border-top:1px solid var(--line);background:var(--surface)}.digital-document-card>footer span{color:var(--muted);font-size:11px}

@media(max-width:760px){.document-summary-tools{align-items:flex-start;justify-content:flex-start}.digital-document-dialog{width:calc(100vw - 16px);max-height:calc(100vh - 16px)}.digital-document-card{max-height:calc(100vh - 16px)}.digital-document-card>header{padding:16px}.digital-document-meta{grid-template-columns:repeat(2,minmax(0,1fr))}.digital-document-content{padding:12px}.digital-document-content dl{grid-template-columns:1fr}.digital-document-content dl>div{border-right:0}.digital-markdown-document ul{grid-template-columns:1fr}.digital-markdown-document li:nth-child(odd),.digital-markdown-document li:nth-child(even){padding:9px 0;border-left:0}.digital-document-card>footer{padding:12px 16px}.digital-document-card>footer span{display:none}}

.mini-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.template-inline {
  display: grid;
  gap: 3px;
  min-width: 150px;
  max-width: 260px;
}

.template-inline small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.template-state {
  width: max-content;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

.template-state.ready {
  color: #166534;
  background: #dcfce7;
}

.template-state.missing {
  color: #854d0e;
  background: #fef3c7;
}

.automation-flow {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.automation-flow span {
  min-height: 50px;
  display: grid;
  place-items: center;
  border: 1px dashed #92b4d8;
  border-radius: 7px;
  background: #f5fbff;
  font-weight: 700;
  color: #244966;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  max-width: 480px;
}

dialog::backdrop {
  background: rgba(10, 20, 35, 0.38);
}

.toast {
  position: fixed;
  right: 20px;
  top: max(20px, var(--bms-safe-area-top));
  bottom: auto;
  z-index: 2147483000;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid #b8d4f5;
  border-radius: 7px;
  color: #123b66;
  background: #ffffff;
  box-shadow: 0 16px 42px rgba(15, 35, 65, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 13px;
  font-weight: 700;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: #86efac;
  color: #166534;
}

.toast.warn {
  border-color: #fde68a;
  color: #854d0e;
}

.toast.error {
  border-color: #fecaca;
  color: #991b1b;
}

@media (max-width: 1180px) {
  .topbar {
    gap: 16px;
  }

  .workspace {
    grid-template-columns: minmax(148px, 184px) minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .sidebar {
    padding: 12px;
  }

  .nav-item {
    padding: 0 8px;
    font-size: 13px;
  }

  .flow-strip {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  }

  .flow-step {
    min-height: 100px;
    padding: 12px;
  }

  .toolbar select {
    min-width: min(210px, 100%);
  }

  .costing-layout {
    grid-template-columns: 1fr;
  }

  .summary-box {
    order: 2;
  }
}

@media (max-width: 900px) {
  html,
  body {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 14px;
  }

  .app-shell,
  .topbar,
  .workspace,
  .content,
  .sidebar,
  .panel,
  .flow-strip,
  .table-wrap {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .topbar {
    display: grid;
    gap: 14px;
    padding: 16px;
  }

  .topbar h1 {
    font-size: 20px;
    line-height: 1.2;
  }

  .topbar-actions,
  .toolbar {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .topbar-actions .btn,
  .toolbar .btn,
  .toolbar select {
    width: 100%;
  }

  .toolbar select {
    min-width: 0;
  }

  .flow-strip,
  .metric-grid,
  .costing-layout,
  .costing-context,
  .deal-context,
  .deal-settings,
  .settings-grid,
  .document-grid,
  .automation-flow {
    grid-template-columns: 1fr;
  }

  .branding-form {
    grid-template-columns: 1fr;
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .sidebar {
    position: static;
    margin-bottom: 0;
    overflow: hidden;
  }

  .brand-block {
    grid-template-columns: 40px 1fr;
    padding-bottom: 10px;
  }

  .brand-block strong {
    width: 40px;
    height: 40px;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0 0;
    overflow: visible;
    padding: 0;
  }

  .nav-item {
    min-width: 0;
    width: 100%;
    text-align: center;
  }

  .flow-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    scroll-snap-type: x proximity;
  }

  .settings-card {
    align-items: stretch;
    display: grid;
  }

  .setting-control {
    width: 100%;
  }

  .setting-control .segment {
    flex: 1;
  }

  .flow-step {
    flex: 0 0 210px;
    min-height: 92px;
    padding: 12px;
    scroll-snap-align: start;
  }

  .two-column.active,
  .approval-grid.active {
    display: grid;
    grid-template-columns: 1fr;
  }

  .project-documents-panel{max-height:none}
  .project-document-list{max-height:520px}

  .form-grid {
    grid-template-columns: 1fr;
  }

  .mail-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .search-box input {
    width: 100%;
  }

  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .panel {
    padding: 12px;
  }

  .metric-grid {
    gap: 8px;
  }

  .metric {
    padding: 12px;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
    border-radius: 7px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
  }

  table {
    min-width: 720px;
  }

  th,
  td {
    padding: 9px 8px;
    font-size: 12px;
  }

  .product-table {
    min-width: 760px;
  }

  .product-table-wrap {
    max-height: none;
  }

  .product-input,
  .cost-input,
  .cost-select,
  .deal-input {
    height: 34px;
    min-width: 84px;
    font-size: 13px;
  }

  .product-input.wide {
    min-width: 180px;
  }

  .cost-input.wide {
    min-width: 150px;
  }

  .cost-input.supplier {
    min-width: 130px;
  }

  .cost-select.group {
    min-width: 135px;
  }

  .cost-select.method {
    min-width: 170px;
  }

  .summary-box {
    order: 2;
  }

  .deal-settings {
    grid-template-columns: 1fr;
  }

  .deal-table {
    min-width: 1200px;
  }

  .document-grid {
    gap: 10px;
  }

  .doc-actions {
    min-width: 0;
    width: 100%;
  }

  .doc-actions .btn,
  .doc-actions .mini-btn,
  .doc-actions label {
    flex: 1 1 140px;
  }

  .template-inline {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .approval-actions {
    justify-content: flex-start;
  }

  dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }

  .toast {
    left: 12px;
    right: 12px;
    top: max(12px, var(--bms-safe-area-top));
    bottom: auto;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 14px 12px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .workspace {
    padding: 8px;
  }

  .sidebar,
  .panel,
  .flow-strip {
    border-radius: 7px;
  }

  .brand-block span {
    font-size: 12px;
  }

  .nav-item {
    min-width: 0;
    min-height: 36px;
    padding: 0 8px;
    font-size: 12px;
  }

  .flow-step {
    flex-basis: 180px;
    min-height: 0;
    padding: 12px;
  }

  .flow-step small {
    font-size: 11px;
  }

  h2 {
    font-size: 16px;
  }

  h3 {
    font-size: 14px;
  }

  .btn {
    min-height: 38px;
  }

  .context-chip,
  .deal-context div,
  .metric,
  .summary-box,
  .approval-card,
  .process-step {
    padding: 10px;
  }

  .table-wrap {
    max-width: 100%;
  }

  table {
    min-width: 680px;
  }

  .product-table {
    min-width: 720px;
  }

  .deal-table {
    min-width: 1100px;
  }

  .mail-grid input,
  .mail-grid textarea,
  .form-grid input,
  .form-grid select,
  .form-grid textarea {
    font-size: 13px;
  }
}


/* Receivables payment drawer */
.ar-panel > .ar-drawer { width:min(620px,100%); overflow-x:hidden; }
.ar-payment-form,
.ar-payment-form * { min-width:0; box-sizing:border-box; }
.ar-payment-form { gap:14px; padding-bottom:4px; }
.ar-payment-overview { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(170px,.65fr); gap:10px; }
.ar-payment-overview > div { display:grid; align-content:center; gap:3px; padding:12px 14px; border:1px solid var(--line); border-radius:10px; background:var(--surface-soft); }
.ar-payment-overview span,
.ar-payment-overview small { color:var(--muted); font-size:11px; }
.ar-payment-overview strong { color:var(--ink-strong); font-size:15px; line-height:1.25; }
.ar-payment-overview > div:last-child { border-color:#b9d7f7; background:var(--brand-soft); }
.ar-payment-overview > div:last-child strong { color:var(--blue); font-size:19px; }
.ar-payment-section { margin:0; padding:12px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.ar-payment-section legend { padding:0 6px; color:var(--ink-strong); font-size:12px; font-weight:800; }
.ar-payment-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:10px 12px; }
.ar-payment-grid label { display:grid; align-content:start; gap:5px; color:var(--muted); font-size:11px; font-weight:700; }
.ar-payment-grid input,
.ar-payment-grid select,
.ar-payment-grid textarea { width:100%; margin:0; }
.ar-payment-grid textarea { min-height:64px; resize:vertical; }
.ar-payment-grid label > small { color:var(--muted); font-size:10px; font-weight:400; line-height:1.35; }
.ar-payment-wide { grid-column:1 / -1; }
.ar-payment-actions-bar { position:sticky; bottom:-16px; display:flex; justify-content:flex-end; margin:0 -16px -16px; padding:12px 16px 16px; border-top:1px solid var(--line); background:linear-gradient(to bottom,rgba(255,255,255,.92),var(--surface) 28%); }
.ar-payment-actions-bar .btn { min-width:170px; }
@media(max-width:640px){
  .ar-payment-overview,
  .ar-payment-grid { grid-template-columns:1fr; }
  .ar-payment-wide { grid-column:auto; }
  .ar-payment-actions-bar .btn { width:100%; }
}

/* Compact finished-goods receipt drawer. */
.fg-panel > .inventory-drawer { width:min(560px,100%); overflow-x:hidden; }
.fg-drawer-form .form-grid { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
.fg-drawer-form,
.fg-drawer-form * { min-width:0; }
.fg-drawer-form input,
.fg-drawer-form select,
.fg-drawer-form textarea { width:100%; }
.fg-field-wide { grid-column:1 / -1; }
.fg-drawer-form label small { color:var(--muted); font-weight:400; line-height:1.35; }
.fg-tracking-help { display:block; padding:9px 10px; border-radius:7px; color:#315b88 !important; background:var(--brand-soft); }
.fg-receipt-submit { width:100%; }
@media (max-width:720px) {
  .fg-field-wide { grid-column:auto; }
}

.financial-analytics { display:grid; gap:14px; }
.financial-analytics[hidden] { display:none; }
.financial-header { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding:4px 2px 2px; }
.financial-header h3 { margin:3px 0 5px; color:var(--ink-strong); font-size:22px; }
.financial-header p { margin:0; color:var(--muted); }
.financial-kpis { display:grid; grid-template-columns:repeat(6,minmax(130px,1fr)); gap:10px; }
.financial-kpi { padding:13px 14px; border:1px solid var(--line); border-radius:10px; background:linear-gradient(145deg,var(--surface),var(--surface-soft)); }
.financial-kpi span { display:block; color:var(--muted); font-size:11px; }
.financial-kpi strong { display:block; margin-top:5px; color:var(--ink-strong); font-size:18px; }
.financial-kpi.positive { border-color:#86efac; background:#f0fdf4; }
.financial-kpi.negative { border-color:#fecaca; background:#fef2f2; }
.financial-kpi.negative strong,.financial-negative { color:#b91c1c; }
.financial-positive { color:#15803d; }
.financial-chart-grid { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(360px,.85fr); gap:12px; }
.financial-card { min-width:0; padding:15px; border:1px solid var(--line); border-radius:11px; background:var(--surface); }
.financial-card h4 { margin:0 0 13px; color:var(--ink-strong); font-size:15px; }
.financial-bars { display:grid; gap:15px; }
.financial-bar-row { display:grid; grid-template-columns:145px minmax(120px,1fr) 150px; align-items:center; gap:10px; }
.financial-bar-row>span { color:var(--muted); font-size:12px; }
.financial-bar-row>div { height:12px; overflow:hidden; border-radius:99px; background:#e8eef7; }
.financial-bar-row i { display:block; height:100%; border-radius:inherit; background:#0757b8; }
.financial-bar-row i.cost { background:#f59e0b; }
.financial-bar-row i.profit { background:#16a34a; }
.financial-bar-row i.loss { background:#dc2626; }
.financial-bar-row strong { text-align:right; font-size:12px; }
.financial-cost-layout { display:grid; grid-template-columns:150px minmax(0,1fr); align-items:center; gap:18px; }
.financial-donut { display:grid; place-items:center; width:142px; aspect-ratio:1; border-radius:50%; }
.financial-donut>span { display:grid; place-items:center; width:82px; aspect-ratio:1; border-radius:50%; background:var(--surface); box-shadow:0 0 0 1px var(--line); }
.financial-donut strong,.financial-donut small { display:block; text-align:center; }
.financial-donut small { color:var(--muted); font-size:10px; }
.financial-legend { display:grid; gap:8px; }
.financial-legend div { display:grid; grid-template-columns:9px minmax(0,1fr) auto; align-items:center; gap:7px; font-size:11px; }
.financial-legend i { width:9px; height:9px; border-radius:3px; }
.financial-legend span { color:var(--muted); }
.financial-table { min-width:880px; }
.financial-table th,.financial-table td { font-size:12px; white-space:nowrap; }
.financial-table td:nth-child(n+3) { text-align:right; }
.financial-margin { position:relative; min-width:92px; height:23px; overflow:hidden; border-radius:5px; background:#edf2f8; }
.financial-margin i { position:absolute; inset:0 auto 0 0; background:#bbf7d0; }
.financial-margin i.loss { background:#fecaca; }
.financial-margin span { position:relative; z-index:1; display:block; padding:5px 7px; color:var(--ink); font-size:11px; text-align:right; }
.financial-insights { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.financial-insight { display:grid; grid-template-columns:8px minmax(0,1fr); gap:10px; padding:11px; border:1px solid var(--line); border-radius:9px; background:var(--surface-soft); }
.financial-insight>i { width:8px; height:8px; margin-top:4px; border-radius:50%; background:#64748b; }
.financial-insight.good>i { background:#16a34a; }.financial-insight.warning>i { background:#f59e0b; }.financial-insight.danger>i { background:#dc2626; }.financial-insight.neutral>i { background:#3b82f6; }
.financial-insight strong { color:var(--ink); font-size:12px; }.financial-insight p { margin:4px 0 0; color:var(--muted); font-size:11px; line-height:1.4; }
.financial-method { padding:11px 13px; border:1px solid var(--line); border-radius:9px; color:var(--muted); background:var(--surface-soft); font-size:11px; }
.financial-method summary { cursor:pointer; color:var(--ink-strong); font-weight:700; }.financial-method p { margin:8px 0 0; line-height:1.5; }
@media (max-width:1250px) { .financial-kpis { grid-template-columns:repeat(3,1fr); }.financial-chart-grid { grid-template-columns:1fr; }.financial-cost-card { max-width:none; } }
@media (max-width:720px) { .financial-header { flex-direction:column; }.financial-kpis { grid-template-columns:repeat(2,1fr); }.financial-bar-row { grid-template-columns:1fr; }.financial-bar-row strong { text-align:left; }.financial-cost-layout { grid-template-columns:1fr; justify-items:center; }.financial-legend { width:100%; }.financial-insights { grid-template-columns:1fr; } }
@media print {
  body.quotation-print-preview * { visibility:hidden !important; }
  body.quotation-print-preview #quotationPdfPreview,
  body.quotation-print-preview #quotationPdfPreview * { visibility:visible !important; }
  body.quotation-print-preview #quotationPdfPreview { position:absolute; inset:0; overflow:visible; padding:0; background:#fff; }
  body.quotation-print-preview #quotationPdfPreview .quotation-document { width:100%; border:0; box-shadow:none; }
  body.quotation-print-preview .quotation-items-table tr,
  body.quotation-print-preview .quotation-terms-list > label { break-inside:avoid; page-break-inside:avoid; }
  body.quotation-print-preview .quotation-section-title { break-after:avoid; page-break-after:avoid; }
  body.financial-report-print * { visibility:hidden; }
  body.financial-report-print .documents-panel,
  body.financial-report-print .documents-panel .financial-analytics,
  body.financial-report-print .documents-panel .financial-analytics * { visibility:visible; }
  body.financial-report-print .documents-panel { display:block!important; position:absolute; inset:0; padding:0; }
  body.financial-report-print .documents-panel>.workflow-page-title,
  body.financial-report-print .financial-header .toolbar { display:none!important; }
  body.financial-report-print .financial-kpis { grid-template-columns:repeat(3,1fr); }
  body.financial-report-print .financial-chart-grid { grid-template-columns:1fr 1fr; }
  body.financial-report-print .financial-card { break-inside:avoid; }
}

.production-module-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:14px}.production-module-header h2{margin:3px 0;color:#074b9b}.production-module-header p{margin:0;color:#64748b}.production-project-facts{display:grid;grid-template-columns:repeat(6,minmax(120px,1fr));border:1px solid #c9dcf5;border-radius:11px;background:#fff;margin-bottom:12px}.production-project-facts>div{padding:10px 13px;border-right:1px solid #e1ebf7}.production-project-facts>div:last-child{border:0}.production-project-facts span,.production-metric span{display:block;color:#64748b;font-size:11px}.production-project-facts strong{display:block;color:#12305b;margin-top:3px}.production-metrics{display:grid;grid-template-columns:repeat(6,minmax(120px,1fr));gap:9px;margin-bottom:12px}.production-metric{padding:12px 14px;border:1px solid #c9dcf5;border-radius:10px;background:linear-gradient(145deg,#fff,#f3f8ff)}.production-metric strong{display:block;color:#074b9b;font-size:20px;margin-top:4px}.production-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:12px;align-items:start}.production-main-card,.production-side-card{border:1px solid #c9dcf5;border-radius:11px;background:#fff;min-width:0}.production-side-card{padding:14px;position:sticky;top:12px}.production-table-toolbar,.production-execution-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 13px}.production-table-toolbar span{color:#64748b;font-size:12px}.production-table-wrap{max-height:520px}.production-table{min-width:1320px}.production-order-table{min-width:1380px}.production-table thead{position:sticky;top:0;z-index:2}.production-table th,.production-table td{font-size:12px;white-space:nowrap}.production-table td:nth-child(5),.production-order-table td:nth-child(n+4):nth-child(-n+7){text-align:right}.production-table td small{display:block;color:#64748b;max-width:260px;overflow:hidden;text-overflow:ellipsis}.production-status{display:inline-flex;padding:4px 8px;border-radius:999px;background:#eef2f7;color:#334155;font-size:11px;font-weight:700}.production-status.released,.production-status.ready,.production-status.completed,.production-status.reserved{background:#dcfce7;color:#166534}.production-status.in_progress,.production-status.partially_completed,.production-status.planning{background:#dbeafe;color:#1d4ed8}.production-status.paused,.production-status.shortage,.production-status.blocked,.production-status.rework_required{background:#fee2e2;color:#991b1b}.production-status.unmapped{background:#fef3c7;color:#92400e}.production-empty{padding:28px 10px;text-align:center;color:#64748b}.production-side-card h3{margin:0;color:#074b9b}.production-side-card h4{margin:14px 0 8px;color:#12305b}.production-side-summary{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:11px 0}.production-side-summary>div{padding:9px;border:1px solid #d8e5f7;border-radius:8px}.production-side-summary span{display:block;color:#64748b;font-size:11px}.production-side-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px}.production-side-actions .btn{min-height:40px}.production-side-actions .span-2{grid-column:1/-1}.production-list{display:grid;gap:7px}.production-list-item{padding:9px;border:1px solid #d8e5f7;border-radius:8px}.production-list-item strong,.production-list-item small{display:block}.production-list-item small{color:#64748b;margin-top:3px}.production-operation-item{display:flex;align-items:center;justify-content:space-between;gap:8px}.production-operation-actions{display:flex;flex:0 0 auto;gap:5px}.production-operation-actions .btn{min-height:28px;padding:4px 8px;font-size:11px}.production-progress{width:90px;height:7px;border-radius:99px;background:#e5edf7;overflow:hidden}.production-progress i{display:block;height:100%;background:#0b63c7}.production-execution-toolbar{border:1px solid #c9dcf5;border-radius:10px;background:#fff;margin-bottom:12px}.production-execution-toolbar label{display:grid;gap:3px;color:#64748b;font-size:11px}.production-execution-toolbar input{min-width:280px}.production-drawer{position:fixed;inset:0;z-index:60;background:rgba(15,23,42,.32);display:grid;place-items:center;padding:24px}.production-drawer[hidden]{display:none}.production-drawer-card{width:min(760px,100%);max-height:90vh;overflow:auto;border-radius:13px;background:#fff;box-shadow:0 24px 70px rgba(15,23,42,.25)}.production-drawer-card>header{display:flex;align-items:center;justify-content:space-between;padding:15px 18px;border-bottom:1px solid #d8e5f7}.production-drawer-card h3{margin:0;color:#074b9b}.production-drawer-card>header button{border:0;background:transparent;font-size:25px;color:#64748b}.production-drawer-card>div{padding:18px}.production-form{display:grid;gap:12px}.production-form .form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.production-form label{display:grid;gap:5px;color:#475569;font-size:12px}.production-form input,.production-form select,.production-form textarea{width:100%}.production-variance{width:100%}.production-variance td:nth-child(n+2){text-align:right}@media(max-width:1250px){.production-project-facts,.production-metrics{grid-template-columns:repeat(3,1fr)}.production-layout{grid-template-columns:1fr}.production-side-card{position:static}}@media(max-width:720px){.production-module-header,.production-execution-toolbar{align-items:stretch;flex-direction:column}.production-project-facts,.production-metrics{grid-template-columns:repeat(2,1fr)}.production-form .form-grid{grid-template-columns:1fr}.production-execution-toolbar input{min-width:0}.production-side-actions{grid-template-columns:1fr}.production-side-actions .span-2{grid-column:auto}.production-operation-item{align-items:stretch;flex-direction:column}.production-operation-actions .btn{flex:1}}
.xop-shift-board{margin-bottom:12px;padding-bottom:12px}.xop-shift-board .production-table-toolbar>div{display:grid;gap:3px}.xop-shift-board .production-table-toolbar label{display:grid;gap:4px;color:var(--muted);font-size:11px}.xop-shift-board-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;padding:0 12px}.xop-shift-card{min-width:0;border:1px solid var(--line);border-radius:9px;background:var(--surface)}.xop-shift-card>header{display:flex;justify-content:space-between;gap:8px;padding:10px;border-bottom:1px solid var(--line)}.xop-shift-card>header div,.xop-shift-card>header small{display:grid;gap:2px}.xop-shift-card>header span,.xop-shift-card small{color:var(--muted);font-size:11px}.xop-shift-card>div{display:grid}.xop-shift-order{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;padding:10px;border-bottom:1px solid var(--line);color:var(--ink);background:transparent;text-align:left}.xop-shift-order:last-child{border-bottom:0}.xop-shift-order>span{display:grid;gap:3px;min-width:0}.xop-shift-order>span:last-child{justify-items:end}@media(max-width:1100px){.xop-shift-board-grid{grid-template-columns:1fr}}@media(max-width:720px){.xop-shift-board .production-table-toolbar,.xop-shift-card>header,.xop-shift-order{align-items:stretch;flex-direction:column}.xop-shift-order>span:last-child{justify-items:start}}

/* Shared page title for all workflow modules. */
.workflow-page-title { display:flex; align-items:center; justify-content:space-between; gap:16px; min-width:0; min-height:44px; margin:0 0 14px; padding:0; border:0; background:transparent; }
.workflow-page-title h2 { flex:1 1 auto; min-width:0; margin:0; overflow:hidden; color:var(--ink-strong); font-size:21px; font-weight:700; line-height:1.25; text-align:left; text-overflow:ellipsis; white-space:nowrap; }
.workflow-page-title [hidden] { display:none !important; }
.workflow-page-actions { flex:0 1 auto; min-width:0; justify-content:flex-end; }
.approval-grid>.workflow-page-title { width:100%; }
@media (max-width:700px) {
  .workflow-page-title { align-items:stretch; flex-direction:column; gap:9px; min-height:0; }
  .workflow-page-title h2 { width:100%; font-size:19px; }
  .workflow-page-actions { width:100%; justify-content:flex-start; flex-wrap:wrap; }
  .workflow-page-actions>select,.workflow-page-actions>label { min-width:0; max-width:100%; }
}

/* In-app guide */
.nav-item-with-icon { display:flex; align-items:center; gap:9px; }
.nav-item-with-icon>span:first-child { display:grid; place-items:center; width:20px; height:20px; border:1px solid currentColor; border-radius:6px; font-size:12px; font-weight:900; }
.guide-panel { min-width:0; }
.guide-mode-switch { display:inline-flex; gap:4px; padding:4px; margin-bottom:12px; border:1px solid var(--line); border-radius:10px; background:var(--surface-soft); }
.guide-mode-switch button { display:flex; align-items:center; gap:8px; min-height:38px; padding:8px 14px; border:0; border-radius:7px; color:var(--muted); background:transparent; font-weight:700; cursor:pointer; }
.guide-mode-switch button.active { color:#fff; background:var(--blue); box-shadow:0 3px 10px rgba(11,99,199,.2); }
.guide-toolbar { display:flex; align-items:end; gap:10px; margin-bottom:12px; }
.guide-toolbar label { display:grid; gap:5px; color:var(--muted); font-size:11px; font-weight:700; }
.guide-toolbar label:first-child { flex:1; }
.guide-toolbar input,.guide-toolbar select { min-height:38px; }
.guide-toolbar select { min-width:190px; }
.guide-layout { display:grid; grid-template-columns:260px minmax(0,1fr); min-height:540px; overflow:hidden; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.guide-topic-list { display:flex; flex-direction:column; gap:4px; max-height:680px; overflow:auto; padding:10px; border-right:1px solid var(--line); background:var(--surface-soft); }
.guide-topic-list button { display:grid; gap:3px; width:100%; padding:10px 11px; border:1px solid transparent; border-radius:8px; color:var(--ink); background:transparent; text-align:left; cursor:pointer; }
.guide-topic-list button:hover { background:var(--surface); }
.guide-topic-list button.active { border-color:#a9cff8; color:var(--blue); background:var(--brand-soft); box-shadow:inset 3px 0 0 var(--blue); }
.guide-topic-list button span { font-weight:700; }
.guide-topic-list button small { color:var(--muted); font-size:10px; }
.guide-content { min-width:0; padding:20px; }
.guide-content-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; }
.guide-content-header h3 { margin:0; color:var(--ink-strong); font-size:20px; }
.guide-content-header span { display:block; margin-top:3px; color:var(--muted); font-size:12px; }
.guide-visual-missing { display:grid; place-items:center; min-height:190px; padding:26px; border:1px dashed #a9bfd9; border-radius:11px; color:var(--muted); background:linear-gradient(145deg,var(--surface-soft),var(--surface)); text-align:center; }
.guide-visual-missing>span { display:grid; place-items:center; width:48px; height:48px; margin-bottom:8px; border-radius:12px; color:var(--blue); background:var(--brand-soft); font-size:25px; }
.guide-visual-missing strong { color:var(--ink-strong); }
.guide-visual-missing p { max-width:560px; margin:5px 0 0; font-size:12px; line-height:1.5; }
.guide-visual { position:relative; margin:0; overflow:hidden; border:1px solid var(--line); border-radius:11px; background:var(--surface-soft); }
.guide-visual img { display:block; width:100%; height:auto; }
.guide-image-marker { position:absolute; display:grid; place-items:center; width:28px; height:28px; border:2px solid #fff; border-radius:50%; color:#fff; background:var(--blue); box-shadow:0 4px 12px rgba(0,45,105,.35); font-weight:800; transform:translate(-50%,-50%); }
.guide-section { margin-top:18px; }
.guide-section h4,.guide-tour-card h4 { margin:0 0 9px; color:var(--ink-strong); }
.guide-callouts,.guide-tour-preview { display:grid; gap:8px; margin:0; padding:0; list-style:none; }
.guide-callouts li,.guide-tour-preview li { display:flex; gap:10px; padding:10px; border:1px solid var(--line); border-radius:9px; background:var(--surface-soft); }
.guide-callouts li>span,.guide-tour-preview li>span { display:grid; flex:0 0 26px; place-items:center; width:26px; height:26px; border-radius:50%; color:#fff; background:var(--blue); font-size:12px; font-weight:800; }
.guide-callouts strong,.guide-tour-preview strong { color:var(--ink-strong); }
.guide-callouts p,.guide-tour-preview p { margin:3px 0 0; color:var(--muted); font-size:12px; line-height:1.45; }
.guide-action-list { margin:0; padding-left:22px; color:var(--ink); }
.guide-action-list li { margin:7px 0; padding-left:4px; }
.guide-result,.guide-permission-note { margin-top:16px; padding:12px 14px; border-radius:9px; }
.guide-result { border:1px solid #b9e3c7; color:#166534; background:#f0fbf4; }
.guide-result p,.guide-permission-note { margin-bottom:0; }
.guide-result p { margin:4px 0 0; }
.guide-permission-note { color:#805900; background:#fff8df; font-size:12px; }
.guide-tour-card { display:flex; gap:14px; margin-bottom:14px; padding:16px; border:1px solid #b9d7f7; border-radius:11px; background:linear-gradient(145deg,var(--brand-soft),var(--surface)); }
.guide-tour-card p { margin:4px 0 0; color:var(--muted); line-height:1.5; }
.guide-tour-icon { display:grid; flex:0 0 42px; place-items:center; width:42px; height:42px; border-radius:12px; color:#fff; background:linear-gradient(135deg,var(--blue),#0f766e); font-size:20px; }
.guide-start-button { margin-top:16px; }
.guide-empty { color:var(--muted); text-align:center; }
.guide-overlay { position:fixed; inset:0; z-index:120; pointer-events:none; }
.guide-overlay[hidden] { display:none!important; }
.guide-shade { position:fixed; background:rgba(7,22,43,.58); transition:all .22s ease; }
.guide-focus-ring { position:fixed; border:3px solid #4da3ff; border-radius:10px; box-shadow:0 0 0 3px rgba(255,255,255,.88),0 10px 35px rgba(0,55,125,.35); transition:all .22s ease; }
.guide-virtual-cursor { position:fixed; left:0; top:0; z-index:2; width:28px; height:34px; filter:drop-shadow(0 3px 3px rgba(0,0,0,.35)); transition:transform .6s cubic-bezier(.2,.8,.2,1); }
.guide-virtual-cursor::before { content:""; position:absolute; width:0; height:0; border-top:22px solid #fff; border-right:14px solid transparent; transform:rotate(-20deg); }
.guide-virtual-cursor::after { content:""; position:absolute; left:3px; top:3px; width:0; height:0; border-top:16px solid #124f95; border-right:10px solid transparent; transform:rotate(-20deg); }
.guide-virtual-cursor span { position:absolute; left:-8px; top:-8px; width:38px; height:38px; border:2px solid rgba(77,163,255,.7); border-radius:50%; animation:guide-cursor-pulse 1.4s infinite; }
@keyframes guide-cursor-pulse { 50% { opacity:.18; transform:scale(.65); } }
.guide-pop-dialog { position:fixed; z-index:3; max-height:calc(100vh - 24px); overflow:auto; padding:14px; border:1px solid #b9d7f7; border-radius:15px; color:var(--ink); background:var(--surface); box-shadow:0 22px 60px rgba(5,35,75,.3); pointer-events:auto; }
.guide-pop-dialog::before { content:""; position:absolute; left:-7px; top:24px; width:12px; height:12px; border-left:1px solid #b9d7f7; border-bottom:1px solid #b9d7f7; background:var(--surface); transform:rotate(45deg); }
.guide-pop-dialog>header { display:flex; align-items:center; gap:9px; margin-bottom:10px; }
.guide-pop-avatar { display:grid; place-items:center; width:40px; height:40px; border-radius:12px; color:#fff; background:linear-gradient(135deg,#0757b8,#0f7f78); font-size:11px; font-weight:900; }
.guide-pop-dialog header strong,.guide-pop-dialog header small { display:block; }
.guide-pop-dialog header small { color:var(--muted); }
.guide-pop-dialog h3 { margin:0; color:var(--ink-strong); font-size:16px; }
.guide-pop-dialog>p { margin:6px 0 14px; color:var(--muted); line-height:1.5; }
.guide-pop-details { display:grid; gap:7px; margin:0 0 14px; padding-left:20px; color:var(--ink); font-size:12px; line-height:1.45; }
.guide-pop-details[hidden] { display:none; }
.guide-pop-details li::marker { color:var(--blue); font-weight:700; }
.guide-pop-dialog footer { display:flex; align-items:center; gap:6px; }
.guide-pop-dialog footer button { min-height:32px; padding:6px 9px; border:1px solid var(--line); border-radius:6px; color:var(--ink); background:var(--surface); cursor:pointer; }
.guide-pop-dialog footer button.primary { color:#fff; border-color:var(--blue); background:var(--blue); }
.guide-pop-dialog footer span { flex:1; color:var(--muted); text-align:center; font-size:11px; }
@media (max-width:850px) {
  .guide-layout { grid-template-columns:1fr; }
  .guide-topic-list { flex-direction:row; max-height:none; overflow:auto; border-right:0; border-bottom:1px solid var(--line); }
  .guide-topic-list button { flex:0 0 190px; }
}
@media (max-width:600px) {
  .guide-mode-switch,.guide-mode-switch button { width:100%; }
  .guide-mode-switch button { justify-content:center; }
  .guide-toolbar { align-items:stretch; flex-direction:column; }
  .guide-toolbar select { min-width:0; width:100%; }
  .guide-content { padding:14px; }
  .guide-content-header { align-items:stretch; flex-direction:column; }
  .guide-pop-dialog::before { display:none; }
}
@media (prefers-reduced-motion:reduce) {
  .guide-focus-ring,.guide-virtual-cursor { transition:none; }
  .guide-virtual-cursor span { animation:none; }
}

/* Playbook viewer */
.playbook-mount[hidden],.guide-layout[hidden],.guide-toolbar[hidden] { display:none!important; }
.playbook-viewer { position:relative; min-width:0; overflow:hidden; border:1px solid var(--line); border-radius:14px; color:var(--ink); background:radial-gradient(circle at 50% 25%,#f8fbff 0,#e8eef5 65%,#dbe4ee 100%); box-shadow:inset 0 1px 0 rgba(255,255,255,.8); outline:none; }
.playbook-viewer:focus-visible { box-shadow:0 0 0 3px rgba(11,99,199,.24); }
.playbook-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 18px; border-bottom:1px solid rgba(113,135,160,.25); background:rgba(255,255,255,.72); backdrop-filter:blur(8px); }
.playbook-header h3,.playbook-drawer h4 { margin:2px 0 0; color:var(--ink-strong); font-size:18px; }
.playbook-kicker { color:var(--blue); font-size:10px; font-weight:900; letter-spacing:.16em; }
.playbook-icon,.playbook-toolbar button { border:1px solid var(--line); color:var(--ink); background:var(--surface); cursor:pointer; }
.playbook-icon { width:38px; height:38px; border-radius:9px; font-size:20px; }
.playbook-stage { position:relative; display:grid; grid-template-columns:48px minmax(0,1fr) 48px; align-items:center; gap:12px; min-height:480px; padding:24px 16px 12px; overflow:auto hidden; }
.playbook-book { --playbook-zoom:1; position:relative; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:center; width:min(calc(100% * var(--playbook-zoom)),1180px); margin:auto; perspective:2200px; transform-style:preserve-3d; filter:drop-shadow(0 18px 22px rgba(18,43,71,.22)); }
.playbook-book.is-single { grid-template-columns:minmax(0,1fr); width:min(calc(82% * var(--playbook-zoom)),900px); }
.playbook-page { position:relative; display:grid; place-items:center; min-width:0; aspect-ratio:1492/1054; overflow:hidden; border:1px solid rgba(41,61,82,.18); background:#fff; transform-style:preserve-3d; backface-visibility:hidden; }
.playbook-page.left { border-radius:5px 0 0 5px; box-shadow:inset -18px 0 28px -24px rgba(10,28,48,.75); transform-origin:right center; }
.playbook-page.right { border-radius:0 5px 5px 0; box-shadow:inset 18px 0 28px -24px rgba(10,28,48,.75); transform-origin:left center; }
.playbook-book:not(.is-single)::after { content:""; position:absolute; z-index:4; top:0; bottom:0; left:50%; width:10px; pointer-events:none; background:linear-gradient(90deg,rgba(0,0,0,.16),rgba(255,255,255,.28) 45%,rgba(0,0,0,.12)); transform:translateX(-50%); }
.playbook-page img { display:block; width:100%; height:100%; object-fit:contain; opacity:0; transition:opacity .18s ease; }
.playbook-page.loaded img { opacity:1; }
.playbook-page-placeholder { position:absolute; color:var(--muted); font-size:12px; }
.playbook-page.loaded .playbook-page-placeholder { display:none; }
.playbook-page.error .playbook-page-placeholder { color:#a52a2a; }
.playbook-turning-leaf { position:absolute; z-index:8; inset:0 50% 0 0; transform-style:preserve-3d; pointer-events:none; }
.playbook-turning-leaf .playbook-page { position:absolute; inset:0; width:100%; height:100%; }
.playbook-turning-leaf.forward { left:50%; right:0; transform-origin:left center; animation:playbook-flip-forward .68s cubic-bezier(.22,.68,.26,1) both; }
.playbook-turning-leaf.backward { left:0; right:50%; transform-origin:right center; animation:playbook-flip-backward .68s cubic-bezier(.22,.68,.26,1) both; }
.playbook-book.is-single .playbook-turning-leaf { inset:0; }
.playbook-book.is-single .playbook-turning-leaf.forward { transform-origin:left center; }
.playbook-book.is-single .playbook-turning-leaf.backward { transform-origin:right center; }
.playbook-turning-leaf::after { content:""; position:absolute; inset:0; background:linear-gradient(90deg,rgba(0,0,0,.42),transparent 32%,rgba(255,255,255,.28)); opacity:.7; animation:playbook-paper-shadow .68s ease both; }
@keyframes playbook-flip-forward { 0%{transform:rotateY(0deg) skewY(0)} 48%{transform:rotateY(-92deg) skewY(-1.2deg)} 100%{transform:rotateY(-180deg) skewY(0)} }
@keyframes playbook-flip-backward { 0%{transform:rotateY(0deg) skewY(0)} 48%{transform:rotateY(92deg) skewY(1.2deg)} 100%{transform:rotateY(180deg) skewY(0)} }
@keyframes playbook-paper-shadow { 0%,100%{opacity:.08} 50%{opacity:.78} }
.playbook-nav { display:grid; place-items:center; width:44px; height:44px; border:1px solid rgba(83,109,137,.28); border-radius:50%; color:var(--blue); background:rgba(255,255,255,.9); box-shadow:0 6px 15px rgba(30,55,82,.13); font-size:32px; cursor:pointer; }
.playbook-nav:disabled { opacity:.3; cursor:not-allowed; }
.playbook-status { padding:4px 12px 10px; color:var(--muted); text-align:center; font-size:12px; font-weight:700; }
.playbook-toolbar { display:flex; align-items:center; justify-content:center; gap:7px; padding:11px 14px 14px; }
.playbook-toolbar button { min-height:36px; padding:7px 11px; border-radius:8px; font-weight:700; }
.playbook-toolbar output { min-width:50px; color:var(--muted); text-align:center; font-size:12px; font-weight:800; }
.playbook-separator { width:1px; height:24px; margin:0 3px; background:var(--line); }
.playbook-drawer { position:absolute; z-index:20; inset:0; }
.playbook-backdrop { position:absolute; inset:0; width:100%; border:0; background:rgba(8,25,44,.5); }
.playbook-drawer>section { position:absolute; top:0; bottom:0; left:0; width:min(390px,90%); overflow:auto; padding:16px; background:var(--surface); box-shadow:18px 0 45px rgba(4,26,48,.25); }
.playbook-drawer header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.playbook-thumbnails { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.playbook-thumbnails>button { padding:7px; border:1px solid var(--line); border-radius:9px; color:var(--ink); background:var(--surface-soft); cursor:pointer; }
.playbook-thumbnails .playbook-page { width:100%; }
.playbook-thumbnails>button>span { display:block; padding-top:6px; font-size:11px; font-weight:700; }
.playbook-viewer.is-overlay { position:fixed; z-index:150; inset:8px; }
.playbook-viewer:fullscreen,.playbook-viewer.is-overlay { border-radius:0; }
.playbook-viewer:fullscreen .playbook-stage,.playbook-viewer.is-overlay .playbook-stage { min-height:calc(100vh - 150px); }
@media (max-width:700px), (orientation:portrait) and (max-width:900px) {
  .guide-mode-switch { display:grid; grid-template-columns:1fr 1fr; }
  .playbook-header { padding:10px 12px; }
  .playbook-stage { grid-template-columns:34px minmax(0,1fr) 34px; gap:5px; min-height:360px; padding:16px 5px 8px; }
  .playbook-book,.playbook-book.is-single { grid-template-columns:minmax(0,1fr); width:min(calc(100% * var(--playbook-zoom)),700px); }
  .playbook-nav { width:34px; height:42px; border-radius:9px; font-size:26px; }
  .playbook-toolbar { flex-wrap:wrap; padding:8px 8px 12px; }
  .playbook-toolbar button { padding:7px 9px; }
  .playbook-toolbar button span { display:none; }
  .playbook-book::after { display:none; }
}
@media (prefers-reduced-motion:reduce) {
  .playbook-turning-leaf { animation-duration:.01ms!important; }
  .playbook-turning-leaf::after { animation-duration:.01ms!important; }
}

/* Shared floating actions: Chat nội bộ above POP Nexus */
:root {
  --floating-bubble-size:48px;
  --floating-bubble-width:154px;
  --floating-bubble-gap:10px;
  --floating-bubble-left:18px;
  --floating-bubble-right:18px;
  --floating-bubble-bottom:18px;
  --floating-bubble-radius:999px;
  --floating-bubble-icon-size:32px;
  --floating-bubble-shadow:0 13px 30px rgba(7,65,124,.3);
  --floating-popup-gap:12px;
  --floating-popup-bottom:calc(var(--floating-bubble-bottom) + (var(--floating-bubble-size) * 2) + var(--floating-bubble-gap) + var(--floating-popup-gap));
}
.floating-actions-container { position:fixed; z-index:111; right:auto; bottom:var(--floating-bubble-bottom); left:var(--floating-bubble-left); display:flex; flex-direction:column; align-items:flex-start; gap:var(--floating-bubble-gap); pointer-events:auto; }
.floating-action-host { position:relative; display:flex; order:var(--floating-action-order); font-family:var(--font-ui); pointer-events:auto; }
.floating-action-bubble { position:relative; z-index:112; display:flex; align-items:center; gap:9px; width:var(--floating-bubble-width); height:var(--floating-bubble-size); min-width:var(--floating-bubble-width); min-height:var(--floating-bubble-size); padding:7px 14px 7px 8px; overflow:visible; border:1px solid rgba(255,255,255,.32); border-radius:var(--floating-bubble-radius); color:#fff; background:linear-gradient(135deg,#0757b8,#0f7f78); box-shadow:var(--floating-bubble-shadow); font:800 13px/1 var(--font-ui); white-space:nowrap; cursor:pointer; transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease,filter .18s ease; }
.floating-action-bubble__icon { display:grid; place-items:center; flex:0 0 var(--floating-bubble-icon-size); width:var(--floating-bubble-icon-size); height:var(--floating-bubble-icon-size); border-radius:50%; background:rgba(255,255,255,.16); font-size:18px; line-height:1; }
.floating-action-bubble__label { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.floating-action-bubble:hover { transform:translateY(-1px); box-shadow:0 16px 34px rgba(7,65,124,.36); filter:saturate(1.04); }
.floating-action-bubble:focus-visible { outline:3px solid color-mix(in srgb,var(--brand) 38%,#fff); outline-offset:3px; }
.floating-action-host.is-open>.floating-action-bubble,.floating-action-bubble.is-open { border-color:rgba(255,255,255,.72); box-shadow:0 0 0 3px rgba(14,165,233,.25),var(--floating-bubble-shadow); }
@media(min-width:901px){
  .sidebar{max-height:calc(100dvh - 32px);overflow-y:auto;scroll-padding-bottom:130px}
  .sidebar .nav-list{padding-bottom:118px}
}

/* POP Nexus assistant */
.pop-nexus-root { z-index:auto; }
.pop-nexus-root svg { display:block; width:20px; height:20px; fill:currentColor; }
.pop-nexus-srm-invite { position:fixed; z-index:110; top:12px; left:var(--floating-bubble-left); width:min(330px,calc(100vw - 36px)); padding:12px 38px 12px 14px; border:1px solid var(--line-strong); border-radius:14px; color:var(--ink); background:var(--surface); box-shadow:var(--shadow-soft); cursor:pointer; animation:pop-nexus-invite-enter .22s ease-out; }
.pop-nexus-srm-invite[hidden] { display:none!important; }
.pop-nexus-srm-invite::after { content:""; position:absolute; top:var(--pop-invite-tail-top,22px); right:-9px; width:16px; height:16px; border-top:1px solid var(--line-strong); border-right:1px solid var(--line-strong); background:var(--surface); transform:rotate(45deg); }
.pop-nexus-srm-invite small { display:block; margin-bottom:5px; color:var(--brand); font-size:9px; font-weight:850; letter-spacing:.1em; }
.pop-nexus-srm-invite p { margin:0; font-size:12px; font-weight:650; line-height:1.45; }
.pop-nexus-srm-invite-close { position:absolute; top:7px; right:7px; z-index:1; display:grid; place-items:center; width:26px; height:26px; padding:0; border:1px solid transparent; border-radius:7px; color:var(--muted); background:transparent; font-size:19px; line-height:1; cursor:pointer; transition:color .15s ease,background-color .15s ease,border-color .15s ease,transform .15s ease; }
.pop-nexus-srm-invite-close:hover { border-color:var(--line-strong); color:var(--ink); background:var(--surface-soft); transform:scale(1.06); }
.pop-nexus-srm-invite-close:focus-visible { outline:2px solid var(--brand); outline-offset:1px; }
@keyframes pop-nexus-invite-enter { from { opacity:0; transform:translateY(6px) scale(.98); } }
.pop-nexus-window { position:fixed; z-index:109; right:auto; bottom:var(--floating-popup-bottom); left:var(--floating-bubble-left); display:grid; grid-template-rows:auto minmax(0,1fr); width:min(410px,calc(100vw - 36px)); height:min(640px,calc(100dvh - var(--floating-popup-bottom) - 12px)); overflow:hidden; border:1px solid var(--line); border-radius:18px; color:var(--ink); background:var(--surface); box-shadow:0 24px 70px rgba(15,39,70,.28); transform-origin:bottom left; animation:pop-nexus-enter .18s ease-out; }
.pop-nexus-window[hidden] { display:none!important; }
.pop-nexus-window.is-minimized { height:auto; }
.pop-nexus-window.is-minimized .pop-nexus-body { display:none; }
@keyframes pop-nexus-enter { from { opacity:0; transform:translateY(8px) scale(.98); } }
.pop-nexus-header { position:relative; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; min-height:68px; padding:11px 12px; color:var(--ink); background:linear-gradient(110deg,var(--surface),color-mix(in srgb,var(--brand-soft) 58%,var(--surface))); border-bottom:1px solid var(--line); }
.pop-nexus-avatar { position:relative; display:grid; place-items:center; width:42px; height:42px; border:1px solid var(--line-strong); border-radius:13px; color:var(--brand); background:var(--surface); box-shadow:var(--bms-shadow-1); }
.pop-nexus-avatar svg { width:25px; height:25px; }
.pop-nexus-avatar i { position:absolute; right:-3px; top:-3px; width:12px; height:12px; border:3px solid var(--surface); border-radius:50%; background:var(--bms-success); box-shadow:0 0 0 1px var(--bms-success); }
.pop-nexus-root[data-connection="loading"] .pop-nexus-avatar i { background:var(--bms-neutral); box-shadow:0 0 0 1px var(--bms-neutral); }
.pop-nexus-root[data-connection="error"] .pop-nexus-avatar i { background:var(--bms-danger); box-shadow:0 0 0 1px var(--bms-danger); }
.pop-nexus-title { min-width:0; }
.pop-nexus-title>div { display:flex; align-items:center; gap:7px; }
.pop-nexus-title strong { font-size:15px; }
.pop-nexus-title span { display:inline-flex; align-items:center; gap:4px; padding:3px 7px; border:1px solid var(--line-strong); border-radius:999px; color:var(--muted); background:var(--surface); font-size:9px; font-weight:850; text-transform:uppercase; letter-spacing:.02em; }
.pop-nexus-title span::before { content:""; width:5px; height:5px; border-radius:50%; background:currentColor; }
.pop-nexus-root[data-connection="ready"] .pop-nexus-mode-badge { border-color:var(--bms-success); color:var(--bms-success); background:var(--bms-success-soft); }
.pop-nexus-root[data-connection="error"] .pop-nexus-mode-badge { border-color:var(--bms-danger); color:var(--bms-danger); background:var(--bms-danger-soft); }
.pop-nexus-title small { display:block; margin-top:3px; opacity:.82; font-size:11px; }
.pop-nexus-header-actions { display:flex; align-items:center; gap:2px; }
.pop-nexus-icon-btn { display:grid; place-items:center; width:34px; height:34px; padding:0; border:0; border-radius:9px; color:inherit; background:transparent; cursor:pointer; }
.pop-nexus-icon-btn:hover { color:var(--brand); background:var(--brand-soft); }
.pop-nexus-menu { position:absolute; z-index:3; top:57px; right:54px; width:205px; padding:5px; border:1px solid var(--line); border-radius:10px; color:var(--ink); background:var(--surface); box-shadow:var(--shadow-soft); }
.pop-nexus-menu[hidden] { display:none; }
.pop-nexus-menu button { width:100%; padding:9px 10px; border:0; border-radius:7px; color:var(--red); background:transparent; text-align:left; cursor:pointer; }
.pop-nexus-menu button:hover { background:var(--surface-soft); }
.pop-nexus-body { min-height:0; display:grid; grid-template-rows:minmax(0,1fr) auto auto auto; background:var(--surface-soft); }
.pop-nexus-connection-note { margin:0; padding:8px 12px; border-bottom:1px solid var(--line); color:var(--muted); background:var(--brand-soft); font-size:10px; line-height:1.35; }
.pop-nexus-connection-note span { color:var(--brand); font-weight:800; }
.pop-nexus-integrations { display:grid; grid-template-columns:repeat(4,1fr); gap:5px; padding:8px 10px; border-bottom:1px solid var(--line); background:var(--surface); }
.pop-nexus-integrations button { position:relative; display:flex; align-items:center; gap:5px; min-width:0; padding:5px 6px; border:1px solid transparent; border-radius:9px; color:var(--muted); background:transparent; cursor:pointer; }
.pop-nexus-integrations button:hover { border-color:var(--line); background:var(--surface-soft); }
.pop-nexus-integrations button>span:first-child,.pop-nexus-dialog-mark { display:grid; place-items:center; flex:0 0 auto; width:24px; height:24px; border-radius:7px; color:#fff; background:var(--integration-color); }
.pop-nexus-integrations svg { width:15px; height:15px; }
.pop-nexus-integrations strong { font-size:7px; letter-spacing:-.3px; }
.pop-nexus-integrations button>span:nth-child(2) { min-width:0; overflow:hidden; font-size:9px; font-weight:700; text-overflow:ellipsis; }
.pop-nexus-integrations button>i { position:absolute; top:3px; right:2px; width:7px; height:7px; border:1px solid var(--surface); border-radius:50%; background:#94a3b8; }
.pop-nexus-messages { min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:14px 12px 10px; scroll-behavior:smooth; }
.pop-nexus-message { display:flex; align-items:flex-end; gap:7px; margin-bottom:12px; }
.pop-nexus-message.user { justify-content:flex-end; }
.pop-nexus-message>div { max-width:82%; padding:9px 11px 6px; border:1px solid var(--line); border-radius:13px 13px 13px 4px; background:var(--surface); box-shadow:0 3px 10px rgba(15,40,75,.05); }
.pop-nexus-message.user>div { border-color:transparent; border-radius:13px 13px 4px 13px; color:#fff; background:var(--brand); }
.pop-nexus-message p { margin:0; font-size:12px; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere; }
.pop-nexus-message time { display:block; margin-top:4px; color:var(--muted); font-size:9px; text-align:right; }
.pop-nexus-message.user time { color:rgba(255,255,255,.72); }
.pop-nexus-answer-rating{display:flex;align-items:center;gap:5px;margin-top:7px;padding-top:6px;border-top:1px solid var(--line);color:var(--muted);font-size:9px}.pop-nexus-answer-rating span{margin-right:auto}.pop-nexus-answer-rating button{display:grid;place-items:center;width:25px;height:24px;padding:0;border:1px solid var(--line);border-radius:8px;background:var(--surface);cursor:pointer}.pop-nexus-answer-rating button:hover,.pop-nexus-answer-rating button.active{border-color:var(--brand);background:var(--brand-soft)}
.pop-nexus-supplier-replies { display:flex; gap:7px; margin-top:9px; }
.pop-nexus-supplier-replies button { min-width:68px; padding:6px 12px; border:1px solid var(--line-strong); border-radius:8px; color:var(--ink); background:var(--surface-soft); font-size:11px; font-weight:750; cursor:pointer; }
.pop-nexus-supplier-replies button:first-child { border-color:var(--brand); color:#fff; background:var(--brand); }
.pop-nexus-supplier-replies button:hover { transform:translateY(-1px); box-shadow:var(--shadow-soft); }
.pop-nexus-message-avatar { display:grid; place-items:center; flex:0 0 auto; width:25px; height:25px; border-radius:8px; color:#fff; background:linear-gradient(135deg,#0757b8,#0f766e); }
.pop-nexus-message-avatar svg { width:15px; height:15px; }
.pop-nexus-typing>div { display:flex; gap:4px; padding:11px 13px; }
.pop-nexus-typing>div>i { width:6px; height:6px; border-radius:50%; background:var(--muted); animation:pop-nexus-dot 1s infinite ease-in-out; }
.pop-nexus-typing>div>i:nth-child(2) { animation-delay:.15s; }.pop-nexus-typing>div>i:nth-child(3) { animation-delay:.3s; }
@keyframes pop-nexus-dot { 0%,60%,100% { transform:translateY(0); opacity:.45; } 30% { transform:translateY(-3px); opacity:1; } }
.pop-nexus-quick-actions { display:flex; gap:6px; overflow-x:auto; padding:7px 10px 8px; scrollbar-width:thin; }
.pop-nexus-quick-actions button { flex:0 0 auto; max-width:205px; padding:6px 9px; border:1px solid var(--line-strong); border-radius:999px; color:var(--brand); background:var(--surface); font-size:10px; white-space:nowrap; cursor:pointer; }
.pop-nexus-quick-actions button:hover { background:var(--brand-soft); }
.pop-nexus-tools-sheet { margin:0 10px 8px; overflow:hidden; border:1px solid var(--line-strong); border-radius:15px; background:var(--surface); box-shadow:var(--bms-shadow-overlay); animation:pop-nexus-tools-enter .16s ease-out; }
.pop-nexus-tools-sheet[hidden],.pop-nexus-tool-integrations[hidden] { display:none!important; }
@keyframes pop-nexus-tools-enter { from { opacity:0; transform:translateY(7px) scale(.985); } }
.pop-nexus-tools-sheet>header { display:flex; align-items:center; gap:8px; min-height:41px; padding:6px 9px 6px 12px; border-bottom:1px solid var(--line); }
.pop-nexus-tools-sheet>header strong { font-size:11px; }
.pop-nexus-tools-sheet>header span { margin-left:auto; color:var(--muted); font-size:9px; }
.pop-nexus-tools-sheet>header button { display:grid; place-items:center; width:28px; height:28px; padding:0; border:0; border-radius:8px; color:var(--muted); background:var(--surface-soft); font-size:18px; cursor:pointer; }
.pop-nexus-tool-list { display:grid; padding:5px; }
.pop-nexus-tool-list>button { display:grid; grid-template-columns:34px minmax(0,1fr) 18px; align-items:center; gap:8px; width:100%; min-height:48px; padding:6px 7px; border:0; border-radius:10px; color:var(--ink); background:transparent; text-align:left; cursor:pointer; }
.pop-nexus-tool-list>button:hover { background:var(--brand-soft); }
.pop-nexus-tool-list>button>i { display:grid; place-items:center; width:32px; height:32px; border-radius:9px; color:var(--brand); background:var(--brand-soft); font-size:14px; font-style:normal; }
.pop-nexus-tool-list>button span { min-width:0; }
.pop-nexus-tool-list>button strong,.pop-nexus-tool-list>button small { display:block; }
.pop-nexus-tool-list>button strong { font-size:11px; }
.pop-nexus-tool-list>button small { margin-top:2px; overflow:hidden; color:var(--muted); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
.pop-nexus-tool-list>button>b { color:var(--muted); font-size:17px; text-align:center; transition:transform .15s ease; }
.pop-nexus-tool-list>button[aria-expanded="true"]>b { transform:rotate(90deg); }
.pop-nexus-tool-integrations { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; margin:2px 7px 6px 41px; padding:7px; border:1px solid var(--line); border-radius:10px; background:var(--surface-soft); }
.pop-nexus-tool-integrations button { display:grid; justify-items:center; gap:4px; min-width:0; padding:6px 3px; border:0; border-radius:8px; color:var(--muted); background:transparent; cursor:pointer; }
.pop-nexus-tool-integrations button:hover { color:var(--ink); background:var(--surface); }
.pop-nexus-tool-integrations button>span { display:grid; place-items:center; width:25px; height:25px; border-radius:7px; color:var(--bms-surface); background:var(--bms-primary); }
.pop-nexus-tool-integrations .pop-nexus-integration-teams>span { background:var(--bms-review); }
.pop-nexus-tool-integrations .pop-nexus-integration-onedrive>span { background:var(--bms-info); }
.pop-nexus-tool-integrations .pop-nexus-integration-gmail>span { background:var(--bms-danger); }
.pop-nexus-tool-integrations .pop-nexus-integration-outlook>span { background:var(--bms-primary); }
.pop-nexus-tool-integrations .pop-nexus-integration-sheets>span { background:var(--bms-success); }
.pop-nexus-tool-integrations .pop-nexus-integration-drive>span { background:var(--bms-warning); }
.pop-nexus-tool-integrations svg { width:15px; height:15px; }
.pop-nexus-tool-integrations strong { max-width:100%; overflow:hidden; font-size:8px; text-overflow:ellipsis; white-space:nowrap; }
.pop-nexus-composer { display:grid; grid-template-columns:auto auto minmax(0,1fr) auto; align-items:center; gap:4px; margin:0 10px; padding:5px; border:1px solid var(--line); border-radius:13px; background:var(--surface); }
.pop-nexus-composer:focus-within { border-color:var(--brand-muted); box-shadow:0 0 0 3px color-mix(in srgb,var(--brand) 12%,transparent); }
.pop-nexus-composer textarea { box-sizing:border-box; min-width:0; min-height:34px; max-height:96px; padding:7px 3px; overflow-y:auto; border:0; outline:0; resize:none; color:var(--ink); background:transparent; font:12px/20px var(--bms-font-ui); }
.pop-nexus-attach { color:var(--muted); }.pop-nexus-attach:hover { color:var(--brand); background:var(--brand-soft); }
.pop-nexus-tools-toggle { color:var(--brand); background:var(--brand-soft); }
.pop-nexus-tools-toggle svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
.pop-nexus-tools-toggle[aria-expanded="true"] { color:var(--bms-surface); background:var(--brand); }
.pop-nexus-send { display:grid; place-items:center; width:34px; height:34px; padding:0; border:0; border-radius:10px; color:#fff; background:var(--brand); cursor:pointer; }
.pop-nexus-send svg { width:17px; height:17px; }.pop-nexus-send:disabled { opacity:.38; cursor:not-allowed; }
.pop-nexus-disclaimer { display:block; padding:7px 12px 9px; color:var(--muted); font-size:9px; text-align:center; }
.pop-nexus-integration-dialog { width:min(390px,calc(100vw - 32px)); padding:22px; border:1px solid var(--line); border-radius:16px; color:var(--ink); background:var(--surface); box-shadow:0 25px 70px rgba(15,23,42,.28); }
.pop-nexus-integration-dialog::backdrop { background:rgba(15,23,42,.42); backdrop-filter:blur(2px); }
.pop-nexus-dialog-close { position:absolute; top:10px; right:10px; display:grid; place-items:center; width:34px; height:34px; padding:0; border:0; border-radius:9px; color:var(--muted); background:transparent; cursor:pointer; }
.pop-nexus-dialog-mark { width:46px; height:46px; border-radius:13px; }.pop-nexus-dialog-mark svg { width:27px; height:27px; }.pop-nexus-dialog-mark strong { font-size:11px; }
.pop-nexus-dialog-eyebrow { margin:14px 0 3px; color:var(--brand); font-size:10px; font-weight:800; }
.pop-nexus-integration-dialog h2 { margin:0 0 8px; color:var(--ink-strong); font-size:21px; }
.pop-nexus-connection-state { display:inline-flex; align-items:center; gap:6px; padding:4px 8px; border-radius:999px; color:var(--muted); background:var(--surface-soft); font-size:10px; font-weight:700; }
.pop-nexus-connection-state i { width:7px; height:7px; border-radius:50%; background:#94a3b8; }
.pop-nexus-dialog-description { margin:15px 0; color:var(--muted); font-size:12px; line-height:1.55; }
.pop-nexus-connect { width:100%; padding:10px 12px; border:0; border-radius:9px; color:#fff; background:var(--brand); font-weight:800; cursor:pointer; }
.pop-nexus-capabilities-dialog { width:min(430px,calc(100vw - 32px)); padding:0; overflow:hidden; border:1px solid var(--line); border-radius:16px; color:var(--ink); background:var(--surface); box-shadow:var(--bms-shadow-overlay); }
.pop-nexus-capabilities-dialog::backdrop { background:var(--bms-backdrop); backdrop-filter:blur(2px); }
.pop-nexus-capabilities-dialog>header { position:relative; padding:18px 54px 14px 18px; border-bottom:1px solid var(--line); background:linear-gradient(110deg,var(--surface),var(--brand-soft)); }
.pop-nexus-capabilities-dialog>header p { margin:0 0 4px; color:var(--brand); font-size:9px; font-weight:850; letter-spacing:.1em; }
.pop-nexus-capabilities-dialog>header h2 { margin:0; font-size:19px; }
.pop-nexus-capability-list { display:grid; gap:0; padding:7px 16px 14px; }
.pop-nexus-capability-list section { display:grid; grid-template-columns:30px minmax(0,1fr); gap:9px; padding:11px 0; border-bottom:1px solid var(--line); }
.pop-nexus-capability-list section:last-child { border:0; }
.pop-nexus-capability-list i { color:var(--brand); font:800 10px/1.4 ui-monospace,monospace; font-style:normal; }
.pop-nexus-capability-list strong { font-size:12px; }
.pop-nexus-capability-list p { margin:3px 0 0; color:var(--muted); font-size:10px; line-height:1.45; }
.pop-nexus-root button:focus-visible,.pop-nexus-root textarea:focus-visible,.pop-nexus-integration-dialog button:focus-visible { outline:3px solid color-mix(in srgb,var(--brand) 35%,transparent); outline-offset:2px; }
.sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
:root[data-theme="dark"] .pop-nexus-window,:root[data-theme="dark"] .pop-nexus-integration-dialog,:root[data-theme="dark"] .pop-nexus-capabilities-dialog { box-shadow:var(--bms-shadow-overlay); }
:root[data-theme="dark"] .pop-nexus-message.user>div { color:#fff; background:#2563eb; }
@media (max-width:640px) {
  .pop-nexus-header { min-height:64px; padding:9px 10px; }
  .pop-nexus-title span { padding-inline:5px; font-size:8px; }
  .pop-nexus-messages { padding-inline:10px; }
  .pop-nexus-message>div { max-width:86%; }
}
@media (max-width:360px) { .pop-nexus-menu-button { display:none; }.pop-nexus-header-actions { gap:0; }.pop-nexus-title span { display:none; } }
@media (prefers-reduced-motion:reduce) { .pop-nexus-window,.pop-nexus-launcher,.pop-nexus-srm-invite,.pop-nexus-typing>div>i { animation:none; transition:none; scroll-behavior:auto; } }

.mobile-nav-toggle,
.mobile-nav-profile,
.mobile-nav-logout,
.mobile-nav-backdrop,
.workflow-mobile-dashboard {
  display: none;
}

/* Mobile workspace: compact header, shared navigation drawer and touch-friendly data regions. */
@media (max-width: 768px) {
  body {
    padding-bottom: calc(62px + var(--bms-safe-area-bottom));
  }

  .topbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    min-height: 72px;
    padding: 10px 12px;
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .topbar h1 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .topbar .current-user {
    display: none;
  }

  .topbar-user-actions {
    grid-column: 3;
    grid-row: 1;
    width: auto;
    margin-left: 0;
    justify-content: flex-end;
  }

  .notification-bell {
    width: 44px;
    height: 44px;
  }

  .notification-dropdown {
    position: fixed;
    top: calc(max(10px, var(--bms-safe-area-top)) + 62px);
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100dvh - max(10px, var(--bms-safe-area-top)) - 82px);
  }

  .mobile-nav-toggle {
    display: grid;
    place-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 9px;
    color: #fff;
    background: rgba(255, 255, 255, .12);
    cursor: pointer;
  }

  .mobile-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .workspace {
    gap: 8px;
    padding: 8px;
  }

  .sidebar {
    position: fixed;
    z-index: 131;
    inset: 0 auto 0 0;
    height: 100dvh;
    align-self: auto;
    display: flex;
    flex-direction: column;
    width: min(86vw, 330px);
    max-width: none;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0 16px 16px 0;
    box-shadow: 18px 0 50px rgba(15, 23, 42, .28);
    transform: translateX(-105%);
    transition: transform 180ms ease-out;
    visibility: hidden;
  }

  .sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .mobile-nav-profile {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
    min-height: 82px;
    padding: calc(14px + var(--bms-safe-area-top)) 12px 14px;
    color: #fff;
    background: linear-gradient(120deg, #063f89, #0f766e);
  }

  .mobile-nav-profile > div {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .mobile-nav-profile strong,
  .mobile-nav-profile small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-profile small {
    opacity: .78;
    font-size: 11px;
  }

  .mobile-user-avatar {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    font-size: 19px;
    font-weight: 900;
  }

  .mobile-nav-close {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    font-size: 28px;
    cursor: pointer;
  }

  .sidebar .brand-block {
    display: none;
  }

  .nav-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .nav-item {
    width: 100%;
    min-height: 44px;
    padding-inline: 14px;
    text-align: left;
    white-space: nowrap;
  }

  .mobile-nav-logout {
    display: block;
    flex: 0 0 auto;
    width: calc(100% - 24px);
    min-height: 44px;
    margin: auto 12px calc(12px + var(--bms-safe-area-bottom));
  }

  .mobile-nav-backdrop {
    position: fixed;
    z-index: 130;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 42, .48);
    backdrop-filter: blur(1px);
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open .mobile-nav-backdrop {
    display: block;
  }

  .content {
    gap: 8px;
  }

  .flow-strip.workflow-13 {
    padding: 7px;
    scroll-padding-inline: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    touch-action: pan-x pan-y;
    scroll-snap-type: x proximity;
  }

  .workflow-track {
    gap: 8px;
  }

  .workflow-node {
    flex-shrink: 0;
    width: 142px;
    min-height: 68px;
    padding: 8px;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 1px 6px;
    scroll-snap-align: start;
  }

  .workflow-node::after {
    right: -7px;
  }

  .workflow-node-number {
    width: 26px;
    height: 26px;
  }

  .workflow-node strong {
    font-size: 12px;
  }

  .workflow-node small {
    font-size: 10px;
  }

  .workflow-mobile-dashboard {
    display: grid;
    border-color: #9fc4ef;
    background: var(--brand-soft);
  }

  .workflow-mobile-dashboard .workflow-node-number {
    background: var(--blue);
  }

  .panel {
    padding: 10px;
  }

  .section-title {
    gap: 10px;
    margin-bottom: 10px;
  }

  .dashboard-panel > .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-panel .metric {
    min-height: 82px;
  }

  .dashboard-panel .metric strong {
    margin-top: 5px;
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  .table-wrap {
    position: relative;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    touch-action: pan-x pan-y;
  }

  .table-wrap > table > thead {
    position: sticky;
    z-index: 2;
    top: 0;
  }

  .table-wrap th,
  .table-wrap td {
    padding: 7px 6px;
    font-size: clamp(11px, 3.15vw, 12px);
    line-height: 1.3;
  }

  .table-wrap .status,
  .table-wrap [class*="-status"] {
    max-width: 150px;
    padding: 3px 7px;
    font-size: 10px;
    white-space: normal;
  }

  .table-wrap .btn,
  .table-wrap button {
    min-height: 36px;
    padding-inline: 9px;
    font-size: 11px;
  }

  .table-wrap input,
  .table-wrap select {
    min-height: 34px;
    padding: 5px 7px;
    font-size: 16px;
  }

  .table-wrap table.mobile-fit-table {
    min-width: 100%;
    table-layout: auto;
  }

  .table-wrap table.mobile-wide-table {
    min-width: 680px;
  }

  button,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }

  input,
  select,
  textarea,
  .product-input,
  .cost-input,
  .cost-select,
  .deal-input {
    font-size: 16px;
  }

  .production-drawer {
    padding: 8px;
  }

  .production-drawer-card {
    max-height: calc(100dvh - 16px);
    border-radius: 10px;
  }

}

@media (max-width: 360px) {
  .topbar h1 {
    font-size: 15px;
  }

  .current-user button {
    padding-inline: 10px;
    font-size: 12px;
  }

  .dashboard-panel > .metric-grid {
    gap: 6px;
  }
}

/* Mobile module balance: contain desktop min-content and prevent focus zoom. */
@media (max-width: 768px) {
  .panel input,
  .panel select,
  .panel textarea,
  .login-card input {
    min-width: 0;
    max-width: 100%;
    font-size: 16px !important;
  }

  /* iOS Safari gives native date fields an oversized, centered value. */
  input[type="date"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 40px;
    min-height: 40px;
    padding: 7px 9px;
    font: inherit;
    font-size: 16px;
    line-height: 24px;
    color: inherit;
    text-align: left;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
  }

  input[type="date"]::-webkit-date-and-time-value {
    min-height: 24px;
    margin: 0;
    text-align: left;
  }

  input[type="date"]::-webkit-datetime-edit {
    padding: 0;
  }

  input[type="date"]::-webkit-calendar-picker-indicator {
    flex: 0 0 auto;
    margin: 0 0 0 6px;
    padding: 2px;
  }

  .product-overview,
  .costing-layout,
  .costing-layout > *,
  .quotation-form,
  .quotation-card,
  .quotation-auto-grid,
  .quotation-field-groups,
  .quotation-field-group,
  .quotation-items-card,
  .inventory-workspace,
  .inventory-main-card,
  .inventory-toolbar,
  .warehouse-card,
  .warehouse-toolbar {
    min-width: 0;
    max-width: 100%;
  }

  .product-table-wrap {
    max-height: 190px;
  }

  .table-wrap table.product-table {
    min-width: 620px;
  }

  .product-input {
    min-width: 72px;
    height: 32px;
    padding-inline: 6px;
  }

  .product-input.code {
    min-width: 96px;
  }

  .product-input.wide {
    min-width: 150px;
  }

  .product-input.number {
    min-width: 72px;
  }

  .costing-layout > .table-wrap table {
    min-width: 1080px;
  }

  .cost-input,
  .cost-select {
    min-width: 72px;
    height: 32px;
    padding-inline: 6px;
  }

  .cost-select.group {
    min-width: 120px;
  }

  .cost-input.wide {
    min-width: 128px;
  }

  .cost-input.supplier,
  .cost-supplier-control {
    min-width: 110px;
  }

  .cost-select.method {
    min-width: 160px;
  }

  .suggested-price-control {
    min-width: 120px;
  }

  .suggested-price-control .cost-input {
    min-width: 92px;
  }

  .quotation-form {
    width: 100%;
    overflow: hidden;
  }

  .quotation-card {
    width: 100%;
    padding: 12px;
  }

  .quotation-auto-grid,
  .quotation-customer-approval,
  .quotation-fields {
    width: 100%;
  }

  .quotation-items-card .table-wrap {
    width: 100%;
  }

  .table-wrap table.quotation-items-table {
    min-width: 820px;
  }

  .quotation-items-table .description-cell {
    min-width: 145px;
  }

  .inventory-main-card {
    overflow: hidden;
  }

  .inventory-toolbar {
    width: 100%;
  }

  .inventory-filters {
    max-width: 100%;
  }

  .inventory-table-wrap,
  .warehouse-card .table-wrap {
    width: 100%;
  }

  .warehouse-section-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    overflow: visible;
  }

  .warehouse-section-tabs button {
    width: 100%;
    min-width: 0;
    padding: 9px 7px;
    line-height: 1.25;
    white-space: normal;
  }

  .warehouse-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .warehouse-section-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .warehouse-section-actions .btn {
    min-width: 0;
    padding-inline: 6px;
    white-space: normal;
  }
}

/* Shared compact workspace for phones held in landscape orientation. */
@media (orientation: landscape) and (max-width: 950px) and (max-height: 500px) {
  html,
  body,
  .app-shell,
  .workspace,
  .content,
  .panel {
    min-width: 0;
    max-width: 100%;
  }

  html,
  body {
    min-height: 100%;
    overflow-x: hidden;
  }

  body {
    min-height: 100dvh;
    padding-bottom: calc(54px + var(--bms-safe-area-bottom));
  }

  .topbar {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 6px max(10px, var(--bms-safe-area-right)) 6px max(10px, var(--bms-safe-area-left));
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .topbar h1 {
    display: block;
    overflow: hidden;
    margin: 0;
    font-size: 15px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar .current-user {
    display: none;
  }

  .topbar-user-actions {
    grid-column: 3;
    grid-row: 1;
    width: auto;
    margin-left: 0;
    justify-content: flex-end;
  }

  .notification-bell {
    width: 40px;
    height: 40px;
  }

  .mobile-nav-toggle {
    display: grid;
    place-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 8px;
    color: #fff;
    background: rgba(255, 255, 255, .12);
    cursor: pointer;
  }

  .mobile-nav-toggle span {
    display: block;
    width: 19px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    width: 100%;
    padding: 6px;
  }

  .sidebar {
    position: fixed;
    z-index: 131;
    inset: 0 auto 0 0;
    display: flex;
    visibility: hidden;
    flex-direction: column;
    align-self: auto;
    width: min(58vw, 320px);
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0 14px 14px 0;
    box-shadow: 18px 0 50px rgba(15, 23, 42, .28);
    transform: translateX(-105%);
    transition: transform 180ms ease-out;
  }

  .sidebar.is-open {
    visibility: visible;
    transform: translateX(0);
  }

  .sidebar .brand-block {
    display: none;
  }

  .mobile-nav-profile {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    padding: max(6px, var(--bms-safe-area-top)) 8px 6px max(8px, var(--bms-safe-area-left));
    color: #fff;
    background: linear-gradient(120deg, #063f89, #0f766e);
  }

  .mobile-nav-profile > div {
    display: grid;
    gap: 1px;
    min-width: 0;
  }

  .mobile-nav-profile strong,
  .mobile-nav-profile small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-profile small {
    opacity: .78;
    font-size: 10px;
  }

  .mobile-user-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    font-size: 15px;
    font-weight: 900;
  }

  .mobile-nav-close {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    font-size: 25px;
    cursor: pointer;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 7px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .nav-item {
    width: 100%;
    min-height: 38px;
    padding: 6px 9px;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
  }

  .mobile-nav-logout {
    display: block;
    flex: 0 0 auto;
    width: calc(100% - 14px);
    min-height: 40px;
    margin: auto 7px max(7px, var(--bms-safe-area-bottom));
  }

  .mobile-nav-backdrop {
    position: fixed;
    z-index: 130;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 42, .48);
    backdrop-filter: blur(1px);
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open .mobile-nav-backdrop {
    display: block;
  }

  .content {
    gap: 6px;
  }

  .flow-strip.workflow-13 {
    width: 100%;
    max-width: 100%;
    padding: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-padding-inline: 5px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    touch-action: pan-x;
  }

  .workflow-track {
    width: max-content;
    min-width: max-content;
    gap: 6px;
  }

  .workflow-node {
    flex: 0 0 136px;
    width: 136px;
    min-height: 58px;
    padding: 6px;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 1px 5px;
    scroll-snap-align: start;
  }

  .workflow-node::after {
    right: -6px;
  }

  .workflow-node-number {
    width: 25px;
    height: 25px;
    font-size: 12px;
  }

  .workflow-node strong {
    font-size: 11px;
    line-height: 1.15;
  }

  .workflow-node small {
    font-size: 9px;
  }

  .workflow-mobile-dashboard {
    display: grid;
    border-color: #9fc4ef;
    background: var(--brand-soft);
  }

  .workflow-mobile-dashboard .workflow-node-number {
    background: var(--blue);
  }

  .panel {
    padding: 8px;
  }

  .section-title,
  .production-module-header,
  .inventory-header,
  .qc-header {
    gap: 8px;
    margin-bottom: 8px;
  }

  .panel h2,
  .section-title h2,
  .production-module-header h2 {
    font-size: 18px;
    line-height: 1.2;
  }

  .metric-grid,
  .warehouse-metrics,
  .inventory-metrics,
  .production-project-facts,
  .production-metrics {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 6px;
    margin-bottom: 8px;
  }

  .metric,
  .production-metric,
  .production-project-facts > div {
    min-height: 0;
    padding: 7px 9px;
  }

  .metric strong,
  .production-metric strong {
    margin-top: 2px;
    font-size: 16px;
  }

  .toolbar,
  .dashboard-actions,
  .warehouse-section-actions,
  .production-execution-toolbar,
  .production-table-toolbar,
  .inventory-toolbar,
  .warehouse-toolbar,
  .qc-toolbar,
  .guide-toolbar {
    display: flex;
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    width: auto;
  }

  .workflow-page-title {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    min-height: 40px;
    margin-bottom: 8px;
  }

  .workflow-page-title h2 {
    width: auto;
    font-size: 18px;
  }

  .workflow-page-actions {
    display: flex;
    flex: 0 1 auto;
    width: auto;
    max-width: 72%;
    justify-content: flex-end;
  }

  .toolbar .btn,
  .dashboard-actions .btn,
  .warehouse-section-actions .btn {
    width: auto;
    min-height: 36px;
  }

  .form-grid,
  .quotation-auto-grid,
  .quotation-fields,
  .warehouse-form-grid,
  .production-form .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .form-grid > .span-2,
  .production-form .form-grid > .span-2 {
    grid-column: 1 / -1;
  }

  .table-wrap,
  .product-table-wrap,
  .production-table-wrap,
  .inventory-table-wrap {
    width: 100%;
    max-width: 100%;
    max-height: min(56dvh, 260px);
    overflow: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
  }

  .table-wrap th,
  .table-wrap td,
  .production-table th,
  .production-table td {
    padding: 5px 6px;
    font-size: 11px;
    line-height: 1.2;
  }

  .table-wrap .btn,
  .table-wrap button {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 10px;
  }

  .production-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .production-side-card {
    position: static;
    padding: 9px;
  }

  .cost-mapping-modal,
  .production-drawer {
    align-items: stretch;
    padding: 4px;
  }

  .cost-mapping-card,
  .production-drawer-card {
    width: min(860px, 100%);
    max-height: calc(100dvh - 8px);
    border-radius: 9px;
  }

  .cost-mapping-card > header,
  .production-drawer-card > header {
    position: sticky;
    z-index: 3;
    top: 0;
    padding: 8px 11px;
    background: var(--surface);
  }

  .cost-mapping-search {
    padding: 7px 11px;
  }

  .cost-mapping-results,
  .production-drawer-card > div {
    padding: 0 11px 8px;
  }

  .cost-mapping-card > footer {
    padding: 7px 11px;
    background: var(--surface);
  }

  .warehouse-panel > .inventory-drawer,
  .fg-panel > .inventory-drawer,
  .inventory-drawer,
  .qc-drawer,
  .ar-panel > .ar-drawer {
    position: fixed;
    z-index: 140;
    inset: 4px 4px 4px auto;
    width: min(72vw, 620px);
    height: auto;
    max-height: calc(100dvh - 8px);
    padding: 10px;
    overflow: auto;
    border-radius: 10px 0 0 10px;
  }

  .inventory-drawer header,
  .qc-drawer > header {
    position: sticky;
    z-index: 3;
    top: -10px;
    padding: 4px 0 8px;
    background: var(--surface);
  }

  dialog,
  .pop-nexus-integration-dialog {
    max-height: calc(100dvh - 8px);
    overflow: auto;
  }

}

@media (orientation: landscape) and (min-width: 840px) and (max-width: 950px) and (max-height: 500px) {
  .dashboard-panel > .metric-grid,
  .warehouse-metrics,
  .inventory-metrics,
  .production-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .production-layout {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 32%);
  }
}

/* Compact the commercial review screens without reducing editable fields below
   the iOS no-zoom font threshold. */
@media (max-width: 768px) {
  .deal-context {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
  }

  .deal-context div,
  .deal-settings label {
    min-width: 0;
    padding: 7px 8px;
  }

  .deal-context span,
  .deal-settings span {
    font-size: 9px;
    line-height: 1.2;
  }

  .deal-context strong {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .deal-settings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
  }

  .deal-settings label {
    gap: 4px;
  }

  .deal-input {
    height: 34px;
    min-width: 0;
    padding-inline: 7px;
  }

  .deal-table-wrap {
    max-height: min(48dvh, 340px);
  }

  .deal-table {
    min-width: 1020px;
    font-size: 10px;
  }

  .deal-table th,
  .deal-table td {
    max-width: 112px;
    padding: 5px 6px;
    font-size: 10px;
    line-height: 1.2;
  }

  .deal-table th {
    white-space: normal;
  }

  .deal-table td {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .deal-table .deal-input.price {
    width: 92px;
    min-width: 92px;
  }

  .approval-section {
    padding: 11px 12px;
  }

  .approval-section h3 {
    font-size: 13px;
  }

  .approval-summary {
    gap: 5px;
    margin-top: 8px;
  }

  .approval-summary > div {
    gap: 8px;
    padding-bottom: 5px;
  }

  .approval-summary span {
    font-size: 10px;
  }

  .approval-summary strong {
    max-width: 62%;
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  .approval-product-list {
    gap: 6px;
  }

  .approval-product-item {
    padding: 7px 8px;
  }

  .approval-product-heading {
    gap: 1px;
  }

  .approval-product-heading strong {
    font-size: 11px;
  }

  .approval-product-meta {
    gap: 3px 8px;
    margin-top: 4px;
  }

  .approval-product-meta span {
    font-size: 9px;
  }

  .approval-sheet-footer {
    gap: 8px;
    padding: 9px 11px;
  }

  .approval-sheet-footer p {
    font-size: 10px;
    line-height: 1.3;
  }

  .approval-sheet-footer .approval-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
  }

  .approval-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 5px 6px;
    font-size: 10px;
    white-space: normal;
  }

  .quotation-card {
    padding: 9px 10px;
  }

  .quotation-card h3 {
    margin-bottom: 8px;
    font-size: 15px;
  }

  .quotation-auto-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .quotation-summary-item {
    min-width: 0;
    padding: 6px 7px;
  }

  .quotation-summary-item:last-child {
    grid-column: 1 / -1;
  }

  .quotation-auto-grid span,
  .quotation-customer-approval label > span,
  .quotation-fields label > span {
    font-size: 9px;
  }

  .quotation-auto-grid strong {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .quotation-approval-header {
    gap: 8px;
    margin-bottom: 8px;
  }

  .quotation-approval-icon {
    width: 42px;
    height: 42px;
  }

  .quotation-approval-header h3 {
    margin-bottom: 2px;
  }

  .quotation-approval-header p {
    font-size: 10px;
    line-height: 1.3;
  }

  .quotation-customer-approval {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .quotation-customer-approval label:last-child {
    grid-column: 1 / -1;
  }

  .quotation-customer-approval label:first-child {
    grid-column: 1 / -1;
  }

  .quotation-field-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .quotation-field-group {
    min-width: 0;
    padding: 8px;
  }

  .quotation-field-group h4 {
    margin-bottom: 6px;
    font-size: 11px;
  }

  .quotation-terms-group {
    grid-column: 1 / -1;
  }

  .quotation-terms-group .quotation-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .quotation-terms-group .quotation-fields .span-2 {
    grid-column: 1 / -1;
  }

  .quotation-fields {
    gap: 6px;
  }

  .quotation-fields label {
    gap: 3px;
    min-width: 0;
  }

  .quotation-fields textarea,
  .quotation-terms-grid textarea {
    min-height: 42px;
  }

  .table-wrap table.quotation-items-table {
    min-width: 740px;
    font-size: 10px;
  }

  .quotation-items-table th,
  .quotation-items-table td {
    padding: 5px;
    font-size: 10px;
    line-height: 1.2;
  }

  .quotation-items-table .description-cell {
    min-width: 120px;
  }

  .quotation-totals {
    margin-top: 7px;
  }

  .quotation-totals > div {
    padding: 5px 7px;
    font-size: 11px;
  }
}

@media (orientation: landscape) and (max-width: 950px) and (max-height: 500px) {
  .deal-context {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-bottom: 6px;
  }

  .deal-settings {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    margin-bottom: 6px;
  }

  .deal-context div,
  .deal-settings label {
    min-width: 0;
    padding: 6px 7px;
  }

  .deal-context span,
  .deal-settings span {
    font-size: 9px;
  }

  .deal-context strong {
    margin-top: 2px;
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  .deal-table {
    min-width: 1020px;
    font-size: 10px;
  }

  .approval-sheet-body {
    grid-template-columns: minmax(215px, .78fr) minmax(0, 1.22fr);
  }

  .approval-project-section {
    grid-row: span 2;
    border-right: 1px solid #e1eaf4;
    border-bottom: 0;
  }

  .approval-section {
    padding: 9px 11px;
  }

  .approval-product-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .approval-sheet-footer {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding: 7px 10px;
  }

  .approval-sheet-footer .approval-actions {
    display: flex;
    flex: 0 0 auto;
    width: auto;
  }

  .quotation-form {
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
    gap: 7px;
  }

  .quotation-card {
    padding: 8px 9px;
  }

  .quotation-auto-card {
    grid-column: 1;
  }

  .quotation-approval-card {
    grid-column: 2;
  }

  .quotation-extra-card {
    grid-column: 1 / -1;
  }

  .quotation-auto-grid,
  .quotation-customer-approval,
  .quotation-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .quotation-field-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .quotation-terms-group {
    grid-column: 1 / -1;
  }

  .quotation-items-card,
  .quotation-form > .form-actions {
    grid-column: 1 / -1;
  }

  .quotation-items-card .table-wrap {
    max-height: min(48dvh, 210px);
  }

  table.quotation-items-table {
    min-width: 740px;
    font-size: 10px;
  }
}

/* Quotation document responsive layout */
@media (max-width:1050px) {
  .quotation-document-header { grid-template-columns: minmax(0, 1fr); }
  .quotation-document-header > .quotation-approval-card { grid-column: auto; }
  .quotation-customer-approval { grid-template-columns: repeat(2, minmax(0, 1fr)); font-size: 13px; }
}

@media (max-width: 760px) {
  .quotation-roadmap-card { padding:10px 8px; }
  .quotation-roadmap-card > header { align-items:flex-start; }
  .quotation-roadmap-card > header div { display:grid; gap:3px; }
  .quotation-roadmap-scroll { width:100%; max-width:100%; overflow-x:auto; overflow-y:visible; }
  .quotation-roadmap-track { grid-template-columns:repeat(5,96px); width:max-content; min-width:max-content; }
  .quotation-roadmap-step {
    width:88px;
    min-width:88px;
    min-height:58px;
    margin-bottom:14px;
    padding:8px 8px 10px;
  }
  .quotation-roadmap-quick-check {
    bottom:-11px;
    width:22px;
    min-width:22px;
    max-width:22px;
    height:22px;
    min-height:22px;
    max-height:22px;
    aspect-ratio:1;
    flex:0 0 22px;
    border-radius:50%;
    box-shadow:0 0 0 2px var(--surface);
  }
  .quotation-roadmap-quick-check svg {
    width:11px;
    height:11px;
  }
  .quotation-roadmap-quick-check.is-confirmed {
    box-shadow:0 0 0 2px color-mix(in srgb,var(--green) 38%,var(--surface));
  }
  .quotation-roadmap-quick-check.is-confirmed.is-warning {
    box-shadow:0 0 0 2px color-mix(in srgb,var(--amber) 42%,var(--surface));
  }
  .quotation-roadmap-dialog-card footer { position:sticky; bottom:0; padding-top:8px; background:#fff; }
  .quotation-pdf-dialog > section > header { align-items:flex-start; }
  .quotation-pdf-dialog > section > header div { flex-wrap:wrap; justify-content:flex-end; }
  #quotationPdfPreview { padding:8px; }
}
@media (max-width:768px) {
  .quotation-document-header {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 20px 16px 16px;
  }
  .quotation-document-meta,
  .quotation-party-grid { grid-template-columns: minmax(0, 1fr); }
  .quotation-document-meta > label:nth-child(1),
  .quotation-document-meta > label:nth-child(2),
  .quotation-document-meta > label:nth-child(3) { grid-column: 1; }
  .quotation-field-wide { grid-column: 1; }
  .quotation-section-title { align-items: flex-start; flex-direction: column; }
  .quotation-items-table { min-width: 760px; }
  .quotation-terms-list { padding-inline: 14px; }
  .quotation-terms-list > label { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .quotation-terms-list > label > span:first-child,
  .quotation-terms-list > label > select:first-child { margin-top: 0; }
  .quotation-bank-fields { grid-template-columns: minmax(0, 1fr); }
  .quotation-totals { width: 100%; padding-inline: 14px; }
  .quotation-document-actions { align-items: stretch; flex-direction: column; padding-inline: 14px; }
  .quotation-document-actions .btn { width: 100%; min-height: 44px; }
  .quotation-customer-approval { grid-template-columns: minmax(0, 1fr); }
}

/* Warehouse delete with reservations modal */
.warehouse-delete-reservations-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.45);
  padding: 16px;
}
.warehouse-delete-card {
  background: var(--surface,#fff); border-radius: 10px;
  max-width: 580px; width: 100%;
  box-shadow: 0 12px 48px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}
.warehouse-delete-card header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 0;
}
.warehouse-delete-card header h3 {
  margin: 0; font-size: 17px; color: var(--danger,#dc2626);
}
.warehouse-delete-close {
  background: none; border: none; font-size: 22px;
  cursor: pointer; padding: 4px 8px; color: var(--text-muted,#666);
  line-height: 1;
}
.warehouse-delete-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  flex: 1;
}
.warehouse-delete-info {
  width: 100%; border-collapse: collapse;
  margin-bottom: 12px;
}
.warehouse-delete-info td {
  padding: 5px 8px; font-size: 13px;
  vertical-align: top;
}
.warehouse-delete-info td:first-child {
  width: 40%; color: var(--text-muted,#666);
}
.warehouse-delete-projects {
  margin-bottom: 12px;
  font-size: 13px;
}
.warehouse-delete-projects summary {
  cursor: pointer; font-weight: 600;
  padding: 4px 0; color: var(--accent,#1e3a5f);
}
.warehouse-delete-projects ul {
  margin: 6px 0 0 16px; padding: 0;
  list-style: disc;
}
.warehouse-delete-projects li {
  padding: 2px 0; font-size: 12px;
}
.warehouse-delete-reason {
  display: block; margin-top: 12px;
}
.warehouse-delete-reason span {
  display: block; font-weight: 600; font-size: 13px;
  margin-bottom: 4px;
}
.warehouse-delete-reason textarea {
  width: 100%; min-height: 60px;
  padding: 8px 10px; border: 1px solid var(--border,#ccc);
  border-radius: 6px; font-family: inherit; font-size: 13px;
  resize: vertical; box-sizing: border-box;
}
.warehouse-delete-reason textarea:focus {
  outline: 2px solid var(--accent,#1e3a5f); outline-offset: -1px;
}
.warehouse-delete-card footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border-light,#eee);
}
.btn.danger {
  background: var(--danger,#dc2626); color: #fff;
}
.btn.danger:hover { background: #b91c1c; }
.btn.danger:disabled { opacity: .5; cursor: not-allowed; }
.text-danger { color: var(--danger,#dc2626); }

/* CRM / SRM relationship workspaces */
.relationship-panel{min-width:0}.relationship-title p{margin:4px 0 0;color:var(--muted,#64748b)}
.relationship-tabs{display:flex;gap:6px;overflow-x:auto;padding:4px;margin:0 0 14px;border-bottom:1px solid var(--border,#e2e8f0)}
.relationship-tabs button{border:0;background:transparent;color:var(--muted,#64748b);padding:10px 14px;border-radius:8px 8px 0 0;white-space:nowrap;font-weight:650;cursor:pointer}
.relationship-tabs button.active{color:var(--accent,#1e3a5f);background:color-mix(in srgb,var(--accent,#1e3a5f) 10%,transparent);box-shadow:inset 0 -2px var(--accent,#1e3a5f)}
.relationship-toolbar{display:flex;gap:10px;margin-bottom:14px}.relationship-toolbar input{flex:1;min-width:180px;padding:10px 12px;border:1px solid var(--border,#d7dee8);border-radius:8px;background:var(--surface,#fff);color:inherit}
.relationship-content{min-height:260px}.relationship-loading,.relationship-empty{padding:34px;text-align:center;color:var(--muted,#64748b)}
.relationship-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin-bottom:16px}
.relationship-metric,.relationship-card,.supplier-score-grid article{padding:16px;border:1px solid var(--border,#e2e8f0);border-radius:12px;background:var(--surface,#fff);box-shadow:0 3px 14px rgba(15,23,42,.045)}
.relationship-metric span,.relationship-metric small{display:block;color:var(--muted,#64748b)}.relationship-metric strong{display:block;font-size:22px;margin:6px 0}.relationship-metric small{font-size:11px}.relationship-metric.unavailable{border-style:dashed}
.pipeline-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px}.pipeline-summary>div{padding:12px;border-radius:9px;background:var(--background,#f8fafc)}.pipeline-summary span,.pipeline-summary small{display:block;color:var(--muted,#64748b)}.pipeline-summary strong{font-size:20px}
.relationship-table-wrap{overflow:auto;border:1px solid var(--border,#e2e8f0);border-radius:10px}.relationship-table-wrap table{width:100%;min-width:760px}.relationship-table-wrap td small{display:block;color:var(--muted,#64748b)}
.crm-kanban{display:grid;grid-template-columns:repeat(7,minmax(210px,1fr));gap:10px;overflow-x:auto;padding-bottom:10px}.crm-stage{min-height:300px;padding:10px;background:var(--background,#f5f7fb);border:1px solid var(--border,#e2e8f0);border-radius:10px}.crm-stage>header{display:flex;justify-content:space-between;margin-bottom:10px}.crm-stage>p{color:var(--muted,#64748b);font-size:12px}.crm-opportunity{display:grid;gap:5px;padding:11px;margin-bottom:8px;border:1px solid var(--border,#dce3ed);border-radius:8px;background:var(--surface,#fff);cursor:grab}.crm-opportunity span,.crm-opportunity small{color:var(--muted,#64748b)}.crm-opportunity em{font-size:10px;color:#b45309}
.relationship-list{display:grid;gap:8px}.relationship-list article{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:11px 13px;border:1px solid var(--border,#e2e8f0);border-radius:9px;background:var(--surface,#fff)}.relationship-list article>div{display:grid;gap:3px}.relationship-list span,.relationship-list small{color:var(--muted,#64748b)}
.relationship-inline-form{display:flex;flex-wrap:wrap;gap:8px;padding:12px;margin-bottom:14px;background:var(--background,#f8fafc);border-radius:10px}.relationship-inline-form input,.relationship-inline-form select{min-width:150px;flex:1;padding:9px;border:1px solid var(--border,#d7dee8);border-radius:7px;background:var(--surface,#fff);color:inherit}
.relationship-notice{padding:12px;margin:12px 0;border-left:4px solid #0ea5e9;background:#e0f2fe;color:#0c4a6e;border-radius:7px}
.supplier-score-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}.supplier-score-grid article>strong{font-size:26px}.supplier-score-grid article>div{display:grid;grid-template-columns:repeat(2,1fr);gap:5px;margin:10px 0}.supplier-score-grid span{display:flex;justify-content:space-between;color:var(--muted,#64748b)}
.kraljic-matrix{display:grid;grid-template-columns:repeat(2,minmax(250px,1fr));gap:12px}.kraljic-matrix section{min-height:200px;padding:14px;border:1px solid var(--border,#e2e8f0);border-radius:12px}.kraljic-matrix section.strategic{background:#fef2f2}.kraljic-matrix section.leverage{background:#ecfdf5}.kraljic-matrix section.bottleneck{background:#fff7ed}.kraljic-matrix section.non_critical{background:#f8fafc}.kraljic-matrix button{display:grid;width:100%;text-align:left;border:1px solid rgba(15,23,42,.12);background:rgba(255,255,255,.8);padding:9px;margin:6px 0;border-radius:7px;cursor:pointer}.kraljic-matrix button small{color:#64748b}
.relationship-status{padding:3px 8px;border-radius:999px;background:#e2e8f0}.relationship-status.active{background:#dcfce7;color:#166534}.relationship-status.blocked{background:#fee2e2;color:#991b1b}.risk-high,.risk-critical{border-left:4px solid #dc2626!important}.risk-medium{border-left:4px solid #f59e0b!important}
.relationship-drawer{position:fixed;inset:0;z-index:9000}.relationship-drawer-backdrop{position:absolute;inset:0;border:0;background:rgba(15,23,42,.48)}.relationship-drawer>aside{position:absolute;right:0;top:0;bottom:0;width:min(680px,94vw);overflow:auto;background:var(--surface,#fff);box-shadow:-15px 0 40px rgba(15,23,42,.18)}.relationship-drawer header{position:sticky;top:0;z-index:2;display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid var(--border,#e2e8f0);background:var(--surface,#fff)}.relationship-drawer header h3{margin:0}.relationship-drawer-body,#relationshipDrawerBody{padding:18px}.drawer-open{overflow:hidden}
.relationship-detail-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.relationship-detail-grid section{padding:12px;border:1px solid var(--border,#e2e8f0);border-radius:9px}.relationship-detail-grid h4{margin-top:0}.relationship-detail-grid dl{display:grid;grid-template-columns:110px 1fr;gap:7px;margin:0}.relationship-detail-grid dt{color:var(--muted,#64748b)}.relationship-detail-grid dd{margin:0;font-weight:600}.relationship-timeline{border-left:2px solid var(--border,#e2e8f0);margin-left:8px;padding-left:16px}.relationship-timeline article{display:grid;margin:10px 0}.relationship-timeline time{color:var(--muted,#64748b);font-size:11px}
.relationship-form{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.relationship-form label{display:grid;gap:5px}.relationship-form input,.relationship-form textarea{padding:9px;border:1px solid var(--border,#d7dee8);border-radius:7px;background:var(--surface,#fff);color:inherit}.relationship-form .span-2{grid-column:1/-1}
@media(max-width:768px){.relationship-title{align-items:flex-start}.relationship-toolbar{flex-direction:column}.relationship-metrics{grid-template-columns:repeat(2,1fr)}.kraljic-matrix,.relationship-detail-grid,.relationship-form{grid-template-columns:1fr}.relationship-form .span-2{grid-column:auto}.crm-kanban{grid-template-columns:repeat(7,82vw)}.relationship-drawer>aside{width:100vw}.relationship-list article{align-items:flex-start}.relationship-tabs{margin-inline:-8px}.relationship-inline-form{display:grid}.relationship-inline-form input,.relationship-inline-form select{width:100%}}

/* CRM V2 — approved dark enterprise workspace */
[data-panel="crm"]{--crm-bg:#08111f;--crm-card:#111b2d;--crm-card-2:#152136;--crm-border:rgba(148,163,184,.15);--crm-blue:#3b82f6;--crm-cyan:#06b6d4;--crm-green:#22c55e;--crm-lime:#84cc16;--crm-yellow:#eab308;--crm-amber:#f59e0b;--crm-orange:#f97316;--crm-red:#ef4444;--crm-purple:#8b5cf6;--crm-magenta:#d946ef;background:var(--crm-bg);color:#e7eef9;border-radius:14px;padding:14px;min-height:calc(100vh - 130px)}
[data-panel="crm"] .relationship-title{margin:-14px -14px 12px;padding:14px 16px;border-bottom:1px solid var(--crm-border);background:linear-gradient(135deg,#0b1424,#0d192b)}[data-panel="crm"] .relationship-title p{color:#8291a8}[data-panel="crm"] .relationship-title h2{color:#f8fafc}
[data-panel="crm"] .relationship-tabs{gap:4px;border:1px solid var(--crm-border);border-radius:10px;padding:5px;background:#0b1424}[data-panel="crm"] .relationship-tabs button{color:#8fa0b8;border-radius:7px;padding:8px 11px}[data-panel="crm"] .relationship-tabs button.active{color:#fff;background:#1d4ed8;box-shadow:0 5px 15px rgba(37,99,235,.25)}
[data-panel="crm"] .relationship-toolbar input{background:#0b1424;border-color:var(--crm-border);color:#e7eef9}[data-panel="crm"] .relationship-content{color:#dbe7f7}
[data-panel="crm"] .relationship-toolbar[hidden]{display:none!important}
.crm-v2-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:10px}.crm-v2-kpis{grid-column:1/-1;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:9px}.crm-v2-card{min-width:0;padding:13px;border:1px solid var(--crm-border);border-radius:9px;background:linear-gradient(145deg,var(--crm-card),#0e1828);box-shadow:0 6px 18px rgba(0,0,0,.13)}.crm-v2-card h3{margin:0 0 11px;color:#f1f5f9;font-size:14px}.crm-v2-kpi{cursor:pointer;transition:transform .2s,border-color .2s}.crm-v2-kpi:hover{transform:translateY(-2px);border-color:rgba(59,130,246,.45)}.crm-v2-kpi span,.crm-v2-kpi small{display:block;color:#8999af;font-size:11px}.crm-v2-kpi strong{display:block;margin:7px 0;color:#fff;font-size:20px;white-space:nowrap}.crm-v2-kpi small{color:#5ee09a}.crm-v2-funnel{grid-column:span 4}.crm-v2-today{grid-column:span 4}.crm-v2-donut-card{grid-column:span 4}.crm-v2-revenue{grid-column:span 4}.crm-v2-sales{grid-column:span 3}.crm-v2-closing{grid-column:span 5}
.crm-funnel-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px}.crm-funnel-heading h3{margin-bottom:3px!important}.crm-funnel-heading p{margin:0;color:#8999af;font-size:10px}.crm-funnel-heading>span{flex:none;padding:4px 8px;border:1px solid var(--crm-border);border-radius:999px;color:#9aacbf;font-size:9px;font-weight:700}.crm-funnel-shape{display:grid;gap:3px;padding:2px 0 5px}.crm-funnel-row{display:flex;justify-content:center;width:100%;margin:0}.crm-funnel-segment{display:flex;align-items:center;justify-content:space-between;width:calc(100% - var(--funnel-level)*9%);min-width:48%;height:30px;padding:0 clamp(12px,5cqi,22px);clip-path:polygon(3% 0,97% 0,93% 100%,7% 100%);background:linear-gradient(100deg,color-mix(in srgb,var(--funnel-color) 88%,#fff),var(--funnel-color));color:#fff;filter:drop-shadow(0 3px 4px rgba(15,23,42,.13))}.crm-funnel-row:first-child .crm-funnel-segment{border-radius:7px 7px 0 0}.crm-funnel-row:last-child .crm-funnel-segment{border-radius:0 0 7px 7px}.crm-funnel-segment span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px;font-weight:700;letter-spacing:.01em}.crm-funnel-segment b{flex:none;margin-left:8px;font-size:12px;font-variant-numeric:tabular-nums}.crm-funnel-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:8px;padding-top:9px;border-top:1px solid var(--crm-border)}.crm-funnel-summary span{display:flex;align-items:center;justify-content:space-between;gap:7px}.crm-funnel-summary small{color:#8999af;font-size:9px}.crm-funnel-summary strong{font-size:12px;font-variant-numeric:tabular-nums}.crm-v2-funnel{container-type:inline-size}.crm-today-row,.crm-sales-row{display:flex;align-items:center;gap:9px;padding:8px 0;border-bottom:1px solid var(--crm-border)}.crm-today-row:last-child,.crm-sales-row:last-child{border:0}.crm-dot{width:8px;height:8px;border-radius:50%;background:var(--crm-amber);box-shadow:0 0 8px currentColor}.crm-today-row span,.crm-sales-row span{flex:1;font-size:12px}.crm-pill{padding:3px 7px;border-radius:999px;background:rgba(245,158,11,.14);color:#fbbf24;font-size:10px}.crm-donut{width:150px;aspect-ratio:1;margin:auto;border-radius:50%;display:grid;place-items:center;background:conic-gradient(var(--crm-blue) 0 18%,var(--crm-cyan) 18% 34%,var(--crm-green) 34% 49%,var(--crm-amber) 49% 67%,var(--crm-red) 67% 82%,var(--crm-purple) 82%)}.crm-donut:after{content:attr(data-label);display:grid;place-items:center;width:92px;aspect-ratio:1;border-radius:50%;background:#111b2d;color:#fff;font-weight:800;text-align:center;white-space:pre;font-size:13px}.crm-bars{height:130px;display:flex;align-items:end;gap:10px;padding-top:10px;border-bottom:1px solid #26344a}.crm-bar{flex:1;min-width:18px;border-radius:4px 4px 0 0;background:linear-gradient(#60a5fa,#2563eb);position:relative}.crm-bar span{position:absolute;bottom:-20px;width:100%;text-align:center;color:#8494aa;font-size:10px}.crm-avatar{width:27px;height:27px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(135deg,#3b82f6,#8b5cf6);font-size:10px;font-weight:800}.crm-v2-table-wrap{overflow:auto;border:1px solid var(--crm-border);border-radius:9px;background:#0e1828}.crm-v2-table{width:100%;min-width:760px;border-collapse:collapse}.crm-v2-table th,.crm-v2-table td{padding:10px 11px;border-bottom:1px solid var(--crm-border);text-align:left;font-size:12px}.crm-v2-table th{color:#8392a8;font-size:10px;text-transform:uppercase;letter-spacing:.04em}.crm-v2-table tr{cursor:pointer}.crm-v2-table tbody tr:hover{background:rgba(59,130,246,.06)}.crm-status{display:inline-flex;padding:3px 8px;border-radius:999px;background:rgba(59,130,246,.16);color:#60a5fa;font-size:10px}.crm-status.won{background:rgba(34,197,94,.14);color:#4ade80}.crm-status.lost{background:rgba(239,68,68,.14);color:#f87171}
.crm-v2-table th,.crm-v2-table td{background:transparent!important;color:#dce7f6!important}.crm-v2-table th{color:#8392a8!important}
[data-panel="crm"] .crm-kanban{grid-template-columns:repeat(7,minmax(220px,1fr))}[data-panel="crm"] .crm-stage{background:#0b1424;border-color:var(--crm-border)}[data-panel="crm"] .crm-stage:nth-child(1){border-top:3px solid var(--crm-blue)}[data-panel="crm"] .crm-stage:nth-child(2){border-top:3px solid var(--crm-cyan)}[data-panel="crm"] .crm-stage:nth-child(3){border-top:3px solid var(--crm-green)}[data-panel="crm"] .crm-stage:nth-child(4){border-top:3px solid var(--crm-yellow)}[data-panel="crm"] .crm-stage:nth-child(5){border-top:3px solid var(--crm-orange)}[data-panel="crm"] .crm-stage:nth-child(6){border-top:3px solid var(--crm-lime)}[data-panel="crm"] .crm-stage:nth-child(7){border-top:3px solid var(--crm-red)}[data-panel="crm"] .crm-opportunity{background:var(--crm-card);border-color:var(--crm-border);color:#eef4ff}
.crm-empty-v2{display:grid;place-items:center;min-height:280px;text-align:center;color:#8b9bb0}.crm-empty-v2 strong{display:block;color:#dbe7f7;font-size:16px;margin-bottom:6px}
@media(max-width:1200px){.crm-v2-kpis{grid-template-columns:repeat(3,1fr)}.crm-v2-funnel,.crm-v2-today,.crm-v2-donut-card{grid-column:span 6}.crm-v2-revenue,.crm-v2-closing{grid-column:span 7}.crm-v2-sales{grid-column:span 5}}@media(max-width:700px){[data-panel="crm"]{padding:9px;border-radius:0}.crm-v2-kpis{grid-template-columns:repeat(2,1fr)}.crm-v2-grid>*{grid-column:1/-1}.crm-v2-kpi strong{font-size:16px}.crm-v2-card{padding:11px}.crm-v2-table{min-width:680px}}

/* CRM V2 follows the BMS workspace theme and its normal content density. */
[data-panel="crm"]{--crm-bg:var(--background);--crm-card:var(--surface);--crm-card-2:var(--surface-soft);--crm-border:var(--line);margin:0;padding:0;min-height:0;border-radius:0;background:transparent;color:var(--ink)}
:root[data-theme="dark"] [data-panel="crm"]{--crm-bg:#08111f;--crm-card:#111b2d;--crm-card-2:#152136;--crm-border:rgba(148,163,184,.2)}
[data-panel="crm"] .relationship-title{margin:0 0 10px;padding:0 0 10px;border-bottom:1px solid var(--line);background:transparent}
[data-panel="crm"] .relationship-title p{color:var(--muted)}[data-panel="crm"] .relationship-title h2{color:var(--ink)}
[data-panel="crm"] .relationship-tabs{gap:3px;margin-bottom:10px;padding:4px;border-color:var(--line);background:var(--surface-soft)}
[data-panel="crm"] .relationship-tabs button{padding:7px 10px;color:var(--muted)}[data-panel="crm"] .relationship-tabs button.active{color:#fff;background:var(--brand);box-shadow:0 3px 10px rgba(7,87,184,.18)}
[data-panel="crm"] .relationship-toolbar input{border-color:var(--line);background:var(--surface);color:var(--ink)}[data-panel="crm"] .relationship-content{color:var(--ink)}
[data-panel="crm"] .crm-v2-grid{gap:8px}[data-panel="crm"] .crm-v2-kpis{gap:8px}
[data-panel="crm"] .crm-v2-card{padding:11px;border-color:var(--crm-border);background:var(--crm-card);box-shadow:0 3px 12px rgba(15,39,70,.06)}
[data-panel="crm"] .crm-v2-card h3{margin-bottom:9px;color:var(--ink);font-size:13px}
[data-panel="crm"] .crm-v2-kpi span,[data-panel="crm"] .crm-v2-kpi small{color:var(--muted)}[data-panel="crm"] .crm-v2-kpi strong{margin:5px 0;color:var(--ink);font-size:18px}[data-panel="crm"] .crm-v2-kpi small{color:var(--success,#08783e)}
[data-panel="crm"] .crm-funnel-heading p,[data-panel="crm"] .crm-funnel-summary small{color:var(--muted)}[data-panel="crm"] .crm-funnel-heading>span{color:var(--muted)}
[data-panel="crm"] .crm-today-row,[data-panel="crm"] .crm-sales-row{padding:7px 0}
[data-panel="crm"] .crm-donut{width:132px}[data-panel="crm"] .crm-donut:after{width:78px;background:var(--crm-card);color:var(--ink);font-size:12px}
[data-panel="crm"] .crm-bars{height:112px;border-color:var(--line)}[data-panel="crm"] .crm-bar span{color:var(--muted)}
[data-panel="crm"] .crm-v2-table-wrap{border-color:var(--crm-border);background:var(--crm-card)}
[data-panel="crm"] .crm-v2-table th,[data-panel="crm"] .crm-v2-table td{padding:8px 9px;color:var(--ink)!important}[data-panel="crm"] .crm-v2-table th{color:var(--muted)!important}
[data-panel="crm"] .crm-stage{border-color:var(--crm-border);background:var(--crm-card-2)}[data-panel="crm"] .crm-opportunity{border-color:var(--crm-border);background:var(--crm-card);color:var(--ink)}
[data-panel="crm"] .crm-empty-v2{min-height:220px;color:var(--muted)}[data-panel="crm"] .crm-empty-v2 strong{color:var(--ink)}
:root[data-theme="dark"] [data-panel="crm"] .crm-v2-card{box-shadow:0 5px 16px rgba(0,0,0,.14)}
@media(max-width:700px){[data-panel="crm"]{padding:0}}
.nav-item[data-panel="crm"]{width:100%;min-height:38px;padding:0 10px;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--ink)}
.nav-item[data-panel="crm"].active,.nav-item[data-panel="crm"]:hover{border-color:var(--line-strong);background:var(--brand-soft);color:var(--blue)}
section[data-panel="crm"]{padding:14px;border-radius:8px;background:var(--surface)}
section[data-panel="crm"] .relationship-title{margin:0;padding:4px 0 14px;border-bottom:1px solid var(--line)}
section[data-panel="crm"] .relationship-tabs{gap:4px;margin:12px 0 18px;padding:0;overflow-x:auto;border:0;border-bottom:1px solid var(--line);border-radius:0;background:transparent}
section[data-panel="crm"] .relationship-tabs button{padding:10px 12px;border-radius:8px 8px 0 0;background:transparent;color:var(--muted)}
section[data-panel="crm"] .relationship-tabs button.active{background:var(--brand-soft);color:var(--brand);box-shadow:none}
@media(max-width:700px){section[data-panel="crm"]{padding:12px}section[data-panel="crm"] .relationship-tabs{margin-inline:0}}

.pop-nexus-feedback-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:0 14px 10px}.pop-nexus-feedback-actions button{padding:9px;border:1px solid #b9d4f4;border-radius:9px;background:#eff6ff;color:#0757b8;font-weight:800;cursor:pointer}
.pop-nexus-feedback-dialog{width:min(760px,calc(100vw - 24px));max-height:min(88vh,820px);padding:0;overflow:auto;border:0;border-radius:16px;background:var(--surface);color:var(--ink);font-family:var(--font-ui);font-size:14px;line-height:1.5;box-shadow:0 24px 80px rgba(15,23,42,.35)}.pop-nexus-feedback-dialog::backdrop{background:rgba(15,23,42,.55)}.pop-nexus-feedback-dialog>header{position:sticky;z-index:3;top:0;display:flex;align-items:start;justify-content:space-between;padding:18px 20px;border-bottom:1px solid var(--line);background:var(--surface)}.pop-nexus-feedback-dialog header p{margin:0;color:#0757b8;font-size:11px;font-weight:700;letter-spacing:.02em}.pop-nexus-feedback-dialog header h2{margin:4px 0 0;font-size:23px;font-weight:700;line-height:1.25}.pop-nexus-feedback-dialog [data-feedback-view]{padding:18px 20px}.pop-feedback-tabs{position:sticky;z-index:2;top:78px;display:flex;padding:0 20px;border-bottom:1px solid var(--line);background:var(--surface)}.pop-feedback-tabs button{padding:12px;border:0;border-bottom:2px solid transparent;background:none;color:var(--muted);font-size:15px;font-weight:700;cursor:pointer}.pop-feedback-tabs button.active{border-color:#0757b8;color:#0757b8}
.pop-feedback-form{display:grid;grid-template-columns:1fr 1fr;gap:14px}.pop-feedback-form label{display:grid;gap:6px;color:var(--muted);font-size:13px;font-weight:600;line-height:1.4}.pop-feedback-form input,.pop-feedback-form select,.pop-feedback-form textarea{width:100%;padding:10px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);font-family:var(--font-ui);font-size:14px;font-weight:400;line-height:1.5}.pop-feedback-form textarea{resize:vertical}.pop-feedback-form input::placeholder,.pop-feedback-form textarea::placeholder{color:#7c8798;font-weight:400;opacity:1}.pop-feedback-form small{font-size:12px;font-weight:400}.pop-feedback-wide,.pop-feedback-form footer,.pop-feedback-error{grid-column:1/-1}.pop-feedback-error{min-height:18px;margin:0;color:#b91c1c}.pop-feedback-form footer{display:flex;justify-content:flex-end}.pop-feedback-submit{padding:10px 18px;border:0;border-radius:9px;background:#0757b8;color:#fff;font-size:14px;font-weight:700;cursor:pointer}.pop-feedback-submit:disabled{opacity:.6;cursor:wait}
.pop-feedback-mine-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.pop-feedback-mine-toolbar button,.pop-feedback-mine-detail>button{padding:7px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);cursor:pointer}.pop-feedback-mine-list{display:grid;gap:9px}.pop-feedback-mine-list>button{display:grid;grid-template-columns:1fr auto;gap:5px;width:100%;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);text-align:left;cursor:pointer}.pop-feedback-mine-list>button:hover{border-color:#60a5fa}.pop-feedback-mine-list span:first-child{display:grid}.pop-feedback-mine-list small,.pop-feedback-mine-list time{color:var(--muted);font-size:11px}.pop-feedback-mine-list p{grid-column:1/-1;margin:5px 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pop-feedback-status{display:inline-flex;align-self:start;padding:4px 7px;border-radius:999px;background:#e5e7eb;font-size:10px;font-weight:800}.pop-feedback-status.new{background:#dbeafe;color:#1d4ed8}.pop-feedback-status.in_progress,.pop-feedback-status.analyzing,.pop-feedback-status.planned{background:#ede9fe;color:#6d28d9}.pop-feedback-status.completed{background:#dcfce7;color:#166534}.pop-feedback-status.rejected,.pop-feedback-status.duplicate{background:#fee2e2;color:#991b1b}.pop-feedback-mine-detail{display:grid;gap:12px}.pop-feedback-mine-detail>p,.pop-feedback-mine-detail section p{white-space:pre-wrap}.pop-feedback-mine-detail section{padding:12px;border-left:3px solid #22c55e;background:#f0fdf4}.pop-feedback-files{display:flex;gap:7px;flex-wrap:wrap}.pop-feedback-files button{padding:7px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:#0757b8}.pop-feedback-mine-detail ol{display:grid;gap:7px;padding:0;list-style:none}.pop-feedback-mine-detail li{display:grid;padding:9px;border-left:2px solid #93c5fd;background:rgba(219,234,254,.25)}.pop-feedback-mine-detail time{color:var(--muted);font-size:10px}.pop-feedback-empty{padding:28px;text-align:center;color:var(--muted)}
@media(max-width:640px){.pop-nexus-feedback-dialog{width:100vw;max-width:none;height:100dvh;max-height:none;border-radius:0}.pop-nexus-feedback-dialog>header{padding:14px}.pop-feedback-tabs{top:70px;padding:0 14px}.pop-nexus-feedback-dialog [data-feedback-view]{padding:14px}.pop-feedback-form{grid-template-columns:1fr}.pop-feedback-wide,.pop-feedback-form footer,.pop-feedback-error{grid-column:auto}.pop-nexus-feedback-actions{padding-inline:10px}}

/* Authenticated internal employee chat */
.internal-chat-root[hidden]{display:none!important}.internal-chat-root{z-index:auto;color:var(--ink)}
.internal-chat-launcher>b{position:absolute;top:-7px;right:-5px;min-width:22px;padding:4px 6px;border:2px solid var(--surface);border-radius:999px;background:#dc2626;color:#fff;font-size:10px;line-height:1.1;text-align:center}.internal-chat-launcher>b[hidden]{display:none!important}
.internal-chat-window{position:fixed;z-index:110;right:auto;bottom:var(--floating-popup-bottom);left:var(--floating-bubble-left);display:grid;grid-template-rows:64px minmax(0,1fr);width:min(920px,calc(100vw - 36px));height:min(650px,calc(100dvh - var(--floating-popup-bottom) - 12px));max-height:calc(100dvh - var(--floating-popup-bottom) - 12px);overflow:hidden;contain:layout paint;border:1px solid var(--line);border-radius:18px;background:var(--surface);box-shadow:0 24px 70px rgba(15,39,70,.3);animation:chat-enter .18s ease-out}.internal-chat-window[hidden]{display:none!important}@keyframes chat-enter{from{opacity:0;transform:translateY(8px) scale(.985)}}
.internal-chat-header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;color:#fff;background:linear-gradient(115deg,#0757b8,#0f766e)}.internal-chat-header>div{display:grid;grid-template-columns:38px 1fr;column-gap:9px;align-items:center}.internal-chat-header>div>span{grid-row:1/3;display:grid;place-items:center;width:38px;height:38px;border:1px solid rgba(255,255,255,.25);border-radius:11px;background:rgba(255,255,255,.14);font-size:19px}.internal-chat-header strong{font-size:15px}.internal-chat-header small{opacity:.8;font-size:10px}.internal-chat-header nav{display:flex}.internal-chat-header button,.chat-thread-header>button,.chat-info>header button{display:grid;place-items:center;width:34px;height:34px;padding:0;border:0;border-radius:9px;background:transparent;color:inherit;font-size:18px;cursor:pointer}.internal-chat-header button:hover{background:rgba(255,255,255,.15)}
.internal-chat-body{display:grid;grid-template-columns:260px minmax(0,1fr);min-height:0}.internal-chat-body:has(.chat-info:not([hidden])){grid-template-columns:240px minmax(0,1fr) 245px}.chat-sidebar{display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;border-right:1px solid var(--line);background:var(--surface)}.chat-sidebar-toolbar{display:flex;gap:7px;padding:10px;border-bottom:1px solid var(--line)}.chat-sidebar-toolbar label{display:flex;align-items:center;flex:1;min-width:0;padding:0 9px;border:1px solid var(--line);border-radius:9px;background:var(--surface-soft)}.chat-sidebar-toolbar input{width:100%;min-width:0;padding:9px 5px;border:0;outline:0;background:transparent;color:var(--ink);font:12px var(--font-ui)}.chat-sidebar-toolbar>button{width:38px;border:0;border-radius:9px;background:var(--brand);color:#fff;font-size:21px;cursor:pointer}
.chat-conversation-list{min-height:0;overflow-y:auto}.chat-conversation{position:relative;display:grid;grid-template-columns:40px minmax(0,1fr) auto;gap:8px;width:100%;padding:10px;border:0;border-bottom:1px solid var(--line);background:transparent;color:var(--ink);text-align:left;cursor:pointer}.chat-conversation:hover,.chat-conversation.active{background:var(--brand-soft)}.chat-avatar{display:grid;place-items:center;flex:0 0 auto;width:38px;height:38px;border-radius:12px;background:linear-gradient(135deg,#dbeafe,#ccfbf1);color:#0757b8;font-size:12px;font-weight:800}.chat-conversation>span:nth-child(2){min-width:0}.chat-conversation strong,.chat-conversation small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-conversation strong{font-size:12px}.chat-conversation small,.chat-conversation time{margin-top:4px;color:var(--muted);font-size:9px}.chat-conversation>b{position:absolute;right:9px;bottom:9px;min-width:19px;padding:3px;border-radius:999px;background:#dc2626;color:#fff;font-size:9px;text-align:center}.chat-conversation>i{position:absolute;right:30px;bottom:11px;color:var(--brand);font-size:8px}.chat-empty{display:grid;place-items:center;gap:8px;padding:30px 14px;color:var(--muted);font-size:12px;text-align:center}.chat-empty button,.chat-welcome button{padding:9px 13px;border:0;border-radius:8px;background:var(--brand);color:#fff;font-weight:700;cursor:pointer}
.chat-thread{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto auto;min-width:0;min-height:0;background:var(--surface-soft)}.chat-welcome{grid-row:1/-1;display:grid;place-content:center;justify-items:center;padding:20px;text-align:center}.chat-welcome>span{display:grid;place-items:center;width:62px;height:62px;border-radius:20px;background:var(--brand-soft);font-size:29px}.chat-welcome h3{margin:15px 0 3px}.chat-welcome p{max-width:330px;margin:0 0 15px;color:var(--muted);font-size:12px}.chat-thread-header{display:flex;align-items:center;gap:9px;min-height:58px;padding:8px 10px;border-bottom:1px solid var(--line);background:var(--surface)}.chat-thread-header>div{min-width:0;margin-right:auto}.chat-thread-header strong,.chat-thread-header small{display:block}.chat-thread-header small{margin-top:2px;color:var(--muted);font-size:9px}.chat-thread-header>button{color:var(--muted)}.chat-mobile-back{display:none!important}.chat-message-search{display:flex;gap:6px;padding:7px 10px;border-bottom:1px solid var(--line);background:var(--surface)}.chat-message-search[hidden]{display:none}.chat-message-search input{flex:1;min-width:0;padding:7px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink)}.chat-message-search button{border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink)}
.chat-messages{min-height:0;overflow-y:auto;padding:14px;overscroll-behavior:contain}.chat-message{display:flex;align-items:flex-end;gap:7px;margin:0 0 12px}.chat-message.mine{flex-direction:row-reverse}.chat-message>.chat-avatar{width:28px;height:28px;border-radius:9px;font-size:9px}.chat-message-bubble{max-width:min(78%,520px);padding:8px 10px;border:1px solid var(--line);border-radius:13px 13px 13px 3px;background:var(--surface);box-shadow:0 3px 10px rgba(15,40,75,.04)}.chat-message.mine .chat-message-bubble{border-color:transparent;border-radius:13px 13px 3px 13px;background:#dbeafe}.chat-message-bubble>b{display:block;margin-bottom:3px;color:var(--brand);font-size:9px}.chat-message p{margin:0;font-size:12px;line-height:1.48;white-space:pre-wrap;overflow-wrap:anywhere}.chat-message em{color:var(--muted);font-size:11px}.chat-message blockquote{margin:0 0 6px;padding:6px;border-left:3px solid var(--brand);background:rgba(148,163,184,.14);font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-message blockquote strong{display:block}.chat-message footer{display:flex;justify-content:flex-end;gap:7px;margin-top:5px}.chat-message footer time{margin-right:auto;color:var(--muted);font-size:8px}.chat-message footer button{padding:0;border:0;background:none;color:var(--brand);font-size:9px;cursor:pointer}.chat-file{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px 6px;width:100%;margin-top:5px;padding:7px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);text-align:left;cursor:pointer}.chat-file>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-file small{grid-column:2;color:var(--muted);font-size:8px}
.chat-reply-preview{display:flex;align-items:center;justify-content:space-between;padding:7px 12px;border-top:1px solid var(--line);background:var(--surface)}.chat-reply-preview[hidden]{display:none}.chat-reply-preview span,.chat-reply-preview small{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px}.chat-reply-preview button{border:0;background:none;color:var(--muted);font-size:18px}.chat-composer{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:end;gap:5px;margin:8px;padding:5px;border:1px solid var(--line);border-radius:13px;background:var(--surface)}.chat-composer textarea{min-height:35px;max-height:100px;padding:8px 3px;border:0;outline:0;resize:none;background:transparent;color:var(--ink);font:12px/1.45 var(--font-ui)}.chat-composer>button{width:35px;height:35px;padding:0;border:0;border-radius:10px;background:transparent;color:var(--muted);font-size:17px;cursor:pointer}.chat-composer .chat-send{background:var(--brand);color:#fff}.chat-composer>small{position:absolute;right:5px;bottom:44px;max-width:80%;padding:3px 6px;border-radius:5px;background:var(--surface);color:var(--muted);font-size:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-info{min-width:0;overflow-y:auto;border-left:1px solid var(--line);background:var(--surface)}.chat-info>header{display:flex;align-items:center;justify-content:space-between;padding:12px;border-bottom:1px solid var(--line)}.chat-info-profile{display:grid;justify-items:center;padding:18px 10px;border-bottom:1px solid var(--line)}.chat-info-profile .chat-avatar{width:54px;height:54px;font-size:15px}.chat-info-profile strong{margin-top:8px;font-size:13px}.chat-info-profile small{color:var(--muted);font-size:10px}.chat-preferences{display:grid;padding:8px;border-bottom:1px solid var(--line)}.chat-preferences button,.chat-danger{padding:9px;border:0;border-radius:7px;background:transparent;color:var(--ink);text-align:left;cursor:pointer}.chat-preferences button:hover{background:var(--surface-soft)}.chat-member-section{padding:10px}.chat-member-section>header{display:flex;justify-content:space-between;margin-bottom:7px}.chat-member-section>header button{border:0;background:none;color:var(--brand);font-size:10px}.chat-member-section>div{display:flex;align-items:center;gap:7px;padding:6px 0}.chat-member-section .chat-avatar{width:29px;height:29px;border-radius:9px;font-size:8px}.chat-member-section>div>span:nth-child(2){min-width:0;margin-right:auto}.chat-member-section strong,.chat-member-section small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px}.chat-member-section small{color:var(--muted);font-size:8px}.chat-member-section>div>button{border:0;background:none;color:#dc2626;font-size:9px}.chat-member-section select{max-width:80px;padding:4px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--ink);font-size:8px}.chat-info form{display:grid;gap:6px;padding:10px}.chat-info form label{display:grid;gap:4px;color:var(--muted);font-size:9px}.chat-info form input{width:100%;padding:7px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink)}.chat-info form button{padding:7px;border:0;border-radius:7px;background:var(--brand);color:#fff}.chat-danger{margin:10px;color:#dc2626}
.chat-new-dialog{width:min(500px,calc(100vw - 28px));max-height:80dvh;padding:0;border:0;border-radius:15px;background:var(--surface);color:var(--ink);font-family:var(--font-ui);box-shadow:0 25px 75px rgba(15,23,42,.35)}.chat-new-dialog [hidden]{display:none!important}.chat-new-dialog::backdrop{background:rgba(15,23,42,.52)}.chat-new-dialog form{display:grid;gap:12px;padding:18px}.chat-new-dialog form>header{display:flex;justify-content:space-between}.chat-new-dialog header strong,.chat-new-dialog header small{display:block}.chat-new-dialog header small{margin-top:3px;color:var(--muted);font-size:10px}.chat-new-dialog header button{border:0;background:none;color:var(--muted);font-size:22px}.chat-type-tabs{display:flex;border-bottom:1px solid var(--line)}.chat-type-tabs button{padding:8px 12px;border:0;border-bottom:2px solid transparent;background:none;color:var(--muted);font-weight:700}.chat-type-tabs button.active{border-color:var(--brand);color:var(--brand)}.chat-new-dialog form>label{display:grid;gap:5px;color:var(--muted);font-size:11px;font-weight:700}.chat-new-dialog input{padding:9px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink)}.chat-employee-results{max-height:300px;overflow-y:auto;border:1px solid var(--line);border-radius:9px}.chat-employee-results>label{display:flex;align-items:center;gap:9px;padding:8px;border-bottom:1px solid var(--line);cursor:pointer}.chat-employee-results>label:last-child{border:0}.chat-employee-results .chat-avatar{width:32px;height:32px;border-radius:9px;font-size:9px}.chat-employee-results strong,.chat-employee-results small{display:block}.chat-employee-results small{color:var(--muted);font-size:9px}.chat-employee-results>p{padding:18px;color:var(--muted);text-align:center}.chat-form-error{min-height:16px;margin:0;color:#dc2626;font-size:10px}.chat-new-dialog footer{display:flex;justify-content:flex-end;gap:8px}.chat-new-dialog footer button{padding:9px 13px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);font-weight:700}.chat-new-dialog footer .primary{border-color:var(--brand);background:var(--brand);color:#fff}
:root[data-theme="dark"] .chat-message.mine .chat-message-bubble{background:#183b69}.internal-chat-root button:focus-visible,.internal-chat-root input:focus-visible,.internal-chat-root textarea:focus-visible{outline:3px solid color-mix(in srgb,var(--brand) 35%,transparent);outline-offset:1px}
.internal-chat-header nav{display:flex;align-items:center}.internal-chat-header nav button{width:40px;height:40px;font-size:21px}.internal-chat-header button:hover,.internal-chat-header button:focus-visible{background:rgba(255,255,255,.18)}.chat-conversation-list,.chat-online-panel{grid-row:2}
.internal-chat-body{min-width:0;overflow:hidden}.chat-sidebar{min-height:0;overflow:hidden}.chat-sidebar-controls{border-bottom:1px solid var(--line)}.chat-sidebar-toolbar{padding-bottom:6px;border-bottom:0}.chat-sidebar-toolbar label[hidden]{display:none}.chat-sidebar-toolbar>button{flex:0 0 38px;height:38px}.chat-sidebar-tabs{display:grid;grid-template-columns:1fr 1fr;padding:0 8px}.chat-sidebar-tabs button{min-height:36px;padding:7px 4px;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--muted);font-size:10px;font-weight:700;cursor:pointer}.chat-sidebar-tabs button.active{border-color:var(--brand);color:var(--brand)}
.chat-avatar-wrap{position:relative;display:block;width:38px;height:38px;flex:0 0 38px}.chat-online-dot{position:absolute;right:-2px;bottom:-2px;width:11px;height:11px;border:2px solid var(--surface);border-radius:50%;background:#16a34a;box-sizing:border-box}.chat-online-panel{display:grid;grid-template-rows:auto minmax(0,1fr);min-height:0;overflow:hidden}.chat-online-panel[hidden]{display:none}.chat-online-panel>label{display:flex;align-items:center;margin:9px;padding:0 9px;border:1px solid var(--line);border-radius:9px;background:var(--surface-soft)}.chat-online-panel input{width:100%;min-width:0;padding:9px 5px;border:0;outline:0;background:transparent;color:var(--ink)}.chat-online-panel>[data-chat-online-list]{min-height:0;overflow-y:auto;overscroll-behavior:contain}.chat-online-user{display:flex;align-items:center;gap:9px;width:100%;min-height:56px;padding:9px 10px;border:0;border-bottom:1px solid var(--line);background:transparent;color:var(--ink);text-align:left;cursor:pointer}.chat-online-user:hover{background:var(--brand-soft)}.chat-online-user>span:nth-child(2){min-width:0}.chat-online-user strong,.chat-online-user small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-online-user small{margin-top:3px;color:var(--muted);font-size:9px}
.chat-thread{position:relative;overflow:hidden}.chat-thread-header,.chat-message-search,.chat-reply-preview,.chat-composer{flex-shrink:0}.chat-messages{min-width:0;min-height:0;overflow-x:hidden;overflow-y:auto}.chat-message{min-width:0}.chat-message-bubble{min-width:0;overflow:hidden}.chat-file{max-width:100%}.chat-composer{min-width:0;flex-shrink:0}.chat-composer textarea{width:100%;min-width:0;max-height:100px;overflow-y:hidden;box-sizing:border-box}.chat-scroll-bottom{position:absolute;z-index:2;right:18px;bottom:70px;padding:7px 10px;border:1px solid var(--line);border-radius:999px;background:var(--surface);color:var(--brand);box-shadow:0 5px 16px rgba(15,39,70,.16);font-size:10px;font-weight:700;cursor:pointer}.chat-scroll-bottom[hidden]{display:none}.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
@media(max-width:900px){.internal-chat-window{inset:0;width:100vw;height:100dvh;max-height:100dvh;border:0;border-radius:0}.internal-chat-header{padding-top:max(10px,var(--bms-safe-area-top));}.internal-chat-body,.internal-chat-body:has(.chat-info:not([hidden])){grid-template-columns:1fr}.chat-thread,.chat-info{display:none}.internal-chat-root.has-active-thread .chat-sidebar{display:none}.internal-chat-root.has-active-thread .chat-thread{display:grid}.internal-chat-root.has-active-thread .chat-info:not([hidden]){position:absolute;z-index:3;inset:64px 0 0;display:block}.chat-mobile-back{display:grid!important}.chat-messages{-webkit-overflow-scrolling:touch;overscroll-behavior:contain}.chat-message>div{max-width:85%}.chat-composer{margin:6px 8px max(6px,var(--bms-safe-area-bottom))}.chat-composer textarea,.chat-sidebar-toolbar input,.chat-online-panel input,.chat-message-search input,.chat-new-dialog input,.chat-info input,.chat-info select{font-size:16px!important}.chat-new-dialog{width:100vw;max-width:none;height:100dvh;max-height:none;border-radius:0}.chat-new-dialog form{height:100%;padding-bottom:max(18px,var(--bms-safe-area-bottom));grid-template-rows:auto auto auto auto minmax(0,1fr) auto auto}}
@media(prefers-reduced-motion:reduce){.internal-chat-window,.internal-chat-launcher{animation:none;transition:none}}

@media(min-width:1400px){.floating-actions-container:has(.internal-chat-root.is-open) .pop-nexus-root:has(.pop-nexus-launcher.is-open) .pop-nexus-window{left:calc(var(--floating-bubble-left) + min(920px,calc(100vw - 36px)) + 12px)}}
@media(max-width:900px){
  :root{--floating-bubble-size:48px;--floating-bubble-width:48px;--floating-bubble-right:max(12px,var(--bms-safe-area-right));--floating-bubble-bottom:max(12px,var(--bms-safe-area-bottom));--floating-bubble-gap:8px}
  .floating-actions-container{right:var(--floating-bubble-right);left:auto;align-items:flex-end}
  :root[data-floating-surface] .floating-action-bubble{display:none}
  .floating-action-bubble{justify-content:center;gap:0;padding:7px}
  .floating-action-bubble__label{display:none}
  .pop-nexus-window,.pop-nexus-window.is-minimized{inset:0;width:100vw;height:100dvh;max-height:100dvh;border:0;border-radius:0;transform-origin:bottom right}
  .pop-nexus-window.is-minimized{top:auto;right:max(8px,var(--bms-safe-area-right));bottom:max(8px,var(--bms-safe-area-bottom));left:8px;width:auto;height:auto;border:1px solid var(--line);border-radius:14px}
}
@media(max-width:900px) and (orientation:landscape){
  :root{--floating-bubble-size:44px;--floating-bubble-width:44px;--floating-bubble-icon-size:30px;--floating-bubble-gap:6px;--floating-bubble-right:max(10px,var(--bms-safe-area-right));--floating-bubble-bottom:max(8px,var(--bms-safe-area-bottom))}
  .pop-nexus-window,.internal-chat-window{max-height:100dvh}
}

/* Keep optional hidden rows from changing the chat panel's three-region layout. */
.chat-thread-header{grid-row:1}
.chat-message-search{grid-row:2}
.chat-messages{grid-row:3}
.chat-reply-preview{grid-row:4}
.chat-composer{grid-row:5}

.chat-message.pending>div{opacity:.72}
.chat-file-pending{cursor:default}
.chat-delivery-status{margin-left:2px;color:var(--muted);font-size:8px;white-space:nowrap}
.chat-reactions{display:flex;flex-wrap:wrap;gap:4px;margin-top:6px}
.chat-reaction-chip{display:inline-flex;align-items:center;gap:3px;min-height:24px;padding:2px 7px;border:1px solid var(--line);border-radius:999px;background:var(--surface-soft);color:var(--ink);cursor:pointer}
.chat-reaction-chip.mine{border-color:var(--brand);background:var(--brand-soft)}
.chat-reaction-chip b{font-size:9px}
.chat-reaction-picker{display:flex;flex-wrap:wrap;gap:3px;margin-top:6px;padding:5px;border:1px solid var(--line);border-radius:10px;background:var(--surface);box-shadow:0 6px 18px rgba(15,39,70,.12)}
.chat-reaction-picker button{display:grid;place-items:center;width:32px;height:32px;padding:0;border:0;border-radius:8px;background:transparent;font-size:17px;cursor:pointer}
.chat-reaction-picker button:hover,.chat-reaction-picker button:focus-visible{background:var(--brand-soft)}
.chat-message-react-side{display:grid;place-items:center;flex:0 0 36px;width:36px;height:36px;margin:0 0 3px;padding:0;border:1px solid var(--line);border-radius:50%;background:var(--surface);color:var(--brand);box-shadow:0 3px 10px rgba(15,39,70,.1);font-size:20px;line-height:1;cursor:pointer}
.chat-message-react-side:hover,.chat-message-react-side:focus-visible{border-color:var(--brand);background:var(--brand-soft);outline:2px solid transparent}

/* Internal chat conversation layout: compact message bubbles and non-destructive info drawer. */
.chat-ui-icon{display:block;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.internal-chat-header .chat-ui-icon{width:20px;height:20px}
.internal-chat-body{position:relative;grid-template-columns:280px minmax(0,1fr)}
.internal-chat-body:has(.chat-info:not([hidden])){grid-template-columns:280px minmax(0,1fr)}
.chat-messages{padding:18px 18px 76px}
.chat-message{gap:7px;margin-bottom:10px;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important}
.chat-message>.chat-avatar{align-self:flex-end;width:26px;height:26px;border-radius:50%;font-size:8px}
.chat-message>.chat-message-stack{position:relative;display:block;width:fit-content;max-width:min(68%,480px);padding:0;border:0;background:transparent;box-shadow:none;overflow:visible}
.chat-message-bubble{min-width:72px;max-width:100%;padding:7px 10px 6px;border:1px solid var(--line);border-radius:12px 12px 12px 3px;background:var(--surface);box-shadow:0 2px 7px color-mix(in srgb,var(--ink) 7%,transparent)}
.chat-message.mine .chat-message-bubble{border-color:color-mix(in srgb,var(--brand) 28%,transparent);border-radius:12px 12px 3px 12px;background:color-mix(in srgb,var(--surface) 76%,var(--brand))}
.chat-message-bubble>b{display:block;margin-bottom:2px;color:var(--brand);font-size:9px}
.chat-message footer{display:flex;align-items:center;gap:7px;min-height:14px;margin:4px 16px 0 0;padding:0;color:var(--muted)}
.chat-message.mine footer{justify-content:flex-end}
.chat-message footer button{min-height:16px!important;padding:0;font-size:8px;line-height:1.2}
.chat-file{grid-template-columns:18px minmax(0,1fr) auto;align-items:center;width:min(100%,320px);gap:2px 7px;padding:8px}
.chat-file small{grid-column:3;white-space:nowrap}
.chat-info{position:absolute;z-index:4;inset:0 0 0 auto;width:min(290px,100%);box-shadow:-14px 0 36px color-mix(in srgb,var(--ink) 16%,transparent)}
.chat-composer{z-index:3;box-shadow:0 -8px 22px color-mix(in srgb,var(--surface) 82%,transparent)}
.chat-message{margin-bottom:22px}
.chat-message-react-side{position:absolute;z-index:2;right:-11px;bottom:-10px;display:grid;place-items:center;width:25px;height:25px;min-height:25px!important;aspect-ratio:1;margin:0;padding:0;border:1px solid var(--line);border-radius:50%!important;background:var(--surface);font-size:13px;line-height:1;box-shadow:0 2px 6px color-mix(in srgb,var(--ink) 14%,transparent)}
.chat-message-react-side.has-reaction{border-color:color-mix(in srgb,var(--brand) 42%,var(--line));background:var(--surface);font-size:15px}
.chat-message-react-side>span{display:grid;place-items:center;width:100%;height:100%;line-height:1}
.chat-reaction-picker{position:absolute;z-index:4;right:-8px;bottom:20px;display:flex;flex-wrap:nowrap;margin:0;padding:4px;border-radius:999px;box-shadow:0 8px 22px color-mix(in srgb,var(--ink) 20%,transparent)}
.chat-avatar{overflow:hidden;isolation:isolate;border-radius:50%;background:var(--bms-frame-800)}.chat-avatar>img{display:block;width:100%;height:100%;object-fit:cover}
.chat-avatar .avatar-role-portrait{transform:scale(1.04)}
.chat-composer>button{display:grid;place-items:center;align-self:center;line-height:0}
.chat-composer .chat-send{width:36px;height:36px;min-height:36px!important;border-radius:9px}
.chat-composer .chat-send .chat-ui-icon{width:18px;height:18px;transform:translate(-1px,1px)}
.chat-composer>[data-chat-files]:empty{display:none}
.chat-composer .chat-send{overflow:hidden;background-clip:padding-box}
.chat-composer .chat-send:focus-visible{outline:0;box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--bms-frame-text) 72%,transparent)}
.chat-composer>[data-chat-files]{z-index:1;top:5px;right:auto;bottom:auto;left:50%;width:max-content;max-width:calc(100% - 108px);padding:3px 8px;transform:translateX(-50%);border:1px solid var(--line);border-radius:999px;background:var(--surface);text-align:center;pointer-events:none}
.chat-composer.has-files textarea{padding-top:24px}
@media(max-width:900px){
  .internal-chat-body,.internal-chat-body:has(.chat-info:not([hidden])){grid-template-columns:1fr}
  .chat-messages{padding:14px 10px calc(76px + var(--bms-safe-area-bottom))}
  .chat-message>.chat-message-stack{max-width:80%}
  .chat-info{position:absolute;inset:0;width:100%;border-left:0;box-shadow:none}
}
.approval-sheet{overflow:visible}.approval-sheet-body{position:relative;z-index:0;grid-template-columns:repeat(4,minmax(0,1fr));gap:0}.approval-sheet-body .approval-section{grid-row:auto;min-width:0;padding:18px;border-right:1px solid #e1eaf4;border-bottom:0}.approval-sheet-body .approval-section:last-child{border-right:0}.approval-sheet-body .approval-summary{margin-top:12px}.approval-sheet-body .approval-summary>div{display:grid;grid-template-columns:1fr;gap:3px;align-content:start}.approval-sheet-body .approval-summary strong{max-width:none;text-align:left;overflow-wrap:anywhere}.approval-sheet-footer{justify-content:flex-end}.approval-sheet-footer p{margin-right:auto}.approval-sheet-footer .approval-actions{margin-left:auto}
.approval-sheet-body .approval-section{position:relative;isolation:isolate;border:1px solid #d6e4f5!important;border-radius:12px;background:linear-gradient(145deg,#fff,#f8fbff);box-shadow:inset 0 1px 0 rgba(255,255,255,.94),0 3px 10px rgba(21,89,172,.06);transition:transform .22s ease,box-shadow .22s ease,background-color .22s ease}.approval-sheet-body .approval-section h3{display:inline-flex;align-items:center;min-height:31px;margin:-3px 0 0;padding:5px 9px;border-radius:7px;background:linear-gradient(135deg,#e9f2ff,#f7fbff);color:#0b4e9b}.approval-cost-breakdown{display:grid;gap:0}.approval-cost-breakdown>div{display:flex!important;grid-template-columns:none!important;align-items:flex-start;justify-content:space-between;gap:10px;padding:7px 0;border-bottom:1px solid #dce7f2}.approval-cost-breakdown>div strong{text-align:right}.approval-cost-breakdown .approval-cost-total{margin-top:2px;padding-top:10px;border-bottom:0;border-top:2px solid #b9d0ed;font-size:15px}.approval-cost-breakdown p{margin:0;padding:7px 0 9px;color:var(--muted);font-size:12px;line-height:1.45}.approval-cost-breakdown .approval-product-line{display:grid!important;grid-template-columns:1fr!important;gap:3px;padding-top:8px;border-top:1px solid #dce7f2;border-bottom:0}.approval-cost-breakdown .approval-product-line strong{font-size:12px;line-height:1.45;text-align:left}
@media (hover:hover){.approval-sheet-body .approval-section:hover{z-index:20;transform:translateY(-6px) scale(1.015);border-color:#9bbfea!important;background:linear-gradient(145deg,#f4f9ff,#fff);box-shadow:0 16px 30px rgba(21,89,172,.16)}.approval-sheet-body .approval-section:hover h3{background:linear-gradient(135deg,#dbeaff,#edf7ff);color:#07458a}}
@media (max-width:1200px){.approval-sheet-body{grid-template-columns:repeat(2,minmax(0,1fr))}.approval-sheet-body .approval-section:nth-child(2){border-right:0}.approval-sheet-body .approval-section:nth-child(-n+2){border-bottom:1px solid #e1eaf4}}
@media (max-width:700px){.approval-sheet-body{grid-template-columns:1fr}.approval-sheet-body .approval-section,.approval-sheet-body .approval-section:nth-child(2){border-right:0;border-bottom:1px solid #e1eaf4}.approval-sheet-body .approval-section:last-child{border-bottom:0}.approval-sheet-footer{align-items:stretch;flex-direction:column}.approval-sheet-footer p{margin-right:0}.approval-sheet-footer .approval-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;margin-left:0}}
.solution-approval-panel{min-width:0}
.solution-top-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:stretch;gap:14px;margin-bottom:14px}

.solution-area{margin:16px 0 8px}
.solution-area-title{display:flex;align-items:center;gap:8px;margin-bottom:12px}.solution-area-title span{font-size:12px;color:var(--muted);font-weight:700;text-transform:uppercase;letter-spacing:.4px}.solution-area-title::after{content:"";flex:1;height:1px;background:var(--line)}
.solution-two-col{display:grid;grid-template-columns:minmax(0,38fr) minmax(0,62fr);align-items:stretch;gap:14px}
.solution-two-col>.solution-card{height:clamp(520px,68vh,680px)}
.solution-two-col .solution-discussion{grid-template-rows:auto minmax(220px,1fr) auto}
.btgv-section-divider{height:1px;margin:12px 0;background:var(--line)}
.btgv-area-title{margin-bottom:10px}
.btgv-overview-header{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:8px}
.btgv-products-heading{flex:1;margin-bottom:0}
.btgv-products-heading .eyebrow{margin-bottom:2px}
.btgv-toolbar{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap}.btgv-toolbar select{width:min(280px,100%);height:36px;border:1px solid #cbd8e6;border-radius:7px;padding:0 10px;font-size:13px;background:#fff;color:var(--ink)}
.cost-combined-complete{flex:0 0 auto;min-width:230px;min-height:38px;font-size:16px}
@media(max-width:800px){.solution-two-col{grid-template-columns:1fr}.solution-two-col .solution-discussion{grid-template-rows:auto minmax(240px,40vh) auto}}
.solution-card{min-width:0;padding:14px;border:1px solid var(--line);border-radius:12px;background:var(--surface);box-shadow:0 5px 16px rgba(15,39,70,.06)}
.solution-summary-card{display:flex;flex-direction:column}.solution-card>header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.solution-autosave-state{flex:0 0 auto;color:var(--muted);font-size:11px;font-weight:650}.solution-autosave-state:empty{display:none}.solution-autosave-state[data-state="saving"],.solution-autosave-state[data-state="dirty"]{color:#8a5b00}.solution-autosave-state[data-state="saved"]{color:#08783e}.solution-autosave-state[data-state="error"]{color:#b42318}
.solution-summary-content{min-width:0}.solution-summary-form{display:grid;gap:12px;align-content:start}.solution-summary-field{display:grid;grid-template-columns:minmax(150px,.9fr) minmax(0,1.6fr);align-items:stretch;gap:14px;min-width:0;color:var(--ink);font-size:13px;font-weight:650}.solution-summary-field>span{display:flex;align-items:center;line-height:1.4}.solution-summary-form textarea{box-sizing:border-box;width:100%;min-width:0;height:62px;min-height:62px;max-height:62px;padding:8px 12px;resize:none;overflow-y:auto;border-color:#cbd8e6;border-radius:7px;font:inherit;line-height:1.4}.solution-summary-form textarea:disabled{opacity:1;background:var(--surface-soft,#f6f9fc);cursor:default}.solution-summary-form .muted-copy{margin:0;padding-top:2px;font-size:12px}.solution-summary-card{justify-content:flex-start}
.solution-summary-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:2px}.solution-summary-metrics label{display:grid;gap:6px;min-width:0;padding:10px;border:1px solid #d7e3ef;border-radius:9px;background:var(--surface-soft,#f6f9fc)}.solution-summary-metrics span{color:var(--ink);font-size:12px;font-weight:650;line-height:1.35}.solution-summary-metrics .btgv-input{box-sizing:border-box;width:100%;height:36px;border:1px solid #cbd8e6;border-radius:7px;padding:0 10px;background:var(--surface);color:var(--ink);font-size:13px}
.solution-metric-input{display:grid!important;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:7px}.solution-metric-input em{color:var(--muted);font-size:12px;font-style:normal;font-weight:600;white-space:nowrap}
@media (max-width:720px){.solution-summary-form{gap:14px}.solution-summary-field{grid-template-columns:1fr;gap:6px}.solution-summary-field>span{align-items:flex-start}.solution-summary-form textarea{height:62px;min-height:62px;max-height:62px}.solution-summary-metrics{grid-template-columns:1fr}.btgv-overview-header{align-items:stretch;flex-direction:column}.btgv-toolbar{display:grid;grid-template-columns:1fr;width:100%}.btgv-toolbar select{width:100%}.cost-combined-complete{width:100%;min-width:0}}
.solution-card h3{margin:0 0 10px;color:var(--ink-strong);font-size:16px;font-weight:700;line-height:1.3}.solution-card>header h3{margin:0}
.solution-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.solution-facts div,.solution-description{min-width:0;padding:8px;border-radius:8px;background:var(--surface-soft,#f6f9fc)}
.solution-facts span,.solution-facts strong{display:block}.solution-facts span{margin-bottom:4px;color:var(--muted);font-size:12px}.solution-facts strong{overflow-wrap:anywhere}
.solution-description{grid-column:1/-1}.solution-description strong{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;white-space:pre-wrap}.solution-description.expanded strong{-webkit-line-clamp:unset}.link-button{align-self:flex-start;margin:8px 0 0;padding:0;border:0;background:transparent;color:var(--brand);font:inherit;font-weight:650;cursor:pointer}
.solution-history{max-height:190px;margin-top:10px;overflow-y:auto}.solution-history article{padding:9px 0;border-top:1px solid var(--line)}.solution-history small{display:block;color:var(--muted)}.solution-history p{margin:4px 0 0;overflow-wrap:anywhere}.solution-decision-notice{margin:12px 0 8px;font-weight:700;color:#27466f}.solution-decision-buttons{display:flex;flex-wrap:wrap;gap:8px}
.solution-discussion{display:grid;grid-template-rows:auto minmax(260px,46vh) auto;min-height:0}
.solution-messages{min-height:0;padding:12px;overflow-y:auto;border:1px solid var(--line);border-radius:10px;background:#f7fbff}
.solution-message{width:min(72%,680px);margin:0 0 12px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface);overflow-wrap:anywhere}
.solution-message.mine{margin-left:auto;background:var(--brand-soft)}.solution-message header{display:flex;justify-content:space-between;gap:12px;font-size:12px}.solution-message p{white-space:pre-wrap}.solution-system-event{margin:10px auto;padding:7px 12px;width:max-content;max-width:90%;border-radius:20px;background:#e9eef5;color:var(--muted);text-align:center}
.solution-message.recalled{color:var(--muted);font-style:italic}.solution-message-reply{margin:7px 0;padding:6px 8px;border-left:3px solid var(--brand);border-radius:5px;background:rgba(255,255,255,.55);font-size:12px}.solution-message-reply strong,.solution-message-reply span{display:block}.solution-message-reply span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.solution-message-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:7px}.solution-message-actions button{padding:0;border:0;background:transparent;color:var(--brand);font:inherit;font-size:12px;font-weight:650;cursor:pointer}.solution-reply-preview{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:6px 8px;border-left:3px solid var(--brand);border-radius:6px;background:var(--brand-soft)}.solution-reply-preview span{min-width:0}.solution-reply-preview strong,.solution-reply-preview small{display:block}.solution-reply-preview small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}.solution-reply-preview button{border:0;background:transparent;font-size:20px;line-height:1;cursor:pointer}
.solution-attachment{display:flex;align-items:center;justify-content:space-between;gap:8px;max-width:100%;margin-top:6px;padding:8px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--brand);overflow-wrap:anywhere}.solution-attachment span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.solution-attachment button{border:0;background:transparent;color:var(--brand);font-weight:650;cursor:pointer}.solution-image-thumb{display:block;max-width:220px;margin-top:8px;padding:4px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--brand);cursor:pointer}.solution-image-thumb img{display:block;width:100%;height:130px;border-radius:6px;object-fit:cover;background:#edf2f7}.solution-image-thumb span{display:block;max-width:100%;padding:5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}
.solution-composer{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:end;gap:8px;margin-top:12px;padding:8px;border:1px solid var(--line);border-radius:12px;background:var(--surface-soft,#f6f9fc)}.solution-composer textarea{min-height:38px;max-height:120px;margin:0;border:0;background:transparent;resize:none;overflow-y:auto}.solution-composer textarea:focus{outline:2px solid var(--brand-soft)}.solution-attach-button{display:grid;place-items:center;width:38px;height:38px;border-radius:8px;color:var(--brand);font-size:20px;cursor:pointer}.solution-attach-button:hover{background:var(--brand-soft)}.solution-file-previews{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:6px}.solution-file-previews:empty{display:none}.solution-file-previews article{display:flex;align-items:center;gap:5px;max-width:100%;padding:5px 8px;border:1px solid var(--line);border-radius:999px;background:var(--surface)}.solution-file-previews strong{max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.solution-file-previews small{color:var(--muted)}.solution-file-previews button{border:0;background:transparent;color:var(--muted);font-size:18px;cursor:pointer}
.solution-participant-dialog{width:min(94vw,580px);border:0;border-radius:14px;padding:18px;box-shadow:0 18px 50px rgba(0,0,0,.24)}.solution-participant-dialog::backdrop{background:rgba(15,29,46,.45)}.solution-dialog-header{display:flex;align-items:center;justify-content:space-between;margin:0 0 12px}.solution-dialog-header h3{margin:0}.solution-dialog-header button{border:0;background:transparent;font-size:25px;cursor:pointer}.solution-participant-dialog>input{width:100%;box-sizing:border-box}.solution-participant-candidates{max-height:min(45vh,380px);margin:10px 0;overflow:auto;border:1px solid var(--line);border-radius:9px}.solution-participant-option{display:grid;grid-template-columns:auto 34px minmax(0,1fr) auto;align-items:center;gap:8px;padding:9px;border-bottom:1px solid var(--line);cursor:pointer}.solution-participant-option:last-child{border-bottom:0}.solution-participant-option.existing{opacity:.65}.solution-participant-option strong,.solution-participant-option small{display:block}.solution-participant-option small{color:var(--muted)}.solution-participant-option em{font-size:12px;color:var(--muted)}.solution-avatar{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--brand-soft);color:var(--brand);font-weight:700}
.solution-participant-list{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}.solution-participant-chip{display:inline-flex;align-items:center;gap:4px;padding:3px 7px;border-radius:999px;background:var(--brand-soft);font-size:12px}.solution-participant-chip button{border:0;background:transparent;color:var(--danger,#b42318);font-size:16px;line-height:1;cursor:pointer}.solution-viewer-notice{margin:10px 0 0;padding:9px 11px;border-radius:8px;background:#fff7e6;color:#8a5b00}
.solution-lightbox{width:min(94vw,1100px);height:min(92vh,800px);padding:44px 14px 14px;border:0;border-radius:12px;background:#101820}.solution-lightbox::backdrop{background:rgba(0,0,0,.72)}.solution-lightbox img{width:100%;height:100%;object-fit:contain}.solution-lightbox button{position:absolute;top:8px;right:10px;width:36px;height:36px;border:0;border-radius:50%;font-size:24px;cursor:pointer}
@media(max-width:800px){.solution-top-grid{grid-template-columns:1fr}.solution-two-col>.solution-card{height:auto;max-height:none}.solution-facts{grid-template-columns:1fr}.solution-card{padding:12px}.solution-discussion{grid-template-rows:auto minmax(240px,50vh) auto}.solution-message{width:88%}.solution-composer{grid-template-columns:auto minmax(0,1fr) auto}.solution-send-label{display:none}.solution-composer .btn{min-width:38px;padding-inline:10px}.solution-file-previews{max-height:82px;overflow:auto}.solution-participant-dialog{padding:14px}.solution-participant-option{grid-template-columns:auto 32px minmax(0,1fr)}}
.cost-placeholder-row {
  background: #f8fafc;
  opacity: .58;
}

.cost-placeholder-row:focus-within,
.cost-placeholder-row:hover {
  opacity: .82;
}

.cost-quantity-control {
  position: relative;
  min-width: 86px;
}

.cost-quantity-control.is-percent .cost-input {
  padding-right: 30px;
}

.cost-quantity-control.is-percent > span {
  position: absolute;
  top: 50%;
  right: 11px;
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
  transform: translateY(-50%);
}

.percent-reference-hint {
  position: fixed;
  z-index: 10000;
  max-width: min(340px, calc(100vw - 24px));
  padding: 8px 11px;
  border: 1px solid #b9d0ed;
  border-radius: 8px;
  background: #102f55;
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 39, 70, .22);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
}

.pwa-offline-banner{position:fixed;z-index:10000;inset:0 0 auto;padding:max(8px,var(--bms-safe-area-top)) 16px 8px;background:var(--red);color:var(--bms-frame-text);text-align:center;font-weight:700}.business-cache-readonly-banner{inset:44px 0 auto;background:var(--bms-warning)}.pwa-settings-card{grid-column:1/-1}.pwa-actions{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}.pwa-message{min-height:1.4em;color:var(--muted)}.pwa-message.error{color:var(--red)}.pwa-settings-card details{margin-top:8px}.app-shell{padding-bottom:var(--bms-safe-area-bottom)}@media(max-width:900px){body{padding-left:var(--bms-safe-area-left);padding-right:var(--bms-safe-area-right)}.topbar{padding-top:max(12px,var(--bms-safe-area-top))}.pwa-actions .btn{flex:1 1 210px}}
.native-permission-prompt{position:fixed;z-index:2147483640;left:max(16px,var(--bms-safe-area-left));right:max(16px,var(--bms-safe-area-right));bottom:max(16px,var(--bms-safe-area-bottom));max-width:520px;margin:auto;padding:18px;border:1px solid color-mix(in srgb,var(--brand) 35%,transparent);border-radius:16px;background:var(--surface);color:var(--text);box-shadow:var(--bms-shadow-overlay)}.native-permission-prompt p{margin:8px 0 14px;color:var(--muted)}.native-permission-prompt div{display:flex;justify-content:flex-end;gap:8px}body:has(.native-permission-prompt) .floating-actions-container{visibility:hidden;pointer-events:none}

.qc-history-detail-actions{display:flex;align-items:center;justify-content:space-between;gap:12px}
@media(max-width:700px){.qc-history-detail-actions{align-items:stretch;flex-direction:column}.qc-history-detail-actions .btn{width:100%}}
/* BMS Desktop thin-client integration */
.desktop-web-update{position:fixed;right:24px;bottom:24px;z-index:1600;display:flex;align-items:center;gap:18px;max-width:min(560px,calc(100vw - 48px));padding:14px 16px;border:1px solid color-mix(in srgb,var(--bms-warning) 45%,transparent);border-radius:14px;background:var(--bms-warning-soft);color:var(--bms-text);box-shadow:var(--bms-shadow-2)}
.desktop-web-update[hidden]{display:none}.desktop-web-update div{display:grid;gap:3px}.desktop-web-update span{font-size:.82rem;color:var(--bms-text-muted)}
#desktopDiagnosticsHost:not(:empty){border-top:1px solid var(--bms-border)}.desktop-diagnostics-card{display:grid;grid-template-columns:minmax(210px,.8fr) minmax(360px,1.35fr) minmax(250px,1fr);align-items:center;gap:18px;padding:18px 22px;background:color-mix(in srgb,var(--surface-soft) 58%,transparent)}.desktop-diagnostics-identity h4{margin:2px 0 5px;color:var(--ink-strong);font-size:16px}.desktop-diagnostics-identity>p:last-child{margin:0;color:var(--muted);font-size:12px}.desktop-diagnostics-card dl{display:grid;grid-template-columns:repeat(3,minmax(100px,1fr));gap:8px;margin:0}.desktop-diagnostics-card dl div{min-width:0;padding:9px 10px;border:1px solid var(--bms-border);border-radius:10px;background:var(--surface)}.desktop-diagnostics-card dt{font-size:.7rem;color:var(--bms-text-muted)}.desktop-diagnostics-card dd{margin:4px 0 0;font-size:.82rem;font-weight:700;white-space:nowrap}.desktop-diagnostics-card dd::before{content:"";display:inline-block;width:7px;height:7px;margin-right:6px;border-radius:50%;background:var(--muted)}.desktop-diagnostics-card dd[data-state="ready"]::before{background:var(--green)}.desktop-diagnostics-card dd[data-state="off"]::before{background:var(--red)}.desktop-diagnostics-controls{min-width:0}.desktop-diagnostics-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}.desktop-diagnostics-card [data-desktop-message]{min-height:1.3em;margin:8px 0 0;color:var(--bms-text-muted);font-size:12px;text-align:right}
@media(max-width:1100px){.desktop-diagnostics-card{grid-template-columns:1fr 1.45fr}.desktop-diagnostics-controls{grid-column:1/-1}.desktop-diagnostics-actions{justify-content:flex-start}.desktop-diagnostics-card [data-desktop-message]{text-align:left}}
@media(max-width:700px){.desktop-diagnostics-card{grid-template-columns:1fr;padding:16px}.desktop-diagnostics-card dl{grid-template-columns:1fr}.desktop-diagnostics-controls{grid-column:auto}.desktop-diagnostics-actions .btn{width:100%;max-width:none}}
.document-data-type{display:inline-flex;max-width:170px;align-items:center;border-radius:999px;padding:4px 8px;font-size:10px;font-weight:700;line-height:1.25}.document-data-type.digital{background:var(--bms-neutral-soft);color:var(--bms-neutral)}.document-data-type.generated{background:var(--bms-info-soft);color:var(--bms-info)}.document-data-type.upload{background:var(--bms-warning-soft);color:var(--bms-warning)}.document-detail-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;flex-wrap:wrap}.doc-actions{display:flex;gap:5px;flex-wrap:wrap}.workflow-auto-note{color:var(--bms-text-muted);font-size:12px}
.warehouse-card .warehouse-toolbar-fields{margin-left:auto}.warehouse-card .warehouse-toolbar-fields>label{display:grid;gap:5px;color:var(--muted);font-size:11px;font-weight:700;text-transform:uppercase}.warehouse-date-filter input,.warehouse-card .inventory-search input{box-sizing:border-box;width:220px;min-width:220px;height:38px;min-height:38px;padding:7px 9px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink)}
@media(max-width:700px){.warehouse-card .warehouse-toolbar-fields{margin-left:0}.warehouse-date-filter,.warehouse-date-filter input,.warehouse-card .inventory-search,.warehouse-card .inventory-search input{width:100%;min-width:0}}

.xop-order-editor{grid-column:1/-1;margin-top:16px;padding:18px;border:1px solid var(--line);border-radius:14px;background:var(--surface)}
.xop-order-editor>header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:14px}.xop-order-editor h3,.xop-order-editor p{margin:0}.xop-order-editor header p:last-child{margin-top:5px;color:var(--muted);font-size:12px}.xop-order-lines{width:100%;min-width:900px;table-layout:fixed}.xop-order-lines th:nth-child(1){width:88px}.xop-order-lines th:nth-child(2){width:210px}.xop-order-lines th:nth-child(3){width:142px}.xop-order-lines th:nth-child(4){width:125px}.xop-order-lines th:nth-child(5),.xop-order-lines th:nth-child(6),.xop-order-lines th:nth-child(7){width:112px}.xop-order-lines th:nth-child(8){width:70px}.xop-order-lines input,.xop-order-lines select{box-sizing:border-box;width:100%;min-width:0;padding:7px 8px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink)}.xop-order-lines .xop-line-name{min-width:0}.xop-order-pricing-summary{display:flex;justify-content:flex-end;gap:20px;margin-top:12px;color:var(--muted)}.xop-order-pricing-summary strong{color:var(--ink)}.xop-vat-option{align-content:end}.xop-vat-option input{width:22px;height:22px}
body[data-business-profile="XOP_ME_LINH"] .xop-order-derived-field{display:none!important}
@media(max-width:700px){.xop-order-editor>header{flex-direction:column}.xop-order-editor>header .toolbar{width:100%}.xop-order-editor>header .btn{flex:1}.xop-order-pricing-summary{align-items:flex-end;flex-direction:column;gap:4px}}

progress.production-progress{display:block;width:90px;height:7px;border:0;border-radius:99px;background:var(--bms-border);overflow:hidden;appearance:none}
progress.production-progress::-webkit-progress-bar{background:var(--bms-border)}
progress.production-progress::-webkit-progress-value{background:var(--bms-primary)}
progress.production-progress::-moz-progress-bar{background:var(--bms-primary)}
