:root {
  --bg: #0d0d14;
  --bg-raised: #12121c;
  --card: rgba(255, 255, 255, 0.04);
  --card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f4f4f8;
  --muted: #9a9aad;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --none: #6b7280;
  --none-soft: rgba(107, 114, 128, 0.18);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 500px at 70% -10%, rgba(99, 102, 241, 0.09), transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh;
}

button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 60px; }

/* Header */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 0 14px;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: 0.2px; }
.brand .dot { color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.tab {
  background: transparent; color: var(--muted); border: 1px solid transparent;
  padding: 8px 14px; border-radius: 10px;
}
.tab:hover { color: var(--text); background: var(--card); }
.tab.active { color: var(--text); background: var(--accent-soft); border-color: rgba(99, 102, 241, 0.35); }
.tab .badge {
  display: inline-block; min-width: 18px; text-align: center; margin-left: 6px;
  background: var(--warn); color: #1a1206; border-radius: 9px; font-size: 11px; font-weight: 700; padding: 0 5px;
}

/* Cards and layout */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.cols-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.stat { text-align: left; }
.stat .n { font-size: 24px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; }

h2 { font-size: 16px; margin: 26px 0 12px; }
h2:first-child { margin-top: 0; }
.sub { color: var(--muted); font-size: 13px; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row .spacer { flex: 1; }

/* Buttons and inputs */
.btn {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 10px;
}
.btn:hover { background: var(--card-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }
.btn.small { padding: 4px 9px; font-size: 12.5px; border-radius: 8px; }

input[type="text"], input[type="password"], input[type="url"], select {
  background: var(--bg-raised); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 11px; min-width: 0;
}
input:focus, select:focus { outline: 2px solid rgba(99, 102, 241, 0.5); outline-offset: 0; border-color: var(--accent); }
label.f { display: block; margin-bottom: 10px; }
label.f span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }

/* Pills and chips */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600;
}
.pill.success { background: var(--success-soft); color: #4ade80; }
.pill.decline { background: var(--danger-soft); color: #f87171; }
.pill.unknown { background: var(--none-soft); color: #9ca3af; }
.pill.ordered { background: var(--accent-soft); color: #a5b4fc; }
.pill.payment_issue { background: var(--warn-soft); color: #fbbf24; }
.pill.repaid { background: var(--success-soft); color: #4ade80; }
.pill.shipped { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }
.pill.delivered { background: var(--success-soft); color: #4ade80; }
.pill.cancelled { background: var(--none-soft); color: #9ca3af; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 10px; padding: 5px 10px; font-size: 12.5px; margin: 3px 4px 3px 0;
  border: 1px solid var(--border); background: var(--card);
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.chip.success::before { background: var(--success); box-shadow: 0 0 8px rgba(34, 197, 94, 0.7); }
.chip.decline::before { background: var(--danger); box-shadow: 0 0 8px rgba(239, 68, 68, 0.7); }
.chip.none::before { background: var(--none); }
.chip.unknown::before { background: var(--warn); }
.chip .r { color: var(--muted); font-size: 11.5px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
tr:last-child td { border-bottom: none; }
td .thumb { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--bg-raised); }
.table-scroll { overflow-x: auto; }

/* Drop cards */
.drop-card { cursor: pointer; transition: background 0.15s ease, transform 0.15s ease; }
.drop-card:hover { background: var(--card-hover); transform: translateY(-1px); }
.drop-card .head { display: flex; gap: 12px; align-items: center; }
.drop-card img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--bg-raised); }
.drop-card .t { font-weight: 600; }
.drop-card .counts { display: flex; gap: 8px; margin-top: 12px; }

.mono {
  width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; flex: none;
}

/* Radar */
.radar { border-color: rgba(245, 158, 11, 0.45); background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), var(--card)); }
.countdown { font-weight: 700; color: var(--warn); }
.countdown.overdue { color: var(--danger); }

.copybox {
  display: flex; align-items: center; gap: 8px; background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; font-family: Consolas, monospace; font-size: 12.5px;
  overflow: hidden;
}
.copybox .u { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* Login */
.login {
  max-width: 420px; margin: 12vh auto 0; padding: 28px;
}
.login h1 { font-size: 22px; margin: 0 0 4px; }

/* Clients two-pane */
.split { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
.list-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
}
.list-item:hover { background: var(--card); }
.list-item.active { background: var(--accent-soft); border-color: rgba(99, 102, 241, 0.35); }
.list-item .sub { font-size: 12px; }

.empty { color: var(--muted); text-align: center; padding: 34px 10px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1c1c2a; border: 1px solid var(--border); color: var(--text);
  padding: 10px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); z-index: 50;
}

a { color: #a5b4fc; }
.muted { color: var(--muted); }
.right { text-align: right; }

/* Bots — add-a-bot form + bot cards + webhook rows */
.botform { margin-top: 4px; }
.wh-list { display: flex; flex-direction: column; gap: 8px; }
.wh-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wh-row select { min-width: 130px; }
.btn.icon { padding: 6px 9px; line-height: 1; }

.botcard-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.botcard-head .mono { width: 38px; height: 38px; border-radius: 10px; font-size: 13px; }
.botcard-title { flex: 1; min-width: 0; }
.botcard-name { font-weight: 700; font-size: 15px; }
.botcard-actions { display: flex; gap: 6px; margin-left: auto; flex: none; }

.wh-item {
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-raised);
  padding: 10px 12px;
}
.wh-item.off { opacity: 0.55; }
.wh-main { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.wh-name { font-weight: 600; }
.wh-ago { margin-left: auto; font-size: 12px; }
.wh-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.wh-add {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border);
}
