/* FIVETECH AI Services Control Center - tema scuro premium, mobile-first */
:root {
  --bg: #070b14;
  --bg2: #0c1322;
  --card: #111a2c;
  --card2: #15203a;
  --line: #1f2b45;
  --text: #e8eefc;
  --muted: #8a97b4;
  --gold: #d4af37;
  --gold2: #f3d77a;
  --cyan: #38bdf8;
  --violet: #8b5cf6;
  --green: #22c55e;
  --yellow: #facc15;
  --red: #ef4444;
  --gray: #64748b;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; background: radial-gradient(1200px 600px at 80% -10%, rgba(56, 189, 248, .10), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(212, 175, 55, .08), transparent 60%), var(--bg); background-attachment: fixed; }
a { color: var(--cyan); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: .2px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }
.hidden { display: none !important; }

/* boot */
.boot { display: grid; place-items: center; min-height: 100vh; }
.boot-logo { font-weight: 800; letter-spacing: 4px; color: var(--gold); font-size: 22px; display: flex; gap: 12px; align-items: center; }
.logo-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--gold), #8a6d12); color: #0a0a0a; font-weight: 900; letter-spacing: 0; box-shadow: 0 0 24px rgba(212, 175, 55, .35); }

/* layout */
.shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.sidebar { display: none; }
.main { padding: 14px 14px 96px; max-width: 1400px; width: 100%; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 800; letter-spacing: 2px; font-size: 14px; }
.brand-name b { color: var(--gold); }
.brand-sub { font-size: 10.5px; letter-spacing: 1.6px; color: var(--muted); text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer; font-size: 18px; }
.icon-btn:hover { border-color: var(--cyan); }
.badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.mode-pill { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; padding: 5px 10px; border-radius: 999px; border: 1px solid; }
.mode-DEMO { color: var(--yellow); border-color: rgba(250, 204, 21, .5); background: rgba(250, 204, 21, .08); }
.mode-LIVE { color: var(--green); border-color: rgba(34, 197, 94, .5); background: rgba(34, 197, 94, .08); }
.demo-banner { background: linear-gradient(90deg, rgba(250, 204, 21, .14), rgba(250, 204, 21, .04)); border: 1px solid rgba(250, 204, 21, .35); color: #fde68a; border-radius: 12px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 14px; }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; overflow-x: auto; gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: rgba(10, 15, 27, .96); border-top: 1px solid var(--line); backdrop-filter: blur(12px); scrollbar-width: none; }
.bottom-nav::-webkit-scrollbar { display: none; }
.nav-item { flex: 0 0 auto; min-width: 72px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; border-radius: 12px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.nav-item .ico { font-size: 19px; }
.nav-item.active { color: var(--text); background: var(--card2); box-shadow: inset 0 0 0 1px rgba(212, 175, 55, .35); }

@media (min-width: 1000px) {
  .shell { grid-template-columns: 250px 1fr; }
  .sidebar { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--line); background: rgba(9, 14, 25, .7); }
  .sidebar .brand { margin: 0 6px 22px; }
  .sidebar .nav-item { flex-direction: row; gap: 12px; font-size: 14px; padding: 11px 12px; min-width: 0; }
  .sidebar .nav-item .ico { font-size: 17px; width: 22px; text-align: center; }
  .sidebar .nav-item:hover { color: var(--text); background: rgba(21, 32, 58, .6); }
  .sidebar-foot { margin-top: auto; padding: 10px; font-size: 11.5px; color: var(--muted); }
  .bottom-nav { display: none; }
  .main { padding: 26px 32px 48px; }
  .topbar .brand { display: none; }
}

/* cards */
.page-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.page-title h1 { font-size: 22px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr; }
.g3 { grid-template-columns: 1fr; }
.g4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); } }
.card { background: linear-gradient(180deg, var(--card), #0f1728); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h3 { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.section { margin-top: 18px; }

.prov-card { position: relative; overflow: hidden; padding: 18px; }
.prov-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c, var(--gray)); }
.prov-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.prov-name { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800; letter-spacing: 1px; padding: 6px 11px; border-radius: 999px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gray); }
.st-ONLINE .dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.st-WARNING .dot, .st-DEGRADED .dot, .st-UNVERIFIED .dot, .st-DEMO .dot { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.st-CRITICAL .dot { background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 1.4s infinite; }
.st-OFFLINE .dot, .st-NOT_CONFIGURED .dot, .st-NOT_CONNECTED .dot, .st-UNKNOWN .dot { background: #111; border: 1px solid #555; }
@keyframes pulse { 50% { opacity: .35; } }
.balance { font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
.balance small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.balance.na { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: .5px; line-height: 1.4; }
.lvl { display: inline-block; margin-top: 6px; font-size: 11.5px; font-weight: 800; letter-spacing: 1px; padding: 3px 8px; border-radius: 6px; }
.lvl-WARNING { background: rgba(250, 204, 21, .15); color: var(--yellow); }
.lvl-CRITICAL { background: rgba(239, 68, 68, .15); color: #fca5a5; }
.lvl-EMERGENCY { background: var(--red); color: #fff; }
.lvl-INFO { background: rgba(56, 189, 248, .15); color: var(--cyan); }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.kv > div { background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.kv .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.kv .v { font-size: 16px; font-weight: 700; margin-top: 3px; overflow-wrap: anywhere; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.stale { color: var(--yellow); font-weight: 700; }

.stat { padding: 14px; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.stat .v { font-size: 22px; font-weight: 800; margin-top: 4px; }
.stat .s { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.progress { height: 10px; background: rgba(255, 255, 255, .06); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--cyan), var(--violet)); transition: width .6s; }
.progress.warn > i { background: linear-gradient(90deg, var(--yellow), #f59e0b); }
.progress.crit > i { background: linear-gradient(90deg, #f97316, var(--red)); }

.tag { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); white-space: nowrap; }
.tag.stima { color: var(--cyan); border-color: rgba(56, 189, 248, .4); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* tabelle */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); background: rgba(255, 255, 255, .02); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.err { color: #fca5a5; }
.ok { color: var(--green); }
.ko { color: #fca5a5; }

/* filtri e form */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 13px; cursor: pointer; }
.chip.on { border-color: var(--gold); color: var(--gold2); background: rgba(212, 175, 55, .08); }
.btn { background: linear-gradient(135deg, var(--gold), #a8841d); color: #0a0a0a; border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 800; letter-spacing: .5px; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: rgba(239, 68, 68, .15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .4); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; letter-spacing: .4px; }
input[type=text], input[type=email], input[type=password], input[type=number], select { width: 100%; background: #0a1120; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, select:focus { border-color: var(--cyan); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); margin: 0; }
.test-result { margin-top: 10px; padding: 10px; border-radius: 10px; background: #0a1120; border: 1px solid var(--line); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.PASS { color: var(--green); font-weight: 800; }
.FAIL { color: var(--red); font-weight: 800; }
.DA_CONFIGURARE { color: var(--yellow); font-weight: 800; }

/* alert */
.alert-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .02); margin-bottom: 10px; }
.alert-item.unread { border-color: rgba(212, 175, 55, .45); background: rgba(212, 175, 55, .05); }
.alert-ico { font-size: 22px; }
.alert-title { font-weight: 800; }
.alert-msg { white-space: pre-line; color: #c9d4ec; font-size: 13px; margin-top: 5px; }
.alert-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; color: var(--muted); }

/* grafici SVG */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .brand { justify-content: center; margin-bottom: 20px; }
.login-card form { display: grid; gap: 14px; }
.error-box { color: #fca5a5; font-size: 13px; min-height: 18px; }

/* notification center */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: #0b1220; border-left: 1px solid var(--line); z-index: 40; transform: translateX(100%); transition: transform .25s; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow-y: auto; padding: 14px; flex: 1; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 30; }

/* centralino */
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.flow .node { padding: 10px 14px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.flow .node.hl { border-color: var(--gold); color: var(--gold2); }
.flow .arr { color: var(--cyan); font-weight: 900; }
.channels { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .channels { grid-template-columns: repeat(3, 1fr); } }
.channel { text-align: center; padding: 22px 14px; }
.channel .big { font-size: 40px; }
.channel h2 { justify-content: center; }
.hero-claim { font-size: 20px; font-weight: 900; letter-spacing: 1.5px; text-align: center; color: var(--gold2); margin: 8px 0 16px; }
ul.clean { margin: 0; padding-left: 18px; line-height: 1.8; }
.impl { color: var(--green); font-weight: 800; font-size: 11.5px; letter-spacing: .8px; }
.pred { color: var(--cyan); font-weight: 800; font-size: 11.5px; letter-spacing: .8px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); opacity: 0; background: #0f1a30; border: 1px solid var(--line); padding: 11px 16px; border-radius: 12px; z-index: 60; transition: .25s; font-size: 13px; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: rot .8s linear infinite; vertical-align: middle; }
@keyframes rot { to { transform: rotate(360deg); } }
.footer-note { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 26px; }
