:root {
  --bg: #f4f7fb;
  --ink: #14213d;
  --muted: #63738d;
  --line: rgba(20, 33, 61, 0.12);
  --brand: #1268b3;
  --brand-dark: #0b3f74;
  --accent: #21a67a;
  --danger: #c83b3b;
  --surface: #ffffff;
  --shadow: 0 24px 70px rgba(18, 47, 83, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  font-weight: 800;
  cursor: pointer;
}

button.ghost,
.topbar-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(18, 104, 179, 0.22);
  border-radius: 7px;
  color: var(--brand-dark);
  background: rgba(18, 104, 179, 0.07);
  font-weight: 800;
  text-decoration: none;
}

input,
textarea {
  width: 100%;
  margin-top: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: rgba(18, 104, 179, 0.65);
  box-shadow: 0 0 0 3px rgba(18, 104, 179, 0.12);
}

label {
  display: block;
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 800;
}

.mono {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(14, 34, 61, 0.9), rgba(18, 104, 179, 0.72)),
    url("/assets/banner-backdrop.jpg") center / cover;
}

.login-card {
  width: min(420px, 100%);
  padding: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card form button {
  width: 100%;
  margin-top: 22px;
}

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

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 104, 179, 0.06);
}

.auth-tab {
  min-height: 36px;
  color: var(--brand-dark);
  background: transparent;
  box-shadow: none;
}

.auth-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px;
  align-items: end;
}

.code-row input,
.code-row button {
  margin-top: 7px;
}

.code-row button {
  min-height: 45px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  font-weight: 900;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row strong {
  color: var(--brand-dark);
  font-size: 18px;
}

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

.dashboard-view {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar .brand-row {
  margin-bottom: 0;
}

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

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--brand-dark);
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.user-center {
  margin-bottom: 14px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.profile-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  font-size: 20px;
  font-weight: 900;
}

.user-center h1,
.user-help h2 {
  margin: 0;
  color: var(--brand-dark);
}

.user-center p,
.user-help p {
  margin: 10px 0 0;
  color: var(--muted);
}

.user-help .token-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(18, 104, 179, 0.22);
  border-radius: 7px;
  color: var(--brand-dark);
  background: rgba(18, 104, 179, 0.07);
  font-weight: 800;
  text-decoration: none;
}

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

.summary-grid article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 35px rgba(18, 47, 83, 0.06);
}

.summary-grid article {
  padding: 18px 20px;
}

.summary-grid span,
.panel-head p,
.records-head p,
#tokenMeta {
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  color: var(--brand-dark);
  font-size: 34px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 14px;
}

.panel {
  padding: 22px;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h1,
.panel-head h2,
.records-head h2 {
  margin: 0;
  color: var(--brand-dark);
  line-height: 1.15;
}

.panel-head h1 {
  font-size: 28px;
}

.panel-head h2,
.records-head h2 {
  font-size: 22px;
}

.panel-head p,
.records-head p {
  margin: 7px 0 0;
}

.issue-form {
  display: grid;
  gap: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
}

.check-row input {
  width: auto;
  margin: 0;
}

.token-panel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.token-box {
  min-height: 310px;
  flex: 1;
  resize: vertical;
  word-break: break-all;
}

.token-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.records-panel {
  margin-top: 14px;
}

.records-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.records-head input {
  max-width: 320px;
  margin-top: 0;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--brand-dark);
  font-size: 13px;
}

td {
  color: var(--ink);
  font-size: 14px;
}

.status {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--brand-dark);
  background: rgba(18, 104, 179, 0.09);
  font-size: 12px;
  font-weight: 800;
}

.status.revoked,
.status.disabled {
  color: var(--danger);
  background: rgba(200, 59, 59, 0.1);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

dialog {
  width: min(760px, calc(100% - 30px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(8, 24, 43, 0.45);
}

dialog form {
  padding: 22px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dialog-head h2 {
  margin: 0;
}

.dialog-head button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--brand-dark);
  background: rgba(18, 104, 179, 0.08);
}

.detail-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 14px;
}

.detail-grid b {
  color: var(--brand-dark);
}

.detail-token {
  min-height: 130px;
  margin-top: 14px;
}

@media (max-width: 980px) {
  .workspace,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .records-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .records-head input {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .dashboard-view {
    width: min(100% - 24px, 1320px);
    padding-top: 18px;
  }

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

  .panel {
    padding: 18px;
  }

  .token-actions,
  .topbar-actions {
    flex-direction: column;
  }

  .code-row {
    grid-template-columns: 1fr;
  }

  .token-actions button,
  .topbar-actions a,
  .topbar-actions button {
    width: 100%;
  }
}
