:root {
  --bg: #070b16;
  --bg-soft: #101932;
  --panel: rgba(16, 25, 50, 0.86);
  --panel-strong: #18264a;
  --text: #e6ecff;
  --muted: #9fb0d7;
  --accent: #59d5ff;
  --accent-2: #7ef5cc;
  --danger: #ff7f93;
  --border: rgba(148, 174, 255, 0.26);
  --radius: 16px;
  --shadow: 0 20px 45px rgba(2, 8, 22, 0.45);
}

* {
  box-sizing: border-box;
}

body.admin-theme {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(89, 213, 255, 0.2), transparent 38%),
    radial-gradient(circle at 84% 18%, rgba(126, 245, 204, 0.16), transparent 42%),
    linear-gradient(160deg, #070b16 0%, #101936 52%, #0b1228 100%);
  color: var(--text);
  min-height: 100vh;
}

body.admin-theme.admin-page .admin-app-shell {
  width: 100%;
}

body.admin-theme.admin-page {
  min-width: 100%;
}

.admin-auth-gate {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  z-index: 1200;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(89, 213, 255, 0.14), transparent 34%),
    radial-gradient(circle at bottom right, rgba(126, 245, 204, 0.11), transparent 28%),
    rgba(7, 11, 22, 0.94);
  font-weight: 700;
  letter-spacing: 0.01em;
}

html.admin-auth-checking .admin-auth-gate {
  display: flex;
}

html.admin-auth-checking .admin-app-shell {
  visibility: hidden;
  pointer-events: none;
}

html.admin-auth-ready .admin-auth-gate {
  display: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth-card {
  width: min(520px, 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  padding: 28px;
}

.auth-title {
  margin: 0;
  font-size: 1.8rem;
}

.auth-subtitle {
  margin: 10px 0 24px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-note {
  margin: 16px 0 0;
  font-size: 0.92rem;
  color: #b8c6eb;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(6, 11, 24, 0.84);
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.98rem;
}

.form-field textarea {
  min-height: 120px;
  resize: vertical;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  padding: 11px 16px;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #27bff2, #39ddb5);
  color: #03131a;
}

.btn-secondary {
  background: rgba(13, 21, 44, 0.8);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-success {
  background: linear-gradient(135deg, #36d98c, #7df2c0);
  color: #062517;
}

.btn-warn {
  background: linear-gradient(135deg, #ffcf66, #ff9a4d);
  color: #311603;
}

.btn-danger {
  background: linear-gradient(135deg, #ff7792, #ff9771);
  color: #2d0711;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.auth-links {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.feedback {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  display: none;
  font-size: 0.95rem;
}

.feedback.show {
  display: block;
}

.feedback.info {
  background: rgba(53, 117, 255, 0.14);
  border: 1px solid rgba(90, 143, 255, 0.34);
}

.feedback.success {
  background: rgba(58, 182, 132, 0.14);
  border: 1px solid rgba(58, 182, 132, 0.34);
}

.feedback.error {
  background: rgba(255, 90, 123, 0.14);
  border: 1px solid rgba(255, 120, 150, 0.34);
}

.admin-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  border-right: 1px solid var(--border);
  background: rgba(8, 13, 28, 0.92);
  padding: 24px 16px;
}

.admin-brand {
  margin-bottom: 22px;
}

.admin-brand h1 {
  margin: 0;
  font-size: 1.15rem;
}

.admin-brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-nav button {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.admin-nav button.active,
.admin-nav button:hover {
  border-color: var(--border);
  background: rgba(89, 213, 255, 0.12);
}

.admin-main {
  padding: 20px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.admin-topbar .user-badge {
  border: 1px solid var(--border);
  background: rgba(8, 15, 32, 0.74);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 13, 28, 0.6);
  padding: 12px;
}

.stat-card small {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-card strong {
  font-size: 1.2rem;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.inline-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-controls label {
  color: var(--muted);
  font-size: 0.88rem;
}

.inline-controls select {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(9, 16, 34, 0.84);
  color: var(--text);
  padding: 8px 10px;
}

.inline-controls input {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(9, 16, 34, 0.84);
  color: var(--text);
  padding: 8px 10px;
  min-width: 130px;
}

.btn-xs {
  padding: 8px 10px;
  font-size: 0.82rem;
}

.btn-row.tight {
  margin-top: 0;
  gap: 6px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  border: 1px solid rgba(148, 174, 255, 0.26);
  background: rgba(148, 174, 255, 0.12);
}

.status-pending {
  border-color: rgba(255, 188, 99, 0.45);
  background: rgba(255, 188, 99, 0.18);
  color: #ffd8a6;
}

.status-approved {
  border-color: rgba(122, 233, 190, 0.45);
  background: rgba(122, 233, 190, 0.14);
  color: #d9ffee;
}

.status-rejected {
  border-color: rgba(255, 139, 162, 0.5);
  background: rgba(255, 139, 162, 0.14);
  color: #ffd3dd;
}

.status-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-stack small {
  color: var(--muted);
  font-size: 0.78rem;
}

.inline-note {
  color: var(--muted);
  font-size: 0.8rem;
}

.compact-select {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(7, 13, 28, 0.9);
  color: var(--text);
  padding: 7px 9px;
  width: 100%;
}

.request-actions {
  display: grid;
  gap: 8px;
  min-width: 230px;
}

.request-actions textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(7, 13, 28, 0.9);
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.86rem;
}

.request-reviewed-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  min-width: 220px;
}

.stack-form {
  display: grid;
  gap: 10px;
}

.panel-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.mail-preview {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(5, 11, 24, 0.94);
  color: #d9e8ff;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

.inbox-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: rgba(89, 213, 255, 0.08);
}

.mail-detail {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(8, 14, 29, 0.74);
  padding: 12px;
  min-height: 320px;
  display: grid;
  gap: 10px;
}

.mail-detail h4 {
  margin: 0;
}

.mail-detail-meta {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.mail-detail pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.52;
  color: #d6e5ff;
}

.file-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 12px;
}

.file-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(8, 14, 29, 0.74);
  max-height: 520px;
  overflow: auto;
}

.file-list button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  cursor: pointer;
  border-bottom: 1px solid rgba(148, 174, 255, 0.12);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84rem;
}

.file-list button:hover,
.file-list button.active {
  background: rgba(89, 213, 255, 0.12);
}

.editor-panel textarea {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #070d1c;
  color: #d8e7ff;
  padding: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.55;
}

.editor-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 8px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(148, 174, 255, 0.16);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.shorts-report-controls {
  justify-content: flex-end;
}

.shorts-summary-grid .stat-card strong {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.shorts-archive-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shorts-archive-list button,
.shorts-sort-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(9, 16, 34, 0.84);
  color: var(--text);
  cursor: pointer;
}

.shorts-archive-list button {
  padding: 8px 10px;
  font-weight: 700;
}

.shorts-archive-list button.active,
.shorts-archive-list button:hover,
.shorts-sort-btn.is-active,
.shorts-sort-btn:hover {
  background: rgba(89, 213, 255, 0.14);
  border-color: rgba(89, 213, 255, 0.48);
}

.shorts-sort-btn {
  width: 100%;
  padding: 5px 6px;
  text-align: left;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

.shorts-table-wrap {
  max-width: 100%;
}

.shorts-report-table {
  min-width: 1120px;
}

.shorts-report-table th,
.shorts-report-table td {
  vertical-align: middle;
}

.shorts-thumb {
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(148, 174, 255, 0.26);
  background: rgba(7, 13, 28, 0.8);
  display: block;
}

.shorts-title-cell {
  min-width: 260px;
  max-width: 420px;
}

.shorts-title-cell a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.shorts-title-cell small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.shorts-rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(148, 174, 255, 0.32);
  background: rgba(148, 174, 255, 0.12);
  font-weight: 800;
}

.shorts-top-rank {
  background: rgba(126, 245, 204, 0.06);
}

.shorts-rank-1 .shorts-rank-pill {
  background: linear-gradient(135deg, #ffdf73, #ffb14f);
  color: #261506;
  border-color: rgba(255, 218, 115, 0.8);
}

.shorts-rank-2 .shorts-rank-pill {
  background: linear-gradient(135deg, #cdd7ee, #8fb2e8);
  color: #071120;
  border-color: rgba(205, 215, 238, 0.8);
}

.shorts-rank-3 .shorts-rank-pill {
  background: linear-gradient(135deg, #f0b38b, #d07a45);
  color: #221006;
  border-color: rgba(240, 179, 139, 0.8);
}

.shorts-media-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.shorts-media-status.is-archived {
  color: #081f14;
  border-color: rgba(73, 222, 128, 0.72);
  background: linear-gradient(135deg, #80f0aa, #38d894);
}

.shorts-media-status.is-missing {
  color: var(--muted);
  background: rgba(148, 174, 255, 0.08);
}

.shorts-media-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 12px;
  background: rgba(5, 10, 20, 0.74);
  overflow: auto;
}

.shorts-media-modal.hidden {
  display: none !important;
}

.shorts-media-modal-card {
  width: min(720px, calc(100vw - 24px));
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(9, 16, 32, 0.97);
  box-shadow: var(--shadow);
  padding: 16px;
}

.shorts-media-modal-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.shorts-media-modal-card .form-field {
  margin-bottom: 0;
}

.modal-subtle {
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.shorts-rights-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(148, 174, 255, 0.08);
  color: var(--text);
  font-weight: 700;
  line-height: 1.45;
}

.shorts-rights-check input {
  margin-top: 3px;
  flex: 0 0 auto;
}

.shorts-media-watch-card {
  width: min(960px, calc(100vw - 24px));
}

.shorts-media-watch-card video {
  width: 100%;
  max-height: min(72vh, 720px);
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #050a14;
}

@media (max-width: 1024px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .file-layout,
  .grid-3,
  .grid-4,
  .inbox-layout {
    grid-template-columns: 1fr;
  }

  .shorts-report-controls {
    justify-content: flex-start;
  }
}

.auth-page .auth-shell {
  min-height: calc(100vh - 148px);
  padding-top: 8px;
}

.auth-page .auth-card {
  width: min(560px, 100%);
}

.admin-page .page-shell {
  max-width: none;
  width: auto;
  margin: 0;
  padding: 0;
}

body.admin-theme.admin-page .admin-app-shell > .site-topbar {
  width: min(1680px, calc(100% - 32px)) !important;
  max-width: 1680px !important;
  margin: 16px auto 18px;
}

body.admin-theme.admin-page .admin-app-shell > .site-topbar .site-topbar-inner {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

body.admin-theme.admin-page .admin-app-shell > .page-shell {
  width: min(1680px, calc(100% - 32px)) !important;
  max-width: 1680px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0 0 24px;
}

.admin-page .admin-layout {
  display: grid !important;
  grid-template-columns: 240px minmax(0, 1fr) !important;
  gap: 24px !important;
  min-height: calc(100vh - 190px);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: visible;
  background: rgba(7, 14, 28, 0.44);
  box-shadow: var(--shadow);
  padding: 18px;
  width: 100% !important;
  max-width: none !important;
  align-items: start !important;
}

.admin-page .admin-sidebar {
  border: 1px solid var(--border);
  border-radius: 14px;
  border-right: 1px solid var(--border);
  min-height: 100%;
  backdrop-filter: blur(10px);
}

.admin-page .admin-main {
  min-width: 0 !important;
  width: 100% !important;
  max-width: none !important;
  padding: 4px 4px 8px;
}

.admin-page #section-users .table-wrap table {
  min-width: 1180px;
}

.admin-page #section-users td:nth-child(2),
.admin-page #section-users td:nth-child(3),
.admin-page #section-users td:nth-child(10) {
  word-break: break-word;
}

.admin-page #section-users td:nth-child(9) {
  min-width: 140px;
}

.admin-page #section-users td:nth-child(10) {
  min-width: 190px;
}

.admin-page #section-users td:nth-child(11) .btn-row.tight {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-width: 190px;
}

.admin-page #section-users td:nth-child(11) .btn-xs {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
}

.education-overview-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.education-table {
  min-width: 1500px;
}

.education-activity-table {
  min-width: 1320px;
}

.support-table {
  min-width: 1560px;
}

.page-visits-table {
  min-width: 1340px;
}

.page-visits-recent-table {
  min-width: 1180px;
}

#section-pageVisits td:nth-child(1),
#section-pageVisits td:nth-child(2),
#section-pageVisits td:nth-child(3),
#section-pageVisits td:nth-child(9) {
  word-break: break-word;
}

#section-pageVisits td:nth-child(9) .btn-xs {
  white-space: nowrap;
}

.mini-bar-chart {
  display: grid;
  gap: 8px;
}

.mini-bar-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 64px;
  gap: 10px;
  align-items: center;
}

.mini-bar-label,
.mini-bar-value {
  font-size: 0.84rem;
  color: var(--muted);
}

.mini-bar-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(95, 125, 182, 0.22);
  overflow: hidden;
}

.mini-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, #59d5ff, #7ef5cc);
}

#section-supportTickets td:nth-child(2),
#section-supportTickets td:nth-child(4),
#section-supportTickets td:nth-child(5) {
  word-break: break-word;
}

#section-supportTickets td:nth-child(11) .btn-row.tight {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-width: 190px;
}

#section-supportTickets td:nth-child(11) .btn-xs {
  width: 100%;
  white-space: nowrap;
}

.mail-log-failed {
  color: #ffd3dd;
}

.mail-log-sent {
  color: #d9ffee;
}

#section-education td:nth-child(1),
#section-education td:nth-child(3),
#section-education td:nth-child(9),
#section-education td:nth-child(10) {
  word-break: break-word;
}

#section-education td:nth-child(11) .btn-row.tight {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-width: 180px;
}

#section-education td:nth-child(11) .btn-xs {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
}

.education-detail-body {
  display: grid;
  gap: 14px;
}

.education-detail-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.education-detail-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(8, 14, 29, 0.64);
  padding: 8px 10px;
}

.education-detail-row small {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
}

.education-inline-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.education-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 12px;
  background: rgba(5, 10, 20, 0.7);
  overflow: auto;
}

.education-modal.hidden {
  display: none !important;
}

.education-modal-card {
  width: min(1260px, calc(100vw - 24px));
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(9, 16, 32, 0.96);
  box-shadow: var(--shadow);
  padding: 16px;
}

.admin-page .panel {
  border-radius: 16px;
}

.admin-page .file-list {
  max-height: 460px;
}

.admin-page .editor-panel textarea {
  min-height: 380px;
}

body.admin-theme.light-theme {
  --bg: #f5f8fc;
  --bg-soft: #eaf1fb;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-strong: #e7f0fb;
  --text: #102033;
  --muted: #53677f;
  --accent: #2563eb;
  --accent-2: #0ea5e9;
  --danger: #dc2626;
  --border: rgba(143, 167, 201, 0.5);
  --shadow: 0 18px 42px rgba(15, 35, 65, 0.12);
  background:
    radial-gradient(circle at 10% 10%, rgba(113, 163, 238, 0.2), transparent 38%),
    radial-gradient(circle at 90% 14%, rgba(120, 223, 238, 0.16), transparent 36%),
    linear-gradient(165deg, #f8fbff 0%, #eff5fd 55%, #e8f0fb 100%);
  color: var(--text);
}

body.admin-theme.light-theme .admin-auth-gate {
  color: #10233a;
  background:
    radial-gradient(circle at top left, rgba(102, 154, 233, 0.18), transparent 36%),
    radial-gradient(circle at bottom right, rgba(97, 211, 222, 0.12), transparent 32%),
    rgba(245, 249, 255, 0.9);
}

body.admin-theme.light-theme .auth-card,
body.admin-theme.light-theme .panel,
body.admin-theme.light-theme .form-card {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

body.admin-theme.light-theme .auth-note,
body.admin-theme.light-theme .auth-subtitle,
body.admin-theme.light-theme .panel-note,
body.admin-theme.light-theme .inline-note,
body.admin-theme.light-theme .status-stack small,
body.admin-theme.light-theme .admin-brand p {
  color: var(--muted);
}

body.admin-theme.light-theme .form-field input,
body.admin-theme.light-theme .form-field textarea,
body.admin-theme.light-theme .inline-controls select,
body.admin-theme.light-theme .inline-controls input,
body.admin-theme.light-theme .compact-select,
body.admin-theme.light-theme .request-actions textarea,
body.admin-theme.light-theme .editor-panel textarea {
  background: #ffffff;
  color: #13263c;
  border-color: rgba(145, 170, 204, 0.55);
}

body.admin-theme.light-theme .btn-secondary {
  background: rgba(232, 240, 252, 0.95);
  color: #163150;
  border-color: rgba(140, 166, 203, 0.55);
}

body.admin-theme.light-theme .btn-primary {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #ffffff;
}

body.admin-theme.light-theme .admin-layout {
  background: rgba(255, 255, 255, 0.74);
  border-color: var(--border);
}

body.admin-theme.light-theme .admin-sidebar {
  background: rgba(244, 249, 255, 0.94);
  border-color: var(--border);
}

body.admin-theme.light-theme .admin-nav button {
  color: #203852;
}

body.admin-theme.light-theme .admin-nav button.active,
body.admin-theme.light-theme .admin-nav button:hover {
  border-color: rgba(127, 155, 196, 0.52);
  background: rgba(190, 213, 245, 0.45);
}

body.admin-theme.light-theme .admin-topbar .user-badge,
body.admin-theme.light-theme .stat-card,
body.admin-theme.light-theme .mail-detail,
body.admin-theme.light-theme .file-list,
body.admin-theme.light-theme .education-detail-row,
body.admin-theme.light-theme .education-modal-card {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(145, 170, 205, 0.5);
  color: #132940;
}

body.admin-theme.light-theme .mail-preview {
  background: rgba(245, 249, 255, 0.96);
  border-color: rgba(142, 168, 205, 0.55);
  color: #18324d;
}

body.admin-theme.light-theme .mail-detail pre {
  color: #18344f;
}

body.admin-theme.light-theme th {
  color: #4a627f;
}

body.admin-theme.light-theme th,
body.admin-theme.light-theme td,
body.admin-theme.light-theme .file-list button {
  border-color: rgba(145, 170, 205, 0.35);
}

body.admin-theme.light-theme .shorts-archive-list button,
body.admin-theme.light-theme .shorts-sort-btn,
body.admin-theme.light-theme .shorts-thumb,
body.admin-theme.light-theme .shorts-rank-pill {
  border-color: rgba(55, 92, 154, 0.24);
  background: rgba(255, 255, 255, 0.72);
  color: #162342;
}

body.admin-theme.light-theme .shorts-title-cell a {
  color: #0b66a6;
}

body.admin-theme.light-theme .shorts-top-rank {
  background: rgba(11, 102, 166, 0.05);
}

body.admin-theme.light-theme .clickable-row:hover,
body.admin-theme.light-theme .file-list button:hover,
body.admin-theme.light-theme .file-list button.active {
  background: rgba(194, 216, 246, 0.42);
}

body.admin-theme.light-theme .status-badge {
  border-color: rgba(131, 160, 199, 0.5);
  background: rgba(217, 231, 251, 0.72);
  color: #1d3551;
}

body.admin-theme.light-theme .status-pending {
  border-color: rgba(203, 132, 55, 0.5);
  background: rgba(255, 229, 194, 0.78);
  color: #854515;
}

body.admin-theme.light-theme .status-approved {
  border-color: rgba(37, 132, 96, 0.52);
  background: rgba(202, 246, 227, 0.86);
  color: #0d5b3c;
}

body.admin-theme.light-theme .status-rejected {
  border-color: rgba(204, 80, 108, 0.5);
  background: rgba(255, 223, 230, 0.84);
  color: #912741;
}

body.admin-theme.light-theme .mail-log-failed {
  color: #b5475f;
}

body.admin-theme.light-theme .mail-log-sent {
  color: #1f7b59;
}

body.admin-theme.light-theme .education-modal {
  background: rgba(28, 50, 80, 0.2);
}

body.admin-theme.light-theme .shorts-media-modal {
  background: rgba(28, 50, 80, 0.22);
}

body.admin-theme.light-theme .shorts-media-modal-card {
  background: rgba(255, 255, 255, 0.98);
}

body.admin-theme.light-theme .shorts-rights-check {
  background: rgba(37, 99, 235, 0.06);
}

body.admin-theme.light-theme .mini-bar-track {
  background: rgba(153, 178, 212, 0.35);
}

body.admin-theme.light-theme .mini-bar-fill {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
}

@media (max-width: 900px) {
  .admin-page .page-shell {
    width: calc(100% - 20px);
  }

  body.admin-theme.admin-page .admin-app-shell > .site-topbar,
  body.admin-theme.admin-page .admin-app-shell > .page-shell {
    width: calc(100% - 20px);
  }

  .auth-page .auth-shell {
    min-height: auto;
    padding-top: 0;
  }

  .admin-page .admin-layout {
    gap: 12px;
    padding: 10px;
    border-radius: 16px;
    grid-template-columns: 1fr !important;
  }

  .education-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .education-detail-grid {
    grid-template-columns: 1fr;
  }

  .mini-bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.server-metrics-inline-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.server-metrics-toggle-wrap {
  color: var(--muted);
  font-size: 12px;
}

.server-metrics-content {
  display: grid;
  gap: 12px;
}

.server-metrics-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.server-metrics-kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.server-metrics-kv-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.server-metrics-kv-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.server-metrics-kv-list {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.server-metrics-progress-row {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.server-metrics-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  gap: 8px;
}

.server-metrics-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.server-metrics-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c3da, #5a88f8);
}

.server-metrics-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.server-metrics-status-item {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.server-metrics-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.server-metrics-app-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 8px;
}

.server-metrics-app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.server-metrics-app-meta {
  font-size: 12px;
  color: var(--muted);
}

.server-metrics-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
}

.server-metrics-badge.ok {
  background: rgba(28, 182, 108, 0.2);
  color: #8de2bd;
}

.server-metrics-badge.warn {
  background: rgba(215, 158, 52, 0.2);
  color: #f5d59a;
}

.server-metrics-badge.err {
  background: rgba(235, 91, 91, 0.2);
  color: #ffb5b5;
}

.server-metrics-message-error {
  color: #ffb5b5;
}

body.admin-theme.light-theme .server-metrics-kv-card,
body.admin-theme.light-theme .server-metrics-status-item,
body.admin-theme.light-theme .server-metrics-app-card {
  border-color: rgba(55, 92, 154, 0.25);
  background: rgba(255, 255, 255, 0.75);
}

body.admin-theme.light-theme .server-metrics-progress-track {
  background: rgba(55, 92, 154, 0.18);
}

body.admin-theme.light-theme .server-metrics-badge.ok {
  color: #0a7245;
}

body.admin-theme.light-theme .server-metrics-badge.warn {
  color: #8a5b05;
}

body.admin-theme.light-theme .server-metrics-badge.err {
  color: #941d1d;
}


/* Country Shorts module */
.shorts-hero-panel .panel-note {
  max-width: 980px;
}

.shorts-control-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 14px 0;
}

.shorts-control-grid label,
.shorts-auto-profile select {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.shorts-control-grid select,
.shorts-control-grid input,
.shorts-auto-profile select,
.shorts-video-filters input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(6, 11, 24, 0.84);
  color: var(--text);
  padding: 9px 10px;
  min-height: 38px;
}

.shorts-control-actions {
  display: flex;
  align-items: end;
}

.shorts-job-panel {
  border: 1px solid rgba(89, 213, 255, 0.32);
  border-radius: 12px;
  background: rgba(89, 213, 255, 0.08);
  padding: 12px;
  margin: 12px 0;
}

.shorts-job-panel.hidden {
  display: none;
}

.shorts-report-notice {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(89, 213, 255, 0.22);
  border-radius: 10px;
  background: rgba(89, 213, 255, 0.08);
  color: var(--text);
}

.shorts-job-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shorts-job-steps span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.shorts-job-steps .running {
  color: #071120;
  background: linear-gradient(135deg, #59d5ff, #7ef5cc);
}

.shorts-job-steps .done {
  color: #081f14;
  background: rgba(73, 222, 128, 0.72);
}

.shorts-auto-profiles {
  display: grid;
  gap: 8px;
}

.shorts-auto-profile {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) 88px minmax(170px, 1fr) minmax(150px, 1fr) 88px auto;
  gap: 8px;
  align-items: center;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.shorts-archive-table,
.shorts-compact-table {
  width: 100%;
}

.shorts-archive-table tr.is-selected {
  background: rgba(89, 213, 255, 0.08);
}

.shorts-link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

.shorts-compact-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(9, 16, 32, 0.96);
}

.shorts-compact-table .shorts-title-cell {
  min-width: 320px;
  max-width: 620px;
}

.shorts-compact-table .shorts-title-cell a,
.shorts-compact-table .shorts-title-cell {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.shorts-actions {
  display: grid;
  grid-template-columns: repeat(6, 32px);
  gap: 5px;
  justify-content: start;
}

.shorts-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(13, 21, 44, 0.82);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
}

.shorts-icon-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.shorts-detail-row td {
  background: rgba(7, 13, 28, 0.48);
}

.shorts-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.shorts-detail-grid div {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: rgba(148, 174, 255, 0.06);
  min-width: 0;
}

.shorts-detail-grid small {
  display: block;
  color: var(--muted);
  margin-bottom: 3px;
}

.shorts-detail-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.shorts-detail-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 1440px) {
  .shorts-control-grid {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }

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

@media (max-width: 1024px) {
  .admin-page .admin-sidebar {
    min-height: auto;
  }

  .admin-page .admin-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shorts-auto-profile {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shorts-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  body.admin-theme.admin-page .admin-app-shell > .site-topbar,
  body.admin-theme.admin-page .admin-app-shell > .page-shell {
    width: calc(100% - 16px) !important;
  }

  .shorts-control-grid,
  .shorts-auto-profile,
  .shorts-detail-grid,
  .grid-4 {
    grid-template-columns: 1fr !important;
  }

  .admin-page .admin-nav {
    grid-template-columns: 1fr;
    max-height: 260px;
    overflow: auto;
  }

  .shorts-actions {
    grid-template-columns: repeat(3, 32px);
  }
}

body.admin-theme.light-theme .shorts-control-grid select,
body.admin-theme.light-theme .shorts-control-grid input,
body.admin-theme.light-theme .shorts-auto-profile select,
body.admin-theme.light-theme .shorts-video-filters input,
body.admin-theme.light-theme .shorts-icon-btn {
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

body.admin-theme.light-theme .shorts-compact-table th {
  background: rgba(255, 255, 255, 0.96);
}

.stats-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.stats-settings-grid .form-field {
  min-width: 0;
  margin-bottom: 0;
}

.stats-settings-grid .toggle-field {
  display: flex;
  align-items: center;
}

.stats-settings-grid .toggle-line {
  flex-wrap: nowrap;
  white-space: normal;
}

#section-statistics .panel-note {
  color: var(--muted);
  margin: 6px 0 0;
}

#section-statistics hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

@media (max-width: 700px) {
  .stats-settings-grid {
    grid-template-columns: 1fr;
  }
}
