:root {
  --orange: #ff6b4a;
  --orange-deep: #ea4d2d;
  --orange-soft: #fff1ec;
  --ink: #171b24;
  --muted: #6b7280;
  --subtle: #9aa2af;
  --line: #ece8e4;
  --panel: rgba(255, 255, 255, .92);
  --surface: #fbf7f3;
  --surface-2: #f4efea;
  --green: #159763;
  --blue: #2f74d0;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 18px 44px rgba(38, 30, 24, .08);
  --shadow-soft: 0 8px 22px rgba(38, 30, 24, .05);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 70% 0%, rgba(255, 107, 74, .12), transparent 30%),
    linear-gradient(180deg, #fffdfb 0%, var(--surface) 42%, #f8f5f1 100%);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.account-icp {
  padding: 18px 20px 26px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.account-icp a {
  color: inherit;
  text-decoration: none;
}

.account-icp a:hover {
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(255, 107, 74, .22);
  outline-offset: 2px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(236, 232, 228, .9);
  background: rgba(255, 251, 248, .94);
  backdrop-filter: blur(18px);
  z-index: 20;
}

.brand {
  min-height: 98px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 19px;
  line-height: 1.2;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 8px;
  padding: 18px 14px;
}

.nav-item,
.side-logout,
.topbar button,
.page-actions button,
.panel-title button,
.update-actions button,
.secondary-wide {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.nav-item {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  color: #3f4653;
  text-align: left;
  font-weight: 700;
}

.nav-item:hover {
  background: #fff;
  border-color: var(--line);
}

.nav-item.active {
  color: var(--orange-deep);
  background: linear-gradient(90deg, #fff3ee 0%, #fff9f6 100%);
  border-color: #ffd8cc;
  box-shadow: inset 3px 0 0 var(--orange);
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #7b8494;
  background: #f3f0ec;
  font-size: 12px;
  font-weight: 800;
}

.nav-item.active .nav-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--orange-deep));
}

.side-logout {
  width: calc(100% - 28px);
  min-height: 44px;
  margin: auto 14px 20px;
  color: var(--muted);
  background: #fff;
  border-color: var(--line);
  font-weight: 700;
}

.side-logout:hover {
  color: var(--orange-deep);
  border-color: #ffd8cc;
  background: #fff6f2;
}

.main {
  min-width: 0;
  padding: 24px 28px 34px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -24px -28px 22px;
  padding: 12px 28px;
  border-bottom: 1px solid rgba(236, 232, 228, .85);
  background: rgba(255, 253, 251, .88);
  backdrop-filter: blur(18px);
}

.menu-button { display: none; }

.search {
  width: min(560px, 44vw);
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.search span {
  flex: 0 0 auto;
  color: var(--subtle);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar button,
.page-actions button,
.panel-title button,
.update-actions button,
.secondary-wide {
  min-height: 40px;
  padding: 0 14px;
  color: #374151;
  background: #fff;
  border-color: var(--line);
  font-weight: 800;
}

.topbar button:hover,
.page-actions button:hover,
.panel-title button:hover,
.update-actions button:hover,
.secondary-wide:hover {
  color: var(--orange-deep);
  border-color: #ffd8cc;
  box-shadow: var(--shadow-soft);
}

.admin-profile {
  min-height: 46px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-profile b {
  font-size: 13px;
  line-height: 1.2;
}

.admin-profile small {
  color: var(--muted);
  font-size: 12px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1d4ed8;
  background: #eff6ff;
  font-weight: 800;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid rgba(236, 232, 228, .86);
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow-soft);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--orange-deep);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
}

.page-head p:not(.eyebrow) {
  max-width: 740px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.page-actions button:first-child,
.primary-wide {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--orange-deep));
  box-shadow: 0 12px 24px rgba(255, 107, 74, .18);
}

.page-actions button:first-child:hover,
.primary-wide:hover {
  color: #fff;
  transform: translateY(-1px);
}

.qq-login-button {
  min-height: 44px;
  width: 100%;
  border: 1px solid #d8eefb;
  border-radius: 8px;
  background: #f6fcff;
  color: #0f6f9f;
  font-weight: 900;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.qq-login-button:hover {
  border-color: #9edcf7;
  background: #eefaff;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.qq-login-button-primary {
  min-height: 50px;
  border-color: #14b8d6;
  background: #13b5d7;
  color: #fff;
  box-shadow: 0 18px 34px rgba(19, 181, 215, .22);
}

.qq-login-button-primary:hover {
  border-color: #0ea5c6;
  background: #0ea5c6;
}

.auth-secondary-title {
  margin: 2px 0 -4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-grid.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metric-grid.primary-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.prompt-review-panel { padding: 18px; }
.prompt-review-count { margin: 14px 0 10px; color: var(--muted); font-size: 13px; }
.prompt-review-list { display: grid; gap: 12px; }
.prompt-review-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 4px 14px rgba(15, 23, 42, .04); }
.prompt-review-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.prompt-review-card h3 { margin: 0; color: var(--ink); font-size: 16px; }
.prompt-review-card-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.prompt-review-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0; color: var(--muted); font-size: 12px; }
.prompt-review-body { display: flex; align-items: flex-start; gap: 12px; }
.prompt-review-reference { width: 72px; height: 92px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.prompt-template-preview { min-width: 0; flex: 1; }
.prompt-template-preview summary { color: var(--blue); cursor: pointer; font-weight: 700; line-height: 1.5; }
.prompt-template-preview pre { max-height: 300px; margin: 8px 0 0; padding: 12px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); font: 13px/1.65 inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.prompt-review-reason { margin: 12px 0 0; padding: 9px 11px; border-radius: 8px; color: #9a3412; background: #fff7ed; font-size: 12px; line-height: 1.5; }
.prompt-review-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.prompt-review-actions label { display: grid; flex: 1 1 280px; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.prompt-review-reason-input { width: 100%; min-height: 38px; box-sizing: border-box; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.prompt-review-reason-input:focus { outline: 2px solid rgba(37, 99, 235, .32); border-color: var(--blue); }
.prompt-review-actions .primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.prompt-review-actions .danger { border-color: #fecaca; color: #b91c1c; background: #fff; }
.prompt-review-actions .danger:hover { background: #fff1f2; }
@media (max-width: 720px) { .prompt-review-card-head { display: grid; } .prompt-review-body { display: grid; } .prompt-review-reference { width: 96px; height: 120px; } .prompt-review-actions button { min-height: 40px; } }

.metric-section-title {
  margin: 18px 0 10px;
  font-size: 14px;
  color: var(--muted);
}

.scale-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.scale-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 2px 18px;
  border-left: 1px solid var(--line);
}

.scale-item:first-child {
  border-left: 0;
}

.scale-item span,
.scale-item small {
  color: var(--muted);
  font-size: 12px;
}

.scale-item strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.product-usage-panel {
  margin-bottom: 18px;
}

.product-usage-heading {
  align-items: flex-start;
}

.product-usage-heading .eyebrow {
  margin-bottom: 5px;
}

.product-usage-layout {
  display: grid;
  grid-template-columns: minmax(210px, .58fr) minmax(0, 1.42fr);
  gap: 16px;
  align-items: stretch;
}

.product-usage-total {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border: 1px solid #ffd7ca;
  border-radius: 10px;
  background: linear-gradient(145deg, #fff8f4, #fff1e9);
}

.product-usage-total span,
.product-usage-total small {
  color: var(--muted);
}

.product-usage-total span {
  font-size: 13px;
  font-weight: 900;
}

.product-usage-total strong {
  color: var(--orange-deep);
  font-size: clamp(36px, 4vw, 52px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.product-usage-total small {
  max-width: 230px;
  line-height: 1.65;
}

.product-usage-table {
  overflow: auto;
}

.product-usage-table table {
  min-width: 580px;
}

.product-usage-table th:nth-child(2),
.product-usage-table th:nth-child(3),
.product-usage-table td:nth-child(2),
.product-usage-table td:nth-child(3) {
  width: 110px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.product-usage-table th:last-child,
.product-usage-table td:last-child {
  width: 32%;
}

.product-usage-bar {
  width: 100%;
  height: 8px;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: #f4eee9;
}

.product-usage-bar i {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--orange-deep));
}

.overview-body-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  gap: 16px;
  margin-bottom: 18px;
}

.overview-trend {
  margin-bottom: 18px;
}

.preview-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 10px;
  padding: 0 8px;
  border: 1px solid #ffd8cc;
  border-radius: 6px;
  color: var(--orange-deep);
  background: var(--orange-soft);
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.overview-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, .7fr);
  gap: 16px;
  margin-bottom: 18px;
}

.overview-main-grid > * {
  min-width: 0;
}

.overview-main-grid .chart-card,
.overview-main-grid .overview-progress-panel {
  height: 100%;
}

.overview-diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.overview-secondary-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.overview-insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.overview-list {
  display: grid;
}

.overview-list-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border-top: 1px solid var(--line);
}

.overview-list-row:first-child {
  border-top: 0;
}

.overview-list-rank {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.overview-list-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.overview-list-copy strong,
.overview-list-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-list-copy strong {
  font-size: 13px;
}

.overview-list-copy small {
  color: var(--muted);
  font-size: 11px;
}

.overview-list-value {
  color: var(--orange-deep);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.overview-progress-panel {
  min-width: 0;
}

.overview-progress-list {
  display: grid;
  gap: 16px;
}

.overview-progress-row {
  display: grid;
  gap: 6px;
}

.overview-progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.overview-progress-heading strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-progress-heading span {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.overview-progress-row small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.overview-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-2);
}

.overview-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

.overview-progress-fill.blue {
  background: var(--blue);
}

.overview-progress-fill.green {
  background: var(--green);
}

.authorization-overview {
  margin-bottom: 18px;
}

.license-product-switch {
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.license-product-switch button {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}

.license-product-switch button:hover {
  color: var(--orange-deep);
  background: #fff;
}

.license-product-switch button.active {
  color: #fff;
  background: var(--orange);
  box-shadow: 0 6px 16px rgba(255, 96, 65, .2);
}

.license-product-switch span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.license-product-switch small {
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 8px;
  color: inherit;
  background: rgba(255, 255, 255, .78);
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

.license-product-switch button.active small {
  color: var(--orange-deep);
}

.license-filter-form {
  grid-template-columns: minmax(280px, 1.5fr) minmax(220px, .75fr) minmax(140px, .5fr);
}

.authorization-switch-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.authorization-switch {
  min-width: 0;
  min-height: 94px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px 16px;
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  text-align: left;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.authorization-switch:first-child {
  border-left: 0;
}

.authorization-switch:hover {
  background: #fff8f4;
}

.authorization-switch.active {
  color: var(--orange-deep);
  background: var(--orange-soft);
  box-shadow: inset 0 -3px 0 var(--orange);
}

.authorization-switch span,
.authorization-switch small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.authorization-switch span {
  font-size: 12px;
  font-weight: 800;
}

.authorization-switch strong {
  font-size: 26px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.authorization-switch small {
  color: var(--muted);
  font-size: 11px;
}

.authorization-detail-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.authorization-detail-title > div {
  display: grid;
  gap: 3px;
}

.authorization-detail-title .authorization-detail-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
}

.authorization-detail-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.authorization-detail-controls select {
  min-width: 190px;
  min-height: 36px;
  padding: 0 32px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 800;
}

.authorization-rank {
  color: var(--orange-deep);
  font-variant-numeric: tabular-nums;
}

.authorization-detail-title strong {
  font-size: 14px;
}

.authorization-detail-title span {
  color: var(--muted);
  font-size: 11px;
}

.recent-device-list {
  display: grid;
}

.recent-device-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.recent-device-row:first-child {
  border-top: 0;
}

.recent-device-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(21, 151, 99, .1);
}

.recent-device-copy,
.recent-device-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.recent-device-copy strong,
.recent-device-copy small,
.recent-device-meta strong,
.recent-device-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-device-copy strong,
.recent-device-meta strong {
  font-size: 12px;
}

.recent-device-copy small,
.recent-device-meta small {
  color: var(--muted);
  font-size: 11px;
}

.recent-device-meta {
  max-width: 128px;
  text-align: right;
}

.backup-metrics .backup-metric-card {
  position: relative;
  overflow: hidden;
}

.backup-metric-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--subtle);
}

.backup-metric-card.green::before {
  background: var(--green);
}

.backup-metric-card.blue::before {
  background: #3b82f6;
}

.backup-metric-card.orange::before {
  background: var(--orange);
}

.backup-detail-grid {
  margin-bottom: 18px;
}

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

.backup-policy-grid > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 4px 18px;
  border-left: 1px solid var(--line);
}

.backup-policy-grid > div:first-child {
  border-left: 0;
}

.backup-policy-grid strong {
  font-size: 14px;
}

.backup-policy-grid span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.activity-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.activity-metric-group {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(236, 232, 228, .92);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.activity-metric-values div {
  display: grid;
  gap: 5px;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.activity-metric-values div:last-child {
  border-right: 0;
}

.activity-metric-values span {
  color: var(--muted);
  font-size: 12px;
}

.activity-metric-values strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.analytics-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.analytics-range select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.metric-card,
.panel,
.chart-card,
.module-card,
.update-card,
.login-card {
  border: 1px solid rgba(236, 232, 228, .92);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 118px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  font-size: 28px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr .86fr;
  gap: 16px;
  margin-bottom: 18px;
}

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

.content-grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 16px;
}

.panel,
.chart-card {
  min-width: 0;
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title h2 {
  margin: 0;
  font-size: 18px;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.backup-status-list {
  display: grid;
  gap: 0;
}

.backup-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  border-top: 1px solid var(--line);
}

.backup-status-row:first-child {
  border-top: 0;
}

.backup-status-row > span {
  color: var(--muted);
  font-size: 13px;
}

.backup-status-row > strong {
  max-width: 66%;
  overflow-wrap: anywhere;
  text-align: right;
  font-size: 13px;
}

.table-stack {
  display: grid;
  gap: 3px;
  min-width: 150px;
}

.table-stack strong {
  font-size: 13px;
}

.table-stack small {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.mini-chart {
  width: 100%;
  height: 150px;
  margin-top: 8px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff7f3, rgba(255, 255, 255, .45));
}

.mini-chart circle {
  fill: #fff;
  stroke: var(--orange);
  stroke-width: 3;
}

.analytics-chart text {
  fill: var(--muted);
  font-size: 11px;
}

.analytics-chart .chart-axis {
  stroke: #ebe7e3;
  stroke-width: 1;
}

.mini-donut {
  width: 152px;
  height: 152px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  margin: 18px auto 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 52%, transparent 53%),
    conic-gradient(var(--orange) 0 calc(var(--percent) * 1%), #dfe6ee 0 100%);
}

.mini-donut strong {
  position: relative;
  z-index: 1;
  font-size: 34px;
  line-height: 1;
}

.mini-donut small {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #f0ece8;
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid #f0ece8;
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
}

th {
  color: #667085;
  background: #fbfaf8;
  font-size: 13px;
  font-weight: 900;
}

tbody tr:hover {
  background: #fff8f4;
}

tr:last-child td {
  border-bottom: 0;
}

.table-link {
  border: 0;
  background: transparent;
  color: var(--orange-deep);
  font-weight: 900;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: #475569;
  background: #f1f5f9;
  font-size: 13px;
  font-weight: 900;
}

.status-pill.green { color: #12804d; background: #e7f8ef; }
.status-pill.orange { color: #c2410c; background: #fff1e8; }
.status-pill.blue { color: #1d5fbf; background: #eaf3ff; }
.status-pill.gray { color: #667085; background: #f1f3f6; }
.status-pill.red { color: #b42318; background: #feeceb; }

.feedback-search-form {
  grid-template-columns: minmax(260px, 1.8fr) repeat(3, minmax(130px, .65fr)) auto;
  align-items: end;
}

.feedback-search-form .span-2 {
  grid-column: auto;
}

.feedback-detail-panel {
  margin-top: 18px;
  border-color: #cfe0f5;
  box-shadow: 0 18px 46px rgba(42, 93, 154, .11);
}

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

.section-head h2,
.section-head p {
  margin: 0;
}

.section-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.section-head button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}

.feedback-detail-grid article h3 {
  margin: 4px 0 8px;
  font-size: 14px;
}

.feedback-long-text {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
}

.feedback-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.feedback-diagnostic-summary {
  max-height: 190px;
  overflow: auto;
  margin: 0 0 16px;
  border: 1px solid #dde6f0;
  border-radius: 12px;
  background: #f5f8fc;
  padding: 12px 14px;
  color: #506176;
  font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.feedback-context span {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  color: #475569;
  word-break: break-word;
}

.feedback-context b {
  color: #8290a2;
  font-size: 12px;
}

.feedback-update-form {
  align-content: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 16px;
  border: 1px solid #e0e8f2;
  border-radius: 8px;
  background: #fbfdff;
}

@media (max-width: 1180px) {
  .feedback-search-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feedback-context {
    grid-template-columns: 1fr;
  }
}

.stat-list {
  display: grid;
  gap: 10px;
}

.stat-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid #f0ece8;
  border-radius: 8px;
  background: rgba(255, 255, 255, .74);
}

.stat-list span {
  color: var(--green);
  font-weight: 900;
}

.empty-state {
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  border: 1px dashed #ddd7d1;
  border-radius: 8px;
  background: rgba(255, 255, 255, .55);
}

.empty-state strong {
  color: var(--ink);
  font-size: 16px;
}

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

.module-card,
.update-card {
  display: grid;
  gap: 11px;
  padding: 18px;
}

.module-card span {
  justify-self: start;
  color: var(--green);
  background: #e7f8ef;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.module-card strong,
.update-card strong {
  font-size: 18px;
}

.module-card p,
.update-card p {
  min-height: 54px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.inline-form,
.version-form {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.inline-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

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

.form-grid .span-2 {
  grid-column: span 2;
}

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

.ai-upstream-form label > small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
}

.ai-upstream-clear-row {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.ai-upstream-security-note {
  margin: 18px 0 0;
  padding: 14px;
  border-radius: 8px;
  color: #475569;
  background: #f4f8ff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.7;
}

label {
  display: grid;
  gap: 8px;
  color: #384150;
  font-weight: 800;
}

input,
select,
textarea,
.status-select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: 0;
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
  line-height: 1.7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(255, 107, 74, .1);
}

.primary-wide {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 900;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.auth-password-reset {
  justify-self: end;
  border: 0;
  background: transparent;
  color: var(--orange-deep);
  cursor: pointer;
  font-weight: 800;
  padding: 0;
}

.version-badge {
  justify-self: start;
  border-radius: 999px;
  color: var(--orange-deep);
  background: var(--orange-soft);
  padding: 6px 10px;
  font-weight: 900;
}

.update-card small {
  color: var(--muted);
  font-weight: 800;
}

.update-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: #475569;
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.auth-shell,
.member-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 16% 14%, rgba(255, 107, 74, .16), transparent 26%),
    linear-gradient(180deg, #fffdfb, var(--surface));
}

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

.login-card {
  display: grid;
  gap: 15px;
  padding: 30px;
}

.member-card {
  gap: 18px;
}

.member-summary {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf7;
}

.member-summary span,
.member-summary small {
  color: var(--muted);
}

.member-summary strong {
  font-size: 22px;
}

.member-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.account-settings-card {
  width: min(620px, calc(100vw - 32px));
}

.member-settings-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.member-settings-form label {
  display: grid;
  gap: 8px;
  color: #374151;
  font-weight: 800;
}

.member-bind-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.member-bind-panel div {
  display: grid;
  gap: 4px;
}

.account-password-button {
  margin-top: 14px;
}

.account-dialog-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

.account-dialog-mask.hidden {
  display: none;
}

.account-dialog {
  position: relative;
  width: min(430px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
}

.account-dialog h2 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 24px;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
}

.member-bind-panel span {
  color: var(--muted);
  font-size: 13px;
}

.login-card img {
  width: 58px;
  height: 58px;
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
}

.login-copy,
.form-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.login-card form {
  display: grid;
  gap: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf8;
}

.auth-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: #475569;
  background: transparent;
  font-weight: 900;
}

.auth-tabs button.active {
  color: var(--orange-deep);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.form-message {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #ffd7ca;
  border-radius: 8px;
  color: var(--orange-deep);
  background: #fff7f3;
  font-weight: 800;
}

.hidden { display: none !important; }

.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(340px, calc(100vw - 32px));
}

.toast {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #ffd7ca;
  border-radius: 8px;
  color: #9a3412;
  background: #fff7f3;
  box-shadow: 0 16px 36px rgba(38, 30, 24, .13);
  font-weight: 800;
}

.mobile-menu-mask {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: none;
  background: rgba(15, 23, 42, .24);
}

.authorization-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .78);
  scrollbar-width: thin;
}

.authorization-tabs button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  color: #536071;
  background: transparent;
  font-weight: 800;
  white-space: nowrap;
}

.authorization-tabs button:hover {
  color: var(--orange-deep);
  background: #fff7f3;
}

.authorization-tabs button.active {
  color: #fff;
  background: var(--orange);
  box-shadow: 0 7px 18px rgba(255, 107, 74, .2);
}

.authorization-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(150px, .55fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.authorization-search-field {
  min-width: 0;
}

.compatibility-note {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid #f5dfc8;
  border-radius: 8px;
  color: #8a5b25;
  background: #fffbf2;
  font-size: 12px;
  line-height: 1.65;
}

.authorization-pagination {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 4px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.authorization-pagination > div {
  display: flex;
  gap: 8px;
}

.authorization-pagination button,
.account-detail-actions button,
.generated-code-panel button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #334155;
  background: #fff;
  font-weight: 800;
}

.authorization-pagination button:hover,
.account-detail-actions button:hover,
.generated-code-panel button:hover {
  color: var(--orange-deep);
  border-color: #ffc7b7;
  background: #fff8f4;
}

button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.table-link.danger {
  color: var(--red);
}

.authorization-secondary-section {
  margin-top: 16px;
}

.authorization-secondary-section > summary,
.account-device-details > summary {
  cursor: pointer;
  color: #394456;
  font-size: 14px;
  font-weight: 900;
}

.authorization-secondary-section[open] > summary,
.account-device-details[open] > summary {
  margin-bottom: 16px;
}

.authorization-dialog-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .44);
  backdrop-filter: blur(6px);
}

.authorization-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 32px 90px rgba(15, 23, 42, .22);
}

.authorization-dialog-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-right: 46px;
}

.authorization-dialog-header h2 {
  margin: 3px 0 5px;
  font-size: 26px;
}

.authorization-dialog-header small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.authorization-dialog-header .dialog-close {
  top: 0;
  right: 0;
}

.account-detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 14px;
}

.account-detail-actions span:last-child {
  margin-left: auto;
}

.account-channel-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #ffd8cc;
  border-radius: 10px;
  background: #fff8f4;
}

.account-channel-control > div {
  display: grid;
  gap: 4px;
}

.account-channel-control small {
  color: var(--muted);
}

.account-channel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-channel-control select {
  min-width: 168px;
  min-height: 40px;
  padding: 0 36px 0 12px;
  border: 1px solid #ffc7b7;
  border-radius: 8px;
  color: #172033;
  background: #fff;
  font-weight: 800;
}

.account-channel-control button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.account-channel-control button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.account-entitlement-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.account-entitlement-summary article {
  min-height: 82px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf8;
}

.account-entitlement-summary article > span:first-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.account-entitlement-form {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #f5d4ca;
  border-radius: 10px;
  background: #fffaf8;
}

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

.authorization-reason-field {
  grid-column: span 2;
}

.authorization-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
}

.authorization-form-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.account-device-details {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.authorization-package-form,
.authorization-batch-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf8;
}

.authorization-package-form fieldset {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 68px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.authorization-package-form legend {
  color: #384150;
  font-size: 12px;
  font-weight: 800;
}

.authorization-package-form fieldset label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  white-space: nowrap;
}

.authorization-package-form fieldset input {
  width: auto;
  min-height: auto;
}

.authorization-description-field {
  grid-column: span 2;
}

.generated-code-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #bde8d4;
  border-radius: 10px;
  color: #116845;
  background: #effbf5;
}

.generated-code-panel > div {
  display: grid;
  gap: 3px;
}

.generated-code-actions {
  display: flex !important;
  grid-auto-flow: column;
  gap: 8px !important;
}

.generated-code-panel span {
  font-size: 12px;
}

.generated-code-preview {
  margin-top: 6px;
  color: #255b47;
  font-size: 12px;
}

.generated-code-preview > summary {
  cursor: pointer;
  font-weight: 800;
}

.generated-code-preview > div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.generated-code-preview code {
  padding: 4px 7px;
  border-radius: 5px;
  color: #15543b;
  background: rgba(255, 255, 255, .78);
}

.batch-code-records {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

@media (max-width: 1320px) {
  .metric-grid,
  .metric-grid.six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

}

@media (max-width: 1120px) {
  .dashboard-grid,
  .dashboard-grid.two-charts,
  .overview-body-grid,
  .overview-main-grid,
  .overview-diagnostic-grid,
  .overview-secondary-grid,
  .activity-summary-grid,
  .content-grid.two,
  .overview-insights,
  .product-usage-layout {
    grid-template-columns: 1fr;
  }

  .product-usage-total {
    min-height: 150px;
  }

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

  .backup-policy-grid > div:nth-child(3) {
    border-left: 0;
  }

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

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

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    width: 256px;
    transition: transform .2s ease;
  }

  .admin-shell.menu-open .sidebar {
    transform: translateX(0);
  }

  .admin-shell.menu-open .mobile-menu-mask {
    display: block;
  }

  .main {
    padding: 18px 14px 28px;
  }

  .topbar {
    min-height: auto;
    flex-wrap: wrap;
    margin: -18px -14px 18px;
    padding: 12px 14px;
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .search {
    order: 3;
    width: 100%;
  }

  .topbar-actions {
    gap: 8px;
  }

  .admin-profile {
    display: none;
  }

  .page-head {
    display: grid;
    padding: 18px;
  }

  .page-head h1 {
    font-size: 24px;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .metric-grid,
  .metric-grid.six,
  .metric-grid.primary-metrics,
  .module-grid,
  .update-grid,
  .inline-form,
  .form-grid,
  .authorization-toolbar,
  .authorization-package-form,
  .authorization-batch-form,
  .authorization-form-grid {
    grid-template-columns: 1fr;
  }

  .authorization-reason-field,
  .authorization-description-field {
    grid-column: auto;
  }

  .ai-upstream-form .span-2 {
    grid-column: auto;
  }

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

  .authorization-form-footer {
    align-items: stretch;
    flex-direction: column;
  }

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

  .backup-policy-grid {
    grid-template-columns: 1fr;
  }

  .backup-policy-grid > div,
  .backup-policy-grid > div:nth-child(3) {
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .backup-policy-grid > div:first-child {
    border-top: 0;
  }

  .metric-card {
    min-height: 96px;
  }

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

  .scale-item:nth-child(3) {
    border-left: 0;
  }

  .scale-item:nth-child(n + 3) {
    margin-top: 12px;
  }

  .update-actions {
    grid-template-columns: 1fr;
  }

  .member-actions {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .authorization-dialog-mask {
    padding: 8px;
  }

  .authorization-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 18px;
  }

  .account-entitlement-summary {
    grid-template-columns: 1fr;
  }

  .account-detail-actions span:last-child {
    width: 100%;
    margin-left: 0;
  }

  .account-channel-control {
    align-items: stretch;
    flex-direction: column;
  }

  .generated-code-panel,
  .authorization-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid.primary-metrics {
    grid-template-columns: 1fr;
  }

  .license-product-switch button {
    min-height: 54px;
    display: grid;
    gap: 2px;
    padding: 6px 4px;
  }

  .license-product-switch span {
    font-size: 12px;
  }

  .license-product-switch small {
    min-width: 0;
    padding: 0;
    background: transparent;
    font-size: 10px;
  }

  .license-product-switch button.active small {
    color: #fff;
  }

  .preview-label {
    margin: 8px 0 0;
  }

  .product-usage-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .authorization-switch-grid {
    grid-template-columns: 1fr;
  }

  .authorization-switch,
  .authorization-switch:first-child {
    min-height: 76px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .authorization-switch:first-child {
    border-top: 0;
  }

  .authorization-detail-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .authorization-detail-title .authorization-detail-controls {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .authorization-detail-controls select {
    width: 100%;
  }

  .recent-device-row {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .recent-device-meta {
    grid-column: 2;
    max-width: none;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
