/* =====================================================================
   QuoteTrack — black & signal-yellow CRM
   Display: Chakra Petch · Body: Barlow
   ===================================================================== */

/* ---------- Tokens ---------- */
:root,
[data-bs-theme="dark"] {
  --qt-bg: #0E0E0B;
  --qt-surface: #171713;
  --qt-surface-2: #212019;
  --qt-line: #2E2D25;
  --qt-ink: #F2EFE4;
  --qt-ink-2: #A9A595;
  --qt-ink-3: #75725F;
  --qt-y: #FFC21A;
  --qt-y-hover: #FFD04D;
  --qt-y-deep: #B88600;
  --qt-y-ink: #191300;
  --qt-y-soft: rgba(255, 194, 26, .13);
  --qt-y-text: #FFC21A;
  --qt-green: #3DD68C;
  --qt-green-soft: rgba(61, 214, 140, .13);
  --qt-red: #FF5D55;
  --qt-red-soft: rgba(255, 93, 85, .13);
  --qt-blue: #7AB8FF;
  --qt-blue-soft: rgba(122, 184, 255, .13);
  --qt-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --qt-glass: rgba(14, 14, 11, .86);

  --bs-body-bg: var(--qt-bg);
  --bs-body-color: var(--qt-ink);
  --bs-emphasis-color: var(--qt-ink);
  --bs-secondary-color: var(--qt-ink-2);
  --bs-tertiary-color: var(--qt-ink-3);
  --bs-secondary-bg: var(--qt-surface-2);
  --bs-tertiary-bg: var(--qt-surface-2);
  --bs-border-color: var(--qt-line);
  --bs-link-color: var(--qt-y-text);
  --bs-link-hover-color: var(--qt-y-hover);
  --bs-link-color-rgb: 255, 194, 26;
  --bs-link-hover-color-rgb: 255, 208, 77;
  --bs-heading-color: var(--qt-ink);
  --bs-focus-ring-color: rgba(255, 194, 26, .35);
  --bs-form-valid-color: var(--qt-green);
  --bs-form-invalid-color: var(--qt-red);
  --bs-form-invalid-border-color: var(--qt-red);
  color-scheme: dark;
}

[data-bs-theme="light"] {
  --qt-bg: #F3F2EC;
  --qt-surface: #FFFFFF;
  --qt-surface-2: #F1EFE7;
  --qt-line: #E1DED3;
  --qt-ink: #16150F;
  --qt-ink-2: #5F5C50;
  --qt-ink-3: #8E8A7B;
  --qt-y: #FFC21A;
  --qt-y-hover: #FFB800;
  --qt-y-deep: #9A6F00;
  --qt-y-ink: #191300;
  --qt-y-soft: rgba(255, 194, 26, .24);
  --qt-y-text: #8A6300;
  --qt-green: #10915A;
  --qt-green-soft: rgba(16, 145, 90, .12);
  --qt-red: #D93A31;
  --qt-red-soft: rgba(217, 58, 49, .1);
  --qt-blue: #2563B8;
  --qt-blue-soft: rgba(37, 99, 184, .1);
  --qt-shadow: 0 10px 30px rgba(22, 21, 15, .12);
  --qt-glass: rgba(243, 242, 236, .88);
  --bs-link-color-rgb: 138, 99, 0;
  --bs-link-hover-color-rgb: 90, 65, 0;
  color-scheme: light;
}

/* ---------- Base ---------- */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body {
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--qt-bg);
  color: var(--qt-ink);
  min-height: 100vh;
}
h1, h2, h3, h4, h5, h6, .font-display {
  font-family: "Chakra Petch", "Barlow", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -.005em;
}
.num, .tabular { font-variant-numeric: tabular-nums; }
a { text-underline-offset: 2px; }
::selection { background: var(--qt-y); color: var(--qt-y-ink); }
.req { color: var(--qt-y-text); }
.skip-link { position: absolute; z-index: 2000; left: 12px; top: 12px; background: var(--qt-y); color: var(--qt-y-ink); padding: 6px 12px; }
:focus-visible { outline: 2px solid var(--qt-y); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn { font-weight: 500; border-radius: 8px; }
.btn-primary {
  --bs-btn-bg: var(--qt-y); --bs-btn-border-color: var(--qt-y); --bs-btn-color: var(--qt-y-ink);
  --bs-btn-hover-bg: var(--qt-y-hover); --bs-btn-hover-border-color: var(--qt-y-hover); --bs-btn-hover-color: var(--qt-y-ink);
  --bs-btn-active-bg: var(--qt-y-hover); --bs-btn-active-border-color: var(--qt-y-hover); --bs-btn-active-color: var(--qt-y-ink);
  --bs-btn-disabled-bg: var(--qt-y); --bs-btn-disabled-border-color: var(--qt-y); --bs-btn-disabled-color: var(--qt-y-ink);
  --bs-btn-focus-shadow-rgb: 255, 194, 26;
  font-weight: 600;
}
.btn-outline-secondary {
  --bs-btn-color: var(--qt-ink); --bs-btn-border-color: var(--qt-line); --bs-btn-bg: var(--qt-surface);
  --bs-btn-hover-bg: var(--qt-surface-2); --bs-btn-hover-color: var(--qt-ink); --bs-btn-hover-border-color: var(--qt-ink-3);
  --bs-btn-active-bg: var(--qt-surface-2); --bs-btn-active-color: var(--qt-ink); --bs-btn-active-border-color: var(--qt-ink-3);
}
.btn-danger { --bs-btn-bg: var(--qt-red); --bs-btn-border-color: var(--qt-red); --bs-btn-hover-bg: var(--qt-red); --bs-btn-hover-border-color: var(--qt-red); }
.btn-chamfer {
  border-radius: 0;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}
.btn-chamfer:focus-visible { outline: 2px solid var(--qt-y-ink); outline-offset: -5px; box-shadow: none; }
.btn-icon {
  width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center;
  border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--qt-ink-2);
}
.btn-icon:hover { background: var(--qt-surface-2); color: var(--qt-ink); }
.btn-icon i { font-size: 17px; }

/* ---------- Forms ---------- */
.form-label { font-size: 12.5px; font-weight: 500; color: var(--qt-ink-2); margin-bottom: 4px; }
.form-control, .form-select {
  background-color: var(--qt-surface-2); border-color: var(--qt-line); color: var(--qt-ink); border-radius: 8px;
}
.form-control::placeholder { color: var(--qt-ink-3); }
.form-control:focus, .form-select:focus {
  background-color: var(--qt-surface-2); color: var(--qt-ink); border-color: var(--qt-y);
  box-shadow: 0 0 0 .2rem var(--qt-y-soft);
}
.form-check-input:checked { background-color: var(--qt-y); border-color: var(--qt-y); }
.form-check-input:focus { border-color: var(--qt-y); box-shadow: 0 0 0 .2rem var(--qt-y-soft); }
[data-bs-theme="dark"] .form-check-input:checked[type="checkbox"] { --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23191300' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e"); }
.form-switch .form-check-input:checked { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23191300'/%3e%3c/svg%3e"); }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator { opacity: .7; cursor: pointer; }
[data-bs-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.85); }
.invalid-feedback { font-size: 12px; }
.group-invalid { box-shadow: 0 0 0 1px var(--qt-red); border-radius: 10px; }

/* Segmented status picker */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; background: var(--qt-surface-2); border: 1px solid var(--qt-line); border-radius: 10px; }
.seg-btn { margin: 0; text-align: center; padding: 7px 4px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--qt-ink-2); user-select: none; }
.seg-btn:hover { color: var(--qt-ink); }
.btn-check:checked + .seg-btn.sg-followup { background: var(--qt-y); color: var(--qt-y-ink); }
.btn-check:checked + .seg-btn.sg-approved { background: var(--qt-green); color: #06200F; }
.btn-check:checked + .seg-btn.sg-rejected { background: var(--qt-red); color: #fff; }
.btn-check:focus-visible + .seg-btn, .btn-check:focus-visible + .chip { outline: 2px solid var(--qt-y); outline-offset: 1px; }

/* Chip pickers */
.chip-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  margin: 0; display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; cursor: pointer; user-select: none;
  border: 1px solid var(--qt-line); border-radius: 999px; background: var(--qt-surface-2); color: var(--qt-ink-2); font-size: 13px; font-weight: 500;
}
.chip:hover { color: var(--qt-ink); }
.btn-check:checked + .chip { border-color: var(--qt-y); background: var(--qt-y-soft); color: var(--qt-ink); }

/* ---------- Brand ---------- */
.brand-mark {
  flex: 0 0 auto; width: 36px; height: 36px; display: inline-grid; place-items: center;
  background: var(--qt-y); color: var(--qt-y-ink);
  font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 15px; letter-spacing: .02em;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.brand-mark.sm { width: 30px; height: 30px; font-size: 13px; }
.brand-mark.lg { width: 52px; height: 52px; font-size: 21px; }
.brand-logo { height: 36px; width: auto; max-width: 132px; object-fit: contain; flex: 0 0 auto; }
.brand-logo.sm { height: 28px; max-width: 96px; }
.brand-logo.lg { height: 52px; max-width: 180px; }

/* ---------- Desktop shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 236px; z-index: 1035;
  flex-direction: column; gap: 14px; padding: 16px 12px;
  background: var(--qt-surface); border-right: 1px solid var(--qt-line);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 14px; border-bottom: 1px solid var(--qt-line); color: var(--qt-ink); text-decoration: none; min-width: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: "Chakra Petch", sans-serif; font-weight: 600; font-size: 14.5px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-app { font-size: 12px; color: var(--qt-ink-3); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--qt-ink-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.side-link i { font-size: 17px; width: 18px; text-align: center; }
.side-link:hover { background: var(--qt-surface-2); color: var(--qt-ink); }
.side-link.active { background: var(--qt-y-soft); color: var(--qt-ink); box-shadow: inset 3px 0 0 var(--qt-y); }
.side-link.active i { color: var(--qt-y-text); }
.side-new { width: 100%; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-top: 12px; border-top: 1px solid var(--qt-line); }
.side-user-link { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--qt-ink); text-decoration: none; }
.side-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.side-user-text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 108px; }
.side-user-text small { color: var(--qt-ink-3); }
.avatar {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--qt-surface-2); border: 1px solid var(--qt-line); color: var(--qt-y-text);
  font-family: "Chakra Petch", sans-serif; font-weight: 700; text-decoration: none;
}
.avatar-sm { width: 30px; height: 30px; font-size: 13px; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 1020; height: 60px; padding: 0 24px;
  align-items: center; justify-content: space-between;
  background: var(--qt-glass); backdrop-filter: saturate(140%) blur(12px); -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--qt-line);
}
.page-title { font-size: 19px; margin: 0; }
.content { padding: 16px 24px 48px; max-width: 1440px; }
@media (min-width: 992px) { .app-shell { margin-left: 236px; } }

/* ---------- Mobile shell (app-like) ---------- */
.appbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  background: var(--qt-glass); backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--qt-line); user-select: none;
}
.appbar-brand { display: flex; align-items: center; gap: 10px; color: var(--qt-ink); text-decoration: none; min-width: 0; }
.appbar-title { font-family: "Chakra Petch", sans-serif; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
  height: calc(62px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--qt-surface); border-top: 1px solid var(--qt-line); user-select: none;
}
.bn-item {
  position: relative; appearance: none; border: 0; background: none; padding: 6px 0 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--qt-ink-3); text-decoration: none; font-size: 11px; font-weight: 500;
}
.bn-item i { font-size: 21px; line-height: 1; }
.bn-item.active { color: var(--qt-ink); }
.bn-item.active i { color: var(--qt-y-text); }
.bn-item.active::before { content: ""; position: absolute; top: 0; width: 26px; height: 3px; background: var(--qt-y); }
.bn-dot { position: absolute; top: 8px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--qt-red); box-shadow: 0 0 0 2px var(--qt-surface); }
.bn-fab {
  justify-self: center; align-self: start; margin-top: -16px; width: 54px; height: 54px; border: 0;
  background: var(--qt-y); color: var(--qt-y-ink); font-size: 26px; display: grid; place-items: center;
  clip-path: polygon(13px 0, 100% 0, 100% calc(100% - 13px), calc(100% - 13px) 100%, 0 100%, 0 13px);
}
.bn-fab:active { transform: scale(.95); }

@media (max-width: 991.98px) {
  .content { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  body { overscroll-behavior-y: contain; }
}
@media (max-width: 767.98px) {
  /* iOS zooms into inputs smaller than 16px */
  .form-control, .form-select, .form-control-sm, .form-select-sm { font-size: 16px; }
}

/* ---------- Sheets & bottom-sheet modals ---------- */
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--qt-line); margin: 8px auto 0; }
.offcanvas.sheet { --bs-offcanvas-bg: var(--qt-surface); }
.offcanvas-bottom.sheet { height: auto; max-height: 88vh; border-radius: 18px 18px 0 0; border-top: 1px solid var(--qt-line); padding-bottom: env(safe-area-inset-bottom); }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.more-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px;
  background: var(--qt-surface-2); border: 1px solid var(--qt-line); border-radius: 12px;
  color: var(--qt-ink); text-decoration: none; font-size: 13px; font-weight: 500;
}
.more-tile i { font-size: 22px; color: var(--qt-y-text); }

.modal { --bs-modal-bg: var(--qt-surface); --bs-modal-border-color: var(--qt-line); --bs-modal-header-border-color: var(--qt-line); --bs-modal-footer-border-color: var(--qt-line); }
.modal-backdrop { --bs-backdrop-opacity: .6; }
@media (max-width: 767.98px) {
  .sheet-modal .modal-dialog { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; max-width: none; width: 100%; max-height: 94vh; height: auto; }
  .sheet-modal.fade .modal-dialog { transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
  .sheet-modal.show .modal-dialog { transform: none; }
  .sheet-modal .modal-content { border: 0; border-top: 1px solid var(--qt-line); border-radius: 18px 18px 0 0; max-height: 94vh; padding-bottom: env(safe-area-inset-bottom); }
  .sheet-modal .modal-header { border-bottom: 0; padding-top: 8px; }
  .sheet-modal .modal-footer { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
  .sheet-modal .modal-footer > * { margin: 0; }
}

.dropdown-menu { --bs-dropdown-bg: var(--qt-surface); --bs-dropdown-border-color: var(--qt-line); --bs-dropdown-link-hover-bg: var(--qt-surface-2); --bs-dropdown-link-active-bg: var(--qt-y); --bs-dropdown-link-active-color: var(--qt-y-ink); --bs-dropdown-font-size: 13.5px; box-shadow: var(--qt-shadow); }

/* ---------- Toasts ---------- */
.toast-pos { z-index: 2000; top: calc(env(safe-area-inset-top) + 10px); left: 50%; transform: translateX(-50%); width: min(380px, calc(100% - 24px)); }
@media (min-width: 992px) { .toast-pos { top: 72px; right: 20px; left: auto; transform: none; } }
.qt-toast { background: var(--qt-ink); color: var(--qt-bg); border: 0; border-radius: 10px; font-weight: 500; box-shadow: var(--qt-shadow); }
.qt-toast.err { background: var(--qt-red); color: #fff; }
.qt-toast .toast-body { display: flex; gap: 10px; align-items: center; }

/* ---------- Panels ---------- */
.panel { background: var(--qt-surface); border: 1px solid var(--qt-line); border-radius: 12px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--qt-line); }
.panel-title { font-family: "Chakra Petch", sans-serif; font-weight: 600; font-size: 14.5px; margin: 0; }
.panel-body { padding: 14px; }
.panel-sub { font-size: 12px; color: var(--qt-ink-3); }

/* ---------- Status & result chips ---------- */
.st { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; line-height: 1.55; white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-followup { color: var(--qt-y-text); background: var(--qt-y-soft); }
.st-approved { color: var(--qt-green); background: var(--qt-green-soft); }
.st-rejected { color: var(--qt-red); background: var(--qt-red-soft); }
.res { display: inline-block; padding: 1px 8px; border-radius: 4px; border: 1px solid var(--qt-line); color: var(--qt-ink-2); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.res-converted { color: var(--qt-green); border-color: color-mix(in srgb, var(--qt-green) 45%, transparent); }
.res-lost { color: var(--qt-red); border-color: color-mix(in srgb, var(--qt-red) 45%, transparent); }
.res-interested { color: var(--qt-blue); border-color: color-mix(in srgb, var(--qt-blue) 45%, transparent); }
.res-negotiating { color: var(--qt-y-text); border-color: color-mix(in srgb, var(--qt-y) 50%, transparent); }
.res-noresponse { border-style: dashed; }
.chip.res-converted, .chip.res-lost, .chip.res-interested, .chip.res-negotiating { border-color: var(--qt-line); }

/* ---------- Filters ---------- */
.filters { margin-bottom: 12px; }
.filter-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.filter-top:empty { display: none; }
.search-box { position: relative; flex: 1 1 auto; margin: 0; min-width: 0; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--qt-ink-3); pointer-events: none; }
.search-box .form-control { padding-left: 34px; height: 38px; }
.filter-btn { height: 38px; white-space: nowrap; }
.filter-count { background: var(--qt-y); color: var(--qt-y-ink); margin-left: 2px; }
.export-dd { margin-left: auto; }
.export-dd .btn { height: 38px; white-space: nowrap; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 8px 10px; align-items: end; }
.f-field .form-label { font-size: 11.5px; margin-bottom: 3px; }
.f-date { grid-column: span 3; }
.date-row { display: grid; grid-template-columns: minmax(128px, 1.2fr) minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; }
.date-sep { font-size: 12px; color: var(--qt-ink-3); }
.f-switch .form-check { min-height: 31px; display: flex; align-items: center; gap: 8px; margin: 0; }
.f-actions { justify-content: flex-end; align-items: end; }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; padding-top: 16px; }
@media (min-width: 992px) {
  .filter-sheet .offcanvas-body { display: block !important; padding: 10px 12px !important; background-color: var(--qt-surface) !important; border: 1px solid var(--qt-line); border-radius: 12px; }
  .filter-sheet .filter-grid { width: 100%; }
}
@media (max-width: 991.98px) {
  .filter-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .f-date { grid-column: 1 / -1; }
  .date-row { grid-template-columns: 1fr 1fr; }
  .date-row select { grid-column: 1 / -1; }
  .date-sep { display: none; }
  .f-switch { grid-column: 1 / -1; }
}

/* ---------- Segmented tabs ---------- */
.segtabs { display: flex; gap: 4px; padding: 3px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; background: var(--qt-surface); border: 1px solid var(--qt-line); border-radius: 10px; }
.segtabs::-webkit-scrollbar { display: none; }
.segtab { flex: 1 0 auto; appearance: none; border: 0; background: none; padding: 6px 12px; border-radius: 7px; color: var(--qt-ink-2); font-size: 13px; font-weight: 500; white-space: nowrap; }
.segtab:hover { color: var(--qt-ink); }
.segtab.active { background: var(--qt-y); color: var(--qt-y-ink); font-weight: 600; }
.segtab .cnt { font-family: "Chakra Petch", sans-serif; font-weight: 700; margin-left: 5px; font-size: 12px; }
.segtab .cnt.hot { color: var(--qt-red); }
.segtab.active .cnt.hot { color: inherit; }
@media (min-width: 992px) { .segtabs { display: inline-flex; } .segtab { flex: 0 0 auto; } }

/* ---------- Summary strip ---------- */
.sumstrip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; }
.sumstrip::-webkit-scrollbar { display: none; }
.sum { flex: 0 0 auto; min-width: 108px; padding: 7px 12px; background: var(--qt-surface); border: 1px solid var(--qt-line); border-radius: 10px; }
.sum-l { font-size: 11.5px; color: var(--qt-ink-2); white-space: nowrap; }
.sum-v { font-family: "Chakra Petch", sans-serif; font-weight: 600; font-size: 15.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Tables (desktop) ---------- */
.table-wrap { overflow-x: auto; }
.qt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.qt-table th {
  position: sticky; top: 0; z-index: 1; background: var(--qt-surface);
  padding: 9px 10px; border-bottom: 1px solid var(--qt-line); text-align: left;
  font-size: 11.5px; font-weight: 600; color: var(--qt-ink-2); white-space: nowrap;
}
.qt-table td { padding: 8px 10px; border-bottom: 1px solid var(--qt-line); vertical-align: middle; }
.qt-table tbody tr:last-child td { border-bottom: 0; }
.qt-table tbody tr:hover td { background: var(--qt-surface-2); }
.qt-table tr.clickable { cursor: pointer; }
.qt-table .num, .qt-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qt-table .wrap { min-width: 180px; max-width: 360px; white-space: normal; }
.qt-table tfoot td { font-weight: 600; border-top: 1px solid var(--qt-line); border-bottom: 0; }
.qno { font-family: "Chakra Petch", sans-serif; font-weight: 600; color: var(--qt-ink); text-decoration: none; white-space: nowrap; }
a.qno:hover { color: var(--qt-y-text); }
.cell-sub { display: block; font-size: 12px; color: var(--qt-ink-3); }
.muted { color: var(--qt-ink-3); }
.due-over { color: var(--qt-red); font-weight: 600; }
.due-today { color: var(--qt-y-text); font-weight: 600; }

/* ---------- Ticket cards (the quotation "stub") ---------- */
.card-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 576px) and (max-width: 991.98px) { .card-list { grid-template-columns: 1fr 1fr; } }
.ticket {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  background: var(--qt-surface); border: 1px solid var(--qt-line); border-radius: 12px;
  color: var(--qt-ink); text-decoration: none;
}
.ticket::before { content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--qt-y); }
.ticket.is-approved::before { background: var(--qt-green); }
.ticket.is-rejected::before { background: var(--qt-red); }
.ticket:active { background: var(--qt-surface-2); }
.ticket-main { padding: 10px 12px 10px 15px; min-width: 0; }
.ticket-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ticket .qno { font-size: 13px; }
.ticket-client { margin-top: 4px; font-weight: 600; font-size: 15px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-co { color: var(--qt-ink-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 7px; font-size: 12px; color: var(--qt-ink-3); }
.ticket-meta i { margin-right: 3px; }
.ticket-stub {
  position: relative; min-width: 112px; padding: 10px 12px; text-align: right;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  border-left: 1px dashed var(--qt-line);
}
.ticket-stub::before, .ticket-stub::after {
  content: ""; position: absolute; left: -7px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--qt-bg); border: 1px solid var(--qt-line);
}
.ticket-stub::before { top: -7px; clip-path: inset(50% 0 0 0); }
.ticket-stub::after { bottom: -7px; clip-path: inset(0 0 50% 0); }
.amt-cur { font-size: 10.5px; color: var(--qt-ink-3); font-weight: 600; letter-spacing: .04em; }
.amt-v { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 16.5px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stub-note { font-size: 11.5px; color: var(--qt-ink-3); }

/* Generic report cards (mobile) */
.rcard { background: var(--qt-surface); border: 1px solid var(--qt-line); border-radius: 12px; padding: 10px 12px; }
.rcard-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-weight: 600; }
.rcard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 8px; font-size: 13px; }
.rcard-grid .full { grid-column: 1 / -1; }
.rk { display: block; font-size: 11px; color: var(--qt-ink-3); }
.rv { word-break: break-word; }

/* Visibility helpers for table vs cards */
.only-desk { display: none; }
@media (min-width: 992px) { .only-desk { display: block; } .only-mob { display: none !important; } }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--qt-ink-2); }
.empty i { display: block; font-size: 34px; color: var(--qt-ink-3); margin-bottom: 8px; }
.empty-title { font-weight: 600; color: var(--qt-ink); margin-bottom: 2px; }
.skel { height: 74px; border-radius: 12px; background: linear-gradient(90deg, var(--qt-surface) 0%, var(--qt-surface-2) 50%, var(--qt-surface) 100%); background-size: 200% 100%; animation: skel 1.2s linear infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.load-more { display: block; margin: 14px auto 0; min-width: 160px; }
.list-count { font-size: 12px; color: var(--qt-ink-3); margin: 8px 2px 0; text-align: center; }

/* ---------- Dashboard ---------- */
.dash { display: grid; gap: 12px; }
.pipe { padding: 16px 16px 14px; }
.pipe-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pipe-label { font-size: 12.5px; color: var(--qt-ink-2); margin-bottom: 4px; }
.pipe-total { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: clamp(30px, 7vw, 46px); line-height: 1; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.pipe-total small { font-size: .38em; font-weight: 600; color: var(--qt-ink-2); margin-right: 6px; letter-spacing: .04em; vertical-align: .55em; }
.pipe-conv { text-align: right; }
.pipe-conv-v { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 26px; line-height: 1; color: var(--qt-y-text); }
.pipe-bar { display: flex; gap: 3px; height: 16px; margin: 16px 0 12px; background: var(--qt-surface-2); }
.pipe-seg { height: 100%; min-width: 0; transition: flex-grow .7s cubic-bezier(.2, .8, .2, 1); }
.pipe-seg.s-approved { background: var(--qt-green); }
.pipe-seg.s-followup { background: repeating-linear-gradient(-45deg, var(--qt-y) 0 7px, var(--qt-y-deep) 7px 14px); }
.pipe-seg.s-rejected { background: var(--qt-red); }
.pipe-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pl-l { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--qt-ink-2); }
.pl-sw { width: 10px; height: 10px; flex: 0 0 auto; }
.pl-v { font-family: "Chakra Petch", sans-serif; font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-n { font-size: 12px; color: var(--qt-ink-3); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kpi { display: block; padding: 10px 12px; background: var(--qt-surface); border: 1px solid var(--qt-line); border-radius: 12px; color: var(--qt-ink); text-decoration: none; }
a.kpi:hover { border-color: var(--qt-ink-3); }
.kpi-l { font-size: 12px; color: var(--qt-ink-2); }
.kpi-v { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 24px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-s { font-size: 12px; color: var(--qt-ink-3); }
.kpi.hot .kpi-v { color: var(--qt-red); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 1199.98px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 767.98px) { .kpis { grid-template-columns: 1fr 1fr; } .pipe-legend { grid-template-columns: 1fr 1fr 1fr; gap: 6px; } .pl-v { font-size: 14px; } }
.chart-box { position: relative; height: 240px; }
.due-item { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--qt-line); color: var(--qt-ink); text-decoration: none; }
.due-item:last-child { border-bottom: 0; }
.due-item:hover { background: var(--qt-surface-2); }
.due-date { flex: 0 0 44px; text-align: center; line-height: 1.05; font-family: "Chakra Petch", sans-serif; }
.due-date .d { display: block; font-size: 19px; font-weight: 700; }
.due-date .m { display: block; font-size: 11px; color: var(--qt-ink-2); }
.due-date.over .d { color: var(--qt-red); }
.due-body { flex: 1 1 auto; min-width: 0; }
.due-body .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-body .s { font-size: 12px; color: var(--qt-ink-3); }
.lb-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--qt-line); }
.lb-row:last-child { border-bottom: 0; }
.lb-rank { font-family: "Chakra Petch", sans-serif; font-weight: 700; color: var(--qt-ink-3); }
.lb-row:first-child .lb-rank { color: var(--qt-y-text); }
.lb-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-meta { grid-column: 2 / -1; font-size: 12px; color: var(--qt-ink-3); }
.lb-val { font-family: "Chakra Petch", sans-serif; font-weight: 600; text-align: right; white-space: nowrap; }
.hb { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; margin-bottom: 10px; font-size: 13px; }
.hb:last-child { margin-bottom: 0; }
.hb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-val { color: var(--qt-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-track { grid-column: 1 / -1; height: 6px; background: var(--qt-surface-2); overflow: hidden; }
.hb-fill { height: 100%; background: var(--qt-y); transition: width .6s ease; }
.hb-fill.alt { background: var(--qt-ink-2); }

/* ---------- Quote detail ---------- */
.qd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
@media (max-width: 1199.98px) { .qd-grid { grid-template-columns: 1fr; } }
.qd-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.qd-main { padding: 14px 16px; min-width: 0; }
.qd-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qd-no { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 20px; }
.qd-client { font-size: 20px; margin: 8px 0 0; line-height: 1.2; word-break: break-word; }
.qd-company { color: var(--qt-ink-2); }
.qd-stub { min-width: 150px; padding: 14px 16px; }
.qd-stub .amt-v { font-size: 24px; }
.qd-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--qt-line); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 16px; }
.fact-l { font-size: 11.5px; color: var(--qt-ink-3); }
.fact-v { font-weight: 500; word-break: break-word; }
.desc { white-space: pre-wrap; word-break: break-word; }
.reason-box { border-left: 3px solid var(--qt-red); background: var(--qt-red-soft); padding: 9px 12px; border-radius: 0 8px 8px 0; white-space: pre-wrap; }
.qd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 575.98px) { .qd-stats { grid-template-columns: 1fr 1fr; } .qd-head { grid-template-columns: 1fr; } .qd-stub { border-left: 0; border-top: 1px dashed var(--qt-line); text-align: left; } .qd-stub::before, .qd-stub::after { display: none; } }
.tl { position: relative; padding-left: 28px; }
.tl::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: var(--qt-line); }
.tl-item { position: relative; padding-bottom: 12px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -28px; top: 4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--qt-surface); border: 2px solid var(--qt-line); color: var(--qt-ink-2); }
.tl-item.fu .tl-dot { border-color: var(--qt-y); color: var(--qt-y-text); }
.tl-item.ev-approved .tl-dot { border-color: var(--qt-green); color: var(--qt-green); }
.tl-item.ev-rejected .tl-dot { border-color: var(--qt-red); color: var(--qt-red); }
.tl-card { padding: 9px 12px; background: var(--qt-surface-2); border: 1px solid var(--qt-line); border-radius: 10px; }
.tl-item.ev .tl-card { background: transparent; border-style: dashed; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; color: var(--qt-ink-2); }
.tl-head .who { color: var(--qt-ink); font-weight: 600; }
.tl-notes { margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.tl-foot { margin-top: 6px; font-size: 12px; color: var(--qt-ink-3); }
.tl-menu { margin-left: auto; }
.tl-num { font-family: "Chakra Petch", sans-serif; font-weight: 700; color: var(--qt-ink-3); font-size: 12px; }

/* ---------- Reports ---------- */
.rep-picker { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; padding-bottom: 2px; }
.rep-picker::-webkit-scrollbar { display: none; }
@media (min-width: 992px) { .rep-picker { flex-wrap: wrap; } }
.rep-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border: 1px solid var(--qt-line); border-radius: 999px; background: var(--qt-surface); color: var(--qt-ink-2); font-size: 13px; font-weight: 500; }
.rep-chip:hover { color: var(--qt-ink); }
.rep-chip.active { background: var(--qt-y); border-color: var(--qt-y); color: var(--qt-y-ink); font-weight: 600; }
.rep-title { font-size: 16px; margin: 0 0 2px; }
.rep-sub { font-size: 12px; color: var(--qt-ink-3); margin-bottom: 10px; }

/* ---------- Settings & users ---------- */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 991.98px) { .set-grid { grid-template-columns: 1fr; } }
.logo-box { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1.5px dashed var(--qt-line); border-radius: 12px; }
.logo-preview { width: 96px; height: 64px; display: grid; place-items: center; background: var(--qt-surface-2); border-radius: 8px; overflow: hidden; flex: 0 0 auto; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lk-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--qt-line); }
.lk-row:last-child { border-bottom: 0; }
.lk-name { flex: 1 1 auto; min-width: 0; font-weight: 500; }
.lk-name.off { color: var(--qt-ink-3); text-decoration: line-through; }
.lk-used { font-size: 12px; color: var(--qt-ink-3); white-space: nowrap; }
.user-card { display: flex; gap: 12px; align-items: center; }
.user-card .avatar { width: 40px; height: 40px; font-size: 16px; }
.badge-soft { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 4px; background: var(--qt-surface-2); color: var(--qt-ink-2); }
.badge-soft.on { background: var(--qt-green-soft); color: var(--qt-green); }

/* ---------- Login ---------- */
.page-login { display: block; }
.login-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.login-card { position: relative; overflow: hidden; width: min(400px, 100%); padding: 32px 24px 26px; background: var(--qt-surface); border: 1px solid var(--qt-line); border-radius: 14px; box-shadow: var(--qt-shadow); }
.login-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: repeating-linear-gradient(-45deg, var(--qt-y) 0 8px, var(--qt-bg) 8px 16px); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-company { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 18px; line-height: 1.15; }
.login-app { font-size: 13px; color: var(--qt-ink-3); }
.login-title { font-size: 17px; margin-bottom: 16px; }
.login-foot { margin-top: 14px; font-size: 12px; color: var(--qt-ink-3); }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
