/* The hidden attribute must always win over component display rules (e.g. display:flex rows). */
[hidden] { display: none !important; }

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #1d4ed8;
  --warn-bg: #ffedd5;
  --warn-text: #9a3412;
  --error: #b91c1c;
  --header-h: 48px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-title { font-weight: 700; font-size: 17px; }

.view-switch { display: flex; gap: 4px; }

.view-switch button {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}

.view-switch button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.view-switch button:disabled { opacity: 0.5; cursor: not-allowed; }

.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-warn { background: var(--warn-bg); color: var(--warn-text); }

.muted { color: var(--muted); }
.error { color: var(--error); }

/* Session ended mid-edit (api.js): above every dialog, the page stays as it is. */
.session-ended { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 30000; max-width: min(640px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 8px; background: #fef3c7; color: #78350f; border: 1px solid #f59e0b; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); font-size: 14px; }
.session-ended a { color: #92400e; font-weight: 600; }
.session-ended .btn { margin-left: 8px; }
