:root {
  --ink: #17211f;
  --muted: #64716d;
  --paper: #f7f5ef;
  --white: #ffffff;
  --jade: #176c64;
  --jade-dark: #0f4d48;
  --rose: #b66b74;
  --gold: #bd9252;
  --line: rgba(23, 33, 31, 0.13);
  --danger: #b42318;
  --ok: #176c64;
  --shadow: 0 18px 54px rgba(31, 42, 38, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    -apple-system,
    sans-serif;
  line-height: 1.55;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(23, 108, 100, 0.12), transparent 44%),
    var(--paper);
}

.login-panel {
  width: min(100%, 460px);
  padding: 34px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
}

.login-panel p:not(.eyebrow),
.message {
  color: var(--muted);
}

.login-panel form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: #34413e;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfbf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(23, 108, 100, 0.48);
  box-shadow: 0 0 0 3px rgba(23, 108, 100, 0.1);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
}

.button.primary {
  color: var(--white);
  background: var(--jade);
}

.button.primary:hover {
  background: var(--jade-dark);
}

.button.secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  border-color: var(--line);
}

.button.danger {
  color: var(--white);
  background: var(--danger);
}

.dashboard-view {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 22px;
  background: #123d39;
  color: var(--white);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: 0 0 42px;
  color: var(--jade);
  font-weight: 900;
  background: var(--white);
  border-radius: 8px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: rgba(255, 255, 255, 0.7);
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.admin-nav button {
  min-height: 44px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.admin-nav button.active,
.admin-nav button:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
}

#logoutButton {
  margin-top: auto;
}

.workspace {
  min-width: 0;
  padding: clamp(18px, 4vw, 40px);
}

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

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.notice {
  min-height: 24px;
  margin-bottom: 14px;
  color: var(--ok);
  font-weight: 700;
}

.notice.error {
  color: var(--danger);
}

.content-panel {
  display: grid;
  grid-template-columns: minmax(250px, 0.38fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.list-panel,
.editor-panel,
.settings-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 34px rgba(31, 42, 38, 0.08);
}

.list-panel {
  overflow: hidden;
}

.list-toolbar {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.item-list {
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.item-card {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 14px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.item-card.active {
  background: #eef7f5;
}

.item-card strong {
  font-size: 15px;
}

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

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: #2f403c;
  font-size: 12px;
  background: #f1f4f1;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pill.off {
  color: var(--danger);
  background: #fff2f0;
}

.editor-panel {
  padding: 18px;
}

.settings-panel {
  max-width: 860px;
  padding: 18px;
}

.editor-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.editor-form .wide {
  grid-column: 1 / -1;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
}

.image-tools {
  display: grid;
  gap: 10px;
}

.image-preview {
  overflow: hidden;
  width: 180px;
  height: 112px;
  background: #f1f4f1;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-column: 1 / -1;
  margin-top: 4px;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .admin-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .admin-nav button {
    text-align: center;
  }

  .content-panel {
    grid-template-columns: 1fr;
  }

  .item-list {
    max-height: 320px;
  }
}

@media (max-width: 680px) {
  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions,
  .button {
    width: 100%;
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-form {
    grid-template-columns: 1fr;
  }
}
