:root {
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --main-bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
}

* { box-sizing: border-box; }

body.admin-body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--main-bg);
  color: var(--text);
}

.admin-shell {
  min-height: 100vh;
  display: flex;
}

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-brand__logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

.admin-brand__title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.admin-brand__sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.admin-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}

.admin-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 4px;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}

.admin-nav__item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.admin-nav__item--active {
  background: rgba(37, 99, 235, 0.22);
  color: #fff;
  font-weight: 600;
}

.admin-nav__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .85;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.admin-nav__icon--dashboard {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
}

.admin-nav__icon--applications {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
}

.admin-nav__icon--orders {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z'/%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M16 10a4 4 0 0 1-8 0'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z'/%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M16 10a4 4 0 0 1-8 0'/%3E%3C/svg%3E");
}

.admin-nav__icon--progress {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='M7 16l4-4 4 4 5-6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='M7 16l4-4 4 4 5-6'/%3E%3C/svg%3E");
}

.admin-nav__icon--articles {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3C/svg%3E");
}

.admin-nav__icon--settings {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
}

.admin-nav__icon--pay {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='5' width='20' height='14' rx='2'/%3E%3Cpath d='M2 10h20'/%3E%3Cpath d='M6 15h4'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='2' y='5' width='20' height='14' rx='2'/%3E%3Cpath d='M2 10h20'/%3E%3Cpath d='M6 15h4'/%3E%3C/svg%3E");
}

.admin-nav__icon--ads {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19V5'%3E%3C/path%3E%3Cpath d='M4 19h16'%3E%3C/path%3E%3Cpath d='M8 15v-4'%3E%3C/path%3E%3Cpath d='M12 15V8'%3E%3C/path%3E%3Cpath d='M16 15v-6'%3E%3C/path%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19V5'%3E%3C/path%3E%3Cpath d='M4 19h16'%3E%3C/path%3E%3Cpath d='M8 15v-4'%3E%3C/path%3E%3Cpath d='M12 15V8'%3E%3C/path%3E%3Cpath d='M16 15v-6'%3E%3C/path%3E%3C/svg%3E");
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.admin-topbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.admin-topbar__user {
  font-size: 14px;
  color: #475569;
}

.admin-topbar__logout {
  font-size: 14px;
  color: #2563eb;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  transition: background .15s ease, border-color .15s ease;
}

.admin-topbar__logout:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.admin-topbar__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.admin-topbar__sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.admin-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
}

.admin-content {
  padding: 20px 24px 32px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.admin-stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.admin-stat__label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.admin-stat__value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.admin-stat__value--blue { color: #2563eb; }
.admin-stat__value--green { color: #16a34a; }
.admin-stat__value--orange { color: #d97706; }

.admin-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.admin-card__title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
}

.admin-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.admin-alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 14px;
}

.admin-alert--success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.admin-alert--error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.admin-alert--info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}

.admin-table tr:hover td {
  background: #fafafa;
}

.admin-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.admin-input,
.admin-select,
.admin-textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  background: #fff;
}

.admin-input { height: 38px; min-width: 220px; }
.admin-select { height: 38px; }
.admin-textarea { width: 100%; min-height: 100px; resize: vertical; }

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.admin-btn--ghost {
  background: #fff;
  color: var(--primary);
  border: 1px solid #93c5fd;
}

.admin-btn--danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.admin-btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.admin-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.admin-tag--done { background: #dcfce7; color: #15803d; }
.admin-tag--active { background: #dbeafe; color: #1d4ed8; }
.admin-tag--pending { background: #f1f5f9; color: #475569; }
.admin-tag--muted { background: #f8fafc; color: #64748b; }

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-form-group {
  margin-bottom: 14px;
}

.admin-form-group label {
  display: block;
  font-size: 13px;
  color: #475569;
  margin-bottom: 6px;
  font-weight: 600;
}

.admin-form-group .admin-input,
.admin-form-group .admin-select,
.admin-form-group .admin-textarea {
  width: 100%;
}

.admin-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 6px;
}

.admin-hint code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.admin-quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.admin-quick-link {
  display: block;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.admin-quick-link:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.admin-quick-link__title {
  font-weight: 700;
  margin-bottom: 6px;
}

.admin-quick-link__desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%);
  padding: 24px;
}

.admin-login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.admin-login-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.admin-login-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.admin-login-card .admin-input {
  width: 100%;
  margin-bottom: 12px;
}

.admin-login-card .admin-btn {
  width: 100%;
  height: 42px;
  margin-top: 6px;
}

.admin-switch-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.admin-switch-item {
  display: block;
  position: relative;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.admin-switch-item:hover {
  border-color: #cbd5e1;
}

.admin-switch-item input[type="radio"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.admin-switch-item__title,
.admin-switch-item__desc {
  position: relative;
  z-index: 0;
  pointer-events: none;
}

.admin-switch-item:has(input:checked),
.admin-switch-item--active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px #2563eb;
}

.admin-switch-item__title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.admin-switch-item__desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.admin-items-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5e1;
}

.admin-items-block__title {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 10px;
}

.admin-item-detail {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.admin-item-detail > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #1d4ed8;
  list-style: none;
}

.admin-item-detail > summary::-webkit-details-marker {
  display: none;
}

.admin-item-detail[open] > summary {
  margin-bottom: 10px;
}

.admin-textarea {
  width: 100%;
  min-height: 84px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #0f172a;
  background: #fff;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}

.admin-form-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.admin-service-card {
  margin-bottom: 14px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
}

.admin-service-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
  padding: 12px 14px;
  background: #f1f5f9;
  border-bottom: 1px solid transparent;
}

.admin-service-card.is-open .admin-service-card__head {
  border-bottom-color: #e2e8f0;
}

.admin-service-card__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.admin-service-card__chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  margin-top: -2px;
}

.admin-service-card.is-open .admin-service-card__chevron {
  transform: rotate(45deg);
  margin-top: -4px;
}

.admin-service-card__meta {
  margin-left: auto;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.admin-service-card__body {
  display: none;
  padding: 14px 16px 16px;
}

.admin-service-card.is-open .admin-service-card__body {
  display: block;
}

.admin-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #475569;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 960px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: static;
  }
  .admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .admin-nav__item { margin-bottom: 0; }
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-form-grid--3 { grid-template-columns: 1fr; }
  .admin-switch-group { grid-template-columns: 1fr; }
}
