/* ============================================================================
   Estila PM — app stylesheet
   Locked design system: Playfair Display (display) + Inter (body/utility),
   all-caps letter-spaced micro labels, flat surfaces (no shadows, no gradients),
   hairline borders. Two themes: Minimal (light, default for daily work) and
   Luxe (dark, #0C0C0C). Mobile-first.
   ============================================================================ */

:root {
  /* Minimal (light) — default */
  --bg:            #ffffff;
  --bg-sunken:     #f6f5f3;
  --surface:       #ffffff;
  --ink:           #0c0c0c;
  --ink-soft:      #55514c;
  --ink-faint:     #8c877f;
  --line:          #e6e3df;
  --line-strong:   #0c0c0c;
  --accent:        #0c0c0c;   /* monochrome, editorial */
  --accent-ink:    #ffffff;
  --ok:            #1f7a4d;
  --warn:          #9a6b00;
  --danger:        #a32525;
  --focus:         #2b6cb0;
  --radius:        2px;
  --maxw:          440px;
  --font-display:  "Playfair Display", Georgia, serif;
  --font-body:     "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

[data-theme="luxe"] {
  --bg:          #0c0c0c;
  --bg-sunken:   #141414;
  --surface:     #121212;
  --ink:         #f4f2ee;
  --ink-soft:    #b6b1a9;
  --ink-faint:   #777067;
  --line:        #262320;
  --line-strong: #f4f2ee;
  --accent:      #f4f2ee;
  --accent-ink:  #0c0c0c;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- type ---------------------------------------------------------------- */
.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.08;
  margin: 0;
}
h1.display { font-size: clamp(2rem, 6vw, 2.75rem); }
h2.display { font-size: clamp(1.5rem, 5vw, 2rem); }

.eyebrow {
  font-size: 0.6875rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-faint);
}
.label {
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-soft);
}
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }

/* ---- wordmark ------------------------------------------------------------ */
.wordmark {
  font-family: var(--font-body);
  font-weight: 300;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  font-size: 0.95rem;
  color: var(--ink);
  user-select: none;
}
.wordmark b { font-weight: 600; letter-spacing: 0.28em; }

/* ---- layout -------------------------------------------------------------- */
.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 22px calc(32px + env(safe-area-inset-bottom));
}
.stack { max-width: var(--maxw); width: 100%; margin: 0 auto; }
.stack > * + * { margin-top: 18px; }
.row { display: flex; gap: 12px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.grow { flex: 1; }

/* ---- top bar ------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar .icon-btn { color: var(--ink); }

/* ---- buttons ------------------------------------------------------------- */
.btn {
  appearance: none;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 14px 18px;
  border: 1px solid var(--line-strong);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
  transition: opacity .15s ease, background .15s ease;
}
.btn:hover { opacity: .88; }
.btn:active { opacity: .75; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.quiet { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 0.6875rem; }
.icon-btn {
  appearance: none; background: transparent; border: 0; cursor: pointer;
  color: var(--ink-soft); padding: 8px; border-radius: var(--radius);
  font-size: 0.8125rem; letter-spacing: .08em;
}
.icon-btn:hover { color: var(--ink); }

.linkbtn {
  background: none; border: 0; color: var(--ink); cursor: pointer;
  font: inherit; text-decoration: underline; text-underline-offset: 3px; padding: 0;
}

/* ---- inputs -------------------------------------------------------------- */
.field { display: block; }
.field > .label { display: block; margin-bottom: 7px; }
.input, select.input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 13px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
}
.input::placeholder { color: var(--ink-faint); }
.input:focus, select.input:focus, .choice:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---- choice cards (role selection) -------------------------------------- */
.choices { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 420px) { .choices { grid-template-columns: 1fr 1fr; } }
.choice {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--line-strong); }
.choice[aria-pressed="true"] {
  border-color: var(--line-strong);
  background: var(--bg-sunken);
}
.choice h3 {
  font-family: var(--font-display);
  font-weight: 500; font-size: 1.05rem; margin: 8px 0 4px;
}
.choice p { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.choice .num {
  font-size: 0.6875rem; letter-spacing: .2em; color: var(--ink-faint);
  text-transform: uppercase;
}

/* ---- step rail ----------------------------------------------------------- */
.steps { display: flex; gap: 8px; align-items: center; }
.steps .dot {
  width: 22px; height: 2px; background: var(--line);
}
.steps .dot.on { background: var(--line-strong); }

/* ---- cards / surfaces ---------------------------------------------------- */
.card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
}
.divider { height: 1px; background: var(--line); border: 0; margin: 4px 0; }

/* ---- banner -------------------------------------------------------------- */
.banner {
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  background: var(--bg-sunken);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

/* ---- menu (workspace / role / account) ----------------------------------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 230px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px; z-index: 30;
}
.menu[hidden] { display: none; }
.menu .item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  color: var(--ink); font: inherit; padding: 10px 10px; border-radius: var(--radius);
}
.menu .item:hover { background: var(--bg-sunken); }
.menu .item small { color: var(--ink-faint); }
.menu .item .check { color: var(--ink); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu .head { padding: 8px 10px 4px; }

/* ---- modal --------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8,8,8,.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
@media (min-width: 560px) { .modal-backdrop { align-items: center; } }
.modal {
  background: var(--bg); width: 100%; max-width: 460px;
  border: 1px solid var(--line); border-radius: var(--radius);
  max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { padding: 20px 22px 12px; flex: none; }
.modal-body { padding: 0 22px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot {
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); flex: none; background: var(--bg);
}

/* ---- toast --------------------------------------------------------------- */
#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 80;
  background: var(--line-strong); color: var(--bg);
  padding: 11px 16px; border-radius: var(--radius);
  font-size: 0.85rem; max-width: 90vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
#toast.show { opacity: 1; }
#toast.err { background: var(--danger); color: #fff; }

/* ---- empty state --------------------------------------------------------- */
.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 40px 22px; text-align: center;
}
.empty .display { margin-bottom: 6px; }

/* ---- spinner ------------------------------------------------------------- */
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--ink);
  animation: spin .8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hide { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }

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

/* ============================================================================
   Session 3 — project layer, messaging, notifications
   ============================================================================ */

/* Content region uses a wider max than the auth/onboarding column. */
.content { width: 100%; }
.content .stack { max-width: 880px; }
.hide-sm { }
@media (max-width: 640px) { .hide-sm { display: none; } }

/* Notification bell */
.icon-btn { background: none; border: 1px solid transparent; color: var(--ink);
  width: 38px; height: 38px; border-radius: var(--radius); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { border-color: var(--line); }
.bell { display: inline-flex; }
.badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center; font-weight: 600; }
.menu-wide { width: 320px; max-height: 60vh; overflow-y: auto; right: 0; }
.notif-item { display: block; width: 100%; text-align: left; padding: 10px 12px;
  background: none; border: none; border-bottom: 1px solid var(--line);
  color: var(--ink); cursor: pointer; }
.notif-item:hover { background: var(--bg-sunken); }
.notif-item.unread { background: var(--bg-sunken); }
.notif-title { font-size: 13px; }

/* Project cards */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 620px) { .card-grid { grid-template-columns: 1fr 1fr; } }
.project-card { text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; cursor: pointer; display: flex;
  flex-direction: column; gap: 10px; color: var(--ink); }
.project-card:hover { border-color: var(--line-strong); }
.project-card-title { font-family: var(--font-display); font-size: 19px; margin: 0; font-weight: 500; }
.pill { font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; color: var(--ink-soft); }
.pill-muted { color: var(--ink-faint); }
.progress { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 18px; }
.tab { background: none; border: none; padding: 10px 14px; cursor: pointer;
  color: var(--ink-soft); font-size: 13px; letter-spacing: .04em;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--line-strong); }

/* Key/value rows */
.kv { display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }

/* Activity feed */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: none; }
.feed-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  margin-top: 7px; flex: none; }

/* Messages */
.messages { display: flex; flex-direction: column; }
.thread { display: flex; flex-direction: column; gap: 10px; max-height: 52vh;
  overflow-y: auto; padding: 8px 2px; }
.bubble-row { display: flex; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { max-width: 78%; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; background: var(--surface); }
.bubble-row.mine .bubble { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.bubble-name { font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 3px; }
.bubble-time { font-size: 10px; color: var(--ink-faint); margin-top: 4px; }
.bubble-row.mine .bubble-time { color: var(--accent-ink); opacity: .7; }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.composer textarea { resize: vertical; }

/* ============================================================================
   Session 4 — selections board
   ============================================================================ */
.input-sm { padding: 6px 10px; font-size: 13px; width: auto; min-width: 130px; }
.btn.sm { padding: 6px 12px; font-size: 12px; }

.sel-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 16px; }
@media (min-width: 560px) { .sel-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .sel-grid { grid-template-columns: 1fr 1fr 1fr; } }

.sel-card { border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }
.sel-thumb { height: 150px; background-size: cover; background-position: center;
  background-color: var(--bg-sunken); }
.sel-thumb-empty { display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.sel-body { padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.sel-name { font-family: var(--font-display); font-size: 17px; font-weight: 500; margin: 2px 0; }

/* Design boards (5.12) */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 14px; }
.board-tile { display: flex; flex-direction: column; gap: 6px; }
.board-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; cursor: zoom-in;
  border-radius: var(--radius); background: var(--bg-sunken); border: 1px solid var(--line); }
.board-caption { font-size: 13px; color: var(--ink-soft); line-height: 1.4; }

.pill-ok { color: var(--ok); border-color: var(--ok); }
.pill-bad { color: var(--danger); border-color: var(--danger); }
.pill-warn { color: var(--warn); border-color: var(--warn); }
.risk { margin-top: 6px; font-size: 12px; color: var(--warn);
  border-left: 2px solid var(--warn); padding-left: 8px; }

/* Segmented control (e.g. message audience toggle) */
.seg-wrap { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg { background: none; border: none; padding: 7px 16px; cursor: pointer;
  color: var(--ink-soft); font-size: 13px; letter-spacing: .02em; }
.seg:hover { color: var(--ink); }
.seg.on { background: var(--accent); color: var(--accent-ink); }

/* Financial line rows (time / expenses) */
.line-row { display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--line); }
.line-row:last-child { border-bottom: none; }

/* DNE cap progress bar */
.dne-track { position: relative; height: 8px; border-radius: 999px;
  background: var(--bg-sunken); }
.dne-fill { position: absolute; left: 0; top: 0; height: 100%;
  border-radius: 999px; transition: width .3s ease; }
.dne-marker { position: absolute; top: -3px; width: 2px; height: 14px;
  background: var(--ink); opacity: .45; border-radius: 1px; }

/* Financials — KPI overview tiles */
.kpi-grid { display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.kpi { border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; background: var(--surface); cursor: pointer;
  transition: border-color .15s ease, transform .05s ease; }
.kpi:hover { border-color: var(--accent); }
.kpi:active { transform: translateY(1px); }
.kpi-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); }
.kpi-value { font-size: 22px; margin-top: 6px; }
.kpi-sub { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* Billing plans */
.plan-grid { grid-template-columns: 1fr; }
@media (min-width: 820px) { .plan-grid { grid-template-columns: 1fr 1fr 1fr; } }
.plan-card { display: flex; flex-direction: column; gap: 2px; }
.plan-card .btn { margin-top: auto; }
.plan-popular { border-color: var(--ink); }
.plan-lines { list-style: none; padding: 0; margin: 12px 0 16px; font-size: 13px; color: var(--ink-soft); }
.plan-lines li { padding: 5px 0; border-top: 1px solid var(--line); }
