/* ================================================================
   SOLARAYA CRM — design tokens
   ================================================================ */
:root {
  --ember: #F7941E;
  --ember-deep: #C2410C;
  --flame: #FFB457;
  --signal: #DC2626;
  --ink: #334155;
  --coal: #36363A;
  --coal-2: #45454B;
  --paper: #F6F4EF;
  --card: #FFFFFF;
  --line: #E8E3DA;
  --text: #26262B;
  --muted: #8B8896;
  --grad-flame: linear-gradient(145deg, #C2410C 0%, #F7941E 100%);

  --st-new: #334155;
  --st-contacted: #B97509;
  --st-survey: #0E7482;
  --st-quoted: #F7941E;
  --st-won: #1B7F42;
  --st-lost: #97939E;

  --r: 14px;
  --shadow: 0 1px 2px rgba(38, 32, 22, .05), 0 8px 24px -12px rgba(38, 32, 22, .18);
  --shadow-lg: 0 24px 64px -16px rgba(30, 24, 14, .35);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --hexagon: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 400 14.5px/1.55 Inter, system-ui, sans-serif;
  color: var(--text);
  background: var(--paper);
  overflow: hidden;
  height: 100dvh;
}
h1, h2, h3, h4, .wordmark { font-family: Inter, system-ui, sans-serif; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
svg { fill: currentColor; }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================================================================
   Buttons
   ================================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 18px; border-radius: 11px;
  font: 600 14px Inter, system-ui, sans-serif; letter-spacing: .1px;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: scale(.965); }
.btn-ember {
  background: var(--grad-flame); color: #fff;
  box-shadow: 0 2px 8px -2px rgba(190, 85, 15, .45);
}
.btn-ember:hover { background: linear-gradient(145deg, #A8360A 0%, #E58517 100%); }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--line); }
.btn-ghost:hover { color: var(--text); border-color: #d6d0c4; }
.btn-dark { background: var(--coal); color: #fff; }
.btn-dark:hover { background: #1f1f24; }
.btn-block { width: 100%; justify-content: center; }

/* ================================================================
   Login
   ================================================================ */
.login {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: radial-gradient(1200px 800px at 80% -10%, #45454e 0%, var(--coal) 55%, #232327 100%);
  overflow: hidden;
}
.login-hex { position: absolute; clip-path: var(--hexagon); }
.login-hex-1 { width: 420px; height: 460px; right: -120px; top: -140px; background: var(--grad-flame); opacity: .55; }
.login-hex-2 { width: 240px; height: 264px; left: -80px; bottom: -90px; background: #3d3d45; opacity: .6; }

.login-card {
  position: relative; width: min(400px, calc(100vw - 40px));
  background: #fff; border-radius: 22px; padding: 38px 36px 30px;
  box-shadow: var(--shadow-lg);
  animation: cardIn .6s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(22px) scale(.97); } }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand img { width: 58px; height: auto; }
.wordmark { font-weight: 700; font-size: 24px; letter-spacing: .2px; color: var(--coal); }
.sidebar .wordmark { color: #fff; }
.login-tag { font: 600 10px Inter, system-ui, sans-serif; letter-spacing: 3px; color: var(--ember); margin: 10px 0 4px; }
.login h1 { font-size: 24px; font-weight: 700; color: var(--ink); margin-bottom: 22px; }
.login label { display: block; font: 600 12px Inter, sans-serif; color: var(--muted); margin-bottom: 14px; }
.login input {
  width: 100%; margin-top: 6px; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: 11px; font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s;
}
.login input:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px rgba(247, 148, 30, .15); }
.login-error { color: var(--signal); font-size: 12.5px; min-height: 18px; margin: -4px 0 8px; }
.login-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 16px; }

/* ================================================================
   Layout
   ================================================================ */
.app { display: flex; height: 100dvh; }

.sidebar {
  width: 218px; flex: 0 0 218px;
  background: linear-gradient(180deg, var(--coal) 0%, #26262b 100%);
  color: #C9C7CE; display: flex; flex-direction: column;
  padding: 22px 14px 14px;
}
.side-brand { display: flex; align-items: center; gap: 9px; padding: 0 10px 22px; }
.side-brand img { width: 46px; height: auto; }
.side-brand .wordmark { font-size: 20px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10.5px 12px; border-radius: 11px;
  color: #B7B4BF; text-decoration: none;
  font: 500 13.5px Inter, sans-serif;
  transition: background .16s, color .16s;
  position: relative;
}
.side-nav a svg { width: 18px; height: 18px; opacity: .8; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.active { background: var(--grad-flame); color: #fff; font-weight: 600; }
.side-nav a.active svg { opacity: 1; }
.side-testform { margin-top: 14px; border: 1.5px dashed #4a4a52; }
.side-testform .ext { margin-left: auto; opacity: .6; }

.side-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid #3d3d44; }
.side-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.side-user b { display: block; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: #8f8c98; font-size: 11px; }
.side-logout { color: #8f8c98; padding: 8px; border-radius: 9px; transition: .15s; }
.side-logout:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.side-logout svg { width: 17px; height: 17px; display: block; }

.avatar {
  width: 36px; height: 40px; flex: 0 0 36px;
  display: grid; place-items: center;
  clip-path: var(--hexagon);
  background: var(--grad-flame); color: #fff;
  font: 700 12px Inter, system-ui, sans-serif;
}
.avatar.ink { background: var(--ink); }
.avatar.teal { background: var(--st-survey); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px 14px; gap: 16px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.topbar h2 { font-size: 21px; font-weight: 700; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); }
.search input {
  width: 230px; padding: 9.5px 14px 9.5px 36px;
  border: 1.5px solid var(--line); border-radius: 11px;
  background: #fff; font-size: 13.5px;
  transition: width .25s var(--ease), border-color .15s, box-shadow .15s;
}
.search input:focus { outline: 0; width: 300px; border-color: var(--ember); box-shadow: 0 0 0 3px rgba(247, 148, 30, .13); }

.bell { position: relative; padding: 9px; border-radius: 11px; color: var(--muted); border: 1.5px solid var(--line); background: #fff; transition: .15s; }
.bell:hover { color: var(--text); }
.bell svg { width: 19px; height: 19px; display: block; }
.bell-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--signal); color: #fff;
  font: 700 10.5px Inter, sans-serif; line-height: 19px; text-align: center;
  animation: pop .35s var(--ease);
}
@keyframes pop { from { opacity: 0; } }

/* notification panel */
.notif-panel {
  position: absolute; top: 64px; right: 108px; width: 350px; max-height: 65dvh;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--line); z-index: 40;
  display: flex; flex-direction: column;
  animation: dropIn .22s var(--ease) both;
  overflow: hidden;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-head b { font-family: Inter; font-size: 14px; }
.notif-enable { font: 600 11.5px Inter; color: var(--ember); padding: 5px 9px; border-radius: 8px; background: rgba(247, 148, 30, .1); }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 11px; padding: 12px 16px; border-bottom: 1px solid #f1eee7; align-items: flex-start; }
.notif-item:last-child { border-bottom: 0; }
.notif-item .dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--ember); flex: 0 0 8px; }
.notif-item.seen .dot { background: var(--line); }
.notif-item p { font-size: 13px; }
.notif-item small { color: var(--muted); font-size: 11.5px; }
.notif-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }

/* ================================================================
   Views
   ================================================================ */
.view { flex: 1; overflow-y: auto; padding: 22px 26px 30px; }
.view-anim { animation: viewIn .24s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } }

/* ---------- dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 18px 16px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.stat-card:hover { transform: translateY(-1px); }
.stat-card .label { font: 600 11.5px Inter; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.stat-card .num { font: 700 30px/1.15 Inter; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat-card .sub b.up { color: var(--st-won); }
.stat-card::after {
  content: ''; position: absolute; right: -22px; top: -26px;
  width: 74px; height: 82px; clip-path: var(--hexagon);
  background: var(--ember); opacity: .05;
}
.stat-card.ember-card { border-top: 3px solid var(--ember); }
.stat-card.ember-card .label { color: var(--ember-deep); }

.dash-cols { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; margin-top: 14px; align-items: start; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.panel h3 { font-size: 14.5px; font-weight: 600; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.panel h3 small { font: 500 12px Inter; color: var(--muted); }

/* signature: hexagon pipeline */
.hex-pipe { display: flex; align-items: flex-start; justify-content: space-between; padding: 8px 4px 2px; }
.hex-step { display: flex; flex-direction: column; align-items: center; gap: 7px; flex: 1; position: relative; }
.hex-step:not(:last-child)::after {
  content: ''; position: absolute; top: 26px; left: calc(50% + 30px); right: calc(-50% + 30px);
  border-top: 2.5px dotted #d9d3c7;
}
.hex-node {
  width: 46px; height: 52px; clip-path: var(--hexagon);
  display: grid; place-items: center; color: #fff;
  font: 700 16px Inter; position: relative; z-index: 1;
  transition: transform .2s var(--ease);
}
.hex-step:hover .hex-node { transform: translateY(-2px); }
.hex-step label { font: 600 11px Inter; color: var(--muted); letter-spacing: .2px; }

/* chart */
.chart-14 { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 6px; }
.chart-14 .c-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.chart-14 .c-bar {
  width: 100%; max-width: 26px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #F0873B, #E2620E);
  min-height: 3px; transform-origin: bottom;
  animation: barGrow .7s var(--ease) both;
  animation-delay: calc(var(--i) * 35ms);
}
.chart-14 .c-col.zero .c-bar { background: #eee9df; }
@keyframes barGrow { from { transform: scaleY(0); } }
.chart-14 .c-col label { font: 500 9.5px Inter; color: var(--muted); }

/* activity feed */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 10px 2px; border-bottom: 1px solid #f1eee7; }
.feed-item:last-child { border-bottom: 0; }
.feed-ico {
  width: 30px; height: 34px; clip-path: var(--hexagon); flex: 0 0 30px;
  display: grid; place-items: center; font-size: 13px; color: #fff; background: var(--ink);
}
.feed-ico.quote { background: var(--ember); }
.feed-ico.created { background: var(--st-survey); }
.feed-item p { font-size: 13px; }
.feed-item p b { font-weight: 600; }
.feed-item small { color: var(--muted); font-size: 11.5px; }

/* source split */
.src-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12.5px; }
.src-row label { width: 118px; color: var(--muted); font-weight: 500; }
.src-row .track { flex: 1; height: 8px; border-radius: 4px; background: #f0ece3; overflow: hidden; }
.src-row .fill { height: 100%; border-radius: 4px; background: var(--grad-flame); width: 0; transition: width .8s var(--ease); }
.src-row b { width: 26px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- leads board ---------- */
.leads-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.seg { display: inline-flex; background: #eeeae1; border-radius: 11px; padding: 3px; gap: 2px; }
.seg button {
  padding: 7px 16px; border-radius: 9px; font: 600 12.5px Inter; color: var(--muted);
  transition: .18s var(--ease);
}
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.leads-count { margin-left: auto; color: var(--muted); font-size: 12.5px; }

.board { display: grid; grid-template-columns: repeat(6, minmax(188px, 1fr)); gap: 10px; overflow-x: auto; align-items: start; padding-bottom: 10px; }
.col { background: #EFECE4; border-radius: var(--r); padding: 10px 10px 12px; min-height: 200px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; }
.col-head .hex-mini { width: 13px; height: 15px; clip-path: var(--hexagon); }
.col-head b { font: 600 12.5px Inter; letter-spacing: .2px; }
.col-head .cnt { margin-left: auto; font: 600 11.5px Inter; color: var(--muted); background: #fff; padding: 1px 8px; border-radius: 8px; }
.col.drag-over { outline: 2px dashed var(--ember); outline-offset: -2px; background: #f6ede2; }

.card {
  background: #fff; border-radius: 12px; padding: 12px 13px;
  box-shadow: 0 1px 2px rgba(38, 32, 22, .07);
  border: 1px solid rgba(0, 0, 0, .035);
  margin-bottom: 9px; cursor: grab;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), opacity .18s;
  animation: cardPop .3s var(--ease) both;
}
@keyframes cardPop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(38, 32, 22, .25); }
.card.dragging { opacity: .45; cursor: grabbing; }
.card b { font: 600 13.5px Inter; display: block; }
.card .c-area { color: var(--muted); font-size: 12px; margin-top: 1px; }
.card .c-meta { display: flex; align-items: center; gap: 5px; margin-top: 9px; min-width: 0; }
.chip { font: 600 10px Inter; padding: 3px 7px; border-radius: 7px; background: #f2efe8; color: #6d6a76; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.fb { background: #E7F0FF; color: #1B5FBF; }
.chip.bill { background: rgba(247, 148, 30, .1); color: var(--ember-deep); }
.card .c-sp { margin-left: auto; width: 24px; height: 27px; flex: 0 0 24px; clip-path: var(--hexagon); display: grid; place-items: center; font: 700 9.5px Inter; color: #fff; background: var(--ink); }
.card .c-sp.sp2 { background: var(--st-survey); }
.card .c-new-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ember); margin-right: 5px; }

/* list view */
.ltable { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.ltable th { text-align: left; font: 600 11px Inter; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #FBFAF6; }
.ltable td { padding: 12px 16px; border-bottom: 1px solid #f3f0e9; font-size: 13.5px; }
.ltable tr:last-child td { border-bottom: 0; }
.ltable tbody tr { cursor: pointer; transition: background .13s; }
.ltable tbody tr:hover { background: #FBF7F0; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font: 600 11.5px Inter; padding: 4px 11px; border-radius: 9px; color: #fff; }

/* ---------- quotes view ---------- */
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.qcard {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.qcard:hover { transform: translateY(-1px); }
.qcard::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--ember); }
.qcard .q-ref { font: 600 11px Inter; letter-spacing: .8px; color: var(--muted); }
.qcard h4 { font-size: 16px; margin: 3px 0 1px; color: var(--ink); }
.qcard .q-area { color: var(--muted); font-size: 12.5px; }
.qcard .q-nums { display: flex; gap: 18px; margin: 13px 0 15px; }
.qcard .q-nums div b { font: 700 17px Inter; color: var(--text); display: block; font-variant-numeric: tabular-nums; }
.qcard .q-nums div span { font-size: 11px; color: var(--muted); }
.qcard .q-actions { display: flex; gap: 8px; }
.qcard .q-actions .btn { padding: 8px 14px; font-size: 12.5px; }

/* empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .hexagon-empty { width: 64px; height: 72px; clip-path: var(--hexagon); background: #ece8de; margin: 0 auto 16px; display: grid; place-items: center; font-size: 26px; }
.empty b { display: block; font: 600 15px Inter; color: var(--text); margin-bottom: 4px; }

/* ================================================================
   Modals / drawer / overlay
   ================================================================ */
.overlay { position: fixed; inset: 0; background: rgba(28, 24, 18, .45); backdrop-filter: blur(3px); z-index: 45; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }

.modal {
  position: fixed; z-index: 50; left: 50%; top: 50%;
  translate: -50% -50%; width: min(560px, calc(100vw - 36px));
  background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg);
  animation: modalIn .3s var(--ease) both;
  max-height: calc(100dvh - 60px); display: flex; flex-direction: column;
}
.modal-wide { width: min(940px, calc(100vw - 36px)); }
@keyframes modalIn { from { opacity: 0; translate: -50% calc(-50% + 18px); scale: .97; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-head h3 { font-size: 18px; color: var(--ink); }
.modal .x { font-size: 26px; line-height: 1; color: var(--muted); padding: 2px 8px; border-radius: 9px; }
.modal .x:hover { background: #f3f0e9; color: var(--text); }
.modal-body { padding: 18px 24px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; }
.form-grid .modal-foot { padding: 6px 0 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid label { font: 600 12px Inter; color: var(--muted); display: block; }
.form-grid input, .form-grid select, .modal textarea {
  width: 100%; margin-top: 5px; padding: 10px 13px;
  border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-grid input:focus, .form-grid select:focus, .modal textarea:focus {
  outline: 0; border-color: var(--ember); box-shadow: 0 0 0 3px rgba(247, 148, 30, .14);
}

/* quotation builder */
.quote-builder { display: grid; grid-template-columns: 1fr 1.1fr; gap: 24px; }
.qb-left { display: flex; flex-direction: column; gap: 15px; }
.qb-left > label { font: 600 12px Inter; color: var(--muted); }
.qb-left select { width: 100%; margin-top: 5px; padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; background: #fff; }
.qb-left .seg { margin-top: 6px; width: 100%; }
.qb-left .seg button { flex: 1; }
.slider-row { display: flex; align-items: center; gap: 13px; margin-top: 10px; }
.slider-row output { font: 700 15px Inter; color: var(--ember-deep); min-width: 74px; font-variant-numeric: tabular-nums; }
input[type=range] { flex: 1; accent-color: var(--ember); height: 4px; }

.qb-packages { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.pkg {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 13px;
  cursor: pointer; transition: .18s var(--ease); background: #fff;
}
.pkg:hover { border-color: #d8d2c5; }
.pkg.on { border-color: var(--ember); background: #FFF7F1; box-shadow: 0 0 0 3px rgba(247, 148, 30, .12); }
.pkg.rec::after { content: 'Recommended'; font: 700 9px Inter; letter-spacing: .6px; text-transform: uppercase; color: #fff; background: var(--grad-flame); padding: 3px 8px; border-radius: 7px; margin-left: auto; }
.pkg .p-hex { width: 34px; height: 38px; clip-path: var(--hexagon); background: #efece4; display: grid; place-items: center; font: 700 10px Inter; color: var(--ink); flex: 0 0 34px; }
.pkg.on .p-hex { background: var(--grad-flame); color: #fff; }
.pkg b { font: 600 13px Inter; display: block; }
.pkg small { color: var(--muted); font-size: 11.5px; }
.pkg .p-price { margin-left: auto; font: 700 13.5px Inter; color: var(--ink); white-space: nowrap; }
.pkg.rec .p-price { margin-left: 0; }

.qb-right {
  background: linear-gradient(165deg, #33333A, #232327);
  border-radius: 16px; padding: 22px; color: #E7E5EA;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.qb-right::after { content: ''; position: absolute; right: -46px; top: -40px; width: 150px; height: 168px; clip-path: var(--hexagon); background: var(--grad-flame); opacity: .16; }
.qb-right .qp-label { font: 600 10px Inter; letter-spacing: 2.4px; color: #98959f; text-transform: uppercase; }
.qb-right .qp-size { font: 700 40px/1.1 Inter; color: #fff; margin: 8px 0 2px; }
.qb-right .qp-size small { font-size: 19px; color: var(--flame); }
.qb-right .qp-pkgname { color: #b9b6c1; font-size: 12.5px; margin-bottom: 18px; }
.qp-rows { display: flex; flex-direction: column; gap: 0; margin-bottom: 4px; }
.qp-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .09); font-size: 13px; }
.qp-row span { color: #a5a2ad; }
.qp-row b { font-variant-numeric: tabular-nums; transition: .2s; }
.qp-row.hero b { color: var(--flame); font: 700 16px Inter; }
.qp-offset { margin-top: auto; padding-top: 16px; display: flex; align-items: center; gap: 13px; }
.qp-offset .track { flex: 1; height: 9px; border-radius: 5px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.qp-offset .fill { height: 100%; border-radius: 5px; background: var(--grad-flame); transition: width .5s var(--ease); }
.qp-offset b { font: 700 15px Inter; color: #fff; }
.qp-offset small { display: block; color: #98959f; font-size: 10.5px; }

/* ================================================================
   Maintenance — calendar + due list
   ================================================================ */
.maint-cols { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; margin-top: 14px; align-items: start; }
.stat-card.warn-card { border-color: color-mix(in srgb, var(--signal) 35%, var(--line)); }
.stat-card.warn-card .num { color: var(--signal); }

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cal-head h3 { font: 700 16px Inter, sans-serif; color: var(--ink); }
.cal-nav { display: flex; gap: 5px; }
.cal-nav button {
  min-width: 30px; height: 30px; padding: 0 10px; border-radius: 9px;
  border: 1.5px solid var(--line); background: #fff; color: var(--muted);
  font: 600 12.5px Inter, sans-serif; transition: .15s;
}
.cal-nav button:hover { color: var(--text); border-color: #d6d0c4; }

.cal-legend { display: flex; align-items: center; gap: 6px; margin: 10px 0 8px; font: 500 11px Inter, sans-serif; color: var(--muted); flex-wrap: wrap; }
.cal-legend .lg { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.cal-legend .lg:first-child { margin-left: 0; }
.lg.site_visit, .cal-chip.site_visit { background: var(--st-survey); }
.lg.installation, .cal-chip.installation { background: var(--ink); }
.lg.maintenance, .cal-chip.maintenance { background: var(--grad-flame); }
.lg.late, .cal-chip.late { background: var(--signal); }
.lg.done, .cal-chip.done { background: #C9C6BE; }
.cal-tip { margin-left: auto; font-size: 10.5px; color: #b3afba; font-style: italic; }

.cal-cell { cursor: pointer; transition: border-color .15s, background .15s; }
.cal-cell:hover:not(.empty) { border-color: var(--ember); background: #FFFCF8; }
.cal-cell.empty { cursor: default; }

.panel h3 .sched-btn { margin-left: auto; padding: 6px 12px; font-size: 12px; }
.panel h3 { display: flex; align-items: center; gap: 8px; }

.seg.seg-3 { width: 100%; margin-top: 6px; }
.seg.seg-3 button { flex: 1; font-size: 12.5px; padding: 8px 4px; }

.d-sched { display: flex; flex-wrap: wrap; gap: 7px; }
.d-sched .btn { padding: 8px 12px; font-size: 12.5px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font: 600 10.5px Inter, sans-serif; color: var(--muted); text-align: center; padding: 2px 0 4px; letter-spacing: .4px; }
.cal-cell {
  min-height: 74px; border: 1px solid var(--line); border-radius: 9px; padding: 5px;
  display: flex; flex-direction: column; gap: 3px; background: #fff;
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.today { border-color: var(--ember); box-shadow: 0 0 0 2px rgba(247, 148, 30, .14); }
.cal-day { font: 600 11px Inter, sans-serif; color: var(--muted); }
.cal-cell.today .cal-day { color: var(--ember-deep); }
.cal-chip {
  display: block; color: #fff; font: 600 9.5px Inter, sans-serif;
  padding: 2.5px 5px; border-radius: 5px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform .15s var(--ease);
}
.cal-chip:hover { transform: translateY(-1px); }

.due-list { display: flex; flex-direction: column; gap: 7px; }
.due-item { display: flex; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 11px; }
.due-item.late { border-color: color-mix(in srgb, var(--signal) 40%, var(--line)); background: #FFF7F6; }
.due-hex { width: 30px; height: 34px; flex: 0 0 30px; clip-path: var(--hexagon); display: grid; place-items: center; font-size: 13px; }
.due-hex.installation { background: var(--ink); }
.due-hex.maintenance { background: var(--grad-flame); }
.due-main { flex: 1; min-width: 0; }
.due-main b { display: block; font: 600 13px Inter, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-main small { color: var(--muted); font-size: 11.5px; }
.due-act { display: flex; align-items: center; gap: 6px; }
.due-act input[type="date"] { border: 1.5px solid var(--line); border-radius: 8px; padding: 5px 7px; font: 500 11.5px Inter, sans-serif; color: var(--text); background: #fff; }
.due-act .btn { padding: 6px 11px; font-size: 12px; }

.d-job { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 7px; }
.d-job.late { border-color: color-mix(in srgb, var(--signal) 40%, var(--line)); background: #FFF7F6; }
.d-job.done { opacity: .62; }
.d-job-ico { font-size: 15px; }
.d-job b { display: block; font: 600 12.5px Inter, sans-serif; }
.d-job small { color: var(--muted); font-size: 11px; }
.d-job .d-job-done { margin-left: 6px; padding: 5px 10px; font-size: 11.5px; }

/* WhatsApp reminder button + branded notification icon */
.wa-mini {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; border-radius: 8px;
  background: #25D366; color: #fff; font: 700 11.5px Inter, sans-serif; text-decoration: none;
  white-space: nowrap; transition: background .15s;
}
.wa-mini:hover { background: #1ebe5d; }
.d-job .wa-mini { margin-left: auto; padding: 5px 9px; font-size: 11px; }
.notif-item .n-ico {
  flex: 0 0 26px; width: 26px; height: 26px; display: grid; place-items: center;
  font-size: 14px; background: #F6F3EE; border-radius: 8px;
}
.notif-item .n-ico .dot { width: 8px; height: 8px; }

/* ---- roof visualization (quote builder) ---- */
.qb-left input#qb-address {
  width: 100%; margin-top: 5px; padding: 10px 13px; border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 14px; background: #fff; font-family: Inter, sans-serif; color: var(--text);
}
.qb-left input#qb-address:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px rgba(247, 148, 30, .12); }
.qb-roof {
  position: relative; width: 100%; height: 300px; border-radius: 12px; overflow: hidden;
  background: #14141a; border: 1.5px solid var(--line); display: grid; place-items: center;
  margin-bottom: 18px;
}
.qb-roof .roofviz-svg { width: 100%; height: 100%; display: block; }
.qb-roof.loading::after {
  content: 'Generating roof layout…'; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(20, 20, 26, .58); color: #fff; font: 600 13px Inter, sans-serif; letter-spacing: .3px;
}
.qb-roof-empty { color: #9a97a3; font: 500 13px Inter, sans-serif; text-align: center; padding: 20px; max-width: 340px; }
.qb-roof-cap {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px; background: linear-gradient(transparent, rgba(0, 0, 0, .74)); color: #fff;
}
.qb-roof-cap .rc-count { font: 700 13px Inter, system-ui, sans-serif; }
.qb-roof-cap .rc-prov {
  font: 600 10px Inter, sans-serif; letter-spacing: .5px; text-transform: uppercase;
  background: rgba(255, 255, 255, .18); padding: 3px 8px; border-radius: 20px;
}
.qb-roof-cap .rc-prov.warn { background: rgba(217, 30, 24, .85); }
.qb-roof-cap .rc-note { font: 500 11px Inter, sans-serif; color: #e7e4dd; opacity: .92; margin-left: auto; }
.qb-roof-cap .rc-hint { font: 500 10.5px Inter, sans-serif; color: #cfccd6; opacity: .85; margin-left: auto; }

/* ---- interactive panel editor ---- */
.rv-edit { touch-action: none; user-select: none; }
.rv-edit.moving { cursor: grab; }
.rv-edit.moving:active { cursor: grabbing; }
.rv-tools button.on { background: var(--grad-flame); color: #fff; }
.rv-roofline { fill: none; stroke: #F7941E; stroke-width: 2; stroke-dasharray: 7 5; opacity: .6; pointer-events: none; }
.rv-panel { cursor: grab; }
.rv-panel:active { cursor: grabbing; }
.rv-tools {
  position: absolute; top: 10px; right: 10px; z-index: 4;
  display: flex; gap: 4px; align-items: center;
  background: rgba(20, 20, 26, .82); padding: 5px; border-radius: 11px;
}
.rv-tools button {
  min-width: 30px; height: 30px; padding: 0 7px; border: none; border-radius: 7px;
  background: rgba(255, 255, 255, .13); color: #fff; font-size: 14px; cursor: pointer;
  display: grid; place-items: center; line-height: 1; transition: background .15s;
}
.rv-tools button[data-act="reset"] { font: 600 11px Inter, sans-serif; letter-spacing: .2px; }
.rv-tools button:hover:not(:disabled) { background: rgba(255, 255, 255, .26); }
.rv-tools button:disabled { opacity: .32; cursor: default; }
.rv-tools .rv-sep { width: 1px; height: 18px; background: rgba(255, 255, 255, .22); margin: 0 3px; }
.rv-marquee { fill: rgba(251, 176, 64, .12); stroke: #F7941E; stroke-width: 1.2; stroke-dasharray: 5 4; }
.rv-rot-stem { stroke: #F7941E; stroke-width: 1.4; }
.rv-rot-handle { fill: #F7941E; stroke: #fff; stroke-width: 1.6; cursor: grab; }
.rv-trace-line { fill: none; stroke: #F7941E; stroke-width: 2; }
.rv-trace-close { stroke: #F7941E; stroke-width: 1.4; stroke-dasharray: 5 4; opacity: .7; }
.rv-trace-dot { fill: #fff; stroke: #F7941E; stroke-width: 2; }
.rv-trace-dot.first { fill: #F7941E; }

/* ---- address autocomplete ---- */
.qb-ac { position: relative; }
.qb-ac-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 5px);
  background: #fff; border: 1.5px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-lg);
  max-height: 236px; overflow: auto; list-style: none; margin: 0; padding: 5px;
}
.qb-ac-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.qb-ac-list li:hover { background: #FFF3EB; }
.qb-ac-list li b { display: block; font: 600 13px Inter, sans-serif; color: var(--text); }
.qb-ac-list li small { color: var(--muted); font-size: 11.5px; }

/* drawer */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 100vw);
  background: #fff; z-index: 50; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: slideIn .32s var(--ease) both;
}
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } }
.drawer.closing { animation: slideOut .22s var(--ease) both; }
@keyframes slideOut { to { transform: translateX(70px); opacity: 0; } }
.d-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); position: relative; }
.d-head .x { position: absolute; top: 14px; right: 14px; font-size: 24px; color: var(--muted); padding: 3px 9px; border-radius: 9px; }
.d-head .x:hover { background: #f3f0e9; }
.d-top { display: flex; gap: 13px; align-items: center; }
.d-top .avatar { width: 46px; height: 52px; flex-basis: 46px; font-size: 15px; }
.d-top h3 { font-size: 18px; color: var(--ink); }
.d-top .d-sub { color: var(--muted); font-size: 12.5px; }
.d-quick { display: flex; gap: 8px; margin-top: 15px; }
.d-quick a, .d-quick button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px; border-radius: 10px; font: 600 12.5px Inter;
  border: 1.5px solid var(--line); color: var(--text); text-decoration: none;
  transition: .15s;
}
.d-quick a:hover, .d-quick button:hover { border-color: #d8d2c5; background: #FBF8F2; }
.d-quick .wa { color: #128C4B; border-color: #BFE6CF; background: #F0FAF4; }
.d-quick .wa:hover { background: #E3F5EA; }
.d-quick .quote-btn { color: var(--ember-deep); border-color: #F6CDB2; background: #FFF6EF; }
.d-quick .quote-btn:hover { background: #FDEBDD; }
.d-body { flex: 1; overflow-y: auto; padding: 18px 24px; }
.d-section { margin-bottom: 22px; }
.d-section > label { font: 700 10.5px Inter; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 10px; }

/* status stepper (hex, signature) */
.stepper { display: flex; justify-content: space-between; position: relative; padding: 2px 2px 0; }
.step { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 1; position: relative; cursor: pointer; }
.step:not(:last-child)::after { content: ''; position: absolute; top: 15px; left: calc(50% + 20px); right: calc(-50% + 20px); border-top: 2px dotted #ddd7cb; }
.step .s-hex {
  width: 30px; height: 34px; clip-path: var(--hexagon);
  background: #ECE8DE; color: #A5A199; display: grid; place-items: center;
  font: 700 11px Inter; position: relative; z-index: 1;
  transition: .22s var(--ease);
}
.step:hover .s-hex { transform: scale(1.05); }
.step label { font: 600 9.5px Inter; color: var(--muted); cursor: pointer; }
.step.done .s-hex { background: #DCEEE2; color: var(--st-won); }
.step.now .s-hex { background: var(--grad-flame); color: #fff; transform: scale(1.06); }
.step.now label { color: var(--ember-deep); }
.step.lost-btn .s-hex { background: #f4f2ee; }
.step.lost.now .s-hex { background: var(--st-lost); box-shadow: none; }

.d-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; font-size: 13px; }
.d-info div label { display: block; font: 600 10.5px Inter; color: var(--muted); }
.d-info div b { font-weight: 600; }
.d-notes textarea { width: 100%; min-height: 68px; resize: vertical; }
.d-notes .save-note { margin-top: 8px; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 8px; border-left: 2px dotted #ddd7cb; }
.t-item { position: relative; padding-bottom: 14px; }
.t-item::before { content: ''; position: absolute; left: -19px; top: 5px; width: 10px; height: 11px; clip-path: var(--hexagon); background: var(--ember); }
.t-item.type-created::before { background: var(--st-survey); }
.t-item.type-note::before { background: var(--ink); }
.t-item p { font-size: 12.5px; }
.t-item small { color: var(--muted); font-size: 11px; }

/* ================================================================
   Toasts
   ================================================================ */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; gap: 12px; align-items: flex-start;
  width: 330px; background: #26262B; color: #fff;
  border-radius: 14px; padding: 13px 15px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .38s var(--ease) both;
  cursor: pointer;
}
.toast.out { animation: toastOut .3s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.95); } }
.toast .t-hex { width: 32px; height: 36px; clip-path: var(--hexagon); background: var(--grad-flame); display: grid; place-items: center; flex: 0 0 32px; font-size: 15px; }
.toast b { font: 600 13.5px Inter; display: block; }
.toast p { font-size: 12.5px; color: #C3C1C9; }

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 1120px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-cols { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(6, 240px); }
}
@media (max-width: 860px) {
  .sidebar { width: 64px; flex-basis: 64px; padding: 18px 8px 12px; }
  .side-brand .wordmark, .side-nav a { font-size: 0; }
  .side-nav a { justify-content: center; padding: 12px; gap: 0; }
  .side-nav a svg { width: 20px; height: 20px; }
  .side-testform .ext, .side-user div { display: none; }
  .side-brand { justify-content: center; padding-bottom: 18px; }
  .side-foot { flex-direction: column; }
  .search input { width: 130px; }
  .search input:focus { width: 170px; }
  .quote-builder { grid-template-columns: 1fr; }
  .maint-cols { grid-template-columns: 1fr; }
  .notif-panel { right: 12px; left: 12px; width: auto; }
}

/* ---------- phones: bottom tab bar ---------- */
@media (max-width: 640px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; flex: none; flex-direction: row; align-items: center;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
    background: #26262B; z-index: 35;
    border-top: 1px solid #3a3a41;
  }
  .side-brand, .side-foot { display: none; }
  .side-nav { flex-direction: row; flex: 1; gap: 2px; }
  .side-nav a {
    flex: 1 1 0; flex-direction: column; justify-content: center; gap: 3px;
    padding: 7px 2px; font-size: 10px; border-radius: 10px;
  }
  .side-nav a svg { width: 21px; height: 21px; }
  .side-nav a.active { background: none; color: var(--flame); font-weight: 600; }
  .side-nav a.active svg { fill: var(--flame); }
  .side-testform { margin-top: 0; border: 1.5px dashed transparent; }
  .side-testform .ext { display: none; }
  .side-nav a { font-size: 9.5px; padding: 7px 1px; }
  .side-nav a svg { width: 19px; height: 19px; }

  /* maintenance: compact month grid + stacked due rows */
  .maint-cols { grid-template-columns: 1fr; }
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 52px; padding: 3px; border-radius: 7px; }
  .cal-chip { font-size: 8px; padding: 2px 3px; }
  .cal-legend { font-size: 10px; }
  .due-item { flex-wrap: wrap; }
  .due-act { width: 100%; justify-content: flex-end; }

  .main { height: 100dvh; padding-bottom: 0; }
  .view { padding: 14px 14px calc(78px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar h2 { font-size: 17px; }
  .search { flex: 1; min-width: 0; }
  .search input, .search input:focus { width: 100%; }
  .topbar-right { flex: 1; justify-content: flex-end; }
  #new-lead-btn { font-size: 0; gap: 0; padding: 10px 12px; }
  #new-lead-btn svg { width: 18px; height: 18px; }

  .notif-panel { top: 56px; right: 10px; left: 10px; width: auto; max-height: 55dvh; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 13px 14px 12px; }
  .stat-card .num { font-size: 23px; }
  .hex-pipe { overflow-x: auto; gap: 4px; padding-bottom: 6px; }
  .hex-node { width: 38px; height: 43px; font-size: 13px; }
  .hex-step label { font-size: 9.5px; white-space: nowrap; }
  .hex-step:not(:last-child)::after { top: 21px; left: calc(50% + 25px); right: calc(-50% + 25px); }
  .panel { padding: 14px 14px; }

  .board { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; padding-bottom: 16px; }
  .col { flex: 0 0 78vw; scroll-snap-align: start; }
  .ltable { display: block; overflow-x: auto; white-space: nowrap; }

  .drawer { width: 100vw; }
  .modal, .modal-wide { width: calc(100vw - 20px); max-height: calc(100dvh - 32px); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .qb-right { min-height: 300px; }
  .toasts { left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); }
  .toast { width: auto; }
}
