:root {
  --ink: #17211b;
  --muted: #6d7871;
  --paper: #f4f5f1;
  --card: #fffefa;
  --line: #dde2db;
  --green: #176647;
  --green-2: #23815c;
  --green-soft: #e4f1e9;
  --amber: #aa6b19;
  --amber-soft: #f8ecd8;
  --red: #a43f37;
  --red-soft: #f7e4e1;
  --blue: #346d93;
  --shadow: 0 14px 40px rgba(28, 44, 34, .08);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px; display: flex; flex-direction: column; color: #edf4ef; background: #142c22; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #d8b56d; color: #173026; font: 700 22px Georgia, serif; }
.brand strong, .brand span { display: block; }
.brand span { margin-top: 3px; color: #91a99d; font-size: 10px; letter-spacing: .12em; }
nav { display: grid; gap: 7px; margin-top: 26px; }
.nav-item { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border: 0; border-radius: 10px; color: #b8cac1; background: transparent; cursor: pointer; text-align: left; }
.nav-item span { width: 20px; font-size: 18px; color: #91a99d; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.1); }
.nav-item.active span { color: #e2bd73; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 16px 10px 2px; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot small { color: #91a99d; margin-top: 2px; }
.status-dot { width: 9px; height: 9px; border-radius: 99px; background: #45c383; box-shadow: 0 0 0 5px rgba(69,195,131,.12); }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 28px 38px 22px; background: rgba(244,245,241,.92); border-bottom: 1px solid var(--line); }
.topbar h1, .modal-header h2 { margin: 3px 0 0; font-family: Georgia, "Noto Serif SC", serif; font-weight: 600; }
.topbar h1 { font-size: 28px; }
.eyebrow { margin: 0; color: var(--green-2); font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.env-badge { padding: 7px 10px; border: 1px solid #cbd5cd; border-radius: 8px; color: var(--green); background: white; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.content { padding: 28px 38px 48px; }
.button { border: 1px solid transparent; border-radius: 9px; padding: 10px 15px; cursor: pointer; font-weight: 650; }
.button:disabled { opacity: .5; cursor: wait; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { background: var(--green-2); }
.button.secondary { color: var(--green); background: var(--green-soft); }
.button.ghost { border-color: var(--line); color: var(--ink); background: white; }
.button.small { padding: 7px 10px; font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card, .panel, .loading-card { border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.stat-card { padding: 20px; position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -20px; bottom: -35px; width: 100px; height: 100px; border-radius: 50%; background: var(--green-soft); }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { display: block; margin-top: 8px; font: 600 30px Georgia, serif; }
.stat-note { color: var(--muted); font-size: 11px; }
.grid-2 { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; }
.panel { overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font: 600 18px Georgia, serif; }
.panel-body { padding: 18px 20px; }
.panel-flush { padding: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); background: #f7f8f4; font-size: 11px; letter-spacing: .04em; text-align: left; }
th, td { padding: 13px 16px; border-bottom: 1px solid #e7eae5; vertical-align: middle; }
tbody tr:hover { background: #fafbf7; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.badge.succeeded, .badge.active, .badge.published { color: var(--green); background: var(--green-soft); }
.badge.running, .badge.created, .badge.pending, .badge.claimed, .badge.draft { color: var(--blue); background: #e4eef4; }
.badge.failed { color: var(--red); background: var(--red-soft); }
.badge.interrupted, .badge.disabled { color: var(--amber); background: var(--amber-soft); }
.badge.skipped, .badge.blocked, .badge.cancelled, .badge.retired { color: #68716b; background: #ecefeb; }
.flow-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.flow-card { border: 1px solid var(--line); border-radius: 14px; padding: 20px; background: var(--card); box-shadow: var(--shadow); }
.flow-card-head { display: flex; justify-content: space-between; gap: 12px; }
.flow-card h3 { margin: 0 0 7px; font: 600 18px Georgia, serif; }
.flow-card p { min-height: 38px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.flow-meta { display: flex; gap: 18px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.flow-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 15px; }
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-toolbar strong, .section-toolbar span { display: block; }
.section-toolbar strong { font: 600 18px Georgia, serif; }
.section-toolbar span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.draft-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px; border: 1px solid #cddce4; border-radius: 10px; background: #f0f6f9; }
.draft-notice small { display: block; margin-top: 5px; color: var(--muted); }
.draft-actions { display: flex; gap: 6px; }
.subsection-title { margin: 28px 0 12px; font: 600 16px Georgia, serif; }
.empty { padding: 42px 20px; color: var(--muted); text-align: center; }
.loading-card { padding: 40px; color: var(--muted); text-align: center; }
.progress { width: 110px; height: 6px; overflow: hidden; border-radius: 99px; background: #e5e9e4; }
.progress span { display: block; height: 100%; background: var(--green-2); }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(10,24,17,.56); backdrop-filter: blur(3px); }
.hidden { display: none !important; }
.modal { width: min(840px, 96vw); max-height: 90vh; display: flex; flex-direction: column; border-radius: 16px; background: var(--card); box-shadow: 0 28px 80px rgba(0,0,0,.25); }
.modal.compact { width: min(520px, 94vw); }
.modal-header, .modal-footer { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-footer { justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }
.modal-body { overflow-y: auto; padding: 24px; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 28px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 12px; font-weight: 700; }
.field small { color: var(--muted); line-height: 1.4; }
.required { color: var(--red); }
input, select, textarea { width: 100%; border: 1px solid #ccd3cd; border-radius: 8px; padding: 10px 11px; color: var(--ink); background: white; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(35,129,92,.1); }
textarea { min-height: 90px; resize: vertical; font-family: Consolas, monospace; }
.publication-note { margin-bottom: 18px; padding: 12px 14px; border-left: 3px solid var(--green-2); color: var(--muted); background: var(--green-soft); font-size: 12px; line-height: 1.6; }
.check-field { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; cursor: pointer; }
.check-field input { width: auto; margin-top: 3px; }
.check-field strong, .check-field small { display: block; }
.check-field small { margin-top: 4px; color: var(--muted); }
.plan-panel { grid-column: 1/-1; margin-top: 22px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.plan-row { display: grid; grid-template-columns: 50px 1fr 1fr; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.plan-row:last-child { border: 0; }
.run-summary { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 20px; }
.summary-item span, .summary-item strong { display: block; }
.summary-item span { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.event-list { display: grid; gap: 10px; max-height: 390px; overflow: auto; }
.event { border-left: 3px solid var(--line); padding: 6px 0 6px 12px; }
.event.ERROR { border-color: var(--red); }
.event.WARN { border-color: var(--amber); }
.event p { margin: 3px 0; font-size: 12px; }
.event time { color: var(--muted); font-size: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 420px; padding: 13px 17px; border-radius: 10px; color: white; background: #21352b; box-shadow: var(--shadow); }
.toast.error { background: var(--red); }
.login-intro { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }
.login-modal .modal-header { padding-bottom: 24px; }
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 76px 1fr; }
  .sidebar { padding: 22px 12px; }
  .brand > div:last-child, .nav-item:not(.active) { font-size: 0; }
  .nav-item { justify-content: center; padding: 12px; font-size: 0; }
  .nav-item span { width: auto; font-size: 20px; }
  .sidebar-foot div { display: none; }
  .stats { grid-template-columns: repeat(2,1fr); }
  .grid-2, .flow-list { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px; }
  .brand, .sidebar-foot { display: none; }
  nav { grid-template-columns: repeat(7,1fr); margin: 0; gap: 2px; }
  .nav-item, .nav-item:not(.active) { font-size: 0; }
  .topbar, .content { padding-left: 18px; padding-right: 18px; }
  .topbar { align-items: flex-start; }
  .top-actions .ghost, .env-badge { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .section-toolbar, .draft-notice { align-items: stretch; flex-direction: column; }
  .draft-actions { justify-content: flex-end; }
}
