:root {
  --bg: #fff;
  --paper: rgba(255, 255, 255, 0.82);
  --paper-soft: #f8fbfc;
  --ink: #3f4b51;
  --muted: #8d979c;
  --line: rgba(42, 170, 188, 0.22);
  --accent: #27a8ba;
  --accent-dark: #168799;
  --danger: #c94b4b;
  --success: #2e7d32;
  --shadow: 0 14px 42px rgba(39, 168, 186, 0.12), 0 4px 18px rgba(0, 0, 0, 0.05);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 72%, rgba(39, 168, 186, 0.13), transparent 24%),
    radial-gradient(circle at 84% 18%, rgba(255, 205, 210, 0.34), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #f8fcfd 54%, #ffffff 100%);
}

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

button {
  cursor: pointer;
}

.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-content {
  min-width: 0;
}

.gate-shell {
  min-height: 100vh;
  display: grid;
  align-content: center;
}

.hero-panel,
.login-panel,
.admin-sidebar,
.toolbar,
.admin-card,
.empty-state,
.setting-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.admin-sidebar {
  position: sticky;
  top: 24px;
  padding: 18px;
}

.sidebar-brand strong {
  display: block;
  color: var(--accent);
  font-size: 22px;
  line-height: 1.2;
}

.sidebar-menu {
  display: grid;
  gap: 8px;
  margin: 22px 0;
}

.sidebar-menu-btn {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
  transition: all 0.2s ease;
}

.sidebar-menu-btn:hover,
.sidebar-menu-btn.active {
  border-color: var(--line);
  background: rgba(39, 168, 186, 0.1);
  color: var(--accent);
}

.sidebar-actions {
  display: grid;
  gap: 10px;
}

.sidebar-actions .home-link,
.logout-btn {
  width: 100%;
  min-height: 44px;
}

.hero-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  right: -58px;
  bottom: -80px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(39, 168, 186, 0.09);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 620px;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.15;
  text-shadow: 0 2px 0 rgba(39, 168, 186, 0.1);
}

.hero-copy {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.home-link,
.logout-btn,
.login-form button,
.filters button,
.security-actions button,
.card-actions button {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 12px 18px;
  box-shadow: 0 8px 22px rgba(39, 168, 186, 0.18);
}

.logout-btn {
  border: 1px solid rgba(201, 75, 75, 0.24);
  border-radius: 999px;
  background: rgba(201, 75, 75, 0.08);
  color: var(--danger);
  font-weight: 800;
  box-shadow: none;
}

.home-link:hover,
.logout-btn:hover,
.login-form button:hover,
.filters button:hover,
.security-actions button:hover,
.card-actions button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.logout-btn:hover {
  background: rgba(201, 75, 75, 0.14);
  color: #a83b3b;
  box-shadow: 0 8px 22px rgba(201, 75, 75, 0.12);
}

.login-panel {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 22px;
  margin-top: 20px;
  padding: 22px;
}

.gate-panel {
  align-items: center;
}

.login-panel h2,
.empty-state h2 {
  margin-bottom: 8px;
}

.login-panel p,
.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.login-error {
  display: none;
  margin-top: 10px;
  color: var(--danger) !important;
  font-weight: 800;
}

.login-error.show {
  display: block;
}

.login-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-form input,
.filters input,
.filters select,
.meta-row input,
.meta-row select,
.setting-fields input,
.card-extra input,
.card-extra textarea,
.content-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  background: var(--paper-soft);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input,
.filters input,
.filters select {
  min-height: 46px;
  padding: 0 14px;
}

.login-form input:focus,
.filters input:focus,
.filters select:focus,
.meta-row input:focus,
.meta-row select:focus,
.setting-fields input:focus,
.card-extra input:focus,
.card-extra textarea:focus,
.content-input:focus {
  border-color: rgba(39, 168, 186, 0.5);
  box-shadow: 0 0 0 4px rgba(39, 168, 186, 0.09);
}

.login-form button,
.filters button {
  min-height: 46px;
  padding: 0 18px;
  white-space: nowrap;
}

.dashboard {
  margin-top: 22px;
}

.toolbar {
  padding: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-card {
  padding: 16px;
  border: 1px solid rgba(42, 170, 188, 0.12);
  border-radius: 14px;
  background: rgba(248, 251, 252, 0.78);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 30px;
  line-height: 1;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px auto;
  gap: 10px;
  margin-top: 14px;
}

.quiet-btn {
  background: rgba(36, 50, 53, 0.12);
  color: var(--ink);
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.admin-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.9fr) 130px;
  gap: 16px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.admin-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 7px;
  height: 100%;
  background: linear-gradient(180deg, #c8e6c9, #bbdefb);
}

.card-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.card-main,
.card-extra,
.card-actions {
  position: relative;
  z-index: 1;
}

.type-pill,
.visibility-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 800;
}

.type-pill {
  background: rgba(39, 168, 186, 0.1);
  color: var(--accent);
}

.visibility-pill {
  background: rgba(59, 138, 95, 0.12);
  color: var(--success);
}

.visibility-pill.hidden {
  background: rgba(201, 75, 75, 0.12);
  color: var(--danger);
}

.content-input {
  min-height: 94px;
  padding: 14px;
  resize: vertical;
  line-height: 1.7;
  background:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.78)),
    linear-gradient(180deg, transparent 31px, rgba(39, 168, 186, 0.08) 32px);
  background-size: auto, 100% 32px;
}

.meta-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.meta-row input,
.meta-row select,
.setting-fields input,
.card-extra input,
.card-extra textarea {
  min-height: 40px;
  padding: 9px 11px;
}

.card-extra {
  display: grid;
  gap: 10px;
}

.card-extra textarea {
  min-height: 74px;
  resize: vertical;
  line-height: 1.6;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-actions button {
  min-height: 40px;
  padding: 0 14px;
}

.card-actions .toggle-approve-btn.hide {
  background: #d1842f;
}

.card-actions .detail-btn {
  background: rgba(39, 168, 186, 0.1);
  color: var(--accent);
  border: 1px solid rgba(39, 168, 186, 0.24);
}

.card-actions .detail-btn:hover {
  background: rgba(39, 168, 186, 0.16);
  color: var(--accent-dark);
  box-shadow: none;
}

.card-actions .delete-btn {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(201, 75, 75, 0.35);
}

.card-actions .delete-btn:hover {
  background: rgba(201, 75, 75, 0.1);
  box-shadow: none;
}

.empty-state {
  margin-top: 18px;
  padding: 46px 20px;
  text-align: center;
}

.security-panel {
  margin-top: 22px;
}

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

.setting-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  padding: 20px;
}

.setting-card h2 {
  margin-bottom: 8px;
  color: var(--accent);
}

.setting-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.setting-fields {
  display: grid;
  gap: 12px;
}

.setting-fields.wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setting-fields.wide .switch-control,
.setting-fields.wide label:last-child {
  grid-column: 1 / -1;
}

.switch-control {
  --switch-w: 54px;
  --switch-h: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: var(--switch-w);
  height: var(--switch-h);
  flex: 0 0 var(--switch-w);
  border: 1px solid rgba(42, 170, 188, 0.2);
  border-radius: 999px;
  background: #e9f3f5;
  box-shadow: inset 0 2px 6px rgba(63, 75, 81, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 10px rgba(63, 75, 81, 0.18);
  transition: transform 0.22s ease;
}

.switch-control input:checked + .switch-track {
  border-color: rgba(39, 168, 186, 0.56);
  background: linear-gradient(135deg, var(--accent), #5ec9d7);
  box-shadow: 0 8px 18px rgba(39, 168, 186, 0.18);
}

.switch-control input:checked + .switch-track::after {
  transform: translateX(24px);
}

.switch-control input:focus-visible + .switch-track {
  box-shadow: 0 0 0 4px rgba(39, 168, 186, 0.14);
}

.switch-text {
  color: var(--ink);
  font-weight: 800;
}

.security-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.security-actions button {
  min-height: 44px;
  padding: 0 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(36, 50, 53, 0.92);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

  .admin-sidebar {
    position: static;
  }

  .sidebar-menu,
  .sidebar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-panel,
  .admin-card,
  .setting-card {
    grid-template-columns: 1fr;
  }

  .card-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .admin-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero-panel {
    display: block;
    padding: 24px;
  }

  .home-link {
    display: inline-flex;
    margin-top: 18px;
  }

  .login-form,
  .filters {
    grid-template-columns: 1fr;
    display: grid;
  }

  .stats-grid,
  .meta-row,
  .setting-fields.wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  .stats-grid,
  .meta-row,
  .setting-fields.wide,
  .sidebar-menu,
  .sidebar-actions {
    grid-template-columns: 1fr;
  }
}
