:root {
  color-scheme: light;
  --ink: #17221f;
  --muted: #66716d;
  --paper: #f4f1e9;
  --panel: #fffdf7;
  --line: #d9d4c8;
  --green: #1f5b45;
  --green-light: #dfece4;
  --orange: #d66b36;
  --red: #a33d32;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mobile-only { display: none; }
.topbar {
  min-height: 150px; padding: 34px clamp(20px, 5vw, 76px);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  color: white; background: linear-gradient(125deg, #143b30, #1f5b45 58%, #927048);
}
.topbar h1 { margin: 4px 0 0; font: 700 clamp(30px, 5vw, 54px)/1.05 Georgia, serif; }
.topbar h1 span { font: 500 18px/1 sans-serif; opacity: .75; }
.eyebrow { margin: 0; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; opacity: .72; }
.top-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs {
  padding: 0 clamp(20px, 5vw, 76px); display: flex; gap: 8px;
  background: #173f33; border-top: 1px solid rgba(255,255,255,.12);
}
.tabs button {
  padding: 14px 18px; color: rgba(255,255,255,.72); background: none; border: 0;
  border-bottom: 3px solid transparent;
}
.tabs button.active { color: white; border-color: #e6b36d; }
main { padding: 28px clamp(16px, 4vw, 64px) 60px; }
.summary { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric { padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.metric strong { display: block; font: 700 28px/1 Georgia, serif; color: var(--green); }
.metric span { font-size: 12px; color: var(--muted); }
.view { display: none; }
.view.active { display: grid; }
#view-albums { grid-template-columns: minmax(250px, 330px) 1fr; gap: 18px; align-items: start; }
.panel, .editor, .album-sidebar {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 10px 30px rgba(37, 48, 43, .06);
}
.panel { padding: clamp(18px, 3vw, 32px); }
.album-sidebar { position: sticky; top: 12px; overflow: hidden; }
.search-row { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.search-row input { min-width: 0; flex: 1; }
input, textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  color: var(--ink); background: white;
}
textarea { min-height: 140px; resize: vertical; line-height: 1.65; }
.album-list { max-height: calc(100vh - 280px); overflow: auto; }
.album-row {
  width: 100%; padding: 14px; text-align: left; background: transparent; border: 0;
  border-bottom: 1px solid #ebe7df;
}
.album-row:hover, .album-row.active { background: var(--green-light); }
.album-row strong { display: block; }
.album-row small { color: var(--muted); }
.editor { min-width: 0; padding: clamp(18px, 3vw, 34px); }
.editor.empty { min-height: 440px; display: grid; place-items: center; }
.empty-state { color: var(--muted); text-align: center; }
.editor-head, .section-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.editor-head h2, .section-head h2 { margin: 3px 0 0; font: 700 30px/1.15 Georgia, serif; }
.status { padding: 6px 9px; border-radius: 999px; font-size: 12px; background: #eee9de; }
.status.published, .job-succeeded { color: var(--green); background: var(--green-light); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 22px 0; }
.form-grid label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.form-grid .wide { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px;
  color: var(--ink); background: white; text-decoration: none;
}
.button:hover { border-color: #9f998e; }
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button.danger { color: var(--red); }
.button.ghost { color: white; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.3); }
.button.small { padding: 6px 8px; font-size: 12px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.media-section { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.media-section h3 { margin-bottom: 5px; }
.media-grid, .reference-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 12px; margin-top: 14px;
}
.media-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white; }
.media-card.cover { outline: 3px solid #e1a653; }
.media-card.dragging { opacity: .45; }
.media-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #e9e5dc; }
.media-meta { padding: 8px; font-size: 11px; color: var(--muted); }
.media-actions { display: flex; gap: 5px; padding: 0 8px 9px; flex-wrap: wrap; }
.draft-card { margin: 12px 0; padding: 14px; border-left: 4px solid #d7a25c; background: #fbf3e6; border-radius: 8px; }
.draft-card p { line-height: 1.65; }
.drop-zone {
  margin: 22px 0; padding: 50px 20px; text-align: center; color: var(--muted);
  border: 2px dashed #b9b2a5; border-radius: 14px;
}
.drop-zone.drag { color: var(--green); border-color: var(--green); background: var(--green-light); }
.file-button input { display: none; }
.upload-item, .job-row, .trash-row {
  display: grid; grid-template-columns: minmax(160px, 1fr) auto; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid #ebe7df;
}
.upload-item progress { width: 100%; }
.upload-item.error { color: var(--red); }
.split-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 22px; }
.reference-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 9px; }
.reference-card.negative { opacity: .72; filter: saturate(.75); }
.job-failed { color: var(--red); }
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 360px;
  padding: 12px 16px; color: white; background: #17221f; border-radius: 10px;
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s;
}
.toast.show { opacity: 1; transform: none; }
.mobile-tabbar { display: none; }

@media (max-width: 900px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  #view-albums { grid-template-columns: 1fr; }
  .album-sidebar { position: static; }
  .album-list { max-height: 300px; }
  .split-panels { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  main { padding: 18px 12px 24px; }
  .topbar {
    min-height: 132px;
    padding: calc(20px + env(safe-area-inset-top)) 16px 18px;
  }
  .topbar h1 { font-size: 34px; }
  .tabs { display: none; }
  .mobile-only { display: inline-flex; }
  .summary {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
  }
  .metric {
    min-width: 132px;
    scroll-snap-align: start;
  }
  .topbar, .editor-head, .section-head { flex-direction: column; align-items: stretch; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .album-sidebar, .editor, .panel { border-radius: 14px; }
  .album-list { max-height: 42vh; }
  .album-row { padding: 16px 14px; }
  .button { min-height: 42px; }
  .button.small { min-height: 34px; }
  .drop-zone { padding: 36px 14px; }
  .media-actions .button { flex: 1 1 44%; }
  .upload-item, .job-row, .trash-row { grid-template-columns: 1fr; }
  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(23, 34, 31, .96);
    box-shadow: 0 -10px 30px rgba(23, 34, 31, .18);
  }
  .mobile-tabbar button {
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    color: rgba(255,255,255,.68);
    background: transparent;
  }
  .mobile-tabbar button.active {
    color: white;
    background: rgba(255,255,255,.12);
  }
  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    max-width: none;
  }
}

.offline-banner{padding:12px 18px;background:#fbf3e6;border-bottom:1px solid #e6b36d;color:#5b3d18;display:flex;gap:10px;flex-wrap:wrap;justify-content:center}.offline-banner span{color:#775b35}

