* { font-family: "Open Sans", sans-serif !important; }
code, pre, .font-mono, .editor-textarea, .md-preview code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace !important; }
/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
*, *::before, *::after { box-sizing: border-box; }
html, body, button, input, select, textarea { font-family: 'Open Sans', sans-serif; }
body { background: #0A0A0A; color: #d4d4d8; min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Layout ── */
.container { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 56rem; margin: 0 auto; padding: 0 1.5rem; }

/* ── Navbar ── */
.navbar { border-bottom: 1px solid #2A2A2A; background: #0A0A0A; position: sticky; top: 0; z-index: 40; }
.navbar-inner { max-width: 72rem; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1.5rem; }
.navbar-brand { font-size: 1.125rem; font-weight: 600; color: #fff; letter-spacing: -0.025em; }
.navbar-links { display: flex; align-items: center; gap: 1.5rem; }
.navbar-link { font-size: 0.875rem; color: #a1a1aa; transition: color 0.15s; }
.navbar-link:hover { color: #fff; }
.navbar-right { display: flex; align-items: center; gap: 1rem; }
.navbar-status { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: #71717a; }
.navbar-disconnect { font-size: 0.75rem; color: #71717a; background: none; border: none; padding: 0; transition: color 0.15s; }
.navbar-disconnect:hover { color: #f87171; }

/* ── Dot indicators ── */
.dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; display: inline-block; flex-shrink: 0; }
.dot-green { background: #10b981; }
.dot-green-pulse { background: #10b981; animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.dot-red { background: #ef4444; }
.dot-blue { background: #FFDB2A; }
.dot-blue-pulse { background: #FFDB2A; animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.dot-yellow { background: #eab308; }
.dot-gray { background: #6b7280; }
.dot-sm { width: 0.375rem; height: 0.375rem; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1.25rem; font-size: 0.875rem; font-weight: 500; border-radius: 0.5rem; border: none; transition: all 0.15s; line-height: 1; }
.btn-blue { background: #FFDB2A; color: #111; }
.btn-blue:hover { background: #ffe566; color: #111; }
.btn-yellow { background: #ca8a04; color: #fff; }
.btn-yellow:hover { background: #eab308; }
.btn-gray { background: #2A2A2A; color: #d4d4d8; }
.btn-gray:hover { background: #3f3f46; color: #fff; }
.btn-ghost { background: none; border: none; color: #a1a1aa; }
.btn-ghost:hover { color: #e4e4e7; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.8125rem; }

/* ── Cards ── */
.card { background: #111111; border: 1px solid #2A2A2A; border-radius: 0.75rem; padding: 1.25rem; transition: border-color 0.15s; }
.card-hover:hover { border-color: #52525b; }
.card-lg { padding: 1.5rem; border-radius: 1rem; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; white-space: nowrap; }
.badge-purple { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.badge-orange { background: rgba(249, 115, 22, 0.2); color: #fb923c; }
.badge-cyan { background: rgba(6, 182, 212, 0.2); color: #22d3ee; }
.badge-emerald { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-zinc { background: rgba(63, 63, 70, 0.5); color: #d4d4d8; }

/* ── Status colors ── */
.status-initialized { background: #6b7280; }
.status-tone_review { background: #eab308; }
.status-generating { background: #FFDB2A; }
.status-complete { background: #22c55e; }
.status-error { background: #ef4444; }
.status-pending { background: #9ca3af; }
.status-running { background: #FFDB2A; }
.status-skipped { background: #d4d4d8; }

/* ── Forms ── */
.input { width: 100%; background: #2A2A2A; border: 1px solid #3f3f46; border-radius: 0.5rem; padding: 0.625rem 0.875rem; color: #fff; font-size: 0.875rem; outline: none; transition: all 0.15s; }
.input::placeholder { color: #71717a; }
.input:focus { box-shadow: 0 0 0 2px #FFDB2A; border-color: transparent; }
.input-lg { padding: 0.875rem 1rem; font-size: 1rem; }
select.input { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371717a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; }
.label { display: block; color: #d4d4d8; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; }
textarea.input { resize: none; font-family: inherit; }

/* ── Alerts ── */
.alert { border-radius: 0.5rem; padding: 0.75rem 1rem; font-size: 0.875rem; }
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #f87171; }
.alert-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: #4ade80; }
.alert-info { background: rgba(255, 219, 42, 0.1); border: 1px solid rgba(255, 219, 42, 0.3); color: #FFDB2A; }
.alert-warning { background: rgba(234, 179, 8, 0.1); border: 1px solid rgba(234, 179, 8, 0.3); color: #facc15; }
.alert-lg { border-radius: 0.75rem; padding: 1.25rem; }

/* ── Progress Bar ── */
.progress-track { width: 100%; background: #2A2A2A; border-radius: 9999px; overflow: hidden; }
.progress-track-sm { height: 0.375rem; }
.progress-track-md { height: 0.5rem; }
.progress-bar { height: 100%; border-radius: 9999px; transition: width 0.7s ease-out; }
.progress-blue { background: #FFDB2A; }
.progress-green { background: #22c55e; }

/* ── Grid ── */
.grid { display: grid; gap: 1rem; }
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1024px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ── Text ── */
.text-white { color: #fff; }
.text-zinc-200 { color: #e4e4e7; }
.text-zinc-300 { color: #d4d4d8; }
.text-zinc-400 { color: #a1a1aa; }
.text-zinc-500 { color: #71717a; }
.text-zinc-600 { color: #52525b; }
.text-blue-400 { color: #FFDB2A; }
.text-green-400 { color: #4ade80; }
.text-red-400 { color: #f87171; }
.text-yellow-300 { color: #fde047; }
.text-yellow-400 { color: #facc15; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.italic { font-style: italic; }
.leading-relaxed { line-height: 1.625; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ── Spacing / Flex / Layout ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-2 { margin-left: 0.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-8 > * + * { margin-top: 2rem; }

/* ── Spinner ── */
.spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.spinner-icon { width: 1rem; height: 1rem; }
.spinner-icon-lg { width: 1.5rem; height: 1.5rem; }
.spinner-icon-xl { width: 2rem; height: 2rem; }

/* ── Skeleton ── */
.skeleton { background: #2A2A2A; border-radius: 0.25rem; animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* ── Login page ── */
.login-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; }
.login-card { background: #111111; border: 1px solid #2A2A2A; border-radius: 1rem; padding: 2.5rem; width: 100%; max-width: 24rem; }
.login-icon { width: 3.5rem; height: 3.5rem; border-radius: 0.75rem; background: #2A2A2A; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; }
.login-title { font-size: 1.5rem; font-weight: 600; color: #fff; text-align: center; margin-bottom: 0.5rem; }
.login-subtitle { font-size: 0.875rem; color: #71717a; text-align: center; margin-bottom: 1.5rem; line-height: 1.5; }

/* ── Modal / Dialog ── */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
.modal-content { position: relative; background: #111111; border: 1px solid #2A2A2A; border-radius: 1rem; max-width: 28rem; width: 100%; margin: 5rem 1rem 0; padding: 1.5rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.25rem; font-weight: 600; color: #fff; }
.modal-close { color: #71717a; background: none; border: none; padding: 0.25rem; transition: color 0.15s; }
.modal-close:hover { color: #d4d4d8; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; padding-top: 0.5rem; }

/* ── Back link ── */
.back-link { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.875rem; color: #a1a1aa; transition: color 0.15s; margin-bottom: 1.5rem; }
.back-link:hover { color: #fff; }

/* ── Drop Zone ── */
.drop-zone { position: relative; border-radius: 0.75rem; border: 2px dashed #3f3f46; padding: 2rem; text-align: center; cursor: pointer; transition: all 0.15s; background: rgba(24, 24, 27, 0.5); }
.drop-zone:hover { border-color: #71717a; }
.drop-zone.dragging { border-color: #FFDB2A; background: rgba(255, 219, 42, 0.1); }
.drop-zone.uploading { opacity: 0.6; pointer-events: none; }
.drop-zone input[type="file"] { display: none; }

/* ── Document status row ── */
.doc-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0; }
.doc-row + .doc-row { border-top: 1px solid #2A2A2A; }
.doc-icon { width: 1.5rem; height: 1.5rem; border-radius: 9999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-icon-found { background: rgba(34, 197, 94, 0.2); }
.doc-icon-missing { background: #3f3f46; }

/* ── Skill row ── */
.skill-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.25rem; }
.skill-icon { width: 1.5rem; height: 1.5rem; border-radius: 9999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.skill-icon-pending { background: #2A2A2A; }
.skill-icon-running { /* spinner, no bg */ }
.skill-icon-complete { background: rgba(34, 197, 94, 0.2); }
.skill-icon-error { background: rgba(239, 68, 68, 0.2); }
.skill-icon-skipped { background: #3f3f46; }

/* ── Divider list ── */
.divide-y > * + * { border-top: 1px solid rgba(39, 39, 42, 0.5); }

/* ── Category header ── */
.category-header { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #a1a1aa; margin-bottom: 0.75rem; }

/* ── Deliverable card ── */
.deliverable-card { display: flex; flex-direction: column; height: 100%; cursor: pointer; }
.deliverable-card:hover { border-color: #52525b; }
.deliverable-card .card-title { color: #e4e4e7; font-size: 0.875rem; font-weight: 500; transition: color 0.15s; }
.deliverable-card:hover .card-title { color: #fff; }

/* ── Project card ── */
.project-card { cursor: pointer; }
.project-card:hover { border-color: #52525b; }
.project-card .project-name { color: #fff; font-size: 1.125rem; font-weight: 600; transition: color 0.15s; }
.project-card:hover .project-name { color: #FFDB2A; }

/* ── View mode toggle ── */
.view-toggle { display: inline-flex; align-items: center; background: #111111; border: 1px solid #2A2A2A; border-radius: 0.5rem; padding: 0.25rem; }
.view-toggle-btn { padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 500; border-radius: 0.375rem; border: none; background: transparent; color: #a1a1aa; transition: all 0.15s; cursor: pointer; }
.view-toggle-btn:hover { color: #e4e4e7; }
.view-toggle-btn.active { background: #2A2A2A; color: #fff; }

/* ── Editor ── */
.editor-container { display: flex; flex-direction: column; height: 70vh; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; background: #111111; border-bottom: 1px solid #2A2A2A; }
.editor-toolbar-label { font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: #a1a1aa; }
.editor-toggle { display: inline-flex; align-items: center; background: #2A2A2A; border-radius: 0.5rem; padding: 0.125rem; }
.editor-toggle-btn { padding: 0.375rem 0.75rem; font-size: 0.75rem; font-weight: 500; border-radius: 0.375rem; border: none; background: transparent; color: #a1a1aa; cursor: pointer; transition: all 0.15s; }
.editor-toggle-btn:hover { color: #e4e4e7; }
.editor-toggle-btn.active { background: #3f3f46; color: #fff; }
.editor-panes { display: flex; flex: 1; min-height: 0; }
.editor-pane { display: flex; flex-direction: column; overflow: hidden; }
.editor-pane-half { width: 50%; }
.editor-pane-full { width: 100%; }
.editor-pane-divider { border-right: 1px solid #2A2A2A; }
.editor-pane-header { padding: 0.375rem 1rem; background: rgba(24, 24, 27, 0.5); border-bottom: 1px solid rgba(39, 39, 42, 0.5); }
.editor-pane-header span { font-size: 0.625rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: #71717a; }
.editor-textarea { flex: 1; width: 100%; resize: none; background: #0a0a0b; color: #e4e4e7; font-size: 0.875rem; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace; line-height: 1.625; padding: 1rem; border: none; outline: none; overflow-y: auto; }
.editor-textarea::placeholder { color: #52525b; }
.editor-preview { flex: 1; overflow-y: auto; background: #0a0a0b; }

/* ── Markdown Preview ── */
.md-preview { padding: 1.25rem; }
.md-preview h1 { font-size: 1.5rem; font-weight: 700; color: #fff; margin-top: 2rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid #2A2A2A; }
.md-preview h1:first-child { margin-top: 0; }
.md-preview h2 { font-size: 1.25rem; font-weight: 600; color: #fff; margin-top: 1.75rem; margin-bottom: 0.75rem; }
.md-preview h3 { font-size: 1.125rem; font-weight: 600; color: #e4e4e7; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.md-preview h4 { font-size: 1rem; font-weight: 600; color: #d4d4d8; margin-top: 1.25rem; margin-bottom: 0.5rem; }
.md-preview p { color: #d4d4d8; line-height: 1.625; margin-bottom: 1rem; }
.md-preview a { color: #FFDB2A; text-decoration: underline; text-underline-offset: 2px; }
.md-preview a:hover { color: #93c5fd; }
.md-preview ul { list-style: disc inside; color: #d4d4d8; margin-bottom: 1rem; margin-left: 0.5rem; }
.md-preview ol { list-style: decimal inside; color: #d4d4d8; margin-bottom: 1rem; margin-left: 0.5rem; }
.md-preview li { color: #d4d4d8; line-height: 1.625; margin-bottom: 0.375rem; }
.md-preview li > ul, .md-preview li > ol { margin-top: 0.375rem; margin-bottom: 0; margin-left: 1rem; }
.md-preview blockquote { border-left: 4px solid #3f3f46; padding-left: 1rem; font-style: italic; color: #a1a1aa; margin: 1rem 0; }
.md-preview code { background: #2A2A2A; color: #e4e4e7; padding: 0.125rem 0.375rem; border-radius: 0.25rem; font-size: 0.875rem; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace; }
.md-preview pre { background: rgba(39, 39, 42, 0.8); border: 1px solid #3f3f46; border-radius: 0.5rem; padding: 1rem; overflow-x: auto; margin: 1rem 0; color: #e4e4e7; }
.md-preview pre code { background: none; padding: 0; border-radius: 0; }
.md-preview table { width: 100%; font-size: 0.875rem; color: #d4d4d8; border-collapse: collapse; margin: 1rem 0; }
.md-preview thead { background: rgba(39, 39, 42, 0.5); color: #e4e4e7; }
.md-preview th { border: 1px solid #3f3f46; padding: 0.5rem 0.75rem; text-align: left; font-weight: 600; }
.md-preview td { border: 1px solid rgba(63, 63, 70, 0.5); padding: 0.5rem 0.75rem; }
.md-preview hr { border: none; border-top: 1px solid #2A2A2A; margin: 1.5rem 0; }
.md-preview strong { color: #fff; font-weight: 600; }
.md-preview em { color: #d4d4d8; font-style: italic; }

/* ── Review gate ── */
.review-gate { background: rgba(234, 179, 8, 0.1); border: 1px solid rgba(234, 179, 8, 0.3); border-radius: 0.75rem; padding: 1.25rem; }

/* ── Completion banner ── */
.complete-banner { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); border-radius: 0.75rem; padding: 1rem 1.25rem; display: flex; align-items: center; gap: 0.75rem; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-icon { width: 3.5rem; height: 3.5rem; border-radius: 1rem; background: #2A2A2A; display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; }

/* ── Unsaved indicator ── */
.unsaved-indicator { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; font-size: 0.75rem; color: #facc15; }
.unsaved-dot { width: 0.375rem; height: 0.375rem; border-radius: 9999px; background: #facc15; }

/* ── Misc ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.max-h-70vh { max-height: 70vh; }
.border-b { border-bottom: 1px solid #2A2A2A; }
.cursor-pointer { cursor: pointer; }
.inline-flex { display: inline-flex; }
.relative { position: relative; }
.transition-colors { transition: color 0.15s, background-color 0.15s, border-color 0.15s; }

/* ── Per-doc-type upload slots ── */
.doc-slot { border: 1px solid #2A2A2A; border-radius: 0.5rem; padding: 0.75rem; transition: border-color 0.15s; }
.doc-slot-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.drop-zone-sm { border: 1px dashed #2A2A2A; border-radius: 0.375rem; padding: 0.625rem; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.drop-zone-sm:hover { border-color: #FFDB2A; }
.drop-zone-sm.dragging { border-color: #FFDB2A; background: rgba(255, 219, 42, 0.05); }

/* ── Kanit for headings and titles ── */
h1, h2, h3, h4, h5, h6,
.text-2xl, .text-xl, .text-lg,
.font-bold, .font-semibold,
.md-preview h1, .md-preview h2, .md-preview h3 {
  font-family: 'Kanit', sans-serif !important;
}
