/* FuseBox Web Dashboard — Lite 4 Cool Glass (Light + Dark) */

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

/* ═══════ LIGHT MODE (default) ═══════ */
:root{
  --bg:linear-gradient(135deg,#f0f2f8,#eceef4);
  --text:#2a3040;--text-sec:#6a7488;--text-tri:#a0a8b8;
  --green:#22c55e;--green-glow:rgba(34,197,94,.25);
  --red:#ef4444;--amber:#f59e0b;
  --trk-bg:rgba(0,0,0,.04);--trk-border:rgba(0,0,0,.06);
  --lev-off-1:#b0b8c8;--lev-off-2:#8a92a4;--lev-shadow:rgba(0,0,0,.08);
  --cell-bg:rgba(255,255,255,.4);--cell-hover:rgba(255,255,255,.6);
  --cell-border:rgba(255,255,255,.5);
  --cell-green-bg:rgba(240,255,245,.4);--cell-green-border:rgba(34,197,94,.15);
  --cell-amber-bg:rgba(255,252,240,.4);--cell-amber-border:rgba(245,158,11,.12);
  --icon-off:#a0a8b8;--icon-on:#4a5a68;
  --label-off:#5a6478;--label-on:#1a2030;
  --status-border:rgba(0,0,0,.05);--status-dot-off:#c8ccd4;
  --logo-color:#2a3040;
  --surface:rgba(255,255,255,.5);--border:rgba(0,0,0,.08);
  --input-bg:rgba(255,255,255,.6);--input-border:rgba(0,0,0,.1);
  --lock-bg:rgba(239,68,68,.05);--lock-border:rgba(239,68,68,.12);
}

/* ═══════ DARK MODE ═══════ */
@media(prefers-color-scheme:dark){
  :root{
    --bg:linear-gradient(135deg,#111420,#141824);
    --text:#d0d4de;--text-sec:#6a7488;--text-tri:#3a4050;
    --trk-bg:rgba(0,0,0,.3);--trk-border:rgba(255,255,255,.06);
    --lev-off-1:#4a5060;--lev-off-2:#343842;--lev-shadow:rgba(0,0,0,.3);
    --cell-bg:rgba(255,255,255,.03);--cell-hover:rgba(255,255,255,.05);
    --cell-border:rgba(255,255,255,.06);
    --cell-green-bg:rgba(34,197,94,.04);--cell-green-border:rgba(34,197,94,.12);
    --cell-amber-bg:rgba(245,158,11,.04);--cell-amber-border:rgba(245,158,11,.1);
    --icon-off:#3a4050;--icon-on:#8a90a0;
    --label-off:#5a6070;--label-on:#d0d4de;
    --status-border:rgba(255,255,255,.04);--status-dot-off:#2a2e38;
    --logo-color:#d0d4de;
    --surface:rgba(255,255,255,.03);--border:rgba(255,255,255,.06);
    --input-bg:#07080a;--input-border:#1e2028;
    --lock-bg:rgba(239,68,68,.04);--lock-border:rgba(239,68,68,.1);
  }
}

body{font-family:'DM Sans','Segoe UI',system-ui,-apple-system,sans-serif;background:var(--bg);color:var(--text);min-height:100vh;-webkit-font-smoothing:antialiased;transition:background .3s,color .3s}

/* ═══════ HERO SECTION ═══════ */
.hero-section{min-height:100vh;display:flex;align-items:center;justify-content:center;text-align:center;padding:40px 20px;position:relative;overflow:hidden}
.hero-section::before{content:'';position:absolute;inset:0;background:radial-gradient(ellipse 70% 50% at 50% 0%,rgba(34,197,94,.06),transparent 70%);pointer-events:none}
.hero-inner{position:relative;z-index:1;max-width:600px}
.hero-badge{display:inline-flex;align-items:center;gap:6px;padding:5px 14px;background:var(--surface);border:1px solid var(--border);border-radius:100px;font-size:.78rem;color:var(--text-sec);font-weight:500;margin-bottom:28px}
.hero-dot{width:5px;height:5px;background:var(--green);border-radius:50%}
.hero-title{font-size:clamp(2.4rem,7vw,4rem);font-weight:800;line-height:1.05;letter-spacing:-.03em;margin-bottom:18px}
.hero-accent{color:var(--green)}
.hero-sub{font-size:clamp(1rem,2.5vw,1.15rem);color:var(--text-sec);max-width:460px;margin:0 auto 32px;line-height:1.6}
.hero-cta{padding:16px 40px;font-size:1.05rem;border-radius:14px;box-shadow:0 0 24px rgba(34,197,94,.2),0 2px 8px rgba(0,0,0,.2)}
.hero-cta:hover{transform:translateY(-1px);filter:brightness(1.1)}
.hero-badges{display:flex;justify-content:center;gap:20px;flex-wrap:wrap;margin-top:28px}
.hero-trust{display:flex;align-items:center;gap:5px;font-size:.75rem;color:var(--text-tri);font-weight:500}
.hero-trust svg{opacity:.5}

/* Theme toggle */
.theme-toggle{cursor:pointer;padding:6px;border-radius:6px;display:flex;align-items:center}

/* ═══════ AUTH SCREEN ═══════ */

.screen{width:100%;max-width:700px;margin:0 auto;padding:32px 20px}

.auth-box{max-width:380px;margin:80px auto 0;text-align:center}
.auth-logo{font-weight:800;font-size:1.8rem;letter-spacing:-.03em;color:var(--logo-color);margin-bottom:6px}
.auth-logo .dot{display:inline-block;width:7px;height:7px;background:var(--green);border-radius:50%;margin:0 1px}
.auth-sub{font-size:.85rem;color:var(--text-sec);margin-bottom:28px}

.auth-hosting{display:flex;gap:8px;margin-bottom:16px}
.auth-host-btn{flex:1;padding:10px;background:var(--surface);border:1px solid var(--border);border-radius:8px;color:var(--text);font-size:.78rem;font-weight:600;cursor:pointer;transition:.15s;font-family:inherit}
.auth-host-btn.selected{border-color:var(--green);color:var(--green)}
.auth-host-btn:hover{border-color:var(--text-tri)}

.auth-row{margin-bottom:8px}
.auth-input{width:100%;background:var(--input-bg);border:1px solid var(--input-border);border-radius:8px;padding:10px 14px;color:var(--text);font-size:.85rem;outline:none;font-family:inherit;transition:.15s}
.auth-input:focus{border-color:var(--green)}

.auth-actions{display:flex;gap:8px;margin-top:4px}
.btn-primary{flex:1;padding:10px;background:var(--green);color:#000;border:none;border-radius:8px;font-weight:700;font-size:.85rem;cursor:pointer;font-family:inherit;transition:.15s}
.btn-primary:hover{filter:brightness(1.1)}
.btn-secondary{flex:1;padding:10px;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:8px;font-weight:600;font-size:.85rem;cursor:pointer;font-family:inherit;transition:.15s}
.btn-secondary:hover{border-color:var(--text-tri)}
.btn-ghost{background:none;border:none;color:var(--text-tri);font-size:.78rem;cursor:pointer;font-family:inherit;transition:.15s;padding:4px 8px;border-radius:6px}
.btn-ghost:hover{color:var(--text);background:rgba(128,128,128,.08)}

.auth-error{margin-top:12px;padding:10px 14px;background:rgba(239,68,68,.08);border:1px solid rgba(239,68,68,.2);border-radius:8px;color:#fca5a5;font-size:.78rem;text-align:left}
.auth-skip{width:100%;margin-top:14px;font-size:.82rem;color:var(--text-tri)}

/* ═══════ LIGHT MODE (class-based) ═══════ */
body.light{
  --bg:linear-gradient(135deg,#f0f2f8,#eceef4);
  --text:#2a3040;--text-sec:#6a7488;--text-tri:#a0a8b8;
  --trk-bg:rgba(0,0,0,.04);--trk-border:rgba(0,0,0,.06);
  --lev-off-1:#b0b8c8;--lev-off-2:#8a92a4;--lev-shadow:rgba(0,0,0,.08);
  --cell-bg:rgba(255,255,255,.5);--cell-hover:rgba(255,255,255,.7);
  --cell-border:rgba(255,255,255,.6);
  --cell-green-bg:rgba(240,255,245,.5);--cell-green-border:rgba(34,197,94,.18);
  --cell-amber-bg:rgba(255,252,240,.5);--cell-amber-border:rgba(245,158,11,.15);
  --icon-off:#a0a8b8;--icon-on:#4a5a68;
  --label-off:#5a6478;--label-on:#1a2030;
  --status-border:rgba(0,0,0,.05);--status-dot-off:#c8ccd4;
  --logo-color:#2a3040;
  --surface:rgba(255,255,255,.6);--border:rgba(0,0,0,.08);
  --input-bg:rgba(255,255,255,.7);--input-border:rgba(0,0,0,.1);
  --lock-bg:rgba(239,68,68,.05);--lock-border:rgba(239,68,68,.12);
}

/* ═══════ DASHBOARD ═══════ */

.dash-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;padding:0 4px;flex-wrap:wrap;gap:8px}
.logo{font-weight:800;font-size:1.1rem;letter-spacing:-.02em;color:var(--logo-color)}
.logo .dot{display:inline-block;width:5px;height:5px;background:var(--green);border-radius:50%;margin:0 .5px}
.logo .version{font-size:.5rem;font-weight:500;color:var(--text-tri);margin-left:4px;vertical-align:middle}
.dash-header-right{display:flex;align-items:center;gap:8px}
.dash-email{font-size:.72rem;color:var(--text-tri)}

.dash-status-bar{display:flex;align-items:center;gap:8px;padding:8px 4px;margin-bottom:12px;font-size:.78rem;color:var(--text-sec);border-bottom:.5px solid var(--status-border)}
.status-dot{width:6px;height:6px;border-radius:50%;background:var(--status-dot-off);flex-shrink:0}
.status-dot.active{background:var(--green);box-shadow:0 0 6px var(--green-glow)}
.status-dot.partial{background:var(--amber);box-shadow:0 0 6px rgba(245,158,11,.3)}
.sync-badge{margin-left:auto;font-size:.65rem;color:var(--text-tri);padding:2px 8px;background:var(--surface);border:1px solid var(--border);border-radius:4px}

/* Breadcrumb */
.breadcrumb{display:flex;align-items:center;gap:0;margin-bottom:14px;flex-wrap:wrap}
.breadcrumb .crumb{background:none;border:none;color:var(--text-tri);font-size:.82rem;font-weight:600;cursor:pointer;padding:4px 0;font-family:inherit;transition:.15s}
.breadcrumb .crumb:hover{color:var(--text)}
.breadcrumb .crumb.current{color:var(--text);cursor:default}
.breadcrumb .sep{color:var(--text-tri);font-size:.7rem;margin:0 6px;opacity:.5}

.section-title{font-size:1.1rem;font-weight:800;margin-bottom:14px}

/* Grid */
.fuse-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;align-items:stretch}
@media(max-width:600px){.fuse-grid{grid-template-columns:repeat(3,1fr)}}
@media(max-width:400px){.fuse-grid{grid-template-columns:repeat(2,1fr)}}

/* Cell — frosted glass */
.fuse-cell{
  display:flex;flex-direction:column;align-items:center;cursor:pointer;user-select:none;
  padding:10px 6px;border-radius:12px;transition:.15s;
  background:var(--cell-bg);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);
  border:1px solid var(--cell-border)
}
.fuse-cell:hover{background:var(--cell-hover)}
.fuse-cell[data-s="1"]{background:var(--cell-green-bg);border-color:var(--cell-green-border)}
.fuse-cell[data-w="amber"]{background:var(--cell-amber-bg);border-color:var(--cell-amber-border)}

.fuse-wire{display:none}
.fuse-box{width:100%;flex:1;padding:4px 2px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px}
.fuse-icon{width:18px;height:18px;color:var(--icon-off);transition:.2s}
.fuse-icon svg{width:100%;height:100%}
.fuse-cell[data-s="1"] .fuse-icon{color:var(--icon-on)}
.fuse-cell[data-w="amber"] .fuse-icon{color:#b8860b}

.fuse-lb{font-weight:600;font-size:.75rem;color:var(--label-off);text-align:center;line-height:1.2;transition:.2s}
.fuse-cell[data-s="1"] .fuse-lb{color:var(--label-on)}
.fuse-cell[data-w="amber"] .fuse-lb{color:#92700a!important}

/* Track + Lever */
.fuse-trk{width:22px;height:44px;background:var(--trk-bg);border:1px solid var(--trk-border);border-radius:8px;position:relative;overflow:hidden;cursor:pointer}
.fuse-lev{position:absolute;left:2px;right:2px;height:16px;border-radius:6px;transition:.25s cubic-bezier(.22,1,.36,1)}
.fuse-cell[data-s="0"] .fuse-lev{top:2px;background:linear-gradient(180deg,var(--lev-off-1),var(--lev-off-2));box-shadow:0 1px 3px var(--lev-shadow)}
.fuse-cell[data-s="1"] .fuse-lev{top:auto;bottom:2px;background:linear-gradient(180deg,#22c55e,#16a34a);box-shadow:0 1px 6px rgba(34,197,94,.25)}
.fuse-cell[data-w="amber"] .fuse-lev{top:50%;transform:translateY(-50%);bottom:auto;background:linear-gradient(180deg,#f59e0b,#d97706);box-shadow:0 1px 6px rgba(245,158,11,.2)}

.fuse-inf{font-size:.6rem;color:var(--text-tri);transition:.2s}
.fuse-cell[data-s="1"] .fuse-inf{color:var(--text-sec)}
.fuse-cfg{font-size:.6rem;color:var(--text-tri);transition:.15s;cursor:pointer}
.fuse-cell:hover .fuse-cfg{color:var(--text-sec)}

/* Toggle animation */
@keyframes fuse-pop{0%,100%{transform:scale(1)}50%{transform:scale(1.03)}}
.fuse-cell.just-toggled{animation:fuse-pop .2s ease}

/* Client-locked state */
.client-locked .fuse-trk{opacity:.35;cursor:not-allowed;pointer-events:none}
.client-locked .fuse-cell{cursor:default}
.client-locked .fuse-cfg{display:none}

/* Devices panel */
.panel{margin-top:24px;padding:20px;background:var(--surface);backdrop-filter:blur(8px);border:1px solid var(--border);border-radius:14px}
.panel-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.panel-title{font-weight:700;font-size:.9rem}

.device-row{display:flex;align-items:center;justify-content:space-between;padding:6px 0;font-size:.78rem;border-bottom:.5px solid var(--border)}
.device-row:last-child{border-bottom:none}
.device-name{color:var(--text-sec)}
.role-badge{font-size:.6rem;padding:2px 6px;border-radius:4px;font-weight:600}
.role-badge.admin{background:rgba(34,197,94,.1);color:var(--green);border:1px solid rgba(34,197,94,.2)}
.role-badge.client{background:rgba(239,68,68,.1);color:var(--red);border:1px solid rgba(239,68,68,.2)}

.device-actions{display:flex;align-items:center;gap:8px}
.device-actions button{background:none;border:none;color:var(--text-tri);font-size:.68rem;cursor:pointer;font-family:inherit;transition:.15s}
.device-actions button:hover{color:var(--text)}

.lock-bar{text-align:center;padding:10px;margin-bottom:12px;font-size:.75rem;color:var(--red);background:var(--lock-bg);border:1px solid var(--lock-border);border-radius:10px}

/* Settings panel */
.settings-section{display:flex;align-items:center;justify-content:space-between;padding:10px 0;border-bottom:.5px solid var(--border);font-size:.82rem}
.settings-label{color:var(--text-sec);font-weight:500}
.settings-value{color:var(--text);font-weight:600}
.settings-upgrade{padding:16px 0;border-bottom:.5px solid var(--border)}
.settings-actions{display:flex;gap:8px;padding-top:16px}
.settings-actions button{flex:1;padding:8px;font-size:.78rem}
.settings-danger{display:flex;gap:8px;justify-content:center;padding-top:16px;border-top:.5px solid var(--border);margin-top:16px}
button:disabled{opacity:.4;cursor:not-allowed}

/* Sync banner */
.sync-banner{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:20px;padding:14px 18px;background:var(--surface);backdrop-filter:blur(8px);border:1px solid var(--border);border-radius:12px}
.sync-banner-text{font-size:.78rem;color:var(--text-sec);line-height:1.5}
.sync-banner-text strong{color:var(--text);font-weight:700}
.sync-banner-btn{flex-shrink:0;font-size:.78rem;padding:8px 16px}

/* Extension badge */
.ext-badge{font-size:.68rem;padding:3px 8px;border-radius:6px;display:flex;align-items:center;gap:4px}
.ext-badge.connected{color:var(--green);background:rgba(34,197,94,.08);border:1px solid rgba(34,197,94,.15)}
.ext-badge.disconnected{color:var(--text-tri);background:var(--surface);border:1px solid var(--border)}
.ext-dot{width:5px;height:5px;background:var(--green);border-radius:50%;box-shadow:0 0 6px rgba(34,197,94,.3)}
