:root {
  --ink: #111820;
  --muted: #697586;
  --line: rgba(17, 24, 32, .12);
  --soft-line: rgba(17, 24, 32, .1);
  --blue: #ff5a4e;
  --blue-soft: rgba(255, 90, 78, .1);
  --bg: #f6f7f9;
  --card: #ffffff;
  --danger: #c4334f;
  --shadow: 0 18px 48px rgba(17, 24, 32, .07);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #fff, var(--bg));
}
input, textarea, select, button { font: inherit; }
a { color: inherit; text-decoration: none; }
button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #111820;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 18px;
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  margin: 11vh auto;
  padding: 30px;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}
.login-card img { width: 62px; height: 62px; border-radius: 18px; object-fit: cover; }
.login-card p { color: var(--muted); }
.login-card input,
.login-card button {
  width: 100%;
  height: 46px;
  margin-top: 12px;
  border-radius: 13px;
}
.login-card input { border: 1px solid var(--line); padding: 0 12px; }

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.admin-brand img {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  object-fit: cover;
}
.admin-brand div { display: grid; gap: 2px; min-width: 0; }
.admin-brand b { white-space: nowrap; }
.admin-brand span {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-topbar nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-topbar a, .front-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 999px;
  color: #111820;
  background: var(--blue-soft);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.admin-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  width: min(1440px, calc(100vw - 32px));
  margin: 22px auto 60px;
}
.admin-sidebar {
  position: sticky;
  top: 84px;
  align-self: start;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 104px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}
.admin-sidebar a {
  display: grid;
  gap: 4px;
  padding: 12px 13px;
  border-radius: 12px;
  color: #3f4c63;
}
.admin-sidebar a:hover,
.admin-sidebar a.active {
  color: #fff;
  background: #111820;
}
.admin-sidebar small {
  color: inherit;
  opacity: .74;
  line-height: 1.45;
  font-size: 12px;
}

.admin-content { min-width: 0; }
.admin-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 18px;
}
.admin-page-head span {
  color: #ff5a4e;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}
.admin-page-head h1 {
  margin: 6px 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  font-weight: 900;
}
.admin-page-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.panel {
  margin: 18px 0;
  padding: 22px;
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 10px; }
.cms-focus-panel {
  border-top: 5px solid #ff5a4e;
}
.hint {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.75;
}
.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.form-divider {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--blue);
  font-weight: 900;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.stack-form {
  display: grid;
  gap: 16px;
}
.editor-card {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  border-left: 4px solid rgba(255, 90, 78, .36);
}
.new-entry-card {
  display: none;
  border-style: dashed;
  background: #f8fbff;
}
.new-entry-card.is-visible {
  display: block;
}
legend {
  padding: 0 8px;
  color: #ff5a4e;
  font-weight: 900;
}
label { display: grid; gap: 6px; min-width: 0; }
label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
input, textarea, select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  padding: 10px 11px;
}
textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.65;
}
select {
  min-height: 42px;
}
.wide { grid-column: 1 / -1; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}
.check input { width: auto; }
.check.danger { color: var(--danger); }
.stack-form > button,
.admin-form > button,
.danger-zone button {
  width: fit-content;
  margin-top: 4px;
}
.secondary-btn {
  color: #111820;
  background: var(--blue-soft);
}

.alert {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
}
.alert.ok { color: #176451; background: #e8fff8; }
.alert.error { color: #a2263d; background: #fff0f3; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-grid article {
  padding: 20px;
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  border-top: 4px solid #ff5a4e;
}
.stat-grid b {
  display: block;
  font-size: 34px;
  color: #111820;
}
.stat-grid span {
  color: var(--muted);
  font-weight: 800;
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.quick-grid a {
  padding: 14px;
  border-radius: 14px;
  background: var(--blue-soft);
  color: #111820;
  font-weight: 900;
  border: 1px solid rgba(255, 90, 78, .18);
}
.quick-grid a:hover,
.front-link:hover,
.admin-topbar a:hover {
  color: #fff;
  background: #111820;
}
.editor-card legend {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danger-zone textarea {
  width: 100%;
  min-height: 520px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

@media (max-width: 980px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .admin-topbar,
  .admin-page-head,
  .panel-title-row,
  .row-actions {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-topbar nav { width: 100%; }
  .admin-topbar a, .front-link, .secondary-btn { width: 100%; }
  .admin-layout { width: min(100% - 20px, 1440px); }
  .admin-sidebar,
  .admin-form,
  .quick-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .panel { padding: 16px; }
  .stack-form > button,
  .admin-form > button,
  .danger-zone button {
    width: 100%;
  }
}
