/* ============================================================
   VYNAKRO SUITE — Design System
   Audit-grade interface. Precision. Trust. Data-first.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Serif:wght@400;500;600;700&display=swap');

:root {
  /* ── Surface ── */
  --bg:            #0F1115;   /* near-black slate */
  --bg-elevated:   #171A21;   /* cards on dark */
  --bg-sunk:       #0A0C10;   /* deeper panels */
  --surface:       #FFFFFF;   /* light content cards */
  --surface-2:     #FAFAF7;   /* subtle off-white */
  --surface-3:     #F2F1EC;   /* bone / graphite */

  /* ── Lines ── */
  --line:          #23272F;   /* dark dividers */
  --line-2:        #2E333D;
  --line-light:    #E7E5DE;   /* light dividers */
  --line-light-2:  #D9D6CD;

  /* ── Text ── */
  --ink:           #0F1115;
  --ink-2:         #2B2F37;
  --ink-3:         #5A6070;
  --ink-4:         #8A8F9C;
  --ink-inverse:   #F5F4F0;
  --ink-inverse-2: #C3C7D1;
  --ink-inverse-3: #7C828E;

  /* ── Accent ── */
  --accent:        #10B981;   /* verified / pass (emerald) */
  --accent-dim:    #047857;
  --accent-soft:   #D1FAE5;
  --accent-ink:    #064E3B;

  /* ── Signal ── */
  --warn:          #F59E0B;   /* amber */
  --warn-soft:     #FEF3C7;
  --warn-ink:      #78350F;

  --flag:          #DC2626;   /* crimson — rule violation */
  --flag-soft:     #FEE2E2;
  --flag-ink:      #7F1D1D;

  --info:          #2563EB;
  --info-soft:     #DBEAFE;
  --info-ink:      #1E3A8A;

  /* ── Typography ── */
  --font-sans:   'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:   'IBM Plex Mono', ui-monospace, monospace;
  --font-serif:  'IBM Plex Serif', Georgia, serif;

  /* ── Motion ── */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* ── Metrics ── */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;
  --shadow-1:  0 1px 2px rgba(15, 17, 21, 0.04), 0 1px 3px rgba(15, 17, 21, 0.06);
  --shadow-2:  0 2px 4px rgba(15, 17, 21, 0.05), 0 8px 24px rgba(15, 17, 21, 0.08);
  --shadow-3:  0 24px 48px rgba(15, 17, 21, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'ss02', 'cv11';
}

body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }

/* ── Mono numbers everywhere they belong ── */
.mono, .num, [data-num] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  color: var(--ink-inverse);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink-inverse);
}

.brand-mark {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--bg);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: -0.05em;
}

.topbar-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.topbar-nav a {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-inverse-2);
  transition: all 0.18s var(--ease);
  letter-spacing: -0.005em;
}

.topbar-nav a:hover {
  color: var(--ink-inverse);
  background: rgba(255,255,255,0.05);
}

.topbar-nav a.active {
  color: var(--ink-inverse);
  background: rgba(16, 185, 129, 0.12);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.22);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-inverse-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-4);
}

.status-dot.live::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.page-head {
  margin-bottom: 36px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-light-2);
}

.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1.15;
}

.page-sub {
  margin-top: 10px;
  font-size: 15px;
  color: var(--ink-3);
  max-width: 680px;
  line-height: 1.5;
}

.page-actions {
  display: flex;
  gap: 10px;
}

/* ============================================================
   GRID
   ============================================================ */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; }
}

.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 32px; }

.row { display: flex; gap: 10px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; }

/* ============================================================
   PANEL (our card primitive)
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--line-light-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-light);
  background: var(--surface-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.panel-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.panel-body { padding: 22px; }

.panel-body.dense { padding: 16px 22px; }

.panel-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line-light);
  background: var(--surface-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ============================================================
   FORM
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.form-grid.one-col { grid-template-columns: 1fr; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full { grid-column: 1 / -1; }

.field > label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.field > label .req { color: var(--flag); margin-left: 2px; }

.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-light-2);
  border-radius: var(--radius);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.input.mono,
.textarea.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.input:hover, .select:hover, .textarea:hover { border-color: var(--line-light-2); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3px rgba(15, 17, 21, 0.06);
}

.textarea {
  resize: vertical;
  line-height: 1.6;
  min-height: 92px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235A6070' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ── Dropzone ── */
.dropzone {
  border: 1.5px dashed var(--line-light-2);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.dropzone:hover, .dropzone:focus {
  border-color: var(--ink-3);
  background: var(--surface);
  outline: none;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.005);
}

.dropzone-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 10px;
  color: var(--ink-3);
}

.dropzone-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.status-line {
  margin-top: 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent-dim);
}

/* ============================================================
   BUTTON
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.003em;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--ink);
  color: var(--ink-inverse);
  border-color: var(--ink);
}

.btn-primary:hover:not(:disabled) {
  background: #000;
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-accent:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line-light-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--ink-3);
}

.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }

/* ============================================================
   BADGE / PILL
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 3px;
  border: 1px solid transparent;
}

.pill-pass     { background: var(--accent-soft); color: var(--accent-ink); border-color: #A7F3D0; }
.pill-warn     { background: var(--warn-soft);   color: var(--warn-ink);   border-color: #FDE68A; }
.pill-flag     { background: var(--flag-soft);   color: var(--flag-ink);   border-color: #FCA5A5; }
.pill-info     { background: var(--info-soft);   color: var(--info-ink);   border-color: #BFDBFE; }
.pill-neutral  { background: var(--surface-3);   color: var(--ink-2);      border-color: var(--line-light-2); }

/* ============================================================
   TABLE
   ============================================================ */
.t-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data thead th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: left;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-light-2);
}

table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-light);
  color: var(--ink-2);
  vertical-align: top;
}

table.data tbody tr:last-child td { border-bottom: none; }

table.data .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

table.data tr.highlight td {
  background: #FAFAF7;
  font-weight: 600;
  color: var(--ink);
}

table.data .delta-pos { color: var(--accent-dim); }
table.data .delta-neg { color: var(--flag); }

/* ============================================================
   AI OUTPUT PANEL
   ============================================================ */
.ai-out {
  padding: 0;
}

.ai-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  font-style: italic;
}

.ai-loading {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface-2);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-light-2);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.ai-panel {
  padding: 20px 22px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
}

.ai-panel strong { color: var(--ink); font-weight: 600; }
.ai-panel h1, .ai-panel h2, .ai-panel h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--ink);
  margin: 16px 0 6px;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.ai-panel h1:first-child, .ai-panel h2:first-child, .ai-panel h3:first-child { margin-top: 0; }

.ai-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line-light);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--ink-3);
}

.ai-chip {
  padding: 2px 7px;
  background: var(--ink);
  color: var(--ink-inverse);
  border-radius: 3px;
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 0.14em;
}

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-warn { background: var(--warn-soft); color: var(--warn-ink); border-color: #FDE68A; }
.alert-flag { background: var(--flag-soft); color: var(--flag-ink); border-color: #FCA5A5; }
.alert-info { background: var(--info-soft); color: var(--info-ink); border-color: #BFDBFE; }

/* ============================================================
   CHECKLIST (used in Estimate Audit + WM Reference)
   ============================================================ */
.checklist {
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-2);
}

.checklist > div {
  padding: 6px 0;
  border-bottom: 1px dashed var(--line-light);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.checklist > div:last-child { border-bottom: none; }

.check-mark {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--accent-dim);
  font-size: 10px;
  font-weight: 700;
}

.ref-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-light);
  font-size: 13px;
  gap: 12px;
}

.ref-row:last-child { border-bottom: none; }
.ref-row strong { font-family: var(--font-mono); color: var(--ink); font-weight: 600; }

/* ============================================================
   LANDING PAGE
   ============================================================ */
.hero {
  padding: 88px 0 64px;
  text-align: center;
  position: relative;
  border-bottom: 1px solid var(--line-light-2);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-light) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.25) 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.25) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero-eyebrow {
  display: inline-block;
  padding: 4px 10px;
  margin-bottom: 22px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--line-light-2);
  border-radius: 99px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(40px, 5.5vw, 64px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 20px;
}

.hero-title em {
  font-style: italic;
  color: var(--accent-dim);
  font-weight: 500;
}

.hero-sub {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-3);
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.tools-section {
  padding: 72px 0;
}

.section-head {
  text-align: center;
  margin-bottom: 48px;
}

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-3);
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .tools-grid { grid-template-columns: 1fr; }
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--line-light-2);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all 0.25s var(--ease-out);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.tool-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}

.tool-card:hover {
  border-color: var(--ink-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.tool-card:hover::after { transform: scaleX(1); }

.tool-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.14em;
  margin-bottom: 18px;
}

.tool-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 10px;
}

.tool-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-3);
  flex: 1;
  margin-bottom: 20px;
}

.tool-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tool-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--ink);
  padding-top: 14px;
  border-top: 1px solid var(--line-light);
}

.tool-cta .arrow { transition: transform 0.2s var(--ease); }
.tool-card:hover .tool-cta .arrow { transform: translateX(3px); }

/* ── Footer ── */
.footer {
  padding: 40px 32px 48px;
  border-top: 1px solid var(--line-light-2);
  background: var(--bg);
  color: var(--ink-inverse-3);
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.footer a { color: var(--ink-inverse-2); }
.footer a:hover { color: var(--accent); }

/* ============================================================
   UTILITIES
   ============================================================ */
.mt-0 { margin-top: 0 !important; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }

.hide { display: none !important; }

.divider {
  height: 1px;
  background: var(--line-light);
  margin: 20px 0;
}

/* ── Anim ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fade-up 0.4s var(--ease-out) both; }
.fade-up-1 { animation-delay: 0.06s; }
.fade-up-2 { animation-delay: 0.12s; }
.fade-up-3 { animation-delay: 0.18s; }

/* ── Print ── */
@media print {
  .topbar, .footer, .btn, .panel-foot { display: none; }
  .panel { border: 1px solid #ccc; box-shadow: none; }
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 80;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--ink-inverse);
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-3);
  animation: fade-up 0.3s var(--ease-out) both;
}

.toast.error { background: var(--flag); }
.toast.warn  { background: var(--warn); color: #000; }
