/* ==========================================================================
   闻达 · 新闻发稿中台
   轻量、编辑部气质的中文后台界面
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f6f4ee;
  --bg-deep: #efece3;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --surface-3: #f4f1e9;
  --ink: #191917;
  --ink-2: #3d3b35;
  --sub: #636055;
  --muted: #8d897d;
  --line: #e7e3d8;
  --line-strong: #d8d3c5;
  --brand: #b3352b;
  --brand-dark: #93271f;
  --brand-soft: #f8eae7;
  --blue: #2a78d6;
  --blue-soft: #eaf2fc;
  --ok: #176b37;
  --ok-bg: #e8f3ea;
  --warn: #8a5a00;
  --warn-bg: #fbf1da;
  --info: #1f5cab;
  --info-bg: #e9f1fb;
  --bad: #a12b25;
  --bad-bg: #fbe9e7;
  --muted-bg: #f0eee8;
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(25, 25, 23, .04);
  --shadow: 0 1px 2px rgba(25, 25, 23, .04), 0 10px 30px rgba(25, 25, 23, .05);
  --shadow-lg: 0 24px 70px rgba(25, 25, 23, .16);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.has-modal { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; }
::selection { background: #f2d6d1; color: var(--ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8d3c5; border: 3px solid transparent; background-clip: padding-box; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #c5bfae; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- boot */

.app-loading { min-height: 100vh; display: grid; place-items: center; }
.boot { font-family: var(--serif); font-size: 20px; letter-spacing: .12em; color: var(--muted); }
.boot::after { content: ""; display: block; width: 36px; height: 2px; margin: 18px auto 0; background: var(--brand); animation: bootline 1.2s ease-in-out infinite; }
@keyframes bootline { 0%, 100% { transform: scaleX(.35); opacity: .4; } 50% { transform: scaleX(1); opacity: 1; } }

/* ---------------------------------------------------------------- layout */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: #17171a;
  color: #f2efe7;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  overflow: hidden;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(600px 200px at 0% 0%, rgba(179, 53, 43, .16), transparent 65%);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 24px 22px 20px; position: relative; z-index: 1; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  background: var(--brand); color: #fff;
  border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 20px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(179, 53, 43, .3);
}
.brand-text { min-width: 0; }
.brand-name { font-family: var(--serif); font-size: 18px; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 10px; letter-spacing: .22em; color: #8e8b82; text-transform: uppercase; }

.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; position: relative; z-index: 1; }
.nav::-webkit-scrollbar-thumb { background: #3a3a3f; }
.nav-group { margin: 14px 0 4px; }
.nav-label { font-size: 10px; letter-spacing: .18em; color: #77746c; padding: 8px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: 9px;
  color: #c8c5bd; font-size: 13.5px;
  position: relative; transition: background .15s ease, color .15s ease;
}
.nav-item svg { width: 17px; height: 17px; opacity: .8; }
.nav-item:hover { background: rgba(255, 255, 255, .055); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, .085); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-item.active svg { opacity: 1; color: #f2a79f; }
.nav-count { margin-left: auto; font-size: 10.5px; background: rgba(255,255,255,.1); padding: 1px 7px; border-radius: 20px; color: #d7d4cc; }

.sidebar-foot { padding: 14px 22px 20px; border-top: 1px solid rgba(255,255,255,.07); position: relative; z-index: 1; }
.sidebar-foot p { font-size: 11px; color: #77746c; line-height: 1.7; }
.sidebar-foot strong { color: #c8c5bd; font-weight: 500; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 72px; flex: 0 0 72px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px;
  padding: 0 30px;
  background: rgba(246, 244, 238, .86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-title h1 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.topbar-title p { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.mobile-toggle { display: none; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 9px;
  border: 1px solid transparent; background: transparent;
  display: inline-grid; place-items: center;
  color: var(--sub); position: relative;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  background: var(--brand); border-radius: 50%; border: 2px solid var(--bg);
}

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .15s ease;
}
.user-chip:hover { border-color: var(--line-strong); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(145deg, #2b2b2f, #17171a);
  color: #f4f1ea; display: grid; place-items: center;
  font-size: 13px; font-family: var(--serif);
}
.avatar-lg { width: 48px; height: 48px; font-size: 20px; }
.user-chip .name { font-size: 12.5px; font-weight: 550; line-height: 1.2; }
.user-chip .role { font-size: 10.5px; color: var(--muted); line-height: 1.2; }

.user-menu-wrap { position: relative; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 210px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px;
  display: none; z-index: 60;
}
.user-menu.open { display: block; animation: pop .14s ease; }
.user-menu .menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu .menu-head strong { display: block; font-size: 13px; }
.user-menu .menu-head span { font-size: 11.5px; color: var(--muted); }
.menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 11px; border: 0; background: transparent;
  border-radius: 8px; font-size: 13px; text-align: left; color: var(--sub);
}
.menu-item:hover { background: var(--surface-3); color: var(--ink); }
.menu-item svg { width: 16px; height: 16px; }
.menu-item.danger { color: var(--bad); }

@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.view { padding: 28px 30px 64px; max-width: 1440px; width: 100%; margin: 0 auto; flex: 1; }

/* ---------------------------------------------------------------- page intro */

.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-intro h1 { font-family: var(--serif); font-size: 27px; line-height: 1.25; letter-spacing: .01em; font-weight: 700; }
.page-intro p { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.page-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

.announcement {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fdf8ea; border: 1px solid #ecdfb8; color: #6d5314;
  padding: 11px 14px; border-radius: 11px; font-size: 12.5px; margin-bottom: 20px;
}
.announcement svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 550; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .08s ease, box-shadow .15s ease;
}
.btn:hover { border-color: #bfb9a8; background: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(179,53,43,.2); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #8a221d; border-color: #8a221d; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--sub); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.btn-soft:hover { background: #f4deda; border-color: transparent; }
.btn-sm { height: 31px; padding: 0 11px; font-size: 12px; border-radius: 7px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 14px; }
.btn-block { width: 100%; }
.btn.loading { pointer-events: none; opacity: .75; }
.btn.loading::before {
  content: ""; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px 0;
}
.card-head h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -.005em; }
.card-head p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.card-body { padding: 20px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card-actions { display: flex; gap: 8px; align-items: center; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 17px 19px 15px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat::after { content: ""; position: absolute; inset: 0 0 auto auto; width: 92px; height: 92px; background: radial-gradient(circle at top right, rgba(179,53,43,.055), transparent 70%); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.stat-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--sub); }
.stat-icon svg { width: 14px; height: 14px; }
.stat-value { font-size: 30px; font-weight: 620; letter-spacing: -.02em; line-height: 1.2; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat-meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stat-meta .up { color: var(--ok); }
.stat-meta .down { color: var(--bad); }
.stat-meta svg { width: 12px; height: 12px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(290px, 1fr); gap: 16px; margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 550; font-size: 11px; letter-spacing: .06em;
  color: var(--muted); text-transform: none;
  padding: 11px 14px; background: var(--surface-2);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th:first-child { padding-left: 22px; }
.table th:last-child { padding-right: 22px; }
.table td { padding: 13px 14px; border-bottom: 1px solid #f0ede4; vertical-align: middle; }
.table td:first-child { padding-left: 22px; }
.table td:last-child { padding-right: 22px; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #fdfcf9; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .strong { font-weight: 550; color: var(--ink); }
.table .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.row-link { cursor: pointer; }
.row-link:hover .table-title { color: var(--brand); }
.table-title { font-weight: 550; transition: color .12s ease; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 22px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pager-btns { display: flex; gap: 6px; }

/* ---------------------------------------------------------------- pills / tags */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 550; white-space: nowrap;
  background: var(--muted-bg); color: var(--sub);
}
.pill em { font-style: normal; opacity: .65; font-weight: 400; margin-left: 2px; }
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-muted { background: var(--muted-bg); color: var(--sub); }

.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
  border-radius: 5px; background: var(--surface-3); color: var(--sub);
  font-size: 11px; white-space: nowrap; border: 1px solid #ece8dd;
}
.tag-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.tag-blue { background: var(--blue-soft); color: #1f5cab; border-color: transparent; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.text-link { color: var(--info); }
.text-link:hover { text-decoration: underline; }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------------------------------------------------------------- forms */

.field { margin-bottom: 15px; }
.label { display: block; font-size: 12px; font-weight: 550; color: var(--sub); margin-bottom: 6px; }
.label .req { color: var(--brand); margin-left: 2px; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.65; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none;
  font-size: 13.5px; transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(179,53,43,.1); }
.input::placeholder, .textarea::placeholder { color: #b3af9f; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d897d' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.textarea.mono, .input.mono, textarea.code { font-family: var(--mono); font-size: 12px; line-height: 1.65; }
textarea.code { min-height: 280px; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.form-error { background: var(--bad-bg); color: var(--bad); padding: 9px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 14px; }
.form-error:empty { display: none; }

.search-box { position: relative; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-box .input { padding-left: 34px; height: 37px; }

.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.toolbar .input, .toolbar .select { width: auto; height: 37px; }
.toolbar .search-box { width: 250px; }

.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  height: 29px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 12px; color: var(--sub);
}
.chip:hover { border-color: var(--line-strong); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d9d4c7; border-radius: 999px; transition: background .18s ease; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(16px); }

/* ---------------------------------------------------------------- empty / misc */

.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-mark { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-3); display: grid; place-items: center; margin: 0 auto 14px; color: #a8a394; }
.empty-mark svg { width: 22px; height: 22px; }
.empty h3 { font-size: 13.5px; color: var(--sub); font-weight: 550; margin-bottom: 4px; }
.empty p { font-size: 12px; line-height: 1.7; }
.empty .btn { margin-top: 14px; }

.loading-line { padding: 48px 0; display: grid; place-items: center; color: var(--muted); font-size: 12.5px; }
.loading-line::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--brand); animation: spin .8s linear infinite; margin-bottom: 10px; }

.section-gap { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.wrap { flex-wrap: wrap; }

/* ---------------------------------------------------------------- charts */

.chart-card .card-body { padding: 10px 18px 16px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: #e9e6dd; stroke-width: 1; }
.chart .axis-label { fill: #918d80; font-size: 10.5px; font-family: var(--sans); }
.chart .series-line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-area { fill: url(#areaFill); }
.chart .dot { fill: var(--blue); stroke: var(--surface); stroke-width: 2; }
.chart .dot-end { fill: var(--blue); stroke: var(--surface); stroke-width: 2; }
.chart .end-label { fill: var(--ink); font-size: 11.5px; font-weight: 600; font-family: var(--sans); }
.chart .hover-line { stroke: #bdb8a9; stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -100%);
  background: var(--ink); color: #f7f4ec; border-radius: 7px;
  padding: 6px 9px; font-size: 11.5px; white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0,0,0,.18); opacity: 0; transition: opacity .1s ease;
  z-index: 5;
}
.chart-tip.on { opacity: 1; }
.chart-legend-note { font-size: 11px; color: var(--muted); padding: 0 22px 12px; }
.chart-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.chart-table th, .chart-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.chart-table th { color: var(--muted); font-weight: 500; font-size: 11px; }
.chart-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.bars { display: flex; flex-direction: column; gap: 14px; padding: 4px 0; }
.bar-row { display: grid; grid-template-columns: 56px 1fr 30px; align-items: center; gap: 10px; }
.bar-label { font-size: 12px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 12px; background: #f1eee6; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; transition: width .5s cubic-bezier(.2,.7,.3,1); min-width: 3px; }
.bar-value { font-size: 12px; color: var(--sub); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- modal / toast */

.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 20, 19, .42);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 20px 40px; overflow-y: auto;
  opacity: 0; transition: opacity .16s ease;
}
.modal-mask.is-in { opacity: 1; }
.modal {
  width: 100%; max-width: 560px;
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(.99); transition: transform .18s ease;
  max-height: 88vh; display: flex; flex-direction: column;
}
.modal-mask.is-in .modal { transform: none; }
.modal-wide { max-width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; font-weight: 650; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.confirm-text { font-size: 13.5px; color: var(--sub); line-height: 1.8; }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--ink); color: #f7f4ec;
  padding: 11px 15px; border-radius: 10px; font-size: 12.5px;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease;
  max-width: 380px;
}
.toast.is-in { opacity: 1; transform: none; }
.toast-dot { width: 6px; height: 6px; border-radius: 50%; background: #6fc58a; flex: 0 0 6px; }
.toast-bad .toast-dot { background: #ef8f86; }

/* ---------------------------------------------------------------- login */

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--bg); }
.login-left {
  background: #17171a; color: #f4f1e9;
  padding: 54px 60px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(700px 380px at 15% 10%, rgba(179,53,43,.25), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.028) 0 1px, transparent 1px 72px);
  pointer-events: none;
}
.login-left > * { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 13px; }
.login-brand .brand-mark { width: 42px; height: 42px; font-size: 22px; }
.login-brand .name { font-family: var(--serif); font-size: 19px; letter-spacing: .1em; }
.login-brand .sub { font-size: 10px; letter-spacing: .24em; color: #8f8c83; }
.login-quote { margin: auto 0; padding: 40px 0; }
.login-quote .kicker { color: #d9877e; font-size: 11px; letter-spacing: .25em; margin-bottom: 20px; }
.login-quote h1 { font-family: var(--serif); font-size: clamp(32px, 3.6vw, 50px); line-height: 1.32; letter-spacing: .01em; font-weight: 600; }
.login-quote h1 em { font-style: normal; color: #e8a99f; }
.login-quote p { color: #a09d94; font-size: 13px; line-height: 1.9; margin-top: 22px; max-width: 430px; }
.login-features { display: flex; gap: 26px; flex-wrap: wrap; }
.login-feature { font-size: 12px; color: #b6b3aa; }
.login-feature strong { display: block; font-family: var(--serif); font-size: 22px; color: #f4f1e9; font-weight: 500; margin-bottom: 2px; }
.login-foot { font-size: 11px; color: #6e6b63; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

.login-right { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 390px; }
.login-card h2 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.login-card .lead { color: var(--muted); font-size: 12.5px; margin-top: 6px; margin-bottom: 28px; }
.login-card .input { height: 44px; }
.login-card .btn { height: 44px; }
.login-card .form-error { margin-bottom: 16px; }
.login-alt { text-align: center; font-size: 12px; color: var(--muted); margin-top: 18px; }
.login-alt button { border: 0; background: none; color: var(--brand); font-size: 12px; padding: 0; }
.sample-accounts { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 18px; }
.sample-accounts .label { margin-bottom: 9px; }
.sample-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sample-account {
  border: 1px dashed var(--line-strong); background: transparent;
  border-radius: 8px; padding: 6px 10px; font-size: 11.5px; color: var(--sub);
}
.sample-account:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.sample-account b { font-weight: 600; color: var(--ink-2); }

/* ---------------------------------------------------------------- publish */

.publish-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, .9fr); gap: 16px; align-items: start; }
.publish-main { min-width: 0; }
.publish-side { position: sticky; top: 92px; }

.editor-shell { border: 1px solid var(--line-strong); border-radius: 11px; overflow: hidden; background: var(--surface); }
.editor-toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 7px 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tool-btn {
  border: 0; background: transparent; color: var(--sub);
  min-width: 29px; height: 29px; padding: 0 6px; border-radius: 6px;
  font-size: 12px; display: inline-grid; place-items: center;
}
.tool-btn:hover { background: var(--surface-3); color: var(--ink); }
.tool-btn svg { width: 15px; height: 15px; }
.tool-sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 5px; }
.editor-area {
  min-height: 380px; max-height: 560px; overflow-y: auto;
  padding: 18px 20px; outline: none; font-size: 14.5px; line-height: 1.9;
}
.editor-area:empty::before { content: attr(data-placeholder); color: #b3af9f; }
.editor-area h2 { font-family: var(--serif); font-size: 20px; margin: 20px 0 10px; }
.editor-area h3 { font-size: 16px; margin: 16px 0 8px; }
.editor-area p { margin: 0 0 12px; }
.editor-area blockquote { border-left: 3px solid var(--brand); background: var(--surface-2); margin: 14px 0; padding: 8px 14px; color: var(--sub); }
.editor-area img { max-width: 100%; border-radius: 6px; }
.editor-area a { color: var(--info); text-decoration: underline; }
.editor-meta { display: flex; justify-content: space-between; padding: 7px 12px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 11px; color: var(--muted); }

.cover-preview { margin-top: 8px; width: 100%; max-height: 140px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); display: none; }
.cover-preview.on { display: block; }

.media-filter { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.media-filter .search-box { margin-bottom: 10px; }
.media-list { max-height: clamp(240px, calc(100vh - 580px), 520px); overflow-y: auto; padding: 8px; }
.media-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; transition: background .12s ease, border-color .12s ease;
}
.media-item:hover { background: var(--surface-2); }
.media-item.is-selected { background: var(--brand-soft); border-color: #eccbc5; }
.media-check {
  width: 17px; height: 17px; flex: 0 0 17px; border-radius: 5px;
  border: 1.5px solid #c8c2b2; background: var(--surface);
  display: grid; place-items: center; color: #fff; transition: all .12s ease;
}
.media-check svg { width: 11px; height: 11px; opacity: 0; }
.media-item.is-selected .media-check { background: var(--brand); border-color: var(--brand); }
.media-item.is-selected .media-check svg { opacity: 1; }
.media-main { min-width: 0; flex: 1; }
.media-name { display: block; font-size: 13px; font-weight: 550; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-price { font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.media-price small { display: block; font-size: 10px; font-weight: 400; color: var(--muted); text-align: right; }

.summary-bar { border-top: 1px solid var(--line); background: var(--surface-2); padding: 15px 18px; border-radius: 0 0 var(--radius) var(--radius); }
.summary-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.summary-total { font-size: 22px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.summary-actions { display: flex; gap: 8px; margin-top: 12px; }
.summary-actions .btn-primary { flex: 1; }

.picker-empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- article detail */

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.detail-title { font-family: var(--serif); font-size: 25px; line-height: 1.45; font-weight: 650; }
.detail-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 9px; color: var(--muted); font-size: 12px; }
.preview-frame { width: 100%; height: 560px; border: 0; border-radius: 10px; background: #fff; }
.preview-paper { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 34px 40px; font-size: 15px; line-height: 1.95; }
.preview-paper.preview-html img { max-width: 100%; }
.preview-paper .preview-title { font-family: var(--serif); font-size: 27px; line-height: 1.4; margin-bottom: 14px; }
.preview-paper .preview-sub { color: var(--muted); font-size: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.preview-paper h2 { font-family: var(--serif); font-size: 20px; margin: 24px 0 10px; }
.preview-paper p { margin: 0 0 14px; }
.preview-paper img { max-width: 100%; }

/* ---------------------------------------------------------------- orders */

.order-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.order-summary > div { background: var(--surface); padding: 15px 18px; }
.order-summary .k { font-size: 11px; color: var(--muted); }
.order-summary .v { font-size: 17px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.progress { display: flex; align-items: center; gap: 7px; }
.progress-track { width: 62px; height: 5px; border-radius: 3px; background: #eeeae0; overflow: hidden; }
.progress-fill { height: 100%; background: var(--ok); border-radius: 3px; }
.progress-fill.warn { background: #d69a26; }
.progress-text { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

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

/* ---------------------------------------------------------------- channels / api docs */

.channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.channel-card { padding: 19px 20px; }
.channel-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.channel-name { font-size: 14.5px; font-weight: 620; display: flex; align-items: center; gap: 8px; }
.channel-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.channel-remark { font-size: 12px; color: var(--sub); margin: 12px 0 14px; line-height: 1.7; min-height: 20px; }
.channel-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-top: 13px; border-top: 1px solid var(--line); }
.channel-actions .spacer { flex: 1; }

.code-block {
  background: #17171a; color: #e9e6dd; border-radius: 10px;
  padding: 14px 16px; font-family: var(--mono); font-size: 11.5px;
  line-height: 1.75; overflow-x: auto; white-space: pre; position: relative;
}
.code-block .code-copy { position: absolute; right: 8px; top: 8px; background: rgba(255,255,255,.08); color: #d7d4cc; border: 0; border-radius: 6px; padding: 4px 8px; font-size: 10.5px; font-family: var(--sans); }
.code-block .code-copy:hover { background: rgba(255,255,255,.16); }

.doc-list { display: flex; flex-direction: column; gap: 16px; }
.doc-item { border: 1px solid var(--line); border-radius: 10px; padding: 15px 17px; }
.doc-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.method { font-family: var(--mono); font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--ok-bg); color: var(--ok); }
.method.post { background: var(--info-bg); color: var(--info); }
.doc-path { font-family: var(--mono); font-size: 12.5px; }
.doc-desc { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.7; }
.doc-item .code-block { margin-top: 10px; }

.key-row { display: flex; align-items: center; gap: 10px; }
.key-value { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 3px 8px; border-radius: 5px; }
.key-new { background: #fffdf6; border: 1px solid #ecd9a8; border-radius: 10px; padding: 14px; margin-bottom: 16px; }

.copy-field { display: flex; gap: 7px; }
.copy-field .input { font-family: var(--mono); font-size: 12px; }

/* ---------------------------------------------------------------- finance */

.balance-card { background: linear-gradient(135deg, #1c1c20 0%, #28282d 100%); color: #f5f2ea; border: 0; position: relative; overflow: hidden; }
.balance-card::after { content: ""; position: absolute; right: -50px; bottom: -70px; width: 230px; height: 230px; border-radius: 50%; background: radial-gradient(circle, rgba(179,53,43,.35), transparent 70%); }
.balance-label { font-size: 12px; color: #a8a59c; }
.balance-value { font-size: 36px; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.balance-note { font-size: 11.5px; color: #a8a59c; }
.amount { font-variant-numeric: tabular-nums; font-weight: 550; }
.amount.in { color: var(--ok); }
.amount.out { color: var(--bad); }

/* ---------------------------------------------------------------- settings */

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .7fr); gap: 16px; align-items: start; }
.help-card { background: var(--surface-2); }
.help-card h3 { font-size: 13.5px; margin-bottom: 10px; }
.help-card p, .help-card li { font-size: 12px; color: var(--sub); line-height: 1.85; }
.help-card ul { padding-left: 17px; }
.check-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.check-line:last-child { border-bottom: 0; }
.check-line .t { font-size: 13px; font-weight: 500; }
.check-line .d { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .publish-grid { grid-template-columns: 1fr; }
  .publish-side { position: static; }
  .media-list { max-height: 400px; }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 20px 0 60px rgba(0,0,0,.2);
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(20,20,19,.4); display: none; }
  .sidebar-backdrop.on { display: block; }
  .mobile-toggle { display: inline-grid; }
  .topbar { padding: 0 18px; }
  .view { padding: 20px 18px 48px; }
  .login-page { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .channel-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .order-summary { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-intro { align-items: flex-start; }
  .page-intro h1 { font-size: 23px; }
  .topbar-title p { display: none; }
  .user-chip .name, .user-chip .role { display: none; }
  .user-chip { padding: 3px; border: 0; background: transparent; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .toolbar .search-box { width: 100%; }
  .toolbar .input, .toolbar .select { width: 100%; }
  .toolbar .spacer { display: none; }
  .preview-paper { padding: 22px 18px; }
  .order-summary { grid-template-columns: 1fr 1fr; }
  .modal { max-height: 92vh; }
  .modal-mask { padding: 3vh 12px 20px; }
  .detail-title { font-size: 21px; }
  .table th:first-child, .table td:first-child { padding-left: 14px; }
  .table th:last-child, .table td:last-child { padding-right: 14px; }
}

/* ---------------------------------------------------------------- notifications */

.notif-list { display: flex; flex-direction: column; }
.notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.notif-item:last-child { border-bottom: 0; }
.notif-dot { width: 6px; height: 6px; margin-top: 8px; border-radius: 50%; background: transparent; flex: 0 0 6px; }
.notif-item.unread .notif-dot { background: var(--brand); }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-content { font-size: 12px; color: var(--sub); margin-top: 2px; line-height: 1.7; word-break: break-word; }
.notif-time { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

/* ---------------------------------------------------------------- misc refinements */

.user-chip svg { width: 14px; height: 14px; color: var(--muted); }
.help-card .card-body { padding-top: 18px; }
.help-card ul { margin: 0; }
.doc-item details summary { list-style: none; }
.doc-item details summary::-webkit-details-marker { display: none; }
.doc-item details summary::before { content: '▸ '; color: var(--muted); }
.doc-item details[open] summary::before { content: '▾ '; }
.doc-item .code-block { font-size: 11px; }
.channel-grid > .empty { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.summary-line strong { color: var(--ink); }
.editor-area:focus { outline: none; }
.preview-frame { display: block; }
.order-summary .sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.table .actions .btn { padding: 0 8px; }
.btn-ghost.btn-sm[title] { color: var(--muted); }
.btn-ghost.btn-sm[title]:hover { color: var(--ink); }

/* ---------------------------------------------------------------- captcha */

.captcha-row { display: flex; align-items: center; gap: 8px; }
.captcha-row .input { flex: 1; min-width: 0; }
.captcha-img {
  width: 136px; height: 44px; flex: 0 0 136px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); cursor: pointer; object-fit: cover;
  transition: opacity .15s ease, border-color .15s ease;
}
.captcha-img:hover { border-color: var(--brand); }
.captcha-img.loading { opacity: .4; }
.captcha-refresh {
  width: 36px; height: 36px; flex: 0 0 36px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); color: var(--sub);
  display: grid; place-items: center; font-size: 16px;
}
.captcha-refresh:hover { color: var(--ink); border-color: var(--brand); }

@media (max-width: 420px) {
  .captcha-img { width: 116px; flex-basis: 116px; }
}
