/* ============================================================
   Closer War Room - styles.css
   SystemShift dark variant. Color tokens from DESIGN.md §3.
   Type scale from §4. Spacing from §5.
   ============================================================ */

/* ---------- Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---------- Color tokens ---------- */
:root {
  --bg-base:           #0b0d12;
  --bg-raised:         #12151c;
  --bg-sunken:         #0e1117;
  --border-hair:       rgba(255,255,255,0.08);
  --border-hair-strong:rgba(255,255,255,0.14);
  --text-primary:      #F4F6F8;
  --text-secondary:    #AEB6C2;
  --text-muted:        #6B7480;
  --accent:            #0FDFD8;
  --accent-dim:        rgba(15,223,216,0.14);
  --accent-ink:        #0b0d12;
  --ok:                #0FDFD8;
  --warn:              #E0B341;
  --error:             #E5736B;

  /* Spacing */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  /* Radii */
  --r-card:  16px;
  --r-chip:  10px;
  --r-btn:   10px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ============================================================
   SHELL GRID
   ============================================================ */
.shell {
  display: grid;
  grid-template-rows: 64px auto 1fr;
  grid-template-areas:
    "topbar"
    "query"
    "main";
  min-height: 100dvh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--s5);
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  grid-area: topbar;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--s4);
  height: 64px;
  padding: var(--s4) 0;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-hair);
}

.topbar-brand {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-shrink: 0;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.connected    { background: var(--ok); }
.status-dot.reconnecting { background: var(--warn); animation-duration: 1s; }
.status-dot.offline      { background: transparent; border: 1.5px solid var(--text-muted); animation: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.status-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.topbar-spacer { flex: 1; }

/* Vertical selector */
.topbar-vertical {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-shrink: 0;
}

.topbar-vertical label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.vertical-select {
  appearance: none;
  background: var(--bg-sunken) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7480' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--border-hair);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--s2) 32px var(--s2) var(--s3);
  border-radius: var(--r-chip);
  cursor: pointer;
  transition: border-color 0.15s;
  min-width: 180px;
}

.vertical-select:hover  { border-color: var(--border-hair-strong); }
.vertical-select:focus  {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.vertical-select option { background: var(--bg-sunken); color: var(--text-primary); }

/* ============================================================
   QUERY ZONE
   ============================================================ */
.query-zone {
  grid-area: query;
  position: sticky;
  top: 64px;
  z-index: 90;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-hair);
  padding: var(--s5) 0;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

/* Input wrapper */
.query-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-sunken);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-card);
  height: 64px;
  padding: 0 var(--s2) 0 var(--s5);
  transition: border-color 0.15s;
}

.query-input-wrap:focus-within {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.query-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.3;
  caret-color: var(--accent);
}

.query-input::placeholder { color: var(--text-muted); }

/* Prospect lookup inline affordance */
.prospect-lookup {
  display: flex;
  align-items: center;
  gap: var(--s1);
  flex-shrink: 0;
  padding: 0 var(--s3);
}

.prospect-lookup.hidden { display: none; }

.prospect-input {
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-hair);
  outline: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--s2) var(--s3);
  width: 140px;
}

.prospect-input::placeholder { color: var(--text-muted); }

/* Send button */
.send-btn {
  flex-shrink: 0;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--r-btn);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  height: 44px;
  padding: 0 var(--s5);
  opacity: 0.6;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
  min-width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn.active { opacity: 1; }
.send-btn:hover  { opacity: 1; }
.send-btn:active { transform: scale(0.97); }
.send-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Shimmer dots inside Send during submit */
.send-shimmer {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.send-shimmer span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-ink);
  animation: shimmer-dot 0.9s ease-in-out infinite;
}

.send-shimmer span:nth-child(2) { animation-delay: 0.15s; }
.send-shimmer span:nth-child(3) { animation-delay: 0.30s; }

@keyframes shimmer-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%            { opacity: 1;   transform: translateY(-3px); }
}

/* Example hint */
.query-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding-left: var(--s2);
}

.query-hint:hover { color: var(--text-secondary); }

/* Chip row */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-raised);
  border: 1px solid var(--border-hair);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--r-chip);
  height: 44px;
  padding: 0 var(--s4);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  position: relative;
  white-space: nowrap;
}

.chip:hover  { background: var(--accent-dim); border-color: var(--border-hair-strong); }
.chip:active { background: var(--accent); color: var(--accent-ink); transform: scale(0.98); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chip.chip-active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.chip.chip-loading {
  background: var(--accent);
  color: var(--accent-ink);
  overflow: hidden;
}

.chip.chip-loading::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: chip-shimmer 1.4s linear infinite;
}

@keyframes chip-shimmer {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(400%); }
}

/* Last-used underline */
.chip.chip-last-used {
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

/* ============================================================
   MAIN AREA (answer column + pricing rail)
   ============================================================ */
.main-area {
  grid-area: main;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0;
  align-items: start;
}

/* ============================================================
   ANSWER COLUMN
   ============================================================ */
.answer-col {
  padding: var(--s6) var(--s5) var(--s7) 0;
  min-height: 400px;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s7) var(--s5);
  text-align: center;
  gap: var(--s4);
}

.empty-icon {
  width: 48px;
  height: 48px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.empty-icon svg { stroke: var(--accent); }

.empty-headline {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 440px;
}

/* ============================================================
   ANSWER GROUP
   ============================================================ */
.answer-group {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  animation: answer-mount 0.2s ease-out both;
}

.answer-group.answer-prev {
  opacity: 0.55;
  pointer-events: none;
  margin-top: var(--s6);
}

@keyframes answer-mount {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Phase line */
.phase-line {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Cards */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-card);
  padding: var(--s5);
}

.card-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s3);
}

/* Reframe card */
.card-reframe .card-body {
  font-size: clamp(1.75rem, 2.4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Proof card */
.card-proof .card-body {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Next line card */
.card-nextline {
  background: var(--accent-dim);
  border: 1px solid var(--border-hair);
  border-left: 2px solid var(--accent);
  position: relative;
}

.card-nextline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s3);
}

.card-nextline .card-body {
  font-size: clamp(1.25rem, 1.7vw, 1.5rem);
  font-weight: 600;
  font-style: italic;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* Copy button */
.copy-btn {
  background: transparent;
  border: 1px solid var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: var(--s1) var(--s3);
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.copy-btn.copied { color: var(--accent); border-color: var(--accent); }

/* Quick links */
.quick-links {
  display: flex;
  gap: var(--s5);
  padding-top: var(--s2);
}

.quick-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(15,223,216,0.4);
}

.quick-link:hover { text-decoration-color: var(--accent); }
.quick-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Disclosure panel */
.disclosure {
  background: var(--bg-raised);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-card);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.18s ease-out, padding 0.18s;
}

.disclosure.open {
  max-height: 400px;
  padding: var(--s5);
}

.disclosure-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s3);
}

.disclosure ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.disclosure li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.45;
  padding-left: var(--s4);
  position: relative;
}

.disclosure li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ============================================================
   SKELETON LOADER
   ============================================================ */
.skeleton-group {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.skeleton-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-card);
  padding: var(--s5);
  overflow: hidden;
  position: relative;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.05) 50%,
    transparent 100%
  );
  animation: skeleton-sweep 1.4s linear infinite;
}

@keyframes skeleton-sweep {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

.skeleton-label {
  width: 80px;
  height: 10px;
  background: var(--bg-sunken);
  border-radius: 4px;
  margin-bottom: var(--s3);
}

.skeleton-line {
  height: 14px;
  background: var(--bg-sunken);
  border-radius: 4px;
  margin-bottom: var(--s2);
}

.skeleton-line.wide  { width: 100%; }
.skeleton-line.med   { width: 78%; }
.skeleton-line.short { width: 55%; }

.skeleton-line.tall  { height: 32px; }
.skeleton-line.tall2 { height: 28px; }

/* ============================================================
   INLINE ERROR
   ============================================================ */
.inline-error {
  border-left: 2px solid var(--error);
  padding: var(--s3) var(--s4);
  border-radius: 0 var(--r-chip) var(--r-chip) 0;
  background: rgba(229,115,107,0.08);
  margin-top: var(--s4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}

.inline-error-text {
  font-size: 0.9375rem;
  color: var(--error);
  line-height: 1.4;
}

.retry-btn {
  background: transparent;
  border: 1px solid var(--error);
  border-radius: var(--r-chip);
  color: var(--error);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: var(--s1) var(--s3);
  white-space: nowrap;
  flex-shrink: 0;
}

.retry-btn:hover { background: rgba(229,115,107,0.12); }

.query-error {
  font-size: 0.875rem;
  color: var(--error);
  padding-left: var(--s2);
}

/* ============================================================
   PRICING RAIL (right sidebar >= 1200px)
   ============================================================ */
.pricing-rail {
  background: var(--bg-sunken);
  border-left: 1px solid var(--border-hair);
  padding: var(--s5);
  position: sticky;
  top: calc(64px + var(--s8));  /* topbar + query zone approx */
  align-self: start;
  min-height: 300px;
}

.pricing-rail-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--s5);
}

.pricing-tier {
  padding: var(--s5) 0;
  border-top: 1px solid var(--border-hair);
}

.pricing-tier:first-of-type { border-top: none; padding-top: 0; }

.pricing-tier-name {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--s2);
}

.pricing-setup {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: "tnum";
  line-height: 1.2;
}

.pricing-setup .from-word {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pricing-monthly {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-top: var(--s1);
  font-feature-settings: "tnum";
}

/* Never skip block */
.never-skip {
  margin-top: var(--s5);
  padding-top: var(--s5);
  border-top: 1px solid var(--border-hair);
}

.never-skip-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--s3);
}

.never-skip ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.never-skip li {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
  padding-left: var(--s4);
  position: relative;
}

.never-skip li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ============================================================
   PRICING FOOTER (< 1200px)
   ============================================================ */
.pricing-footer {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 80;
  background: var(--bg-sunken);
  border-top: 1px solid var(--border-hair);
  height: 72px;
  padding: 0 var(--s5);
  align-items: center;
  gap: var(--s5);
  overflow: hidden;
}

.pricing-footer-tiers {
  display: flex;
  gap: var(--s5);
  flex: 1;
  overflow: hidden;
  align-items: center;
}

.footer-tier {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.footer-tier-name {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.footer-tier-price {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

.footer-tier-mo {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.reminders-toggle {
  background: transparent;
  border: 1px solid var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: var(--s2) var(--s3);
  white-space: nowrap;
  flex-shrink: 0;
}

.reminders-toggle:hover { border-color: var(--border-hair-strong); color: var(--text-secondary); }

.reminders-panel {
  position: fixed;
  bottom: 72px;
  left: 0;
  right: 0;
  background: var(--bg-sunken);
  border-top: 1px solid var(--border-hair);
  padding: var(--s4) var(--s5);
  display: none;
  gap: var(--s3);
  flex-direction: column;
  z-index: 79;
}

.reminders-panel.open { display: flex; }

.reminders-panel li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  list-style: none;
  padding-left: var(--s4);
  position: relative;
}

.reminders-panel li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Laptop: 1024 to 1199 */
@media (max-width: 1199px) {
  .main-area {
    grid-template-columns: 1fr;
    padding-bottom: 80px;
  }

  .pricing-rail    { display: none; }
  .pricing-footer  { display: flex; }

  .answer-col { padding: var(--s5) 0 var(--s7); }
}

/* Small laptop / tablet: 768 to 1023 */
@media (max-width: 1023px) {
  .shell { padding: 0 var(--s4); }
}

/* Phone: < 768 */
@media (max-width: 767px) {
  .shell { padding: 0 var(--s4); }

  .topbar-brand { font-size: 0.9375rem; }
  .status-label { display: none; }

  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding-bottom: var(--s3);
    gap: var(--s2);
  }

  .topbar-vertical {
    width: 100%;
    flex-wrap: wrap;
  }

  .vertical-select { flex: 1; min-width: 0; }

  .chips-row { gap: var(--s2); }

  .chip {
    flex: 1 1 calc(50% - var(--s1));
    min-width: 0;
    font-size: 0.875rem;
  }

  .pricing-footer-tiers { gap: var(--s4); }

  .footer-tier-price { font-size: 0.875rem; }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: var(--s5);
}

.login-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-card);
  padding: var(--s7) var(--s6);
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.login-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.login-sub {
  font-size: 0.9375rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: calc(-1 * var(--s3));
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.login-field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.login-input {
  background: var(--bg-sunken);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  padding: var(--s3) var(--s4);
  outline: none;
  transition: border-color 0.15s;
}

.login-input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.login-btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--r-btn);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: var(--s3) var(--s4);
  transition: opacity 0.15s;
}

.login-btn:hover { opacity: 0.9; }
.login-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.login-error {
  font-size: 0.875rem;
  color: var(--error);
  text-align: center;
  display: none;
}

.login-error.visible { display: block; }

/* ============================================================
   CLOSE-THE-DEAL PANEL
   ============================================================ */

/* Topbar button */
.close-panel-btn {
  flex-shrink: 0;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--r-btn);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  height: 36px;
  padding: 0 var(--s4);
  letter-spacing: 0.04em;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.close-panel-btn:hover { opacity: 0.88; }
.close-panel-btn:active { opacity: 0.76; }
.close-panel-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Overlay panel */
.close-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(11,13,18,0.72);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 64px 0 0 0;
  backdrop-filter: blur(4px);
}

.close-panel[hidden] { display: none; }

.close-panel-inner {
  background: var(--bg-raised);
  border-left: 1px solid var(--border-hair);
  width: 480px;
  max-width: 100vw;
  height: calc(100dvh - 64px);
  overflow-y: auto;
  padding: var(--s6) var(--s6) var(--s7);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

/* Panel header */
.close-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s2);
}

.close-panel-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.close-panel-dismiss {
  background: transparent;
  border: 1px solid var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.close-panel-dismiss:hover { color: var(--text-primary); border-color: var(--border-hair-strong); }
.close-panel-dismiss:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Form layout */
.close-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s3);
}

.close-form-field {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.close-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.close-label-hint {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.close-input {
  background: var(--bg-sunken);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: var(--s3) var(--s4);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.close-input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.close-input::placeholder { color: var(--text-muted); }

.close-select {
  appearance: none;
  background: var(--bg-sunken) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7480' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: var(--s3) 36px var(--s3) var(--s4);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  width: 100%;
}

.close-select:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.close-select option { background: var(--bg-sunken); color: var(--text-primary); }

.close-textarea {
  background: var(--bg-sunken);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: var(--s3) var(--s4);
  outline: none;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
  transition: border-color 0.15s;
  width: 100%;
}

.close-textarea:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.close-textarea::placeholder { color: var(--text-muted); }

/* Line items */
.cp-line-items {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.cp-line-item-row {
  display: grid;
  grid-template-columns: 1fr 100px auto;
  gap: var(--s2);
  align-items: center;
}

.cp-line-item-name {
  background: var(--bg-sunken);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  padding: var(--s2) var(--s3);
  outline: none;
  transition: border-color 0.15s;
}

.cp-line-item-name:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }

.cp-line-item-amount {
  background: var(--bg-sunken);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  padding: var(--s2) var(--s3);
  outline: none;
  width: 100%;
  text-align: right;
  transition: border-color 0.15s;
}

.cp-line-item-amount:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }

.cp-line-item-remove {
  background: transparent;
  border: 1px solid var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}

.cp-line-item-remove:hover { color: var(--error); border-color: var(--error); }

.cp-add-item-btn {
  background: transparent;
  border: 1px dashed var(--border-hair);
  border-radius: var(--r-chip);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: var(--s2) var(--s4);
  margin-top: var(--s2);
  width: 100%;
  transition: color 0.15s, border-color 0.15s;
}

.cp-add-item-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Action buttons */
.close-actions {
  display: flex;
  gap: var(--s3);
  flex-wrap: wrap;
}

.close-btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--r-btn);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  padding: var(--s3) var(--s5);
  transition: opacity 0.15s;
  white-space: nowrap;
}

.close-btn-primary:hover { opacity: 0.88; }
.close-btn-primary:active { opacity: 0.76; }
.close-btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.close-btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.close-btn-secondary {
  background: var(--bg-sunken);
  color: var(--text-secondary);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-btn);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  padding: var(--s3) var(--s5);
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.close-btn-secondary:hover { border-color: var(--border-hair-strong); color: var(--text-primary); }
.close-btn-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Status line */
.cp-status-line {
  font-size: 0.9375rem;
  line-height: 1.45;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-chip);
  background: var(--bg-sunken);
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
}

.cp-status-line[hidden] { display: none; }
.cp-status-line.ok { border-left-color: var(--ok); }
.cp-status-line.err { border-left-color: var(--error); color: var(--error); }

/* Proposal HTML preview */
.cp-proposal-preview {
  border: 1px solid var(--border-hair);
  border-radius: var(--r-card);
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.cp-proposal-preview[hidden] { display: none; }

.cp-proposal-preview iframe {
  width: 100%;
  min-height: 300px;
  border: none;
  display: block;
}

/* Invoice preview */
.cp-invoice-preview-wrap[hidden] { display: none; }

.close-panel-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--s3);
}

.cp-invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: var(--s4);
}

.cp-invoice-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--border-hair);
}

.cp-invoice-table th:last-child,
.cp-invoice-table td:last-child { text-align: right; }

.cp-invoice-table td {
  padding: var(--s3);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-hair);
  vertical-align: top;
}

.cp-invoice-table tfoot td {
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: none;
  border-top: 1px solid var(--border-hair-strong);
}

.cp-invoice-total-label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.cp-invoice-total-val { font-size: 1.0625rem; color: var(--accent); }

/* Responsive */
@media (max-width: 540px) {
  .close-panel-inner { padding: var(--s4); }
  .close-form-row { grid-template-columns: 1fr; }
  .close-panel { padding-top: 0; }
  .close-panel-inner { height: 100dvh; }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}
