/* EDM Portal
   Neutral, content-first UI: one accent colour, hairline borders, system typography.
   No inline styles anywhere (strict CSP). */

:root {
  color-scheme: light dark;

  --accent: #8a00e5;            /* Siemens Energy purple, used sparingly */
  --accent-ink: light-dark(#6f00b8, #c48cff);
  --accent-soft: light-dark(#f5eefc, #2a1b3a);

  --bg: light-dark(#fbfbfc, #0e0e11);
  --surface: light-dark(#ffffff, #16161a);
  --surface-2: light-dark(#f4f4f6, #1d1d22);
  --border: light-dark(#e6e6ea, #2a2a31);
  --border-strong: light-dark(#d4d4da, #3a3a43);
  --text: light-dark(#18181b, #ededf0);
  --text-2: light-dark(#52525b, #a1a1aa);
  --text-3: light-dark(#71717a, #7c7c86);

  --ok: light-dark(#15803d, #4ade80);
  --ok-soft: light-dark(#ecfdf3, #10261a);
  --warn: light-dark(#b45309, #fbbf24);
  --warn-soft: light-dark(#fffbeb, #2a2110);
  --err: light-dark(#b42318, #f87171);
  --err-soft: light-dark(#fef3f2, #2c1414);

  /* section tones: Siemens Energy purple, teal, blue, amber */
  --tone-self: light-dark(#8a00e5, #b77bff);
  --tone-apps: light-dark(#009999, #2dd4bf);
  --tone-platforms: light-dark(#2563eb, #60a5fa);
  --tone-products: light-dark(#d97706, #fbbf24);
  --hero: #1b1534;
  --hero-2: #2b2150;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px -12px rgb(0 0 0 / .12);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; --hero: #17122b; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  font: 14px/1.5 var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.011em; }
p { margin: 0; }
a { color: inherit; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: 12px; top: -40px; padding: 8px 12px; background: var(--text); color: var(--bg); border-radius: var(--radius); z-index: 100; }
.skip:focus { top: 12px; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; height: 56px; padding: 0 24px;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; white-space: nowrap; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--accent);
  /* simple mesh mark: three nodes, drawn with gradients so it stays CSP-safe */
  background-image:
    radial-gradient(circle at 30% 30%, #fff 0 2px, transparent 2.5px),
    radial-gradient(circle at 70% 45%, #fff 0 2px, transparent 2.5px),
    radial-gradient(circle at 40% 72%, #fff 0 2px, transparent 2.5px);
}
.brand-mark.large { width: 40px; height: 40px; border-radius: 10px; background-size: 100% 100%; }
.env-badge {
  font: 600 11px/1 var(--mono); letter-spacing: .04em; padding: 4px 6px; border-radius: 4px;
  color: var(--warn); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.topbar-search { flex: 1; max-width: 440px; margin-left: auto; }
.search {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-3); transition: border-color .15s;
}
.search:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { font-size: 16px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; color: var(--text); }
.search input::-webkit-search-cancel-button { display: none; }
kbd {
  font: 500 11px/1 var(--mono); color: var(--text-3); padding: 3px 5px;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2);
}
.account { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.topbar-search[hidden] + .theme-toggle { margin-left: auto; }
.theme-toggle svg { display: none; }
:root:not([data-theme]) .theme-toggle .i-system,
:root[data-theme="light"] .theme-toggle .i-light,
:root[data-theme="dark"] .theme-toggle .i-dark { display: block; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft);
}
.account-name { color: var(--text-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.link-button { border: 0; background: none; padding: 4px 2px; font: inherit; color: var(--text-3); cursor: pointer; }
.link-button:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------ buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 500 13px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.button:hover { background: var(--surface-2); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.button.small { height: 28px; padding: 0 10px; font-size: 12px; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button .spinner { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-button {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--radius);
  border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 18px;
}
.icon-button:hover { background: var(--surface-2); color: var(--text); }

/* ------------------------------------------------------------------ gate */
.gate { max-width: 420px; margin: 14vh auto; padding: 0 24px; text-align: center; display: grid; justify-items: center; gap: 12px; }
.gate h1 { font-size: 20px; margin-top: 8px; }
.gate p { color: var(--text-2); }
.gate .button { margin-top: 8px; }

/* ------------------------------------------------------------------ layout */
main { flex: 1; }
.layout {
  max-width: 1240px; margin: 0 auto; padding: 32px 24px 48px;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start;
}
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px;
  margin-bottom: 28px; padding: 28px 28px 24px; border-radius: var(--radius-lg);
  background: var(--hero); color: #fff; position: relative; overflow: hidden;
}
/* quiet mesh pattern, no gradient wash */
.page-head::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgb(255 255 255 / .14) 1px, transparent 1.5px);
  background-size: 18px 18px;
  mask-image: linear-gradient(to left, #000, transparent 70%);
}
.page-head > * { position: relative; z-index: 1; }
.page-head h1 { font-size: 26px; font-weight: 600; }
.page-head h1 .hl { color: #4fd1c5; }
.lede { color: rgb(255 255 255 / .72); margin-top: 6px; }

.tabs { display: flex; gap: 2px; padding: 3px; background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .12); border-radius: var(--radius); }
.tabs button {
  border: 0; background: none; height: 28px; padding: 0 10px; border-radius: 6px;
  font: 500 13px/1 var(--font); color: rgb(255 255 255 / .7); cursor: pointer;
}
.tabs button:hover { color: #fff; }
.tabs button[aria-pressed="true"] { background: #fff; color: var(--hero); }

.eyebrow { font-size: 12px; font-weight: 500; color: var(--text-3); margin-bottom: 10px; }

.recent { margin-bottom: 28px; }
.recent-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font: 500 13px/1 var(--font); color: var(--text); cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); }
.chip svg { color: var(--accent); font-size: 15px; }

/* ------------------------------------------------------------------ action sections */
.section { margin-bottom: 32px; --tone: var(--accent); }
[data-section="self"] { --tone: var(--tone-self); }
[data-section="apps"] { --tone: var(--tone-apps); }
[data-section="platforms"] { --tone: var(--tone-platforms); }
[data-section="products"] { --tone: var(--tone-products); }
.section-head { display: flex; align-items: baseline; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.section-head h2::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px;
  background: var(--tone); margin-right: 8px; vertical-align: 1px;
}
.section-head h2 { font-size: 15px; font-weight: 600; }
.section-head p { color: var(--text-3); font-size: 13px; }

.actions { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.action { border-bottom: 1px solid var(--border); }
.action-button {
  width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 14px 4px; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer;
  border-radius: 6px;
}
.action-button:hover { background: var(--surface-2); }
.action-button:hover .action-go { color: var(--text); transform: translateX(2px); }
.action-icon {
  width: 32px; height: 32px; border-radius: var(--radius); display: grid; place-items: center;
  border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent);
  background: color-mix(in srgb, var(--tone) 10%, var(--surface)); color: var(--tone); font-size: 17px;
}
.action-button:hover .action-icon { background: var(--tone); color: #fff; border-color: var(--tone); }
.action-text { min-width: 0; }
.action-title { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.action-desc { color: var(--text-3); font-size: 13px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-go { color: var(--text-3); font-size: 16px; transition: transform .15s, color .15s; }
.action-button:hover .action-go { color: var(--tone); }
.action.disabled .action-button { cursor: default; }
.action.disabled .action-button:hover { background: none; }
.action.disabled .action-title, .action.disabled .action-icon { opacity: .55; }
.tag {
  font: 500 11px/1 var(--font); padding: 3px 6px; border-radius: 4px;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
}
.tag.accent { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }

.empty { color: var(--text-2); padding: 40px 0; text-align: center; }

/* ------------------------------------------------------------------ side panels */
.side-col { display: grid; gap: 16px; position: sticky; top: 80px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; border-top: 3px solid var(--panel-tone, var(--accent)); }
#releases { --panel-tone: var(--tone-apps); }
.panel-title { font-size: 13px; font-weight: 600; margin-bottom: 12px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.step-n {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font: 600 11px/1 var(--mono); color: #fff; background: var(--accent);
}
.steps strong { display: block; font-weight: 500; font-size: 13px; }
.steps span:not(.step-n) { display: block; color: var(--text-3); font-size: 12px; }

.release-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.release-table th { text-align: left; font-weight: 500; color: var(--text-3); padding: 0 0 8px; }
.release-table th.env-col, .release-table td.env-col { text-align: center; width: 48px; }
.release-table td { padding: 8px 0; border-top: 1px solid var(--border); vertical-align: top; }
.release-table .rel-title { font-weight: 500; }
.release-table .rel-desc { color: var(--text-3); font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); vertical-align: middle; }
.dot.live { background: var(--ok); }
.dot.testing { background: var(--warn); }
.dot.planned { background: transparent; border: 1.5px solid var(--border-strong); }
.legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-3); font-size: 12px; margin-top: 12px; }
.legend .dot { margin-left: 8px; }
.legend .dot:first-child { margin-left: 0; }


/* ------------------------------------------------------------------ footer */
.footer {
  max-width: 1240px; width: 100%; margin: 0 auto; padding: 20px 24px 28px;
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between;
  color: var(--text-3); font-size: 12px; border-top: 1px solid var(--border);
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------ dialogs */
.dialog {
  width: min(520px, calc(100vw - 32px)); max-height: min(88dvh, 820px); padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: 0 24px 64px -16px rgb(0 0 0 / .35);
}
.dialog.wide { width: min(760px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgb(9 9 11 / .45); }
.dialog[open] { animation: dialog-in .16s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.99); } }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 20px 4px; }
.dialog-head h2 { font-size: 17px; font-weight: 600; }
.dialog-head p { color: var(--text-2); margin-top: 4px; }
.dialog > :not(.dialog-head) { margin-inline: 20px; }
.dialog > :last-child { margin-bottom: 20px; }

.env-list { list-style: none; padding: 0; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); }
.env-list li { display: flex; align-items: center; gap: 12px; padding: 14px; }
.env-list li + li { border-top: 1px solid var(--border); }
.env-list .env-text { flex: 1; min-width: 0; }
.env-list strong { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.env-list span.sub { color: var(--text-3); font-size: 13px; }
.env-list li.off { color: var(--text-3); }

.notice { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }
.notice.ok { border-color: color-mix(in srgb, var(--ok) 30%, transparent); background: var(--ok-soft); }
.notice.err { border-color: color-mix(in srgb, var(--err) 30%, transparent); background: var(--err-soft); }
.notice strong { display: block; margin-bottom: 2px; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice .button { margin-top: 10px; }

/* ------------------------------------------------------------------ form */
form { margin-top: 16px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color .12s, box-shadow .12s;
}
.field textarea { resize: vertical; min-height: 72px; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input#pf-code { font-family: var(--mono); letter-spacing: .02em; }
.hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.error { color: var(--err); font-size: 12px; margin-top: 4px; }
.error:empty { display: none; }
.field.invalid input, .field.invalid textarea { border-color: var(--err); }
.field.invalid .hint { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.check span { font-weight: 500; }
.check small { display: block; font-weight: 400; color: var(--text-3); font-size: 12px; }
.summary { margin-top: 16px; font-size: 13px; color: var(--text-2); }
.summary table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.summary td { padding: 6px 0; border-top: 1px solid var(--border); }
.summary td:first-child { color: var(--text-3); width: 34%; }
.summary code, .mono { font-family: var(--mono); font-size: 12px; color: var(--text); }
.fine-print { color: var(--text-3); font-size: 12px; margin-top: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ------------------------------------------------------------------ training */
.training-section + .training-section { margin-top: 20px; }
.training-section h3 { font-size: 12px; font-weight: 500; color: var(--text-3); margin: 16px 0 10px; }
.training-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.video-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); text-align: left; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.video-card:hover { border-color: var(--border-strong); }
.video-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); font-size: 28px; }
.video-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-meta { padding: 10px 12px 12px; }
.video-meta strong { display: block; font-weight: 500; }
.video-meta span { color: var(--text-3); font-size: 12px; }
#training-player video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); margin-top: 12px; }
#training-player h3 { font-size: 15px; margin-top: 12px; }
#training-player p { color: var(--text-2); margin-top: 4px; }
.muted { color: var(--text-3); margin-top: 16px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1040px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side-col { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 720px) {
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .brand-name, .account-name { display: none; }
  .layout { padding: 20px 16px 32px; }
  .actions { grid-template-columns: minmax(0, 1fr); }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .tabs { overflow-x: auto; max-width: 100%; }
  kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
