:root {
  --bg: #0d100d;
  --panel: #151a15;
  --panel-2: #1a2019;
  --line: #2b3329;
  --text: #f3f1e8;
  --muted: #9da697;
  --green: #b7f36a;
  --green-2: #7cb83e;
  --amber: #f0c45d;
  --red: #ff765f;
  --blue: #83bff4;
  --shadow: 0 28px 80px rgba(0, 0, 0, .34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 15% 0%, #1c2618 0, transparent 34rem), var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .22; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E"); }

.eyebrow { margin: 0 0 .45rem; color: var(--green); font: 700 .68rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; }
.brand-mark { width: 3.25rem; height: 3.25rem; display: grid; place-items: center; border: 1px solid #6a7d5c; border-radius: 14px; color: var(--green); background: linear-gradient(145deg, #202a1c, #11150f); font-weight: 800; letter-spacing: -.05em; box-shadow: inset 0 1px rgba(255,255,255,.08); }
.brand-mark.small { width: 2.7rem; height: 2.7rem; border-radius: 11px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: min(100%, 430px); padding: 2.5rem; border: 1px solid var(--line); border-radius: 24px; background: rgba(21, 26, 21, .94); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.login-card h1 { margin: 1.3rem 0 .5rem; font-size: clamp(2rem, 7vw, 3rem); letter-spacing: -.05em; }
.lede { color: var(--muted); line-height: 1.6; margin: 0 0 2rem; }
label { display: grid; gap: .55rem; margin: 1rem 0; color: #c8cec2; font-size: .82rem; font-weight: 700; }
input { width: 100%; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: #0e120e; outline: none; }
input:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(183, 243, 106, .12); }
.credential-note, .form-error { min-height: 1.2em; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.form-error { color: var(--red); }

.dashboard { width: min(1400px, calc(100% - 2rem)); margin: 0 auto; padding: 1rem 0 3rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0 1.4rem; }
.brand-row, .top-actions, .status-title, .master-actions, .panel-title, .metric-head, .dialog-actions { display: flex; align-items: center; }
.brand-row { gap: .8rem; }
.brand-row h1 { margin: 0; font-size: 1.05rem; letter-spacing: -.02em; }
.top-actions { gap: .65rem; }
.pill { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .72rem; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: .75rem; background: rgba(21,26,21,.8); }
.pill span { width: .48rem; height: .48rem; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }
.icon-button, .text-button { border: 1px solid var(--line); color: var(--text); background: transparent; border-radius: 9px; padding: .52rem .75rem; }
.icon-button { font-size: 1.1rem; }
.text-button { color: var(--muted); }

.hero { min-height: 280px; display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; padding: clamp(1.7rem, 5vw, 4rem); border: 1px solid #34402f; border-radius: 26px; background: linear-gradient(125deg, rgba(183,243,106,.13), rgba(21,26,21,.72) 48%), #131812; box-shadow: var(--shadow); }
.status-title { gap: .9rem; }
.status-title h2 { margin: 0; font-size: clamp(2.35rem, 6vw, 5.2rem); letter-spacing: -.065em; }
.status-light { width: 1rem; height: 1rem; flex: 0 0 auto; border-radius: 50%; background: var(--amber); box-shadow: 0 0 24px currentColor; color: var(--amber); }
.status-light.online { color: var(--green); background: var(--green); }
.status-light.offline { color: var(--red); background: var(--red); }
.hero-note { max-width: 650px; color: var(--muted); font-size: 1.05rem; }
.master-actions { gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }

.primary, .danger, .secondary { border: 0; border-radius: 11px; padding: .88rem 1.05rem; font-weight: 800; transition: transform .16s ease, opacity .16s ease; }
.primary:hover, .danger:hover, .secondary:hover { transform: translateY(-1px); }
.primary { color: #10150d; background: var(--green); }
.danger { color: #1d0c08; background: var(--red); }
.secondary { color: var(--text); border: 1px solid var(--line); background: #20251f; }
.wide { width: 100%; margin-top: .55rem; }
button:disabled { cursor: not-allowed; opacity: .45; transform: none !important; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin: .9rem 0 3rem; }
.metrics article, .panel, .service-card { border: 1px solid var(--line); border-radius: 16px; background: rgba(21,26,21,.86); }
.metrics article { padding: 1rem; }
.metric-head { justify-content: space-between; gap: 1rem; font-size: .8rem; color: var(--muted); }
.metric-head strong { color: var(--text); font-size: .9rem; }
.meter { height: 5px; margin-top: .8rem; overflow: hidden; border-radius: 99px; background: #272d25; }
.meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .4s ease; }
.meter.warning i { background: var(--amber); }
.metric-sub { margin: .68rem 0 0; color: var(--muted); font-size: .72rem; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin: 0 0 1rem; }
.section-head h2, .panel h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.035em; }
.section-head > p { max-width: 560px; color: var(--muted); font-size: .82rem; line-height: 1.55; text-align: right; }
.service-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; }
.service-card { padding: 1rem; min-height: 210px; display: flex; flex-direction: column; justify-content: space-between; }
.service-top { display: flex; justify-content: space-between; gap: 1rem; }
.service-icon { width: 2.45rem; height: 2.45rem; display: grid; place-items: center; border-radius: 9px; color: var(--green); background: #20291c; font: 800 .72rem ui-monospace, monospace; }
.service-card h3 { margin: 1.1rem 0 .35rem; font-size: 1rem; }
.service-card p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.state-badge { padding: .36rem .55rem; border-radius: 99px; color: var(--amber); background: rgba(240,196,93,.11); font: 700 .64rem ui-monospace, monospace; text-transform: uppercase; }
.state-badge.online { color: var(--green); background: rgba(183,243,106,.1); }
.state-badge.offline { color: var(--red); background: rgba(255,118,95,.1); }
.lever { margin-top: 1.1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; padding: .3rem; border-radius: 11px; background: #0e120e; }
.lever button { border: 0; border-radius: 8px; padding: .58rem; color: var(--muted); background: transparent; font-size: .72rem; font-weight: 800; }
.lever button:hover { color: var(--text); background: #242b22; }

.lower-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: .8rem; margin-top: .8rem; }
.panel { padding: 1.25rem; }
.panel-title { justify-content: space-between; gap: 1rem; }
.workflow-count { display: flex; align-items: baseline; gap: .65rem; margin: 1.5rem 0 .55rem; }
.workflow-count strong { font-size: 2.4rem; letter-spacing: -.06em; }
.workflow-count span, .panel > p { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.quick-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; margin-top: 1.2rem; }
.quick-links a { display: flex; justify-content: space-between; padding: .75rem .8rem; border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; font-size: .78rem; }
.quick-links a::after { content: "↗"; color: var(--muted); }
footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.25rem .2rem 0; color: var(--muted); font-size: .72rem; }

dialog { width: min(92vw, 460px); border: 1px solid var(--line); border-radius: 20px; color: var(--text); background: #151a15; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(4,6,4,.78); backdrop-filter: blur(4px); }
dialog form { padding: 1rem; }
dialog h2 { margin: .35rem 0 .7rem; font-size: 1.7rem; }
dialog p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.dialog-icon { width: 2.8rem; height: 2.8rem; display: grid; place-items: center; margin-bottom: 1.2rem; border-radius: 50%; color: var(--red); background: rgba(255,118,95,.12); font-weight: 900; }
.dialog-actions { justify-content: flex-end; gap: .65rem; margin-top: 1.5rem; }
.toast { position: fixed; right: 1rem; bottom: 1rem; max-width: min(420px, calc(100% - 2rem)); padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: #222920; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,118,95,.5); }

@media (max-width: 1050px) { .service-grid { grid-template-columns: repeat(3, 1fr); } .metrics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) {
  .dashboard { width: min(100% - 1rem, 1400px); }
  .topbar, .hero, .section-head, footer { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: space-between; }
  .hero { min-height: 360px; }
  .master-actions { justify-content: flex-start; }
  .service-grid, .lower-grid { grid-template-columns: 1fr; }
  .section-head > p { text-align: left; }
  .quick-links { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .metrics { grid-template-columns: 1fr 1fr; } .service-grid { grid-template-columns: 1fr; } .login-card { padding: 1.5rem; } .pill { display: none; } }

