:root {
  --bg: #f4f4f5;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --line: #e4e4e7;
  --text: #111827;
  --muted: #6b7280;
  --black: #0a0a0a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, #ffffff 0%, #f3f4f6 35%, #eceef1 100%);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.admin-page {
  min-height: 100vh;
  padding: 24px;
}

.login-shell,
.admin-shell {
  width: min(1160px, 100%);
  margin: 0 auto;
}

.login-shell {
  max-width: 440px;
  display: grid;
  place-items: center;
  min-height: calc(100vh - 48px);
}

.panel {
  background: linear-gradient(180deg, #fff 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.login-panel {
  width: 100%;
  padding: 24px;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 28px);
}

h2 {
  margin: 0 0 12px;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
}

.stack-form {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: #27272a;
}

.field-title {
  font-size: 14px;
  color: #27272a;
  margin-bottom: 8px;
}

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

.choice-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 6px 10px;
  cursor: pointer;
}

.choice-chip input {
  width: auto;
  height: auto;
}

.hidden {
  display: none;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 40px;
  padding: 0 12px;
  outline: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="file"] {
  padding: 8px;
  height: auto;
}

input:focus {
  border-color: #52525b;
  box-shadow: 0 0 0 3px rgba(82, 82, 91, 0.2);
}

.btn {
  border: 1px solid #d4d4d8;
  border-radius: 10px;
  background: #fff;
  color: #18181b;
  height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

.btn.primary {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.btn.danger {
  border-color: #3f3f46;
  background: #27272a;
  color: #fff;
}

.admin-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.tabs-shell {
  margin-top: 14px;
  padding: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 6px;
  overflow-x: auto;
}

.tab {
  text-decoration: none;
  color: #3f3f46;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 14px;
  white-space: nowrap;
}

.tab.active {
  color: #111;
  background: #f3f4f6;
  border-color: var(--line);
}

.tab-content {
  display: none;
  padding: 18px 6px 10px;
}

.tab-content.show {
  display: block;
}

.action-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.action-row .btn {
  min-width: 72px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.helper {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 12px;
}

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  border: 1px solid #d4d4d8;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: #111;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: #a1a1aa;
}

.toast.error {
  border-color: #71717a;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.34);
  padding: 14px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(700px, 100%);
  max-height: calc(100vh - 28px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

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

th {
  color: #52525b;
  font-weight: 600;
}

td a {
  color: #111;
}

.link-cell a {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted {
  color: #71717a;
}

.alert {
  margin-top: 12px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid;
}

.alert.success {
  border-color: #a1a1aa;
  background: #f4f4f5;
  color: #27272a;
}

.alert.error {
  border-color: #a1a1aa;
  background: #fafafa;
  color: #111;
}

@media (max-width: 740px) {
  .admin-page {
    padding: 12px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
  }

  .tabs-shell {
    padding: 10px;
  }

  .tab-content {
    padding: 14px 2px 8px;
  }

  .stack-form {
    gap: 12px;
  }

  .btn,
  input {
    min-height: 42px;
  }

  .table-wrap {
    border: none;
    background: transparent;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  }

  td {
    border: none;
    padding: 6px 0;
    font-size: 13px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
  }

  td::before {
    content: attr(data-label);
    flex: 0 0 64px;
    font-size: 12px;
    color: #71717a;
    line-height: 1.5;
  }

  .link-cell a {
    white-space: normal;
    word-break: break-all;
    overflow: visible;
    text-overflow: unset;
  }

  .action-row {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--line);
  }

  .action-row .btn {
    flex: 1;
    min-width: 0;
  }
}
