:root{
  --bg:#080d18;
  --bg2:#0b1220;
  --panel:#0f1728;
  --line:rgba(255,255,255,.08);
  --text:#edf2f7;
  --muted:#94a3b8;
  --blue:#60a5fa;
  --cyan:#22d3ee;
  --green:#34d399;
  --purple:#a78bfa;
  --orange:#fb923c;
  --red:#f87171;
  --gold:#fbbf24;
  --radius:22px;
  --shadow:0 14px 50px rgba(0,0,0,.34)
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}

body{
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgba(96,165,250,.14), transparent 22%),
    radial-gradient(circle at 85% 5%, rgba(167,139,250,.13), transparent 22%),
    linear-gradient(180deg,var(--bg) 0%, var(--bg2) 100%);
  min-height:100vh
}

a{color:inherit;text-decoration:none}
.app{min-height:100vh}

.topbar{
  position:sticky;
  top:0;
  z-index:50;
  backdrop-filter:blur(14px);
  background:rgba(8,13,24,.82);
  border-bottom:1px solid var(--line)
}

.topbar-inner{
  width:min(1540px, calc(100% - 34px));
  margin:0 auto;
  min-height:84px;
  display:flex;
  align-items:center;
  gap:20px
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:260px
}

.brand-mark{
  width:16px;
  height:16px;
  border-radius:999px;
  background:linear-gradient(135deg,var(--cyan),var(--purple));
  box-shadow:0 0 30px rgba(34,211,238,.45)
}

.brand-name{
  font-weight:900;
  font-size:18px
}

.brand-sub{
  font-size:12px;
  color:var(--muted);
  padding:5px 9px;
  border:1px solid var(--line);
  border-radius:999px
}

.nav{
  display:flex;
  gap:8px
}

.nav a{
  color:var(--muted);
  padding:11px 15px;
  border-radius:13px;
  font-size:14px;
  font-weight:800
}

.nav a.active,
.nav a:hover{
  background:rgba(255,255,255,.06);
  color:#fff
}

.top-actions{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:12px
}

.search{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:360px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px 12px
}

.search input{
  width:100%;
  background:transparent;
  border:0;
  outline:0;
  color:#fff;
  font-size:14px
}

.user-chip{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 11px;
  border-radius:16px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--line)
}

.avatar{
  width:40px;
  height:40px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg,#0ea5e9,#7c3aed);
  font-weight:900;
  color:#fff
}

.user-role{
  font-size:13px;
  font-weight:900
}

.user-sub{
  font-size:11px;
  color:var(--muted)
}

.container{
  width:min(1540px, calc(100% - 34px));
  margin:24px auto 30px
}

.footer{
  width:min(1540px, calc(100% - 34px));
  margin:16px auto 26px;
  color:var(--muted);
  font-size:12px
}

.card{
  background:linear-gradient(180deg, rgba(15,23,40,.98), rgba(11,18,32,.98));
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow)
}

.muted,.sub,.small{
  color:var(--muted)
}

.small{
  font-size:12px
}

.stack{
  display:flex;
  flex-direction:column;
  gap:12px
}

.panel-head{
  padding:18px 20px;
  border-bottom:1px solid var(--line);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px
}

.panel-head h2{
  margin:0;
  font-size:22px
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:9px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  font-size:13px;
  font-weight:800
}

.pill.active{
  background:linear-gradient(135deg,rgba(34,211,238,.16),rgba(167,139,250,.18))
}

.pill.ghost{
  background:transparent
}

.workspace-bar{
  margin:0 0 16px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  padding:10px;
  border:1px solid var(--line);
  border-radius:18px;
  background:rgba(255,255,255,.03)
}

.workspace-item{
  display:flex;
  align-items:center;
  gap:8px;
  padding:9px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  font-size:13px;
  font-weight:800;
  cursor:pointer
}

.workspace-item.ghost{
  margin-left:auto;
  background:transparent
}

.workspace-item.ghost + .workspace-item.ghost{
  margin-left:0
}

.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(2,6,23,.78);
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  z-index:1000
}

.modal-backdrop.open{
  display:flex
}

.modal-box{
  width:min(860px,100%);
  background:#0f172a;
  border:1px solid rgba(255,255,255,.12);
  border-radius:22px;
  box-shadow:0 22px 60px rgba(0,0,0,.45);
  padding:20px
}

.customize-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.03)
}

.widget-tool{
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  color:var(--text);
  border-radius:10px;
  padding:6px 9px;
  font-size:12px;
  cursor:pointer
}

.widget-tag{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:5px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05)
}

/* Builder mode */
.dashboard-zone{
  display:flex;
  flex-direction:column;
  gap:16px;
  min-height:80px
}

.dashboard-widget{
  position:relative
}

.dashboard-widget.layout-active{
  cursor:grab
}

.dashboard-widget.dragging{
  opacity:.55;
  transform:scale(.99)
}

.dashboard-widget .widget-tools{
  position:absolute;
  right:14px;
  top:14px;
  display:none;
  gap:8px;
  z-index:5
}

.dashboard-builder-mode [data-dashboard-root] > .dashboard-widget{
  outline:1px dashed rgba(255,255,255,.18);
  border-radius:18px
}

.dashboard-builder-mode [data-dashboard-root] > .dashboard-widget .widget-tools{
  display:flex
}

.dashboard-stats-sorter{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:22px;
}

.dashboard-kpi-sort-item{
  position:relative;
}

.kpi-drag-handle{
  display:none;
}

.dashboard-builder-mode .dashboard-kpi-sort-item{
  cursor:grab;
}

.dashboard-builder-mode [data-kpi-sorter] .dashboard-kpi-sort-item{
  outline:1px dashed rgba(255,255,255,.16);
}

.dashboard-builder-mode [data-kpi-sorter] .dashboard-kpi-sort-item:hover{
  outline-color:rgba(255,255,255,.32);
}

.dashboard-builder-mode .kpi-drag-handle{
  display:flex;
  position:absolute;
  top:10px;
  right:10px;
  z-index:6;
  align-items:center;
  justify-content:center;
  min-width:34px;
  height:28px;
  padding:0 8px;
  border-radius:10px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  color:var(--muted);
  font-size:12px;
  font-weight:900;
}

.dashboard-kpi-sort-item.dragging{
  opacity:.55;
  transform:scale(.99);
}

@media (max-width:1100px){
  .dashboard-stats-sorter{
    grid-template-columns:repeat(2,1fr);
  }
}

@media (max-width:700px){
  .dashboard-stats-sorter{
    grid-template-columns:1fr;
  }
}

.layout-help{
  margin-top:10px;
  font-size:12px;
  color:var(--muted)
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="password"],
select{
  width:100%;
  background:linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.03));
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px;
  color:var(--text);
  outline:0
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="password"]:focus,
select:focus{
  border-color:rgba(34,211,238,.45);
  box-shadow:0 0 0 3px rgba(34,211,238,.12)
}

@media (max-width:1180px){
  .topbar-inner{flex-wrap:wrap}
  .search{min-width:220px}
}

@media (max-width:900px){
  .container,
  .footer,
  .topbar-inner{
    width:min(100% - 20px, 1540px)
  }
}