/* Practice — shared styles (consistent with Velocity & Benchmark) */
:root {
  --accent: #0A3655;
  --accent-dark: #072540;
  --accent-light: #eef4f9;
  --alert: #A8313F;
  --alert-light: #fef2f2;
  --ink: #1f2937;
  --ink-light: #4b5563;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --bg: #f9fafb;
  --card: #ffffff;
  --good: #10b981;
  --warn: #f59e0b;
  --bad: var(--accent);
  --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

.beta-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}
.internal-pill {
  background: var(--ink);
}

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand::before {
  content: "";
  width: 22px;
  height: 14px;
  background: url("optro-mark.svg") center/contain no-repeat;
  display: inline-block;
  flex-shrink: 0;
}
.accent { color: var(--accent); }

/* Brand pip — Optro orbital mark */
.brand-pip {
  width: 28px;
  height: 18px;
  background: url("optro-mark.svg") center/contain no-repeat;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}
.brand-pip.sm {
  width: 22px;
  height: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--ink);
  text-decoration: none;
  transition: all 0.15s;
  font-family: inherit;
}
.btn:hover { background: #f3f4f6; }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: #d1d5db; border-color: #d1d5db; cursor: not-allowed; }
.btn-ghost { border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Top nav */
.top-nav {
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.top-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
}
.top-nav-brand {
  display: flex;
  align-items: center;
  gap: 6px;
}
.top-nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
  margin-left: 16px;
}
.top-nav-link {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.15s;
}
.top-nav-link:hover { background: #f3f4f6; color: var(--ink); }
.top-nav-link.active { background: #f3f4f6; color: var(--ink); font-weight: 600; }
.top-nav-user {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Page header */
.page-header { padding: 32px 0 24px; }
.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.page-sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

/* Form elements */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 12px; font-weight: 600; color: var(--ink); }
.form-row input, .form-row select, .form-row textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  background: white;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10, 54, 85, 0.1);
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-help { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Radio group as chip-pills */
.radio-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.radio-pill {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  background: white;
  transition: all 0.15s;
}
.radio-pill:hover { background: #f3f4f6; }
.radio-pill.selected {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

/* Engagement cards */
.engagement-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.engagement-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 12px -4px rgba(0,0,0,0.08);
}
.engagement-card.urgent { border-color: #fecaca; }
.engagement-card.urgent::before {
  content: 'T-MINUS UNDER 100 DAYS';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  background: var(--alert);
  color: white;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 8px 8px 0 0;
  text-align: center;
}
.engagement-card.urgent {
  padding-top: 30px;
}

.eng-customer { font-weight: 600; font-size: 16px; margin-bottom: 2px; }
.eng-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.eng-meta strong { color: var(--ink); font-weight: 500; }

.t-minus {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.t-minus.urgent { color: var(--alert); }

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar-fill {
  height: 100%;
  background: var(--ink);
  transition: width 0.3s ease;
}
.progress-bar-fill.urgent { background: var(--alert); }

/* Stage badge */
.stage-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 3px;
  background: #f3f4f6;
  color: var(--ink-light);
}
.stage-badge.scoping { background: #fef3c7; color: #92400e; }
.stage-badge.design { background: #dbeafe; color: #1e40af; }
.stage-badge.remediation { background: var(--alert-light); color: var(--alert); }
.stage-badge.testing { background: var(--alert-light); color: var(--alert); }
.stage-badge.filing { background: #ecfdf5; color: var(--good); }
.stage-badge.steady_state { background: #f3f4f6; color: var(--muted); }
.stage-badge.no_program { background: #f3f4f6; color: var(--muted); }

/* Margin indicator */
.margin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.margin-num {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.margin-num.behind { color: var(--alert); }
.margin-num.ahead { color: var(--good); }
.margin-num.neutral { color: var(--ink); }

/* Milestone checklist */
.stage-section {
  margin-bottom: 20px;
}
.stage-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  border-bottom: none;
}
.stage-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}
.stage-section-meta {
  font-size: 11px;
  color: var(--muted);
}
.stage-section-body {
  border: 1px solid var(--border);
  border-radius: 0 0 6px 6px;
  background: white;
  border-top: none;
}
.deliverable-row {
  display: grid;
  grid-template-columns: 28px 1fr 180px 100px;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 13px;
}
.deliverable-row:last-child { border-bottom: none; }
.deliverable-row:hover { background: #fafafa; }
.deliverable-check {
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.deliverable-check.complete {
  background: var(--good);
  border-color: var(--good);
  color: white;
}
.deliverable-status-select {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  font-family: inherit;
}
.deliverable-hours {
  font-family: monospace;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

/* Notes timeline */
.note-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  margin-bottom: 8px;
}
.note-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; }
.note-body { font-size: 13px; line-height: 1.5; }

/* Templates grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.template-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.template-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -4px rgba(0,0,0,0.08);
}
.template-name { font-weight: 600; font-size: 14px; margin-bottom: 8px; line-height: 1.3; }
.template-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.template-meta-item { display: flex; gap: 4px; align-items: center; }
.template-meta-item strong { color: var(--ink); font-weight: 500; }
.firm-pill {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  background: var(--ink);
  color: white;
  border-radius: 3px;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.5);
  z-index: 50;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, calc(-50% + 8px));
  width: 820px; max-width: 95vw;
  max-height: 85vh;
  background: white;
  z-index: 51;
  border-radius: 12px;
  opacity: 0; pointer-events: none;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}
.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Playbook layout */
.playbook-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: flex-start;
}
.playbook-nav {
  position: sticky;
  top: 80px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  padding: 8px;
  font-size: 13px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}
.playbook-nav-item {
  display: block;
  padding: 6px 10px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 4px;
  margin-bottom: 1px;
}
.playbook-nav-item:hover { background: #f3f4f6; color: var(--ink); }
.playbook-nav-item.section-header {
  font-weight: 600;
  color: var(--ink);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 10px;
  padding: 6px 10px 4px;
  cursor: default;
}
.playbook-nav-item.section-header:hover { background: transparent; color: var(--ink); }

.playbook-content {
  font-size: 14px;
  line-height: 1.65;
  max-width: 760px;
}
.playbook-content h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.playbook-content h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 40px 0 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.playbook-content h2:first-of-type { border-top: none; padding-top: 0; }
.playbook-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 6px;
}
.playbook-content p { margin: 0 0 12px; }
.playbook-content ul { margin: 0 0 12px; padding-left: 20px; }
.playbook-content li { margin-bottom: 4px; }
.playbook-content code {
  font-family: monospace;
  font-size: 12px;
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 3px;
}
.draft-badge {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: #fef3c7;
  color: #92400e;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Scoping calculator output */
.brief-preview {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 28px;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.6;
  position: sticky;
  top: 80px;
}
.brief-preview h3 {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.brief-preview .brief-meta {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
}
.brief-preview .brief-stat {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-family: var(--sans);
  font-size: 13px;
  border-bottom: 1px dashed var(--border);
}
.brief-preview .brief-stat:last-of-type { border-bottom: none; }
.brief-preview .brief-stat-num {
  font-family: var(--serif);
  font-weight: 700;
}

/* Helpers */
.muted { color: var(--muted); }
.tiny { font-size: 11px; }

/* Gate */
#gate-overlay {
  position: fixed;
  inset: 0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 16px;
}
#gate-overlay.hidden { display: none; }
#gate-form { display: flex; gap: 8px; align-items: center; }
#gate-input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  outline: none;
}
#gate-input:focus { border-color: var(--accent); }
#gate-error {
  color: var(--alert);
  font-size: 12px;
  height: 16px;
}

/* Print */
@media print {
  body { background: white; }
  .top-nav, button:not(.print-keep), .modal-backdrop, .modal { display: none !important; }
  .brief-preview { position: static; box-shadow: none; }
}

/* ============================================================
   REFINED POLISH — single layer, modern-minimalist quality
   Replaces all prior polish iterations. Scoped, non-destructive,
   focused on type rendering, focus rings, and transition easing.
   No universal border overrides. No layered shadows. No heavy
   chrome. Inspired by Harvey / Linear / Vercel design vocabulary.
   ============================================================ */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-feature-settings: "ss01", "cv11", "cv02";
  letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6 {
  font-feature-settings: "ss01", "cv11", "cv02";
  letter-spacing: -0.022em;
  font-weight: 600;
}

h1 { line-height: 1.08; }
h2 { line-height: 1.2; }
h3 { line-height: 1.3; }

/* Subtle focus rings on interactive elements only */
*:focus { outline: none; }
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 54, 85, 0.12);
}
a:focus-visible {
  outline: 2px solid rgba(10, 54, 85, 0.35);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Mono ligatures on code */
code, kbd, samp, pre,
.mono, [class*="mono"], [class*="-mono"] {
  font-feature-settings: "ss01", "cv01", "cv02", "cv11";
}

/* Smoother default easing on every transition */
* {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Disable text-selection highlight on interactive nav chrome */
nav, button, .btn, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}
