:root {
  color-scheme: light;
  --page: #eef4ef;
  --surface: #ffffff;
  --surface-soft: #f6faf7;
  --ink: #111914;
  --muted: #637267;
  --line: #d6e1d8;
  --green: #167a43;
  --green-dark: #102318;
  --mint: #baf0cf;
  --orange: #ff7324;
  --danger: #d83b2d;
  --shadow: 0 24px 60px rgba(22, 44, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #e4e8e4;
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

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

.admin-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  width: min(100%, 1440px);
  margin: 0 auto;
  background: var(--page);
}

.side {
  display: flex;
  flex-direction: column;
  gap: 34px;
  padding: 36px 28px;
  background: var(--green-dark);
  color: #ffffff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 20px;
  font-weight: 900;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--mint);
  color: var(--green-dark);
}

.side-nav {
  display: grid;
  gap: 10px;
}

.side-nav a {
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.side-nav a.active,
.side-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.side-note {
  margin: auto 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  line-height: 1.7;
}

.main-panel {
  display: grid;
  gap: 22px;
  align-content: start;
  padding: 36px clamp(20px, 4vw, 56px);
}

.topbar,
.section-head,
.actions,
.topbar-actions,
.new-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(186, 240, 207, 0.45), transparent 34%),
    var(--page);
}

.login-card {
  display: grid;
  gap: 22px;
  width: min(100%, 520px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  color: var(--ink);
}

.login-card h1 {
  font-size: clamp(34px, 6vw, 52px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.2;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.panel {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.connection-panel {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 18px;
  align-items: end;
}

.backup-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 122, 67, 0.13);
}

textarea {
  min-height: 112px;
  padding-top: 12px;
  resize: vertical;
  line-height: 1.55;
}

input:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.row-checkbox {
  display: block;
  width: 22px;
  min-height: 22px;
  height: 22px;
  margin: 0 auto;
  padding: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.license-checkbox {
  outline: 2px solid #bfd8c7;
  outline-offset: 2px;
}

.primary-button,
.ghost-button,
.text-button,
.danger-button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.primary-button {
  padding: 0 22px;
  background: var(--green-dark);
  color: #ffffff;
}

.ghost-button {
  padding: 0 18px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--green-dark);
}

.text-button {
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

.danger-button {
  min-height: 36px;
  padding: 0 14px;
  background: #fff0ee;
  color: var(--danger);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.create-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.password-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  gap: 16px;
  align-items: end;
  margin-top: 22px;
}

.plugin-update-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.45fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: end;
  margin-top: 22px;
}

.plugin-update-grid .wide {
  grid-column: 1 / -1;
}

.license-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
  margin-top: 22px;
}

.license-plan-admin {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.license-plan-admin > strong {
  color: var(--ink);
  font-size: 15px;
}

.license-plan-admin-header,
.license-plan-admin-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.license-plan-admin-header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.license-plan-admin-rows {
  display: grid;
  gap: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--green-dark);
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--green);
}

.rule-box {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #b9e7c9;
  border-radius: 14px;
  background: #effbf3;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.rule-box strong {
  color: var(--green-dark);
  font-size: 14px;
}

.helper-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(140px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-top: 20px;
}

.audit-filter-grid {
  grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr) auto;
}

.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.bulk-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.wide {
  grid-column: span 2;
}

.new-code-box {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #b9e7c9;
  border-radius: 18px;
  background: #effbf3;
}

.new-code-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.new-code-input {
  flex: 1;
  min-width: 260px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  margin-right: auto;
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 900;
  letter-spacing: 0;
}

.new-code-input:focus {
  border: 0;
  box-shadow: none;
}

.hidden {
  display: none;
}

.disabled-field {
  opacity: 0.62;
}

.summary-text {
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
}

.table-wrap {
  margin-top: 20px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.device-panel {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
  background: #ffffff;
  table-layout: fixed;
}

.license-table .select-col {
  width: 58px;
}

.license-table .prefix-col {
  width: 148px;
}

.license-table .status-col {
  width: 82px;
}

.license-table .type-col,
.license-table .device-col {
  width: 74px;
}

.license-table .date-col {
  width: 122px;
}

.license-table .notice-col,
.license-table .note-col {
  width: 170px;
}

.license-table .action-col {
  width: 150px;
}

.audit-table {
  min-width: 980px;
}

.audit-table .audit-date-col {
  width: 150px;
}

.audit-table .audit-action-col,
.audit-table .audit-actor-col {
  width: 130px;
}

.audit-table .audit-target-col {
  width: 160px;
}

.audit-pill {
  background: #eef4ef;
  color: var(--green-dark);
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

td {
  word-break: break-word;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.pill-active {
  background: #e5f8ec;
  color: var(--green);
}

.pill-banned {
  background: #fff0ee;
  color: var(--danger);
}

.empty {
  padding: 40px 16px;
  color: var(--muted);
  text-align: center;
}

.status-text {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.status-text[data-type="error"] {
  color: var(--danger);
}

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

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 126px;
}

.compact-button {
  min-height: 36px;
  padding: 0 10px;
}

code {
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  word-break: break-all;
}

.prefix-note {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

  .side {
    gap: 20px;
  }

  .side-nav {
    display: flex;
    flex-wrap: wrap;
  }

  .connection-panel,
  .backup-panel,
  .create-grid,
  .plugin-update-grid,
  .license-page-grid,
  .password-grid,
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .backup-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .main-panel,
  .side {
    padding: 24px 18px;
  }

  .topbar,
  .section-head,
  .new-code-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .connection-panel,
  .backup-panel,
  .create-grid,
  .plugin-update-grid,
  .license-page-grid,
  .password-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }
}
