/* Qdatacenter quoting SPA — vanilla, no framework. */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1c2733;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f4c81;
  --brand-2: #1273b8;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
  --chip: #eef2f7;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.right { text-align: right; }
.center { text-align: center; }
a, .linklike { color: var(--brand-2); cursor: pointer; text-decoration: none; background: none; border: 0; padding: 0; font: inherit; }
a:hover, .linklike:hover { text-decoration: underline; }
code { font-family: var(--mono); background: var(--chip); padding: 1px 4px; border-radius: 4px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: #0d2438; color: #dce8f4;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; font-weight: 700; font-size: 15px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 0; }
.nav-item {
  display: block; width: 100%; text-align: left; background: none; border: 0; color: #c6d6e6;
  padding: 9px 16px; font: inherit; cursor: pointer; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,.10); border-left-color: var(--brand-2); color: #fff; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; }
.sidebar-foot .linklike { color: #9fc0dd; display: block; margin-top: 6px; }
.main { flex: 1; min-width: 0; padding: 22px 28px 60px; }
.view-title { display: flex; align-items: baseline; gap: 12px; margin: 0 0 16px; flex-wrap: wrap; }
.view-title h1 { font-size: 20px; margin: 0; }
.view-title .spacer { flex: 1; }

.login-logo {
  width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.login-logo.small { width: 26px; height: 26px; font-size: 11px; border-radius: 6px; }

/* ---------- login ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, #0d2438 0%, #123a5c 55%, #155a8a 100%); }
.login-card {
  width: 100%; max-width: 420px; background: var(--panel); border-radius: 12px; padding: 28px;
  box-shadow: 0 18px 50px rgba(3, 20, 38, .45);
}
.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand .login-logo { margin: 0 auto 10px; width: 46px; height: 46px; font-size: 17px; }
.login-brand h1 { margin: 0; font-size: 20px; }
.login-brand p { margin: 4px 0 0; font-size: 12.5px; }
.login-alt { margin-top: 14px; text-align: center; }

/* ---------- forms ---------- */
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(18,115,184,.35); border-color: var(--brand-2); }
input[type="checkbox"] { width: auto; display: inline-block; margin: 0 6px 0 0; vertical-align: -2px; }
label.inline { display: inline-flex; align-items: center; color: var(--ink); margin-right: 14px; }
label.inline input, label.inline select { width: auto; margin: 0 0 0 4px; display: inline-block; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px 4px; margin: 0 0 16px; background: #fff; }
.fieldset legend { padding: 0 8px; font-size: 13px; font-weight: 600; color: var(--brand); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: #f1f5f9; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-danger { background: #fff; border-color: #f0caca; color: var(--err); }
.btn-danger:hover { background: #fdf2f2; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; font-weight: 500; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- panels / tables ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 10px; font-size: 15px; }
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover { background: #f6f9fc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--chip); }
.badge-draft { background: #e8edf3; color: #3f4f61; }
.badge-sent { background: #e0ecff; color: #1d4f91; }
.badge-accepted { background: #dcf3e4; color: var(--ok); }
.badge-rejected { background: #fdeaea; color: var(--err); }
.badge-expired { background: #fdf0dd; color: var(--warn); }
.badge-deleted { background: #e5e5e5; color: #555; text-decoration: line-through; }
.badge-pub { background: #dcf3e4; color: var(--ok); }
.badge-draft-b { background: #fdeaea; color: var(--err); }
.badge-role-admin { background: #1d2c3b; color: #fff; }
.badge-role-sales_manager { background: #e0ecff; color: #1d4f91; }
.badge-role-partner { background: #dcf3e4; color: var(--ok); }
.badge-role-end_user { background: #e8edf3; color: #3f4f61; }

/* ---------- alerts / toast / modal ---------- */
.alert { border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 13.5px; }
.alert-err { background: #fdeaea; color: var(--err); border: 1px solid #f3c8c8; }
.alert-warn { background: #fdf6e7; color: var(--warn); border: 1px solid #f0dfb8; }
.alert-ok { background: #e9f7ee; color: var(--ok); border: 1px solid #bfe5cd; }
.must-change { background: #fdf6e7; border: 1px solid #f0dfb8; color: var(--warn); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
#toast-root { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #10222f; color: #eaf2f9; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 13.5px; max-width: 420px; }
.toast.err { background: #7f1d1d; }
.toast.ok { background: #14532d; }
.modal-root { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8,20,32,.5); }
.modal { position: relative; background: #fff; border-radius: 12px; padding: 20px 22px; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h2 { margin-top: 0; font-size: 16px; }
.code-box { background: #0d2438; color: #cde3f5; font-family: var(--mono); font-size: 12px; padding: 10px 12px; border-radius: 8px; word-break: break-all; margin: 8px 0; }
.code-box.codes { line-height: 1.9; }

/* ---------- quote detail ---------- */
.qhead { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 6px; }
.qhead dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.qhead dd { margin: 2px 0 8px; font-weight: 600; }
.qactions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.totals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 8px; }
.totals-grid .cell { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.totals-grid .cell .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.totals-grid .cell .v { font-size: 17px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.totals-grid .cell.grand { background: #eef5fb; border-color: #cfe0f0; }

/* ---------- wizard ---------- */
.wiz-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.wiz-step { padding: 6px 12px; border-radius: 999px; background: var(--chip); color: var(--muted); font-weight: 600; font-size: 12.5px; }
.wiz-step.active { background: var(--brand); color: #fff; }
.wiz-step.done { background: #dcf3e4; color: var(--ok); }
.wiz-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .9fr); gap: 18px; align-items: start; }
@media (max-width: 980px) { .wiz-body { grid-template-columns: 1fr; } }
.preview-box { position: sticky; top: 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.warnings { list-style: none; padding: 0; margin: 10px 0 0; }
.warnings li { font-size: 12.5px; color: var(--warn); background: #fdf6e7; border-radius: 6px; padding: 6px 10px; margin-bottom: 6px; }

/* ---------- misc ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; margin: 0; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { background: none; border: 0; padding: 8px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.pct { font-variant-numeric: tabular-nums; }
details { margin: 8px 0; }
summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #cbd5e1; border-top-color: var(--brand-2); border-radius: 50%; animation: sp 1s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
