:root {
  --bg: #f4efe7;
  --ink: #201510;
  --muted: #78675b;
  --line: rgba(67, 47, 35, 0.12);
  --panel: rgba(255, 250, 245, 0.86);
  --panel-strong: #fffaf4;
  --accent: #b65422;
  --accent-deep: #8c3f17;
  --accent-soft: rgba(182, 84, 34, 0.14);
  --green-soft: rgba(23, 110, 88, 0.12);
  --shadow: 0 22px 52px rgba(53, 34, 22, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(234, 188, 137, 0.4), transparent 34%),
    linear-gradient(180deg, #fbf4eb 0%, #f1e6d8 100%);
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.message-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 24px));
}

.message-toast {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 18px;
  background: rgba(255, 250, 245, 0.94);
  box-shadow: 0 18px 40px rgba(48, 31, 20, 0.14);
  color: var(--ink);
  line-height: 1.5;
  animation: toast-in 180ms ease-out;
}

.message-toast.success {
  background: rgba(242, 251, 246, 0.96);
  border-color: rgba(33, 122, 98, 0.18);
}

.message-toast.error {
  background: rgba(255, 244, 239, 0.96);
  border-color: rgba(178, 73, 32, 0.2);
}

.message-toast.fade-out {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.page-shell {
  width: min(1260px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-side,
.auth-panel,
.workspace {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 34px;
}

.hero-copy-wide {
  grid-column: 1 / -1;
}

.hero-kicker,
.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-copy h1,
.section-head h2 {
  margin: 14px 0 12px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.08;
}

.hero-copy p,
.card-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.step-card,
.notice-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.step-card {
  padding: 18px;
}

.step-card strong,
.notice-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.step-card span,
.notice-card p {
  color: var(--muted);
  line-height: 1.65;
}

.step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.step-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(182, 84, 34, 0.24);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255, 250, 245, 0.74);
  color: var(--accent-deep);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.step-link:hover {
  background: rgba(255, 244, 233, 0.94);
  transform: translateY(-1px);
}

.app-link {
  display: none;
}

.hero-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

.admin-link {
  align-self: flex-end;
  color: var(--accent-deep);
  text-decoration: none;
  font-weight: 600;
}

.notice-card {
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 244, 233, 0.95));
}

.notice-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.portal-layout {
  display: grid;
  gap: 24px;
}

.auth-panel,
.workspace {
  padding: 28px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.section-head h2 {
  font-size: 32px;
  margin: 10px 0 0;
}

.ghost-btn,
.primary-btn {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.auth-form,
.binding-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.code-btn {
  white-space: nowrap;
  min-width: 116px;
}

.compact-btn {
  min-width: 72px;
  white-space: nowrap;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  font-weight: 600;
}

label small {
  color: var(--muted);
  line-height: 1.5;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(101, 78, 63, 0.14);
  border-radius: 16px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(182, 84, 34, 0.55);
  box-shadow: 0 0 0 4px rgba(182, 84, 34, 0.12);
}

.wide {
  width: 100%;
}

.primary-btn {
  padding: 13px 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff7f2;
}

.ghost-btn {
  padding: 12px 18px;
  background: rgba(126, 95, 76, 0.08);
  color: var(--ink);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn:disabled,
.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.primary-btn.is-loading {
  position: relative;
  padding-left: 42px;
}

.primary-btn.is-loading::before {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255, 247, 242, 0.46);
  border-top-color: #fff7f2;
  border-radius: 50%;
  content: "";
  animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.2fr);
  gap: 18px;
}

.panel-card {
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 22px;
}

.card-head {
  margin-bottom: 18px;
}

.card-head h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.inline-actions,
.account-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-badge {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--green-soft);
}

.user-badge span {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.empty {
  text-align: center;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.mini-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}

.mini-btn.edit {
  background: rgba(23, 110, 88, 0.12);
  color: #156d58;
}

.mini-btn.deactivate {
  background: rgba(73, 90, 120, 0.12);
  color: #465a78;
}

.mini-btn.delete {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.mini-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 21, 16, 0.34);
  backdrop-filter: blur(6px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: 24px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.modal-head h3 {
  margin: 8px 0 0;
  font-size: 24px;
}

.modal-copy {
  margin: 14px 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(126, 95, 76, 0.1);
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.reason-list {
  display: grid;
  gap: 10px;
}

.reason-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
}

.reason-option input {
  width: auto;
  margin-top: 4px;
}

.reason-option strong,
.reason-option small {
  display: block;
}

.reason-option small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .hero,
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: calc(100% - 16px);
    padding: 12px 0 28px;
  }

  .message-stack {
    top: 10px;
    right: 8px;
    left: 8px;
    width: auto;
  }

  .hero {
    gap: 12px;
    margin-bottom: 14px;
  }

  .hero-copy,
  .hero-side,
  .auth-panel,
  .workspace {
    border-radius: 18px;
    padding: 16px;
  }

  .hero-copy h1 {
    margin-top: 10px;
    font-size: 30px;
    line-height: 1.16;
  }

  .hero-copy p,
  .card-head p,
  label small {
    line-height: 1.58;
  }

  .hero-steps {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 18px;
  }

  .step-card,
  .notice-card {
    border-radius: 16px;
  }

  .step-card {
    padding: 14px;
  }

  .step-card strong,
  .notice-card strong {
    font-size: 16px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .section-head h2 {
    font-size: 26px;
    line-height: 1.18;
  }

  .account-actions,
  .inline-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .account-actions .ghost-btn,
  .inline-actions .ghost-btn,
  .inline-actions .primary-btn,
  .user-badge {
    width: 100%;
  }

  .workspace-grid,
  .auth-form,
  .binding-form {
    gap: 14px;
  }

  .panel-card {
    border-radius: 16px;
    padding: 16px;
  }

  .card-head h3 {
    font-size: 20px;
  }

  input,
  select,
  .ghost-btn,
  .primary-btn {
    min-height: 46px;
  }

  .code-row {
    grid-template-columns: 1fr;
  }

  .select-row {
    grid-template-columns: 1fr;
  }

  .code-btn,
  .compact-btn {
    width: 100%;
  }

  .list-card .table-wrap {
    overflow: visible;
  }

  .list-card table,
  .list-card thead,
  .list-card tbody,
  .list-card tr,
  .list-card td {
    display: block;
  }

  .list-card thead {
    display: none;
  }

  .list-card tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.66);
    padding: 10px 12px;
  }

  .list-card tr:last-child {
    margin-bottom: 0;
  }

  .list-card td {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border-bottom: 0;
    padding: 8px 0;
    word-break: break-word;
  }

  .list-card td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 13px;
    font-weight: 700;
  }

  .list-card td[data-label="操作"] {
    grid-template-columns: 1fr;
  }

  .list-card td[data-label="操作"]::before {
    display: none;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .mini-btn {
    min-height: 40px;
    width: 100%;
  }

  .modal-dialog {
    max-height: calc(100vh - 28px);
    overflow-y: auto;
    border-radius: 18px;
    padding: 18px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .step-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .step-link {
    width: 100%;
  }

  .app-link {
    display: inline-flex;
  }
}

@media (max-width: 420px) {
  .page-shell {
    width: calc(100% - 12px);
  }

  .hero-copy,
  .hero-side,
  .auth-panel,
  .workspace,
  .panel-card {
    padding: 14px;
  }

  .hero-copy h1 {
    font-size: 27px;
  }

  .list-card td {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .row-actions {
    grid-template-columns: 1fr;
  }
}
