:root {
  --ink: #1e2c32;
  --muted: #65777e;
  --line: #dfe6e6;
  --accent: #17675f;
  --bg: #f3f6f5;
  --side: #132c2e;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    14px/1.55 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a {
  color: var(--accent);
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  padding: 9px 15px;
  border-radius: 5px;
  background: white;
  color: var(--ink);
}
button:hover {
  border-color: var(--accent);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.danger {
  color: #a72e31;
}
.sidebar {
  position: fixed;
  width: 225px;
  inset: 0 auto 0 0;
  background: var(--side);
  padding: 35px 20px;
  color: #dcebea;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.brand {
  font:
    27px Georgia,
    serif;
  letter-spacing: 0.1em;
  color: #fff;
}
.brand small {
  font: 10px Arial;
  display: block;
  letter-spacing: 0.3em;
  margin-top: 6px;
}
.sidebar nav {
  margin-top: 38px;
  display: grid;
  gap: 8px;
}
.sidebar nav button {
  background: none;
  color: #d3dedc;
  text-align: left;
  border-color: transparent;
  padding: 13px 15px;
}
.sidebar nav button.active {
  background: #285052;
  color: #fff;
}
.sidebar .bottom {
  margin-top: auto;
  display: grid;
  gap: 12px;
  font-size: 12px;
}
.sidebar a {
  color: #c9d9d7;
}
.workspace {
  margin-left: 225px;
}
.topbar {
  height: 88px;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 20px 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
}
.topbar small {
  color: var(--muted);
}
main {
  padding: 30px 38px 60px;
  max-width: 1800px;
}
.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.spread {
  justify-content: space-between;
}
.muted {
  color: var(--muted);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 25px;
}
.metric,
.panel {
  padding: 23px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.metric strong {
  font-size: 34px;
  font-weight: 550;
}
.metric small {
  color: var(--muted);
  display: block;
}
.panels {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 22px;
}
.panel h2 {
  margin: 0 0 20px;
  font-size: 16px;
}
.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 50px;
  gap: 10px;
  margin: 13px 0;
  align-items: center;
  font-size: 12px;
}
.bar-row i {
  display: block;
  height: 17px;
  background: #4b8b7b;
  border-radius: 3px;
}
.bar-row .track {
  background: #edf4f1;
  border-radius: 3px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar input {
  max-width: 350px;
  margin: 0;
}
.toolbar select {
  max-width: 200px;
  margin: 0;
}
.toolbar .count {
  margin-left: auto;
  color: var(--muted);
}
input,
textarea,
select {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd7d6;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  margin: 5px 0 16px;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #9ec8bc;
  outline-offset: 1px;
}
input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}
textarea {
  min-height: 120px;
  resize: vertical;
}
.code {
  font:
    12px/1.5 Consolas,
    monospace;
  min-height: 340px;
}
.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th {
  text-align: left;
  background: #eff4f2;
  padding: 13px;
  color: #576d71;
  font-weight: 600;
  white-space: nowrap;
}
td {
  border-top: 1px solid var(--line);
  padding: 12px;
  vertical-align: middle;
}
td img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: #f9f9f9;
}
td .title {
  max-width: 400px;
  display: block;
  font-weight: 500;
}
td .path {
  display: block;
  color: var(--muted);
  max-width: 360px;
  word-break: break-all;
  font-size: 10px;
}
td button {
  padding: 6px 10px;
  font-size: 11px;
}
td.wrap {
  max-width: 360px;
  word-break: break-all;
}
.badge {
  display: inline-block;
  background: #e4f1eb;
  padding: 3px 7px;
  border-radius: 4px;
  color: #32735e;
  font-size: 11px;
}
.badge.off {
  background: #f1e8e6;
  color: #9f544c;
}
.pager {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}
.empty {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}
.notice {
  padding: 13px 17px;
  background: #e7f0ed;
  border-left: 3px solid #428678;
  color: #456663;
  margin-bottom: 23px;
  font-size: 12px;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.media-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 13px;
  min-width: 0;
}
.media-card img,
.media-card video {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: #f1f3f2;
}
.media-card p {
  font-size: 12px;
  overflow-wrap: anywhere;
  max-height: 42px;
  overflow: hidden;
}
.media-card code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: var(--muted);
}
.media-card .row {
  margin-top: 12px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
label {
  font-size: 12px;
  color: #4c6268;
  display: block;
}
.checklabel {
  display: flex;
  align-items: center;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}
.preview {
  width: 100%;
  height: 620px;
  border: 1px solid var(--line);
  background: #fff;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(125deg, #102a2d, #275650);
}
.login .box {
  padding: 44px;
  width: min(440px, 92vw);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 15px 60px #0003;
}
.login .brand {
  color: var(--side);
}
.login h1 {
  margin: 28px 0 5px;
  font-size: 23px;
}
.login p {
  color: var(--muted);
  font-size: 12px;
}
.login button {
  width: 100%;
}
.error {
  color: #b03232 !important;
  white-space: pre-wrap;
}
#editor {
  width: min(950px, 95vw);
  max-height: 92vh;
  overflow: auto;
  border: 0;
  border-radius: 9px;
  padding: 35px;
  background: #fff;
  box-shadow: 0 15px 80px #0006;
}
#editor::backdrop {
  background: #061c2399;
}
#editor h2 {
  margin: 0 0 22px;
  font-size: 21px;
}
.close-editor {
  position: absolute;
  right: 12px;
  top: 10px;
  font-size: 23px;
  border: 0;
  padding: 2px 10px;
}
#toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  z-index: 100;
  background: #183f37;
  color: #fff;
  max-width: 450px;
  padding: 14px 20px;
  border-radius: 5px;
  box-shadow: 0 3px 15px #0003;
  display: none;
}
#toast.error {
  background: #8e3232;
  color: #fff !important;
}
.full {
  grid-column: 1/-1;
}
.versions {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.versions button {
  font-size: 11px;
}
.code small {
  font-size: 11px;
}
@media (max-width: 1000px) {
  .sidebar {
    width: 185px;
  }
  .workspace {
    margin-left: 185px;
  }
  main {
    padding: 23px;
  }
  .media-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .panels {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 650px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 20px;
  }
  .sidebar nav {
    margin: 20px 0 0;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .sidebar nav button {
    padding: 8px;
    font-size: 11px;
  }
  .sidebar .bottom {
    display: none;
  }
  .workspace {
    margin: 0;
  }
  .topbar {
    padding: 17px;
    height: 75px;
  }
  main {
    padding: 17px;
  }
  .media-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .metrics {
    gap: 9px;
  }
  .metric {
    padding: 17px;
  }
  .metric strong {
    font-size: 27px;
  }
  .toolbar .count {
    margin: 0;
  }
  .topbar small {
    display: none;
  }
}
.brand img {
  display: block;
  width: 100%;
  max-width: 290px;
  height: auto;
  background: transparent;
  border-radius: 4px;
}
.brand small {
  letter-spacing: 0.06em;
  font-size: 10px;
}
.asset-picker {
  width: min(1000px, 96vw);
  max-height: 92vh;
  overflow: auto;
  border: 0;
  border-radius: 12px;
  padding: 28px;
}
.asset-picker::backdrop {
  background: #061c23b3;
}
.asset-picker h2 {
  margin-top: 0;
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-height: 180px;
}
.picker-tile {
  padding: 10px;
  min-width: 0;
  position: relative;
  text-align: left;
  border: 2px solid var(--line);
}
.picker-tile.selected {
  border-color: var(--accent);
  background: #e5f3ef;
}
.picker-tile.selected::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  width: 24px;
  height: 24px;
  text-align: center;
}
.picker-tile img,
.picker-tile video {
  width: 100%;
  height: 125px;
  object-fit: contain;
  background: white;
}
.picker-tile span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  overflow-wrap: anywhere;
  margin-top: 8px;
}
.picker-actions {
  position: sticky;
  bottom: -28px;
  background: white;
  border-top: 1px solid var(--line);
  padding: 16px 0;
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.picker-actions span {
  margin-right: auto;
}
.chosen-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 220px));
  gap: 14px;
  margin-bottom: 15px;
}
.chosen-image {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  min-width: 0;
}
.chosen-image img,
.chosen-image video {
  width: 100%;
  height: 145px;
  object-fit: contain;
  background: #f6f7f6;
  display: block;
  margin-bottom: 8px;
}
.chosen-image .row {
  gap: 4px;
  margin-top: 8px;
}
.chosen-image button {
  font-size: 11px;
  padding: 5px 7px;
}
.category-options {
  max-height: 245px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  padding: 10px;
  gap: 8px;
}
.category-option {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 7px;
  background: #f5f8f6;
  border-radius: 5px;
  cursor: pointer;
}
.category-option input {
  flex: 0 0 auto;
  margin: 4px 0 0;
}
.category-option span {
  min-width: 0;
}
.category-option small {
  display: block;
  overflow-wrap: anywhere;
  font-size: 10px;
  color: var(--muted);
}
.nav-choice {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 8px;
  align-items: center;
}
.nav-choice input,
.nav-choice select {
  margin: 5px 0;
  min-width: 0;
}
@media (max-width: 650px) {
  .picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .category-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .asset-picker {
    padding: 18px;
  }
  .picker-actions {
    bottom: -18px;
    flex-wrap: wrap;
  }
  .nav-choice {
    grid-template-columns: 1fr;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
  }
}
.template-asset-preview img,
.template-asset-preview video {
  width: 240px;
  height: 160px;
  object-fit: contain;
  margin: 0 0 12px;
  background: #f5f7f6;
}
.toolbar .location-filter { display: grid; gap: 4px; margin: 0; min-width: 160px; max-width: 260px; }
.location-filter select { width: 100%; margin: 0; }
.location-cell { min-width: 180px; max-width: 320px; }
.location-link { display: inline-block; padding: 3px 7px; margin: 2px 3px 2px 0; font-size: 12px; color: var(--accent); background: #edf5f2; text-align: left; }
