:root {
  --bg: #f9f8f3;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: rgba(26, 26, 26, 0.08);
  --brand: #b8956b;
  --brand-deep: #9a7b56;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC",
    sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
}

.hidden {
  display: none !important;
}

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

.shell__aside {
  background: linear-gradient(180deg, #3d3429 0%, #2a231c 100%);
  color: #f5efe6;
  padding: 28px 0;
  display: flex;
  flex-direction: column;
}

.shell__aside h1 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 20px 8px;
  letter-spacing: 0.06em;
}

.shell__aside p {
  margin: 0 20px 24px;
  font-size: 12px;
  opacity: 0.65;
  line-height: 1.45;
}

.cloud-env-badge {
  margin: -8px 20px 12px;
  font-size: 11px;
  line-height: 1.45;
  opacity: 0.82;
  color: #f5efe6;
  word-break: break-all;
}

.nav-links {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.nav-links li {
  margin: 0;
}

.cloud-env-badge {
  margin: -8px 20px 12px;
  font-size: 11px;
  line-height: 1.45;
  opacity: 0.82;
  color: #f5efe6;
  word-break: break-all;
}

.nav-links button {
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 12px 20px;
  font-size: 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-links button:hover,
.nav-links button.active {
  background: rgba(255, 255, 255, 0.06);
  border-left-color: var(--brand);
}

.nav-links .nav-hint {
  display: block;
  font-size: 11px;
  opacity: 0.5;
  margin-top: 2px;
  font-weight: 400;
}

.shell__aside .logout {
  padding: 16px 20px 24px;
}

.shell__aside .logout button {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #f5efe6;
  cursor: pointer;
  font-size: 13px;
}

.shell__main {
  padding: 28px 32px calc(48px + env(safe-area-inset-bottom));
  overflow: auto;
}

.panel-head {
  margin-bottom: 12px;
}

.panel-head-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.panel-hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin: -4px 0 20px;
  max-width: 720px;
}

.plain-guide {
  white-space: pre-wrap;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
}

.btn--primary:hover {
  background: var(--brand-deep);
}

.btn--ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(26, 26, 26, 0.04);
}

.btn--accent {
  background: #3d3429;
  color: #f5efe6;
}

.btn--accent:hover {
  filter: brightness(1.06);
}

.btn--sm {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.field-hint {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 10px;
  line-height: 1.55;
}

.media-field {
  margin-bottom: 4px;
}

.media-preview-slot {
  min-height: 120px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-preview-img {
  max-width: 100%;
  max-height: 240px;
  display: block;
  object-fit: contain;
}

.media-preview-video {
  max-width: 100%;
  max-height: 260px;
  display: block;
}

.media-empty {
  color: #9ca3af;
  font-size: 13px;
  padding: 20px;
  text-align: center;
  line-height: 1.5;
}

.media-toolbar {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

fieldset.zuopin-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px 18px;
  margin: 12px 0 16px;
}

fieldset.zuopin-wrap legend {
  font-size: 13px;
  font-weight: 700;
  padding: 0 6px;
}

.zuopin-row {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.zuopin-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.zuopin-row-body {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
}

.zuopin-row-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 100px;
}



.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-row output {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
  flex: 1;
  min-width: 120px;
}

.table-wrap {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 32px rgba(26, 26, 26, 0.05);
  overflow: auto;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

table.grid th,
table.grid td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.grid th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #faf9f6;
}

table.grid tr:last-child td {
  border-bottom: none;
}

table.grid .cell-title {
  font-weight: 600;
  max-width: 280px;
}

.cell-muted {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.link {
  background: none;
  border: none;
  color: var(--brand-deep);
  cursor: pointer;
  font-size: 14px;
  margin-right: 12px;
  padding: 0;
}

.link--danger {
  color: #b91c1c;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  padding: 36px;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 48px rgba(26, 26, 26, 0.08);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 20px;
}

.login-card p {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input[type="password"],
.field input[type="number"],
.field input[type="text"],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-family: inherit;
}

.field select {
  background: #fff;
  cursor: pointer;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field textarea.tall {
  min-height: 220px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}

.login-error {
  color: #b91c1c;
  font-size: 13px;
  margin-bottom: 12px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
  overflow-y: auto;
  z-index: 99;
}

.modal {
  background: var(--card);
  width: min(620px, 100%);
  border-radius: 16px;
  padding: 24px 26px 20px;
  box-shadow: 0 24px 64px rgba(26, 26, 26, 0.2);
}

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

.modal header h3 {
  margin: 0;
  font-size: 18px;
}

#formMount {
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding-right: 6px;
}
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.hunpai-wrap {
  margin-top: 20px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(249, 248, 243, 0.6);
}

.hunpai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.hunpai-row {
  padding: 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
}

.hunpai-row:last-child {
  margin-bottom: 8px;
}

.hunpai-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}

.hunpai-row-head select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.hunpai-text {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-family: inherit;
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .shell__aside {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px;
  }

  .shell__aside .nav-links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    gap: 4px;
  }

  .shell__aside .logout {
    width: auto;
    margin-left: auto;
    padding: 0;
  }
}
