:root{
  --bg:#050505;
  --card:#121212;
  --card-2:#1a1a24;
  --text:#ffffff;
  --muted:#a1a1aa;
  --border:rgba(255, 255, 255, 0.08);
  --accent:#8b5cf6;
  --accent-2:#a855f7;
  --accent-3:#6d28d9;
  --shadow:0 12px 24px rgba(0,0,0,0.40);
  --radius:16px;
  --radius-sm:12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--sans);
  background:radial-gradient(circle at top right, rgba(109, 40, 217, 0.08) 0%, transparent 50%),
             var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
}

a{color:inherit;text-decoration:none}

.app{min-height:100vh;display:flex}

.sidebar{
  width:260px;
  padding:2rem 1.5rem;
  border-right:1px solid var(--border);
  background:var(--bg);
  position:sticky;
  top:0;
  height:100vh;
  z-index:10;
}

.brand{display:flex;gap:10px;align-items:center;margin-bottom:3rem}
.brand-mark{
  width:44px;height:44px;border-radius:14px;
  background:rgba(18,18,18,.9);
  border:1px solid var(--border);
  box-shadow:0 10px 22px rgba(0,0,0,.35);
  display:flex;align-items:center;justify-content:center;
  color:#ffffff;font-weight:800;letter-spacing:.2px;
  overflow:hidden;
}
.brand-logo{
  width:44px;
  height:44px;
  border-radius:0;
  object-fit:contain;
  display:block;
  filter:drop-shadow(0 6px 16px rgba(0,0,0,.35));
}
.brand-title{font-weight:800}
.brand-sub{font-size:12px;color:var(--muted);margin-top:2px}

.nav{display:flex;flex-direction:column;gap:.5rem;margin-top:0}
.nav-item{
  display:flex;
  align-items:center;
  gap:12px;
  padding:.8rem 1rem;
  color:var(--muted);
  border-radius:8px;
  border:1px solid transparent;
  transition:all .2s ease;
  font-size:.95rem;
  font-weight:500;
}
.nav-item svg{
  width:20px;
  height:20px;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
  fill:none;
  transition:transform .2s ease, color .2s ease;
}
.nav-item:hover{
  background:var(--card-2);
  color:var(--text);
}
.nav-item:hover svg{transform:scale(1.1);color:var(--accent-2)}
.nav-item.is-active{
  background:linear-gradient(90deg, rgba(139, 92, 246, 0.15) 0%, transparent 100%);
  color:var(--text);
  border-left:3px solid var(--accent);
  padding-left:calc(1rem - 3px);
}
.nav-item.is-active svg{color:var(--accent)}
.nav-sep{height:1px;background:var(--border);margin:10px 4px}

.main{flex:1;display:flex;flex-direction:column;min-width:0}

.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:2.5rem 3.5rem 1rem 3.5rem;
}
.topbar-title{font-size:18px;font-weight:800;letter-spacing:.2px}

.topbar-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}

.user-profile{
  display:flex;
  align-items:center;
  gap:1rem;
  padding:.5rem 1rem;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:50px;
}

.user-profile:hover{border-color:rgba(139, 92, 246, 0.5)}

.avatar{
  width:32px;
  height:32px;
  background:linear-gradient(135deg, var(--accent-2), var(--accent-3));
  border-radius:50%;
  display:flex;
  justify-content:center;
  align-items:center;
  font-weight:600;
  font-size:.9rem;
}

.content{padding:0 3.5rem 2.5rem 3.5rem}

.footer{padding:16px 26px;color:var(--muted);display:flex;justify-content:space-between;border-top:1px solid var(--border)}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.card-pad{padding:18px}

.grid{display:grid;gap:16px}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}

.kpi{padding:18px}
.kpi .label{color:var(--muted);font-size:12px}
.kpi .value{font-size:28px;font-weight:900;margin-top:8px}

.row{display:flex;gap:12px;flex-wrap:wrap}

.input, select, textarea{
  width:100%;
  background:rgba(15,23,42,.55);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px 12px;
  outline:none;
}
textarea{min-height:220px;font-family:var(--mono);line-height:1.45}
label{display:block;font-size:12px;color:var(--muted);margin:0 0 8px 2px}
.field{margin-bottom:14px}

.btn{
  display:inline-flex;align-items:center;justify-content:center;
  gap:8px;
  padding:11px 14px;
  border-radius:999px;
  border:1px solid transparent;
  cursor:pointer;
  font-weight:700;
  transition:transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:active{transform:translateY(1px)}
.btn-primary{background:rgba(139, 92, 246, 0.95);color:var(--text);box-shadow:0 18px 50px rgba(139,92,246,.22)}
.btn-primary:hover{box-shadow:0 18px 65px rgba(139,92,246,.32)}
.btn-secondary{background:rgba(148,163,184,.08);border-color:var(--border);color:var(--text)}
.btn-secondary:hover{border-color:rgba(139,92,246,.35);background:rgba(139,92,246,.10)}
.btn-danger{background:rgba(248,113,113,.12);border-color:rgba(248,113,113,.25);color:#fecaca}

.badge{
  display:inline-flex;align-items:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid var(--border);
  background:rgba(148,163,184,.08);
  color:var(--text);
}

.snippets-toolbar{display:flex;gap:12px;flex-wrap:wrap;align-items:end}
.snippets-toolbar .field{margin-bottom:0;min-width:220px;flex:1}

.snippet-card{padding:16px}
.snippet-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.snippet-title{font-weight:900;font-size:16px}
.snippet-meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.snippet-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}
.icon-btn{
  width:40px;height:40px;border-radius:999px;
  border:1px solid var(--border);
  background:rgba(148,163,184,.08);
  cursor:pointer;
}
.icon-btn:hover{border-color:rgba(139,92,246,.35);background:rgba(139,92,246,.10)}
.icon-btn.is-on{border-color:rgba(139,92,246,.55);background:rgba(139,92,246,.16)}

.muted{color:var(--muted)}
.divider{height:1px;background:var(--border);margin:14px 0}

.auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:28px}
.auth-card{width:100%;max-width:420px}
.auth-card .brand{margin-bottom:10px}

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

.modal{position:fixed;inset:0;display:none;z-index:50}
.modal.is-open{display:block}
.modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.65)}
.modal-panel{
  position:relative;
  width:min(1100px, calc(100vw - 32px));
  height:min(720px, calc(100vh - 32px));
  margin:16px auto;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:12px 12px 12px 16px;border-bottom:1px solid var(--border)}
.modal-title{font-weight:800}
.modal-body{flex:1;min-height:0;background:rgba(0,0,0,.15)}
.modal-body iframe{width:100%;height:100%;border:0;background:#0b0b0f}

@media (max-width: 980px){
  .grid-3{grid-template-columns:1fr}
  .sidebar{display:none}
  .topbar{padding:1.5rem 1.5rem 1rem 1.5rem}
  .content{padding:0 1.5rem 1.5rem 1.5rem}
  .footer{padding:16px}
}


.snippet-head{align-items:center}
.modern-actions{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:16px;
}
.modern-actions .btn,
.btn-action{
  width:100%;
  justify-content:flex-start;
  border-radius:14px;
  padding:12px 14px;
  background:linear-gradient(180deg, rgba(255,255,255,.03) 0%, rgba(255,255,255,.01) 100%);
  border-color:rgba(148,163,184,.18);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04), 0 10px 24px rgba(2,6,23,.18);
}
.modern-actions .btn:hover,
.btn-action:hover{
  transform:translateY(-1px);
  border-color:rgba(139,92,246,.42);
  box-shadow:0 14px 30px rgba(139,92,246,.14);
}
.modern-actions .btn-danger{
  background:linear-gradient(180deg, rgba(248,113,113,.16) 0%, rgba(248,113,113,.08) 100%);
  border-color:rgba(248,113,113,.24);
}
.modern-actions .btn svg,
.btn-action svg,
.icon-btn svg{
  width:18px;
  height:18px;
  flex:0 0 18px;
  stroke:currentColor;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
  fill:none;
}
.modern-actions .btn span,
.btn-action span{white-space:nowrap}
.icon-btn{
  width:46px;
  height:46px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:15px;
  border:1px solid rgba(148,163,184,.18);
  background:linear-gradient(180deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,.015) 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04), 0 10px 24px rgba(2,6,23,.18);
  transition:transform .15s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.icon-btn:hover{
  transform:translateY(-1px) scale(1.02);
  border-color:rgba(139,92,246,.45);
  background:linear-gradient(180deg, rgba(139,92,246,.15) 0%, rgba(139,92,246,.08) 100%);
  box-shadow:0 16px 34px rgba(139,92,246,.18);
}
.icon-btn .fav-icon{display:inline-flex;align-items:center;justify-content:center}
.icon-btn .fav-icon svg{width:20px;height:20px;fill:transparent}
.icon-btn.is-on{
  border-color:rgba(244,114,182,.45);
  background:linear-gradient(180deg, rgba(244,114,182,.18) 0%, rgba(236,72,153,.12) 100%);
  box-shadow:0 16px 36px rgba(236,72,153,.22);
  color:#f9a8d4;
}
.icon-btn.is-on .fav-icon svg{fill:currentColor;stroke:currentColor}
@media (max-width: 640px){
  .modern-actions{grid-template-columns:1fr}
}
