:root {
  --admin-green: #087f3d;
  --admin-green-dark: #066c34;
  --admin-green-soft: #eaf6ef;
  --admin-blue: #276c98;
  --admin-amber: #9a5b08;
  --admin-red: #b42318;
  --admin-text: #17212b;
  --admin-muted: #66717e;
  --admin-faint: #8a95a1;
  --admin-line: #dce2e7;
  --admin-line-strong: #c8d0d8;
  --admin-surface: #ffffff;
  --admin-canvas: #f4f6f8;
  --admin-sidebar: #f8f9fa;
  --admin-radius: 6px;
  --admin-focus: 0 0 0 3px rgba(8, 127, 61, .13);
  --admin-shadow: 0 10px 28px rgba(24, 39, 53, .08);
}

/* Common */
body.admin-login,
body.admin-settings,
body.admin-dashboard {
  color: var(--admin-text);
  background: var(--admin-canvas);
  font-family: system-ui, "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

.admin-login *,
.admin-settings *,
.admin-dashboard * {
  box-sizing: border-box;
}

.admin-login :focus-visible,
.admin-settings :focus-visible,
.admin-dashboard :focus-visible {
  outline: 2px solid var(--admin-green);
  outline-offset: 2px;
}

.admin-settings button,
.admin-settings input,
.admin-dashboard button,
.admin-dashboard input,
.admin-dashboard select,
.admin-dashboard textarea {
  font: inherit;
}

.admin-settings > header,
.admin-dashboard > header {
  height: 60px;
  padding: 0 22px;
  border-bottom: 1px solid var(--admin-line);
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 1px 4px rgba(24, 39, 53, .04);
}

.admin-settings .brand,
.admin-dashboard .brand {
  gap: 10px;
  min-width: 0;
}

.admin-settings .brand-logo,
.admin-dashboard .brand-logo {
  width: 38px;
  height: 38px;
  padding: 2px;
  object-fit: contain;
  flex: 0 0 auto;
  border: 1px solid #e4e8ec;
  border-radius: var(--admin-radius);
  background: #fff;
}

.admin-settings .brand-copy,
.admin-dashboard .brand-copy {
  min-width: 0;
}

.admin-settings .brand-copy strong,
.admin-dashboard .brand-copy strong {
  display: block;
  overflow: hidden;
  color: var(--admin-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-settings .brand-copy span,
.admin-dashboard .brand-copy span {
  display: block;
  margin-top: 2px;
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-settings .header-actions,
.admin-dashboard .header-actions {
  gap: 8px;
}

.admin-settings .header-link,
.admin-settings .header-button,
.admin-dashboard .header-link,
.admin-dashboard .header-button,
.admin-dashboard .icon-link {
  height: 32px;
  border: 1px solid var(--admin-line-strong);
  border-radius: 5px;
  background: #fff;
  color: #33404c;
  font-size: 13px;
  font-weight: 500;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.admin-settings .header-link,
.admin-settings .header-button,
.admin-dashboard .header-link,
.admin-dashboard .header-button {
  padding: 0 11px;
}

.admin-settings .header-link:hover,
.admin-settings .header-button:hover,
.admin-dashboard .header-link:hover,
.admin-dashboard .header-button:hover,
.admin-dashboard .icon-link:hover {
  border-color: #9eb7a8;
  background: #f2f8f4;
  color: var(--admin-green-dark);
}

/* Login */
body.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 28px 18px;
  background: #eef2f4;
}

.admin-login .login-shell {
  width: min(390px, 100%);
  margin: 0;
  padding: 0;
}

.admin-login .brand {
  gap: 12px;
  margin: 0 0 18px;
  padding: 0 4px;
}

.admin-login .brand-logo {
  width: 48px;
  height: 48px;
  padding: 3px;
  border: 1px solid #dce3e8;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.admin-login .brand-title {
  color: var(--admin-text);
  font-size: 19px;
  font-weight: 700;
}

.admin-login .brand-subtitle {
  margin-top: 3px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-login .login-panel {
  padding: 26px;
  border: 1px solid var(--admin-line);
  border-top: 3px solid var(--admin-green);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--admin-shadow);
}

.admin-login .login-panel h1 {
  margin: 0 0 20px;
  color: var(--admin-text);
  font-size: 18px;
  font-weight: 700;
}

.admin-login .field + .field {
  margin-top: 15px;
}

.admin-login label {
  margin-bottom: 6px;
  color: #3b4651;
  font-size: 13px;
  font-weight: 600;
}

.admin-login input {
  height: 40px;
  border-color: var(--admin-line-strong);
  border-radius: 5px;
  font-size: 14px;
}

.admin-login input:focus {
  border-color: var(--admin-green);
  box-shadow: var(--admin-focus);
}

.admin-login button {
  height: 40px;
  margin-top: 20px;
  border-color: var(--admin-green);
  border-radius: 5px;
  background: var(--admin-green);
  font-size: 14px;
}

.admin-login button:hover {
  background: var(--admin-green-dark);
}

.admin-login .login-message {
  margin-bottom: 16px;
  border-radius: 5px;
  font-size: 13px;
}

.admin-login .server {
  margin-top: 14px;
  color: var(--admin-faint);
  font-size: 11px;
}

/* Settings */
body.admin-settings {
  margin: 0;
  background: #fff;
}

.admin-settings > header {
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-settings > main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 30px 28px 56px;
  background: #fff;
}

.admin-settings .page-head {
  margin-bottom: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--admin-line);
}

.admin-settings .back {
  color: var(--admin-green);
  font-size: 12px;
  font-weight: 600;
}

.admin-settings .page-head h1 {
  margin: 10px 0 4px;
  font-size: 22px;
  line-height: 1.3;
}

.admin-settings .page-head p {
  color: var(--admin-muted);
  font-size: 13px;
}

.admin-settings .settings-layout {
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 30px;
}

.admin-settings .settings-nav {
  position: sticky;
  top: 88px;
  align-self: start;
  padding: 0 18px 0 0;
  border-right: 1px solid var(--admin-line);
}

.admin-settings .settings-nav a {
  position: relative;
  margin-bottom: 3px;
  padding: 9px 10px;
  border-radius: 5px;
  color: var(--admin-muted);
  font-size: 13px;
}

.admin-settings .settings-nav a:hover,
.admin-settings .settings-nav a.active {
  color: var(--admin-green-dark);
  background: var(--admin-green-soft);
}

.admin-settings .settings-nav a.active::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--admin-green);
}

.admin-settings .settings-content section {
  padding: 0 0 28px;
  border-bottom: 1px solid var(--admin-line);
}

.admin-settings .settings-content section + section {
  margin-top: 0;
  padding-top: 28px;
}

.admin-settings .section-head {
  margin-bottom: 17px;
}

.admin-settings .section-head h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.admin-settings .section-head p,
.admin-settings .hint {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-settings .field label {
  color: #3c4650;
  font-size: 12px;
}

.admin-settings .field input {
  height: 38px;
  border-color: var(--admin-line-strong);
  border-radius: 5px;
  font-size: 13px;
}

.admin-settings .field input:focus {
  border-color: var(--admin-green);
  box-shadow: var(--admin-focus);
}

.admin-settings .primary {
  height: 36px;
  border-color: var(--admin-green);
  border-radius: 5px;
  background: var(--admin-green);
  font-size: 13px;
}

.admin-settings .primary:hover {
  background: var(--admin-green-dark);
}

.admin-settings .info-row {
  padding: 10px 0;
  border-color: #edf0f2;
  font-size: 13px;
}

.admin-settings .data-actions {
  gap: 8px;
}

.admin-settings .data-action {
  min-height: 64px;
  border-color: var(--admin-line);
  border-radius: var(--admin-radius);
  background: #fff;
}

.admin-settings .data-action:hover {
  border-color: #9ebfae;
  background: #f6faf8;
}

.admin-settings .data-action b {
  color: var(--admin-blue);
}

.admin-settings .danger-button {
  height: 36px;
  border-radius: 5px;
  font-size: 13px;
}

/* Dashboard */
body.admin-dashboard {
  margin: 0;
  background: var(--admin-canvas);
  overflow-x: hidden;
}

.admin-dashboard > header {
  position: sticky;
  top: 0;
  z-index: 30;
}

.admin-dashboard .admin-user {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 2px;
  color: var(--admin-muted);
  white-space: nowrap;
}

.admin-dashboard .admin-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #cfe0d5;
  border-radius: 50%;
  background: var(--admin-green-soft);
  color: var(--admin-green-dark);
  font-size: 12px;
  font-weight: 700;
}

.admin-dashboard .admin-name {
  padding: 0;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-dashboard .icon-link {
  width: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.admin-dashboard .subnav {
  width: 204px;
  height: auto;
  position: fixed;
  top: 60px;
  bottom: 0;
  z-index: 18;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 2px;
  padding: 18px 12px;
  border: 0;
  border-right: 1px solid var(--admin-line);
  background: var(--admin-sidebar);
  overflow-y: auto;
}

.admin-dashboard .subnav a {
  height: 36px;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 11px;
  border: 0;
  border-radius: 5px;
  color: #596573;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.admin-dashboard .subnav a:hover,
.admin-dashboard .subnav a.active {
  border: 0;
  background: var(--admin-green-soft);
  color: var(--admin-green-dark);
}

.admin-dashboard .subnav a.active::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--admin-green);
}

.admin-dashboard .nav-label {
  padding: 0 11px 6px;
  color: var(--admin-faint);
  font-size: 11px;
  font-weight: 700;
}

.admin-dashboard .nav-label.nav-secondary {
  margin-top: 16px;
}

.admin-dashboard .subnav a.nav-secondary {
  margin-top: 0;
}

.admin-dashboard > main {
  max-width: none;
  min-width: 0;
  margin: 0 0 0 204px;
  padding: 22px 24px 48px;
  background: var(--admin-canvas);
}

.admin-dashboard .notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #b9dac7;
  border-radius: var(--admin-radius);
  background: #eff8f3;
  color: var(--admin-green-dark);
  font-size: 13px;
}

.admin-dashboard .page-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.admin-dashboard .page-title h1 {
  margin: 0 0 3px;
  color: var(--admin-text);
  font-size: 20px;
  line-height: 1.3;
}

.admin-dashboard .page-title p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-dashboard .page-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px 13px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-dashboard .page-meta strong {
  color: var(--admin-green-dark);
  font-size: 12px;
  font-weight: 600;
}

.admin-dashboard .service-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  border: 1px solid #c9e3d3;
  border-radius: 999px;
  background: #eef8f2;
  color: var(--admin-green-dark);
  font-size: 11px;
  font-weight: 600;
}

.admin-dashboard .service-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0a9b4a;
  box-shadow: 0 0 0 2px rgba(10, 155, 74, .13);
}

.admin-dashboard .stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(116px, 1fr));
  gap: 10px;
  margin: 0 0 26px;
}

.admin-dashboard .stat {
  min-height: 88px;
  padding: 13px 14px;
  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius);
  background: #fff;
  box-shadow: 0 1px 2px rgba(24, 39, 53, .03);
}

.admin-dashboard .stat-action {
  color: var(--admin-text);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.admin-dashboard .stat-action:hover {
  border-color: #a8c7b4;
  background: #fbfdfc;
  box-shadow: 0 4px 12px rgba(24, 39, 53, .06);
}

.admin-dashboard .stat-label {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-dashboard .stat-value {
  margin-top: 6px;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.2;
}

.admin-dashboard .stat-action span {
  display: block;
  margin-top: 4px;
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-dashboard .green {
  color: var(--admin-green);
}

.admin-dashboard .amber {
  color: var(--admin-amber);
}

.admin-dashboard .red {
  color: var(--admin-red);
}

.admin-dashboard section + section {
  margin-top: 28px;
}

.admin-dashboard .section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.admin-dashboard .section-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: max-content;
}

.admin-dashboard .section-title h2 {
  margin: 0;
  color: var(--admin-text);
  font-size: 16px;
  line-height: 1.4;
}

.admin-dashboard .section-count {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-dashboard .filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-dashboard .search,
.admin-dashboard .filter-select,
.admin-dashboard .export-link {
  height: 34px;
  border: 1px solid var(--admin-line-strong);
  border-radius: 5px;
  background: #fff;
  color: #34414d;
  font-size: 13px;
}

.admin-dashboard .search {
  width: 230px;
  padding: 0 10px;
  outline: none;
}

.admin-dashboard .filter-select {
  min-width: 108px;
  padding: 0 28px 0 9px;
}

.admin-dashboard .search:focus,
.admin-dashboard select:focus,
.admin-dashboard textarea:focus,
.admin-dashboard .dialog-form input:focus {
  border-color: var(--admin-green);
  box-shadow: var(--admin-focus);
}

.admin-dashboard .export-link {
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  text-decoration: none;
}

.admin-dashboard .export-link:hover {
  border-color: #9eb7a8;
  background: #f2f8f4;
  color: var(--admin-green-dark);
}

.admin-dashboard .batch-bar {
  min-height: 46px;
  margin-bottom: 8px;
  padding: 6px 9px;
  border: 1px solid #b9dac7;
  border-radius: var(--admin-radius);
  background: #eff8f3;
}

.admin-dashboard .batch-count {
  color: var(--admin-green-dark);
  font-size: 12px;
}

.admin-dashboard .batch-bar select,
.admin-dashboard .batch-bar button {
  height: 32px;
  border-radius: 5px;
  font-size: 12px;
}

.admin-dashboard .table-wrap {
  overflow: auto;
  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius);
  background: #fff;
  box-shadow: 0 1px 2px rgba(24, 39, 53, .025);
}

.admin-dashboard table {
  width: 100%;
  border-collapse: collapse;
  color: var(--admin-text);
  font-size: 13px;
  white-space: nowrap;
}

.admin-dashboard th,
.admin-dashboard td {
  padding: 10px 11px;
  border-bottom: 1px solid #e7ebee;
  text-align: left;
  vertical-align: middle;
}

.admin-dashboard th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f7f8;
  color: #596572;
  font-size: 12px;
  font-weight: 650;
}

.admin-dashboard tbody tr:hover td {
  background: #f7faf8;
}

.admin-dashboard .select-cell {
  width: 42px;
  text-align: center;
}

.admin-dashboard .primary-cell {
  gap: 2px;
}

.admin-dashboard .primary-cell strong {
  font-size: 13px;
  font-weight: 650;
}

.admin-dashboard .primary-cell span {
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-dashboard .status-badge {
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
}

.admin-dashboard .status-approved {
  color: var(--admin-green-dark);
  background: #e8f5ed;
}

.admin-dashboard .status-expiring,
.admin-dashboard .status-pending {
  color: #875005;
  background: #fff3db;
}

.admin-dashboard .status-expired {
  color: #9c2f26;
  background: #ffefed;
}

.admin-dashboard .status-disabled {
  color: #555e68;
  background: #eceff1;
}

.admin-dashboard .actions,
.admin-dashboard .actions form {
  gap: 5px;
}

.admin-dashboard .actions select,
.admin-dashboard .actions button,
.admin-dashboard .link-button {
  height: 30px;
  border-radius: 4px;
  font-size: 12px;
}

.admin-dashboard .actions select {
  min-width: 80px;
}

.admin-dashboard .actions button {
  padding: 0 9px;
}

.admin-dashboard .link-button {
  color: var(--admin-green);
}

.admin-dashboard .filtered-empty {
  padding: 34px;
  border-color: var(--admin-line);
  background: #fff;
  color: var(--admin-muted);
  font-size: 13px;
}

.admin-dashboard dialog {
  width: min(700px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(24, 39, 53, .24);
}

.admin-dashboard dialog::backdrop {
  background: rgba(24, 32, 40, .48);
}

.admin-dashboard .dialog-head {
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0 18px;
  border-bottom: 1px solid var(--admin-line);
  background: #fff;
}

.admin-dashboard .dialog-head h3 {
  font-size: 16px;
}

.admin-dashboard .icon-button {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  color: var(--admin-muted);
}

.admin-dashboard .detail-grid {
  grid-template-columns: 122px minmax(0, 1fr);
  padding: 8px 18px 12px;
}

.admin-dashboard .detail-grid dt,
.admin-dashboard .detail-grid dd {
  padding: 9px 0;
  border-color: #edf0f2;
  font-size: 12px;
}

.admin-dashboard .dialog-form {
  padding: 14px 18px;
  border-color: var(--admin-line);
}

.admin-dashboard .dialog-form label {
  margin-bottom: 6px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-dashboard .dialog-form input,
.admin-dashboard .dialog-form button {
  height: 34px;
  border-radius: 5px;
  font-size: 13px;
}

.admin-dashboard .permissions-form {
  border-top: 1px solid #bdd9c8;
  background: #f3f8f5;
}

.admin-dashboard .permissions-form label {
  color: var(--admin-text);
  font-weight: 650;
}

.admin-dashboard .permissions-form label span {
  color: var(--admin-muted);
  font-weight: 400;
}

.admin-dashboard .permissions-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.admin-dashboard .permissions-form textarea {
  width: 100%;
  min-height: 102px;
  max-height: 220px;
  padding: 9px 10px;
  resize: vertical;
  border: 1px solid #9fbdaa;
  border-radius: 5px;
  outline: none;
  background: #fff;
  font-family: Consolas, "Microsoft YaHei", sans-serif;
  font-size: 12px;
  line-height: 1.5;
}

.admin-dashboard .permissions-form button {
  min-width: 122px;
  border-color: var(--admin-green);
  background: var(--admin-green);
  color: #fff;
}

.admin-dashboard .permissions-form button:hover {
  background: var(--admin-green-dark);
}

.admin-dashboard .permissions-meta {
  margin-top: 6px;
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-dashboard .dialog-actions {
  gap: 7px;
  padding: 12px 18px 18px;
}

.admin-dashboard .dialog-actions button {
  height: 34px;
  border-radius: 5px;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .admin-dashboard .stats {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .admin-dashboard .page-title {
    align-items: flex-start;
  }

  .admin-dashboard .page-meta {
    max-width: 540px;
  }

  .admin-dashboard .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-dashboard .filters {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 880px) {
  .admin-dashboard .subnav {
    width: auto;
    height: 44px;
    position: sticky;
    top: 60px;
    bottom: auto;
    z-index: 19;
    align-items: center;
    flex-direction: row;
    gap: 18px;
    padding: 0 16px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--admin-line);
    background: #fff;
  }

  .admin-dashboard .subnav a {
    height: 44px;
    flex: 0 0 auto;
    padding: 0;
    border-radius: 0;
    white-space: nowrap;
  }

  .admin-dashboard .subnav a:hover,
  .admin-dashboard .subnav a.active {
    border-bottom: 2px solid var(--admin-green);
    background: transparent;
  }

  .admin-dashboard .subnav a.active::before,
  .admin-dashboard .nav-label,
  .admin-dashboard .subnav a.nav-secondary[href="/admin/users.csv"],
  .admin-dashboard .subnav a.nav-secondary[href="/admin/backup/auth.db"] {
    display: none;
  }

  .admin-dashboard > main {
    margin-left: 0;
    padding: 18px 16px 40px;
  }

  .admin-dashboard .page-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .admin-dashboard .page-meta {
    justify-content: flex-start;
  }

  .admin-settings .settings-layout {
    grid-template-columns: 148px minmax(0, 1fr);
    gap: 22px;
  }
}

@media (max-width: 700px) {
  .admin-settings > header,
  .admin-dashboard > header {
    height: 56px;
    padding: 0 12px;
  }

  .admin-settings .brand-logo,
  .admin-dashboard .brand-logo {
    width: 34px;
    height: 34px;
  }

  .admin-settings .brand-copy strong,
  .admin-dashboard .brand-copy strong {
    max-width: 160px;
    font-size: 14px;
  }

  .admin-settings .brand-copy span,
  .admin-dashboard .brand-copy span,
  .admin-dashboard .admin-user,
  .admin-dashboard .header-link,
  .admin-settings .header-link {
    display: none;
  }

  .admin-dashboard .subnav {
    top: 56px;
    padding: 0 12px;
  }

  .admin-dashboard > main {
    padding: 15px 12px 34px;
  }

  .admin-dashboard .page-title h1 {
    font-size: 18px;
  }

  .admin-dashboard .page-meta > span:not(.service-status) {
    display: none;
  }

  .admin-dashboard .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 24px;
  }

  .admin-dashboard .stat {
    min-height: 82px;
    padding: 11px 12px;
  }

  .admin-dashboard .stat-value {
    font-size: 21px;
  }

  .admin-dashboard section + section {
    margin-top: 24px;
  }

  .admin-dashboard .filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .admin-dashboard .search {
    width: 100%;
    grid-column: 1 / -1;
  }

  .admin-dashboard .filter-select,
  .admin-dashboard .export-link {
    width: 100%;
    min-width: 0;
  }

  .admin-dashboard .export-link {
    justify-content: center;
  }

  .admin-dashboard .batch-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-dashboard .batch-count {
    margin: 0;
  }

  .admin-dashboard .batch-bar select,
  .admin-dashboard .batch-bar button {
    width: 100%;
  }

  .admin-dashboard .table-wrap {
    border-radius: 4px;
  }

  .admin-dashboard th,
  .admin-dashboard td {
    padding: 9px 10px;
  }

  .admin-dashboard dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
  }

  .admin-dashboard .detail-grid {
    grid-template-columns: 96px minmax(0, 1fr);
    padding-right: 14px;
    padding-left: 14px;
  }

  .admin-dashboard .dialog-form,
  .admin-dashboard .dialog-actions {
    padding-right: 14px;
    padding-left: 14px;
  }

  .admin-dashboard .permissions-editor {
    grid-template-columns: 1fr;
  }

  .admin-dashboard .permissions-form button {
    width: 100%;
  }

  .admin-dashboard .permissions-meta,
  .admin-dashboard .dialog-actions {
    flex-direction: column;
  }

  .admin-settings > main {
    padding: 20px 14px 40px;
  }

  .admin-settings .page-head {
    margin-bottom: 18px;
  }

  .admin-settings .settings-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .admin-settings .settings-nav {
    position: static;
    display: flex;
    gap: 5px;
    padding: 0 0 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--admin-line);
  }

  .admin-settings .settings-nav a {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
  }

  .admin-settings .settings-nav a.active::before {
    display: none;
  }

  .admin-settings .form-grid,
  .admin-settings .info-grid,
  .admin-settings .data-actions {
    grid-template-columns: 1fr;
  }

  .admin-settings .field.full {
    grid-column: auto;
  }

  .admin-settings .form-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .admin-login .login-panel {
    padding: 22px 18px;
  }

  .admin-settings .brand-copy strong,
  .admin-dashboard .brand-copy strong {
    max-width: 132px;
  }

  .admin-dashboard .header-button,
  .admin-dashboard .icon-link {
    height: 30px;
  }

  .admin-dashboard .page-meta {
    gap: 7px;
  }

  .admin-dashboard .dialog-form-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-dashboard .dialog-form-row button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .admin-login *,
  .admin-settings *,
  .admin-dashboard * {
    scroll-behavior: auto;
    transition: none;
  }
}

/* Readability upgrade: make the admin pages easier to read on desktop displays. */
body.admin-login,
body.admin-settings,
body.admin-dashboard {
  font-size: 15px;
  line-height: 1.52;
}

.admin-settings .brand-copy strong,
.admin-dashboard .brand-copy strong {
  font-size: 17px;
}

.admin-settings .brand-copy span,
.admin-dashboard .brand-copy span,
.admin-settings .header-link,
.admin-settings .header-button,
.admin-dashboard .header-link,
.admin-dashboard .header-button,
.admin-dashboard .admin-name {
  font-size: 14px;
}

.admin-login label,
.admin-login input,
.admin-login button,
.admin-settings .settings-nav a,
.admin-settings .field label,
.admin-settings .field input,
.admin-settings .primary,
.admin-settings .info-row,
.admin-settings .danger-button {
  font-size: 14px;
}

.admin-login .brand-title {
  font-size: 21px;
}

.admin-login .brand-subtitle,
.admin-login .login-message,
.admin-settings .page-head p,
.admin-settings .section-head p,
.admin-settings .hint {
  font-size: 13px;
}
