/* Dossier — vanilla port of the "OSINT Research Platform" Claude Design.
 * Token layer adapted verbatim from docs/design/dossier-tokens.css; the
 * Button/Badge/Input/Checkbox and the 3 views are rebuilt here in plain CSS.
 */

/* ---- Webfonts: General Sans (Fontshare) + Geist Mono ---- */
@import url('https://api.fontshare.com/v2/css?f[]=general-sans@400,500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500&display=swap');

:root {
  /* ---- Brand: plum / violet (the single primary) ---- */
  --plum-700: #3E33B0;
  --plum-600: #4A3FCB;
  --plum-500: #5B4FE0;
  --plum-300: #A79FEE;
  --plum-100: #ECEAFB;
  --plum-050: #F5F3FD;

  /* ---- Warm accent: terracotta / coral ---- */
  --terracotta-600: #C96A4D;
  --terracotta-500: #E8896B;
  --terracotta-300: #F1B4A1;
  --terracotta-100: #FBE7DF;

  /* ---- Calm accent: sage ---- */
  --sage-600: #7E977A;
  --sage-500: #A3B89B;
  --sage-300: #C4D2BE;
  --sage-100: #E9EFE5;

  /* ---- Backgrounds ---- */
  --cream: #FBF7F0;
  --cream-deep: #F3EDE2;
  --white: #FFFFFF;

  /* ---- Ink / text ---- */
  --ink-900: #1C1A17;
  --ink-600: #5C564E;
  --ink-400: #8A8175;
  --ink-200: #B6AE9F;

  /* ---- Borders ---- */
  --line: #E7DFD2;
  --line-strong: #D8CDBA;

  /* ---- Semantic ---- */
  --success-500: #6E9E78; --success-100: #E4EFE4;
  --warning-500: #E5A23B; --warning-100: #FBEFD7;
  --error-500:   #C9533B; --error-100:   #F7E2DB;

  /* ---- Semantic aliases ---- */
  --bg-canvas: var(--cream);
  --bg-band: var(--cream-deep);
  --surface: var(--white);
  --surface-sunken: var(--cream-deep);

  --text-strong: var(--ink-900);
  --text-body: var(--ink-900);
  --text-secondary: var(--ink-600);
  --text-muted: var(--ink-400);
  --text-on-primary: var(--white);
  --text-link: var(--plum-500);

  --primary: var(--plum-500);
  --primary-hover: var(--plum-600);
  --primary-active: var(--plum-700);
  --primary-tint: var(--plum-100);

  --accent-warm: var(--terracotta-500);
  --accent-calm: var(--sage-500);

  --border: var(--line);
  --border-strong: var(--line-strong);
  --focus-ring: var(--plum-500);
  --focus-halo: var(--plum-100);

  /* ---- Fonts ---- */
  --font-display: 'General Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'General Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;

  --lh-tight: 1.05; --lh-snug: 1.18; --lh-normal: 1.55; --lh-relaxed: 1.6;
  --ls-tight: -0.02em; --ls-snug: -0.01em; --ls-normal: 0em; --ls-wide: 0.06em;

  /* ---- Radii ---- */
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 18px; --radius-xl: 24px; --radius-pill: 999px;

  /* ---- Shadows ---- */
  --shadow-xs: 0 1px 2px rgba(60, 46, 28, 0.05);
  --shadow-sm: 0 2px 8px rgba(60, 46, 28, 0.06);
  --shadow-md: 0 8px 24px rgba(60, 46, 28, 0.08);
  --shadow-lg: 0 18px 48px rgba(60, 46, 28, 0.10);
  --shadow-hover: 0 14px 34px rgba(60, 46, 28, 0.12);
  --ring: 0 0 0 4px var(--focus-halo);
  --ring-strong: 0 0 0 3px var(--plum-300);
}

* { box-sizing: border-box; }

body {
  margin: 0; font-family: var(--font-body); font-size: 18px;
  line-height: var(--lh-normal); font-weight: var(--fw-regular);
  color: var(--text-body); background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 {
  font-family: var(--font-display); color: var(--text-strong); margin: 0;
  font-weight: var(--fw-semibold); letter-spacing: var(--ls-snug);
  line-height: var(--lh-snug); text-wrap: balance;
}
a { color: inherit; }
.em-italic { font-style: italic; font-weight: var(--fw-medium); color: var(--primary); }
.eyebrow {
  font-size: 12.5px; font-weight: var(--fw-semibold); letter-spacing: .09em;
  text-transform: uppercase; color: var(--terracotta-600);
}
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ================= Header / shell ================= */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--cream) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1160px; margin: 0 auto; padding: 13px 28px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 11px; background: none; border: 0; padding: 0; cursor: pointer; }
.brand-logo { width: 40px; height: 40px; flex: 0 0 auto; display: block; }
.brand-word { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 20px; letter-spacing: var(--ls-tight); color: var(--text-strong); }
.osint-pill {
  font-size: 10.5px; font-weight: var(--fw-semibold); letter-spacing: .12em;
  text-transform: uppercase; color: var(--plum-600);
  background: var(--plum-050); border: 1px solid var(--plum-100);
  padding: 3px 8px; border-radius: var(--radius-pill);
}
.header-nav { margin-left: auto; display: flex; gap: 4px; }
.nav-link {
  font-size: 14.5px; font-weight: var(--fw-medium); color: var(--text-secondary);
  background: none; border: 0; cursor: pointer; padding: 8px 13px; border-radius: 8px;
  font-family: var(--font-body); transition: background .15s, color .15s;
}
.nav-link:hover { color: var(--text-strong); background: var(--cream-deep); }
.nav-link.active { color: var(--primary); background: var(--plum-050); }

/* ================= Main ================= */
.main { max-width: 1160px; margin: 0 auto; padding: 44px 28px 96px; position: relative; }

.view { animation: viewIn .45s cubic-bezier(.16,.84,.44,1) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
}
[hidden] { display: none !important; }

/* ================= Components: Button ================= */
.btn {
  font-family: var(--font-body); font-size: 15px; font-weight: var(--fw-semibold);
  height: 44px; padding: 0 20px; border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, opacity .15s;
}
.btn-lg { height: 50px; padding: 0 26px; font-size: 16px; }
.btn-full { width: 100%; }
.btn-primary { background: var(--primary); color: var(--text-on-primary); box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--primary-active); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--cream-deep); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ================= Components: Badge ================= */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: var(--fw-semibold); letter-spacing: .01em;
  padding: 4px 11px; border-radius: var(--radius-pill); white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; background: currentColor; }
.badge-sage    { background: var(--sage-100); color: var(--sage-600); }
.badge-plum    { background: var(--plum-100); color: var(--plum-600); }
.badge-neutral { background: var(--cream-deep); color: var(--text-muted); }
.badge-error   { background: var(--error-100); color: var(--error-500); }

/* standalone status dots (row summaries) */
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }
.dot-done { background: var(--sage-500); }
.dot-running { background: var(--plum-500); }
.dot-queued { background: var(--line-strong); }
.dot-error { background: var(--error-500); }
.dot-skipped { background: var(--line); }
.dot-running, .badge-plum .badge-dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .dot-running, .badge-dot { animation: none; } }

/* ================= Components: Input / textarea ================= */
.input, .textarea {
  width: 100%; font-family: var(--font-body); font-size: 15px; color: var(--text-body);
  background: var(--surface); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md); padding: 0 16px;
  transition: border-color .15s, box-shadow .15s;
}
.input { height: 74px; font-size: 17px; }
.textarea { min-height: 92px; padding: 13px 16px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input:disabled, .textarea:disabled { opacity: .6; cursor: not-allowed; background: var(--cream-deep); }

.field-label { display: block; font-size: 14px; font-weight: var(--fw-semibold); color: var(--text-strong); margin-bottom: 9px; }
.field-hint { font-size: 13px; color: var(--text-muted); margin: 8px 0 0; }

/* ================= Components: Checkbox ================= */
.checkbox {
  width: 22px; height: 22px; flex: 0 0 auto; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.checkbox svg { width: 13px; height: 13px; opacity: 0; color: var(--white); }
.checkbox[aria-checked="true"] { background: var(--primary); border-color: var(--primary); }
.checkbox[aria-checked="true"] svg { opacity: 1; }
.checkbox[aria-disabled="true"] { opacity: .55; }

/* ================= View 1: Create ================= */
.create-accents { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.create-accents .arc { position: absolute; top: -120px; right: -80px; width: 380px; height: 380px; border-radius: 50%; background: var(--terracotta-100); opacity: .5; }
.create-accents .circle { position: absolute; bottom: 40px; left: -100px; width: 260px; height: 260px; border-radius: 50%; background: var(--sage-100); opacity: .45; }
.create-wrap { position: relative; z-index: 1; max-width: 720px; }
.create-head { margin-bottom: 26px; }
.create-head h1 { font-size: 46px; font-weight: var(--fw-semibold); letter-spacing: -.02em; margin: 12px 0 14px; }
.create-lead { font-size: 18px; color: var(--text-secondary); max-width: 60ch; margin: 0; line-height: 1.55; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 26px;
}

.modules-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modules-header .field-label { margin: 0; }
.modules-header .hint { font-size: 13px; color: var(--text-muted); }
.modules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.module-card {
  display: flex; align-items: flex-start; gap: 13px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-md);
  padding: 15px; cursor: pointer; font-family: var(--font-body);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.module-card:hover:not(.is-disabled) { border-color: var(--border-strong); }
.module-card.is-checked { border-color: var(--primary); background: var(--plum-050); box-shadow: var(--shadow-xs); }
.module-card.is-disabled { cursor: not-allowed; opacity: .72; }
.module-icon {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 11px;
  background: var(--sage-100); color: var(--sage-600);
  display: flex; align-items: center; justify-content: center;
}
.module-icon svg { width: 22px; height: 22px; }
.module-body { flex: 1 1 auto; min-width: 0; }
.module-name { font-size: 15px; font-weight: var(--fw-semibold); color: var(--text-strong); display: flex; align-items: center; gap: 7px; }
.module-plan { font-size: 11px; font-weight: var(--fw-semibold); color: var(--text-muted); background: var(--cream-deep); padding: 2px 7px; border-radius: var(--radius-pill); letter-spacing: .04em; text-transform: uppercase; }
.module-desc { font-size: 13px; color: var(--text-secondary); margin-top: 3px; line-height: 1.4; }

.card-footer { border-top: 1px solid var(--border); padding-top: 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-footer .footer-hint { margin-left: auto; font-size: 13px; color: var(--text-muted); }
.form-error { color: var(--error-500); font-size: 14px; margin: 0; flex-basis: 100%; }

/* ================= View 2: Dashboard ================= */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.section-head h1 { font-size: 36px; margin: 10px 0 6px; }
.section-head .subtitle { font-size: 15px; color: var(--text-secondary); margin: 0; }
.job-list { display: flex; flex-direction: column; gap: 10px; }
.job-row {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px 22px; box-shadow: var(--shadow-xs); cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.job-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.job-main { flex: 1 1 auto; min-width: 0; }
.job-title { font-family: var(--font-display); font-size: 18px; font-weight: var(--fw-semibold); color: var(--text-strong); }
.job-url { font-size: 13px; color: var(--text-muted); margin-top: 1px; }
.job-meta { display: flex; align-items: center; gap: 9px; margin-top: 9px; font-size: 13px; color: var(--text-secondary); flex-wrap: wrap; }
.job-dots { display: inline-flex; gap: 4px; }
.job-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.chevron { font-size: 22px; color: var(--text-muted); line-height: 1; }

.empty-state { text-align: center; padding: 70px 20px; color: var(--text-secondary); }
.empty-state h2 { font-size: 22px; margin-bottom: 8px; }

/* ================= View 3: Detail ================= */
.back-link { font-size: 14px; font-weight: var(--fw-medium); color: var(--text-secondary); background: none; border: 0; cursor: pointer; padding: 0; font-family: var(--font-body); transition: color .15s; }
.back-link:hover { color: var(--primary); }
.detail-titlerow { display: flex; align-items: center; gap: 14px; margin: 20px 0 6px; flex-wrap: wrap; }
.detail-titlerow h1 { font-size: 38px; }
.detail-sub { font-size: 14px; color: var(--text-muted); margin: 0 0 22px; }
.brief-quote { border-left: 3px solid var(--primary); background: var(--plum-050); padding: 12px 16px; border-radius: 0 10px 10px 0; font-style: italic; color: var(--text-secondary); margin: 0 0 26px; }

.progress-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 10px; }
.progress-row .done { color: var(--text-strong); font-weight: var(--fw-semibold); }
.progress-row .req { color: var(--text-muted); }
.progress-track { height: 8px; background: var(--cream-deep); border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 30px; }
.progress-fill { height: 100%; background: var(--sage-500); border-radius: var(--radius-pill); transition: width .7s ease; }

.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.detail-grid h2 { font-size: 20px; margin-bottom: 14px; }

.module-rows { display: flex; flex-direction: column; gap: 10px; }
.mrow {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 15px 17px;
}
.mrow.is-skipped { opacity: .55; background: var(--cream); }
.mrow .module-icon.tone-done { background: var(--sage-100); color: var(--sage-600); }
.mrow .module-icon.tone-running { background: var(--plum-100); color: var(--plum-600); }
.mrow .module-icon.tone-error { background: var(--error-100); color: var(--error-500); }
.mrow .module-icon.tone-idle { background: var(--cream-deep); color: var(--ink-400); }
.mrow-body { flex: 1 1 auto; min-width: 0; }
.mrow-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.kb-link { font-size: 13px; font-weight: var(--fw-medium); color: var(--primary); text-decoration: none; }
.kb-link:hover { text-decoration: underline; }
.retry-link { font-size: 13px; font-weight: var(--fw-medium); color: var(--error-500); background: none; border: 0; cursor: not-allowed; opacity: .6; font-family: var(--font-body); }

.sidebar { display: flex; flex-direction: column; gap: 16px; }
.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.side-card.sunken { background: var(--surface-sunken); }
.side-card h3 { font-size: 16px; font-weight: var(--fw-semibold); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.side-card .copy { font-size: 13px; color: var(--text-secondary); margin: 0 0 14px; line-height: 1.5; }
.coming-soon { font-size: 10px; font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); background: var(--cream-deep); padding: 2px 8px; border-radius: var(--radius-pill); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.chip { font-size: 12.5px; font-weight: var(--fw-medium); color: var(--text-secondary); background: var(--cream-deep); border: 0; border-radius: var(--radius-pill); padding: 6px 12px; cursor: not-allowed; opacity: .7; font-family: var(--font-body); }

.detail-rows { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.detail-rows .drow { display: flex; justify-content: space-between; gap: 14px; font-size: 13px; }
.detail-rows .drow dt { color: var(--text-muted); }
.detail-rows .drow dd { color: var(--text-strong); font-weight: var(--fw-medium); margin: 0; text-align: right; word-break: break-word; }
.side-divider { height: 1px; background: var(--border); margin: 16px 0; }
.side-card .full-link { font-size: 13px; font-weight: var(--fw-medium); color: var(--primary); text-decoration: none; }
.side-card .full-link:hover { text-decoration: underline; }
.side-card .full-link.is-disabled { color: var(--text-muted); pointer-events: none; }

.loading { color: var(--text-muted); font-size: 15px; padding: 40px 0; }

/* ================= Responsive ================= */
@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .modules-grid { grid-template-columns: 1fr; }
  .create-head h1 { font-size: 36px; }
  .detail-titlerow h1 { font-size: 30px; }
}
@media (max-width: 560px) {
  .main { padding: 32px 18px 72px; }
  .header-inner { padding: 12px 18px; }
  .header-nav { gap: 2px; }
}
