:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', "SF Mono", Consolas, Monaco, monospace;

  --bg: #07070d;
  --bg-alt: #0f1019;
  --card-bg: #12131f;
  --border: #23253a;
  --text: #f2f3f8;
  --muted: #9a9db3;
  --muted-2: #6d7089;

  --accent: #818cf8;
  --accent-2: #c4b5fd;
  --accent-hover: #a5b0fb;
  --accent-soft: #191c33;
  --accent-ring: rgba(129, 140, 248, 0.22);

  --green: #34d399;
  --green-bg: #0f2a20;
  --red: #f87171;
  --red-bg: #2c1414;
  --orange: #fbbf24;
  --orange-bg: #33220f;
  --gray: #9a9db3;
  --gray-bg: #1a1c28;

  --success: var(--green);
  --success-bg: var(--green-bg);
  --error: var(--red);
  --error-bg: var(--red-bg);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

/* ---------- Icons ---------- */
.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.icon-sm {
  width: 14px;
  height: 14px;
}

.icon-lg {
  width: 22px;
  height: 22px;
}

button.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
}

code {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 55;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 20px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.sidebar-brand:hover {
  text-decoration: none;
}

/* Plain icon, no background badge — the icon itself carries a looping
   scan-line sweep so the brand mark reads as an actual live scanner. */
.sidebar-brand .brand-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  overflow: hidden;
  color: var(--text);
  flex-shrink: 0;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-mark-scanline {
  position: absolute;
  left: 6%;
  right: 6%;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.9), 0 0 10px rgba(34, 211, 238, 0.55);
  animation: brand-scan-sweep 2.2s ease-in-out infinite;
}

@keyframes brand-scan-sweep {
  0% { top: 8%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 86%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark-scanline { animation: none; opacity: 0.75; top: 46%; }
}

.sidebar-brand em {
  display: block;
  font-style: normal;
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
  background: var(--bg-alt);
  color: var(--text);
  text-decoration: none;
}

.sidebar-nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
}

.sidebar-logout {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sidebar-logout button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-logout button:hover {
  border-color: var(--red);
  color: var(--red);
  background: none;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.sidebar-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  margin: 0 auto;
  background: var(--text);
  border-radius: 2px;
}

.sidebar-backdrop {
  display: none;
}

/* ---------- Main content ---------- */
main {
  flex: 1;
  min-width: 0;
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 32px 64px;
  width: 100%;
}

h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 22px;
}

h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.muted {
  color: var(--muted);
  font-size: 0.87rem;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card p {
  margin: 8px 0;
}

.card h2 {
  margin-bottom: 4px;
}

.card > p.muted:first-of-type {
  margin-top: 0;
}

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
}

.stat-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.icon-indigo { background: var(--accent-soft); color: var(--accent); }
.icon-green { background: var(--green-bg); color: var(--green); }
.icon-orange { background: var(--orange-bg); color: var(--orange); }
.icon-red { background: var(--red-bg); color: var(--red); }
.icon-gray { background: var(--gray-bg); color: var(--gray); }

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ---------- Quick actions ---------- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  color: var(--text);
}

.quick-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  text-decoration: none;
}

.quick-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
}

.quick-action-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.quick-action-sub {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 1px;
}

/* ---------- Section heading ---------- */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 36px 0 16px;
}

.section-title h2 {
  font-size: 1.15rem;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
}

.card table {
  border: none;
  box-shadow: none;
  border-radius: 0;
  margin: 12px -24px -22px;
  width: calc(100% + 48px);
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  white-space: nowrap;
}

td:last-child, th:last-child {
  white-space: normal;
}

th {
  background: var(--bg-alt);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background: var(--bg-alt);
}

tr:last-child td {
  border-bottom: none;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-success { background: var(--green-bg); color: var(--green); }
.badge-error { background: var(--red-bg); color: var(--red); }
.badge-warning { background: var(--orange-bg); color: var(--orange); }
.badge-neutral { background: var(--gray-bg); color: var(--gray); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- Forms ---------- */
input, select, button, textarea {
  font-size: 0.92rem;
  font-family: inherit;
}

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input[type="text"]:hover, input[type="password"]:hover, input[type="number"]:hover,
select:hover, textarea:hover {
  border-color: var(--muted-2);
}

input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus,
select:focus, textarea:focus {
  outline: none;
  background: var(--card-bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

input::placeholder, textarea::placeholder {
  color: var(--muted-2);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%239a9db3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px;
  cursor: pointer;
}

textarea {
  max-width: 100%;
  resize: vertical;
  line-height: 1.5;
}

/* Every stacked-field form (Add Plan, Add Account, Broadcast, Settings) uses
   this: a responsive multi-column grid instead of one cramped narrow column,
   with the submit row spanning full width and set off by a divider. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px 20px;
  align-items: start;
  margin-top: 4px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--muted);
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.form-grid h2 {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* Compact single-line forms: a select/input next to a button, e.g. Grant
   Plan or the Users search bar — deliberately not the grid layout above. */
.search-form {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  max-width: 420px;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form select, .inline-form input {
  width: auto;
  min-width: 160px;
}

/* The per-row plan editor that expands inside a table */
.inline-edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  background: var(--bg-alt);
  border-radius: 10px;
  padding: 16px;
  margin: 8px 0;
}

.inline-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted);
}

.inline-edit-form input,
.inline-edit-form select {
  width: auto;
  font-weight: normal;
  color: var(--text);
  background: var(--card-bg);
}

/* ---------- Buttons ---------- */
button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background: none;
  color: var(--muted);
  border: 1.5px solid var(--border);
  box-shadow: none;
  padding: 9.5px 16.5px;
}

button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: none;
  transform: none;
  box-shadow: none;
}

/* Redeclared after .secondary so equal-specificity source order doesn't let
   its wider padding win over the square icon-only sizing. */
button.icon-btn, button.secondary.icon-btn {
  padding: 0;
}

.search-form button {
  flex-shrink: 0;
}

/* ---------- Filter tabs (checker accounts: Active/Used/Error/Inactive) ---------- */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-tab:hover {
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}

.filter-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.filter-tab .count {
  opacity: 0.7;
  font-weight: 500;
}

/* Result of a "Get Code" fetch — deliberately loud (this is the whole point
   of clicking the button) with a large monospace code the admin can read at
   a glance, plus the full raw message underneath since not every Telegram
   code message uses the same format. */
.code-result {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.code-result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.code-result-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.code-result-value {
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  word-break: break-all;
}

.code-result-message {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: pre-wrap;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

button.danger {
  background: linear-gradient(135deg, var(--red), #b91c1c);
}

/* ---------- Page header ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head h1 {
  margin-bottom: 6px;
}

.page-head > button {
  flex-shrink: 0;
}

/* ---------- Modals ---------- */
dialog.modal {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(560px, calc(100vw - 40px));
  max-height: min(680px, calc(100vh - 40px));
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

dialog.modal.modal-sm {
  width: min(420px, calc(100vw - 40px));
}

dialog.modal::backdrop {
  background: rgba(10, 11, 20, 0.55);
  backdrop-filter: blur(2px);
}

dialog.modal[open] {
  animation: modal-in 0.16s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-form {
  padding: 26px 28px 28px;
  margin: 0;
}

.modal-form h2 {
  margin-bottom: 18px;
  font-size: 1.15rem;
}

.modal-form p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0 0 20px;
}

/* ---------- Alerts ---------- */
.success {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--success-bg);
  color: var(--success);
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-weight: 600;
  font-size: 0.9rem;
}

.error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--error-bg);
  color: var(--error);
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.login-glow {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 640px;
  background:
    radial-gradient(520px circle at 25% 20%, rgba(129, 140, 248, 0.28), transparent 62%),
    radial-gradient(420px circle at 80% 10%, rgba(196, 181, 253, 0.2), transparent 60%);
  filter: blur(10px);
  pointer-events: none;
}

.login-box {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px;
  width: 340px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  margin-bottom: 26px;
}

.login-brand .brand-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  color: var(--text);
  flex-shrink: 0;
}

.login-brand em {
  display: block;
  font-style: normal;
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.login-box h1 {
  font-size: 1.15rem;
  margin: 0 0 18px;
}

.login-box label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}

.login-box input {
  width: 100%;
  font-weight: normal;
  color: var(--text);
}

.login-box button {
  width: 100%;
  margin-top: 8px;
}

/* ---------- Background grid + TeleScan loader ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(129, 140, 248, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 140, 248, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(900px circle at 20% 0%, #000, transparent 72%);
  -webkit-mask-image: radial-gradient(900px circle at 20% 0%, #000, transparent 72%);
}

.tele-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  background: radial-gradient(circle at 50% 38%, #1c1550 0%, #0a0714 55%, #030207 100%);
  transition: opacity 0.42s ease, visibility 0.42s ease;
}

.tele-loader::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(129, 140, 248, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 140, 248, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle, #000, transparent 72%);
  -webkit-mask-image: radial-gradient(circle, #000, transparent 72%);
}

.tele-loader.is-finished {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.tele-loader-orbit {
  width: 168px;
  height: 168px;
  position: relative;
  filter: drop-shadow(0 0 28px rgba(99, 102, 241, 0.55));
}

.tele-loader-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
}

.tele-loader-ring--outer {
  inset: 0;
  border-top-color: #818cf8;
  border-right-color: #c4b5fd;
  border-bottom-color: rgba(129, 140, 248, 0.15);
  border-left-color: rgba(129, 140, 248, 0.15);
  animation: tele-spin 2.2s linear infinite;
}

.tele-loader-ring--inner {
  inset: 20px;
  border-top-color: #22d3ee;
  border-right-color: rgba(34, 211, 238, 0.15);
  border-bottom-color: rgba(34, 211, 238, 0.15);
  border-left-color: #22d3ee;
  animation: tele-spin-reverse 1.6s linear infinite;
}

.tele-loader-core {
  position: absolute;
  inset: 52px;
  border-radius: 20px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.55), inset 0 0 16px rgba(255, 255, 255, 0.15);
  animation: tele-pulse 1.4s ease-in-out infinite;
}

.tele-loader-scanline {
  position: absolute;
  left: 14%;
  right: 14%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.85), 0 0 16px rgba(34, 211, 238, 0.7);
  animation: tele-scan-sweep 1.8s ease-in-out infinite;
}

@keyframes tele-scan-sweep {
  0% { top: 18%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 78%; opacity: 0; }
}

.tele-loader-core svg {
  width: 42%;
  height: 42%;
  color: #fff;
}

.tele-loader-node {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 12px #a78bfa;
  animation: tele-node-pulse 1.3s ease-in-out infinite;
}

.tele-loader-node--one { top: 8px; left: 16px; }
.tele-loader-node--two { top: 58px; right: -4px; animation-delay: 0.3s; }
.tele-loader-node--three { bottom: 4px; left: 38px; animation-delay: 0.6s; }

.tele-loader-label {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: #e4e4ff;
  text-transform: uppercase;
  margin: 0;
}

.tele-loader-dots i {
  font-style: normal;
  opacity: 0.2;
  animation: tele-dot-step 1.2s infinite;
}

.tele-loader-dots i:nth-child(2) { animation-delay: 0.2s; }
.tele-loader-dots i:nth-child(3) { animation-delay: 0.4s; }

.tele-loader-track {
  width: min(220px, 60vw);
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  position: relative;
}

.tele-loader-track span {
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #818cf8, #fff, #22d3ee, transparent);
  box-shadow: 0 0 14px rgba(129, 140, 248, 0.8);
  animation: tele-progress 1.3s ease-in-out infinite;
}

@keyframes tele-spin { to { transform: rotate(360deg); } }
@keyframes tele-spin-reverse { to { transform: rotate(-360deg); } }
@keyframes tele-pulse {
  50% { transform: scale(0.9); box-shadow: 0 0 18px rgba(124, 58, 237, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.1); }
}
@keyframes tele-node-pulse { 50% { opacity: 0.35; transform: scale(0.6); } }
@keyframes tele-dot-step {
  0%, 60%, 100% { opacity: 0.2; }
  30% { opacity: 1; }
}
@keyframes tele-progress {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(360%); }
}

@media (prefers-reduced-motion: reduce) {
  .tele-loader-ring, .tele-loader-core, .tele-loader-node, .tele-loader-dots i, .tele-loader-track span, .tele-loader-scanline {
    animation: none;
  }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 54;
  }

  .sidebar-backdrop.is-open {
    display: block;
  }

  main {
    padding: 78px 18px 44px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  main {
    padding: 78px 14px 40px;
  }

  .card {
    padding: 18px;
  }

  .card table {
    margin: 12px -18px -18px;
    width: calc(100% + 36px);
  }
}
