/* ============================================================
   CRM — Layout & component-specific styles
   ============================================================ */

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100%; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 18px; height: var(--topbar-h);
  border-bottom: 1px solid var(--border); flex-shrink: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800;
  font-size: 16px; box-shadow: var(--sh-sm); letter-spacing: -0.03em; }
.brand-name { font-weight: 800; font-size: 15px; letter-spacing: -0.02em; white-space: nowrap; line-height: 1.15; }
.brand-sub { font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group { margin-bottom: 4px; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--faint); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-2); cursor: pointer; position: relative;
  transition: background .12s, color .12s; margin-bottom: 1px; user-select: none;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active svg { stroke-width: 2.1; }
.nav-item .nav-badge { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--bg-2);
  color: var(--muted); padding: 1px 7px; border-radius: 99px; }
.nav-item.active .nav-badge { background: var(--accent); color: #fff; }

.sidebar-foot { border-top: 1px solid var(--border); padding: 10px; flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.user-chip:hover { background: var(--bg-2); }
.user-chip > div { min-width: 0; }
.user-chip > div > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }

/* ---------------- Topbar ---------------- */
.main { display: flex; flex-direction: column; height: 100%; overflow: hidden; min-width: 0; }
.topbar { height: var(--topbar-h); border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; flex-shrink: 0; }
.topbar .search-box { display: flex; align-items: center; gap: 9px; flex: 1; max-width: 460px;
  background: var(--bg-2); border: 1px solid transparent; border-radius: var(--r-sm); padding: 0 12px; height: 38px;
  transition: border-color .14s, background .14s; }
.topbar .search-box:focus-within { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.topbar .search-box input { border: none; outline: none; background: transparent; flex: 1; font-size: 13.5px; color: var(--text); }
.topbar .search-box input::placeholder { color: var(--faint); }

.org-select { display: flex; align-items: center; gap: 8px; padding: 6px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color .14s, background .14s; }
.org-select:hover { border-color: var(--border-strong); background: var(--bg-2); }
.org-select .org-name { font-size: 13px; font-weight: 600; line-height: 1.1; }
.org-select .org-sub { font-size: 10.5px; color: var(--muted); font-weight: 500; }

.lang-toggle { display: flex; background: var(--bg-2); border-radius: var(--r-xs); padding: 2px; }
.lang-toggle button { border: none; background: transparent; font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 5px 9px; border-radius: 5px; cursor: pointer; transition: all .12s; }
.lang-toggle button.on { background: var(--surface); color: var(--accent); box-shadow: var(--sh-sm); }

/* FX chip (dollar rate of the day) in topbar */
.fx-chip { display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 8px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); }
.fx-ico { width: 28px; height: 28px; border-radius: 7px; background: var(--success-soft); color: var(--success);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fx-label { font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.fx-val { font-size: 13.5px; font-weight: 800; line-height: 1.1; display: flex; align-items: center; gap: 4px; }
.fx-delta { display: inline-flex; }
.fx-delta.up { color: var(--success); } .fx-delta.down { color: var(--danger); }

.icon-btn { width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-2); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .12s, color .12s; position: relative; }
.icon-btn:hover { background: var(--bg-2); color: var(--text); }
.icon-btn .ping { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 99px;
  background: var(--danger); border: 2px solid var(--surface); }

/* ---------------- Content ---------------- */
.content { flex: 1; overflow-y: auto; }
.page { max-width: 1320px; margin: 0 auto; padding: 26px 30px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .crumbs { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.page-head .crumbs a { color: var(--accent); cursor: pointer; text-decoration: none; }
.page-head .crumbs a:hover { text-decoration: underline; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }

/* Stat cards */
.stat-grid { display: grid; gap: 16px; }
.dash-stats { grid-template-columns: repeat(4, 1fr); }
.dash-main { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }
.dash-main > * { min-width: 0; }
@media (max-width: 1100px) { .dash-main { grid-template-columns: 1fr; } }
@media (max-width: 920px) { .dash-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .dash-stats { grid-template-columns: 1fr; } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 18px 16px; box-shadow: var(--sh-sm); min-width: 0; }
.stat .stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .stat-val { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; margin-top: 8px; line-height: 1; }
.stat .stat-delta { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; margin-top: 9px; }
.stat .up { color: var(--success); } .stat .down { color: var(--danger); }
.stat-ico { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); }

/* ---------------- Modal ---------------- */
.modal-overlay { position: fixed; inset: 0; background: oklch(0.3 0.02 262 / 0.42); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 7vh 20px 20px; z-index: 200; animation: fadeIn .18s ease; overflow-y: auto; }
.modal-panel { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-xl); width: 100%; border: 1px solid var(--border); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 22px; }

/* ---------------- Drawer ---------------- */
.drawer-overlay { position: fixed; inset: 0; background: oklch(0.3 0.02 262 / 0.42); backdrop-filter: blur(3px); z-index: 100; display: flex; justify-content: flex-end; }
.drawer-panel { background: var(--bg); height: 100%; max-width: 94vw; box-shadow: var(--sh-xl); overflow-y: auto;
  animation: slideIn .26s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 18px 24px; z-index: 2; }
.drawer-body { padding: 24px; flex: 1; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s, border-color .12s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------- Empty state ---------------- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 20px; }
.empty-icon { width: 56px; height: 56px; border-radius: 14px; background: var(--bg-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center; }

/* ---------------- Funnel ---------------- */
.funnel { display: flex; flex-direction: column; gap: 7px; }
.funnel-row { display: flex; align-items: center; gap: 12px; }
.funnel-bar { height: 38px; border-radius: var(--r-sm); display: flex; align-items: center; padding: 0 14px;
  color: #fff; font-weight: 700; font-size: 13px; min-width: 64px; transition: width .6s cubic-bezier(.4,0,.2,1); }
.funnel-label { width: 150px; font-size: 13px; font-weight: 600; color: var(--text-2); flex-shrink: 0; }
.funnel-val { font-size: 13px; font-weight: 700; color: var(--muted); width: 56px; text-align: right; }

/* ---------------- Donut / ring ---------------- */
.ring-wrap { position: relative; width: 132px; height: 132px; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---------------- Mini menu ---------------- */
.popmenu { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--sh-lg); padding: 5px; z-index: 50; min-width: 180px; animation: pop .14s ease both; }
.popmenu-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-xs);
  font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
.popmenu-item:hover { background: var(--bg-2); }
.popmenu-item.danger { color: var(--danger); }
.popmenu-item.danger:hover { background: var(--danger-soft); }
.popmenu-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* ---------------- Detail layout ---------------- */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; }

.contact-card { border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; background: var(--surface); transition: box-shadow .14s, border-color .14s; }
.contact-card:hover { box-shadow: var(--sh-md); border-color: var(--border-strong); }

/* ---------------- Fullscreen account ficha ---------------- */
.ficha-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 120; display: flex; flex-direction: column; }
.ficha-top { height: 56px; flex-shrink: 0; border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; }
.ficha-scroll { flex: 1; overflow-y: auto; }
.ficha-inner { max-width: 1080px; margin: 0 auto; padding: 28px 30px 70px; }

/* ---------------- Offer banners (approval / expiry) ---------------- */
.offer-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid transparent; animation: fadeIn .25s ease; }
.offer-banner > svg { flex-shrink: 0; }
.offer-banner .grow { flex: 1; min-width: 0; }
.offer-banner .ttl { font-weight: 700; font-size: 13.5px; color: var(--text); }
.offer-banner .sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.offer-banner > .btn, .offer-banner > .row { flex-shrink: 0; }
.offer-banner.warn { background: var(--warning-soft); }
.offer-banner.warn > svg { color: oklch(0.5 0.12 70); }
.offer-banner.err  { background: var(--danger-soft); }
.offer-banner.err  > svg { color: var(--danger); }
.offer-banner.ok   { background: var(--success-soft); }
.offer-banner.ok   > svg { color: var(--success); }
.offer-banner.info { background: var(--accent-softer); }
.offer-banner.info > svg { color: var(--accent); }

/* ---------------- Version diff ---------------- */
.diff-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; }
.diff-tag.added   { background: var(--success-soft); color: var(--success); }
.diff-tag.removed { background: var(--danger-soft);  color: var(--danger); }
.diff-tag.changed { background: var(--warning-soft); color: oklch(0.45 0.12 70); }
.diff-tag.same    { background: var(--bg-2);          color: var(--muted); }
.diff-row.added   td { background: oklch(0.97 0.04 155 / 0.4); }
.diff-row.removed td { background: oklch(0.97 0.04 25 / 0.35); }
.diff-row.changed td { background: oklch(0.97 0.04 75 / 0.35); }
.diff-row.same    td { opacity: 0.7; }

/* ---------------- Approver chip ---------------- */
.approver-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 8px 5px 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 99px;
  position: relative; transition: border-color .14s, box-shadow .14s; min-width: 0; max-width: 100%; }
.approver-chip:hover { border-color: var(--accent); }
.approver-chip > div { min-width: 0; }
.approver-chip > div > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.approver-chip > .chip-remove { display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 99px; border: none; cursor: pointer;
  background: transparent; color: var(--muted); transition: background .12s, color .12s; margin-left: 2px; }
.approver-chip > .chip-remove:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------------- Approver mini (banner inline) ---------------- */
.approver-mini { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 3px;
  background: rgba(255,255,255,0.55); border-radius: 99px; font-size: 11.5px; font-weight: 600; color: var(--text); }
.ficha-top { height: 56px; flex-shrink: 0; border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; }
.ficha-scroll { flex: 1; overflow-y: auto; }
.ficha-inner { max-width: 1080px; margin: 0 auto; padding: 28px 30px 70px; }
.deal-card { border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; background: var(--surface);
  cursor: pointer; transition: box-shadow .14s, border-color .14s; }
.deal-card:hover { box-shadow: var(--sh-md); border-color: var(--border-strong); }
.offers-nest { margin-top: 12px; padding-top: 10px; padding-left: 14px; border-top: 1px solid var(--border);
  border-left: 2px solid var(--accent-soft); }

/* ---------------- Account gradient stat cards ---------------- */
.gc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.grad-card { border-radius: var(--r-lg); padding: 16px 16px 15px; color: #fff; position: relative;
  overflow: hidden; box-shadow: var(--sh-md); min-width: 0; }
.grad-card .gc-ico { position: absolute; right: -10px; bottom: -14px; opacity: 0.16; pointer-events: none; }
.grad-card .gc-label { font-size: 11.5px; font-weight: 600; opacity: 0.94; display: flex; gap: 7px;
  align-items: center; letter-spacing: 0.01em; }
.grad-card .gc-val { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; margin-top: 11px; line-height: 1; position: relative; }
.grad-card .gc-sub { font-size: 11.5px; opacity: 0.88; margin-top: 8px; font-weight: 500; position: relative; }
.gc-indigo { background: linear-gradient(135deg, oklch(0.56 0.16 278), oklch(0.43 0.15 264)); }
.gc-green  { background: linear-gradient(135deg, oklch(0.62 0.14 162), oklch(0.48 0.13 158)); }
.gc-amber  { background: linear-gradient(135deg, oklch(0.70 0.15 75), oklch(0.58 0.15 48)); }
.gc-rose   { background: linear-gradient(135deg, oklch(0.64 0.18 18), oklch(0.50 0.17 8)); }
@media (max-width: 880px) { .gc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .gc-grid { grid-template-columns: 1fr; } }

/* ---------------- Account timeline ---------------- */
.timeline { position: relative; }
.tl-item { display: flex; gap: 14px; position: relative; padding-bottom: 20px; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 0;
  width: 2px; background: var(--border); }
.tl-dot { width: 34px; height: 34px; border-radius: 99px; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; color: #fff; z-index: 1; box-shadow: 0 0 0 4px var(--bg); }
.tl-card { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 11px 14px; }
.tl-card .tl-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.tl-card .tl-ttl { font-size: 13.5px; font-weight: 700; }
.tl-card .tl-date { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tl-card .tl-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.tl-done { text-decoration: line-through; opacity: 0.7; }
.tl { position: relative; }
.tl-body { flex: 1; min-width: 0; padding-top: 6px; }

/* ---------------- Kanban ---------------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(232px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kanban-col { background: var(--bg-2); border-radius: var(--r-lg); padding: 10px; min-height: 200px; transition: background .15s, box-shadow .15s; }
.kanban-col.over { background: var(--accent-softer); box-shadow: inset 0 0 0 2px var(--accent); }
.kanban-head { padding: 4px 6px 12px; }
.kanban-dot { width: 9px; height: 9px; border-radius: 99px; display: inline-block; }
.kanban-count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--surface); color: var(--muted); padding: 1px 8px; border-radius: 99px; }
.kanban-list { display: flex; flex-direction: column; gap: 9px; }
.kanban-empty { text-align: center; color: var(--faint); font-size: 12px; padding: 20px 0; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; cursor: pointer; box-shadow: var(--sh-sm); transition: box-shadow .14s, transform .06s; }
.kanban-card:hover { box-shadow: var(--sh-md); border-color: var(--border-strong); }
.kanban-card:active { cursor: grabbing; }
.kanban-prob { height: 4px; border-radius: 99px; background: var(--bg-2); overflow: hidden; margin-top: 9px; }
.kanban-prob > i { display: block; height: 100%; border-radius: 99px; }

/* reports */
.rep-tab { display: flex; align-items: flex-start; gap: 11px; padding: 12px 13px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; font-family: inherit;
  transition: box-shadow .14s, border-color .14s; }
.rep-tab:hover { border-color: var(--border-strong); }
.rep-tab.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.rep-tab-ico { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; background: var(--bg-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center; }
.rep-tab.on .rep-tab-ico { background: var(--accent-soft); color: var(--accent); }
.rep-kpis { display: flex; gap: 1px; background: var(--border); border-bottom: 1px solid var(--border); }
.rep-kpi { flex: 1; background: var(--surface); padding: 14px 18px; }

/* reassign owner chip button */
.owner-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px;
  border: 1px solid var(--border-strong); border-radius: 99px; background: var(--surface);
  cursor: pointer; transition: border-color .14s, background .14s; }
.owner-pill:hover { border-color: var(--accent); background: var(--bg-2); }

/* ---------------- Activities (tasks / appointments) ---------------- */
.act-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.act-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.act-stat-ico { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; }
@media (max-width: 720px) { .act-stats { grid-template-columns: repeat(2, 1fr); } }

/* week calendar */
.wk-grid { display: grid; grid-template-columns: 58px repeat(7, minmax(118px, 1fr)); min-width: 760px; }
.wk-corner { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.wk-dayhead { text-align: center; padding: 9px 4px; border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border); }
.wk-dayhead.today { background: var(--accent-softer); }
.wk-times { border-right: 1px solid var(--border); }
.wk-time { position: relative; border-bottom: 1px dashed var(--border); }
.wk-time span { position: absolute; top: -8px; right: 7px; font-size: 10.5px; color: var(--muted);
  font-family: var(--mono); font-weight: 500; }
.wk-col { position: relative; border-right: 1px solid var(--border); }
.wk-slot { border-bottom: 1px dashed var(--border); cursor: pointer; transition: background .1s; }
.wk-slot:hover { background: var(--accent-softer); }
.wk-event { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 4px 7px; color: #fff;
  cursor: pointer; overflow: hidden; box-shadow: var(--sh-sm); z-index: 2; transition: filter .12s; }
.wk-event:hover { filter: brightness(1.08); }

/* ---------------- SearchSelect ---------------- */
.ss { position: relative; width: 100%; }
.ss-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; height: 38px; padding: 0 10px 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer;
  font-size: 13.5px; color: var(--text); transition: border-color .14s, box-shadow .14s; text-align: left; }
.ss-trigger:hover { border-color: var(--muted); }
.ss-trigger.open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.ss-val { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; font-weight: 600; }
.ss-val.ph { color: var(--faint); font-weight: 400; }
.ss-ava { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700; flex-shrink: 0; }
.ss-panel { position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--sh-lg); overflow: hidden; }
.ss-panel.up { top: auto; bottom: calc(100% + 5px); }
.ss-search { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.ss-search input { border: none; outline: none; background: transparent; flex: 1; font-size: 13.5px; color: var(--text); }
.ss-list { overflow-y: auto; padding: 5px; }
.ss-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-xs);
  cursor: pointer; transition: background .1s; }
.ss-item:hover { background: var(--bg-2); }
.ss-item.sel { background: var(--accent-softer); }
.ss-item-label { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-item-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-empty { padding: 18px; text-align: center; font-size: 13px; }

/* removable chip (multi-select) */
.chip-rm { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 11px;
  background: var(--accent-soft); color: var(--accent); border-radius: 99px; font-size: 12.5px; font-weight: 600; }
.chip-rm button { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border: none; background: transparent; color: var(--accent); border-radius: 99px; cursor: pointer; padding: 0; }
.chip-rm button:hover { background: oklch(0.5 0.13 262 / 0.18); }

/* segment picker (campaign builder) */
.seg-pick { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 99px;
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 13px;
  font-weight: 600; color: var(--text-2); transition: all .12s; }
.seg-pick:hover { border-color: var(--accent); }
.seg-pick.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.seg-pick .dot { width: 8px; height: 8px; border-radius: 99px; }

/* image upload */
.img-upload { border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); background: var(--bg-2);
  display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; position: relative;
  transition: border-color .14s, background .14s; }
.img-upload:hover { border-color: var(--accent); }
.img-upload.drag { border-color: var(--accent); background: var(--accent-softer); }
.img-upload.has { border-style: solid; border-color: var(--border); background: #fff; }
.img-upload .img-ph { display: flex; flex-direction: column; align-items: center; color: var(--muted); }
.img-rm { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 7px; border: none;
  background: oklch(0.25 0.02 262 / 0.62); color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(2px); }
.img-rm:hover { background: var(--danger); }

/* config hub cards */
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; }
.cfg-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--sh-sm); cursor: pointer;
  text-align: left; transition: box-shadow .14s, border-color .14s, transform .06s; font-family: inherit; }
.cfg-card:hover { box-shadow: var(--sh-md); border-color: var(--border-strong); }
.cfg-card:active { transform: translateY(0.5px); }
.cfg-card-ico { width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0; background: var(--accent-soft);
  color: var(--accent); display: flex; align-items: center; justify-content: center; }

/* inventory alert chips */
.alert-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px;
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-2); transition: box-shadow .12s; }
.alert-chip:hover { box-shadow: var(--sh-sm); }

/* toggle switch */
.toggle { width: 42px; height: 24px; border-radius: 99px; border: none; background: var(--border-strong);
  position: relative; cursor: pointer; transition: background .16s; flex-shrink: 0; padding: 0; }
.toggle.on { background: var(--accent); }
.toggle-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 99px;
  background: #fff; box-shadow: var(--sh-sm); transition: transform .16s; }
.toggle.on .toggle-knob { transform: translateX(18px); }

/* quote header grid */
.qh-kv { display: grid; grid-template-columns: 180px 1fr 180px 1fr; gap: 10px 18px; align-items: center; }
.qh-kv dt { font-size: 12px; color: var(--muted); font-weight: 500; }
.qh-kv dd { margin: 0; font-size: 13px; font-weight: 600; min-width: 0; }
@media (max-width: 800px) { .qh-kv { grid-template-columns: 150px 1fr; } }
.qh-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border-top: 1px solid var(--border); }
.qh-field { background: var(--surface); padding: 10px 14px; min-width: 0; }
.qh-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.qh-val { font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.qh-val .input, .qh-val .select { width: 100%; }
@media (max-width: 1100px) { .qh-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .qh-grid { grid-template-columns: repeat(2, 1fr); } }

/* dashboard level switcher */
.level-switch { display: inline-flex; background: var(--bg-2); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.level-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: none;
  background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .12s; font-family: inherit; white-space: nowrap; }
.level-btn:hover { color: var(--text); }
.level-btn.on { background: var(--surface); color: var(--accent); box-shadow: var(--sh-sm); }
@media (max-width: 640px) {
  .level-btn span { display: none; }
  .level-btn { padding: 9px 12px; }
}

/* calendar month view */
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-dow-cell { padding: 9px 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); text-align: left; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 7px 8px; cursor: pointer; transition: background .12s; overflow: hidden; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--accent-softer); }
.cal-cell.out { background: var(--bg-2); }
.cal-cell.out .cal-daynum { color: var(--faint); }
.cal-cell.sel { background: var(--accent-softer); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-daynum { font-size: 13px; font-weight: 700; color: var(--text-2); width: 24px; height: 22px; display: inline-flex;
  align-items: center; justify-content: center; border-radius: 7px; }
.cal-daynum.today { background: var(--accent); color: #fff; }
.cal-count { font-size: 10px; font-weight: 700; color: var(--muted); background: var(--bg-2); border-radius: 99px; padding: 1px 6px; }
.cal-items { display: flex; flex-direction: column; gap: 2px; }
.cal-chip { display: flex; align-items: center; gap: 4px; padding: 2px 5px; border-radius: 5px; font-size: 10.5px;
  font-weight: 600; line-height: 1.3; }
.cal-chip.done { opacity: 0.55; }
.cal-chip svg { flex-shrink: 0; }
.cal-more { font-size: 10px; font-weight: 600; color: var(--muted); padding: 1px 5px; }
@media (max-width: 1040px) {
  .page .cal-grid { font-size: 11px; }
  .cal-cell { min-height: 80px; }
}
@media (max-width: 720px) {
  .ficha-inner { padding: 18px 16px 60px; }
  .ficha-inner .anim-in[style*="grid"] { grid-template-columns: 1fr !important; }
}

/* ---------------- Quote builder ---------------- */
.quote-paper { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-md); }
.line-table { width: 100%; border-collapse: collapse; }
.line-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.line-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.line-table input.cell { height: 32px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 0 8px; width: 100%; font-size: 13px; }
.line-table input.cell:hover { border-color: var(--border); }
.line-table input.cell:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-ring); }
.line-table select.cell { height: 32px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 0 6px; width: 100%; font-size: 12px; cursor: pointer; }
.line-table select.cell:hover { border-color: var(--border); }
.line-table select.cell:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-ring); }

/* discount-mode segmented toggle */
.seg2 { display: inline-flex; background: var(--bg-2); border-radius: 7px; padding: 2px; gap: 2px; }
.seg2 button { border: none; background: transparent; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 4px 10px; border-radius: 5px; cursor: pointer; font-family: inherit; }
.seg2 button.on { background: var(--surface); color: var(--accent); box-shadow: var(--sh-sm); }

/* view-as role chip */
.role-chip { display: inline-flex; align-items: center; background: var(--bg-2); border-radius: var(--r-xs); padding: 2px; }
.role-chip button { border: none; background: transparent; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 5px 9px; border-radius: 5px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.role-chip button.on { background: var(--surface); color: var(--accent); box-shadow: var(--sh-sm); }
.totals-box { display: flex; flex-direction: column; gap: 8px; }
.totals-row { display: flex; justify-content: space-between; font-size: 13.5px; }
.totals-row.grand { font-size: 18px; font-weight: 800; padding-top: 10px; border-top: 1px solid var(--border); letter-spacing: -0.01em; }

/* Version timeline */
.ver-item { display: flex; gap: 12px; padding: 11px; border-radius: var(--r-md); cursor: pointer; border: 1px solid transparent; transition: background .12s, border-color .12s; }
.ver-item:hover { background: var(--bg-2); }
.ver-item.active { background: var(--accent-softer); border-color: var(--accent); }
.ver-dot { width: 10px; height: 10px; border-radius: 99px; background: var(--border-strong); margin-top: 5px; flex-shrink: 0; }
.ver-item.active .ver-dot { background: var(--accent); }

/* ---------------- Mobile ---------------- */
.menu-btn { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 1040px) {
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 200;
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.4,0,.2,1); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--sh-xl); }
  .app.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: oklch(0.3 0.02 262 / 0.4); z-index: 150; }
  .menu-btn { display: flex; }
  .topbar .search-box { max-width: none; }
  .topbar .org-select .org-detail { display: none; }
  .page { padding: 18px 16px 50px; }
  .topbar { padding: 0 14px; gap: 10px; }
}
@media (max-width: 560px) {
  .topbar .search-box { display: none; }
  .hide-sm { display: none !important; }
}

/* ---------------- Login ---------------- */
.login-wrap { display: grid; grid-template-columns: 1.05fr 1fr; height: 100%; background: var(--surface); }
.login-brand { position: relative; overflow: hidden; background: linear-gradient(150deg, oklch(0.42 0.14 262) 0%, oklch(0.34 0.13 280) 55%, oklch(0.30 0.10 250) 100%); color: #fff; display: flex; align-items: center; }
.login-brand-inner { position: relative; z-index: 2; padding: 56px; max-width: 540px; }
.login-orbs { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.login-orbs::before, .login-orbs::after { content: ""; position: absolute; border-radius: 50%; filter: blur(8px); opacity: 0.4; }
.login-orbs::before { width: 320px; height: 320px; background: radial-gradient(circle, oklch(0.7 0.16 200/0.5), transparent 70%); top: -80px; right: -60px; }
.login-orbs::after { width: 380px; height: 380px; background: radial-gradient(circle, oklch(0.6 0.18 320/0.45), transparent 70%); bottom: -120px; left: -80px; }
.login-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 56px; }
.login-mark { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,0.16); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: #fff; }
.login-mark.sm { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); font-size: 22px; margin-bottom: 18px; box-shadow: var(--sh-md); }
.login-eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: 0.14em; opacity: 0.7; margin-bottom: 16px; }
.login-hero h1 { font-size: 40px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.05; margin: 0 0 18px; }
.login-hero p { font-size: 15.5px; line-height: 1.6; opacity: 0.82; margin: 0; max-width: 440px; }
.login-stats { display: flex; gap: 14px; margin-top: 48px; }
.login-stat { background: rgba(255,255,255,0.1); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.14); border-radius: 12px; padding: 14px 18px; flex: 1; }
.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px; overflow-y: auto; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.login-sep { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--faint); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-demo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.login-demo-btn { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; font-family: inherit; }
.login-demo-btn:hover { border-color: var(--accent); background: var(--accent-softer); }
@media (max-width: 880px) { .login-brand { display: none; } .login-wrap { grid-template-columns: 1fr; } }

/* ---------------- Notifications tray ---------------- */
.popmenu-backdrop { position: fixed; inset: 0; z-index: 60; }
.notif-pop { position: absolute; top: 46px; right: 0; width: 360px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-xl); z-index: 70; animation: pop .14s ease both; }
.notif-item { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; transition: background .12s; }
.notif-item:hover { background: var(--bg-2); }
.notif-item.unread { background: var(--accent-softer); }
.notif-item.unread:hover { background: var(--accent-soft); }
.notif-ico { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-dot { position: absolute; top: 14px; right: 12px; width: 8px; height: 8px; border-radius: 99px; background: var(--accent); }

/* credit pipeline + stepper */
.credit-stages { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.credit-stage-pill { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; text-align: center; }
.credit-stepper { display: flex; align-items: center; gap: 6px; }
.credit-step { display: flex; align-items: center; gap: 7px; opacity: 0.5; }
.credit-step.active, .credit-step.done { opacity: 1; }
.credit-step-dot { width: 22px; height: 22px; border-radius: 99px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; background: var(--bg-2); color: var(--muted); flex-shrink: 0; }
.credit-step.active .credit-step-dot { background: var(--accent); color: #fff; }
.credit-step.done .credit-step-dot { background: var(--success); color: #fff; }
.credit-step-label { font-size: 12px; font-weight: 600; white-space: nowrap; }
.credit-step:not(:last-child)::after { content: ""; width: 14px; height: 2px; background: var(--border); margin-left: 2px; }
@media (max-width: 720px) { .credit-stages { grid-template-columns: repeat(2,1fr); } .credit-step-label { display: none; } }
.dash-cell { position: relative; width: 38px; height: 32px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-family: inherit; }
.dash-cell.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.dash-cell:hover { border-color: var(--accent); }
.dash-default { position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 99px; background: var(--success); border: 1.5px solid var(--surface); }
