/* Pinecrest Systems — Project Intake design system.
   Tokens mirror the public site: near-black, dark slate cards, coral accent, Inter. */

:root {
  --bg: #000000;
  --surface: #131b26;
  --surface-2: #0d141d;
  --surface-3: #18222e;
  --border: #293442;
  --border-strong: #34434f;
  --fg: #fafafa;
  --muted: #b3b3b3;
  --faint: #7f8a98;
  --accent: #ff5533;
  --accent-hover: #ff6b4a;
  --accent-soft: rgba(255, 85, 51, 0.14);
  --accent-line: rgba(255, 85, 51, 0.4);
  --danger: #ff4d4f;
  --danger-soft: rgba(255, 77, 79, 0.14);
  --success: #3fb950;
  --success-soft: rgba(63, 185, 80, 0.14);
  --warning: #d29922;
  --warning-soft: rgba(210, 153, 34, 0.16);
  --radius: 10px;
  --radius-sm: 7px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --glow: 0 0 0 3px rgba(255, 85, 51, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.82rem; }
.tiny { font-size: 0.72rem; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }

/* ------------------------------------------------ layout */

.container { max-width: 680px; margin: 0 auto; padding: 0 20px; }
.container.wide { max-width: 1180px; }
.app-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-header .inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 14px;
}
.wordmark { font-weight: 800; letter-spacing: -0.02em; font-size: 1.05rem; color: var(--fg); }
.wordmark .dot { color: var(--accent); }
.header-tag { color: var(--muted); font-size: 0.82rem; }
.header-spacer { flex: 1; }
.app-main { padding: 28px 0 120px; }

/* ------------------------------------------------ brand hero (intake) */

.brand-hero { text-align: left; margin-bottom: 22px; }
.brand-hero .kicker {
  color: var(--accent); font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 8px;
}
.brand-hero h1 { font-size: 2rem; }
.brand-hero .tagline { color: var(--muted); margin-top: 6px; }

/* ------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.card-head h2 { flex: 1; }
.card-desc { color: var(--muted); font-size: 0.9rem; margin-bottom: 16px; }
.card-title-row { display: flex; align-items: center; gap: 10px; }

.section-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 0.82rem; flex: 0 0 auto;
}
.section-num.done { background: var(--accent); color: #fff; }

/* ------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 0.92rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.15s ease;
  color: var(--fg); background: var(--surface-3);
}
.btn:hover { border-color: var(--border-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #e6451f 100%);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--fg); background: var(--surface-3); }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  cursor: pointer; font-size: 0.9rem; transition: all 0.12s ease;
}
.icon-btn:hover { color: var(--fg); border-color: var(--border-strong); background: var(--surface-3); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ------------------------------------------------ form fields */

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
label.f-label {
  display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px;
}
.f-label .req { color: var(--accent); margin-left: 2px; }
.f-help { color: var(--muted); font-size: 0.8rem; margin-top: 5px; }
.f-error { color: var(--danger); font-size: 0.8rem; margin-top: 5px; }

.input, textarea.input, select.input {
  width: 100%; padding: 11px 13px; font-size: 0.95rem; font-family: inherit;
  color: var(--fg); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input::placeholder { color: var(--faint); }
.input:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--glow);
}
textarea.input { min-height: 96px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
.field.has-error .input { border-color: var(--danger); }
.field.hidden { display: none; }

.choice-group { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.12s ease; background: var(--surface-2);
}
.choice:hover { border-color: var(--border-strong); }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; cursor: pointer; }
.choice .choice-label { flex: 1; font-size: 0.92rem; }

/* ------------------------------------------------ progress */

.progress-wrap { margin-bottom: 20px; }
.progress-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.progress-track { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #e6451f); border-radius: 999px; transition: width 0.3s ease; }
.stepper { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.step {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--border); color: var(--muted); background: transparent;
}
.step.active { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.step.done { border-color: var(--success); color: var(--success); }

/* ------------------------------------------------ badges */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 600;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.badge.new { border-color: var(--border-strong); color: var(--fg); }
.badge.in_review { border-color: var(--warning); color: var(--warning); background: var(--warning-soft); }
.badge.ready { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.badge.flag { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* ------------------------------------------------ lists / tables */

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.12s ease; background: var(--surface);
}
.list-item + .list-item { margin-top: 8px; }
.list-item:hover { border-color: var(--border-strong); background: var(--surface-3); }
.list-item.active { border-color: var(--accent); background: var(--accent-soft); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kv { display: grid; grid-template-columns: 1fr; gap: 0; }
.kv-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { flex: 0 0 180px; color: var(--muted); font-size: 0.85rem; }
.kv-row .v { flex: 1; font-size: 0.92rem; word-break: break-word; }

/* ------------------------------------------------ panels / tabs */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 9px 14px; font-size: 0.88rem; font-weight: 600; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.split { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* ------------------------------------------------ toast */

.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-3); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 0.88rem;
  box-shadow: var(--shadow); max-width: 340px;
  animation: slide-in 0.2s ease;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------ misc */

.empty {
  text-align: center; color: var(--muted); padding: 48px 20px;
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sticky-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); padding: 14px 20px;
}
.sticky-footer .inner { max-width: 680px; margin: 0 auto; display: flex; gap: 12px; justify-content: flex-end; }

.confirm-panel { text-align: center; padding: 40px 20px; }
.confirm-icon {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--success-soft); color: var(--success);
  display: flex; align-items: center; justify-content: center; font-size: 2rem;
}
.code-badge {
  display: inline-block; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 12px; font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

.note-box {
  background: var(--surface-2); border-left: 3px solid var(--accent);
  padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px;
}
.note-box p:last-child { margin: 0; }

@media (max-width: 600px) {
  .brand-hero h1 { font-size: 1.6rem; }
  .kv-row { flex-direction: column; gap: 2px; }
  .kv-row .k { flex: none; }
}


/* ------------------------------------------------ card tiles (choice questions) */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: box-shadow 0.12s ease, background 0.12s ease, transform 0.06s ease;
}
.tile:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.tile:active { transform: scale(0.985); }
.tile.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.tile-title { font-weight: 600; font-size: 0.95rem; }
.tile-sub { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.tile-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}
.tile.selected .tile-check { display: flex; }
