:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #121821;
  --muted: #5f6b7c;
  --line: #d8e0e8;
  --soft: #edf3f4;
  --accent: #087465;
  --accent-strong: #07564d;
  --gold: #b88931;
  --danger: #b42318;
  --blue: #2453df;
  --shadow: 0 18px 48px rgba(18, 24, 33, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #f9fbfc 0%, #eef4f5 54%, #f6f2e8 100%);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.brand.compact {
  padding: 8px 6px 20px;
}

.brand.compact img {
  width: 34px;
  height: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.lead,
.notice {
  color: var(--muted);
  line-height: 1.7;
}

.login-view {
  width: min(680px, calc(100vw - 64px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 42px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

.login-panel,
.login-aside,
.panel,
.metric-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  width: 100%;
  padding: 36px;
}

.login-panel .brand {
  margin-bottom: 34px;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 116, 101, 0.14);
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.inline-code {
  margin: -6px 0 0;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.button,
.icon-button {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 800;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  white-space: nowrap;
}

.button-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.button-primary:hover {
  background: var(--accent-strong);
}

.button-secondary {
  color: var(--accent-strong);
  background: #fff;
  border-color: var(--line);
}

.button-danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.login-button {
  width: 100%;
}

.login-aside {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.login-aside div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.login-aside span,
.metric-card span,
.account-details dt {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-aside strong,
.metric-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 24px;
}

.login-aside small,
.metric-card small {
  color: var(--muted);
  line-height: 1.6;
}

.console-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav button {
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-weight: 800;
}

.side-nav button:hover,
.side-nav button.is-active {
  color: var(--accent-strong);
  border-color: var(--line);
  background: #fff;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -22px -22px 20px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 248, 0.9);
  backdrop-filter: blur(18px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.account-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.ok {
  color: var(--accent-strong);
  background: #e7f7f2;
  border-color: #bce4d8;
}

.status-pill.warn {
  color: #8a5a16;
  background: #fff5dc;
  border-color: #efd99b;
}

.status-pill.danger {
  color: var(--danger);
  background: #fff0ee;
  border-color: #f0b5ad;
}

.icon-button {
  width: 40px;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.section-stack {
  display: grid;
  gap: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  padding: 18px;
  box-shadow: 0 10px 28px rgba(18, 24, 33, 0.08);
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(18, 24, 33, 0.08);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.mini-list,
.device-list,
.plan-list {
  display: grid;
  gap: 10px;
}

.mini-item,
.device-item,
.plan-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-item strong,
.device-item strong,
.plan-item strong {
  font-size: 15px;
}

.mini-item span,
.device-item span,
.plan-item span {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(4, minmax(120px, 0.7fr)) auto auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(18, 24, 33, 0.06);
}

.export-image-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  background: #fff;
  white-space: nowrap;
}

.export-image-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  word-break: break-word;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  background: #f7fafb;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.pager-size select {
  width: auto;
  min-width: 76px;
  padding: 8px 10px;
}

.button[aria-busy="true"] {
  cursor: wait;
  opacity: 0.72;
}

.quota-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.quota-meter {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.quota-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 180ms ease;
}

.account-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.account-details div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.account-details dd {
  margin: 0;
  font-weight: 800;
}

.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.password-form .button {
  min-height: 42px;
}

.password-status {
  grid-column: 1 / -1;
  margin: 0;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  background: rgba(18, 24, 33, 0.34);
}

.drawer {
  width: min(680px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 20px;
  background: #fff;
  box-shadow: -18px 0 48px rgba(18, 24, 33, 0.16);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.drawer-meta div {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.drawer-meta span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.drawer-meta strong {
  font-size: 13px;
}

pre {
  white-space: pre-wrap;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #f8fafb;
  line-height: 1.65;
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

figure {
  margin: 0;
}

figcaption {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.screenshot-box {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafb;
}

.screenshot-box img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.screenshot-box img.is-previewable {
  cursor: zoom-in;
}

.screenshot-box img.is-previewable:focus-visible {
  outline: 3px solid rgba(29, 122, 94, 0.34);
  outline-offset: 3px;
}

html.preview-lock,
body.preview-lock {
  overflow: hidden;
}

.image-preview {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 16px;
}

.image-preview[hidden] {
  display: none;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.84);
  cursor: zoom-out;
  backdrop-filter: blur(2px);
}

.image-preview img {
  position: relative;
  z-index: 1;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  object-fit: contain;
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 24px 90px rgba(15, 23, 42, 0.44);
}

.image-preview-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(15, 23, 42, 0.72);
}

html.export-lock,
body.export-lock {
  overflow: hidden;
}

.export-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(14, 20, 30, 0.56);
  backdrop-filter: blur(4px);
  cursor: wait;
}

.export-overlay-card {
  display: grid;
  width: min(360px, 100%);
  justify-items: center;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  color: #14202d;
  text-align: center;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(18, 24, 33, 0.24);
}

.export-overlay-card strong {
  font-size: 18px;
}

.export-overlay-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.export-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #d7e2df;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: export-spin 0.8s linear infinite;
}

@keyframes export-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .metric-grid,
  .split-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .login-view,
  .console-view {
    grid-template-columns: 1fr;
  }

  .login-view {
    width: min(680px, calc(100vw - 32px));
    align-items: start;
  }

  .login-panel {
    width: 100%;
    max-width: 100%;
    padding: 32px 24px;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side-nav button {
    text-align: center;
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    position: static;
    margin: -14px -14px 14px;
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .split-grid,
  .account-details,
  .password-form,
  .drawer-meta,
  .screenshot-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .code-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-view {
    width: 100%;
    justify-items: center;
    margin: 0;
    padding: 42px 16px;
  }

  .login-panel {
    width: min(680px, calc(100vw - 64px));
    max-width: 680px;
    min-width: 0;
    padding: 32px 24px;
  }
}
