/* TCMsysN Central — shared mockup styles.
   Visual language follows PACsysN/mockups (teal brand, slate neutrals). */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif; background: #f8fafc; color: #1e293b; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
table { border-collapse: collapse; width: 100%; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

:root {
  color-scheme: light;
  --brand: #0ea5b7; --brand-dark: #0f766e; --brand-light: #ccfbf1; --brand-50: #f0fdfa;
  --slate-50:#f8fafc; --slate-100:#f1f5f9; --slate-200:#e2e8f0; --slate-300:#cbd5e1; --slate-400:#94a3b8;
  --slate-500:#64748b; --slate-600:#475569; --slate-700:#334155; --slate-800:#1e293b; --slate-900:#0f172a;
  --green:#16a34a; --green-bg:#dcfce7; --green-fg:#166534;
  --amber:#d97706; --amber-bg:#fef3c7; --amber-fg:#92400e;
  --red:#dc2626;   --red-bg:#fee2e2;   --red-fg:#991b1b;
  --blue:#2563eb;  --blue-bg:#dbeafe;  --blue-fg:#1e40af;
  --violet:#7c3aed; --violet-bg:#ede9fe; --violet-fg:#5b21b6;
}

/* ── Layout ───────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 244px; background: #fff; border-right: 1px solid var(--slate-200); flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main { flex: 1; min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--slate-200); padding: 12px 24px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; color: var(--slate-900); }
.topbar-sub { font-size: 12px; color: var(--slate-500); display: flex; align-items: center; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.content { padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 18px; }
.mobile-nav { display: none; }
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .mobile-nav { display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--slate-200); }
  .mobile-nav a { white-space: nowrap; font-size: 12px; padding: 5px 10px; border-radius: 999px; background: var(--slate-100); color: var(--slate-600); }
  .mobile-nav a.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}

/* ── Sidebar ──────────────────────────────────────────── */
.sb-brand { padding: 18px 20px; border-bottom: 1px solid var(--slate-100); display: flex; align-items: center; gap: 12px; }
.sb-logo { width: 36px; height: 36px; border-radius: 8px; background: linear-gradient(135deg, #14b8a6, #0f766e); display: grid; place-items: center; color: #fff; }
.sb-name { font-weight: 700; color: var(--slate-900); }
.sb-sub { font-size: 11px; color: var(--slate-500); margin-top: -2px; }
.sb-nav { padding: 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.sb-group { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--slate-400); padding: 12px 12px 4px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; color: var(--slate-500); font-weight: 500; cursor: pointer; }
.nav-link:hover { background: var(--slate-100); color: var(--slate-900); }
.nav-link.active { background: rgba(14,165,183,0.10); color: var(--brand-dark); }
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-link .badge { margin-left: auto; font-size: 10px; font-weight: 600; background: var(--brand-light); color: var(--brand-dark); padding: 1px 7px; border-radius: 999px; }
.nav-link .badge.warn { background: var(--amber-bg); color: var(--amber-fg); }
.nav-link.muted { opacity: .55; cursor: default; }
.sb-user { padding: 12px 16px; border-top: 1px solid var(--slate-100); display: flex; align-items: center; gap: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; display: grid; place-items: center; font-weight: 600; flex-shrink: 0; font-size: 12px; }
.sb-user-name { font-size: 13px; font-weight: 500; color: var(--slate-800); }
.sb-user-role { font-size: 11px; color: var(--slate-500); }

/* ── Lifecycle strip (the end-to-end spine) ───────────── */
.journey { background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; padding: 12px 14px; overflow-x: auto; }
.journey-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; font-size: 11px; color: var(--slate-500); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.journey-head span:last-child { text-transform: none; letter-spacing: 0; font-weight: 500; }
.journey-track { display: flex; align-items: flex-start; min-width: 860px; }
.j-step { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; padding: 0 2px; }
.j-step::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--slate-200); z-index: 0; }
.j-step:first-child::before { display: none; }
.j-step.done::before, .j-step.current::before { background: var(--brand); }
.j-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: #fff; border: 2px solid var(--slate-300); color: var(--slate-400); position: relative; z-index: 1; }
.j-step.done .j-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.j-step.current .j-dot { border-color: var(--brand); color: var(--brand-dark); box-shadow: 0 0 0 4px rgba(14,165,183,.18); }
.j-label { font-size: 11.5px; font-weight: 600; color: var(--slate-500); margin-top: 5px; }
.j-owner { font-size: 10px; color: var(--slate-400); }
.j-step.current .j-label { color: var(--brand-dark); }
.j-step.done .j-label { color: var(--slate-700); }
a.j-step:hover .j-label { text-decoration: underline; }

/* ── Buttons, inputs ──────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { border: 1px solid var(--slate-200); color: var(--slate-700); background: #fff; }
.btn-outline:hover { background: var(--slate-50); }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { color: var(--slate-600); }
.btn-ghost:hover { background: var(--slate-100); }
.btn-lg { padding: 12px 20px; font-size: 15px; border-radius: 10px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 11px; font-weight: 700; color: var(--slate-500); text-transform: uppercase; letter-spacing: .04em; }
.input, .select { width: 100%; border: 1px solid var(--slate-200); background: #fff; border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: none; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,165,183,.15); }
.input.scan { font-family: ui-monospace, monospace; font-size: 15px; padding: 11px 12px; border: 2px dashed var(--brand); background: var(--brand-50); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.hint { font-size: 12px; color: var(--slate-500); }

/* ── Cards, stats ─────────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; padding: 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.card.flush .card-head { padding: 14px 18px 0; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--slate-900); }
.card-head .sub { font-size: 12px; color: var(--slate-500); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat-card { background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; padding: 14px 16px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate-500); font-weight: 700; }
.stat-num { font-size: 28px; font-weight: 700; color: var(--slate-900); line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-num small { font-size: 14px; font-weight: 500; color: var(--slate-500); }
.stat-foot { font-size: 12px; color: var(--slate-600); margin-top: 4px; }
.stat-card.brand { background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; border-color: transparent; }
.stat-card.brand .stat-label, .stat-card.brand .stat-foot { color: #99f6e4; }
.stat-card.brand .stat-num { color: #fff; }
.stat-card.brand .stat-num small { color: #99f6e4; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .grid-2, .grid-3, .grid-main { grid-template-columns: 1fr; } }

/* ── Pills, chips ─────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--slate-100); color: var(--slate-700); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--slate-400); }
.pill.green  { background: var(--green-bg);  color: var(--green-fg); }  .pill.green .dot  { background: var(--green); }
.pill.amber  { background: var(--amber-bg);  color: var(--amber-fg); }  .pill.amber .dot  { background: var(--amber); }
.pill.red    { background: var(--red-bg);    color: var(--red-fg); }    .pill.red .dot    { background: var(--red); }
.pill.blue   { background: var(--blue-bg);   color: var(--blue-fg); }   .pill.blue .dot   { background: var(--blue); }
.pill.violet { background: var(--violet-bg); color: var(--violet-fg); } .pill.violet .dot { background: var(--violet); }
.pill.teal   { background: var(--brand-light); color: var(--brand-dark); } .pill.teal .dot { background: var(--brand); }
.prod { display: inline-block; font-family: ui-monospace, monospace; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
/* Product identity — same hues as the chart series (CRD #4a3aa7 · SGW #eb6834 · TCM #1baf7a) */
.prod.CRD { background: #ebe8f7; color: #3b2e8a; }
.prod.SGW { background: #fdebe3; color: #a8431a; }
.prod.TCM,
.prod.TCMN { background: #dcf5ea; color: #0b6b48; }
.prod.TCMA { background: #ffeede; color: #9a3412; }
.prod.TCMB { background: #f3e8ff; color: #6b21a8; }

/* ── Tables ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-500); font-weight: 700; padding: 9px 12px; background: var(--slate-50); border-bottom: 1px solid var(--slate-200); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--slate-100); vertical-align: middle; white-space: nowrap; }
.tbl tr:hover td { background: var(--slate-50); }
.tbl tr.sel td { background: var(--brand-50); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Progress ─────────────────────────────────────────── */
.bar { height: 8px; background: var(--slate-100); border-radius: 4px; overflow: hidden; display: flex; }
.bar > div { height: 100%; }
.bar .ok { background: linear-gradient(to right, #4ade80, #16a34a); }
.bar .run { background: linear-gradient(to right, #67e8f9, #0891b2); }
.bar .bad { background: linear-gradient(to right, #fca5a5, #dc2626); }
.bar .warn { background: linear-gradient(to right, #fcd34d, #d97706); }

/* ── Step list (flash / install / checks) ─────────────── */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px dashed var(--slate-100); }
.steps li:last-child { border-bottom: none; }
.s-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 2px solid var(--slate-200); color: var(--slate-400); }
.steps li.ok .s-ico { background: var(--green); border-color: var(--green); color: #fff; }
.steps li.run .s-ico { border-color: var(--brand); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps li.bad .s-ico { background: var(--red); border-color: var(--red); color: #fff; }
.steps li.skip .s-ico { background: var(--slate-100); }
.s-title { font-weight: 600; color: var(--slate-800); font-size: 13px; }
.s-detail { font-size: 12px; color: var(--slate-500); }
.s-time { font-size: 11px; color: var(--slate-400); font-family: ui-monospace, monospace; }
.steps li.pending .s-title { color: var(--slate-400); font-weight: 500; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc ─────────────────────────────────────────────── */
.callout { border-radius: 10px; padding: 12px 14px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid; }
.callout.info { background: var(--blue-bg); border-color: #bfdbfe; color: var(--blue-fg); }
.callout.warn { background: var(--amber-bg); border-color: #fde68a; color: var(--amber-fg); }
.callout.ok   { background: var(--green-bg); border-color: #bbf7d0; color: var(--green-fg); }
.callout.note { background: #fffbeb; border: 1px dashed #f59e0b; color: #78350f; }
.callout b { font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--slate-500); }
.kv dd { margin: 0; color: var(--slate-800); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--slate-200); overflow-x: auto; }
.tab { padding: 9px 14px; font-weight: 600; font-size: 13px; color: var(--slate-500); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.tab .pill { margin-left: 4px; }
.seg { display: inline-flex; background: var(--slate-100); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { padding: 6px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--slate-600); }
.seg button.on { background: #fff; color: var(--slate-900); box-shadow: 0 1px 2px rgba(15,23,42,.1); }
.divider { height: 1px; background: var(--slate-100); margin: 4px 0; }
.muted { color: var(--slate-500); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.big-serial { font-family: ui-monospace, monospace; font-size: 26px; font-weight: 800; letter-spacing: .02em; color: var(--slate-900); overflow-wrap: anywhere; }
.term { background: #0f172a; color: #cbd5e1; border-radius: 10px; padding: 12px 14px; font-family: ui-monospace, monospace; font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre; }
.term .c { color: #64748b; } .term .g { color: #4ade80; } .term .y { color: #fcd34d; } .term .b { color: #67e8f9; }

/* Mockup annotation — design notes for the team, not part of the product UI */
.anno { position: relative; border: 1px dashed #f59e0b; background: #fffbeb; color: #78350f; border-radius: 10px; padding: 10px 12px 10px 34px; font-size: 12.5px; }
.anno::before { content: "✎"; position: absolute; left: 12px; top: 9px; font-size: 14px; }
.anno b { font-weight: 700; }
.anno-toggle { position: fixed; right: 16px; bottom: 16px; z-index: 50; background: #78350f; color: #fffbeb; border-radius: 999px; padding: 8px 14px; font-size: 12px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
body.hide-anno .anno { display: none; }

/* Next-stage footer */
.next-stage { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #f0fdfa, #fff); border: 1px solid var(--brand-light); border-radius: 12px; padding: 14px 18px; flex-wrap: wrap; }
.next-stage .ns-text { flex: 1; min-width: 200px; }
.next-stage .ns-k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--brand-dark); }
.next-stage .ns-v { font-weight: 600; color: var(--slate-800); }

/* Tables placed directly in a card (no .table-wrap scroller) must wrap instead of overflowing */
.card > .tbl td, .doc .tbl td, .doc .tbl th { white-space: normal; overflow-wrap: anywhere; }

/* Drillable cards (data-drill) — every summary number opens its detail */
.drillable { cursor: pointer; position: relative; transition: border-color .12s, box-shadow .12s, transform .12s; }
.drillable:hover { border-color: var(--brand) !important; box-shadow: 0 0 0 3px rgba(14,165,183,.14); }
.drillable:focus-visible { outline: none; border-color: var(--brand) !important; box-shadow: 0 0 0 3px rgba(14,165,183,.35); }
.drillable::after { content: "→"; position: absolute; top: 10px; right: 12px; font-size: 13px; font-weight: 700; color: var(--brand-dark); opacity: 0; transition: opacity .12s; }
.stat-card.brand.drillable::after { color: #ccfbf1; }
.drillable:hover::after, .drillable:focus-visible::after { opacity: 1; }
.drill-active { border-color: var(--brand) !important; box-shadow: 0 0 0 3px rgba(14,165,183,.35) !important; }
.dimmed { opacity: .25; }
.drill-flash { animation: drillflash 1.4s ease-out; }
@keyframes drillflash { 0%, 30% { box-shadow: 0 0 0 4px rgba(14,165,183,.45); } 100% { box-shadow: 0 0 0 4px rgba(14,165,183,0); } }
.drill-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; background: var(--blue-bg); color: var(--blue-fg); border-radius: 999px; padding: 3px 10px; }
.drill-chip button { font-weight: 800; }

/* Stat tiles never push the page wider on small screens */
.stat-card { min-width: 0; }
.stat-num { overflow-wrap: anywhere; }

/* Environment banner (staging) - env-banner.js. Fixed above everything; sticky bars move down to make room. */
.env-banner { position: fixed; top: 0; left: 0; right: 0; height: 30px; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 0 12px; background: #b45309; color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .02em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
html.has-env-banner body { padding-top: 30px; }
html.has-env-banner .topbar, html.has-env-banner .sidebar { top: 30px; }
html.has-env-banner .sidebar { height: calc(100vh - 30px); }
.env-banner .env-short { display: none; }
@media (max-width: 720px) { .env-banner .env-long { display: none; } .env-banner .env-short { display: inline; } }
