:root {
  --bg: #fbf6f4;
  --bg-mobile: #fcf7f5;
  --panel: #fffdfc;
  --panel-strong: #ffffff;
  --surface-soft: #fbf3f1;
  --text: #241f1f;
  --text-secondary: #514848;
  --muted: #7b7070;
  --hint: #a09494;
  --line: #eedfd9;
  --line-soft: #f4e8e3;
  --accent: #c07a86;
  --accent-deep: #b06c78;
  --accent-soft: #e8c7c0;
  --accent-wash: #f1ddd2;
  --success: #7fa27d;
  --warning: #c9965a;
  --danger: #c56b6b;
  --shadow-soft: 0 4px 12px rgba(66, 46, 49, 0.04);
  --shadow-panel: 0 8px 20px rgba(66, 46, 49, 0.06);
  --radius-lg: 16px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;
  --border: var(--line);
  --text-soft: var(--muted);
  --font:
    "SF Pro Display",
    "SF Pro Text",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    "Noto Sans SC",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

code {
  padding: var(--space-4) var(--space-8);
  border-radius: 8px;
  background: #fff4f3;
  color: var(--accent-deep);
  font-size: 12px;
}

p {
  margin: 0;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--space-24) var(--space-16);
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  overflow-y: auto;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.brand {
  display: grid;
  justify-items: center;
  padding: 0 0 var(--space-16);
  border-bottom: 1px solid var(--line-soft);
  text-align: center;
}

.brand-lockup,
.brand-text {
  display: grid;
  gap: var(--space-4);
  justify-items: center;
  text-align: center;
}

.brand-wordmark {
  color: var(--accent);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-subtitle,
.brand-text small,
.user-card-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.user-card {
  display: grid;
  justify-items: center;
  gap: var(--space-4);
  padding: var(--space-16);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  text-align: center;
}

.user-card-title {
  font-size: 15px;
  font-weight: 600;
}

.nav-list {
  display: grid;
  gap: var(--space-8);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 var(--space-16);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
  border: 1px solid transparent;
}

.nav-link::before {
  content: "";
  position: absolute;
  left: var(--space-16);
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: transparent;
  transform: translateY(-50%);
  transition: background-color 180ms ease;
}

.nav-link:hover {
  color: var(--text);
  background: #fff8f7;
}

.nav-link.active {
  color: var(--accent-deep);
  background: #fff3f2;
  border-color: var(--accent-soft);
}

.nav-link.active::before {
  background: var(--accent);
}

.logout-form {
  margin-top: auto;
  padding-top: var(--space-16);
  border-top: 1px solid var(--line-soft);
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  justify-items: center;
  gap: var(--space-12);
  width: 100%;
  text-align: center;
}

.sidebar-account {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
  box-shadow: none;
  justify-items: center;
}

.sidebar-account span,
.sidebar-account strong {
  text-align: center;
}

.sidebar-footer .logout-form {
  width: auto;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.sidebar-footer .button-ghost {
  min-width: 0;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.sidebar-footer .button-ghost:hover {
  background: transparent;
  color: var(--accent-deep);
}

.main {
  padding: var(--space-24);
  display: grid;
  gap: var(--space-16);
  align-content: start;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-20);
  padding: 0;
}

.page-header-main {
  display: grid;
  gap: var(--space-8);
}

.page-kicker,
.eyebrow,
.hero-tag,
.report-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  min-height: 22px;
  padding: 0 var(--space-8);
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 500;
}

.soft-chip.is-muted {
  background: #f7f2f0;
  border-color: var(--line);
  color: var(--muted);
}

.page-header h1,
.error-shell h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
}

.login-hero h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
}

.page-header p,
.login-hero p,
.error-shell p {
  max-width: 760px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.header-badge {
  min-width: 180px;
  padding: var(--space-16);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  display: grid;
  gap: var(--space-4);
}

.header-badge span {
  color: var(--hint);
  font-size: 12px;
}

.header-badge strong {
  font-size: 14px;
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.nested-panel {
  background: var(--panel-strong);
  border-color: var(--line-soft);
  box-shadow: none;
}

.toolbar,
.form-card,
.error-shell {
  padding: var(--space-16);
}

.toolbar.panel {
  background: var(--panel);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-16);
  margin-bottom: var(--space-8);
  padding: var(--space-14) var(--space-16) 0;
}

.form-card .panel-header,
.toolbar .panel-header {
  padding: 0;
}

.toolbar-row,
.header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  flex-wrap: wrap;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
}

.panel-header span,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.card-grid {
  display: grid;
  gap: var(--space-16);
}

.card-grid-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-wrap {
  container-type: inline-size;
  overflow-x: auto;
  padding: 0 clamp(8px, 1vw, 14px) clamp(8px, 1vw, 12px);
}

.table-wrap-fixed-10 {
  height: auto;
  max-height: 408px;
  overflow-x: auto;
  overflow-y: auto;
}

.table-wrap-fixed-10 thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-wrap-fixed-records {
  height: auto;
  max-height: 424px;
  overflow-x: auto;
  overflow-y: auto;
}

.table-wrap-fixed-records thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-wrap-fixed-10-frame {
  height: 420px;
  overflow-x: auto;
  overflow-y: auto;
}

.table-wrap-fixed-10-frame thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: clamp(5px, 0.75vw, 8px) clamp(7px, 0.9vw, 10px);
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: clamp(11px, 0.85vw, 13px);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

thead th {
  background: #fff7f6;
  color: var(--muted);
  font-weight: 500;
}

thead th:first-child {
  border-top-left-radius: 12px;
}

thead th:last-child {
  border-top-right-radius: 12px;
}

tbody tr:hover td {
  background: #fff9f8;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.edit-dialog {
  width: min(560px, calc(100vw - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(89, 62, 67, 0.18);
}

.edit-dialog::backdrop {
  background: rgba(67, 48, 52, 0.3);
  backdrop-filter: blur(2px);
}

.dialog-layer {
  display: contents;
}

.dialog-form {
  display: grid;
  gap: var(--space-16);
  padding: var(--space-20);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}

.dialog-header h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.dialog-close {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.dialog-grid {
  display: grid;
  gap: var(--space-12);
}

.dialog-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-8);
}

@container (max-width: 980px) {
  .compact-table th,
  .compact-table td {
    padding: 6px 8px;
    font-size: 12px;
  }

  .table-note {
    font-size: 11px;
  }
}

@container (max-width: 760px) {
  .compact-table th,
  .compact-table td {
    padding: 6px;
    font-size: 11px;
  }

  .table-identity strong,
  .table-value {
    font-size: 11px;
  }

  .table-field select,
  .table-field input,
  .mini-input {
    min-height: 28px;
    padding: 0 8px;
    font-size: 11px;
  }

  .button,
  .button-xs {
    min-height: 24px;
    padding: 0 6px;
    font-size: 10px;
  }

  .table-actions {
    gap: 4px;
  }
}

.form-grid,
.inline-form {
  display: grid;
  gap: var(--space-16);
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-form {
  grid-template-columns: repeat(auto-fit, minmax(180px, max-content));
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.action-field {
  align-self: end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(60px, 7vw, 72px);
  min-height: clamp(30px, 2.8vw, 36px);
  padding: 0 clamp(8px, 1vw, 12px);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: clamp(11px, 0.82vw, 13px);
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.button-primary {
  background: var(--accent);
  color: #ffffff;
}

.button-secondary {
  background: #fff4f4;
  border-color: var(--accent-soft);
  color: var(--accent-deep);
}

.button-ghost {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text-secondary);
}

.button-danger {
  background: #fff3f1;
  border-color: rgba(197, 107, 107, 0.22);
  color: var(--danger);
}

.button-xs {
  min-height: clamp(22px, 2.2vw, 28px);
  min-width: 0;
  padding: 0 clamp(6px, 0.85vw, 12px);
  font-size: clamp(10px, 0.75vw, 12px);
}

.button-like {
  min-width: 36px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
}

.button-like .like-icon {
  width: 14px;
  height: 14px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button-like.is-active {
  background: #fff1f4;
  border-color: rgba(192, 122, 134, 0.3);
  color: var(--accent-deep);
}

.button-like.is-active .like-icon {
  fill: currentColor;
}

.button-block {
  width: 100%;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  margin: 0 auto;
}

.status-approved,
.status-locked,
.status-active {
  background: rgba(127, 162, 125, 0.14);
  color: #6b8b69;
}

.status-submitted,
.status-draft,
.status-live {
  background: rgba(192, 122, 134, 0.12);
  color: var(--accent-deep);
}

.status-rejected,
.status-disabled {
  background: rgba(197, 107, 107, 0.12);
  color: var(--danger);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(4px, 0.8vw, 8px);
  justify-content: center;
}

th.cell-number,
td.cell-number {
  text-align: right;
}

th.cell-status,
td.cell-status {
  width: clamp(66px, 8vw, 92px);
}

th.cell-actions,
td.cell-actions {
  width: clamp(88px, 10vw, 132px);
}

th.cell-status,
td.cell-status,
th.cell-actions,
td.cell-actions {
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-12);
  padding: 0 var(--space-20) var(--space-20);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-12);
  margin: var(--space-8) 0 0;
}

.compact-gallery {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.gallery-card {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-soft);
  background: #ffffff;
}

.gallery-card img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  background: #eadfd2;
}

.gallery-card figcaption {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.gallery-card figcaption p {
  color: var(--muted);
  font-size: 12px;
}

.permission-form {
  gap: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.comment-form {
  margin-top: var(--space-16);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-20);
  background: var(--bg);
}

.login-layout {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  align-items: start;
  gap: var(--space-20);
}

.login-hero,
.login-panel {
  padding: var(--space-24);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-panel);
}

.login-hero,
.login-panel {
  display: grid;
  align-content: start;
}

.login-hero {
  gap: var(--space-12);
}

.hero-brand {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
}

.hero-brand-copy {
  display: grid;
  gap: 2px;
}

.hero-brand-copy span {
  color: var(--muted);
  font-size: 12px;
}

.hero-wordmark {
  font-size: 22px;
  line-height: 1.2;
}

.hero-grid {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.hero-card,
.credential-panel {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
}

.hero-card {
  display: grid;
  gap: 6px;
}

.hero-card strong {
  font-size: 15px;
  font-weight: 600;
}

.hero-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.credential-panel {
  margin-top: 0;
}

.credential-panel h2 {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
}

.credential-panel ul {
  margin: 0;
  padding-left: var(--space-16);
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.form-intro {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
}

.form-intro h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
}

.login-panel .form-card {
  display: grid;
  gap: var(--space-16);
}

.login-panel .button-block {
  margin-top: 0;
}

.flash {
  padding: var(--space-12) var(--space-16);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 13px;
}

.flash-success {
  background: rgba(127, 162, 125, 0.1);
  color: #6b8b69;
  border-color: rgba(127, 162, 125, 0.18);
}

.flash-error {
  background: rgba(197, 107, 107, 0.1);
  color: var(--danger);
  border-color: rgba(197, 107, 107, 0.18);
}

.flash-info {
  background: rgba(192, 122, 134, 0.1);
  color: var(--accent-deep);
  border-color: rgba(192, 122, 134, 0.16);
}

.error-shell {
  width: min(620px, 100%);
  text-align: center;
  display: grid;
  gap: var(--space-12);
}

@media (max-width: 980px) {
  .backend-section-grid {
    grid-template-columns: 1fr;
  }

  .backend-span-2 {
    grid-column: auto;
  }
}

.reports-filter-bar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 4px 6px;
  flex-wrap: wrap;
  flex: 1 1 720px;
}

.reports-filter-bar .field {
  gap: 2px;
}

.reports-filter-bar .field span {
  font-size: 10px;
  line-height: 1;
}

.reports-filter-bar .field input,
.reports-filter-bar .field select {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11px;
}

.reports-filter-bar .field.compact {
  width: min(100%, 150px);
}

.reports-filter-bar .button {
  width: auto;
  min-width: 0;
  min-height: 26px;
  padding: 0 10px;
  font-size: 11px;
}

.page-block {
  display: grid;
  gap: var(--space-16);
}

.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 22px;
  padding: 0 var(--space-8);
  border-radius: 999px;
  background: #fff7f6;
  border: 1px solid var(--line-soft);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.rank-1 {
  background: #fff4ea;
  border-color: #f1dcc0;
  color: #b67d45;
}

.rank-2 {
  background: #f7f4f4;
  border-color: #e6dddd;
  color: #8e7e7e;
}

.rank-3 {
  background: #fff1ef;
  border-color: #f1d6cf;
  color: #b97970;
}

.tips-panel .stack-list,
.compact-panel .stack-list {
  padding-top: 0;
}

.section-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.soft-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 500;
}

.empty-state {
  margin: 0 12px 12px;
  padding: var(--space-12);
  border-radius: var(--radius-md);
  border: 1px dashed var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.action-confirm-popover {
  position: fixed;
  z-index: 2000;
  width: min(240px, calc(100vw - 24px));
  padding: var(--space-12);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fffdfc;
  box-shadow: 0 16px 36px rgba(66, 46, 49, 0.12);
}

.action-confirm-message {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.action-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-8);
  margin-top: var(--space-12);
}

.table-card .panel-header,
.compact-panel .panel-header {
  margin-bottom: var(--space-8);
}

.tip-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.key-value-grid {
  display: grid;
  gap: var(--space-12);
  padding: 0 var(--space-20) var(--space-20);
}

.key-value-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-16);
  padding: var(--space-12) var(--space-16);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
}

.key-value-row span {
  color: var(--muted);
  font-size: 12px;
}

.key-value-row strong {
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  text-align: right;
}

.card-caption {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.card-body {
  padding: 0 var(--space-20) var(--space-20);
}

.progress-card {
  padding: var(--space-16);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  display: grid;
  gap: var(--space-12);
}

.progress-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.progress-card-head strong {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
}

.progress-card-head span,
.progress-card p {
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #f4e6e3;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.progress-fill.is-success {
  background: var(--success);
}

.progress-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.report-board {
  display: grid;
  gap: var(--space-12);
  margin-top: var(--space-16);
}

.trend-positive {
  color: var(--success);
}

.trend-negative {
  color: var(--danger);
}

.rank-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-muted {
  color: var(--muted);
  font-size: 12px;
}
