﻿:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #18202b;
  --muted: #637083;
  --line: #d8dee6;
  --brand: #157a6e;
  --brand-dark: #0f5f57;
  --accent: #2152d4;
  --danger: #bc3b3b;
  --success: #16774f;
  --warning: #9a6500;
  --soft: #eef5ff;
  --soft-warm: #fff6e5;
  --soft-green: #eaf7f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
}

button:hover { background: var(--brand-dark); }
button.secondary { background: #e7ebf0; color: var(--ink); }
button.secondary:hover { background: #d9e0e8; }
button.danger { background: var(--danger); }
button:disabled { cursor: not-allowed; opacity: .55; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.shell { min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  background: #121826;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #34c2aa;
  color: #082826;
  font-weight: 900;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-link { color: #fff; }

.page {
  width: min(1180px, calc(100vw - 28px));
  margin: 24px auto 48px;
}

.single-column { width: min(960px, calc(100vw - 28px)); }

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-box,
.section,
.stat,
.material-shell,
.material-view,
.empty-view,
.modal-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-box,
.section,
.material-shell,
.material-view,
.empty-view {
  padding: 18px;
}

.login-box {
  width: min(420px, 100%);
  box-shadow: 0 20px 50px rgba(24, 32, 43, .08);
}

.login-box h1,
.material-view h1,
.empty-view h1,
.section h2,
.modal-panel h2 {
  margin: 0;
  font-size: 22px;
}

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0; }

.form { display: grid; gap: 14px; }
.grid { display: grid; gap: 16px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.stat {
  padding: 14px;
}

.stat strong {
  display: block;
  font-size: 24px;
  margin-top: 6px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.tabs button {
  background: #e7ebf0;
  color: var(--ink);
}

.tabs button.active {
  background: var(--brand);
  color: #fff;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  padding: 3px 9px;
  font-size: 12px;
}

.badge-success { background: var(--soft-green); color: var(--success); }
.badge-warn { background: var(--soft-warm); color: var(--warning); }
.badge-muted { background: #edf0f3; color: #5f6975; }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
}

.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.page-size { width: auto; min-width: 88px; }

.material-shell,
.material-view {
  display: grid;
  gap: 16px;
}

.material-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.status-stack {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.preview,
.media-placeholder {
  width: 100%;
  min-height: 260px;
  max-height: 520px;
  border-radius: 8px;
  background: #0f1622;
  object-fit: contain;
}

.media-fit { aspect-ratio: 16 / 9; height: auto; }

.media-placeholder {
  display: grid;
  place-items: center;
  color: #cfd6e1;
}

.meta { font-size: 13px; }

.primary-action { min-width: 144px; }

.material-view > label {
  color: var(--ink);
  font-weight: 700;
}

#publishText {
  color: var(--ink);
  line-height: 1.55;
  background: #fbfcfd;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 30, .42);
}

.modal-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(640px, calc(100vw - 28px));
  transform: translate(-50%, -50%);
  padding: 18px;
  box-shadow: 0 28px 80px rgba(15, 20, 30, .24);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.qr-content {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.qr-image {
  width: 240px;
  height: 240px;
  border: 10px solid #fff;
  background: #fff;
  border-radius: 8px;
}

.qr-link {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(480px, calc(100vw - 36px));
  background: #121826;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
  display: none;
  z-index: 30;
}

.toast.show { display: block; }
.hidden { display: none !important; }

@media (max-width: 860px) {
  body { background: #fff; }

  button {
    min-height: 44px;
    padding: 0 12px;
  }

  .page,
  .single-column {
    width: 100%;
    margin: 0;
  }

  .topbar {
    padding: 12px 14px;
    gap: 10px;
  }

  .brand {
    font-size: 15px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .material-shell {
    border: 0;
    border-radius: 0;
    padding: 0;
    background: #fff;
  }

  .material-view,
  .empty-view {
    border: 0;
    border-radius: 0;
    padding: 14px;
    gap: 12px;
  }

  .material-view h1,
  .empty-view h1 {
    font-size: 20px;
    line-height: 1.25;
  }

  .material-head {
    gap: 10px;
  }

  .status-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .preview,
  .media-placeholder {
    min-height: 0;
    max-height: 58vh;
    border-radius: 8px;
  }

  .media-fit {
    aspect-ratio: auto;
    max-height: 58vh;
    object-fit: contain;
  }

  img.media-fit {
    height: auto;
  }

  video.media-fit {
    width: 100%;
    height: auto;
  }

  #publishText {
    min-height: 112px;
    max-height: 180px;
    font-size: 15px;
  }

  .material-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .material-actions button {
    width: 100%;
    min-width: 0;
  }

  .material-actions .primary-action {
    grid-column: 1 / -1;
    min-height: 48px;
    font-size: 16px;
    font-weight: 700;
  }

  .meta {
    font-size: 12px;
    line-height: 1.5;
  }

  .summary-grid,
  .grid.three { grid-template-columns: 1fr; }

  .topbar,
  .material-head,
  .section-head,
  .list-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-stack { justify-items: start; }
}
