.admin-body {
  background:
    radial-gradient(circle at top right, rgba(15, 23, 42, 0.035), transparent 34%),
    #fafafa;
  min-height: 100vh;
}

.admin-shell {
  display: grid;
  grid-template-columns: 272px 1fr;
  min-height: 100vh;
}
@media (max-width: 960px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .admin-nav {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  .admin-nav a {
    white-space: nowrap;
    margin-bottom: 0;
  }
  .admin-sidebar .logout-wrap { display: none; }
}

.admin-sidebar {
  background: #000;
  color: #fff;
  padding: 1.35rem 1rem 1.25rem;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.admin-sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.85rem 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1rem;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}
.admin-sidebar .brand-logo {
  width: auto;
  height: 1.65rem;
  max-width: 7.5rem;
  object-fit: contain;
  flex: 0 0 auto;
}
.admin-sidebar .brand.has-logo .brand-text {
  font-size: 0.95rem;
}
.admin-nav-label {
  color: #64748b;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 0.85rem 0.35rem;
  font-weight: 600;
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #cbd5e1;
  padding: 0.68rem 0.85rem;
  border-radius: 12px;
  margin-bottom: 0.2rem;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.admin-nav a .nav-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  opacity: 0.8;
}
.admin-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.admin-nav a:hover .nav-icon {
  opacity: 1;
}
.admin-nav a.active {
  background: #fff;
  color: #000;
  font-weight: 600;
}
.admin-nav a.active .nav-icon {
  opacity: 1;
}
.admin-main {
  padding: 1.75rem 1.75rem 2.5rem;
  max-width: 1200px;
}
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.35rem;
}
.admin-top h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.5vw, 1.9rem);
  letter-spacing: -0.04em;
}
.admin-top .subtitle {
  margin: 0.35rem 0 0;
  color: #64748b;
  font-size: 0.95rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
.stat {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 18px;
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow);
}
.stat .label { color: #64748b; font-size: 0.84rem; }
.stat .value {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-top: 0.25rem;
}

.panel {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.panel-body { padding: 1.25rem; }

/* Tabs */
.tabs-shell {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 22px;
  box-shadow: -2px 4px 12px 4px rgba(51, 51, 51, 0.05);
  overflow: hidden;
}
.tabs-nav {
  display: flex;
  gap: 0.4rem;
  padding: 0.75rem;
  border-bottom: 1px solid #eee;
  background: #fafafa;
  overflow-x: auto;
}
.tabs-nav .tab-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0 !important;
  outline: none;
  background: transparent;
  color: #64748b;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.7rem 1.05rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s ease;
  box-shadow: none !important;
}
.tabs-nav .tab-btn:hover {
  background: #f4f4f5;
  color: #0f172a;
}
.tabs-nav .tab-btn.active {
  background: #000 !important;
  color: #fff !important;
}
.tabs-panels {
  padding: 1.35rem 1.35rem 1.5rem;
}
.tab-panel {
  display: none !important;
}
.tab-panel.active {
  display: block !important;
}
.tab-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.tab-panel .tab-lead {
  margin: 0 0 1.25rem;
  color: #64748b;
  font-size: 0.95rem;
}
.tabs-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.35rem 1.35rem;
  border-top: 1px solid #eee;
  background: #fafafa;
}

.form-grid {
  display: grid;
  gap: 1rem;
  max-width: 720px;
}
.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 720px) {
  .form-grid.two { grid-template-columns: 1fr; }
}
label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.checkbox-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.7rem !important;
  font-weight: 600;
  max-width: 100%;
}
.checkbox-row span {
  font-weight: 600;
  color: #0f172a;
}
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0.78rem 0.95rem;
  font: inherit;
  background: #fff;
  color: #0f172a;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="checkbox"],
input[type="radio"] {
  width: 1.05rem !important;
  height: 1.05rem !important;
  min-width: 1.05rem !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: #000;
  flex: 0 0 auto !important;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #0f172a;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}
.help { color: #64748b; font-weight: 400; font-size: 0.82rem; }

.choice-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 720px;
}
@media (max-width: 720px) {
  .choice-grid { grid-template-columns: 1fr; }
}
.choice-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 0.75rem !important;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 0.95rem 1rem;
  background: #fff;
  cursor: pointer;
  font-weight: 400;
}
.choice-card:has(input:checked) {
  border-color: #0f172a;
  background: #f8fafc;
}
.choice-card strong {
  display: block;
  color: #0f172a;
  font-size: 0.92rem;
}
.choice-card small {
  display: block;
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 400;
}
.channel-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 0.75rem !important;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 0.95rem 1rem;
  background: #fafafa;
  max-width: 720px;
  cursor: pointer;
  font-weight: 400;
}
.channel-card strong {
  display: block;
  color: #0f172a;
  font-size: 0.92rem;
}
.channel-card small {
  display: block;
  margin-top: 0.35rem;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
}
.nested-panel {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fafafa;
  padding: 1rem 1.1rem;
  max-width: 720px;
}
.nested-panel > .panel-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}
.test-box {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fafafa;
  padding: 1rem 1.1rem;
  margin-top: 1.25rem;
  max-width: 720px;
}
.test-box h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}
.test-box p {
  margin: 0 0 0.85rem;
  color: #64748b;
  font-size: 0.88rem;
}
#panel-security {
  padding: 1.35rem 1.35rem 1.5rem;
}
.twofa-setup {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
}
.twofa-qr {
  flex: 0 0 auto;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}
.twofa-qr img {
  display: block;
  border-radius: 4px;
}
.twofa-manual-key {
  display: inline-block;
  padding: 0.45rem 0.65rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  word-break: break-all;
}
.backup-codes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 1rem;
  max-width: 360px;
}
.backup-codes code {
  font-size: 0.9rem;
  letter-spacing: 0.03em;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  background: #fff;
  color: #0f172a;
  transition: 0.15s ease;
}
.btn-secondary:hover {
  background: #f4f4f5;
  border-color: #cbd5e1;
}
.btn-compact {
  padding: 0.55rem 0.95rem;
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.input-with-action {
  display: flex;
  gap: 0.55rem;
  align-items: stretch;
}
.input-with-action input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}
.settings-extra-actions {
  border-top: 1px solid #eee;
  padding: 1.25rem 1.35rem 1.35rem;
  background: #fff;
}

/* Image upload */
.image-upload {
  display: grid;
  gap: 0.45rem;
}
.image-upload-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.15rem;
}
.image-upload-label {
  display: inline !important;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
}
.image-upload-label .optional {
  margin-left: 0.3rem;
  font-weight: 400;
  color: #94a3b8;
}
.image-upload-clear {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: #64748b;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.image-upload-clear:hover { color: #e11d48; }
.image-upload-hint-text { margin: 0; padding: 0 0.15rem; }
.image-upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  min-height: 9.5rem;
  padding: 1.15rem 1rem;
  border: 2px dashed #e2e8f0;
  border-radius: 18px;
  background: #fafafa;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.image-upload-drop:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.image-upload.is-dragging .image-upload-drop,
.image-upload-drop:focus-visible {
  outline: none;
  border-color: #0f172a;
  background: #f1f5f9;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.image-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 16px;
  background: #fff;
  color: #64748b;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  border: 1px solid #e2e8f0;
}
.image-upload-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}
.image-upload-preview,
.image-upload-preview-sm {
  display: block;
  width: auto;
  max-width: 140px;
  height: 3.5rem;
  object-fit: contain;
}
.image-upload-preview-sm {
  width: 3rem;
  height: 3rem;
  max-width: 3rem;
}
.image-upload-copy { display: grid; gap: 0.2rem; }
.image-upload-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
}
.image-upload-title .muted {
  font-weight: 500;
  color: #64748b;
}
.image-upload-sub {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 400;
}
.image-upload-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}
.upload-grid {
  display: grid;
  gap: 1.15rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 720px;
}
@media (max-width: 720px) {
  .upload-grid { grid-template-columns: 1fr; }
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.data th,
table.data td {
  text-align: left;
  padding: 0.85rem 0.65rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
table.data th {
  color: #64748b;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafafa; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at top, rgba(0,0,0,0.05), transparent 42%),
    #fafafa;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #eee;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 1.85rem;
}
.login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}
.login-card .sub {
  color: #64748b;
  margin: 0 0 1.25rem;
}
.token-reveal {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 14px;
  padding: 1rem;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filters a {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 600;
}
.filters a.active {
  background: #000;
  border-color: #000;
  color: #fff;
}
.inline-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.75rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid #eee;
}
.kv:last-child { border-bottom: 0; }
.kv dt { color: #64748b; }
.kv dd { margin: 0; word-break: break-all; }

.flash {
  border-radius: 14px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.logout-wrap {
  margin-top: 1.5rem;
  padding: 0 0.75rem;
}
