/* The SHIFT palette, taken from the Figma designs (example_files/shift_designs). The older token names
   (--color-bg, --color-bg-raised, ...) are kept and pointed at the new palette, so every stylesheet
   that already uses them picks the new look up without being rewritten. */
:root {
  /* Surfaces, darkest first. */
  --surface-page: #111215;
  --surface-nav: #16171b;
  --surface-card: #1b1c21;
  --surface-panel: #18181b;
  --surface-tile: #27272a;
  --surface-raised: #2c2d35;
  --surface-control: #1e2024;
  --surface-strong: #404040;

  /* Lines. */
  --line-subtle: #23242a;
  --line: #27272a;
  --line-card: #2c2d35;
  --line-control: #383942;
  --line-strong: #404040;

  /* Text. */
  --text-strong: #ffffff;
  --text: #fafafa;
  --text-soft: #d9dee5;
  --text-secondary: #a4a7ae;
  --text-muted: #a1a1aa;
  --text-dim: #737373;
  --text-faint: #62656b;

  /* Accents. */
  --accent: #8b5cf6;
  --accent-hover: #7c4ae8;
  --accent-strong: #7f56d9;
  --accent-tab: #9e77ed;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --highlight: #e0a92c;
  --highlight-soft: rgba(224, 169, 44, 0.1);
  --status-blue: #679fdb;
  --status-green: #55b96d;
  --status-amber: #e0a92c;
  --status-red: #f87171;
  --status-red-soft: rgba(248, 113, 113, 0.14);

  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  --font-family: "Inter", "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --nav-height: 56px;

  /* The original tokens, now aliases. */
  --color-bg: var(--surface-page);
  --color-bg-raised: var(--surface-card);
  --color-text: var(--text);
  --color-text-muted: var(--text-muted);
  --color-status-ready: var(--status-green);
  --color-status-important: var(--accent);
  --color-status-warning: var(--status-amber);
  --color-status-error: var(--status-red);
  --color-selected: var(--highlight);
  --color-selected-soft: var(--highlight-soft);
  --radius-sharp: var(--radius);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface-page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface-page);
  color: var(--text);
  font-family: var(--font-family);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input, select, textarea { font-family: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::selection { background: var(--accent-soft); }

/* Thin dark scrollbars, so the panels do not show a bright system one. */
* { scrollbar-color: #3f3f46 transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { height: 8px; width: 8px; }
*::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

.icon { display: block; flex: none; }

/* ---------------------------------------------------------------- text */

.eyebrow {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 12px;
  text-transform: uppercase;
}

.text-important {
  color: var(--text-strong);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
  text-transform: none;
}

.mono { font-family: var(--font-mono); }

/* ---------------------------------------------------------------- buttons */

/* .production-button is the older name some workspaces still use; it is drawn as .btn. */
.btn,
.production-button {
  align-items: center;
  appearance: none;
  background: var(--surface-strong);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: #f5f5f5;
  cursor: pointer;
  display: inline-flex;
  flex: none;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  gap: 6px;
  height: 32px;
  justify-content: center;
  line-height: 20px;
  padding: 0 10px;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.btn:hover:not(:disabled), .production-button:hover:not(:disabled) { background: #4d4d4d; }
.btn:disabled, .production-button:disabled { cursor: default; opacity: 0.45; }
.btn--primary, .production-button--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled), .production-button--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--outline { background: transparent; border-color: var(--line-strong); color: #fff; }
.btn--outline:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); }
.btn--light { background: #f5f5f5; color: #0a0a0a; }
.btn--light:hover:not(:disabled) { background: #e5e5e5; }
.btn--ghost { background: transparent; color: #fff; }
.btn--ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.btn--danger, .production-button--danger { background: var(--status-red-soft); color: var(--status-red); }
.btn--danger:hover:not(:disabled), .production-button--danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.22); }
.btn--lg { border-radius: var(--radius-md); font-family: var(--font-family); font-size: 16px; font-weight: 600; gap: 8px; height: 40px; padding: 0 16px; }
.btn--lg .icon { height: 20px; width: 20px; }
.btn--sm { font-size: 13px; height: 28px; padding: 0 8px; }

.icon-btn {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  flex: none;
  height: 32px;
  justify-content: center;
  padding: 0;
  transition: background-color 0.12s, opacity 0.12s;
  width: 32px;
}
.icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.icon-btn:disabled { cursor: default; opacity: 0.35; }
.icon-btn--bare { border-color: transparent; }
.icon-btn--sm { border-radius: var(--radius-md); height: 28px; width: 28px; }
.icon-btn.is-active { background: #e5e5e5; border-color: #e5e5e5; color: #0a0a0a; }

/* ---------------------------------------------------------------- badges */

.badge {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  display: inline-flex;
  flex: none;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  gap: 4px;
  height: 20px;
  line-height: 16px;
  padding: 0 8px;
  white-space: nowrap;
}
.badge--light { background: #e5e5e5; color: #0a0a0a; }
.badge--dark { background: var(--surface-strong); color: #f5f5f5; }
.badge--outline { border-color: var(--line-strong); color: #fff; }
.badge--plain { color: #fff; padding: 0; }
.badge--count { background: #262626; border-radius: var(--radius-lg); color: #d4d4d4; height: 22px; padding: 0 8px; }
.badge--purple { background: var(--accent-soft); border-color: rgba(139, 92, 246, 0.5); color: #c4b5fd; }
.badge--amber { background: rgba(224, 169, 44, 0.14); border-color: rgba(224, 169, 44, 0.55); color: var(--highlight); }
.badge--green { background: rgba(85, 185, 109, 0.16); border-color: rgba(85, 185, 109, 0.55); color: #7fd08f; }
.badge--blue { background: rgba(103, 159, 219, 0.16); border-color: rgba(103, 159, 219, 0.55); color: #9cc3ec; }
.badge--red { background: var(--status-red-soft); border-color: rgba(248, 113, 113, 0.5); color: var(--status-red); }

/* A status badge that opens a menu of every status, for whoever may change it. */
.status-menu { display: inline-flex; position: relative; }
.status-menu__trigger { appearance: none; cursor: default; font-family: var(--font-ui); }
.status-menu.is-enabled .status-menu__trigger { cursor: pointer; }
.status-menu.is-enabled .status-menu__trigger:hover { filter: brightness(1.08); }
.status-menu__list {
  background: var(--surface-card);
  border: 1px solid var(--line-card);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  left: 0;
  list-style: none;
  margin: 6px 0 0;
  min-width: 11rem;
  padding: 4px;
  position: absolute;
  top: 100%;
  z-index: 30;
}
.status-menu__option {
  background: none;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  display: block;
  font-size: 13px;
  padding: 6px 8px;
  text-align: left;
  width: 100%;
}
.status-menu__option:hover { background: rgba(255, 255, 255, 0.06); }
.status-menu__option[aria-checked="true"] { color: var(--accent-tab); font-weight: 600; }

/* ---------------------------------------------------------------- form controls */

.select-control,
.input-control {
  appearance: none;
  background-color: var(--surface-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 14px;
  height: 32px;
  line-height: 20px;
  min-width: 0;
  padding: 0 10px;
}
.select-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 8px center;
  background-repeat: no-repeat;
  cursor: pointer;
  padding-right: 30px;
}
.select-control:disabled, .input-control:disabled { cursor: default; opacity: 0.5; }
.select-control:focus, .input-control:focus { border-color: #52525b; outline: none; }
.select-control option { background: var(--surface-card); color: var(--text); }
.input-control::placeholder { color: var(--text-dim); }

.textarea-control {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 16px;
  min-height: 76px;
  padding: 8px 10px;
  resize: vertical;
  width: 100%;
}
.textarea-control::placeholder { color: #a3a3a3; }
.textarea-control:focus { border-color: #5b5b5b; outline: none; }
.textarea-control:disabled { opacity: 0.5; }

input[type="checkbox"] { accent-color: var(--accent); }

/* A toggle switch drawn over a real checkbox. */
.switch { align-items: center; cursor: pointer; display: inline-flex; gap: 12px; position: relative; user-select: none; }
.switch input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.switch__track {
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), #171717;
  border-radius: var(--radius-pill);
  flex: none;
  height: 14px;
  position: relative;
  transition: background 0.15s;
  width: 24px;
}
.switch__track::after {
  background: #e5e5e5;
  border-radius: 50%;
  content: "";
  height: 12px;
  left: 1px;
  position: absolute;
  top: 1px;
  transition: transform 0.15s;
  width: 12px;
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(10px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch__label { color: var(--text-secondary); font-family: var(--font-ui); font-size: 12px; line-height: 16px; }

/* Empty thumbnail tile. */
.thumb-empty { align-items: center; background: var(--surface-tile); color: #52525b; display: flex; justify-content: center; }

/* ---------------------------------------------------------------- legacy status bar */

.status-bar {
  align-items: center;
  background: var(--surface-card);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius);
  display: flex;
  font-size: 0.875rem;
  height: 1.75rem;
  line-height: 1;
  padding: 0 0.75rem;
  width: 100%;
}
.status-bar[data-status="ready"] { border-left-color: var(--status-green); }
.status-bar[data-status="important"] { border-left-color: var(--accent); }
.status-bar[data-status="warning"] { border-left-color: var(--status-amber); }
.status-bar[data-status="error"] { border-left-color: var(--status-red); }

/* ---------------------------------------------------------------- dialogs */

/* The dimmed layer a dialog sits on. */
.modal-backdrop {
  align-items: flex-start;
  backdrop-filter: blur(2px);
  background: rgba(8, 9, 11, 0.72);
  display: flex;
  inset: 0;
  justify-content: center;
  overflow-y: auto;
  padding: 10vh 24px 40px;
  position: fixed;
  z-index: 100;
}

.dialog {
  background: var(--surface-card);
  border: 1px solid var(--line-card);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  color: var(--text);
  max-width: 100%;
}

.dialog-header { align-items: flex-start; display: flex; gap: 16px; }
.dialog-header__icon {
  align-items: center;
  background: rgba(127, 86, 217, 0.18);
  border-radius: 10px;
  color: var(--accent-tab);
  display: flex;
  flex: none;
  height: 48px;
  justify-content: center;
  width: 48px;
}
.dialog-header__title { align-items: center; color: #fff; display: flex; font-size: 24px; font-weight: 700; gap: 10px; line-height: 30px; margin: 0; }
.dialog-header__count { align-items: center; background: #e5e5e5; border-radius: 50%; color: #0a0a0a; display: inline-flex; font-size: 14px; font-weight: 600; height: 26px; justify-content: center; width: 26px; }
.dialog-header__text { color: var(--text-soft); font-size: 15px; line-height: 22px; margin: 4px 0 0; }

/* A brief message that slides up from the bottom of a workspace and goes again (.production-notice is its older name). */
.toast,
.production-notice {
  background: var(--surface-card);
  border: 1px solid var(--line-card);
  border-left: 3px solid var(--status-green);
  border-radius: var(--radius-md);
  bottom: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-size: 13px;
  left: 50%;
  max-width: min(36rem, calc(100vw - 48px));
  padding: 10px 14px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 120;
}
.toast--error, .production-notice--error { border-left-color: var(--status-red); }
