/* 落ち着いた灰色を基本にし、色はシートの種類を示す小さな点だけに使う */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --subtle: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --primary: #18181b;
  --primary-hover: #27272a;
  --ring: rgba(24, 24, 27, 0.12);
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;
  --ok: #16a34a;
  --dot-共通: #a1a1aa;
  --dot-大分類: #8b5cf6;
  --dot-グループ: #0ea5e9;
  --dot-商品: #10b981;
  --dot-未使用: #f59e0b;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.65 Inter, "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------------------------------------------------------------- 上のバー */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--primary); position: relative; }
.logo::after { content: ""; position: absolute; inset: 6px 5px; border: 2px solid #fff; border-top: 0; border-radius: 0 0 6px 6px; }
.brand-title { font-weight: 600; font-size: 15px; }
.brand-client {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}
.brand-client:empty { display: none; }
.tabs { display: flex; gap: 2px; height: 100%; }
.tab {
  position: relative;
  border: 0;
  background: none;
  padding: 0 12px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); }
.tab.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--text); border-radius: 2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.mode { display: flex; align-items: center; gap: 10px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warning-text); }
.status.is-web::before { background: var(--ok); }
.user { font-size: 12px; color: var(--muted); }

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 24px 0;
  padding: 10px 14px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 13px;
}
.notice.error { border-color: #fecaca; background: var(--danger-soft); color: var(--danger); }

/* ---------------------------------------------------------------- 配置 */
.layout { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 24px; padding: 20px 24px 48px; align-items: start; }
.single { padding: 24px 24px 48px; max-width: 1200px; }

.sidebar { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; padding-right: 4px; }
.sidebar-section { padding: 2px 2px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.sheet-group-title { font-size: 11px; font-weight: 600; color: var(--faint); margin: 14px 10px 4px; text-transform: uppercase; letter-spacing: 0.06em; }
.sheet-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  text-align: left;
  color: var(--text-2);
}
.sheet-item:hover { background: var(--subtle); color: var(--text); }
.sheet-item.is-active { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.sheet-item .order { color: var(--faint); font-size: 12px; width: 14px; text-align: right; }
.sheet-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-item .count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.sheet-item.is-special { color: var(--text); font-weight: 500; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--faint)); flex-shrink: 0; }
.k-共通 { --dot: var(--dot-共通); }
.k-大分類 { --dot: var(--dot-大分類); }
.k-グループ { --dot: var(--dot-グループ); }
.k-商品 { --dot: var(--dot-商品); }
.k-未使用 { --dot: var(--dot-未使用); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 8px;
  background: var(--surface);
  white-space: nowrap;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot, var(--faint)); }

/* ---------------------------------------------------------------- 見出し・操作 */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.page-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.page-desc { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
/* ナレッジ一覧の見出し・検索を、上のバー（高さ56px）のすぐ下に残す */
.sticky-head { position: sticky; top: 56px; z-index: 4; background: var(--bg); margin-top: -20px; padding-top: 20px; }
.sticky-head .toolbar { margin-bottom: 0; padding-bottom: 12px; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { width: 100%; height: 34px; padding: 0 10px 0 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.segmented { display: inline-flex; padding: 2px; background: var(--subtle); border-radius: var(--radius); }
.segmented button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.segmented button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.result-count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.label { display: flex; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); margin: 16px 0 6px; }
.label:first-child { margin-top: 0; }
.label-note { font-weight: 400; color: var(--faint); }
.hint { color: var(--muted); font-size: 12px; margin: 8px 2px 0; }
.input, .select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.select { height: 34px; padding: 0 30px 0 10px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2371717a' stroke-width='1.6'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 8px center / 14px; }
.select-inline { width: auto; min-width: 150px; }
.textarea { resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .search input:focus { outline: 0; border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--ring); }
.input:disabled, .select:disabled { background: var(--subtle); color: var(--text-2); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--subtle); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger-ghost { border-color: transparent; color: var(--danger); background: none; }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.link-btn { border: 0; background: none; padding: 0; color: #2563eb; font-size: 13px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn { border: 0; background: none; width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--subtle); color: var(--text); }

/* ---------------------------------------------------------------- ナレッジの一覧 */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.row {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  text-align: left;
  cursor: pointer;
}
.row:last-child { border-bottom: 0; }
/* お気に入り：行の左端の星。付けたものは一覧の一番上に出る */
.row-wrap { position: relative; border-bottom: 1px solid var(--border); }
.row-wrap:last-child { border-bottom: 0; }
.row-wrap .row { border-bottom: 0; padding-left: 44px; }
.pin-btn { position: absolute; left: 10px; top: 12px; z-index: 1; width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; display: grid; place-items: center; color: var(--border-strong); cursor: pointer; }
.pin-btn:hover { background: var(--subtle); color: var(--muted); }
.pin-btn:focus-visible { outline: 2px solid var(--ring); }
.row-wrap.is-pinned .pin-btn { color: #f59e0b; }
.row-wrap.is-pinned .pin-btn svg { fill: currentColor; }
.row-wrap.is-pinned .row { background: #fffdf5; }
.row:hover { background: #fcfcfd; }
.row:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.row-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.row-title { flex: 1; min-width: 0; font-weight: 600; color: var(--text); }
.row-meta { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 12px; }
.row-body {
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row.is-overridden { background: var(--bg); }
.row.is-overridden .row-title, .row.is-overridden .row-body { color: var(--faint); }
.row-note { font-size: 12px; color: var(--warning-text); margin-top: 6px; }
.badge { font-size: 11px; font-weight: 500; color: var(--warning-text); background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: 999px; padding: 0 7px; }
mark { background: #fef08a; color: inherit; border-radius: 2px; padding: 0 1px; }

.empty { padding: 48px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; font-size: 14px; }

/* ---------------------------------------------------------------- 商品の表 */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { position: sticky; top: 0; background: var(--bg); font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 9px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: #fcfcfd; }
.table tr:last-child td { border-bottom: 0; }
.table .alias { white-space: pre-line; color: var(--muted); font-size: 13px; }
.table .num { font-variant-numeric: tabular-nums; color: var(--text-2); }
.table .product-name { font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.none { color: var(--faint); }

/* ---------------------------------------------------------------- ポップアップ */
.dialog {
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.dialog-wide { width: min(760px, calc(100vw - 32px)); }
.dialog[open] { animation: pop 0.14s ease-out; }
.dialog::backdrop { background: rgba(9, 9, 11, 0.45); backdrop-filter: blur(2px); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
.dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 12px; }
.dialog-title { margin: 0; font-size: 17px; font-weight: 600; }
.dialog-desc { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.dialog-body { padding: 4px 24px 8px; overflow: auto; }
.dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--bg); }
.dialog-foot-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.form-error { color: var(--danger); font-size: 13px; margin: 12px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}
.chip:hover { border-color: var(--border-strong); }
.chip.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.is-on { cursor: default; padding-right: 4px; }
.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
}
.chip-remove:hover { opacity: 1; background: rgba(255, 255, 255, 0.18); }
.chip-remove svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.chips:not(:empty) + .combo { margin-top: 10px; }
.combo-menu {
  position: fixed;
  z-index: 10;
  max-height: 208px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.02);
  padding: 4px;
}
.combo-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: none;
  padding: 7px 10px;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.combo-option.is-active { background: var(--subtle); }
.combo-option .combo-count { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.combo-option.is-new { color: var(--text-2); }
.combo-option.is-new svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.combo-empty { padding: 8px 10px; color: var(--muted); font-size: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  z-index: 20;
  animation: pop 0.14s ease-out;
}

/* ---------------------------------------------------------------- ログイン */
body.is-login .tabs, body.is-login .topbar-right { display: none; }
.login { min-height: calc(100vh - 56px); display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px 28px; box-shadow: var(--shadow-sm); }
.logo-lg { display: block; width: 36px; height: 36px; border-radius: 9px; margin-bottom: 16px; }
.logo-lg::after { inset: 10px 9px; border-width: 3px; border-radius: 0 0 9px 9px; }
.login-title { margin: 0; font-size: 18px; font-weight: 600; }
.login-desc { margin: 6px 0 20px; color: var(--muted); font-size: 13px; }
.btn-block { width: 100%; margin-top: 16px; height: 38px; }

@media (max-width: 900px) {
  .topbar { height: auto; flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px 0; }
  .topbar-right { margin-left: 0; width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  .tabs { order: 3; width: 100%; height: 40px; overflow-x: auto; }
  .tab.is-active::after { bottom: 0; }
  .user { display: none; }
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .sidebar { position: static; max-height: none; }
  .sticky-head { position: static; margin-top: 0; padding-top: 0; }
  .single { padding: 16px; }
  .notice { margin: 12px 16px 0; }
  .page-head { flex-direction: column; }
}

/* ---------------------------------------------------------------- ログ */
.single-wide { max-width: 1320px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; }
.retention-note { display: inline-block; margin-left: 8px; font-size: 11px; color: var(--faint); white-space: nowrap; }
.fetched-at { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.filter-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.filter-bar .toolbar { margin: 0; }
.log-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.segmented-lg button { padding: 6px 16px; font-size: 14px; }
.segmented button { min-height: 30px; }
.chart-hint { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.date-range { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.input-date { width: auto; height: 34px; padding: 0 8px; font-size: 13px; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 12px; font-size: 12px; color: var(--muted); }
.filter-pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 2px 4px 2px 10px; color: var(--text); font-size: 12px; }
.filter-pill button { border: 0; background: none; cursor: pointer; color: var(--muted); width: 18px; height: 18px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.filter-pill button:hover { background: var(--subtle); color: var(--text); }
.filter-pill svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }


.log-table td { font-size: 13px; }
.log-table .log-time { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.log-table .log-q { min-width: 260px; }
.log-table .log-q-text { color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.log-table .log-a-text { margin-top: 4px; color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.log-table .log-used { min-width: 240px; }
.log-table .log-used .tag { margin-bottom: 4px; }
.log-table .log-title { color: var(--text-2); }
.log-table tr.is-new td { animation: flash 2.4s ease-out; }
@keyframes flash { from { background: #f0fdf4; } to { background: transparent; } }
.log-table .log-user { white-space: nowrap; }
/* ログを選んで消す */
.log-table .log-check { width: 40px; padding-right: 0; }
.log-table .log-check label { display: flex; align-items: center; justify-content: center; margin: -9px -8px; padding: 9px 8px; cursor: pointer; }
.log-table .log-check input { width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: var(--primary); }
.log-table tr.is-selected td { background: #eff6ff; }
.selection-bar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 15;
  display: flex; align-items: center; gap: 10px; white-space: nowrap; max-width: calc(100vw - 32px); overflow-x: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px 10px 8px 16px;
  box-shadow: var(--shadow-lg);
}
.selection-count { font-size: 13px; font-weight: 600; color: var(--text); }
/* 帯が出ているあいだは、お知らせ（トースト）を帯の上に出す */
body:has(.selection-bar) .toast { bottom: 84px; }
/* 一番下の行が帯に隠れないよう、下に余白をとる */
body:has(.selection-bar) #viewLogs { padding-bottom: 96px; }
/* 列見出しを、上のバー（高さ56px）のすぐ下に残す。横スクロールの枠があると固定できないので、表が収まる幅の画面だけ枠を外す */
@media (min-width: 1100px) {
  .log-wrap { overflow: clip; }
  .log-table th { top: 56px; z-index: 3; }
}
.user-chip { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 12px; color: var(--text-2); background: none; border: 1px solid transparent; border-radius: 6px; padding: 1px 6px 1px 4px; margin-left: -5px; }
button.user-chip { cursor: pointer; }
button.user-chip:hover, button.user-chip:focus-visible { background: var(--subtle); border-color: var(--border); outline: 0; }
.user-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--u); flex: none; }
.user-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; letter-spacing: 0.04em; color: var(--text); }
.user-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.user-id { margin-top: 2px; font-size: 11px; color: var(--faint); word-break: break-all; }
.channel { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; background: var(--subtle); color: var(--text-2); }
.channel-line { background: #ecfdf3; color: #067647; }
.result { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; color: var(--text-2); }
.result::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--r, var(--faint)); }
.r-answered { --r: #16a34a; }
.r-clarify { --r: #0ea5e9; }
.r-noanswer { --r: #f59e0b; }
.r-escalation { --r: #dc2626; }
.r-smalltalk { --r: #a1a1aa; }
.r-irrelevant { --r: #71717a; }
.load-more { display: flex; justify-content: center; padding: 16px; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; min-width: 0; }
.chart-card.span-2 { grid-column: 1 / -1; }
.chart-title { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.chart-note { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.chart-head .chart-title { margin: 0; }
.chart-head .chart-note { margin: 0; }
.bars { display: flex; flex-direction: column; gap: 2px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 40%) 1fr 44px; align-items: center; gap: 10px; border: 0; background: none; padding: 5px 6px; border-radius: 6px; text-align: left; font-size: 13px; color: var(--text); cursor: pointer; width: 100%; }
.bar-row:hover { background: var(--subtle); }
.bar-row.is-static { cursor: default; }
.bar-row.is-static:hover { background: none; }
.bar-label { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bar-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-label .bar-sub { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.bar-track { display: block; height: 10px; background: var(--subtle); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--bar, var(--primary)); min-width: 2px; }
.bar-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 12px; }
.day-chart { width: 100%; height: auto; display: block; stroke: none; }
.day-chart .day-bar { fill: #3b82f6; }
.day-chart .day-bar:hover { fill: #1d4ed8; }
.day-chart text { font-size: 11px; fill: var(--muted); stroke: none; font-family: inherit; font-weight: 400; }
.day-chart .grid { stroke: var(--border); stroke-width: 1; }
.chart-empty { color: var(--muted); font-size: 13px; padding: 16px 0; }

.detail-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 16px; font-size: 13px; margin-bottom: 16px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; color: var(--text); word-break: break-all; }
.bubble { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; white-space: pre-wrap; font-size: 14px; line-height: 1.75; margin-bottom: 12px; word-break: break-word; }
.bubble-q { background: var(--subtle); }
.bubble-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 0 0 6px; }
.ref-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-2); line-height: 1.8; }

@media (max-width: 860px) {
  .chart-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; gap: 12px; }
  .detail-grid { grid-template-columns: 90px 1fr; }
}
