:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #e4e6ec;
  --text-muted: #9ba2b0;
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.15);
  --warn: #facc15;
  --warn-dim: rgba(250, 204, 21, 0.15);
  --danger: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1200px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  gap: 20px;
}

.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.main-nav a:hover { color: var(--text); }

/* Workspace */
.workspace { padding: 32px 0; }

.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

.panel-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

/* Preset bar */
.preset-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.preset-bar label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.preset-bar select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.9rem;
  flex: 1;
  min-width: 160px;
}

/* Form */
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
}

legend {
  font-weight: 600;
  padding: 0 8px;
  font-size: 0.95rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

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

.field label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.field input,
.field textarea {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.15s;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.field input.warn { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-dim); }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  font-family: var(--font);
}

.btn { background: var(--accent); color: #0f1115; }
.btn:hover { opacity: 0.9; }

.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--text-muted); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.1); }

/* Result panel */
.result-panel {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.result-card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.result-card-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.result-card-footer small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.summary-table td {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.summary-table td:first-child { color: var(--text-muted); width: 55%; }
.summary-table td:last-child { text-align: right; font-weight: 500; }
.summary-table tr:last-child td { border-bottom: none; }

.summary-table td.warn { color: var(--warn); }

.flags { margin-top: 12px; }

.flag {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.flag-warn { background: var(--warn-dim); color: var(--warn); }
.flag-ok { background: var(--accent-dim); color: var(--accent); }

/* Compare */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.compare-table th,
.compare-table td {
  padding: 6px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.compare-table th:first-child,
.compare-table td:first-child {
  text-align: left;
  color: var(--text-muted);
}

.compare-table th { font-weight: 600; }

.diff-pos { color: var(--warn); }
.diff-neg { color: var(--accent); }

/* Content sections */
.content-section {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.content-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.columns h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.columns p,
.columns ul {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.columns ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.columns li::before {
  content: "\2022";
  color: var(--accent);
  margin-right: 8px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* Sessions list */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.session-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.session-card .session-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.session-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 20px 0;
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 40px 0 20px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 24px;
}

.footer-grid strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.footer-grid p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.footer-links a:hover { color: var(--text); }

.footer-copy {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.85rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 200;
  animation: toast-in 0.2s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 900px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .result-panel { position: static; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .columns { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .main-nav { display: none; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }
}

/* Print */
@media print {
  .site-header, .site-footer, .preset-bar, .form-actions, .result-panel, .content-section, #sessions { display: none !important; }
  body { background: #fff; color: #000; }
  .workspace-grid { display: block; }
  fieldset { border-color: #ccc; }
  .field input, .field textarea { border-color: #ccc; color: #000; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
