/* Design tokens transcribed from Strategiepapier VII (Teil A/B/C).
   This is the dashboard's own UI, not an article page, so only the tokens
   that apply to app chrome are used here — no header/article compositions
   (those are Block 5, the SVG shape library). */

:root {
  --color-primary: #2952e3;
  --color-mist-blue: #dce6fb;
  --color-apricot: #fbe0d0;
  --color-sage: #dcefe3;
  --color-lilac: #e8e1f7;
  --color-graphite: #1b1f2a;
  --color-paper: #f7f8fc;

  --color-dept-economy: #e8935e;
  --color-dept-psyche: #5ea37e;
  --color-dept-power: #2952e3;
  --color-dept-science: #8c6fd1;

  --font-display: "Space Grotesk", "General Sans", system-ui, sans-serif;
  --font-body: "Inter", "IBM Plex Sans", system-ui, sans-serif;

  --radius-pill: 999px;
  --radius-lg: 28px;
  --radius-md: 14px;
  --radius-sm: 8px;

  --glass-blur: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-paper);
  color: var(--color-graphite);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
}


main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

/* --- Queue list --- */
.queue-item {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(27, 31, 42, 0.06);
  cursor: pointer;
}

.queue-item .gate-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}

.gate-tag.gate_1_topic { background: var(--color-mist-blue); color: var(--color-primary); }
.gate-tag.gate_2_research { background: var(--color-lilac); color: #8c6fd1; }
.gate-tag.gate_3_publication { background: var(--color-sage); color: #5ea37e; }

.queue-item .summary {
  font-size: 15px;
  line-height: 1.45;
}

.queue-item .meta {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(27, 31, 42, 0.55);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: rgba(27, 31, 42, 0.5);
  font-size: 15px;
}

/* --- Detail sheet --- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 31, 42, 0.35);
  backdrop-filter: blur(4px);
  z-index: 20;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0));
  z-index: 21;
}

.sheet h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

.sheet .field-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(27, 31, 42, 0.5);
  margin-top: 16px;
  margin-bottom: 4px;
}

.sheet .body-text {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.6;
}

.sheet pre.json {
  background: var(--color-paper);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12px;
  overflow-x: auto;
}

.sheet .error-message {
  background: var(--color-apricot);
  color: var(--color-graphite);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 16px;
  font-size: 14px;
}

/* --- Buttons --- */
.actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

button {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 20px;
  cursor: pointer;
}

button.approve { background: var(--color-primary); color: #fff; }
button.reject { background: #fff; color: var(--color-graphite); border: 1px solid rgba(27,31,42,0.15); }
button.change { background: var(--color-apricot); color: #8a4a1f; }
button.close { background: transparent; color: rgba(27,31,42,0.5); }
button:disabled { background: rgba(27,31,42,0.08); color: rgba(27,31,42,0.35); cursor: not-allowed; }

/* --- Login --- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 8px 30px rgba(27, 31, 42, 0.1);
}

.login-card h1 {
  font-size: 24px;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.login-card p {
  font-size: 13px;
  color: rgba(27, 31, 42, 0.55);
  margin: 0 0 20px;
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(27, 31, 42, 0.15);
  font-size: 15px;
  margin-bottom: 12px;
}

.login-card button {
  width: 100%;
  background: var(--color-primary);
  color: #fff;
  padding: 13px;
}

.login-error {
  color: #c0392b;
  font-size: 13px;
  margin-bottom: 10px;
}

/* --- Jobs section --- */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 10px;
}

.section-heading h2 {
  font-size: 15px;
  color: rgba(27, 31, 42, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cost-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.cost-card .cost-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.cost-card .cost-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
}

.cost-card .cost-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: rgba(27, 31, 42, 0.08);
  overflow: hidden;
  margin: 8px 0;
}

.cost-card .cost-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-pill);
}

.cost-card .cost-bar-fill.over-budget {
  background: #c0392b;
}

.cost-card .cost-label {
  font-size: 12px;
  color: rgba(27, 31, 42, 0.55);
}

.job-item {
  background: #fff;
  border-left: 3px solid #c0392b;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 13px;
}

.job-item .job-type {
  font-weight: 600;
}

.job-item .job-error {
  color: rgba(27, 31, 42, 0.6);
  margin-top: 2px;
}

.status-subheading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(27, 31, 42, 0.45);
  margin: 20px 0 8px;
}

.status-subheading:first-child { margin-top: 0; }

.status-item {
  background: #fff;
  border-left: 3px solid var(--color-mist-blue);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 13px;
}

.status-item.active { border-left-color: var(--color-primary); }

.status-item-title { font-weight: 600; }

.status-item-meta {
  color: rgba(27, 31, 42, 0.55);
  margin-top: 2px;
  font-size: 12px;
}

.status-item-next {
  color: var(--color-primary);
  margin-top: 4px;
  font-size: 12px;
}

.plan-grid {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-day {
  border-top: 1px solid rgba(27, 31, 42, 0.08);
  padding-top: 6px;
}

.plan-day-label {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 4px;
}

.plan-day-date {
  font-weight: 400;
  color: rgba(27, 31, 42, 0.45);
}

.plan-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  padding: 2px 0;
  flex-wrap: wrap;
}

.plan-icon {
  width: 16px;
  flex: none;
  font-weight: 700;
}

.plan-state-done .plan-icon { color: #3a9a5c; }
.plan-state-in_progress .plan-icon { color: var(--color-primary); }
.plan-state-failed .plan-icon { color: #c94a3f; }
.plan-state-pending .plan-icon { color: rgba(27, 31, 42, 0.35); }

.plan-category { font-weight: 600; }

.plan-format {
  color: rgba(27, 31, 42, 0.55);
}

.plan-title {
  color: rgba(27, 31, 42, 0.75);
  font-style: italic;
}

.empty-state.small {
  padding: 14px;
  font-size: 13px;
  text-align: left;
}

.tabs {
  display: flex;
  gap: 4px;
  background: rgba(27, 31, 42, 0.06);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: 16px;
}

.tabs button {
  flex: 1;
  background: transparent;
  color: rgba(27, 31, 42, 0.6);
  padding: 8px;
}

.tabs button.active {
  background: #fff;
  color: var(--color-graphite);
  box-shadow: 0 1px 3px rgba(27,31,42,0.1);
}

.login-switch{display:flex;gap:4px;background:#eef1f8;border-radius:999px;padding:4px;margin:0 0 14px}
.login-switch button,.login-switch a{flex:1;text-align:center;border:0;background:none;border-radius:999px;padding:8px 10px;font:600 14px inherit;color:#5d6475;text-decoration:none;cursor:pointer}
.login-switch .on{background:#fff;color:#1b1f2a;box-shadow:0 1px 2px #1b1f2a22}
.au-row{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:8px 0;border-top:1px solid #e3e7f1;font-size:14px}
.au-row:first-child{border-top:0}
.au-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.au-actions button,.au-new button{border:0;border-radius:999px;background:#2952e3;color:#fff;padding:7px 14px;font-weight:600;font-size:13px;cursor:pointer}
.au-actions button.ghost{background:#fff;color:#2952e3;box-shadow:inset 0 0 0 1.5px #2952e3}
.au-actions button.danger{background:#fff;color:#c0392b;box-shadow:inset 0 0 0 1.5px #c0392b}
.au-new{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}.au-new input{flex:1;min-width:140px;padding:8px 10px;border:1px solid #dfe3ee;border-radius:10px;font:inherit}
.au-link{word-break:break-all;background:#eef1f8;border-radius:10px;padding:10px;margin-top:8px;font-size:13px}
.au-text{white-space:pre-wrap;max-height:50vh;overflow:auto;background:#fff;border:1px solid #e3e7f1;border-radius:10px;padding:12px;font-size:15px;line-height:1.55}
.au-f{border-left:4px solid #dfe3ee;padding:4px 10px;margin:8px 0;font-size:13px}.au-f.problem{border-color:#c0392b}.au-f.unclear{border-color:#b7791f}.au-f.ok{border-color:#2e7d57}

.login-brand .tag{color:#8a90a0;font-weight:500;font-size:16px;letter-spacing:-0.01em}
.login-brand{display:flex;align-items:center;justify-content:center;gap:10px;margin-bottom:10px}
.login-brand img{height:34px;width:auto}
