:root {
  --ink: #16221f;
  --muted: #65716d;
  --line: #dfe7e3;
  --paper: #f5f8f6;
  --panel: #ffffff;
  --green: #0d6953;
  --green-soft: #e5f3ed;
  --amber: #a86008;
  --amber-soft: #fff1d8;
  --red: #a43b36;
  --red-soft: #fde9e7;
  --blue: #315f93;
  --blue-soft: #e8f0fb;
  --shadow: 0 20px 55px rgba(25, 52, 43, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 15% 0, #eaf5f0 0, transparent 36rem), var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; }
.auth-card { width: min(470px, 100%); padding: 42px; border: 1px solid rgba(208, 220, 214, .9); border-radius: 28px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: white; background: linear-gradient(145deg, #0d7058, #173f35); font: 750 22px/1 Georgia, serif; letter-spacing: -.08em; box-shadow: 0 12px 30px rgba(13, 105, 83, .22); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 11px; font-size: 14px; }
.eyebrow { margin: 28px 0 8px; color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(28px, 4vw, 42px); line-height: 1.1; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.02em; }
.lede { margin-bottom: 26px; color: var(--muted); line-height: 1.72; }
.auth-form { display: grid; gap: 10px; }
.auth-form label { font-size: 13px; font-weight: 700; }
.auth-form input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: white; outline: none; }
.auth-form input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(13, 105, 83, .11); }
.primary-button, .secondary-button, .danger-button { min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font-weight: 700; }
.primary-button { width: 100%; margin-top: 8px; color: white; background: var(--green); }
.primary-button:hover { background: #095944; }
.secondary-button { color: var(--green); border-color: #acd0c2; background: var(--green-soft); }
.danger-button { color: var(--red); border-color: #ebbbb7; background: var(--red-soft); }
.primary-button:disabled, .secondary-button:disabled, .danger-button:disabled { opacity: .55; cursor: wait; }
.message { min-height: 24px; margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.message.error { color: var(--red); }
.security-note { margin: 22px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.55; }
.security-note code { word-break: break-all; }

.app-shell { min-height: 100vh; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1380px) / 2)); border-bottom: 1px solid rgba(210, 222, 216, .9); background: rgba(250, 252, 251, .88); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 760; text-decoration: none; letter-spacing: -.02em; }
.primary-nav { align-self: stretch; display: flex; align-items: center; gap: 6px; }
.primary-nav a { height: 100%; display: flex; align-items: center; padding: 0 14px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; font-weight: 680; text-decoration: none; }
.primary-nav a:hover { color: var(--ink); }
.primary-nav a[aria-current="page"] { color: var(--green); border-bottom-color: var(--green); }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.session-user { color: var(--muted); font-size: 13px; }
.text-button { border: 0; padding: 7px 0; color: var(--green); background: transparent; font-weight: 700; }
.workspace { width: min(1380px, calc(100% - 48px)); margin: 0 auto; padding: 46px 0 72px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 28px; }
.page-heading .eyebrow { margin-top: 0; }
.page-heading h1 { margin-bottom: 9px; }
.page-heading p:last-child { color: var(--muted); margin-bottom: 0; }
.refresh-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #28a47d; box-shadow: 0 0 0 5px rgba(40, 164, 125, .12); }
.runtime-banner { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; padding: 14px 18px; border: 1px solid #e4c788; border-radius: 16px; background: var(--amber-soft); }
.runtime-banner.good { border-color: #b9dccc; background: var(--green-soft); }
.runtime-banner:empty { display: none; }
.runtime-banner div { display: grid; gap: 3px; }
.runtime-banner strong { font-size: 14px; }
.runtime-banner span { color: var(--muted); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { min-height: 132px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, .92); box-shadow: 0 12px 28px rgba(30, 60, 50, .045); }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { display: block; margin-top: 11px; font-size: 34px; font-weight: 780; letter-spacing: -.04em; }
.metric-value.compact { font-size: 24px; line-height: 1.3; }
.metric-note { margin-top: 8px; color: var(--muted); font-size: 12px; }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); gap: 18px; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: rgba(255, 255, 255, .95); box-shadow: 0 12px 28px rgba(30, 60, 50, .045); }
.panel-wide { grid-column: 1 / -1; }
.panel-heading { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.panel-heading .eyebrow { margin: 0 0 5px; }
.section-link { color: var(--green); font-size: 12px; font-weight: 720; text-decoration: none; white-space: nowrap; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 16px; color: var(--muted); background: #fafcfb; text-align: left; font-weight: 650; white-space: nowrap; }
td { padding: 15px 16px; border-top: 1px solid #edf1ef; vertical-align: middle; }
tbody tr:hover { background: #fbfdfc; }
.table-link { color: var(--green); font-weight: 700; text-decoration: none; }
.status-pill { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: 11px; font-weight: 760; }
.status-pill.good { color: var(--green); background: var(--green-soft); }
.status-pill.warn { color: var(--amber); background: var(--amber-soft); }
.status-pill.bad { color: var(--red); background: var(--red-soft); }
.muted { color: var(--muted); }
.stack-list { display: grid; gap: 0; }
.stack-item { padding: 18px 22px; border-top: 1px solid #edf1ef; }
.stack-item:first-child { border-top: 0; }
.stack-item h3 { margin: 0 0 7px; font-size: 15px; }
.stack-item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.stack-item-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; }
.small-button { min-height: 32px; padding: 0 11px; border: 1px solid #bcd7cd; border-radius: 9px; color: var(--green); background: #f0f8f5; font-size: 12px; font-weight: 700; }
.small-button:disabled { opacity: .55; cursor: not-allowed; }
.empty-state { padding: 28px 22px; color: var(--muted); font-size: 13px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 420px; padding: 13px 16px; border-radius: 12px; color: white; background: #20342e; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.back-link { display: inline-block; margin-bottom: 24px; color: var(--green); font-weight: 700; text-decoration: none; }
.action-row { display: flex; gap: 10px; }
.button-link { width: auto; display: inline-flex; align-items: center; justify-content: center; margin: 0; text-decoration: none; }
.json-view { max-height: 410px; min-height: 160px; overflow: auto; margin: 0; padding: 18px 22px; color: #294139; background: #f8fbf9; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.result-highlight { background: linear-gradient(145deg, #fbfefc, #f0f8f5); }
.workflow-strip { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, .9); box-shadow: 0 12px 28px rgba(30, 60, 50, .04); overflow-x: auto; }
.workflow-strip span { min-width: max-content; padding: 9px 12px; border-radius: 10px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 720; }
.workflow-strip i { color: #9aa9a3; font-style: normal; }
.progress { width: 110px; height: 7px; overflow: hidden; border-radius: 999px; background: #e8eeeb; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.stage-track { display: grid; grid-template-columns: repeat(8, minmax(90px, 1fr)); gap: 0; padding: 28px 22px 32px; overflow-x: auto; }
.stage-node { position: relative; min-width: 100px; display: grid; justify-items: center; gap: 9px; color: var(--muted); font-size: 12px; text-align: center; }
.stage-node::after { content: ""; position: absolute; z-index: 0; top: 16px; left: calc(50% + 18px); width: calc(100% - 36px); height: 2px; background: var(--line); }
.stage-node:last-child::after { display: none; }
.stage-number { z-index: 1; width: 34px; height: 34px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 50%; background: white; font-weight: 760; }
.stage-node.completed .stage-number { color: white; border-color: var(--green); background: var(--green); }
.stage-node.completed::after { background: var(--green); }
.stage-node.current { color: var(--green); }
.stage-node.current .stage-number { border-color: var(--green); box-shadow: 0 0 0 6px var(--green-soft); }
.technical-details { width: 100%; }
.technical-details > summary { padding: 20px 22px; color: var(--green); cursor: pointer; font-size: 13px; font-weight: 720; }
.technical-details[open] > summary { border-bottom: 1px solid var(--line); }
.technical-content { display: grid; gap: 24px; padding-bottom: 22px; }
.technical-content h3 { margin: 22px 22px 10px; font-size: 14px; }
.technical-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 0 22px; }
.technical-grid h3 { margin-left: 0; }
.catalog-stack { display: grid; gap: 18px; }
.catalog-card { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: rgba(255, 255, 255, .95); box-shadow: 0 12px 28px rgba(30, 60, 50, .045); }
.catalog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 24px; border-bottom: 1px solid var(--line); }
.catalog-header .eyebrow { margin: 0 0 6px; }
.catalog-header h2 { margin-bottom: 7px; font-size: 24px; }
.catalog-header p { margin-bottom: 0; }
.catalog-body { display: grid; gap: 0; }
.catalog-section { padding: 24px; border-top: 1px solid var(--line); }
.catalog-section:first-child { border-top: 0; }
.catalog-section > h3 { margin: 0 0 16px; font-size: 15px; }
.catalog-section .table-scroll { margin: 0 -24px -24px; width: calc(100% + 48px); }
.channel-name { display: grid; gap: 3px; min-width: 145px; font-weight: 700; }
.channel-name small { color: var(--muted); font-size: 10px; font-weight: 500; }
.scope-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 28px; }
.scope-group h4 { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 7px 10px; border: 1px solid #d9e8e2; border-radius: 999px; color: #294139; background: #f5faf8; font-size: 12px; line-height: 1.2; }

@media (max-width: 900px) {
  .topbar { height: auto; min-height: 68px; flex-wrap: wrap; padding-top: 10px; }
  .primary-nav { order: 3; width: 100%; height: 48px; overflow-x: auto; }
  .primary-nav a { height: 48px; padding: 0 12px; white-space: nowrap; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid { grid-template-columns: 1fr; }
  .panel-wide { grid-column: auto; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .technical-grid, .scope-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .auth-card { padding: 30px 24px; border-radius: 22px; }
  .workspace { width: min(100% - 28px, 1380px); padding-top: 30px; }
  .topbar { padding: 0 14px; }
  .brand { padding-top: 8px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 112px; padding: 17px; }
  .metric-value { font-size: 28px; }
  .session-user { display: none; }
  .action-row { width: 100%; }
  .action-row button, .action-row a { flex: 1; }
  .runtime-banner { align-items: flex-start; flex-direction: column; gap: 8px; }
  .catalog-header { padding: 20px; }
  .catalog-section { padding: 20px; }
  .catalog-section .table-scroll { margin: 0 -20px -20px; width: calc(100% + 40px); }
}
