* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "DM Sans", -apple-system, "Segoe UI", sans-serif;
  background: #f4f6fb;
  color: #1c2333;
}

button {
  font-family: inherit;
  cursor: pointer;
}


.admin-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid #e4e8f2;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-logo-fresh {
  height: 22px;
  width: auto;
}

.admin-logo-bg {
  height: 26px;
  width: auto;
}

.admin-brand-text {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
}

.admin-tabs {
  display: flex;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

.admin-tab {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #5a6478;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.admin-tab:hover {
  background: #f0f3fa;
  color: #1c2333;
}

.admin-tab.is-current {
  background: #eef3ff;
  color: #1f5eff;
}

.admin-tab-badge {
  background: #e5484d;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-email {
  font-size: 13px;
  color: #5a6478;
}


.btn-primary,
.btn-ghost,
.btn-danger,
.btn-ok,
.btn-warn {
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border: 1px solid transparent;
  transition: background 0.15s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: #1f5eff;
  color: #fff;
}

.btn-primary:hover {
  background: #1a4fd6;
}

.btn-ghost {
  background: #fff;
  border-color: #d8deeb;
  color: #3c4457;
}

.btn-ghost:hover {
  background: #f0f3fa;
}

.btn-ok {
  background: #e7f6ec;
  color: #18794e;
  border-color: #b7e2c8;
}

.btn-ok:hover {
  background: #d5efdf;
}

.btn-warn {
  background: #fff4e5;
  color: #b25e09;
  border-color: #f5d5a8;
}

.btn-warn:hover {
  background: #ffe9cc;
}

.btn-danger {
  background: #fdecec;
  color: #c92a2a;
  border-color: #f5c2c2;
}

.btn-danger:hover {
  background: #fadcdc;
}

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


.admin-main {
  flex: 1;
  padding: 26px 28px 60px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.section-block {
  background: #fff;
  border: 1px solid #e4e8f2;
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 22px;
}

.section-block--pending {
  border-color: #f5d5a8;
  background: #fffdf7;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
  font-size: 17px;
}

.section-head p {
  margin: 3px 0 0;
  font-size: 13px;
  color: #7a8399;
  width: 100%;
}

.section-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-search {
  border: 1px solid #d8deeb;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  min-width: 220px;
}

.section-empty {
  color: #7a8399;
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
  margin: 0;
}


.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.admin-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a8399;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid #e4e8f2;
  white-space: nowrap;
}

.admin-table td {
  padding: 10px;
  border-bottom: 1px solid #f0f3fa;
  vertical-align: middle;
}

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

.admin-table tr.is-pending td {
  background: #fffdf3;
}

.col-actions {
  min-width: 260px;
}

.cell-email {
  font-weight: 600;
}

.cell-sub {
  display: block;
  font-size: 12px;
  color: #7a8399;
  font-weight: 400;
  margin-top: 2px;
}

.cell-muted {
  color: #9aa3b8;
}


.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge--pending {
  background: #fff4e5;
  color: #b25e09;
}

.badge--approved {
  background: #e7f6ec;
  color: #18794e;
}

.badge--rejected {
  background: #fdecec;
  color: #c92a2a;
}

.badge--disabled {
  background: #eef0f5;
  color: #6b7385;
}

.badge--admin {
  background: #eef3ff;
  color: #1f5eff;
}

.badge--state-done {
  background: #e7f6ec;
  color: #18794e;
}

.badge--state-error,
.badge--state-canceled {
  background: #fdecec;
  color: #c92a2a;
}

.badge--state-running {
  background: #eef3ff;
  color: #1f5eff;
}

.badge--state-queued {
  background: #fff4e5;
  color: #b25e09;
}


.cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pending-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #f0e2c4;
  background: #fff;
  border-radius: 12px;
  padding: 13px 16px;
  flex-wrap: wrap;
}

.pending-card-email {
  font-weight: 600;
  font-size: 14.5px;
}

.pending-card-meta {
  font-size: 12.5px;
  color: #7a8399;
  margin-top: 2px;
}


.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  border: 1px solid #e4e8f2;
  border-radius: 12px;
  padding: 14px 16px;
}

.stat-card-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card-label {
  font-size: 12.5px;
  color: #7a8399;
  margin-top: 4px;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.service-card {
  border: 1px solid #e4e8f2;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.service-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.service-card-name {
  font-weight: 700;
  font-size: 14.5px;
}

.service-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.service-dot--on {
  background: #2f9e63;
  box-shadow: 0 0 0 3px rgba(47, 158, 99, 0.18);
}

.service-dot--off {
  background: #c92a2a;
  box-shadow: 0 0 0 3px rgba(201, 42, 42, 0.15);
}

.service-card-meta {
  font-size: 12.5px;
  color: #7a8399;
}


.bg-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.bg-thumb {
  border: 1px solid #e4e8f2;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafd;
}

.bg-thumb img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

.bg-thumb-name {
  font-size: 12px;
  padding: 7px 9px;
  font-weight: 500;
  word-break: break-all;
}


.fb-card {
  border: 1px solid #e4e8f2;
  border-radius: 12px;
  padding: 14px 16px;
}

.fb-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.fb-stars {
  color: #f0a020;
  letter-spacing: 2px;
  font-size: 14px;
}

.fb-stars--empty {
  color: #c6cddc;
}

.fb-card-comment {
  font-size: 14px;
  margin: 6px 0;
  white-space: pre-wrap;
}

.fb-card-meta {
  font-size: 12.5px;
  color: #7a8399;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.fb-job-link {
  color: #1f5eff;
  text-decoration: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.fb-job-link:hover {
  text-decoration: underline;
}


.admin-denied {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-denied-card {
  text-align: center;
  background: #fff;
  border: 1px solid #e4e8f2;
  border-radius: 18px;
  padding: 44px 52px;
}

.admin-denied-logo {
  height: 26px;
  margin-bottom: 18px;
}

.admin-denied-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.admin-denied-card p {
  margin: 0 0 22px;
  color: #7a8399;
}


.admin-toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c2333;
  color: #fff;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(10, 20, 50, 0.25);
  z-index: 100;
  max-width: 90vw;
}

.admin-toast--error {
  background: #c92a2a;
}

@media (max-width: 860px) {
  .admin-header {
    gap: 12px;
    padding: 12px 16px;
  }

  .admin-main {
    padding: 18px 14px 50px;
  }

  .col-actions {
    min-width: 200px;
  }
}

.admin-table th.col-num,
.admin-table td.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.downloads-extra {
  margin: 10px 0 0;
  font-size: 13px;
  color: #7a8399;
}

.fb-source {
  display: inline-flex;
  gap: 6px;
}

.fb-source .btn-ghost.is-current {
  background: #eef3ff;
  color: #1f5eff;
}

:root {
  --ch-1: #2a78d6;
  --ch-2: #eb6834;
  --ch-text: #1c2333;
  --ch-muted: #7a8399;
  --ch-grid: #e4e8f2;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ch-1: #3987e5;
    --ch-2: #d95926;
  }
}

.q-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.q-chip { background: #eef2fb; border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 600; }
.q-note { font-size: 12.5px; color: var(--ch-muted); }
.q-running { border: 1px solid #e4e8f2; border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; }
.q-running-msg, .q-running-time { font-size: 13px; color: var(--ch-muted); margin-top: 4px; }
.q-bar { height: 8px; border-radius: 4px; background: #e4e8f2; overflow: hidden; margin-top: 8px; }
.q-bar i { display: block; height: 100%; background: var(--ch-1); }
.q-warn { color: #8a4b00; background: #fff3d6; border-radius: 6px; padding: 2px 6px; font-weight: 600; }
.qh-error { color: #b3261e; font-size: 13px; }
.seg { display: inline-flex; gap: 4px; }
.seg .btn-ghost.is-current { background: #e4ecfb; font-weight: 600; }
#qh-tiles { margin-bottom: 16px; }
.ch-grid-wrap { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .ch-grid-wrap { grid-template-columns: 1fr 1fr; } }
.ch-card { border: 1px solid #e4e8f2; border-radius: 12px; padding: 12px 14px; min-width: 0; }
.ch-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ch-head h3 { margin: 0; font-size: 14px; }
.ch-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ch-text); margin: 6px 0; }
.ch-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.ch-body { position: relative; }
.ch-svg { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--ch-grid); stroke-width: 1; }
.ch-ref { stroke: var(--ch-muted); stroke-width: 1; stroke-dasharray: 4 3; opacity: .5; }
.ch-axis, .ch-label { fill: var(--ch-muted); font-size: 11px; }
.ch-label { fill: var(--ch-text); }
.ch-cross { stroke: var(--ch-muted); stroke-width: 1; }
.ch-tip { position: absolute; top: 0; transform: translateX(-50%); background: #1c2333; color: #fff; font-size: 12px; padding: 6px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; z-index: 2; }
.ch-table { margin-top: 8px; max-height: 260px; overflow: auto; }
.ub-list { margin-top: 8px; }
.ub-row { display: grid; grid-template-columns: minmax(80px, 1.2fr) 2fr auto; gap: 8px; align-items: center; font-size: 12.5px; padding: 3px 0; }
.ub-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ch-text); }
.ub-track { height: 8px; background: transparent; }
.ub-track i { display: block; height: 100%; background: var(--ch-1); border-radius: 0 4px 4px 0; }
.ub-val { color: var(--ch-text); white-space: nowrap; }
