/*
  RISE Workflow Console stylesheet, themed to match the RISE product's design
  system. The token vocabulary below is ported from the main RISE frontend
  (cloud-solution-development/frontend/styles.css) and trimmed to what this
  console actually uses. A component written against var(--token) needs no
  per-theme override rule — only the two token blocks below differ.
*/

* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;

  --bg: #F6F6FB;
  --surface: #ffffff;
  --surface-2: #F1F1F8;
  --border: rgba(20, 20, 50, 0.12);
  --border-strong: rgba(20, 20, 50, 0.2);
  --text: #14142F;
  --text-muted: #66667f;
  --text-faint: #9797ab;
  --field-bg: rgba(20, 20, 50, 0.03);
  --accent: #5B54F5;
  --accent-hover: #4A44E0;
  --accent-ink: #fff;
  --accent-soft: rgba(91, 84, 245, 0.1);
  --danger: #C4433F;
  --danger-bg: #FBE4E2;
  --success: #218A67;
  --success-bg: #DEF3EA;
  --warn: #FF955A;
  --warn-bg: #FFE7D8;
  --scrim: rgba(15, 46, 48, 0.35);

  --hero-gradient: linear-gradient(160deg, #EEEDFD 0%, #DCE4FF 45%, #D8F0EC 100%);
  --particle-rgb: 91, 84, 245;
  --particle-line-alpha: 0.22;
  --particle-dot-alpha: 0.4;
  --blob-a: #A8C1FF;
  --blob-b: #5B54F5;
  --blob-c: #FF955A;
  --blob-opacity-a: 0.4;
  --blob-opacity-b: 0.22;
  --blob-opacity-c: 0.2;

  --shadow: 0 10px 28px rgba(39, 36, 110, 0.1);
  --shadow-card: 0 22px 70px rgba(39, 36, 110, 0.13), 0 3px 12px rgba(39, 36, 110, 0.06);

  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0a0c0f;
  --surface: #14171b;
  --surface-2: #191c20;
  --border: color-mix(in srgb, var(--text) 10%, transparent);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f2f4f6;
  --text-muted: #9aa3ac;
  --text-faint: #666e75;
  --field-bg: color-mix(in srgb, var(--text) 4%, transparent);
  --accent: #45bcc3;
  --accent-hover: #62C6CD;
  --accent-ink: #04211f;
  --accent-soft: rgba(69, 188, 195, 0.15);
  --danger: #f98d8d;
  --danger-bg: #3a2323;
  --success: #5edac4;
  --success-bg: #1d3a35;
  --warn: #f3b36f;
  --warn-bg: #3a2f1e;
  --scrim: rgba(15, 46, 48, 0.55);

  --hero-gradient: linear-gradient(160deg, #0a141c 0%, #123047 42%, #1b4d52 100%);
  --particle-rgb: 255, 255, 255;
  --particle-line-alpha: 0.18;
  --particle-dot-alpha: 0.6;
  --blob-a: #45bcc3;
  --blob-b: #4f47a8;
  --blob-c: #a3634a;
  --blob-opacity-a: 0.30;
  --blob-opacity-b: 0.20;
  --blob-opacity-c: 0.16;

  --shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 22px 70px rgba(0, 0, 0, 0.5), 0 3px 12px rgba(0, 0, 0, 0.3);
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--hero-gradient);
  color: var(--text);
}

[hidden] { display: none !important; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  margin: 0;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ---- Shared translucent surface (login card, panels) ---- */
.glass {
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  box-shadow: var(--shadow-card);
}

/* ---- Ambient background blobs, used on the signed-in views ---- */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
}

.blob--a {
  width: 460px;
  height: 460px;
  background: var(--blob-a);
  opacity: var(--blob-opacity-a);
  top: -160px;
  left: -140px;
}

.blob--b {
  width: 420px;
  height: 420px;
  background: var(--blob-b);
  opacity: var(--blob-opacity-b);
  bottom: -180px;
  right: -120px;
}

.blob--c {
  width: 300px;
  height: 300px;
  background: var(--blob-c);
  opacity: var(--blob-opacity-c);
  top: 40%;
  left: 60%;
}

/* ---- Theme toggle ---- */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 250;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

/* ---- Views ---- */
.view {
  position: relative;
  min-height: 100vh;
}

/* Signed-in views sit on the flatter page ground, not the login's hero
   gradient — the .blob elements are what carries colour into them, same
   split as the rest of RISE. */
#versions-view.view,
#editor-view.view {
  background: var(--bg);
  overflow: hidden;
}

/* ---- One button system ---- */
.button-primary,
.button-secondary,
.button-danger,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.13s ease, border-color 0.13s ease, color 0.13s ease;
}

.button-secondary,
.btn {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.button-secondary:hover,
.btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

.button-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button-primary:disabled {
  background: color-mix(in srgb, var(--accent) 35%, var(--surface-2));
  color: color-mix(in srgb, var(--accent-ink) 60%, var(--text-faint));
  cursor: not-allowed;
}

.button-danger {
  background: transparent;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

.button-danger:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.link-button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 0;
  cursor: pointer;
}

.link-button:hover {
  color: var(--text);
}

.link-button:disabled {
  color: var(--text-faint);
  cursor: default;
  text-decoration: none;
}

/* ---- Fields ---- */
label,
.field-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  margin: 0.9rem 0 0.4rem;
}

input,
select,
textarea,
.field {
  width: 100%;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

textarea {
  min-height: 100px;
  font-family: monospace;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.error {
  color: var(--danger);
  background: var(--danger-bg);
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 0.9rem 0 0;
  white-space: pre-wrap;
}

/* ---- Login ---- */
#login-view.view {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  padding: 0;
}

#net {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(360px, 90vw);
  padding: clamp(48px, 11vh, 104px) 0 72px;
  margin: 0;
  text-align: center;
  box-sizing: border-box;
}

.login-card__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-card__wordmark {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  line-height: 1;
  color: var(--text);
}

.login-card__tagline {
  margin-top: 10px;
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 450;
  color: var(--text-muted);
}

.auth-step {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.auth-step h1 {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
}

.auth-step .subtitle {
  text-align: center;
}

.auth-step button[type="submit"] {
  margin-top: 1.5rem;
}

/* ---- Signed-in shell ---- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 20px;
  /* Reserve the theme toggle's own width plus a gap — it is fixed to the
     same spot on every view, and the topbar's last action would otherwise
     land underneath it. */
  padding: 0 68px 0 24px;
  height: 56px;
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

.topbar__title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar__nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.topbar__link {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  font-family: inherit;
  font-size: 12.8px;
  font-weight: 650;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.topbar__link:hover {
  color: var(--text);
}

.topbar #sign-out {
  margin-left: 8px;
}

/* ---- Page shell (versions / editor) ---- */
.page {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page__header h1 {
  font-size: 1.4rem;
}

.page__header-sub {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: none;
}

.page__header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.workflow-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.workflow-picker select {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 6px 10px;
  font-size: 0.85rem;
}

/* An author display rule beats the browser's own [hidden] rule regardless
   of specificity, so a toggleable element needs this companion. */
.workflow-picker[hidden] {
  display: none;
}

.panel {
  border-radius: 16px;
  padding: 8px;
  overflow: hidden;
}

/* ---- Table ---- */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 14px;
  font-size: 13.4px;
}

.table th {
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table td .link-button {
  margin-right: 12px;
}

.table td.error {
  margin: 0;
}

/* ---- Stage editor ---- */
.stage-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  background: var(--surface);
}

.stage-card__row {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
}

.stage-card__row > * {
  flex: 1;
}

.stage-card__label {
  display: block;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.stage-card__row > .link-button {
  flex: none;
  margin-top: 4px;
}

.substeps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.substep-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.substep-row input {
  flex: 1;
}

.editor-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
