:root {
  --bg: #f4efe7;
  --paper: #fffdf9;
  --paper-strong: #ffffff;
  --ink: #201a15;
  --muted: #82766a;
  --line: rgba(70, 52, 35, 0.12);
  --accent: #a87549;
  --accent-dark: #7b5130;
  --accent-soft: #f3e5d4;
  --rose: #c9807a;
  --rose-soft: #faece9;
  --moss: #647866;
  --moss-soft: #e9f0e8;
  --blue: #65759f;
  --blue-soft: #edf0f8;
  --danger: #ae4e42;
  --danger-soft: #fae9e6;
  --shadow: 0 18px 56px rgba(63, 43, 24, 0.09);
  --shadow-small: 0 8px 28px rgba(63, 43, 24, 0.07);
  font-family: "PingFang SC", "SF Pro Display", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; color: var(--ink); background:
  radial-gradient(circle at 88% 4%, rgba(225, 199, 166, .32), transparent 28rem),
  linear-gradient(145deg, #faf7f1 0, var(--bg) 55%, #efe6d9 100%); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.mobile-only { display: none; }

.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 28px; }
.login-card { width: 100%; max-width: 470px; min-width: 0; overflow: hidden; padding: 46px; border: 1px solid rgba(255,255,255,.82); border-radius: 36px; background: rgba(255,253,249,.9); box-shadow: var(--shadow); backdrop-filter: blur(22px); }
.brand-mark { position: relative; width: 68px; height: 68px; margin-bottom: 26px; border-radius: 21px; background: #171411; box-shadow: 0 16px 32px rgba(0,0,0,.16); }
.brand-mark i { position: absolute; top: 23px; width: 30px; height: 21px; border: 2px solid #e7c98e; border-radius: 50%; }
.brand-mark i:first-child { left: 13px; transform: rotate(12deg); }
.brand-mark i:last-child { right: 13px; transform: rotate(-12deg); }
.brand-mark.small { width: 46px; height: 46px; margin: 0; border-radius: 14px; }
.brand-mark.small i { top: 15px; width: 21px; height: 15px; }
.brand-mark.small i:first-child { left: 8px; }
.brand-mark.small i:last-child { right: 8px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 900; letter-spacing: .21em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; overflow-wrap: anywhere; font-size: 38px; letter-spacing: -.06em; }
h2 { margin: 0; font-size: 28px; letter-spacing: -.055em; }
h3 { margin-bottom: 6px; font-size: 22px; letter-spacing: -.045em; }
.muted, .panel-heading p, .security-note { color: var(--muted); }
.login-form { display: grid; gap: 16px; margin-top: 30px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 800; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid transparent; border-radius: 15px; outline: none; background: #f3ede5; color: var(--ink); padding: 13px 14px; transition: .18s ease; }
input:focus, select:focus, textarea:focus { border-color: rgba(168,117,73,.48); background: white; box-shadow: 0 0 0 4px rgba(168,117,73,.1); }
textarea { resize: vertical; line-height: 1.75; }
.form-error { min-height: 20px; margin: -4px 0; color: var(--danger); font-size: 13px; font-weight: 800; }
.security-note { margin: 20px 0 0; font-size: 12px; line-height: 1.65; }

.primary, .secondary, .ghost, .danger-soft { border: 0; border-radius: 14px; padding: 12px 17px; font-weight: 900; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.primary { background: var(--ink); color: white; box-shadow: 0 8px 20px rgba(32,26,21,.16); }
.primary:hover, .secondary:hover { transform: translateY(-1px); }
.secondary { border: 1px solid var(--line); background: white; color: var(--ink); }
.ghost { background: rgba(255,255,255,.07); color: inherit; }
.danger-soft { background: var(--danger-soft); color: var(--danger); }
.wide { width: 100%; }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--ink); font-size: 22px; }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 248px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 24px 18px; overflow-y: auto; background: #191613; color: white; box-shadow: 18px 0 60px rgba(33,24,16,.08); z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: 13px; padding: 0 8px 26px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 19px; }
.sidebar-brand span { margin-top: 2px; color: rgba(255,255,255,.48); font-size: 11px; font-weight: 800; letter-spacing: .15em; }
#mainNav { display: grid; gap: 5px; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 12px; border: 0; border-radius: 14px; background: transparent; color: rgba(255,255,255,.6); padding: 12px 13px; text-align: left; font-size: 14px; font-weight: 900; transition: .18s ease; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: #241b14; background: linear-gradient(135deg, #f4dfc5, #e8c99e); box-shadow: 0 10px 24px rgba(0,0,0,.2); }
.nav-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; background: rgba(255,255,255,.07); font-size: 13px; }
.nav-item.active .nav-icon { background: rgba(255,255,255,.42); }
.sidebar-footer { display: grid; gap: 14px; margin-top: auto; padding-top: 24px; }
.system-state { display: flex; align-items: center; gap: 10px; padding: 11px; border-radius: 13px; background: rgba(255,255,255,.05); }
.system-state strong, .system-state small { display: block; }
.system-state strong { font-size: 12px; }
.system-state small { margin-top: 2px; color: rgba(255,255,255,.45); font-size: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #86b18a; box-shadow: 0 0 0 5px rgba(134,177,138,.13); }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; display: flex; min-height: 96px; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 32px; border-bottom: 1px solid rgba(70,52,35,.07); background: rgba(248,244,238,.82); backdrop-filter: blur(22px); z-index: 15; }
.topbar-actions, .toolbar, .filter-row, .segmented { display: flex; align-items: center; gap: 10px; }
.last-updated { color: var(--muted); font-size: 12px; font-weight: 800; }
.content { padding: 28px 32px 110px; }
.page { animation: pageIn .22s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(5px); } }

.panel { min-width: 0; padding: 24px; border: 1px solid rgba(255,255,255,.9); border-radius: 26px; background: rgba(255,253,249,.88); box-shadow: var(--shadow-small); backdrop-filter: blur(16px); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.panel-heading p:last-child { margin: 4px 0 0; font-size: 13px; font-weight: 700; line-height: 1.6; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card { position: relative; min-height: 142px; overflow: hidden; padding: 21px; border: 1px solid rgba(255,255,255,.85); border-radius: 23px; background: rgba(255,253,249,.9); box-shadow: var(--shadow-small); }
.metric-card::after { content:""; position:absolute; width: 92px; height:92px; right:-26px; top:-27px; border-radius:50%; background: var(--tone, var(--accent-soft)); opacity:.7; }
.metric-card span, .metric-card strong, .metric-card small { position: relative; display:block; z-index:1; }
.metric-card span { color: var(--muted); font-size:12px; font-weight:900; }
.metric-card strong { margin-top: 12px; font-size:34px; letter-spacing:-.06em; }
.metric-card small { margin-top:10px; color:var(--muted); font-weight:700; }
.dashboard-grid { display:grid; grid-template-columns: minmax(0,1.55fr) minmax(290px,.65fr); gap:20px; }
.dashboard-grid .span-2 { min-width:0; }
.segmented { width: fit-content; padding:4px; border-radius:14px; background:#eee7de; }
.segmented button { border:0; border-radius:10px; background:transparent; color:var(--muted); padding:8px 13px; font-size:12px; font-weight:900; }
.segmented button.active { background:white; color:var(--ink); box-shadow:0 4px 14px rgba(63,43,24,.09); }
.trend-chart { min-height: 310px; }
.chart-legend { display:flex; flex-wrap:wrap; gap:16px; margin-bottom:16px; color:var(--muted); font-size:11px; font-weight:800; }
.legend-dot { display:inline-block; width:8px; height:8px; margin-right:5px; border-radius:50%; }
.trend-chart svg { overflow:visible; }
.trend-chart text { font-family:inherit; }
.pulse-list, .audit-list, .report-list, .feedback-list, .content-list { display:grid; gap:11px; }
.pulse-item { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:15px; border:1px solid var(--line); border-radius:16px; background:white; }
.pulse-item strong, .pulse-item small { display:block; }
.pulse-item small { margin-top:4px; color:var(--muted); }
.pulse-value { font-size:21px; font-weight:900; }

.summary-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:20px; }
.summary-card { padding:18px 20px; border-radius:20px; background:white; box-shadow:var(--shadow-small); }
.summary-card span { color:var(--muted); font-size:12px; font-weight:900; }
.summary-card strong { display:block; margin-top:7px; font-size:28px; }
.toolbar { flex-wrap:wrap; justify-content:flex-end; }
.toolbar input { width:210px; }
.toolbar select { width:auto; min-width:130px; }
.filter-row { justify-content:space-between; gap:18px; margin-bottom:20px; }
.data-scope-notice { display:flex; align-items:flex-start; gap:12px; margin:-5px 0 20px; padding:14px 16px; border:1px solid #ead9c5; border-radius:16px; background:linear-gradient(135deg,#fff9f1,#f6eee4); color:#72563b; }
.data-scope-notice strong { flex:0 0 auto; font-size:12px; }
.data-scope-notice span { color:#8a7159; font-size:12px; font-weight:700; line-height:1.65; }
.data-scope-notice.compact { margin-top:-8px; }
.data-scope-notice.in-drawer { margin:15px 0 0; background:#f8f3ec; }
.data-scope-notice.warning { border-color:#efd5b2; background:#fff7ea; }
.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:18px; background:white; }
table { width:100%; min-width:820px; border-collapse:collapse; text-align:left; }
th { padding:13px 16px; background:#f3ece3; color:var(--muted); font-size:11px; font-weight:900; letter-spacing:.04em; }
td { padding:14px 16px; border-top:1px solid var(--line); font-size:13px; vertical-align:middle; }
tbody tr:hover { background:#fffaf3; }
.identity { display:flex; align-items:center; gap:11px; min-width:180px; }
.avatar { width:42px; height:42px; flex:0 0 auto; border-radius:14px; background:var(--accent-soft); object-fit:cover; }
.avatar.round { border-radius:50%; }
.identity strong, .identity small { display:block; }
.identity small, .subtle { margin-top:3px; color:var(--muted); font-size:11px; font-weight:700; }
.server-content-cell { min-width:210px; }
.server-content-cell .content-counts { margin-bottom:7px; }
.server-content-cell .badge { margin-right:5px; }
.badge { display:inline-flex; align-items:center; border-radius:999px; padding:5px 9px; background:#eee8e0; color:var(--muted); font-size:10px; font-weight:900; white-space:nowrap; }
.badge.ok { background:var(--moss-soft); color:#48624b; }
.badge.warn { background:#fff0dc; color:#976126; }
.badge.danger { background:var(--danger-soft); color:var(--danger); }
.badge.vip { background:#211b16; color:#ead09e; }
.mini-button { border:1px solid var(--line); border-radius:10px; background:white; padding:7px 10px; color:var(--ink); font-size:11px; font-weight:900; }
.pagination { display:flex; min-height:38px; align-items:center; justify-content:flex-end; gap:8px; margin-top:16px; color:var(--muted); font-size:12px; font-weight:800; }
.pagination button { border:1px solid var(--line); border-radius:10px; background:white; padding:7px 11px; font-weight:900; }

.space-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.space-card { display:grid; grid-template-columns:88px minmax(0,1fr); gap:16px; padding:16px; border:1px solid var(--line); border-radius:21px; background:white; transition:.16s ease; }
.space-card:hover { transform:translateY(-2px); box-shadow:var(--shadow-small); }
.space-cover { display:grid; width:88px; height:96px; place-items:center; overflow:hidden; border-radius:17px; background:linear-gradient(145deg,#f2d9c0,#d6b18b); color:white; font-size:28px; font-weight:900; }
.space-cover img { width:100%; height:100%; object-fit:cover; }
.space-card h4 { margin:1px 0 5px; font-size:16px; }
.space-card p { height:37px; margin:0 0 10px; overflow:hidden; color:var(--muted); font-size:12px; line-height:1.55; }
.space-stats { display:flex; flex-wrap:wrap; gap:6px; }
.space-meta { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:12px; }

.content-card, .feedback-card, .report-card, .audit-item { padding:15px 17px; border:1px solid var(--line); border-radius:17px; background:white; }
.content-card { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:16px; align-items:center; }
.content-card h4, .feedback-card h4, .report-card h4 { margin:0 0 7px; font-size:14px; }
.content-card p, .feedback-card p, .report-card p { margin:0; color:var(--muted); font-size:12px; line-height:1.65; }
.content-meta { display:flex; flex-wrap:wrap; gap:7px; margin-top:10px; }
.moderation-layout { grid-template-columns:minmax(330px,.75fr) minmax(0,1.25fr); }
.audit-item { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.audit-item strong, .audit-item small { display:block; }
.audit-item small { margin-top:5px; color:var(--muted); line-height:1.5; }
.report-actions { display:flex; flex-wrap:wrap; gap:7px; margin-top:12px; }
.report-actions button { border:1px solid var(--line); border-radius:9px; background:#f7f2ec; padding:6px 9px; font-size:10px; font-weight:900; }

.asset-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.asset-card { overflow:hidden; border:1px solid var(--line); border-radius:20px; background:white; }
.asset-preview { height:170px; background:#eee7de; }
.asset-preview img { width:100%; height:100%; object-fit:cover; }
.asset-info { padding:13px; }
.asset-info h4 { margin:0 0 5px; font-size:13px; }
.asset-actions { display:flex; gap:7px; margin-top:11px; }
.asset-actions button { flex:1; }
.settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:15px; }
.form-grid .full { grid-column:1/-1; }
.input-action { display:flex; gap:8px; }
.input-action input { flex:1; }
.check-label { display:flex; align-items:center; gap:8px; align-self:end; padding:12px 0; }
.check-label input { width:auto; }
.switch { display:block; }
.switch input { display:none; }
.switch span { position:relative; display:block; width:48px; height:28px; border-radius:999px; background:#d9d2c9; transition:.2s; }
.switch span::after { content:""; position:absolute; top:4px; left:4px; width:20px; height:20px; border-radius:50%; background:white; box-shadow:0 3px 9px rgba(0,0,0,.18); transition:.2s; }
.switch input:checked + span { background:var(--moss); }
.switch input:checked + span::after { transform:translateX(20px); }
.sticky-save { position:fixed; right:32px; bottom:24px; display:flex; align-items:center; gap:22px; padding:12px 13px 12px 20px; border:1px solid rgba(255,255,255,.8); border-radius:18px; background:rgba(255,253,249,.9); box-shadow:var(--shadow); backdrop-filter:blur(18px); z-index:14; }
.sticky-save span { color:var(--muted); font-size:12px; font-weight:800; }

.drawer-backdrop { position:fixed; inset:0; background:rgba(27,21,17,.24); backdrop-filter:blur(3px); z-index:39; }
.detail-drawer { position:fixed; top:0; right:0; width:min(680px,94vw); height:100vh; transform:translateX(105%); background:#faf7f1; box-shadow:-30px 0 90px rgba(30,22,15,.2); transition:transform .24s ease; z-index:40; }
.detail-drawer.open { transform:translateX(0); }
.detail-drawer header { display:flex; min-height:92px; align-items:center; justify-content:space-between; padding:22px 25px; border-bottom:1px solid var(--line); background:rgba(255,253,249,.9); }
.detail-drawer header h3 { margin:0; }
.drawer-content { height:calc(100vh - 92px); padding:22px 25px 50px; overflow:auto; }
.detail-section { margin-bottom:20px; padding:18px; border:1px solid var(--line); border-radius:19px; background:white; }
.detail-section h4 { margin:0 0 14px; }
.detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.detail-field { padding:11px 12px; border-radius:12px; background:#f5efe8; }
.detail-field span, .detail-field strong { display:block; }
.detail-field span { color:var(--muted); font-size:10px; font-weight:900; }
.detail-field strong { margin-top:5px; overflow-wrap:anywhere; font-size:12px; }
.detail-list { display:grid; gap:8px; }
.detail-row { padding:12px; border:1px solid var(--line); border-radius:13px; }
.detail-row strong, .detail-row small { display:block; }
.detail-row small { margin-top:4px; color:var(--muted); line-height:1.55; }

.modal { width:min(560px,calc(100% - 28px)); border:0; border-radius:25px; background:#faf7f1; padding:0; box-shadow:0 32px 100px rgba(31,22,15,.25); }
.modal::backdrop { background:rgba(28,21,16,.34); backdrop-filter:blur(4px); }
.modal form { padding:23px; }
.modal-heading, .modal-actions { display:flex; align-items:center; justify-content:space-between; gap:15px; }
.modal-heading { margin-bottom:20px; }
.modal-heading h3 { margin:0; }
.modal-actions { justify-content:flex-end; margin-top:22px; }
.toast { position:fixed; left:50%; bottom:26px; max-width:min(520px,calc(100% - 30px)); transform:translate(-50%,20px); border-radius:999px; background:#1d1915; color:white; padding:12px 18px; opacity:0; pointer-events:none; font-size:12px; font-weight:900; box-shadow:var(--shadow); transition:.2s; z-index:80; }
.toast.show { opacity:1; transform:translate(-50%,0); }
.loading-overlay { position:fixed; inset:0; display:grid; place-content:center; justify-items:center; gap:12px; background:rgba(248,244,238,.68); color:var(--muted); font-size:12px; font-weight:900; backdrop-filter:blur(5px); z-index:70; }
.loader { width:36px; height:36px; border:3px solid #dfd5c9; border-top-color:var(--accent); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.empty-state { padding:44px 20px; border:1px dashed var(--line); border-radius:18px; color:var(--muted); text-align:center; font-size:13px; font-weight:800; }

@media (max-width: 1180px) {
  .metric-grid, .asset-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .settings-grid { grid-template-columns:1fr; }
}
@media (max-width: 900px) {
  .mobile-only { display:grid; }
  .app-shell { grid-template-columns:1fr; }
  .sidebar { position:fixed; left:0; transform:translateX(-105%); width:248px; transition:.22s; }
  .sidebar.open { transform:translateX(0); }
  .topbar { padding:17px 20px; }
  .content { padding:20px 18px 100px; }
  .dashboard-grid, .moderation-layout { grid-template-columns:1fr; }
  .summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .space-grid { grid-template-columns:1fr; }
  .topbar-actions .last-updated { display:none; }
}
@media (max-width: 620px) {
  h2 { font-size:23px; }
  .login-card { padding:32px 25px; }
  .topbar-actions .secondary { display:none; }
  .panel { padding:18px; border-radius:21px; }
  .panel-heading, .filter-row { flex-direction:column; align-items:stretch; }
  .toolbar { justify-content:stretch; }
  .toolbar input, .toolbar select { width:100%; }
  .metric-grid, .summary-grid, .asset-grid { grid-template-columns:1fr 1fr; gap:10px; }
  .metric-card { min-height:126px; padding:17px; }
  .metric-card strong { font-size:28px; }
  .space-card { grid-template-columns:68px minmax(0,1fr); }
  .space-cover { width:68px; height:78px; }
  .form-grid, .detail-grid { grid-template-columns:1fr; }
  .form-grid .full { grid-column:auto; }
  .sticky-save { left:16px; right:16px; bottom:14px; justify-content:space-between; }
  .sticky-save span { display:none; }
}
