:root {
  color-scheme: light;
  --ink: #17233b;
  --muted: #667085;
  --line: #e5e9f0;
  --paper: #ffffff;
  --ground: #f3f5f8;
  --accent: #e0612f;
  --accent-dark: #bd4720;
  --blue: #294d7a;
  --warn: #fff4d8;
  --danger: #9b2c2c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px max(20px, calc((100vw - 1120px) / 2));
  background: var(--ink);
  color: white;
}
.topbar h1, .section-title h2, .login-card h1 { margin: 2px 0 0; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .13em; font-size: .72rem; font-weight: 800; opacity: .72; }
.layout { max-width: 1120px; margin: 28px auto; padding: 0 20px 48px; display: grid; grid-template-columns: .92fr 1.08fr; gap: 22px; align-items: start; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: 0 14px 36px rgba(26, 39, 63, .07); }
.section-title { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 22px; }
label { display: block; font-size: .86rem; font-weight: 700; margin: 18px 0 8px; }
textarea, input { width: 100%; border: 1px solid #cfd6e2; border-radius: 12px; padding: 13px 14px; background: #fbfcfe; color: var(--ink); }
textarea:focus, input:focus { outline: 3px solid rgba(41, 77, 122, .15); border-color: var(--blue); }
button, .upload-button { border: 0; border-radius: 12px; padding: 13px 16px; font-weight: 800; text-align: center; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.secondary, .upload-button, .record { background: #eaf0f7; color: var(--blue); }
.danger { background: #fae9e9; color: var(--danger); }
.quiet { color: white; background: rgba(255,255,255,.1); }
.wide { width: 100%; margin-top: 12px; }
.split-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.upload-button { display: block; margin: 0; cursor: pointer; }
.record.active { color: white; background: var(--danger); }
.material-strip { margin: 20px 0 8px; padding: 13px 15px; border-radius: 12px; background: #f6f8fb; display: flex; justify-content: space-between; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 7px 10px; font-weight: 800; font-size: .78rem; color: #9b421f; background: #ffe9df; white-space: nowrap; }
.badge.neutral { color: #45556e; background: #edf1f6; }
.preview { white-space: pre-wrap; font: 500 1rem/1.55 Inter, ui-sans-serif, sans-serif; border: 1px solid var(--line); background: #fbfcfe; border-radius: 14px; padding: 18px; min-height: 230px; overflow-wrap: anywhere; }
.empty-state { min-height: 230px; border: 1px dashed #cbd3df; border-radius: 14px; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.alert { border-radius: 12px; padding: 12px 14px; line-height: 1.45; }
.warning { background: var(--warn); color: #745009; }
.error { background: #fae9e9; color: var(--danger); }
.edit-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hidden { display: none !important; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(92vw, 620px); padding: 13px 18px; border-radius: 12px; background: var(--ink); color: white; box-shadow: 0 15px 40px rgba(0,0,0,.25); z-index: 10; }

.login-page { display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at top, #344968, var(--ink)); }
.login-card { width: min(100%, 420px); padding: 32px; border-radius: 20px; background: white; box-shadow: 0 28px 70px rgba(0,0,0,.3); }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 13px; color: white; background: var(--accent); font-weight: 900; }

@media (max-width: 820px) {
  .topbar { padding: 18px 16px; }
  .topbar h1 { font-size: 1.35rem; }
  .layout { grid-template-columns: 1fr; margin: 16px auto; padding: 0 12px 34px; }
  .card { padding: 18px; border-radius: 15px; }
  .action-grid { grid-template-columns: 1fr; }
  .edit-row { grid-template-columns: 1fr; }
}
