:root {
  --bg:            #0a0b12;
  --bg-2:          #0f111b;
  --bg-soft:       #141623;
  --bg-card:       #181a2a;
  --bg-card-2:     #1d1f30;
  --bg-input:      #0f111c;
  --bg-hover:      #1f2238;
  --border:        #262a40;
  --border-2:      #323755;
  --border-focus:  #7c3aed;
  --text:          #edeefb;
  --text-soft:     #c9cbe1;
  --text-dim:      #8b8fae;
  --text-muted:    #60637f;
  --accent:        #7c3aed;
  --accent-2:      #a855f7;
  --accent-soft:   rgba(124, 58, 237, 0.14);
  --accent-ring:   rgba(124, 58, 237, 0.28);
  --danger:        #ef4444;
  --danger-soft:   rgba(239, 68, 68, 0.12);
  --success:       #22c55e;
  --success-soft:  rgba(34, 197, 94, 0.12);
  --warn:          #f59e0b;
  --warn-soft:     rgba(245, 158, 11, 0.12);
  --info:          #3b82f6;
  --info-soft:     rgba(59, 130, 246, 0.12);

  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     16px;
  --radius-xl:     22px;

  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow:        0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg:     0 24px 60px -20px rgba(0, 0, 0, 0.75);

  --sidebar-w:     260px;
  --topbar-h:      64px;

  --font-sans:     'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono:     ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-2); text-decoration: none; transition: color .15s ease; }
a:hover { color: #c4b5fd; text-decoration: none; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
p  { margin: 0 0 8px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  color: #c4b5fd;
}

/* ================================================
   LOGIN / AUTH SCREENS
   ================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 70% -10%, rgba(124,58,237,0.18), transparent 60%),
    radial-gradient(600px 400px at 10% 110%, rgba(168,85,247,0.12), transparent 60%),
    var(--bg);
}
.login-card {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 420px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
}
.login-card .brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.2px;
}
.login-card .brand-mark .logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 8px 24px -8px var(--accent);
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card p  { color: var(--text-dim); margin: 0 0 22px; font-size: 14px; }

/* ================================================
   LAYOUT
   ================================================ */
.layout {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 18px 14px 24px;
  z-index: 20;
}

.content {
  flex: 1 1 auto;
  min-width: 0; /* allow children to shrink, prevents horizontal overflow */
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 22px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar .brand .logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 6px 18px -6px var(--accent);
}
.sidebar .brand .title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--text);
}
.sidebar .brand .subtitle {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  margin-top: 2px;
}

.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
  border: 1px solid transparent;
}
.sidebar .nav-item:hover {
  background: var(--bg-card);
  color: var(--text-soft);
  text-decoration: none;
}
.sidebar .nav-item.active {
  background: var(--accent-soft);
  color: #e9d5ff;
  border-color: rgba(124, 58, 237, 0.25);
}
.sidebar .nav-item .ico {
  width: 18px; height: 18px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: currentColor;
  opacity: .85;
}
.sidebar .group-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  margin: 18px 10px 6px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 28px;
  background: rgba(10, 11, 18, 0.75);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar .tb-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-soft);
}
.topbar .user-chip .avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}

.page {
  padding: 26px 32px 60px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex: 1 1 auto;
  min-width: 0;
}

/* ================================================
   CARDS & FORMS
   ================================================ */
.card {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 24px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card > header,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.num,
.card h3 .num,
.card h2 .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: #d8b4fe;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(124, 58, 237, 0.28);
  margin-right: 12px;
  vertical-align: middle;
  line-height: 1;
}
.card h3,
.card h2 { gap: 0; }
.card .card-desc {
  color: var(--text-dim);
  font-size: 13px;
  margin: -6px 0 14px;
}
.card > footer,
.card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 16px;
  margin-top: 18px;
  border-top: 1px solid var(--border);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }

label.label {
  display: block;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: 0.15px;
}

.input,
select.input,
textarea.input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  -moz-appearance: textfield;
}

.input::placeholder { color: var(--text-muted); }

.input:hover:not(:disabled):not([readonly]) { border-color: var(--border-2); }
.input:focus,
select.input:focus,
textarea.input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-ring);
  background: var(--bg-soft);
}

/* Make number inputs readable — fix the value showing properly */
.input[type="number"] {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #fff;
  text-align: left;
  padding-right: 8px;
}
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: auto;
  opacity: 1;
  height: 26px;
  cursor: pointer;
  filter: invert(0.85);
}

/* Color input */
.input[type="color"] {
  padding: 4px;
  height: 42px;
  cursor: pointer;
}

/* File input */
.input[type="file"] {
  padding: 8px 10px;
  cursor: pointer;
}
.input[type="file"]::-webkit-file-upload-button,
.input[type="file"]::file-selector-button {
  background: var(--accent-soft);
  color: #d8b4fe;
  border: 1px solid rgba(124, 58, 237, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  margin-right: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}

select.input {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b8fae' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

textarea.input {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

.input-with-icon {
  position: relative;
}
.input-with-icon .input { padding-left: 38px; }
.input-with-icon .icon {
  position: absolute;
  left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
  line-height: 1.5;
}

/* Checkbox / switch */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px; flex: none;
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background .15s ease, border-color .15s ease;
}
.checkbox input[type="radio"] { border-radius: 50%; }
.checkbox input[type="checkbox"]:checked,
.checkbox input[type="radio"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox input[type="checkbox"]:checked::after {
  content: '';
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-0.5px, -0.5px);
}
.checkbox input[type="radio"]:checked::after {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fff;
}
.checkbox input[type="checkbox"]:focus-visible,
.checkbox input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* Toggle switch */
.switch {
  --w: 42px; --h: 24px;
  position: relative;
  display: inline-block;
  width: var(--w); height: var(--h);
  flex: none;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  transition: background .15s ease, border-color .15s ease;
  cursor: pointer;
}
.switch .slider::before {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.switch input:checked + .slider {
  background: var(--accent);
  border-color: var(--accent);
}
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--accent-ring); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}
.switch-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.switch-row .l { font-weight: 600; color: var(--text); font-size: 13.5px; }
.switch-row .d { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }

/* ================================================
   BUTTONS
   ================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: 0;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  transition: filter .15s ease, transform .05s ease, box-shadow .15s ease;
  box-shadow: 0 6px 18px -10px var(--accent);
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border-2);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text); filter: none; }

.btn-danger {
  background: linear-gradient(135deg, #dc2626, var(--danger));
  box-shadow: 0 6px 18px -10px var(--danger);
}
.btn-success {
  background: linear-gradient(135deg, #16a34a, var(--success));
  box-shadow: 0 6px 18px -10px var(--success);
}
.btn-warn {
  background: linear-gradient(135deg, #d97706, var(--warn));
  color: #1a0b00;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 7px;
  gap: 6px;
}
.btn-lg {
  padding: 13px 22px;
  font-size: 14.5px;
  border-radius: 10px;
}
.btn-block { width: 100%; }

.btn-group {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ================================================
   TABLES
   ================================================ */
.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
table th,
table td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}
table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}
table tbody tr { transition: background .12s ease; }
table tbody tr:hover td { background: rgba(255, 255, 255, 0.022); }
table tbody tr:last-child td { border-bottom: 0; }

/* Compact input inside table cells */
table .input {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 7px;
}
table .input[type="number"] { min-width: 72px; }

/* ================================================
   BADGES
   ================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: 1px solid transparent;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-pending  { background: var(--warn-soft);    color: var(--warn);    border-color: rgba(245,158,11,.25); }
.badge-paid     { background: var(--success-soft); color: var(--success); border-color: rgba(34,197,94,.25); }
.badge-rejected { background: var(--danger-soft);  color: var(--danger);  border-color: rgba(239,68,68,.25); }
.badge-info     { background: var(--info-soft);    color: var(--info);    border-color: rgba(59,130,246,.25); }
.badge-neutral  { background: var(--bg-input);     color: var(--text-dim); border-color: var(--border); }
.badge-neutral::before { background: var(--text-dim); }

/* ================================================
   FLASH MESSAGES
   ================================================ */
.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid;
}
.flash::before {
  content: '';
  width: 18px; height: 18px;
  flex: none;
  margin-top: 1px;
  background: currentColor;
  -webkit-mask: center/contain no-repeat;
          mask: center/contain no-repeat;
}
.flash-danger { background: var(--danger-soft); border-color: rgba(239,68,68,.28); color: #fecaca; }
.flash-danger::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
}
.flash-success { background: var(--success-soft); border-color: rgba(34,197,94,.28); color: #bbf7d0; }
.flash-success::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E");
}
.flash-info { background: var(--info-soft); border-color: rgba(59,130,246,.28); color: #bfdbfe; }
.flash-info::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
}

/* ================================================
   STATS
   ================================================ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-card-2));
  border: 1px solid var(--border);
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(400px 200px at 100% 0%, var(--accent-soft), transparent 60%);
  pointer-events: none;
  opacity: .5;
}
.stat .l {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat .v {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -0.02em;
  color: var(--text);
}
@media (max-width: 960px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .stat-row { grid-template-columns: 1fr; } }

/* ================================================
   MISC
   ================================================ */
.muted  { color: var(--text-dim); font-size: 13px; }
.empty  { padding: 40px 16px; text-align: center; color: var(--text-dim); }
.danger-zone {
  background: linear-gradient(180deg, rgba(239,68,68,0.06), rgba(239,68,68,0.02));
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.danger-zone h3 { color: #fecaca; }
.danger-zone h3 .num { background: var(--danger-soft); color: #fecaca; border-color: rgba(239,68,68,.35); }

.dash-summary summary { cursor: pointer; font-weight: 600; }

pre.codeblock {
  background: var(--bg-input);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: #c4b5fd;
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
}

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
}
.chip:hover { border-color: var(--border-2); text-decoration: none; color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: rgba(124,58,237,.35); color: #e9d5ff; }

.thumb {
  width: 48px; height: 30px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  flex: none;
}

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 18px 0;
}

/* ================================================
   THEME PICKER
   ================================================ */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 6px;
}
.theme-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
  position: relative;
}
.theme-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.theme-card input[type="radio"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.theme-card .swatch {
  height: 70px;
  border-radius: 9px;
  border: 1px solid var(--border);
}
.theme-card .name {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.theme-card .desc {
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.5;
}
.theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 16px 40px -20px var(--accent);
}
.theme-card .check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--border-2);
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.theme-card.active .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.theme-card.active .check::after { content: '✓'; font-size: 11px; font-weight: 700; }

/* ================================================
   SECRET / API KEY DISPLAY
   ================================================ */
.secret-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: middle;
}
.secret-status.set     { background: var(--success-soft); color: var(--success); border: 1px solid rgba(34,197,94,.3); }
.secret-status.not-set { background: var(--bg-input);     color: var(--text-dim); border: 1px solid var(--border); }

/* ================================================
   DASHBOARD PERIOD STATS + ACTIVITY
   ================================================ */
.period-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.period-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.period-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  font-weight: 800;
  margin-bottom: 12px;
}
.period-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-size: 13px;
}
.period-row .period-l { color: var(--text-dim); }
.period-row .period-v { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.activity-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.activity-kind {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  letter-spacing: 0.6px;
  font-weight: 800;
  background: var(--bg-card);
  color: var(--text-soft);
  border: 1px solid var(--border-2);
  white-space: nowrap;
}
.activity-kind.kind-purchase   { background: var(--success-soft); color: var(--success); border-color: rgba(34,197,94,.3); }
.activity-kind.kind-paid       { background: var(--success-soft); color: var(--success); border-color: rgba(34,197,94,.3); }
.activity-kind.kind-product    { background: var(--accent-soft);  color: #d8b4fe;        border-color: rgba(124,58,237,.3); }
.activity-kind.kind-attack     { background: var(--danger-soft);  color: var(--danger);  border-color: rgba(239,68,68,.3); }
.activity-kind.kind-security   { background: var(--warn-soft);    color: var(--warn);    border-color: rgba(245,158,11,.3); }
.activity-kind.kind-rejected   { background: var(--danger-soft);  color: var(--danger);  border-color: rgba(239,68,68,.3); }

@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Vouch image preview thumb */
.vouch-thumb {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-input);
}


/* ================================================
   MODAL
   ================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .15s ease;
}
.modal {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-card-2));
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 480px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  animation: popIn .18s ease;
}
.modal h2 { font-size: 18px; margin-bottom: 6px; }
.modal p { color: var(--text-dim); font-size: 13.5px; }
.modal .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }

/* ================================================
   MOBILE
   ================================================ */
.menu-toggle {
  display: none;
  width: 38px; height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-soft);
}

@media (max-width: 880px) {
  .layout { display: block; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    flex: none;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 50;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 40;
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .page { padding: 16px; }
}
