/* SolarFlow AI POC — shared component library (ported + re-themed + solar additions) */

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-h); padding: 0 18px; border-radius: var(--r-m); border: 1.5px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--ink); text-decoration: none !important;
  transition: background 150ms ease, box-shadow 150ms ease, border-color 150ms ease, transform 160ms var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn-pri { background: var(--green-700); color: #fff; }
.btn-pri:hover { background: var(--green-800); }
.btn-gold { background: var(--leaf); color: #3a2400; border-color: var(--leaf-deep); }
.btn-gold:hover { background: var(--leaf-deep); color: #fff; }
.btn-ghost { border-color: var(--line); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--mut-2); }
.btn-soft { background: var(--green-50); color: var(--green-700); border-color: var(--green-150); }
.btn-soft:hover { background: var(--green-100); }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red-bd); }
.btn-danger:hover { background: #f6dcd8; }
.btn-lg { min-height: var(--tap-lg); padding: 0 24px; font-size: 15.5px; border-radius: var(--r-m); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: var(--r-s); }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn.is-disabled {
  background: var(--line-2); color: var(--mut-2); border-color: var(--line);
  cursor: not-allowed; box-shadow: none;
}
.btn[disabled]:active, .btn.is-disabled:active { transform: none; }
.btn .ic { width: 16px; height: 16px; }

/* ============ PILLS (status) ============ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  padding: 2.5px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-new       { color: var(--slate);  background: var(--slate-bg);  border-color: var(--slate-bd); }
.pill-review    { color: var(--amber);  background: var(--amber-bg);  border-color: var(--amber-bd); }
.pill-approved  { color: var(--green-700); background: var(--green-50); border-color: var(--green-150); }
.pill-packed    { color: var(--indigo); background: var(--indigo-bg); border-color: var(--indigo-bd); }
.pill-assigned  { color: var(--cyan);   background: var(--cyan-bg);   border-color: var(--cyan-bd); }
.pill-delivered { color: var(--teal);   background: var(--teal-bg);   border-color: var(--teal-bd); }
.pill-completed { color: #fff; background: var(--green-700); border-color: var(--green-700); }
.pill-cancelled { color: var(--red); background: transparent; border-color: var(--red-bd); }
/* status aliases used across solar screens */
.pill-active    { color: var(--green-700); background: var(--green-50); border-color: var(--green-150); }
.pill-warning   { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-bd); }
.pill-hold      { color: #fff; background: var(--red); border-color: var(--red); }
.pill-synced { color: var(--green-700); background: var(--green-50); border-color: var(--green-150); }
.pill-queued { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-bd); }
.pill-failed { color: var(--red); background: var(--red-bg); border-color: var(--red-bd); }
.pill-gold   { color: var(--leaf-deep); background: #FFF6E6; border-color: var(--solar-300); }

/* ============ CHIPS & BADGES ============ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; padding: 3px 9px;
  border-radius: var(--r-s); background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap;
}
.chip .ic { width: 13px; height: 13px; color: var(--mut); }
.chip-green { background: var(--green-50); border-color: var(--green-150); color: var(--green-800); }
.chip-green .ic { color: var(--green-700); }
.chip-gold { background: #FFF6E6; border-color: var(--solar-300); color: var(--leaf-deep); }
.chip-gold .ic { color: var(--leaf-deep); }
.chip-amber { background: var(--amber-bg); border-color: var(--amber-bd); color: var(--amber); }
.chip-amber .ic { color: var(--amber); }
.chip-red { background: var(--red-bg); border-color: var(--red-bd); color: var(--red); }
.chip-red .ic { color: var(--red); }
.chip-blue { background: var(--blue-bg); border-color: var(--blue-bd); color: var(--blue); }
.chip-blue .ic { color: var(--blue); }
.chip-mono { font-family: var(--mono); font-size: 11.5px; }
.count-badge {
  display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px;
  align-items: center; justify-content: center; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: var(--green-700); color: #fff;
}
.count-badge.amber { background: var(--amber); }
.count-badge.red { background: var(--red); }
.count-badge.gray { background: var(--mut-2); }
.count-badge.gold { background: var(--leaf-deep); }

/* ============ CARDS ============ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); box-shadow: var(--sh-1);
}
.card-p { padding: 16px; }
.card-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-2);
}
.card-h h3 { font-size: 13px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-2); }
.card-h .more { font-size: 12.5px; font-weight: 600; }

/* KPI card */
.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; position: relative; overflow: hidden; }
.kpi .k-label { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--mut); display:flex; align-items:center; gap:6px; }
.kpi .k-num { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--ink); }
.kpi .k-sub { font-size: 12px; color: var(--mut); }
.kpi .k-edge { position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--line); }
.kpi.is-link { cursor: pointer; transition: box-shadow .15s, border-color .15s; text-decoration: none !important; color: inherit; }
.kpi.is-link:hover { box-shadow: var(--sh-2); border-color: var(--green-150); }

/* ============ BANNERS ============ */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--r-m); border: 1px solid;
  font-size: 13px; line-height: 1.45;
}
.banner .ic { width: 17px; height: 17px; margin-top: 1px; flex: none; }
.banner b { font-weight: 700; }
.banner-info { background: var(--blue-bg); border-color: var(--blue-bd); color: var(--blue); }
.banner-warn { background: var(--amber-bg); border-color: var(--amber-bd); color: var(--amber); }
.banner-danger { background: var(--red-bg); border-color: var(--red-bd); color: var(--red); }
.banner-success { background: var(--green-50); border-color: var(--green-150); color: var(--green-800); }
.banner-ai { background: linear-gradient(100deg, #EEF3FF, #F5EFFF); border-color: #D5DDFA; color: #3B3A8C; }
.banner-ai .ic { color: var(--green-600); }

/* ============ TABLES ============ */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--mut); padding: 9px 12px;
  border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
.tbl td { padding: 14px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:nth-child(even) { background: var(--surface-2); }
.tbl tbody tr:hover { background: var(--green-50); }
.tbl tbody tr.is-click { cursor: pointer; }
.tbl tbody tr.is-click:active { background: var(--green-100); }
.tbl .num { text-align: right; font-family: var(--mono); font-size: 12.5px; }
.tbl th.num { font-family: var(--sans); }
.tbl tr.is-dim td { opacity: .5; }
.tbl tr.is-total td { font-weight: 700; background: var(--green-50); border-top: 1.5px solid var(--green-150); }
.tbl-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 12.5px; color: var(--mut); border-top: 1px solid var(--line-2); }

/* ============ TABS ============ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line-2); overflow-x: auto; }
.tab {
  appearance: none; background: none; border: 0; cursor: pointer; min-height: 48px;
  padding: 0 16px; font-size: 14px; font-weight: 600; color: var(--mut);
  border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none !important;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--green-700); border-bottom-color: var(--green-700); }
.tab .count-badge { background: var(--line); color: var(--ink-2); }
.tab.is-active .count-badge { background: var(--green-700); color: #fff; }
[data-tab-panel] { display: none; }
[data-tab-panel].is-active { display: block; }
[data-step-panel] { display: none; }
[data-step-panel].is-active { display: block; }

/* ============ STEPPER (lifecycle) ============ */
.stepper { display: flex; align-items: flex-start; }
.step { flex: 1; min-width: 0; position: relative; text-align: center; padding-top: 4px; }
.step::before {
  content: ""; position: absolute; top: 15px; left: -50%; right: 50%;
  height: 2px; background: var(--line);
}
.step:first-child::before { display: none; }
.step.is-done::before, .step.is-current::before { background: var(--green-600); }
.step .s-dot {
  position: relative; z-index: 1; width: 22px; height: 22px; margin: 0 auto;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.step.is-done .s-dot { background: var(--green-600); border-color: var(--green-600); }
.step.is-current .s-dot { border-color: var(--green-600); background: var(--surface); }
.step.is-current .s-dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green-600); }
.step.is-blocked .s-dot { border-color: var(--red); background: var(--red-bg); }
.step .s-dot .ic { width: 12px; height: 12px; }
.step .s-name { margin-top: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.step .s-time { font-family: var(--mono); font-size: 10.5px; color: var(--mut-2); margin-top: 1px; }
.step.is-off .s-name, .step.is-off .s-time { color: var(--mut-2); }

/* ============ CONFIDENCE BAR ============ */
.conf { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.conf .conf-track { flex: 1; height: 5px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.conf .conf-fill { height: 100%; border-radius: 4px; background: var(--green-600); transition: width .8s var(--ease-out); }
.conf.is-low .conf-fill { background: var(--amber); }
.conf .conf-val { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--mut); width: 34px; text-align: right; }
.conf.is-low .conf-val { color: var(--amber); }

/* ============ AI CHAT THREAD (new — distinct from WhatsApp) ============ */
.ai-thread {
  background:
    radial-gradient(700px 320px at 90% -40px, rgba(37,99,235,.05), transparent 60%),
    radial-gradient(600px 300px at -10% 110%, rgba(245,166,35,.06), transparent 55%),
    var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.ai-msg { display: flex; gap: 10px; align-items: flex-start; max-width: 92%; }
.ai-msg.is-user { margin-left: auto; flex-direction: row-reverse; }
.ai-av {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; color: #fff;
}
.ai-av.bot { background: linear-gradient(150deg, var(--green-600), #6D5BD0); }
.ai-av.bot .ic { width: 17px; height: 17px; }
.ai-av.me { background: var(--ink-2); font-size: 11px; font-weight: 700; }
.ai-bubble {
  position: relative; padding: 11px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.5; overflow-wrap: break-word;
}
.ai-bubble.is-assistant { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 4px; box-shadow: var(--sh-1); }
.ai-bubble.is-user { background: var(--green-700); color: #fff; border-top-right-radius: 4px; }
.ai-bubble.is-user a { color: #fff; }
.ai-bubble p + p { margin-top: 8px; }
.ai-bubble .ai-cite { margin-top: 9px; display: flex; gap: 8px; flex-wrap: wrap; }
.ai-enter { animation: ai-rise 320ms var(--ease-out) backwards; }
@keyframes ai-rise { from { opacity: 0; transform: translateY(8px); } }
/* typing dots */
.ai-typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--mut-2); display: inline-block; animation: ai-blink 1.2s infinite ease-in-out; }
.ai-typing i:nth-child(2) { animation-delay: .18s; }
.ai-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes ai-blink { 0%,80%,100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ============ REVEAL (savings card / generated result) ============ */
.reveal { animation: reveal-pop 460ms var(--ease-out) backwards; }
@keyframes reveal-pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.is-hidden { display: none !important; }

/* big headline stat (savings reveal) */
.stat-big { display: flex; flex-direction: column; gap: 2px; }
.stat-big .v { font-family: var(--serif); font-size: 34px; font-weight: 700; line-height: 1.05; }
.stat-big .v.gold { color: var(--leaf-deep); }
.stat-big .v.green { color: var(--green-700); }
.stat-big .l { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--mut); }

/* ============ SHIMMER (AI generating) ============ */
.shimmer { position: relative; overflow: hidden; background: var(--line-2); border-radius: 6px; }
.shimmer::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
  animation: shimmer 1.25s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.gen-line { height: 12px; margin: 9px 0; }

/* ============ TIER CARDS (Good / Better / Best) ============ */
.tier-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
@media (max-width: 880px) { .tier-grid { grid-template-columns: 1fr; } }
.tier-card {
  display: block; text-align: left; cursor: pointer; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--r-l); padding: 16px; position: relative;
  transition: border-color .15s, box-shadow .15s, transform .15s var(--ease-out);
}
.tier-card:hover { border-color: var(--green-150); transform: translateY(-2px); box-shadow: var(--sh-2); }
.tier-card.is-active { border-color: var(--green-700); box-shadow: 0 0 0 1px var(--green-700), var(--sh-2); }
.tier-card .tier-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--mut); }
.tier-card.is-active .tier-tag { color: var(--green-700); }
.tier-card .tier-size { font-family: var(--serif); font-size: 25px; font-weight: 700; margin-top: 6px; }
.tier-card .tier-best { position: absolute; top: -10px; right: 14px; }

/* ============ FINANCING COLUMNS ============ */
.fin-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; }
.fin-col.is-rec { border-color: var(--solar-300); box-shadow: 0 0 0 1px var(--solar-300), var(--sh-1); }
.fin-col .fin-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.fin-col .fin-big { font-family: var(--serif); font-size: 28px; font-weight: 700; margin: 8px 0 2px; }
.fin-col .fin-sub { font-size: 12px; color: var(--mut); }
.fin-col ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 7px; }
.fin-col li { font-size: 12.5px; color: var(--ink-2); padding-left: 20px; position: relative; }
.fin-col li .ic { position: absolute; left: 0; top: 2px; width: 13px; height: 13px; color: var(--green-600); }

/* ============ AVATARS ============ */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; letter-spacing: .02em;
}
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.av-1 { background: #2563EB; } .av-2 { background: #6D5BD0; } .av-3 { background: #0E7490; }
.av-4 { background: #B45309; } .av-5 { background: #0F766E; } .av-6 { background: #9333EA; }
.av-7 { background: #15803D; } .av-8 { background: #C2410C; }

/* ============ FORMS ============ */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--mut); }
.input, .select, .textarea {
  width: 100%; min-height: var(--control-h); padding: 10px 13px; border-radius: var(--r-m);
  border: 1.5px solid var(--line); background: var(--surface);
  font-size: 15px; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--green-600); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--mut-2); }
.textarea { resize: vertical; min-height: 70px; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235A6B82' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.search-box { position: relative; }
.search-box .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--mut-2); }
.search-box .input { padding-left: 38px; }

.check { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 9px; margin: -9px; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: #fff; transition: background .15s, border-color .15s; flex: none;
}
.check .box .ic { width: 16px; height: 16px; opacity: 0; }
.check input:checked + .box { background: var(--green-700); border-color: var(--green-700); }
.check input:checked + .box .ic { opacity: 1; }
.check input:focus-visible + .box { box-shadow: var(--ring); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 44px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .sw { width: 52px; height: 30px; border-radius: 999px; background: var(--line); position: relative; transition: background .18s; flex: none; }
.switch .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .18s; }
.switch input:checked + .sw { background: var(--green-600); }
.switch input:checked + .sw::after { left: 25px; }
.switch .sw-label { font-size: 14px; font-weight: 500; }

/* segmented control */
.seg { display: inline-flex; background: var(--line-2); border: 1px solid var(--line); border-radius: var(--r-m); padding: 4px; gap: 3px; }
.seg button {
  appearance: none; border: 0; background: transparent; cursor: pointer; min-height: 40px;
  padding: 0 16px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--mut);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform 120ms var(--ease-out);
}
.seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.seg button:active { transform: scale(.97); }

.chip-tap {
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 16px;
  border-radius: var(--r-pill); border: 1.5px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap;
  transition: transform 120ms var(--ease-out), background .15s, border-color .15s;
}
.chip-tap:hover { background: var(--surface-2); }
.chip-tap:active { transform: scale(.97); }
.chip-tap.is-active { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.chip-tap.is-active .count-badge { background: rgba(255,255,255,.25); color: #fff; }

/* ============ PROGRESS ============ */
.prog { height: 7px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.prog > span { display: block; height: 100%; border-radius: 6px; background: var(--green-600); transition: width .8s var(--ease-out); }
.prog.amber > span { background: var(--amber); }
.prog.gold > span { background: var(--leaf); }

/* ============ MODAL ============ */
.scrim {
  position: fixed; inset: 0; background: rgba(10,20,40,.5); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 80; padding: 20px;
}
.scrim.is-open { display: flex; }
.modal {
  width: 100%; max-width: 470px; background: var(--surface); border-radius: var(--r-l);
  box-shadow: var(--sh-2); overflow: hidden; animation: pop 200ms var(--ease-out);
}
.modal.wide { max-width: 580px; }
@keyframes pop { from { transform: scale(.96) translateY(6px); opacity: 0; } }
.modal-h { padding: 16px 20px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.modal-h h3 { font-family: var(--serif); font-size: 18px; }
.modal-b { padding: 12px 20px 4px; font-size: 13.5px; color: var(--ink-2); }
.modal-f { padding: 16px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.modal .x { appearance: none; border: 0; background: none; cursor: pointer; color: var(--mut); padding: 2px; }

/* ============ TOASTS ============ */
.toast-stack { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  display: flex; align-items: flex-start; gap: 9px; max-width: 360px;
  background: var(--green-950); color: #EAF0FF; font-size: 13px; line-height: 1.4;
  border-radius: var(--r-m); padding: 11px 14px; box-shadow: var(--sh-2);
  animation: toast-in 240ms var(--ease-out);
}
.toast .ic { width: 16px; height: 16px; margin-top: 1px; color: var(--leaf); flex: none; }
.toast.warn .ic { color: #F2CE8B; }
.toast.is-out { animation: toast-out 180ms ease forwards; }
@keyframes toast-in { from { transform: translateY(10px) scale(.98); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }

/* ============ STAGGERED ENTRANCE ============ */
.stagger > * { animation: rise 360ms var(--ease-out) backwards; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ============ TOOLTIPS ============ */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%;
  transform: translateX(-50%); z-index: 60; width: max-content; max-width: 240px;
  background: var(--green-950); color: #EAF0FF; font-size: 11.5px; font-weight: 500;
  line-height: 1.4; padding: 6px 9px; border-radius: 7px; box-shadow: var(--sh-2);
  pointer-events: none; white-space: normal; text-align: left;
}
[data-tip]:hover::before {
  content: ""; position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--green-950); z-index: 60;
}

/* ============ TIMELINE ============ */
.tline { list-style: none; padding: 0; position: relative; }
.tline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line-2); }
.tline li { position: relative; padding: 0 0 16px 30px; }
.tline li:last-child { padding-bottom: 0; }
.tline .t-dot { position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--green-600); }
.tline li.amber .t-dot { border-color: var(--amber); }
.tline li.gold .t-dot { border-color: var(--leaf); }
.tline li.red .t-dot { border-color: var(--red); }
.tline li.gray .t-dot { border-color: var(--mut-2); }
.tline .t-text { font-size: 13px; }
.tline .t-meta { font-size: 11.5px; color: var(--mut); font-family: var(--mono); margin-top: 1px; }

/* ============ NOTES ============ */
.note { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.note:last-child { border-bottom: 0; }
.note .n-body { flex: 1; min-width: 0; }
.note .n-head { display: flex; gap: 8px; align-items: baseline; }
.note .n-name { font-weight: 600; font-size: 13px; }
.note .n-role { font-size: 11px; color: var(--mut); }
.note .n-time { font-size: 11px; color: var(--mut-2); font-family: var(--mono); margin-left: auto; }
.note .n-text { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.note.is-auto .n-text { font-style: italic; color: var(--mut); }

/* ============ SLIDE PANEL ============ */
.panel-scrim { position: fixed; inset: 0; background: rgba(10,20,40,.35); display: none; z-index: 70; }
.panel-scrim.is-open { display: block; }
.slide-panel {
  position: fixed; top: 0; right: -520px; bottom: 0; width: 500px; max-width: 92vw;
  background: var(--surface); box-shadow: var(--sh-2); z-index: 71;
  transition: right .25s ease; display: flex; flex-direction: column;
}
.slide-panel.is-open { right: 0; }
.slide-panel .sp-h { padding: 18px 20px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; }
.slide-panel .sp-b { padding: 18px 20px; overflow-y: auto; flex: 1; }

/* ============ FILE ROWS ============ */
.file-row { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.file-row + .file-row { margin-top: 8px; }
.file-row .fr-ic { width: 34px; height: 34px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--mut); }
.file-row .fr-ic .ic { width: 17px; height: 17px; }
.file-row.is-ok .fr-ic { background: var(--green-50); color: var(--green-700); }
.file-row.is-missing { border-style: dashed; border-color: var(--mut-2); background: var(--surface-2); }
.file-row.is-missing .fr-ic { background: var(--surface); }
.file-row.is-flag { border-color: var(--amber-bd); background: #FFFDF6; }
.file-row.is-flag .fr-ic { background: var(--amber-bg); color: var(--amber); }
.file-row .f-name { font-weight: 600; font-size: 13.5px; }
.file-row .f-meta { font-size: 11.5px; color: var(--mut); margin-top: 1px; }

/* ============ DEFINITION ROWS ============ */
.def { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; }
.def dt { color: var(--mut); }
.def dd { margin: 0; font-weight: 500; }

/* ============ LEGEND ============ */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--mut); }
.legend .l-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* ============ EMPTY STATE ============ */
.empty { text-align: center; padding: 36px 20px; color: var(--mut); }
.empty .ic { width: 34px; height: 34px; margin: 0 auto 10px; color: var(--mut-2); }
.empty h4 { font-family: var(--serif); font-size: 16px; color: var(--ink-2); margin-bottom: 4px; }

/* ============ DROPDOWN MENU ============ */
.menu-wrap { position: relative; display: inline-block; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); min-width: 200px; z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  box-shadow: var(--sh-2); padding: 5px; display: none;
}
.menu.is-open { display: block; }
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; min-height: 46px;
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 0 12px; border-radius: 8px; font-size: 14px; color: var(--ink); text-decoration: none !important;
}
.menu button:hover, .menu a:hover { background: var(--green-50); }
.menu .ic { width: 17px; height: 17px; color: var(--mut); }
.kebab { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; cursor: pointer; color: var(--mut); border-radius: var(--r-m); flex: none; }
.kebab:hover { background: var(--surface-2); color: var(--ink); }
.kebab .ic { width: 20px; height: 20px; }

/* ============ MISC ============ */
.dot-sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--mut-2); margin: 0 7px; vertical-align: middle; }
.src-ic { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--mut); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px 10px; }
.src-ic .ic { width: 13px; height: 13px; color: var(--green-600); }

/* permission matrix */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .yes { color: var(--green-600); }
.matrix .no { color: var(--mut-2); }

/* "VIEWING AS" role switcher */
.role-switch { display: inline-flex; align-items: center; gap: 8px; }

/* hide elements per role */
body.role-coordinator [data-needs="admin"], body.role-installer [data-needs="admin"] { display: none !important; }

/* ============ SOLAR: roof / panel layout visual ============ */
.roof-art { background: linear-gradient(160deg, #1b2540, #0d1730); border-radius: var(--r-l); padding: 14px; position: relative; overflow: hidden; }
.panel-grid { display: grid; gap: 4px; }
.pv { background: linear-gradient(150deg, #2f6fe0, #14306b); border: 1px solid #4f86e8; border-radius: 3px; aspect-ratio: 1.7 / 1; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }

/* spec line list */
.spec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.spec-list li { display: flex; align-items: center; gap: 11px; font-size: 13.5px; }
.spec-list .sp-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--green-50); color: var(--green-700); display: flex; align-items: center; justify-content: center; flex: none; }
.spec-list .sp-ic .ic { width: 18px; height: 18px; }
.spec-list b { display: block; }
.spec-list .sp-sub { font-size: 11.5px; color: var(--mut); }

/* metric gauge wrapper */
.gauge-wrap { display: flex; align-items: center; gap: 16px; }
