:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --text: #20231f;
  --muted: #687064;
  --line: #dfe4db;
  --accent: #176b5b;
  --accent-strong: #0f4d42;
  --warn: #9b4b20;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}
body.admin {
  background:
    linear-gradient(180deg, #f8faf6 0%, #eef4ed 100%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
.site-header, .site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(24px, calc((100vw - 1120px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.admin .site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(16, 35, 28, .06);
}
.site-footer { border-top: 1px solid var(--line); border-bottom: 0; margin-top: 48px; }
.brand { font-weight: 800; color: var(--text); }
.admin .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}
.admin .brand::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(23,107,91,.12);
}
nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.site-main { width: min(1120px, calc(100% - 32px)); margin: 32px auto; }
.admin nav a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 3px 6px;
}
.admin nav a:hover {
  background: #eef6f2;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
  gap: 28px;
  align-items: end;
  padding: 42px 0;
}
.hero h1, .section-head h1, .article h1 { line-height: 1.15; margin: 0 0 12px; }
.hero h1 { font-size: clamp(2rem, 5vw, 4.4rem); max-width: 780px; }
.eyebrow { margin: 0 0 8px; color: var(--warn); font-weight: 700; font-size: .82rem; text-transform: uppercase; }
.search-box, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.admin .panel {
  box-shadow: 0 10px 24px rgba(25, 43, 35, .04);
}
.search-box { display: flex; gap: 8px; }
.search-box.compact { width: min(520px, 100%); }
input, textarea, select, button, .button {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  font: inherit;
}
input[type="checkbox"] {
  width: auto;
  min-height: 0;
  padding: 0;
}
input.bulk-check {
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  border: 1.5px solid #aab8ad;
  border-radius: 4px;
  background: #fff;
  vertical-align: middle;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
input.bulk-check:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23,107,91,.10);
}
input.bulk-check:checked {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11.6 3.4 5.8 9.9 2.5 6.8' fill='none' stroke='white' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
}
input.bulk-check:indeterminate {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: linear-gradient(#fff, #fff);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 10px 2px;
}
textarea { resize: vertical; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
}
.danger { background: #9f2d20; border-color: #9f2d20; }
.help { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }
.button.small { min-height: 34px; padding: 6px 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.card div { padding: 16px; }
.card h3 { margin: 0 0 8px; line-height: 1.3; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.article { width: min(820px, 100%); margin: 0 auto; }
.meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); margin-bottom: 18px; }
.featured { width: 100%; border-radius: 8px; margin: 10px 0 24px; }
.prose p { margin: 0 0 1em; }
.prose h2, .prose h3 { margin-top: 1.6em; line-height: 1.25; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.stats strong { display: block; font-size: 2rem; line-height: 1; }
.stats span { color: var(--muted); }
.form, .form-grid { display: grid; gap: 14px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-row input, .form-row select { width: auto; min-width: 160px; flex: 1; }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.auth-panel { width: min(420px, 100%); margin: 8vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.notice { background: #fff7db; border: 1px solid #eed184; border-radius: 8px; padding: 12px; margin-bottom: 18px; }
.inline-form { display: inline; }
.inline-form button { min-height: 32px; padding: 4px 9px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #eef1ea;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
}
.status-sent, .status-completed { background: #e4f4ed; color: #126044; }
.status-published, .status-running, .status-processing { background: #e8f0ff; color: #254d9a; }
.status-review, .status-pending { background: #fff8e5; color: #8b4b12; }
.status-failed { background: #fff1ef; color: #9f2d20; }
.status-paused { background: #f0f0f0; color: #565c54; }
.status-unused { background: #fff8e5; color: #8b4b12; }
.status-used { background: #e4f4ed; color: #126044; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 12px 10px; vertical-align: top; }
th { background: #e8eee5; color: #17382f; font-size: .9rem; }
.admin tbody tr:hover {
  background: #f7fbf8;
}
.admin table { font-size: .95rem; }
.admin th { white-space: nowrap; }
.admin td small { color: var(--muted); word-break: break-word; }
.url-cell { max-width: 360px; word-break: break-all; }
.action-row { display: flex; gap: 12px; margin-top: 16px; }
.pagination { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.modal {
  width: min(640px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.modal::backdrop { background: rgba(0,0,0,.36); }
.send-box { margin-top: 8px; }
.send-box summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.send-box form { margin-top: 8px; min-width: 220px; }
.upload-box { width: 100%; }
.upload-box summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.upload-image-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff !important;
  font-size: .98rem;
}
.create-image-button {
  min-height: 28px !important;
  padding: 3px 7px !important;
  font-size: .82rem;
}
.random-image-button {
  min-height: 34px !important;
  padding: 6px 10px !important;
  background: #2463a6;
  border-color: #2463a6;
}
.random-image-button:hover {
  background: #1d4f85;
  border-color: #1d4f85;
}
.upload-box form { margin-top: 8px; min-width: 220px; }
.upload-box input[type="file"] { width: 100%; min-width: 0; }
.compact-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
}
.bulk-time-field {
  min-width: 220px;
  flex: 1;
}
.bulk-time-field input {
  min-width: 210px;
}
.compact-label input { width: 100%; min-width: 0; }
.task-progress {
  border: 1px solid #eed184;
  border-radius: 8px;
  background: #fff8e5;
  color: #8b4b12;
  padding: 10px 12px;
  font-weight: 700;
}
.stats-compact { margin-bottom: 22px; }
.batch-panel {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.batch-counter { color: var(--muted); font-weight: 800; }
.progress-shell {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece6;
}
.progress-bar {
  height: 100%;
  min-width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f6b5a, #2bb98d);
  transition: width .35s ease;
}
.field-group {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.field-group legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 800;
}
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.checkbox-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(110px, 150px));
}
.check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}
.check-option input {
  width: 16px;
  height: 16px;
  min-width: 16px;
  accent-color: var(--accent);
}
.empty { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.content-table th:first-child,
.content-table td:first-child {
  width: 44px;
  min-width: 44px;
  text-align: center;
}
.content-table th:nth-child(2),
.content-table td:nth-child(2) {
  width: 92px;
}
.thumb-cell { min-width: 92px; }
.content-thumb {
  width: 76px;
  height: 48px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef1ea;
}
.image-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  min-height: 34px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}
.image-status.media-progress { color: var(--warn); background: #fff8e5; border-style: solid; }
.image-status.failed { color: #9f2d20; background: #fff1ef; border-style: solid; }
.link-toggle {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  justify-content: flex-start;
  text-align: left;
  font-weight: 700;
}
.link-toggle:hover { color: var(--accent); }
.toggle-icon {
  display: inline-block;
  width: 1.2em;
  color: var(--accent);
}
.content-hi-row { background: #fbfcfa; }
.content-hi-row td { border-top: 0; }
.content-row-sent { background: #f2fbf6; }
.content-row-sent td { border-bottom-color: #cfe7d8; }
.content-row-published { background: #f3f7ff; }
.content-row-unsent { background: #fffdf7; }
.review-cell { min-width: 150px; }
.review-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}
.review-low { background: #e8f7ee; color: #116137; }
.review-medium { background: #fff4d8; color: #8b4b12; }
.review-high { background: #ffe6e0; color: #9f2d20; }
.danger-text { color: #9f2d20 !important; font-weight: 800; }
.review-panel ul { margin-top: 8px; }
.actions-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  min-width: 230px;
}
.actions-cell .send-box { width: 100%; margin-top: 0; }
.gallery-upload { margin-bottom: 16px; }
.gallery-table th:first-child,
.gallery-table td:first-child { width: 142px; }
.gallery-thumb {
  width: 128px;
  height: 72px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef1ea;
}
.gallery-row-unused { background: #fffdf7; }
.gallery-row-used { background: #f2fbf6; }
.gallery-row-paused { background: #f6f6f4; color: #596057; }

@media (max-width: 760px) {
  .site-header, .site-footer, .section-head, .hero { display: block; }
  nav { margin-top: 12px; }
  .search-box { margin-top: 16px; }
  table { display: block; overflow-x: auto; }
}
