:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --line: #dce3eb;
  --line-soft: #e8edf3;
  --text: #17202a;
  --muted: #647386;
  --sidebar: #121a24;
  --sidebar-soft: #1c2734;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --primary-soft: #e6f5f2;
  --accent: #c58a16;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --success: #17623f;
  --success-soft: #e8f4ee;
  --warning: #8a5a00;
  --warning-soft: #fff7df;
  --shadow: 0 16px 40px rgba(18, 26, 36, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

.login-root,
.login-root body.login-page {
  height: 100%;
  overflow: hidden;
}

.login-page {
  height: 100dvh;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 18%, rgba(15, 118, 110, 0.12), transparent 28%),
    linear-gradient(135deg, #f6f8fb 0%, #edf2f7 48%, #f8fafc 100%);
}

.login-shell {
  height: 100dvh;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: hidden;
}

.login-card {
  width: min(430px, 100%);
  max-height: calc(100dvh - 44px);
  overflow: auto;
  padding: 28px;
  border: 1px solid rgba(220, 227, 235, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(18, 26, 36, 0.16);
}

.login-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand {
  margin-bottom: 24px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: linear-gradient(135deg, #f1c84b, #d99b19);
  color: #111827;
  font-weight: 800;
}

.login-brand strong,
.login-brand small,
.brand strong,
.brand small {
  display: block;
}

.login-brand small,
.brand small {
  margin-top: 3px;
  color: var(--muted);
}

.login-card h1 {
  margin: 0 0 18px;
  font-size: 24px;
  line-height: 1.25;
}

.login-form,
form {
  display: grid;
  gap: 14px;
  max-width: 440px;
}

.login-form {
  max-width: none;
}

.login-card .hint {
  margin: 0 0 18px;
}

.login-card code {
  word-break: break-all;
}

.qr-panel {
  display: grid;
  place-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-muted);
}

.qr-panel svg {
  width: min(220px, 100%);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: linear-gradient(180deg, var(--sidebar), #0e151d);
  color: #fff;
  overflow-y: auto;
}

.brand {
  margin-bottom: 28px;
  padding: 0 4px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand small {
  color: #9eacba;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 7px;
  color: #d8e0ea;
  text-decoration: none;
  font-weight: 700;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav a:hover,
.nav a.active {
  background: var(--sidebar-soft);
  color: #fff;
}

.nav a.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.content {
  min-width: 0;
  padding: 28px;
}

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

.topbar h1 {
  margin: 5px 0 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

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

.account-menu {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-height: 38px;
  border: 1px solid #d7e5e2;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 22px rgba(18, 26, 36, 0.06);
  overflow: hidden;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--success);
  font-weight: 800;
}

.account-menu .status-pill {
  border-radius: 0;
}

.account-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(23, 98, 63, 0.12);
}

.logout-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-left: 1px solid #d7e5e2;
  color: var(--primary-dark);
  font-weight: 800;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease;
}

.logout-link:hover {
  background: var(--primary);
  color: #fff;
}

.panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

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

.summary-grid article {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
}

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

.summary-grid.compact article {
  padding: 14px 16px;
}

.summary-grid span,
.summary-grid small {
  display: block;
  color: var(--muted);
}

.summary-grid strong {
  display: block;
  margin: 8px 0;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.compact strong {
  font-size: 18px;
  line-height: 1.25;
}

.section-title {
  margin-bottom: 18px;
}

.section-title h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
}

.section-title p,
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.steps div {
  min-height: 94px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-muted);
}

.steps b {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
}

.steps span {
  display: block;
  font-weight: 800;
}

label {
  display: grid;
  gap: 7px;
  color: #263442;
  font-weight: 800;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

input[readonly] {
  background: #f8fafc;
  color: #52667a;
}

button,
.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover,
.primary-action:hover {
  background: var(--primary-dark);
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.2);
}

button:active,
.primary-action:active {
  transform: translateY(1px);
}

.success,
.danger {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 800;
}

.success {
  border: 1px solid #b7dfcc;
  background: var(--success-soft);
  color: var(--success);
}

.danger {
  border: 1px solid #ffd0cc;
  background: var(--danger-soft);
  color: var(--danger);
}

.action-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.action-form {
  display: block;
  max-width: none;
}

.hint,
.empty-state {
  border: 1px dashed #c9d3df;
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-muted);
}

.hint {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.hint code {
  color: #334155;
  white-space: normal;
  overflow-wrap: anywhere;
}

.empty-state {
  margin-top: 16px;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.error-list {
  margin: 0;
  padding-left: 20px;
  color: var(--danger);
}

.list-title {
  margin-top: 28px;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 12px 11px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

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

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fafc;
  color: #56667a;
  font-size: 13px;
  font-weight: 800;
}

.data-table tbody tr {
  background: #fff;
}

.data-table tbody tr:hover {
  background: #f8fbfb;
}

.data-table a,
.button-link {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-top: 18px;
  margin-right: 14px;
}

.secondary-link {
  color: #52667a;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.link-button {
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid #cfe2dc;
  border-radius: 7px;
  color: var(--primary);
  background: #f4fbf9;
  font-weight: 800;
  box-shadow: none;
}

.link-button:hover {
  color: #fff;
  background: var(--primary);
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid #cfe2dc;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 800;
  white-space: nowrap;
}

.badge.status-success {
  border-color: #b7dfcc;
  background: #ecfdf4;
  color: #087443;
}

.badge.status-failed {
  border-color: #ffc9c2;
  background: #fff1ef;
  color: #b42318;
}

.badge.status-warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #b45309;
}

.badge.status-processing {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.badge.status-pending {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #475569;
}

.badge.status-neutral {
  border-color: #d7dee8;
  background: #f4f6f8;
  color: #52667a;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
}

.pagination a,
.pagination strong {
  min-width: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}

.pagination a {
  color: var(--text);
  background: #fff;
}

.pagination strong {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.54);
  backdrop-filter: blur(3px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(540px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.28);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #52667a;
  background: #f4f6f8;
  font-size: 22px;
  line-height: 1;
  box-shadow: none;
}

.icon-button:hover {
  color: var(--text);
  background: #e9eef4;
  box-shadow: none;
}

body.modal-open {
  overflow: hidden;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

  .brand {
    margin-bottom: 14px;
    padding-bottom: 14px;
  }

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

  .content {
    padding: 20px;
  }
}

@media (max-width: 720px) {
  .login-shell {
    padding: 14px;
  }

  .login-card {
    max-height: calc(100dvh - 28px);
    padding: 22px;
  }

  .topbar,
  .action-title {
    display: grid;
  }

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

  .summary-grid,
  .steps {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
  }

  .nav {
    grid-template-columns: 1fr;
  }
}
