/* ─── ICN Consult — Stylesheet ─────────────────────────────────────────
   Aesthetic: warm cream paper, generous negative space, serif headings,
   tracked-out small caps for labels. Mirrors the supplied mockup.
*/

/* ---------- Tokens --------------------------------------------------- */
:root {
  --bg:           #f3ede1;       /* warm cream */
  --bg-card:     #ebe3d3;        /* slightly warmer beige for the case card */
  --bg-card-2:   #faf6ec;        /* assessment card (paler) */
  --bg-input:    #fbf7ee;
  --line:         #d8cdb8;
  --line-soft:    #e3dcc9;
  --ink:          #2b2a26;
  --ink-soft:     #5e5a4f;
  --ink-mute:     #8a8676;
  --accent:       #7a8c6f;       /* sage button */
  --accent-2:     #5e7155;
  --danger:       #b14a3c;

  --serif:  'Cormorant Garamond','Georgia','EB Garamond','Times New Roman',serif;
  --sans:   'Inter','Helvetica Neue','Arial',sans-serif;
  --mono:   'JetBrains Mono','SF Mono',Consolas,monospace;

  --radius:  10px;
  --shadow:  0 1px 0 rgba(0,0,0,0.03);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; border-bottom: 1px dashed transparent; }
a:hover { border-bottom-color: var(--accent-2); }

/* small caps tracked-out label */
.label-cap, .select-cap, .meta-tag, .rev-tag, .code-tag, .copy-btn, .meta-link {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* =====================================================================
   AUTH PAGES
====================================================================== */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
}
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand .brand-mark {
  display: inline-block;
  font-size: 18px;
  color: var(--accent-2);
  margin-right: 4px;
}
.auth-brand h1 {
  margin: 8px 0 4px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: 0.01em;
}
.auth-brand h1 em { font-style: italic; color: var(--ink-soft); }
.auth-tag {
  margin: 0;
  color: var(--ink-mute);
  font-size: 13px;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; }
.auth-form input {
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  font: inherit;
  color: var(--ink);
}
.auth-form input:focus {
  outline: none;
  border-color: var(--accent-2);
}
.auth-error {
  background: #f1d8d3;
  color: var(--danger);
  border: 1px solid #e3b9af;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}
.auth-alt {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-mute);
}
.auth-foot {
  margin-top: 28px;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
}

/* =====================================================================
   DASHBOARD
====================================================================== */
.dash-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg);
}
.topbar-left { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  color: var(--accent-2);
  font-size: 14px;
}
.brand-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
}
.brand-title em { font-style: italic; color: var(--ink-soft); }
.brand-divider { color: var(--line); }
.brand-sub {
  font-size: 12.5px;
  color: var(--ink-mute);
}
.topbar-right { display: flex; align-items: center; gap: 18px; }
.code-tag {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
}
.user-chip {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card-2);
}
.inline-form { display: inline; margin: 0; }
.link-btn {
  background: none;
  border: none;
  color: var(--ink-mute);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.02em;
}
.link-btn:hover { color: var(--accent-2); }

/* ── grid ── */
.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0,1fr) 320px;
  gap: 0;
  align-items: stretch;
}
.left-pane {
  padding: 26px 36px 120px;     /* bottom space for follow-up bar */
  overflow-y: auto;
  border-right: 1px solid var(--line-soft);
}
.right-pane {
  padding: 26px 26px 120px;
  background: linear-gradient(180deg, var(--bg) 0%, #efe7d6 100%);
}

/* ── empty state ── */
.empty-state {
  margin-top: 80px;
  text-align: center;
  color: var(--ink-mute);
  font-style: italic;
  font-family: var(--serif);
  font-size: 16px;
}

/* ── case card ── */
.case-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 26px 24px;
  margin-bottom: 22px;
}
.card-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  margin-bottom: 6px;
}
.meta-link {
  background: none; border: none;
  color: var(--ink-mute); cursor: pointer;
  font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
}
.meta-link:hover { color: var(--ink); }
.case-card h2 {
  margin: 4px 0 2px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
}
.case-articles {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 14px;
}
.case-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}
.case-body strong { font-weight: 600; }
.case-body em     { font-style: italic; }

/* ── assessment card ── */
.assessment-card {
  background: var(--bg-card-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px 26px 18px;
  margin-bottom: 22px;
}
.assessment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.rev-info { display: flex; align-items: center; gap: 8px; }
.info-mark { color: var(--accent-2); font-size: 13px; }
.rev-divider { color: var(--line); }
.rev-sub {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.copy-btn {
  background: none; border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.copy-btn:hover { background: rgba(0,0,0,0.04); color: var(--ink); }

.assessment-body h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  margin: 14px 0 6px;
}
.assessment-body p { margin: 6px 0; }
.assessment-body ul {
  list-style: none;
  margin: 6px 0 6px;
  padding-left: 0;
}
.assessment-body ul li {
  position: relative;
  padding-left: 18px;
  margin: 6px 0;
}
.assessment-body ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--ink-mute);
}
.assessment-body em { font-style: italic; }
.assessment-body strong { font-weight: 600; }
.assessment-body code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: rgba(0,0,0,0.04);
  padding: 1px 5px;
  border-radius: 3px;
}
.assessment-foot {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  text-align: right;
}

/* ── loading spinner ── */
.loading {
  text-align: center;
  padding: 36px 0;
  color: var(--ink-mute);
}
.spinner {
  display: inline-block;
  width: 28px; height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 10px;
}
.loading-text { font-style: italic; font-family: var(--serif); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── right pane ── */
.side-title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
}
.side-tag {
  margin: 0 0 22px;
  color: var(--ink-mute);
  font-size: 13px;
  line-height: 1.5;
}
.side-form { display: flex; flex-direction: column; gap: 14px; }

.select-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  gap: 12px;
}
.select-cap {
  white-space: nowrap;
  font-size: 9.5px;
  letter-spacing: 0.2em;
}
.select-wrap select {
  flex: 1;
  background: transparent;
  border: none;
  font: inherit;
  color: var(--ink);
  padding: 6px 0;
}
.select-wrap select:focus { outline: none; }

.dynamic-fields { display: flex; flex-direction: column; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field input, .field select, .field textarea {
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent-2);
}

.side-help {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* ── buttons ── */
.btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent-2);
  padding: 9px 16px;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.btn:hover { background: var(--accent-2); }
.btn-primary { /* default */ }
.btn-block { width: 100%; }

/* ── follow-up bar ── */
.followup {
  position: fixed;
  bottom: 0; left: 0;
  width: calc(100% - 320px);  /* leaves the right column visible */
  padding: 12px 36px 14px;
  background: linear-gradient(180deg, rgba(243,237,225,0) 0%, var(--bg) 30%);
  pointer-events: none;
}
.followup-form {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 6px 6px 14px;
  max-width: 880px;
}
#followup-input {
  flex: 1;
  background: transparent;
  border: none;
  font: inherit;
  color: var(--ink);
  padding: 8px 0;
}
#followup-input:focus { outline: none; }
#followup-input::placeholder { color: var(--ink-mute); }
.send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  width: 32px; height: 32px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}
.send-btn:hover { background: var(--accent-2); }

/* ── utilities ── */
.hidden { display: none !important; }

@media (max-width: 900px) {
  .main-grid { grid-template-columns: 1fr; }
  .left-pane { border-right: none; }
  .followup { width: 100%; }
  .topbar { flex-wrap: wrap; gap: 8px; }
}
