/* DISCLOSURE (collapsible supporting section) */
/* Reuses .section-label on the <summary> so a folded section is visually the
   same heading it was when it was always-open — the only additions are the
   affordance (pointer + chevron) and the open/closed state. */
.disclosure { margin-bottom: 8px; }
.disclosure > summary {
  cursor: pointer; list-style: none; user-select: none;
  transition: color 0.15s, border-color 0.15s;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after {
  content: '⌄'; font-size: 14px; line-height: 1; margin-left: auto;
  transform: translateY(-3px); transition: transform 0.2s;
}
.disclosure[open] > summary::after { transform: translateY(1px) rotate(180deg); }
.disclosure > summary:hover { color: var(--text); border-bottom-color: var(--muted); }
.disclosure > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }
/* .section-label already carries a bottom margin for the always-open case;
   when collapsed that gap is dead space, so only pay it while open. */
.disclosure:not([open]) > summary { margin-bottom: 10px; }

/* BUTTONS */
.btn {
  border: none; border-radius: 999px; padding: 10px 22px;
  font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 13px;
  cursor: pointer; transition: opacity 0.2s, background 0.2s, border-color 0.2s, transform 0.1s;
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
/* Same red-orange gradient as the landing page's themed header/hero/CTAs
   (see views.css's LANDING section) — reused here so every primary action
   across the signed-in app reads as the same brand, not a flatter
   "internal tool" palette bolted on behind the marketing page. */
.btn-primary { background: linear-gradient(120deg, #b91c1c, #e8590c); color: #fff; }
.btn-primary:hover:not(:disabled) { background: linear-gradient(120deg, var(--accent-hover), var(--accent)); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); border-color: var(--text); }
.btn-danger { background: var(--surface); color: var(--negative); border: 1px solid var(--border); }
.btn-danger:hover:not(:disabled) { background: var(--negative-bg); border-color: var(--negative); }
.btn-ghost { background: none; color: var(--muted); border: none; padding: 8px 14px; border-radius: 999px; }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--bg); }
.btn-lg { padding: 13px 28px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }

/* GENERIC CARD SURFACE */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* FREE VS PAID PLAN CARDS — same visual language as the landing page's
   pricing section (see views.css's LANDING section: same gradient, same
   checkmark/excluded-list pattern) so the in-app comparison reads as the
   same product, built with the app's own token system rather than the
   landing page's literal hex values (which are intentionally scoped to
   that page alone — see the comment atop .landing-page). */
.plan-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; align-items: start;
}
.plan-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px; display: flex; flex-direction: column; position: relative;
}
.plan-name { font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 6px; }
.plan-price { font-family: 'DM Mono', monospace; font-weight: 700; font-size: 32px; color: var(--text); margin-bottom: 18px; }
.plan-price span { font-family: 'DM Sans', sans-serif; font-weight: 400; font-size: 13px; opacity: 0.8; }
.plan-bullets { list-style: none; margin: 0; padding: 0; }
.plan-bullets li {
  display: flex; gap: 9px; align-items: flex-start; margin-bottom: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 13px; line-height: 1.5; color: var(--text);
}
.plan-bullets li::before { content: '✓'; color: var(--text); font-weight: 700; }
.plan-divider { border-top: 1px solid var(--border); margin: 14px 0 12px; }
.plan-excluded-label {
  font-family: 'DM Mono', monospace; font-weight: 600; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin-bottom: 10px;
}
.plan-excluded { list-style: none; margin: 0; padding: 0; }
.plan-excluded li {
  display: flex; gap: 9px; align-items: flex-start; margin-bottom: 9px;
  font-family: 'DM Sans', sans-serif; font-size: 13px; line-height: 1.5; color: var(--muted);
}
.plan-excluded li::before { content: '✕'; color: var(--border); font-weight: 700; }
.plan-card.is-paid {
  background: linear-gradient(160deg, #b91c1c, #e8590c 60%, #f2994a);
  border: none; color: #fff8ee; box-shadow: 0 16px 34px rgba(185, 28, 28, 0.24);
}
.plan-card.is-paid .plan-name, .plan-card.is-paid .plan-price { color: #fff8ee; }
.plan-card.is-paid .plan-bullets li { color: rgba(255, 248, 238, 0.92); }
.plan-card.is-paid .plan-bullets li::before { color: #fff8ee; }
/* Named distinctly from .plan-badge (the small FREE/PRO pill in the
   header, defined in views.css) — that name collision previously made
   this ribbon's `position: absolute` leak onto the header pill, since a
   property declared only here isn't overridden just because views.css
   loads after this file and redeclares the other shared properties. */
.plan-card-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-family: 'DM Mono', monospace; font-weight: 600; font-size: 10px;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}

/* FORM FIELDS (shared by wizard + edit mode) */
.field-group { margin-bottom: 28px; }
.field-group-title {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  margin-bottom: 4px;
}
.field-group-desc { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.field.has-error { border-color: var(--negative); }
.field.has-error:focus-within { box-shadow: 0 0 0 3px var(--negative-bg); }
.field.auto-filled { border-color: var(--positive); background: var(--positive-bg); }
.auto-filled-tag {
  font-family: 'DM Sans', sans-serif; text-transform: none; letter-spacing: normal;
  font-size: 9.5px; color: var(--positive); background: var(--surface);
  border: 1px solid var(--positive); border-radius: 999px; padding: 1px 7px; margin-left: auto;
}
.field label {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.field input, .field select {
  background: none; border: none; outline: none;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 400;
  width: 100%;
}
.field input[type="text"].text-value { font-family: 'DM Sans', sans-serif; font-size: 13px; }
/* A native select renders its own control chrome, which the borderless field
   styling above otherwise leaves looking like an inert label on some
   platforms — the caret is what marks it as choosable. */
.field select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 18px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 6px top 55%, right 1px top 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.field select option { background: var(--surface); color: var(--text); }
.field textarea {
  background: none; border: none; outline: none; resize: vertical;
  color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 13px;
  width: 100%; line-height: 1.6; min-height: 90px;
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field .unit-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 3px; }
.field .unit { font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; }
.field .field-error { font-size: 10.5px; color: var(--negative); font-family: 'DM Sans', sans-serif; }
.rate-suggestion:empty { display: none; }
.rate-suggestion {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
  font-family: 'DM Sans', sans-serif; font-size: 11px; color: var(--muted); line-height: 1.6;
}
.rate-suggestion strong { color: var(--text); }
/* Every suggestion box's action, matched by element rather than by listing
   each data-use-* attribute: that list had already fallen behind (the
   management-cost estimate button was never styled) and there are now six of
   these boxes. */
.rate-suggestion button {
  background: none; border: none; color: var(--text); text-decoration: underline;
  font-family: 'DM Sans', sans-serif; font-size: 11px; cursor: pointer; padding: 0; margin-left: 2px;
}
.rate-suggestion button:hover { color: var(--muted); }
.rate-suggestion-note { font-size: 10px; margin-top: 3px; }

.help-hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--surface2); color: var(--text); border: 1px solid var(--muted);
  font-size: 10px; font-family: 'DM Sans', sans-serif; font-weight: 600;
  cursor: help; flex-shrink: 0;
  position: relative;
  outline: none;
}
.help-hint:hover, .help-hint:focus-visible, .help-hint.open { background: var(--text); color: var(--bg); }

/* Portaled to document.body while shown (see fieldGroup.js) so position:fixed
   is always relative to the viewport, never clipped by a scroll/animation
   ancestor's overflow:hidden. Position (left/bottom) is set inline by JS. */
.help-bubble {
  position: fixed; transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 240px;
  background: var(--text); color: var(--bg);
  font-family: 'DM Sans', sans-serif; font-weight: 400; font-size: 11.5px; line-height: 1.5;
  text-transform: none; letter-spacing: normal;
  padding: 9px 12px; border-radius: var(--radius-sm);
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1000;
}
.help-bubble::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--text);
}
.help-bubble.visible {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

/* PROGRESS BAR (wizard) */
.progress-track {
  display: flex; gap: 6px; margin-bottom: 28px;
}
.progress-step {
  flex: 1; height: 4px; border-radius: 99px; background: var(--border);
  transition: background 0.25s;
}
.progress-step.done { background: var(--accent2); }
.progress-step.active { background: var(--text); }
.progress-step[data-goto-step] { cursor: pointer; }
.progress-step[data-goto-step]:hover, .progress-step[data-goto-step]:focus-visible { height: 7px; margin-top: -1.5px; outline: none; }
.progress-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
}
.progress-meta .step-count { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); }

/* COLLAPSIBLE (edit mode) */
details.collapsible {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
}
details.collapsible > summary {
  list-style: none; cursor: pointer; padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'DM Serif Display', serif; font-size: 16px;
  user-select: none;
}
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary .chev { color: var(--muted); font-family: 'DM Mono', monospace; font-size: 12px; transition: transform 0.2s; }
details.collapsible[open] > summary .chev { transform: rotate(90deg); }
details.collapsible > summary:hover { background: var(--surface2); }
details.collapsible .collapsible-body { padding: 4px 22px 22px; }

/* DIALOG */
.dialog-overlay {
  position: fixed; inset: 0; background: rgba(26,25,22,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 26px; max-width: 380px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.dialog h3 { font-size: 18px; margin-bottom: 10px; }
.dialog p { color: var(--muted); font-size: 13px; margin-bottom: 22px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.dialog-checkbox-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); margin: -10px 0 22px; cursor: pointer;
}
.dialog-checkbox-row input { margin: 0; cursor: pointer; }

/* AUTH DIALOG (sign in / sign up / link account) */
.auth-dialog { max-width: 400px; position: relative; }
.auth-intro { font-size: 13px; line-height: 1.6; color: var(--muted); margin: 0 0 20px; }
.auth-google-btn { width: 100%; justify-content: center; margin-bottom: 4px; }
/* Hairline rule with the word centred on it, rather than a bare "or" that
   would read as a third option between the two real ones. */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0; font-size: 11px; color: var(--muted);
  font-family: 'DM Mono', monospace; text-transform: uppercase; letter-spacing: 0.08em;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field > span {
  font-family: 'DM Mono', monospace; font-size: 10.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
.auth-field input {
  font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; outline: none; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.auth-hint { font-size: 11.5px; color: var(--muted); }
.auth-error:empty { display: none; }
.auth-error {
  font-size: 12.5px; line-height: 1.5; color: var(--negative);
  background: var(--negative-bg); border-radius: var(--radius-sm); padding: 9px 11px;
}
.auth-submit { width: 100%; justify-content: center; margin-top: 2px; }
.auth-links {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
}
.auth-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 12.5px; color: var(--accent);
}
.auth-link:hover { text-decoration: underline; }
.dialog-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted); padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.dialog-close:hover { color: var(--text); background: var(--surface2); }

.onboarding-dialog { max-width: 420px; }
.onboarding-section { margin-bottom: 20px; }
.onboarding-label {
  font-family: 'DM Mono', monospace; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.onboarding-toggle { display: flex; width: 100%; padding: 3px; }
.onboarding-toggle .lang-toggle-opt { flex: 1; text-align: center; font-size: 13px; padding: 10px 12px; }

/* TOOL DRAWER */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(26,25,22,0.35);
  z-index: 100; animation: fadeIn 0.15s ease;
}
.drawer-overlay.closing { animation: fadeOut 0.2s ease forwards; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 84vw;
  background: var(--surface); border-right: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  display: flex; flex-direction: column; padding: 18px 14px;
  animation: drawerIn 0.2s ease;
}
.drawer-overlay.closing .drawer { animation: drawerOut 0.2s ease forwards; }
@keyframes drawerIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes drawerOut { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 18px; }
.drawer-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; background: none; border: none; border-radius: var(--radius);
  padding: 12px 14px; font-family: 'DM Sans', sans-serif; font-size: 13.5px; cursor: pointer; color: var(--text);
}
.drawer-item:hover { background: var(--surface2); }
.drawer-item.active { background: var(--bg); font-weight: 600; }
/* Pushes everything from here down to the bottom of the drawer (a flex
   column) — the drawer's fixed to full viewport height but the nav items
   above don't fill it, so without this the divider+item after it would sit
   bunched up right under Upgrade instead of reading as a separate,
   secondary action at the bottom (Feedback, in this case). */
.drawer-divider { margin-top: auto; border-top: 1px solid var(--border); margin-left: 4px; margin-right: 4px; padding-top: 4px; }

/* TOAST */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px;
  border-radius: var(--radius); font-size: 12.5px; font-family: 'DM Mono', monospace;
  z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  animation: toastIn 0.2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* MENU (card overflow) */
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
  min-width: 160px; z-index: 50; overflow: hidden;
}
.menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 10px 14px; font-size: 12.5px; font-family: 'DM Sans', sans-serif; cursor: pointer;
  color: var(--text);
}
.menu button:hover { background: var(--surface2); }
.menu button.danger { color: var(--negative); }

/* USER MENU / AVATAR */
.lang-toggle {
  display: inline-flex; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px;
}
.lang-toggle-opt {
  border: none; background: none; cursor: pointer; font-family: 'DM Mono', monospace;
  font-size: 11px; font-weight: 500; letter-spacing: 0.5px; color: var(--muted);
  padding: 5px 11px; border-radius: 999px; transition: background 0.15s, color 0.15s;
}
.lang-toggle-opt.active { background: var(--text); color: var(--bg); }
.lang-toggle-opt:hover:not(.active) { color: var(--text); }

/* Same segmented-pill visual language as .lang-toggle, reused for any field
   that accepts more than one entry unit (currently just rentPerSqm — see
   wireRentModeToggle in fieldGroup.js). Separate class names since this
   isn't language-related, just visually identical. */
.field-mode-toggle {
  display: inline-flex; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px;
}
.field-mode-opt {
  border: none; background: none; cursor: pointer; font-family: 'DM Mono', monospace;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.3px; color: var(--muted);
  padding: 4px 9px; border-radius: 999px; transition: background 0.15s, color 0.15s;
}
.field-mode-opt.active { background: var(--text); color: var(--bg); }
.field-mode-opt:hover:not(.active) { color: var(--text); }

.user-menu-btn { padding: 5px 12px 5px 5px; gap: 8px; }
.user-menu-btn .plan-badge { margin-left: 0; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
  flex-shrink: 0;
}
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--text); color: var(--surface);
  font-family: 'DM Serif Display', serif; font-size: 12px;
}
