:root {
  --bg: #070b14;
  --bg-soft: #0b1220;
  --panel: rgba(17, 26, 43, 0.82);
  --panel-strong: #101a2c;
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #e8eef9;
  --muted: #8b9ab3;
  --muted-2: #64748b;
  --accent: #7c8cff;
  --accent-2: #22d3ee;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --radius: 18px;
  --font: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Cascadia Code', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 88% -12%, rgba(99, 102, 241, 0.2), transparent 62%),
    radial-gradient(900px 520px at 2% 112%, rgba(34, 211, 238, 0.12), transparent 62%),
    radial-gradient(800px 500px at 50% 50%, rgba(15, 23, 42, 0.28), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

h1, h2, h3, h4, p {
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: #a5b4fc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid rgba(124, 140, 255, 0.75);
  outline-offset: 2px;
}

::selection {
  background: rgba(124, 140, 255, 0.35);
  color: #fff;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

[data-icon] svg {
  width: 18px;
  height: 18px;
}

svg {
  flex-shrink: 0;
}

.screen.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
}

.card {
  background: linear-gradient(180deg, rgba(18, 27, 46, 0.88), rgba(10, 16, 29, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -34px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* ============ Topbar ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7, 11, 20, 0.78);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 13px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #818cf8 0%, #22d3ee 100%);
  color: #061018;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -1px;
  box-shadow: 0 10px 26px -10px rgba(99, 102, 241, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  position: relative;
  overflow: hidden;
}

.brand-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.35), transparent 46%);
  pointer-events: none;
}

.brand-mark-lg {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  font-size: 31px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-name {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.brand-sub {
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2.1px;
  margin-top: 2px;
}

.topbar-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.72);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.1);
  transition: background 0.2s ease;
}

.live-pill.is-online .live-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.11);
  animation: pulse 2.4s infinite;
}

.live-pill.is-offline .live-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.11);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
  max-width: 210px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
}

.user-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip svg {
  width: 15px;
  height: 15px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.05);
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.icon-btn:hover {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.11);
  border-color: var(--border-strong);
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn.danger:hover {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

/* ============ Layout ============ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: 27px;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.page-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.collection-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.55);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 11.5px;
  font-family: var(--mono);
  direction: ltr;
}

.collection-pill svg {
  width: 15px;
  height: 15px;
  color: var(--accent-2);
}

/* ============ Stats ============ */
.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.stat:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid transparent;
}

.stat-icon svg {
  width: 19px;
  height: 19px;
}

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.stat-value {
  font-size: 23px;
  line-height: 1.25;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.tone-indigo {
  background: rgba(124, 140, 255, 0.11);
  border-color: rgba(124, 140, 255, 0.2);
  color: #a5b4fc;
}

.tone-green {
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.2);
  color: #6ee7b7;
}

.tone-slate {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.16);
  color: #94a3b8;
}

.tone-red {
  background: rgba(248, 113, 113, 0.09);
  border-color: rgba(248, 113, 113, 0.2);
  color: #fca5a5;
}

.tone-amber {
  background: rgba(251, 191, 36, 0.09);
  border-color: rgba(251, 191, 36, 0.2);
  color: #fcd34d;
}

.tone-cyan {
  background: rgba(34, 211, 238, 0.09);
  border-color: rgba(34, 211, 238, 0.2);
  color: #67e8f9;
}

/* ============ Cards ============ */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.head-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid transparent;
}

.head-icon svg {
  width: 17px;
  height: 17px;
}

.card-title h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.5;
}

.card-title p {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
  line-height: 1.7;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(148, 163, 184, 0.05);
  white-space: nowrap;
}

.mini-tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 7px var(--accent-2);
}

.create-card {
  margin-bottom: 20px;
}

/* ============ Forms ============ */
.create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(140px, 0.75fr) minmax(170px, 0.9fr) auto;
  align-items: end;
  gap: 14px;
  padding: 20px 22px 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(5, 10, 20, 0.58);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.field input::placeholder {
  color: var(--muted-2);
}

.field input:hover {
  border-color: var(--border-strong);
}

.field input:focus {
  border-color: rgba(124, 140, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.1);
  background: rgba(5, 10, 20, 0.8);
}

.field input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.field input.invalid {
  border-color: rgba(248, 113, 113, 0.65) !important;
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.08) !important;
}

.code-input {
  direction: ltr;
  text-align: left;
  font-family: var(--mono);
  font-size: 13.5px !important;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap input {
  padding-left: 46px;
}

.input-btn {
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.input-btn:hover {
  color: #c7d2fe;
  background: rgba(124, 140, 255, 0.14);
  border-color: rgba(124, 140, 255, 0.35);
}

.input-btn.is-active {
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.14);
  border-color: rgba(34, 211, 238, 0.4);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.07);
}

.input-btn svg {
  width: 15px;
  height: 15px;
}

.input-btn.infinity {
  font-family: var(--font);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  padding-bottom: 2px;
}

.field-submit .btn {
  height: 44px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
  text-decoration: none;
  user-select: none;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: linear-gradient(135deg, #818cf8 0%, #22d3ee 100%);
  color: #071019;
  font-weight: 800;
  box-shadow: 0 12px 28px -14px rgba(99, 102, 241, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 14px 32px -14px rgba(99, 102, 241, 1), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 12px 28px -16px rgba(239, 68, 68, 0.9);
}

.btn-outline,
.btn-ghost {
  background: rgba(148, 163, 184, 0.06);
  border-color: var(--border);
  color: var(--muted);
}

.btn-outline:hover,
.btn-ghost:hover {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-xs {
  padding: 6px 9px;
  font-size: 10.5px;
  border-radius: 8px;
  gap: 5px;
}

.btn-xs svg {
  width: 12px;
  height: 12px;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 11px;
  border-radius: 9px;
}

.btn-success-soft {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}

.btn-success-soft:hover {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.4);
}

.btn-warn-soft {
  background: rgba(251, 191, 36, 0.07);
  border-color: rgba(251, 191, 36, 0.22);
  color: #fcd34d;
}

.btn-warn-soft:hover {
  background: rgba(251, 191, 36, 0.13);
  border-color: rgba(251, 191, 36, 0.38);
}

.btn-block {
  width: 100%;
}

.form-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 22px 18px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.8;
}

.form-note svg {
  width: 14px;
  height: 14px;
  margin-top: 3px;
  color: var(--accent);
}

.form-note p {
  max-width: 900px;
}

/* ============ Table ============ */
.table-head {
  align-items: center;
}

.count-badge {
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(124, 140, 255, 0.11);
  border: 1px solid rgba(124, 140, 255, 0.2);
  color: #a5b4fc;
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.search-box {
  position: relative;
  width: 290px;
  max-width: 100%;
}

.search-box [data-icon] {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(5, 10, 20, 0.55);
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-box input::placeholder {
  color: var(--muted-2);
}

.search-box input:focus {
  border-color: rgba(124, 140, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.08);
}

.search-box svg {
  width: 16px;
  height: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.055);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  background: rgba(148, 163, 184, 0.11);
  color: var(--text);
}

.chip.is-active {
  background: rgba(124, 140, 255, 0.13);
  border-color: rgba(124, 140, 255, 0.34);
  color: #c7d2fe;
}

.chip-count {
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.11);
  font-size: 9.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.chip.is-active .chip-count {
  background: rgba(124, 140, 255, 0.2);
  color: #dbe3ff;
}

.table-hint {
  color: var(--muted-2);
  font-size: 10.5px;
  white-space: nowrap;
}

.table-mobile-hint {
  display: none;
  padding: 10px 18px 0;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.7;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--radius) var(--radius);
}

.codes-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  text-align: start;
}

.codes-table th {
  padding: 11px 14px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted-2);
  text-align: start;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: rgba(7, 12, 22, 0.35);
}

.codes-table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.065);
  font-size: 12px;
  color: #cbd5e1;
  vertical-align: middle;
}

.codes-table tbody tr {
  transition: background 0.14s ease;
}

.codes-table tbody tr:hover {
  background: rgba(124, 140, 255, 0.035);
}

.codes-table tbody tr:last-child td {
  border-bottom: none;
}

.muted {
  color: var(--muted-2);
}

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid rgba(124, 140, 255, 0.18);
  background: rgba(124, 140, 255, 0.075);
  color: #c7d2fe;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  direction: ltr;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.code-chip:hover {
  background: rgba(124, 140, 255, 0.14);
  border-color: rgba(124, 140, 255, 0.36);
}

.code-chip svg {
  width: 12px;
  height: 12px;
  opacity: 0.55;
}

.code-chip:hover svg {
  opacity: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
}

.badge.st-active {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.09);
  border-color: rgba(52, 211, 153, 0.22);
}

.badge.st-inactive {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.075);
  border-color: rgba(148, 163, 184, 0.17);
}

.badge.st-blocked {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.09);
  border-color: rgba(248, 113, 113, 0.23);
}

.badge.st-expired {
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
}

.pill-soft {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid rgba(148, 163, 184, 0.11);
  font-size: 10.5px;
  color: #b6c2d6;
  white-space: nowrap;
}

.unlimited {
  color: #67e8f9;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.device-count {
  color: #b6c2d6;
  font-size: 11px;
  white-space: nowrap;
}

.hwid-chip {
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 7px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  background: rgba(148, 163, 184, 0.06);
  color: #a8b7cc;
  font-family: var(--mono);
  font-size: 10px;
  direction: ltr;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.hwid-chip:hover {
  background: rgba(148, 163, 184, 0.11);
  border-color: rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
}

.date-text {
  font-size: 10.5px;
  color: #b6c2d6;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.date-extra {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  color: var(--muted-2);
  white-space: nowrap;
}

.date-extra.is-warn {
  color: #fcd34d;
}

.date-extra.is-danger {
  color: #fca5a5;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.row-actions .icon-btn {
  width: 29px;
  height: 29px;
  border-radius: 8px;
}

.row-actions .icon-btn svg {
  width: 13px;
  height: 13px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 20px 58px;
  text-align: center;
}

.empty-state svg {
  width: 42px;
  height: 42px;
  color: var(--muted-2);
  opacity: 0.6;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 14px;
  font-weight: 700;
  color: #cbd5e1;
}

.empty-state p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11.5px;
  max-width: 360px;
  line-height: 1.8;
}

.empty-state .btn {
  margin-top: 15px;
}

.empty-state.is-error svg {
  color: #fca5a5;
  opacity: 0.8;
}

/* ============ Footer ============ */
.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 28px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.2px;
}

.footer-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted-2);
}

/* ============ Boot / Auth / Setup ============ */
.boot-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.boot-box p {
  color: var(--muted);
  font-size: 12.5px;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid rgba(148, 163, 184, 0.16);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.auth-card {
  width: 100%;
  max-width: 410px;
  padding: 32px 30px 26px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: -70px;
  right: 50%;
  transform: translateX(50%);
  width: 250px;
  height: 160px;
  background: radial-gradient(circle, rgba(124, 140, 255, 0.16), transparent 70%);
  pointer-events: none;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
  position: relative;
}

.auth-brand .brand-name {
  font-size: 20px;
  letter-spacing: 2px;
}

.auth-brand .brand-sub {
  letter-spacing: 3px;
}

.auth-title {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
  position: relative;
}

.auth-sub {
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.8;
  margin-bottom: 24px;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-ltr {
  direction: ltr;
  text-align: left;
  font-family: var(--mono);
  font-size: 12.5px !important;
}

.auth-card .field input {
  height: 44px;
}

.auth-card .btn-primary {
  height: 45px;
  margin-top: 2px;
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px;
  align-self: center;
  transition: color 0.15s ease;
}

.link-btn:hover {
  color: #c7d2fe;
}

.auth-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted-2);
  font-size: 9.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.auth-foot svg {
  width: 12px;
  height: 12px;
}

.form-alert {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 11px;
  line-height: 1.8;
}

/* ============ Modal ============ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 7, 15, 0.72);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #121c30, #0c1423);
  box-shadow: 0 32px 90px -30px rgba(0, 0, 0, 0.95);
  transform: translateY(8px) scale(0.985);
  transition: transform 0.18s ease;
}

.overlay.open .modal {
  transform: none;
}

.modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(248, 113, 113, 0.09);
  border: 1px solid rgba(248, 113, 113, 0.22);
  color: #fca5a5;
  margin-bottom: 14px;
}

.modal-icon svg {
  width: 19px;
  height: 19px;
}

.modal-icon.is-neutral {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.2);
  color: #67e8f9;
}

.modal h3 {
  font-size: 16.5px;
  font-weight: 800;
  margin-bottom: 7px;
}

.modal-message {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.9;
}

.modal-message .code-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  direction: ltr;
  color: #c7d2fe;
  background: rgba(124, 140, 255, 0.09);
  border: 1px solid rgba(124, 140, 255, 0.2);
  border-radius: 5px;
  padding: 1px 6px;
  margin: 0 2px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

/* ============ Toasts ============ */
.toasts {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: rgba(15, 24, 40, 0.96);
  box-shadow: 0 18px 45px -20px rgba(0, 0, 0, 0.9);
  color: #dbe4f3;
  font-size: 11.5px;
  line-height: 1.75;
  pointer-events: auto;
  animation: toast-in 0.24s ease both;
  backdrop-filter: blur(12px);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-icon {
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-top: 1px;
}

.toast-icon svg {
  width: 17px;
  height: 17px;
}

.toast-message {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.toast-close {
  border: none;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 1px;
  flex: none;
}

.toast-close:hover {
  color: var(--text);
}

.toast-success {
  border-color: rgba(52, 211, 153, 0.25);
}

.toast-success .toast-icon {
  color: #6ee7b7;
}

.toast-error {
  border-color: rgba(248, 113, 113, 0.3);
}

.toast-error .toast-icon {
  color: #fca5a5;
}

.toast-info .toast-icon {
  color: #93c5fd;
}

/* ============ Animations ============ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.11); }
  50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0.03); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ Responsive ============ */
@media (max-width: 1120px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .create-form {
    grid-template-columns: minmax(200px, 1.4fr) minmax(140px, 0.8fr) minmax(170px, 0.9fr);
  }

  .field-submit {
    grid-column: 1 / -1;
  }

  .field-submit .btn {
    width: 100%;
  }
}

@media (max-width: 860px) {
  .container {
    padding: 22px 16px 44px;
  }

  .topbar-inner {
    padding: 12px 16px;
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat {
    padding: 13px;
    gap: 10px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-icon {
    width: 37px;
    height: 37px;
  }

  .card-head {
    padding: 16px 18px;
  }

  .create-form {
    grid-template-columns: 1fr 1fr;
    padding: 18px 18px 8px;
  }

  .field-code {
    grid-column: 1 / -1;
  }

  .field-submit {
    grid-column: 1 / -1;
  }

  .form-note {
    padding: 2px 18px 16px;
  }

  .toolbar {
    padding: 12px 18px;
  }

  .table-hint {
    display: none;
  }

  .table-mobile-hint {
    display: block;
  }

  .search-box {
    width: 100%;
  }

  .table-head .search-box {
    margin-top: 2px;
  }

  .footer {
    padding: 0 16px 24px;
  }
}

@media (max-width: 620px) {
  .brand-sub,
  .user-chip {
    display: none;
  }

  .live-pill {
    padding: 6px 9px;
  }

  .live-pill #liveText {
    display: none;
  }

  .topbar-inner {
    gap: 10px;
  }

  .page-head {
    margin-bottom: 18px;
  }

  .page-head h1 {
    font-size: 22px;
  }

  .page-head p {
    font-size: 11.5px;
  }

  .collection-pill {
    display: none;
  }

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

  .stat {
    padding: 12px;
  }

  .stat-label {
    font-size: 10px;
  }

  .stat-value {
    font-size: 19px;
  }

  .stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .stat-icon svg {
    width: 16px;
    height: 16px;
  }

  .create-form {
    grid-template-columns: 1fr;
  }

  .field-code,
  .field-submit {
    grid-column: auto;
  }

  .card-title h2 {
    font-size: 14px;
  }

  .card-title p {
    font-size: 10.5px;
  }

  .mini-tag {
    display: none;
  }

  .chips {
    gap: 4px;
  }

  .chip {
    padding: 5px 8px;
    font-size: 10px;
  }

  .chip-count {
    min-width: 16px;
    height: 15px;
    font-size: 9px;
  }

  .auth-card {
    padding: 26px 20px 22px;
  }

  .modal {
    padding: 20px;
  }

  .toasts {
    left: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
