@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg-0: #060912;
  --bg-1: #0c1220;
  --bg-2: #131a2c;
  --bg-3: #1a2237;
  --line: #1f2a44;
  --line-soft: #18213a;

  --text:        #e9eef7;
  --text-soft:   #b8c3d6;
  --muted:       #6e7c97;
  --muted-soft:  #4f5a72;

  --accent:      #5b8cff;
  --accent-2:    #7aa2ff;
  --accent-soft: rgba(91,140,255,.12);

  --ok:    #2bb673;
  --ok-soft: rgba(43,182,115,.12);
  --warn:  #f4a900;
  --danger:#e54545;
  --danger-soft: rgba(229,69,69,.14);

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.25);
  --shadow:    0 4px 16px rgba(0,0,0,.32), 0 1px 2px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.55), 0 8px 16px -8px rgba(0,0,0,.4);

  --t: 160ms cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11','ss01';
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; }

a { color: var(--accent); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent-2); }

h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 19px; }
h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }

/* ---------- Buttons ---------- */
button, .btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--t);
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
button:hover, .btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
button:active, .btn:active { transform: translateY(0); filter: brightness(.95); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; }

button.ghost {
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text-soft);
}
button.ghost:hover { background: var(--bg-3); color: var(--text); }
button.danger { background: var(--danger); }
button.ok { background: var(--ok); }
button.subtle {
  background: transparent; border: 1px solid var(--line);
  color: var(--text-soft);
}
button.subtle:hover { background: var(--bg-2); color: var(--text); }
button.icon { width: 36px; padding: 0; }

/* ---------- Inputs ---------- */
input, select, textarea {
  font: inherit;
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-2);
}
input[type=color] {
  width: 56px; height: 40px; padding: 2px;
  cursor: pointer;
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ---------- Layout primitives ---------- */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t), transform var(--t), box-shadow var(--t);
}
.card.hover:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }

.container { max-width: 1180px; margin: 28px auto; padding: 0 24px; }

.muted { color: var(--muted); font-size: 13px; }
.soft  { color: var(--text-soft); }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--bg-2);
  font-size: 12px;
  color: var(--text-soft);
  border: 1px solid var(--line);
  font-weight: 500;
  transition: all var(--t);
}
a.tag:hover { background: var(--bg-3); color: var(--text); border-color: var(--line); }
.tag.accent { background: var(--accent-soft); color: var(--accent); border-color: rgba(91,140,255,.3); }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge.live { background: var(--ok-soft); color: var(--ok); }
.badge.off  { background: var(--bg-2); color: var(--muted); }

.hidden { display: none !important; }

/* ---------- Brand bar (top app bar) ---------- */
.brandbar {
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
}
.brandbar .logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: white;
  box-shadow: 0 4px 12px rgba(91,140,255,.3);
}
.brandbar .title {
  font-weight: 700; font-size: 15px; letter-spacing: -.01em;
}
.brandbar .title small {
  display: block;
  font-weight: 500; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .14em; margin-top: 1px;
}
.brandbar nav { display: flex; gap: 6px; align-items: center; margin-left: 18px; }
.brandbar nav a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-soft);
  font-weight: 500; font-size: 14px;
  transition: all var(--t);
}
.brandbar nav a:hover { background: var(--bg-2); color: var(--text); }
.brandbar nav a.active { background: var(--accent-soft); color: var(--accent); }
.brandbar .spacer { flex: 1; }
.brandbar .userchip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 99px;
}
.brandbar .userchip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #6c5ce7, #5b8cff);
  color: white; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Auth screen ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(91,140,255,.18), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(108,92,231,.14), transparent 50%),
    var(--bg-0);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.auth-card .brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
}
.auth-card .brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: white;
}

/* ---------- Modals ---------- */
dialog {
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: min(720px, 95vw);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-2); }

/* ---------- Misc ---------- */
.color-swatch {
  display: inline-block; width: 18px; height: 18px;
  border-radius: 4px; vertical-align: middle;
  border: 1px solid rgba(255,255,255,.15);
}

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: var(--bg-1);
  transition: all var(--t);
  cursor: pointer;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.dropzone strong { color: var(--text); display: block; margin-bottom: 4px; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 6px; border: 3px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--line); }
