:root {
  color-scheme: dark;
  --bg: #0c1117;
  --panel: #121922;
  --panel-2: #17212b;
  --line: #26323e;
  --text: #f2f6f7;
  --muted: #91a0ad;
  --accent: #6ee7b7;
  --accent-deep: #143b31;
  --amber: #f5c66b;
  --red: #ff8b8b;
  --blue: #7ab8ff;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 22px; border-right: 1px solid var(--line); background: #0e141b; display: flex; flex-direction: column; }
.brand { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent); color: #10241e; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { color: var(--muted); margin-top: 2px; }
.lab-badge { margin: 28px 0 22px; padding: 10px 12px; border: 1px solid #315247; color: #b8f4dc; background: #11261f; border-radius: 999px; font-size: 12px; }
.lab-badge span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; box-shadow: 0 0 0 4px rgba(110,231,183,.1); }
nav { display: grid; gap: 6px; }
.nav-item { color: var(--muted); text-decoration: none; padding: 11px 12px; border-radius: 10px; font-size: 14px; }
.nav-item:hover, .nav-item.active { color: var(--text); background: var(--panel-2); }
.sidebar-note { margin-top: auto; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.sidebar-note span { color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; }
.sidebar-note p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0 0; }

main { width: min(1400px, 100%); margin: 0 auto; padding: 34px 42px 64px; }
.topbar, .panel-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(30px, 4vw, 48px); letter-spacing: -.045em; margin-bottom: 0; }
h2 { font-size: 22px; letter-spacing: -.02em; margin-bottom: 0; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; margin-bottom: 8px; }
.primary, .secondary, .row-action { border: 0; border-radius: 10px; padding: 11px 15px; color: var(--text); background: var(--panel-2); }
.primary { background: var(--accent); color: #10241e; font-weight: 800; }
.primary:hover { background: #8af1ca; }
.secondary { border: 1px solid var(--line); }
.notice { margin: 28px 0 18px; display: flex; gap: 14px; align-items: center; border: 1px solid #3a4d45; border-radius: 12px; background: #101d1a; padding: 14px 16px; }
.notice strong { color: var(--accent); font-size: 13px; }
.notice span { color: #aab7b2; font-size: 13px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.metrics article { background: linear-gradient(145deg, #151d26, #111820); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; }
.metrics span, .metrics small { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: block; font-size: 30px; letter-spacing: -.04em; margin: 10px 0 6px; }

.panel { margin-top: 18px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.row-action { padding: 8px 10px; font-size: 12px; border: 1px solid var(--line); }
.row-action:hover { border-color: #496071; }

.pipeline { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(6, 1fr); position: relative; }
.pipeline::before { content: ""; position: absolute; top: 18px; left: 9%; right: 9%; height: 1px; background: var(--line); }
.pipeline li { text-align: center; position: relative; padding: 0 9px; }
.pipeline li > span { width: 36px; height: 36px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; background: var(--panel-2); border: 1px solid #38505c; color: var(--accent); font-size: 11px; font-weight: 800; position: relative; }
.pipeline strong, .pipeline small { display: block; }
.pipeline strong { font-size: 12px; }
.pipeline small { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.progress-label { color: var(--muted); font-size: 12px; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 20px; }
.check-item { display: flex; gap: 11px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #0f161e; }
.check-item input { accent-color: var(--accent); margin-top: 3px; }
.check-item strong, .check-item small { display: block; }
.check-item strong { font-size: 13px; }
.check-item small { color: var(--muted); margin-top: 4px; line-height: 1.4; }

label { display: grid; gap: 7px; color: #c9d2d8; font-size: 12px; font-weight: 700; }
input, select { width: 100%; padding: 12px 13px; color: var(--text); background: #0d141b; border: 1px solid var(--line); border-radius: 10px; outline: 0; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110,231,183,.1); }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 12px 15px; border-radius: 10px; background: var(--text); color: #111820; font-size: 12px; font-weight: 700; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translateY(0); opacity: 1; }

/* Console reale */
button:disabled { opacity: .45; cursor: not-allowed; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
a.row-action { text-decoration: none; display: inline-block; }
.logout { margin-top: 14px; }
.logout button { width: 100%; }
.metrics { margin-top: 28px; }
.notice + .metrics { margin-top: 0; }
.screen-wrap { position: relative; margin-top: 20px; height: min(78vh, 900px); border: 1px solid var(--line); border-radius: 14px; background: #05080b; overflow: hidden; }
.screen-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.screen-placeholder { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; text-align: center; color: var(--muted); padding: 24px; background: #05080b; }
.screen-placeholder strong { color: var(--text); font-size: 18px; }
.screen-placeholder[hidden], .notice[hidden] { display: none; }
.screen-caption { margin: 12px 0 0; }

/* Login */
.login-body { display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 16px; padding: 30px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.login-card h1 { font-size: 30px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.login-error { color: var(--red); font-size: 13px; margin: 0; }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; gap: 16px; padding: 15px 22px; }
  .lab-badge, .sidebar-note { display: none; }
  nav { display: flex; margin-left: auto; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .pipeline { grid-template-columns: repeat(3, 1fr); row-gap: 22px; }
  .pipeline::before { display: none; }
}

@media (max-width: 700px) {
  main { padding: 24px 16px 50px; }
  .sidebar { overflow-x: auto; }
  .brand small, .nav-item:nth-child(n+3) { display: none; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .screen-wrap { height: 70vh; }
  h1 { font-size: 30px; }
  .notice { align-items: flex-start; flex-direction: column; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .panel { padding: 18px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .pipeline { grid-template-columns: 1fr; gap: 12px; }
  .pipeline::before { display: block; top: 18px; bottom: 18px; left: 18px; right: auto; width: 1px; height: auto; }
  .pipeline li { display: grid; grid-template-columns: 46px 1fr; text-align: left; align-items: center; }
  .pipeline li > span { margin: 0; grid-row: span 2; }
  .check-grid { grid-template-columns: 1fr; }
}
