/* PlanningFit Design Language (PFDL) — shared stylesheet.
   Violet & Steel, dark-first. The foundation for server-rendered pages
   (legal, auth, admin). Mirrors the tokens in the mockups; see
   mockups/pfdl-reference.html for the full component reference. */

:root {
  --bg: #eef0f4;
  --surface: #ffffff;
  --surface-alt: #e6e9f0;
  --text: #14161d;
  --text-muted: #6b7180;
  --border: #d9dde6;
  --accent: #5a4be0;
  --accent-hover: #4a3cd0;
  --on-accent: #ffffff;
  --warn: #c8781a;
  --danger: #d23b40;
  --danger-hover: #b22f33;
  --pr: #1f9d63;
  --btn-bg: #ffffff;
  --btn-secondary-hover: #e6e9f0;
  --input-bg: #ffffff;
  --shadow-btn: 0 1px 0 rgba(20,22,40,.04), 0 1px 3px rgba(20,22,40,.14), inset 0 1px 0 rgba(255,255,255,.85);
  --shadow-btn-primary: 0 1px 0 rgba(0,0,0,.08), 0 1px 3px rgba(90,75,224,.35), inset 0 1px 0 rgba(255,255,255,.30);
  --shadow-card: 0 1px 3px rgba(20,22,40,.06);
  --radius: 10px;
  --radius-sm: 5px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "Cascadia Code", "Consolas", monospace;
  --tb-bg: #1c1f2a;
  --tb-border: #14161d;
  --tb-brand: #ffffff;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --surface: #181b24;
  --surface-alt: #20242f;
  --text: #e7e8ef;
  --text-muted: #9aa0b0;
  --border: #2d323f;
  --accent: #6d5ef0;
  --accent-hover: #8779f5;
  --on-accent: #0f1117;
  --warn: #f5a623;
  --danger: #e5484d;
  --danger-hover: #f06a6e;
  --pr: #2fb574;
  --btn-bg: #20242f;
  --btn-secondary-hover: #2a2f3c;
  --input-bg: #20242f;
  --shadow-btn: 0 1px 0 rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.40), inset 0 1px 0 rgba(255,255,255,.05);
  --shadow-btn-primary: 0 1px 0 rgba(0,0,0,.45), 0 2px 8px rgba(109,94,240,.45), inset 0 1px 0 rgba(255,255,255,.18);
  --shadow-card: 0 1px 3px rgba(0,0,0,.45);
  --tb-bg: #20242f;
  --tb-border: #343a48;
  --tb-brand: #e7e8ef;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a, .link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover, .link:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }

/* ---- top bar (brand) -------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: var(--tb-bg); border-bottom: 1px solid var(--tb-border);
}
.brand {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 800; letter-spacing: -0.01em;
  color: var(--tb-brand); text-decoration: none;
}
.brand:hover { text-decoration: none; filter: brightness(1.12); }
.brand em { color: var(--accent); font-style: normal; }
.topbar-nav { display: inline-flex; align-items: center; gap: 14px; }
.topbar-nav form { margin: 0; }
.topbar-user { color: var(--tb-brand); opacity: .75; font-size: 13px; }
.topbar-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-size: 13px; font-weight: 600; }

/* ---- buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: var(--font);
  color: var(--text); cursor: pointer; text-decoration: none;
  border: 1px solid var(--border); background: var(--btn-bg);
  box-shadow: var(--shadow-btn);
  transition: background .12s, transform .05s;
}
.btn:hover { background: var(--btn-secondary-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); color: var(--on-accent);
  border-color: var(--accent-hover); box-shadow: var(--shadow-btn-primary);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }

/* ---- forms ------------------------------------------------------------ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; }
.form-input {
  padding: 10px 12px; font-size: 15px; font-family: var(--font);
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); width: 100%;
}
.form-input:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.form-error {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--danger); margin: 4px 0 12px;
}
.form-error::before { content: '\26A0'; }

/* ---- card ------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-card);
}
.content .card { margin-top: 16px; }
.content h2.card-title { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.content .card-desc { font-size: 13px; color: var(--text-muted); margin: 0 0 14px; }
.empty-state {
  padding: 18px; text-align: center; color: var(--text-muted); font-size: 13px;
  background: var(--surface-alt); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); margin-top: 8px;
}
.ok-note { color: var(--pr); font-weight: 600; }
.ta-right { text-align: right; }
.content .table td form { margin: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* ---- legal / long-form content --------------------------------------- */
.content {
  max-width: 820px; margin: 0 auto; padding: 36px 24px 96px;
}
.content h1 { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -0.01em; margin: 8px 0 4px; }
.content h2 { font-family: var(--font-display); font-size: 21px; font-weight: 700; margin: 36px 0 8px; }
.content h3 { font-size: 16px; font-weight: 700; margin: 22px 0 6px; }
.content p, .content li { font-size: 15px; }
.content ul { padding-left: 22px; }
.content li { margin: 4px 0; }
.content code { font-family: var(--mono); font-size: 13px; background: var(--surface-alt); padding: 1px 5px; border-radius: 3px; }
.legal-effective-date { color: var(--text-muted); font-size: 14px; margin-top: 0; }
.content table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; }
.content th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.content td { padding: 8px 10px; border-bottom: 1px solid var(--surface-alt); vertical-align: top; }
.callout {
  border-left: 3px solid var(--warn); background: var(--surface-alt);
  padding: 12px 16px; border-radius: var(--radius-sm); margin: 16px 0;
  font-size: 14px;
}
.legal-footer {
  margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px;
  display: flex; gap: 16px; flex-wrap: wrap;
}

/* ---- auth (sign-in) --------------------------------------------------- */
.auth-wrap {
  display: flex; justify-content: center; align-items: flex-start;
  padding: 64px 20px;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-title { font-family: var(--font-display); font-size: 24px; font-weight: 800; margin: 0 0 18px; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-sep {
  display: flex; align-items: center; text-align: center;
  color: var(--text-muted); font-size: 12px; margin: 18px 0 14px;
}
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-sep span { padding: 0 10px; }
.auth-provider { width: 100%; margin-top: 8px; }

/* ---- taxonomy editors (admin) ---------------------------------------- */
.tax-grid { display: flex; flex-direction: column; gap: 0; margin-top: 12px; }
.tax-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 7px 0; border-bottom: 1px solid var(--surface-alt); margin: 0;
}
.tax-row .tax-f { flex: 1; min-width: 0; }
.tax-actions { flex: none; display: flex; gap: 4px; align-items: flex-start; padding-top: 1px; }
.tax-head {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.tax-add { border-bottom: none; padding-top: 12px; }
.tax-add .tax-f .form-input { border-style: dashed; }
.tax-grip {
  flex: none; width: 20px; text-align: center;
  cursor: grab; color: var(--text-muted); font-size: 15px; line-height: 34px;
  -webkit-user-select: none; user-select: none;
}
.tax-grip:active { cursor: grabbing; }
.tax-grip-empty { visibility: hidden; cursor: default; }
.tax-row.dragging { opacity: 0.45; }
