* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; margin: 0; background: #f4f6f8; color: #26303a; font-size: 13.5px; }
.hidden { display: none !important; }
.muted { color: #8a95a1; }
.muted-light { color: #9db3c8; font-size: 13px; font-weight: 400; }
.error { color: #e74c3c; }
.ok { color: #27ae60; } .warn { color: #e67e22; }

/* 登录 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #2c3e50 0%, #4a6785 100%); }
.login-card { width: 350px; padding: 26px 28px; }
.login-card h3 { margin: 0; font-size: 17px; }
.row { margin-bottom: 12px; }
.row label { display: block; font-size: 12px; color: #7d8894; margin-bottom: 4px; }

/* 布局 */
.header { background: linear-gradient(135deg, #2c3e50, #34495e); color: #fff; padding: 13px 22px; display: flex; align-items: center; justify-content: space-between; }
.header h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.header-right { display: flex; align-items: center; gap: 14px; font-size: 12.5px; }
.topbar-fixed { position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 4px rgba(20,35,50,.08); }
.tabs { background: #fff; border-bottom: 1px solid #e3e8ee; display: flex; flex-wrap: wrap; padding: 0 14px; }
.tab { padding: 12px 16px; background: none; border: none; border-bottom: 2.5px solid transparent; color: #6b7885; font-size: 13.5px; cursor: pointer; }
.tab:hover { color: #2c3e50; }
.tab.active { color: #2c3e50; font-weight: 600; border-bottom-color: #2c3e50; }
.content { padding: 16px 22px 60px; max-width: 1440px; }

/* 卡片与表格 */
.card { background: #fff; border: 1px solid #e6ebf1; border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; overflow-x: auto; }
.card h3 { margin: 0 0 4px; font-size: 14.5px; }
.note { margin: 0 0 12px; font-size: 12px; color: #8a95a1; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 7px 9px; text-align: left; border-bottom: 1px solid #f0f3f7; white-space: nowrap; }
th { background: #fafbfc; color: #7d8894; font-weight: 600; }
tr:hover td { background: #f7fafc; }
td.wrap { white-space: normal; word-break: break-all; }
.table-scroll { overflow: auto; max-height: 64vh; border: 1px solid #e6ebf1; border-radius: 7px; }
.table-scroll th { position: sticky; top: 0; z-index: 1; box-shadow: 0 1px 0 #eef1f5; }

/* 控件 */
input, select, textarea, button { font: inherit; padding: 6px 10px; border: 1px solid #d5dce4; border-radius: 5px; font-size: 13px; background: #fff; color: #26303a; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 2px rgba(52,152,219,.15); }
button { cursor: pointer; }
button.primary { background: #2c3e50; border-color: #2c3e50; color: #fff; }
button.primary:hover { background: #34495e; }
button.ghost { background: #fff; color: #4a5866; }
button.ghost:hover { border-color: #b8c4cf; }
button.ghost-light { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 5px; padding: 4px 12px; }
button.ghost-light:hover { background: rgba(255,255,255,.22); }
button:disabled { opacity: .4; cursor: not-allowed; }
.full { width: 100%; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters .grow { flex: 1; min-width: 150px; }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 10px; font-size: 12.5px; color: #7d8894; }

/* 指标 */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }
.metric { background: #fff; border: 1px solid #e6ebf1; border-radius: 8px; padding: 11px 13px; }
.metric span { font-size: 12px; color: #8a95a1; }
.metric b { display: block; font-size: 21px; margin-top: 3px; color: #2c3e50; }
.metric b.ok { color: #27ae60; } .metric b.err { color: #e74c3c; } .metric b.warn { color: #e67e22; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); gap: 11px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #7d8894; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

/* 标签 */
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; border: 1px solid #d5dce4; color: #5c6b7a; }
.tag.hit { color: #27ae60; border-color: #27ae60; }
.tag.miss { color: #e74c3c; border-color: #e74c3c; }
.tag.module-dd { color: #8e44ad; border-color: #8e44ad; }
.tag.module-tmdb { color: #2980b9; border-color: #2980b9; }
.tag.module-bgm { color: #16a085; border-color: #16a085; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
textarea.code { width: 100%; min-height: 300px; resize: vertical; }

/* 弹窗 */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(25,35,45,.5); display: grid; place-items: center; z-index: 30; }
.dialog { background: #fff; border-radius: 10px; padding: 18px 20px; width: min(860px, 94vw); max-height: 90vh; overflow: auto; }
.dialog h3 { margin: 0 0 10px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 13px; margin: 0 0 12px; }
.kv dt { color: #8a95a1; } .kv dd { margin: 0; word-break: break-all; }
img.preview { max-width: 100%; max-height: 300px; border-radius: 8px; border: 1px solid #e6ebf1; }
.module-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.module-tabs button { border-radius: 999px; }
.module-tabs button.active { background: #2c3e50; border-color: #2c3e50; color: #fff; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }

/* 提示 */
.toast { position: fixed; right: 22px; top: 16px; background: #fff; border: 1px solid #e6ebf1; border-left: 4px solid #27ae60; border-radius: 8px; padding: 10px 16px; box-shadow: 0 6px 22px rgba(20,35,50,.18); opacity: 0; pointer-events: none; transition: opacity .25s; max-width: 420px; z-index: 50; }
.toast.show { opacity: 1; }
.toast.error { border-left-color: #e74c3c; }
