/* Dark, accessible, responsive UI */
:root {
  --bg: #0f1216;
  --bg-elev: #161b22;
  --text: #e6edf3;
  --muted: #9aa4b2;
  --border: #2b3138;
  --accent: #3b82f6;
  --accent-600: #2563eb;
  --danger: #ef4444;
  --info: #22d3ee;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji';
  color: var(--text); background: radial-gradient(1200px 800px at 30% -10%, rgba(37,99,235,0.10), transparent), var(--bg);
}
.app-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent); }
.logo { width: 36px; height: 36px; }
.app-header h1 { margin: 0; font-size: 1.3rem; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }

.container.split { display: grid; grid-template-columns: 1fr 1.1fr; gap: 16px; padding: 16px; }
.panel { min-width: 0; }
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid .field:nth-child(1) { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-weight: 600; }
.req { color: var(--danger); font-weight: 500; }
input[type=text], input[type=datetime-local], select, textarea {
  width: 100%; background: #0c0f13; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 10px 12px; outline: none; transition: border-color .15s ease;
}
textarea { resize: vertical; min-height: 160px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.25); }

.switches { display: flex; gap: 16px; flex-wrap: wrap; border: 1px dashed var(--border); padding: 10px 12px; border-radius: 10px; margin-top: 8px; }
.switches legend { padding: 0 6px; color: var(--muted); }
.switches label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }

.actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.btn { appearance: none; border: 1px solid var(--border); background: #0e131a; color: var(--text); padding: 10px 14px; border-radius: 10px; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent-600); color: white; }
.btn.ghost { background: transparent; }
.btn:focus-visible { outline: 3px solid rgba(59,130,246,.5); outline-offset: 2px; }

.alert { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--border); }
.alert.error { border-color: #7f1d1d; background: rgba(239,68,68,0.12); }
.alert.info { border-color: #0e7490; background: rgba(34,211,238,0.12); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: #0e131a; }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.row-actions { display: inline-flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .95rem; }

.render { min-height: 200px; }
.codeblock { background: #0b0f14; border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow: auto; }

.app-footer { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); border-top: 1px solid var(--border); padding: 16px; }
.sep { opacity: .5; }

/* Loading state */
body.busy { cursor: progress; }
body.busy .btn.primary { opacity: .7; pointer-events: none; }

/* Responsive */
@media (max-width: 980px) {
  .container.split { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
