:root {
  --blue:#2563eb; --blue2:#1d4ed8; --bg:#f4f6fb; --side:#ffffff; --card:#fff;
  --text:#111827; --muted:#6b7280; --line:#e6eaf0; --green:#059669; --red:#dc2626;
  --primary:#2563eb; --primary-hover:#1d4ed8;
  --danger:#dc2626; --success:#059669; --warning:#d97706;
  --shadow:0 8px 24px rgba(15,23,42,.05);
  --radius:16px;
}
* { box-sizing:border-box; }
html, body { height:100%; }
body {
  margin:0; background:var(--bg); color:var(--text);
  font-family:Inter,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; font-size:14px; line-height:1.5;
}
a { color:var(--blue); text-decoration:none; }
a:hover { color:var(--blue2); }

.layout { display:flex; min-height:100vh; }
.side {
  width:248px; background:var(--side); border-right:1px solid var(--line); display:flex;
  flex-direction:column; position:sticky; top:0; height:100vh; flex-shrink:0;
}
.logo { display:flex; align-items:center; gap:12px; padding:22px 18px 18px; }
.logo .mark {
  width:38px; height:38px; border-radius:11px; background:linear-gradient(180deg,#3b82f6,#2563eb);
  color:#fff; display:flex; align-items:center; justify-content:center;
}
.logo b { display:block; font-size:14px; }
.logo span { display:block; color:var(--muted); font-size:12px; margin-top:2px; }
.nav { padding:8px; display:flex; flex-direction:column; gap:4px; flex:1; overflow:auto; }
.nav-label { margin:14px 12px 4px; font-size:12px; color:#9ca3af; }
.nav a {
  display:flex; align-items:center; gap:10px; padding:11px 12px; border-radius:10px;
  color:#4b5563; text-decoration:none; font-size:14px;
}
.nav a i { width:18px; text-align:center; }
.nav a:hover { background:#f3f6fb; color:var(--text); }
.nav a.on { background:#eff6ff; color:var(--blue); font-weight:600; }
.side-foot { margin-top:auto; padding:12px; border-top:1px solid var(--line); }
.side-foot a {
  display:flex; align-items:center; gap:10px; padding:11px 12px; border-radius:10px;
  color:#b91c1c; text-decoration:none; font-size:14px;
}
.side-foot a:hover { background:#fef2f2; }

.main { flex:1; min-width:0; }
.top {
  height:68px; background:#fff; border-bottom:1px solid var(--line); display:flex;
  align-items:center; justify-content:space-between; padding:0 24px; position:sticky; top:0; z-index:8; gap:12px;
}
.crumb { display:flex; flex-direction:column; gap:2px; min-width:0; }
.crumb h1 { margin:0; font-size:18px; display:flex; align-items:center; gap:8px; }
.crumb h1 i { color:var(--blue); }
.crumb p { margin:0; color:var(--muted); font-size:12px; }
.top-right { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.who-name { color:var(--muted); font-size:13px; display:inline-flex; align-items:center; gap:6px; }
.menu-btn { display:none; width:38px; height:38px; border:1px solid var(--line); background:#fff; border-radius:8px; }
.mask { display:none; }
.wrap { padding:22px; }

.tabs { display:flex; gap:8px; flex-wrap:wrap; }
.tabs a {
  padding:7px 12px; border-radius:999px; background:#fff; border:1px solid var(--line);
  color:var(--muted); text-decoration:none; font-size:12px; display:inline-flex; align-items:center; gap:6px;
}
.tabs a.on { background:var(--blue); border-color:var(--blue); color:#fff; }

.kpis { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:16px; }
.kpi { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:16px; box-shadow:var(--shadow); }
.kpi .row { display:flex; justify-content:space-between; align-items:flex-start; }
.kpi .ico { width:38px; height:38px; border-radius:11px; display:flex; align-items:center; justify-content:center; }
.kpi .label { color:var(--muted); font-size:13px; margin:12px 0 4px; }
.kpi .num { font-size:28px; font-weight:700; letter-spacing:-.04em; }
.c1 { background:#eff6ff; color:#2563eb; } .c2 { background:#ecfdf5; color:#059669; }
.c3 { background:#fffbeb; color:#d97706; } .c4 { background:#fef2f2; color:#dc2626; }
.delta { font-size:12px; font-weight:600; }
.delta.up { color:var(--green); } .delta.down { color:var(--red); } .delta.flat { color:var(--muted); }

.grid { display:grid; grid-template-columns:1.6fr .9fr; gap:14px; margin-bottom:14px; }
.mini { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:14px; }
.card, .panel, .form, .form.compact {
  background:var(--card); border:1px solid var(--line); border-radius:16px; padding:18px; box-shadow:var(--shadow);
}
.card h2, .panel h2 {
  margin:0 0 14px; font-size:15px; display:flex; align-items:center; gap:8px; font-weight:600;
}
.card h2 i, .panel h2 i { color:var(--blue); }
.form.compact { margin-bottom:16px; max-width:560px; }
.app-form { max-width:760px; }
.card { max-width:none; }

.sbar, .bar-row {
  display:grid; grid-template-columns:minmax(140px,180px) 1fr 42px; gap:8px; align-items:center;
  font-size:13px; margin:0 0 11px;
}
.sbar .n1, .bar-row .name { color:#374151; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:flex; align-items:center; gap:6px; }
.sbar .track, .bar-row .track { height:8px; background:#eef2f7; border-radius:99px; overflow:hidden; }
.sbar .track i, .bar-row .fill { display:block; height:100%; background:linear-gradient(90deg,#60a5fa,#2563eb); border-radius:99px; }
.sbar .n2, .bar-row .n { text-align:right; color:var(--muted); }
.flag { width:20px; height:15px; object-fit:cover; border-radius:2px; box-shadow:0 0 0 1px rgba(15,23,42,.12); flex-shrink:0; }
.empty { color:var(--muted); display:flex; align-items:center; gap:8px; padding:18px 0; }

table { width:100%; border-collapse:collapse; font-size:13px; background:transparent; }
th { text-align:left; color:var(--muted); font-weight:600; padding:11px 8px; border-bottom:1px solid var(--line); white-space:nowrap; background:transparent; }
td { padding:11px 8px; border-bottom:1px solid #f3f4f6; vertical-align:top; }
tr:hover td { background:#f8fafc; }
tr.row-bot td { background:#fff7ed; }
.tag { display:inline-flex; align-items:center; gap:4px; border-radius:999px; padding:3px 8px; font-size:12px; background:#f3f4f6; color:#6b7280; }
.tag.ok { background:#ecfdf5; color:#047857; }
.tag.bad { background:#fef2f2; color:#b91c1c; }
.tag.warn { background:#fffbeb; color:#b45309; }
.tag.info { background:#eff6ff; color:#1d4ed8; }
.mono { font-family:ui-monospace,Consolas,monospace; }
.muted { color:var(--muted); }
.tiny { font-size:12px; margin:4px 0 0; }
.hint { color:var(--muted); font-size:13px; }
.page-bar { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; gap:12px; flex-wrap:wrap; }
.row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.pager, .toolbar { display:flex; gap:8px; align-items:center; margin-top:12px; flex-wrap:wrap; }
.toolbar { margin:0 0 14px; }
.toolbar select { width:auto; min-width:132px; height:36px; }
.stat-filters { display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:space-between; margin-bottom:14px; }
.stat-search { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.stat-search select, .stat-search input { width:auto; min-width:132px; height:36px; }
.stat-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.table-wrap { overflow:auto; }
.hit-table .mono { font-size:12px; }

button, .btn {
  height:36px; padding:0 12px; border-radius:8px; border:1px solid var(--line); background:#fff;
  color:var(--text); text-decoration:none; font-size:13px; display:inline-flex; align-items:center;
  justify-content:center; gap:6px; cursor:pointer; font-family:inherit; line-height:1;
}
button:hover, .btn:hover { background:#f8fafc; color:var(--text); }
.btn.primary, button[type=submit]:not(.ghost):not(.danger) {
  background:var(--blue); color:#fff; border-color:var(--blue);
}
.btn.primary:hover, button[type=submit]:not(.ghost):not(.danger):hover { background:var(--blue2); color:#fff; }
.btn.ghost, button.ghost, .ghost-btn {
  background:#fff; color:#4b5563; border:1px solid var(--line); height:36px; padding:0 12px;
}
.btn.ghost:hover, .ghost-btn:hover { background:#f8fafc; color:var(--text); border-color:#d1d5db; }
button.danger, .btn.danger { background:#fff; color:#b91c1c; border-color:#fecaca; }
button.danger:hover, .btn.danger:hover { background:#fef2f2; }

label { display:block; margin:12px 0; color:#374151; font-size:13px; font-weight:600; }
input, select, textarea { font:inherit; }
input[type=text], input[type=password], input:not([type]), select, input[type=file],
input[type=number], input[type=date], input[type=time], input[type=datetime-local] {
  width:100%; height:40px; padding:0 12px; border:1px solid var(--line); border-radius:10px; background:#fafafa;
}
textarea { width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:#fafafa; }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--blue); background:#fff; box-shadow:0 0 0 4px rgba(37,99,235,.12); }
.chk { display:flex; align-items:center; gap:8px; font-weight:500; }
.chk input { width:auto; height:auto; }
.chk.tight { margin:0; }
.inline { display:inline; }

.flash, .warn, .okbox, .err {
  padding:10px 12px; margin-bottom:14px; border-radius:10px; font-size:13px; display:flex; align-items:center; gap:8px;
}
.flash { background:#eff6ff; color:#1d4ed8; }
.warn { background:#fef2f2; color:#b91c1c; }
.okbox { background:#ecfdf5; color:#047857; }
.err { background:#fef2f2; color:#b91c1c; }

h1 { font-size:18px; margin:0 0 16px; font-weight:600; }
.clip { max-width:360px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; vertical-align:bottom; }
.acts a, .acts button { margin:2px 4px 2px 0; }
fieldset { border:1px solid var(--line); margin:0 0 16px; padding:16px; border-radius:12px; }
legend { padding:0 8px; color:#4b5563; font-weight:600; }
pre.log { background:#0f172a; color:#e5e7eb; padding:12px; overflow:auto; max-height:240px; font-size:12px; margin:8px 0 0; border-radius:12px; }
.form-inline { display:inline-flex; flex-wrap:wrap; gap:6px; align-items:center; }
.form-inline input { width:auto; min-width:120px; }
.ban-actions { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.ban-actions form { margin:0; }
.rule-row { width:100%; }
.rule-row input[name=words] { min-width:220px; }
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
.grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:0 16px; }

.sched-bar, .sched-hero {
  border-radius:16px; padding:14px 16px; margin-bottom:16px; font-size:13px;
  display:flex; flex-wrap:wrap; gap:6px 10px; align-items:center; border:1px solid var(--line);
}
.sched-bar.is-on, .sched-hero.is-on { background:#ecfdf5; color:#047857; border-color:#d1fae5; }
.sched-bar.is-off, .sched-hero.is-off { background:#fffbeb; color:#b45309; border-color:#fde68a; }
.sched-state { font-size:20px; font-weight:700; margin-bottom:6px; }
.auto-tag { font-size:11px; font-weight:600; color:#b45309; background:#fffbeb; border-radius:999px; padding:2px 8px; margin-left:4px; }
.auto-tag.on { color:#047857; background:#ecfdf5; }
.pack-stat { margin:4px 0 0; font-size:12px; color:#4b5563; }
.pack-stat b { color:var(--text); }
.warn-inline { color:#d97706; }

.icon-preview { width:56px; height:56px; object-fit:cover; border-radius:12px; display:block; margin:8px auto 4px; pointer-events:none; }
.kind-pills { display:flex; gap:8px; margin-bottom:8px; }
.pill { margin:0; padding:7px 16px; border:1px solid var(--line); border-radius:999px; cursor:pointer; background:#fff; color:#4b5563; font-weight:500; }
.pill input { display:none; }
.pill:has(input:checked) { border-color:var(--blue); color:var(--blue); background:#eff6ff; }
.upload-row { display:grid; grid-template-columns:1.4fr 1fr; gap:12px; margin:8px 0 16px; }
.file-box-main { min-height:120px; }
.meta-card {
  display:flex; gap:14px; align-items:center; background:#f8fafc;
  border:1px solid var(--line); border-radius:16px; padding:12px 14px; margin:0 0 16px;
}
.facts-icon { width:56px; height:56px; border-radius:12px; object-fit:cover; background:#eff6ff; flex-shrink:0; }
.facts-letter {
  width:56px; height:56px; border-radius:12px; background:#eff6ff; color:var(--blue);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:20px; flex-shrink:0;
}
.facts-letter[hidden], .facts-icon[hidden], .icon-preview[hidden] { display:none !important; }
.facts-name { font-weight:600; font-size:15px; }
.facts-line { margin:2px 0 0; word-break:break-all; }
.facts-body { min-width:0; }
.file-box {
  position:relative; margin:0; padding:16px; border:1px dashed #d1d5db; border-radius:16px;
  text-align:center; background:#f8fafc; cursor:pointer; overflow:hidden;
}
.file-box:hover { border-color:var(--blue); background:#eff6ff; }
.file-box input[type=file] { position:absolute; inset:0; opacity:0; width:100%; height:100%; cursor:pointer; }
.file-title { display:block; font-weight:600; color:var(--text); margin-bottom:4px; pointer-events:none; }
.file-tip { display:block; color:var(--muted); font-size:12px; word-break:break-all; pointer-events:none; }
.adv { margin:8px 0 16px; background:#f8fafc; border-radius:16px; padding:4px 16px 8px; border:1px solid var(--line); }
.adv summary { cursor:pointer; padding:10px 0; color:#4b5563; font-weight:600; }
.form-actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:8px; align-items:center; }
.done-box { background:#ecfdf5; border:1px solid #d1fae5; border-radius:12px; padding:10px 14px; margin-bottom:16px; }
.done-box p { margin:6px 0; }

.empty-card {
  background:#fff; border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow);
  text-align:center; padding:64px 24px; color:var(--muted);
}
.empty-card h2 { color:var(--text); margin-bottom:8px; }
.empty-card .btn { margin-top:16px; }

.app-list { display:flex; flex-direction:column; gap:12px; }
.app-card {
  background:#fff; border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow); padding:16px 18px 12px;
}
.app-head { display:flex; align-items:center; gap:14px; }
.app-icon { width:48px; height:48px; border-radius:12px; object-fit:cover; flex-shrink:0; background:#eff6ff; }
.app-icon.letter { display:flex; align-items:center; justify-content:center; color:var(--blue); font-weight:700; font-size:18px; }
.app-meta { flex:1; min-width:0; }
.app-meta h3 { margin:0; font-size:16px; font-weight:600; }
.app-url { margin:2px 0 0; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.kind-tag { font-size:11px; font-weight:600; color:var(--blue); background:#eff6ff; border-radius:999px; padding:2px 8px; margin-left:6px; }
.badge {
  border:0; background:#f3f4f6; color:#6b7280; border-radius:999px;
  padding:4px 10px; font-size:12px; cursor:pointer; flex-shrink:0; font-weight:600;
}
.badge.st-FINISH { background:#ecfdf5; color:#047857; }
.badge.st-FAIL { background:#fef2f2; color:#b91c1c; }
.badge.st-PACKING, .badge.st-UNPACKING, .badge.st-QUEUED { background:#fffbeb; color:#b45309; }
.badge.st-CANCEL { background:#f3f4f6; color:var(--muted); }
.bar { height:6px; background:#eef2f7; margin:12px 0 10px; border-radius:99px; overflow:hidden; }
.bar i { display:block; height:100%; background:linear-gradient(90deg,#60a5fa,#2563eb); width:0; transition:width .3s; }
.app-foot { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.app-foot .when-idle, .app-foot .when-busy, .app-foot .dl-box { display:inline-flex; align-items:center; gap:8px; flex-wrap:wrap; }
.app-foot [hidden], .dl-box[hidden] { display:none !important; }
.app-card .row-log { margin-top:10px; }
.switch-form { margin:0; }
.switch { display:inline-flex; align-items:center; gap:6px; margin:0; cursor:pointer; color:var(--muted); font-size:13px; font-weight:500; }
.switch input { display:none; }
.switch span { width:34px; height:18px; background:#e5e7eb; border-radius:9px; position:relative; display:inline-block; }
.switch span::after {
  content:""; width:14px; height:14px; background:#fff; border-radius:50%;
  position:absolute; top:2px; left:2px; transition:left .15s;
}
.switch input:checked + span { background:var(--blue); }
.switch input:checked + span::after { left:18px; }
.more { position:relative; display:inline-block; }
.more summary { list-style:none; cursor:pointer; color:var(--muted); padding:8px 12px; border:1px solid var(--line); border-radius:8px; background:#fff; height:36px; }
.more summary::-webkit-details-marker { display:none; }
.more-menu {
  position:absolute; right:0; top:100%; margin-top:4px; background:#fff; border:1px solid var(--line);
  border-radius:12px; box-shadow:var(--shadow); padding:8px; z-index:5; min-width:140px;
}
.more-menu form { margin:4px 0; }
.more-menu button { width:100%; }

body.is-login {
  min-height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center;
  background:radial-gradient(1200px 500px at 10% -10%, #dbeafe 0%, transparent 50%), #f3f5f8;
}
.login-page { padding:12px 24px 24px; }
.search-wrap { position:relative; }
.search-wrap i { position:absolute; left:10px; top:10px; color:#9ca3af; }
.search { height:36px; border:1px solid var(--line); border-radius:8px; padding:0 12px 0 32px; min-width:220px; width:auto; background:#fff; }
.chart-box { position:relative; }
.login-card {
  width:min(92vw,400px); background:#fff; border:1px solid var(--line); border-radius:18px;
  padding:36px 32px; box-shadow:0 16px 50px rgba(15,23,42,.08);
}
.login-card .brand { display:flex; align-items:center; gap:12px; margin-bottom:28px; }
.login-card .brand i {
  width:44px; height:44px; border-radius:12px; background:#eff6ff; color:var(--blue);
  display:flex; align-items:center; justify-content:center; font-size:18px;
}
.login-card h1 { margin:0; font-size:18px; }
.login-card .brand p { margin:3px 0 0; color:var(--muted); font-size:13px; font-weight:400; }
.login-card .field { position:relative; margin-bottom:16px; }
.login-card .field i { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:#9ca3af; }
.login-card .field input { padding-left:38px; height:44px; }
.login-card button { width:100%; height:44px; margin-top:8px; font-size:15px; font-weight:600; border-radius:10px; }
.login-flash { max-width:400px; width:min(92vw,400px); margin:0 auto 12px; }

.hour-row { display:flex; align-items:flex-end; gap:4px; height:120px; padding:8px 0 0; }
.hour-col { flex:1; display:flex; flex-direction:column; align-items:center; height:100%; }
.hour-bar { flex:1; width:100%; display:flex; align-items:flex-end; }
.hour-bar i { display:block; width:100%; min-height:2px; background:#93c5fd; border-radius:3px 3px 0 0; }
.hour-col span { font-size:10px; color:#c0c4cc; margin-top:4px; }

@media (max-width: 1100px) {
  .kpis, .grid, .mini, .stat-grid { grid-template-columns:1fr; }
  .side { position:fixed; left:-260px; z-index:20; transition:left .2s; height:100vh; }
  .side.open { left:0; }
  .menu-btn { display:inline-flex; align-items:center; justify-content:center; }
  .mask.show { display:block; position:fixed; inset:0; background:rgba(15,23,42,.25); z-index:15; }
}
@media (max-width: 860px) {
  .grid-2, .grid-3, .upload-row { grid-template-columns:1fr; }
  .sbar, .bar-row { grid-template-columns:1fr 2fr 36px; }
  .wrap { padding:16px; }
  .kpis { grid-template-columns:1fr 1fr; }
}
