:root {
  color-scheme: light;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #182230;
  background: #f5f7fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f7fb;
}

a {
  color: #2563eb;
  text-decoration: none;
}

.link-button {
  padding: 0;
  color: #2563eb;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.inline-form {
  display: inline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.brand {
  font-size: 18px;
  font-weight: 700;
}

.container {
  width: min(1120px, calc(100% - 40px));
  margin: 40px auto;
}

.card {
  padding: 24px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.login-card {
  width: min(420px, calc(100% - 40px));
  margin: 80px auto;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  color: #ffffff;
  background: #2563eb;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.muted {
  color: #64748b;
}

.status {
  display: inline-block;
  padding: 5px 10px;
  color: #166534;
  background: #dcfce7;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.errorlist {
  margin: 7px 0 0;
  padding-left: 18px;
  color: #b91c1c;
  font-size: 13px;
}

.page-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 34px auto 60px;
}

.page-heading,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-heading {
  align-items: center;
  margin-bottom: 24px;
}

.page-heading h1,
.panel-heading h2 {
  margin: 6px 0 8px;
}

.page-heading h1 {
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.03em;
}

.panel-heading h2 {
  font-size: 20px;
}

.eyebrow {
  color: #2563eb;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.button-secondary {
  color: #334155;
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

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

.metric-card,
.panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.045);
}

.metric-card {
  display: grid;
  gap: 8px;
  padding: 20px 22px;
}

.metric-card span {
  color: #64748b;
  font-size: 14px;
}

.metric-card strong {
  font-size: 29px;
}

.metric-card small,
.table-note,
.help-text {
  color: #94a3b8;
}

.metric-status {
  color: #15803d;
  font-size: 22px !important;
}

.management-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 24px;
}

.create-panel {
  position: sticky;
  top: 20px;
}

.table-wrap {
  margin-top: 20px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 12px 14px;
  color: #64748b;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 600;
}

td {
  padding: 16px 14px;
  border-top: 1px solid #eef2f7;
  font-size: 14px;
  vertical-align: middle;
}

td:first-child,
th:first-child {
  border-radius: 9px 0 0 9px;
}

td:last-child,
th:last-child {
  border-radius: 0 9px 9px 0;
}

.table-note,
.account-name {
  display: block;
}

.table-note {
  margin-top: 4px;
  font-size: 12px;
}

.status-muted {
  color: #475569;
  background: #e2e8f0;
}

.empty-state {
  margin-top: 20px;
  padding: 48px 20px;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  text-align: center;
}

.empty-state strong {
  color: #334155;
}

.step-badge {
  display: inline-flex;
  padding: 4px 8px;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.create-panel form {
  margin-top: 22px;
}

.field select {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font: inherit;
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(37, 99, 235, 0.14);
  border-color: #2563eb;
}

.help-text {
  display: block;
  margin-top: 7px;
  font-size: 12px;
}

.button-block {
  width: 100%;
}

.info-box {
  margin-top: 18px;
  padding: 15px;
  color: #475569;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
}

.info-box p {
  margin: 5px 0 0;
}

.dashboard-actions {
  margin-top: 22px;
}

.dashboard-progress {
  max-width: 620px;
  margin-top: 24px;
}

.progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.progress-heading h2 {
  margin: 12px 0 0;
}

.progress-track {
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  background: #e2e8f0;
  border-radius: 999px;
}

.progress-track span {
  display: block;
  min-width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.onboarding-shell {
  max-width: 920px;
}

.onboarding-summary {
  margin-bottom: 18px;
}

.progress-number {
  color: #2563eb;
  font-size: 34px;
}

.progress-track-large {
  height: 13px;
  margin: 22px 0 18px;
}

.onboarding-list {
  display: grid;
  gap: 12px;
}

.onboarding-step {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 19px 22px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

.onboarding-step-link {
  color: inherit;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.035);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.onboarding-step-link:hover {
  border-color: #93c5fd;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

.onboarding-step-link:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.onboarding-step-locked {
  opacity: 0.68;
}

.onboarding-step.is-complete {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.step-number {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 50%;
  font-weight: 700;
}

.is-complete .step-number {
  color: #166534;
  background: #dcfce7;
}

.step-copy h2 {
  margin: 0 0 6px;
  font-size: 17px;
}

.step-copy p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.6;
}

.step-state {
  padding: 5px 10px;
  color: #475569;
  background: #e2e8f0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.step-state.complete {
  color: #166534;
  background: #dcfce7;
}

.provider-card {
  padding: 28px;
}

.provider-heading {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.provider-heading h2 {
  margin: 10px 0 7px;
}

.provider-heading p {
  margin: 0;
}

.provider-icon {
  display: grid;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  place-items: center;
  color: #ffffff;
  background: #2563eb;
  border-radius: 15px;
  font-size: 24px;
  font-weight: 800;
}

.setup-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 26px;
}

.setup-preview div {
  display: grid;
  gap: 7px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
}

.setup-preview span {
  color: #64748b;
  font-size: 12px;
}

.authorization-panel,
.connection-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding: 20px;
  border-radius: 12px;
}

.authorization-panel {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.authorization-panel h3,
.connection-result h3 {
  margin: 8px 0 5px;
}

.authorization-panel p,
.connection-result p {
  margin: 0;
  line-height: 1.6;
}

.connection-result.is-connected {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.connection-result.needs-config {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.developer-checklist {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.developer-checklist > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.developer-checklist > div > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 50%;
  font-weight: 700;
}

.developer-checklist p {
  display: grid;
  gap: 4px;
  margin: 0;
}

.developer-checklist small {
  color: #64748b;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.web-login-panel {
  border-color: #c8d9ff;
  background: linear-gradient(135deg, #f7faff 0%, #eef5ff 100%);
}

.advanced-setup {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fafbfc;
}

.advanced-setup summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
}

.advanced-setup p {
  margin: 10px 0 0;
}

.advanced-setup .button {
  margin-top: 12px;
}

.qr-login-panel {
  align-items: stretch;
}

.qr-frame {
  display: grid;
  flex: 0 0 220px;
  width: 220px;
  min-height: 220px;
  place-items: center;
  padding: 10px;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
}

.qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder {
  color: #64748b;
  font-size: 14px;
}

.login-live-status {
  margin-top: 14px !important;
  color: #1d4ed8;
  font-weight: 700;
}

.retry-login-form {
  margin-top: 12px;
  text-align: right;
}

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

.plan-card {
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 18px;
  text-align: left;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  cursor: pointer;
  font: inherit;
}

.plan-card:hover {
  border-color: #93c5fd;
  background: #f0f7ff;
}

.plan-card.is-selected {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.plan-card strong {
  font-size: 16px;
}

.plan-card .plan-badge {
  justify-self: start;
  padding: 4px 9px;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.plan-card .plan-model {
  color: #334155;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.plan-card small {
  color: #64748b;
  line-height: 1.55;
}

.field-block {
  margin-top: 20px;
}

.field-block label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.field-block .text-input {
  width: 100%;
  max-width: 560px;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font: inherit;
}

.field-block .text-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  border-color: #2563eb;
}

.field-block .muted {
  margin: 8px 0 0;
  font-size: 13px;
}

.error-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #b91c1c;
}

.error-list li {
  margin: 3px 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

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

.rule-card {
  display: grid;
  gap: 9px;
  padding: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
}

.rule-card label {
  font-weight: 700;
}

.rule-card .muted {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.rule-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-input .text-input {
  width: 110px;
  max-width: 110px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.rule-input span {
  color: #64748b;
  font-weight: 600;
}

.check-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.check-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
}

.check-item input {
  flex: 0 0 auto;
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

.check-item span {
  display: grid;
  gap: 4px;
}

.check-item small {
  color: #64748b;
  line-height: 1.5;
}

.image-toggle-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.image-toggle-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  cursor: pointer;
}

.image-toggle-card:has(input:checked) {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.image-toggle-card input {
  flex: 0 0 auto;
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

.image-toggle-card span {
  display: grid;
  gap: 4px;
}

.image-toggle-card small {
  color: #64748b;
  line-height: 1.5;
}

.text-area {
  display: block;
  max-width: 720px;
  resize: vertical;
  line-height: 1.6;
}

.weekday-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.weekday-card {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.weekday-card:has(input:checked) {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.weekday-card input {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
}

.e2e-list {
  margin-top: 22px;
}

.e2e-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.e2e-item span {
  display: grid;
  gap: 4px;
}

.e2e-item small {
  color: #64748b;
  line-height: 1.5;
}

.e2e-status {
  display: grid !important;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  font-weight: 700;
}

.e2e-ok .e2e-status {
  color: #166534;
  background: #dcfce7;
}

.e2e-missing .e2e-status {
  color: #b91c1c;
  background: #fee2e2;
}

.e2e-pending .e2e-status {
  color: #92400e;
  background: #fef3c7;
}

.nav-tabs {
  display: flex;
  gap: 8px;
  margin: 22px 0;
}

.nav-tab {
  padding: 9px 16px;
  color: #475569;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-weight: 600;
}

.nav-tab.is-active {
  color: #ffffff;
  background: #2563eb;
  border-color: #2563eb;
}

.table-card {
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  padding: 13px 16px;
  text-align: left;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f5f9;
}

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

.status-chip {
  display: inline-block;
  padding: 4px 9px;
  color: #475569;
  background: #f1f5f9;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.lesson-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.lesson-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.lesson-item span {
  display: grid;
  gap: 2px;
}

.lesson-item small {
  color: #64748b;
}

.lesson-position {
  display: grid !important;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 50%;
  font-weight: 700;
}

.batch-card {
  margin-top: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.batch-card > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.batch-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.batch-card li {
  margin: 4px 0;
  font-size: 14px;
}

.batch-card li small {
  margin-left: 6px;
  color: #64748b;
}

@media (max-width: 900px) {
  .management-grid {
    grid-template-columns: 1fr;
  }

  .create-panel {
    position: static;
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding: 0 18px;
  }

  .page-shell {
    width: min(100% - 24px, 1240px);
    margin-top: 22px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .panel {
    padding: 18px;
  }

  .onboarding-step {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 17px;
  }

  .step-state {
    grid-column: 2;
    justify-self: start;
  }

  .setup-preview {
    grid-template-columns: 1fr;
  }

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

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

  .image-toggle-group {
    grid-template-columns: 1fr;
  }

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

  .authorization-panel,
  .connection-result {
    align-items: flex-start;
    flex-direction: column;
  }

  .qr-frame {
    width: 100%;
    max-width: 260px;
  }
}
