/* MeowWatch dashboard — dark violet theme */
:root {
  --bg: #0b0b12;
  --bg-2: #12121c;
  --bg-3: #181826;
  --panel: #15151f;
  --panel-2: #1c1c2a;
  --border: #262636;
  --border-2: #33334a;
  --text: #ececf4;
  --text-2: #a2a2b8;
  --text-3: #6e6e88;
  --accent: #a855f7;
  --accent-2: #7c3aed;
  --accent-soft: rgba(168, 85, 247, 0.14);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --yellow: #eab308;
  --blue: #3b82f6;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- Boot ---------- */
.boot {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: var(--bg);
}
.boot-logo { font-size: 56px; animation: bob 1.6s ease-in-out infinite; }
.boot-text { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--border-2); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.spinner-sm {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo { font-size: 26px; }
.sidebar-brand h1 { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.sidebar-brand small { display: block; font-size: 10.5px; color: var(--text-3); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

.nav { padding: 12px 10px; flex: 1; }
.nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  cursor: pointer; transition: background .12s, color .12s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: #fff; font-weight: 600; }
.nav-item .ico { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto; font-size: 10.5px; font-weight: 700;
  background: var(--accent); color: #fff; border-radius: 99px;
  padding: 1px 7px; min-width: 20px; text-align: center;
}
.nav-item .badge.live { background: var(--red); }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.user-card {
  display: flex; align-items: center; gap: 9px;
  padding: 9px; border-radius: var(--radius-sm); background: var(--bg-3);
}
.user-card img { width: 30px; height: 30px; border-radius: 50%; background: var(--border); }
.user-card .name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .sub { font-size: 10.5px; color: var(--text-3); }
.logout-btn {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 16px; padding: 4px; border-radius: 6px; margin-left: auto;
}
.logout-btn:hover { color: var(--red); background: var(--red-soft); }

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

.topbar {
  padding: 16px 26px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  background: rgba(11,11,18,.85); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.topbar .sub { font-size: 12px; color: var(--text-3); margin-left: 2px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.content { padding: 24px 26px 60px; max-width: 1400px; width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.card-head h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.card-head .spacer { margin-left: auto; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 3px;
  position: relative; overflow: hidden;
}
.stat .label { font-size: 11.5px; color: var(--text-3); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.stat .delta { font-size: 11.5px; color: var(--text-3); }
.stat .ico { position: absolute; right: 12px; top: 12px; font-size: 20px; opacity: .35; }
.stat.accent { border-color: rgba(168,85,247,.35); background: linear-gradient(160deg, rgba(168,85,247,.09), transparent 65%); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--panel-2);
  color: var(--text); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all .13s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--border); border-color: var(--border-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn-danger { background: var(--red-soft); border-color: rgba(239,68,68,.4); color: #fca5a5; }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,.25); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-3); color: var(--text); }
.btn-icon { padding: 6px; width: 30px; height: 30px; justify-content: center; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border-2);
  color: var(--text); outline: none; transition: border-color .13s, box-shadow .13s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 76px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.select { cursor: pointer; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 180px; }

/* ---------- Toggle ---------- */
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle .track {
  width: 36px; height: 20px; border-radius: 99px; background: var(--border-2);
  position: relative; transition: background .16s; flex-shrink: 0;
}
.toggle .track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .16s;
}
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(16px); }
.toggle .txt { font-size: 12.5px; color: var(--text-2); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-3);
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid rgba(38,38,54,.55); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.017); }

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2.5px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
}
.pill-live { background: var(--red-soft); color: #fca5a5; }
.pill-live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--red);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
.pill-off { background: var(--bg-3); color: var(--text-3); }
.pill-ok { background: var(--green-soft); color: #86efac; }
.pill-err { background: var(--red-soft); color: #fca5a5; }
.pill-warn { background: rgba(234,179,8,.14); color: #fde047; }
.pill-platform { background: var(--bg-3); color: var(--text-2); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 44px 20px; color: var(--text-3);
}
.empty .ico { font-size: 40px; margin-bottom: 10px; opacity: .55; }
.empty h4 { font-size: 14.5px; color: var(--text-2); font-weight: 700; margin-bottom: 5px; }
.empty p { font-size: 12.5px; max-width: 420px; margin: 0 auto 16px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
}
.login-wrap::before {
  content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(168,85,247,.20), transparent 68%);
  top: -260px; right: -180px; pointer-events: none;
}
.login-wrap::after {
  content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.13), transparent 68%);
  bottom: -280px; left: -160px; pointer-events: none;
}
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 34px 28px; box-shadow: var(--shadow);
  text-align: center;
}
.login-card .logo { font-size: 46px; margin-bottom: 8px; }
.login-card h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 5px; }
.login-card .tagline { font-size: 13px; color: var(--text-2); margin-bottom: 24px; }
.login-card .divider {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0; color: var(--text-3); font-size: 11.5px; font-weight: 600;
}
.login-card .divider::before, .login-card .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.login-card .features {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  margin-top: 22px; font-size: 11px; color: var(--text-3);
}
.login-card .features span {
  background: var(--bg-3); padding: 3px 9px; border-radius: 99px;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100; backdrop-filter: blur(4px);
  animation: fadeIn .14s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--panel); border: 1px solid var(--border-2);
  border-radius: 16px; width: 100%; max-width: 540px;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow);
  animation: slideUp .16s ease;
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.modal-head {
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { font-size: 15.5px; font-weight: 700; }
.modal-head .close {
  margin-left: auto; background: none; border: none; color: var(--text-3);
  font-size: 20px; cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.modal-head .close:hover { color: var(--text); background: var(--bg-3); }
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 9px; justify-content: flex-end;
}

/* ---------- Toast ---------- */
.toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; max-width: 340px;
}
.toast {
  background: var(--panel-2); border: 1px solid var(--border-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 12.5px; box-shadow: var(--shadow);
  animation: slideIn .18s ease;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--yellow); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0 } to { transform: translateX(0); opacity: 1 } }

/* ---------- Guild cards ---------- */
.guild-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px; cursor: pointer;
  transition: border-color .13s, transform .13s;
  display: flex; flex-direction: column; gap: 10px;
}
.guild-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.guild-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.guild-card .head { display: flex; align-items: center; gap: 10px; }
.guild-card img, .guild-card .ph {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; background: var(--bg-3);
  object-fit: cover;
}
.guild-card .ph { display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--text-2); }
.guild-card .nm { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-card .meta { font-size: 11.5px; color: var(--text-3); }
.guild-card .stats { display: flex; gap: 12px; font-size: 11.5px; color: var(--text-2); border-top: 1px solid var(--border); padding-top: 9px; }
.guild-card .stats b { color: var(--text); font-weight: 700; }

/* ---------- Watch row ---------- */
.watch-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-2);
}
.watch-item + .watch-item { margin-top: 8px; }
.watch-item.live { border-color: rgba(239,68,68,.4); background: linear-gradient(90deg, rgba(239,68,68,.07), transparent 60%); }
.watch-item .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-3); object-fit: cover;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.watch-item .info { flex: 1; min-width: 0; }
.watch-item .title { font-weight: 650; font-size: 13.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.watch-item .sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-item .actions { display: flex; gap: 5px; flex-shrink: 0; }

/* ---------- Chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 110px; padding-top: 8px; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.chart .bar {
  width: 100%; max-width: 42px; border-radius: 5px 5px 0 0; min-height: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  transition: height .3s ease; position: relative;
}
.chart .bar:hover { filter: brightness(1.25); }
.chart .lbl { font-size: 9.5px; color: var(--text-3); white-space: nowrap; }

/* ---------- Misc ---------- */
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px }
.flex { display: flex } .between { justify-content: space-between } .center { align-items: center }
.gap-1 { gap: 8px } .gap-2 { gap: 16px }
.wrap { flex-wrap: wrap }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.text-right { text-align: right; }
code {
  background: var(--bg-3); padding: 1.5px 6px; border-radius: 5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px;
}
pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; overflow-x: auto; font-size: 12px; line-height: 1.55;
}
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.discord-preview {
  background: #313338; border-radius: 8px; padding: 14px;
  font-family: var(--font);
}
.discord-preview .msg-head { display: flex; gap: 9px; align-items: center; margin-bottom: 6px; }
.discord-preview .bot-tag {
  background: #5865f2; color: #fff; font-size: 9.5px; font-weight: 700;
  padding: 1px 4px; border-radius: 3px; text-transform: uppercase;
}
.discord-preview .msg-body { font-size: 13.5px; color: #dbdee1; white-space: pre-wrap; word-break: break-word; }
.discord-preview .embed {
  border-left: 4px solid #5865f2; background: #2b2d31;
  border-radius: 4px; padding: 10px 12px; margin-top: 6px; max-width: 420px;
}
.discord-preview .embed .e-title { font-weight: 700; color: #00a8fc; font-size: 14px; margin-bottom: 4px; }
.discord-preview .embed .e-desc { font-size: 12.5px; color: #dbdee1; }
.discord-preview .embed .e-foot { font-size: 10.5px; color: #949ba4; margin-top: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 90;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex !important; }
  .content { padding: 16px 14px 50px; }
  .topbar { padding: 12px 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stat .value { font-size: 22px; }
  .watch-item { flex-wrap: wrap; }
  .watch-item .actions { width: 100%; justify-content: flex-end; }
}
.menu-btn { display: none; }

.scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 85; animation: fadeIn .15s;
}
