:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-subtle: #f7f9fb;
  --ink: #202631;
  --muted: #66717f;
  --line: #d8dee8;
  --line-soft: #e9edf2;
  --charcoal: #282c34;
  --charcoal-2: #2e3440;
  --accent: #367d89;
  --accent-dark: #2d6570;
  --accent-bright: #56b6c2;
  --accent-soft: #edf8fa;
  --green: #4f7651;
  --green-soft: #eff6ed;
  --blue: #436f9e;
  --blue-soft: #eef4fa;
  --amber: #8b681e;
  --amber-soft: #fff7e5;
  --danger: #b94f59;
  --danger-soft: #fff0f1;
  --shadow: 0 14px 36px rgba(40, 44, 52, .11);
  --shadow-soft: 0 7px 20px rgba(40, 44, 52, .07);
  --glow: 0 0 0 1px rgba(86, 182, 194, .22), 0 0 18px rgba(86, 182, 194, .14);
  --radius: 7px;
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4, p { margin-top: 0; }

.app-shell { min-height: 100vh; }
.global-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  color: #fff;
  background: var(--charcoal);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-block {
  min-width: 190px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  box-shadow: var(--glow);
  border-radius: 7px;
}
.brand-name { display: block; font-size: 15px; font-weight: 900; }
.brand-note { display: block; margin-top: 1px; color: #9dafb7; font-size: 10px; }
.global-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}
.global-nav::-webkit-scrollbar { display: none; }
.global-nav button {
  min-height: 38px;
  padding: 0 13px;
  color: #b9c6cc;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.global-nav button:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.global-nav button.active { color: #fff; background: var(--accent); box-shadow: var(--glow); }
.global-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.prototype-tag { color: #9dafb7; font-size: 11px; white-space: nowrap; }
.global-main { min-height: calc(100vh - 62px); }

.icon-button,
.button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 5px;
  font-weight: 800;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-size: 13px;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--accent); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button.secondary:hover { color: var(--accent); border-color: #e3aaa7; }
.button.ghost { color: var(--muted); background: transparent; border-color: transparent; }
.button.ghost:hover { color: var(--ink); background: var(--surface-subtle); }
.button.danger { color: var(--danger); background: var(--danger-soft); border-color: #f0c7c4; }
.button.success { color: var(--green); background: var(--green-soft); border-color: #c6e5da; }
.button.small { min-height: 30px; padding: 0 10px; font-size: 11px; }
.button.block { width: 100%; }
.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
}
.icon-button:hover { color: var(--accent); border-color: #e3aaa7; }
.text-button { padding: 0; color: var(--accent); background: transparent; border: 0; font-size: 12px; }
.text-button:hover { color: var(--accent-dark); }

.control,
.select-control,
.textarea-control {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: 0;
}
.control, .select-control { height: 39px; padding: 0 11px; }
.textarea-control { min-height: 102px; padding: 10px 11px; resize: vertical; line-height: 1.65; }
.control:focus, .select-control:focus, .textarea-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(214, 66, 60, .10); }
.field { display: grid; gap: 7px; }
.field label { color: var(--ink); font-size: 12px; font-weight: 800; }
.field small { color: var(--muted); font-size: 11px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: #e9edef;
  border-radius: 6px;
}
.segmented button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.segmented button.active { color: var(--ink); background: #fff; box-shadow: 0 1px 4px rgba(21, 33, 38, .08); }
.segmented.dark { background: rgba(255, 255, 255, .08); }
.segmented.dark button { color: #aebcc2; }
.segmented.dark button.active { color: #fff; background: var(--accent); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.status-badge.success { color: var(--green); background: var(--green-soft); }
.status-badge.pending { color: var(--amber); background: var(--amber-soft); }
.status-badge.info { color: var(--blue); background: var(--blue-soft); }
.status-badge.danger { color: var(--danger); background: var(--danger-soft); }
.status-badge.neutral { color: var(--muted); background: #edf1f2; }

.page-titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-titlebar h1 { margin: 0; font-size: 24px; line-height: 1.25; }
.page-titlebar p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.section-heading h2, .section-heading h3 { margin: 0; font-size: 15px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }

.data-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; border-top: 1px solid var(--line); }
.data-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.data-table th {
  height: 42px;
  padding: 0 13px;
  color: var(--muted);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.data-table td { padding: 12px 13px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-size: 12px; }
.data-table tbody tr:hover { background: #fafbfb; }
.table-actions { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.media-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.media-cell img { width: 44px; height: 44px; object-fit: cover; border-radius: 5px; }
.media-cell strong { display: block; font-size: 12px; }
.media-cell span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

.empty-state { padding: 48px 20px; color: var(--muted); text-align: center; }
.empty-state svg { margin-bottom: 10px; color: #aab5ba; }
.empty-state h3 { margin: 0 0 5px; color: var(--ink); font-size: 15px; }
.empty-state p { margin: 0 auto 15px; max-width: 380px; font-size: 12px; }

.modal-root:empty, .toast-root:empty { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 20, 24, .58);
}
.modal-dialog {
  width: min(620px, 100%);
  max-height: min(82vh, 760px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(5, 13, 17, .28);
}
.modal-dialog.wide { width: min(820px, 100%); }
.modal-header { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; background: var(--surface-subtle); border-top: 1px solid var(--line); }
.form-stack { display: grid; gap: 15px; }
.modal-message { padding: 14px; color: var(--muted); background: var(--surface-subtle); border-left: 3px solid var(--accent); font-size: 12px; line-height: 1.7; }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 150; }
.toast {
  min-width: 250px;
  max-width: 360px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  color: #fff;
  background: var(--charcoal);
  border-radius: 6px;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
}
.toast strong { display: block; font-size: 12px; }
.toast span { display: block; margin-top: 2px; color: #c8d2d6; font-size: 11px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.skeleton-bar { height: 8px; overflow: hidden; background: #e7ecee; border-radius: 3px; }
.skeleton-bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .35s ease; }
.muted { color: var(--muted); }
.strong { color: var(--ink); font-weight: 800; }
.nowrap { white-space: nowrap; }
.spacer-12 { height: 12px; }
.spacer-20 { height: 20px; }
.desktop-only { display: inline-flex; }

@media (max-width: 860px) {
  .global-header { gap: 10px; padding: 0 12px; }
  .brand-block { min-width: auto; }
  .brand-copy { display: none; }
  .global-nav button { padding: 0 10px; }
  .prototype-tag { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .page-titlebar { align-items: stretch; flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .desktop-only { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
