/* 东永工贸 · 管理后台 */
:root {
    --ink: #0A0C10;
    --ink-2: #14181F;
    --paper: #F4F2EE;
    --white: #fff;
    --text: #1A1D23;
    --muted: #6E7681;
    --muted-2: #9AA2AC;
    --line: #E3E0DA;
    --accent: #E4572E;
    --accent-2: #FF7A45;
    --ok: #1B7A4F;
    --ok-bg: #E7F4EE;
    --warn: #A96A00;
    --warn-bg: #FBF2DF;
    --danger: #B23A18;
    --danger-bg: #FBEAE4;
    --radius: 3px;
    --font: "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
    --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0; font-family: var(--font); font-size: 14px; color: var(--text);
    background: var(--paper); line-height: 1.7; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
button { font: inherit; }

/* 布局 */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 244px; flex: 0 0 244px; background: var(--ink); color: #fff;
    position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 22px 22px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sb-brand svg { width: 30px; height: 30px; }
.sb-brand .cn { font-size: 15px; font-weight: 700; letter-spacing: .04em; }
.sb-brand .en { display: block; font-family: var(--mono); font-size: 8.5px; letter-spacing: .2em; color: rgba(255,255,255,.42); margin-top: 2px; }
.sb-nav { padding: 16px 12px; overflow-y: auto; flex: 1; }
.sb-label { font-family: var(--mono); font-size: 10px; letter-spacing: .22em; color: rgba(255,255,255,.32); padding: 14px 12px 8px; }
.sb-nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 4px;
    color: rgba(255,255,255,.66); font-size: 13.5px; margin-bottom: 2px; transition: all .2s;
}
.sb-nav a svg { width: 17px; height: 17px; flex: 0 0 17px; }
.sb-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-nav a.on { background: var(--accent); color: #fff; }
.sb-nav a .count {
    margin-left: auto; font-family: var(--mono); font-size: 11px; padding: 1px 7px;
    background: rgba(255,255,255,.14); border-radius: 10px;
}
.sb-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: rgba(255,255,255,.4); }
.sb-foot a { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.6); margin-top: 8px; }
.sb-foot a svg { width: 14px; height: 14px; flex: 0 0 14px; opacity: .75; }
.sb-foot a:hover { color: #fff; }
.sb-foot a:hover svg { opacity: 1; }

.main { margin-left: 244px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 64px; background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    padding: 0 28px; position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 17px; }
.topbar .crumb { font-size: 12.5px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { font-size: 13px; color: var(--muted); }
.who b { color: var(--text); font-weight: 600; }
.content { padding: 28px; max-width: 1320px; width: 100%; }

/* 卡片 */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.card + .card { margin-top: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15px; }
.card-head .hint { font-size: 12.5px; color: var(--muted-2); }
.card-body { padding: 22px; }
.card-body.tight { padding: 0; }

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius);
    background: #fff; color: var(--text); font-size: 13px; cursor: pointer; white-space: nowrap;
    transition: all .2s;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: #C9C4BB; background: #FBFAF8; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #222833; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-danger { color: var(--danger); border-color: #F0D3C9; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-block { width: 100%; height: 44px; }

/* 表单 */
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; letter-spacing: .02em; }
.field .req { color: var(--accent); }
.input, .textarea, .select {
    width: 100%; padding: 9px 12px; font-family: inherit; font-size: 13.5px; color: var(--text);
    background: #fff; border: 1px solid #DDD9D2; border-radius: var(--radius); outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(228,87,46,.1); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.8; }
.textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 240px; }
.help { font-size: 12px; color: var(--muted-2); margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
.table th { background: #FAF9F7; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .04em; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FBFAF8; }
.table .t-title { font-weight: 600; }
.table .t-sub { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.table .t-actions { display: flex; gap: 8px; justify-content: flex-end; }
.table .num { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.table-wrap { overflow-x: auto; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-off { background: #EFEEEB; color: var(--muted); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-accent { background: var(--danger-bg); color: var(--danger); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--line); padding: 20px; border-radius: var(--radius); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border: 1px solid var(--line); border-radius: 50%; }
.stat-card .k { font-size: 12.5px; color: var(--muted); }
.stat-card .v { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -.03em; margin-top: 8px; }
.stat-card .v small { font-size: 12px; color: var(--muted-2); margin-left: 4px; letter-spacing: 0; }

/* 提示 */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 20px; border-left: 3px solid; }
.alert-ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.alert-err { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.empty { padding: 64px 20px; text-align: center; color: var(--muted-2); font-size: 13.5px; }

/* 工具条 */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar .spacer { flex: 1; }
.editor-bar { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px; background: #FAF9F7; border: 1px solid #DDD9D2; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.editor-bar button { height: 28px; min-width: 30px; padding: 0 8px; border: 1px solid transparent; background: transparent; border-radius: 2px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.editor-bar button:hover { background: #fff; border-color: var(--line); color: var(--text); }
.toolbar + .textarea { border-radius: 0 0 var(--radius) var(--radius); }

/* 登录 */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: var(--ink); }
.login-visual { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 56px; color: #fff; }
.login-visual::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(800px 500px at 70% 30%, rgba(228,87,46,.22), transparent 62%),
                linear-gradient(to right, rgba(255,255,255,.05) 1px, transparent 1px),
                linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px);
    background-size: auto, 72px 72px, 72px 72px;
}
.login-visual > * { position: relative; }
.login-visual .lv-tag { font-family: var(--mono); font-size: 10.5px; letter-spacing: .3em; color: var(--accent-2); }
.login-visual h2 { font-size: clamp(26px, 3vw, 40px); margin-top: 18px; max-width: 10em; line-height: 1.3; }
.login-visual p { margin-top: 18px; color: rgba(255,255,255,.5); font-size: 13.5px; max-width: 26em; line-height: 1.9; }
.login-form-wrap { background: var(--paper); display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form { width: 100%; max-width: 360px; }
.login-form h1 { font-size: 22px; }
.login-form .sub { color: var(--muted); font-size: 13px; margin-top: 8px; margin-bottom: 32px; }
.login-form .brand-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 40px; color: var(--ink); }
.login-form .brand-mini svg { width: 32px; height: 32px; }

/* 媒体卡 */
.thumb { width: 54px; height: 40px; background: #14181F; border-radius: 2px; display: grid; place-items: center; color: rgba(255,255,255,.35); overflow: hidden; flex: 0 0 54px; }
.thumb svg { width: 22px; height: 22px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.cell-media { display: flex; align-items: center; gap: 12px; }

.split-2 { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.sticky-side { position: sticky; top: 96px; }

@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); transition: transform .3s; }
    .sidebar.open { transform: none; }
    .main { margin-left: 0; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row, .split-2 { grid-template-columns: 1fr; }
    .login-page { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .content { padding: 18px; }
    .sb-toggle { display: inline-flex !important; }
}
.sb-toggle { display: none; }
