/* WBTL CCP Master Bug 提交站 —— 样式（契约 docs/04-外部契约/13 §6）。
   不引外部字体与 CDN（公司网络可能拦），跟随系统亮暗。 */

:root {
  color-scheme: light dark;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --text: #1c2330;
  --muted: #5f6c80;
  --line: #dde2e9;
  --line-strong: #c5cdd8;
  --accent: #2563eb;
  --accent-hover: #1d4fd8;
  --accent-text: #ffffff;
  --accent-soft: #e8efff;
  --danger: #c2363a;
  --danger-soft: #fdecec;
  --warn: #8a5a00;
  --warn-soft: #fff4d9;
  --s-open: #2563eb;
  --s-confirmed: #a8620a;
  --s-fixed: #1f8a55;
  --s-closed: #6b7686;
  --s-wontfix: #7c4dcc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 8px rgba(15, 23, 42, 0.04);
  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --panel: #1a1e26;
    --panel-2: #20252f;
    --text: #e4e8ef;
    --muted: #98a3b4;
    --line: #2b313d;
    --line-strong: #3b4351;
    --accent: #5b8def;
    --accent-hover: #76a1f3;
    --accent-text: #0b1220;
    --accent-soft: #1d2a44;
    --danger: #ef6b6b;
    --danger-soft: #3a1d20;
    --warn: #f0c56a;
    --warn-soft: #3a2f14;
    --s-open: #74a0f3;
    --s-confirmed: #e3a64a;
    --s-fixed: #55c08a;
    --s-closed: #8e98a8;
    --s-wontfix: #b293f2;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.35; margin: 0; font-weight: 600; }
h2 { font-size: 16px; line-height: 1.4; margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }

/* ---------- 顶栏 ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 20px; }
.brand { font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; }
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 16px; flex: 1; }
.nav a:not(.btn) { color: var(--muted); }
.nav a.active { color: var(--text); font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.who form { margin: 0; }
.role-badge { font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.who-name { color: var(--muted); max-width: 10em; overflow: hidden; text-overflow: ellipsis; }

.container { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.page-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }

/* ---------- 按钮与表单 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; background: var(--panel-2); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field em { color: var(--danger); font-style: normal; }
input[type="text"], input[type="password"], input[type="search"], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px;
}
/* 单行输入框、下拉框和按钮一样高，排在同一行时才齐 */
input[type="text"], input[type="password"], input[type="search"], input:not([type]), select { height: 36px; padding-top: 0; padding-bottom: 0; }
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
.form-msg { color: var(--muted); }
.form-msg.error { color: var(--danger); }
.alert { padding: 10px 12px; border-radius: 8px; margin: 0 0 14px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

.login-card { max-width: 420px; margin: 8vh auto 0; }
.login-card h1 { margin-bottom: 6px; }
.login-card .form { margin-top: 18px; }
.message-card { max-width: 560px; margin: 6vh auto 0; }
.message-card h1 { margin-bottom: 10px; }

/* ---------- 列表 ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; }
.chip:hover { text-decoration: none; color: var(--text); border-color: var(--line-strong); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.filters { display: flex; gap: 8px; align-items: center; margin: 0; }
.filters select { width: auto; min-width: 9em; }
.filters input[type="search"] { width: 14em; }

.bug-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.bug-table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); background: var(--panel-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.bug-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.bug-table tbody tr:last-child td { border-bottom: 0; }
.bug-table tbody tr:hover td { background: var(--panel-2); }
.c-id { color: var(--muted); width: 56px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-title a { color: var(--text); font-weight: 600; }
.counts { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.c-module, .c-version, .c-reporter, .c-time { white-space: nowrap; color: var(--muted); }
.c-status { white-space: nowrap; }

.badge { display: inline-block; font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; background: transparent; background: color-mix(in srgb, currentColor 10%, transparent); }
.s-open { color: var(--s-open); }
.s-confirmed { color: var(--s-confirmed); }
.s-fixed { color: var(--s-fixed); }
.s-closed { color: var(--s-closed); }
.s-wontfix { color: var(--s-wontfix); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

/* ---------- 附件选择 ---------- */
.attach { margin-bottom: 14px; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 14px 16px; background: var(--panel-2); text-align: center; transition: border-color 0.15s, background 0.15s; }
.drop p { margin: 0; }
.drop .hint { margin-top: 6px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.pick { color: var(--accent); cursor: pointer; position: relative; margin-left: 2px; }
.pick:hover { text-decoration: underline; }
.pick input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
kbd { font: 12px var(--mono); padding: 0 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--panel); }
.files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.files:empty { display: none; }
.files li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.files .thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); flex: none; }
.files .file-icon { width: 64px; height: 48px; border-radius: 6px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); background: var(--panel-2); flex: none; text-transform: uppercase; }
.files .file-info { flex: 1; min-width: 0; }
.files .file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .file-size { color: var(--muted); font-size: 12px; }
.files .file-note { display: block; font-size: 12px; color: var(--warn); }
.files .file-note.error { color: var(--danger); }
.files .remove { flex: none; }

/* ---------- 详情 ---------- */
.bug h1 { margin-bottom: 10px; }
.bug-id { color: var(--muted); font-weight: 500; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: var(--muted); font-size: 13px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.meta b { font-weight: 500; color: var(--text); margin-right: 2px; }
.text { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.bug-body { font-size: 15px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 14px; }
.shot { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.shot img { display: block; width: 100%; height: 150px; object-fit: contain; background: var(--panel-2); }
.shot figcaption { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 12px; border-top: 1px solid var(--line); background: var(--panel); }
.shot-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 10px; }
.file-list li a::before { content: "\1F4CE"; margin-right: 4px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.event { position: relative; padding: 0 0 18px 20px; border-left: 2px solid var(--line); margin-left: 6px; }
.event:last-child { padding-bottom: 2px; }
.event::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--accent); }
.event-status::before { border-color: var(--s-fixed); background: var(--s-fixed); }
.event-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 2px; }
.event-status .text { color: var(--muted); }
.event .gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-top: 8px; }

.admin-panel { border-color: var(--line-strong); }
.banner { margin-bottom: 16px; }

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  .topbar-inner { gap: 12px; }
  .who-name, .nav a:not(.btn) { display: none; }
  .container { padding-top: 16px; }
  .card { padding: 16px; }
  .filters { width: 100%; flex-wrap: wrap; }
  .filters select, .filters input[type="search"] { flex: 1; width: auto; min-width: 0; }
  .bug-table thead { display: none; }
  .bug-table, .bug-table tbody { display: block; width: 100%; }
  /* 每条两行：编号 + 标题；状态、模块、版本、提交人、时间 */
  .bug-table tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .bug-table tbody tr:last-child { border-bottom: 0; }
  .bug-table td { display: block; width: auto; padding: 0; border: 0; }
  .bug-table tbody tr:hover td { background: transparent; }
  .bug-table .c-id { order: 1; }
  .bug-table .c-title { order: 2; flex: 1 1 calc(100% - 64px); min-width: 0; }
  .bug-table .c-status { order: 3; margin-top: 4px; }
  .bug-table .c-module { order: 4; }
  .bug-table .c-version { order: 5; }
  .bug-table .c-reporter { order: 6; }
  .bug-table .c-time { order: 7; }
  .bug-table .c-module, .bug-table .c-version, .bug-table .c-reporter, .bug-table .c-time { font-size: 12px; }
}
