@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700;900&display=swap');

:root {
  --color-bg: #f4f5fa;
  --color-surface: #ffffff;
  --color-sidebar: #161a2e;
  --color-sidebar-hover: #23283f;
  --color-sidebar-active: #2f355a;
  --color-primary: #4f56e8;
  --color-primary-dark: #3c42c9;
  --color-primary-soft: #eef0fd;
  --color-text: #1f2333;
  --color-text-muted: #767b93;
  --color-border: #e7e8f2;
  --color-success: #17a673;
  --color-success-soft: #e5f8f1;
  --color-warning: #f5a524;
  --color-warning-soft: #fef3e2;
  --color-danger: #e5484d;
  --color-danger-soft: #fdecec;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(22, 26, 46, 0.06);
  --shadow-lg: 0 12px 32px rgba(22, 26, 46, 0.14);
  --sidebar-width: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }

/* ---------- 版面:側邊欄 + 主內容 ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-sidebar);
  color: #c7c9dd;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 22px 20px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.sidebar-brand .logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-primary), #8b8ff5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 500;
  color: #b7bad2;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a svg { flex-shrink: 0; opacity: 0.85; }

.sidebar-nav a:hover {
  background: var(--color-sidebar-hover);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--color-sidebar-active);
  color: #fff;
}

.sidebar-nav a.active svg { opacity: 1; }

.sidebar-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #565b7c;
  padding: 18px 14px 6px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  margin-bottom: 8px;
}

.user-chip .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6a70f0, #4f56e8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-chip .info { min-width: 0; }
.user-chip .name { color: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .role { font-size: 12px; color: #8b8ea8; }

.logout-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: #b7bad2;
  transition: background 0.15s ease, color 0.15s ease;
}
.logout-link:hover { background: var(--color-sidebar-hover); color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 60px;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 23px;
  font-weight: 700;
  margin: 0;
  color: var(--color-text);
}

.page-subtitle {
  color: var(--color-text-muted);
  font-size: 13.5px;
  margin-top: 4px;
}

/* ---------- 卡片 / 統計方塊 ---------- */

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.card-body { padding: 24px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--color-primary-soft); color: var(--color-primary); }
.stat-icon.red { background: var(--color-danger-soft); color: var(--color-danger); }
.stat-icon.green { background: var(--color-success-soft); color: var(--color-success); }
.stat-icon.amber { background: var(--color-warning-soft); color: var(--color-warning); }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--color-text);
}

.stat-label {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 3px;
}

.stat-card.action {
  align-items: center;
  justify-content: center;
}

/* ---------- 表格 ---------- */

.table-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
  flex-wrap: wrap;
}

.table-card-header h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 700;
}

.vendor-rank-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 26px;
  align-items: stretch;
}
.vendor-rank-donut {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 22px 34px;
}
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
}
.donut-center-value { font-size: 16px; font-weight: 700; fill: var(--color-text); }
.donut-slice-label { font-size: 12px; font-weight: 700; fill: var(--color-text); }

@media (max-width: 900px) {
  .vendor-rank-grid { grid-template-columns: 1fr; }
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data-table thead th {
  text-align: left;
  padding: 12px 22px;
  background: #fafafd;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

table.data-table tbody td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: #fbfbfe; }

table.data-table tbody tr.row-danger { background: #fff8f8; }
table.data-table tbody tr.row-danger:hover { background: #fdecec; }

.empty-row {
  text-align: center;
  color: var(--color-text-muted);
  padding: 48px 20px !important;
}

/* ---------- 徽章 / 標籤 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.success { background: var(--color-success-soft); color: var(--color-success); }
.badge.danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge.warning { background: var(--color-warning-soft); color: #b3720c; }
.badge.neutral { background: #eef0f6; color: var(--color-text-muted); }
.badge.primary { background: var(--color-primary-soft); color: var(--color-primary); }

/* ---------- 按鈕 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-outline { background: #fff; color: var(--color-text); border-color: var(--color-border); }
.btn-outline:hover { background: #f7f7fb; }

.btn-danger-outline { background: #fff; color: var(--color-danger); border-color: #f3c8c9; }
.btn-danger-outline:hover { background: var(--color-danger-soft); }

.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #128a5e; }

.btn-warning { background: var(--color-warning); color: #fff; }
.btn-warning:hover { background: #d9910f; }

.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 表單 ---------- */

.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--color-text);
}

.form-control, select.form-control {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, select.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; }
.form-hint { font-size: 12.5px; color: var(--color-text-muted); margin-top: 5px; }

.input-suffix-wrap { position: relative; }
.input-suffix-wrap .form-control { padding-right: 46px; }
.input-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 14px;
  pointer-events: none;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
/* 日期區間列:欄寬對齊上一列的 5 欄篩選欄位,搜尋緊接在結束日期右邊 */
.date-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-top: 14px;
}
.date-filter-field { flex: 0 0 calc((100% - 56px) / 5); min-width: 180px; }

/* ---------- 登入頁 ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #eef0fd 0%, var(--color-bg) 55%);
  padding: 20px;
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--color-border);
}

.auth-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--color-primary), #8b8ff5);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.auth-title {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 4px;
}

.auth-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13.5px;
  margin-bottom: 28px;
}

/* ---------- 提示訊息 ---------- */

.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}

.alert-success { background: var(--color-success-soft); color: #0d7a54; border-color: #bfeadb; }
.alert-danger { background: var(--color-danger-soft); color: #b3272b; border-color: #f5c3c4; }
.alert-warning { background: var(--color-warning-soft); color: #97650c; border-color: #f7dfa6; }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 40, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-backdrop.open { display: flex; }

.modal-box {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-box.wide { max-width: 760px; }

/* ---------- 進出貨登記:多品項 + 商品搜尋 ---------- */

.reg-row {
  display: grid;
  grid-template-columns: 1fr 110px 32px;
  gap: 8px;
  align-items: start;
  margin-bottom: 10px;
}

.reg-row.with-price { grid-template-columns: 1fr 90px 120px 32px; }
.reg-row.with-two-prices { grid-template-columns: 1fr 70px 100px 100px 140px 32px; }
.quote-detail-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
.quote-detail-grid .qd-wide { grid-column: 1 / -1; }
.survey-row { display: grid; grid-template-columns: 1fr 32px; align-items: center; gap: 8px; margin-bottom: 10px; }
.survey-head { display: none; }
.survey-block:not(.has-amount) .amount-part,
.survey-block:not(.has-amount) .survey-amount { display: none; }
.survey-block.has-amount .survey-row,
.survey-block.has-amount .survey-head { grid-template-columns: 1fr 80px 70px 110px 32px; }
.survey-block.has-amount .survey-head {
  display: grid; gap: 8px; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--color-text-muted);
}
.survey-unit[readonly] { background: #f4f5fa; color: var(--color-text-muted); text-align: center; cursor: not-allowed; }
@media (max-width: 640px) {
  .quote-detail-grid { grid-template-columns: 1fr; }
  .survey-block.has-amount .survey-row { grid-template-columns: 1fr; }
  .survey-block.has-amount .survey-head { display: none; }
}
.quote-totals {
  width: 280px; margin: 14px 0 0 auto; padding-top: 10px; border-top: 1px solid var(--color-border);
  display: flex; flex-direction: column; gap: 6px;
}
.qt-sum-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--color-text-muted); }
.qt-sum-row strong { color: var(--color-text); }
.qt-sum-row.grand strong { font-size: 16px; }
.reg-retail[readonly] { background: #f4f5fa; color: var(--color-text-muted); cursor: not-allowed; }

.reg-head {
  display: grid;
  grid-template-columns: 1fr 110px 32px;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 14px 0 8px;
}

.reg-head.with-price { grid-template-columns: 1fr 90px 120px 32px; }
.reg-head.with-two-prices { grid-template-columns: 1fr 70px 100px 100px 140px 32px; }

.reg-product-wrap { position: relative; }

.reg-suggest {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
  z-index: 60;
  margin-top: 4px;
}
.reg-suggest.open { display: block; }

.reg-suggest-item {
  padding: 9px 12px;
  font-size: 13.5px;
  cursor: pointer;
}
.reg-suggest-item:hover { background: var(--color-primary-soft); }

@media (max-width: 640px) {
  .reg-row, .reg-head, .reg-row.with-price, .reg-head.with-price, .reg-row.with-two-prices, .reg-head.with-two-prices { grid-template-columns: 1fr; }
  .reg-head { display: none; }
  .reg-row { border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 12px; }
}

/* ---------- 進出貨月曆 ---------- */

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
}

.calendar-title { font-size: 16px; font-weight: 700; }

.calendar-nav { display: flex; align-items: center; gap: 8px; }

.calendar-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--color-text);
  background: #fff;
}
.calendar-nav-btn:hover { background: #f7f7fb; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-dow {
  text-align: center;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: #fafafd;
}

.calendar-cell {
  min-height: 96px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 6px;
}
.calendar-cell:nth-child(7n) { border-right: none; }

.calendar-cell.out-month { background: #fafafd; }
.calendar-cell.out-month .calendar-day-num { color: var(--color-text-muted); }

.calendar-cell.today { background: var(--color-primary-soft); }
.calendar-cell.today .calendar-day-num { color: var(--color-primary); }

.calendar-day-num { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }

.calendar-event {
  display: block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  margin-bottom: 3px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  cursor: pointer;
}
.calendar-event:hover { opacity: 0.85; }
.calendar-event.in { background: var(--color-success); }
.calendar-event.out { background: var(--color-warning); }

.calendar-more { font-size: 10.5px; color: var(--color-text-muted); }

@media (max-width: 880px) {
  .calendar-cell { min-height: 64px; }
  .calendar-event { font-size: 10px; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h3 { margin: 0; font-size: 16.5px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 4px;
}

.modal-body { padding: 22px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- 工具類 ---------- */

.text-muted { color: var(--color-text-muted); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-0 { margin-bottom: 0; }

table.table { width: 100%; border-collapse: collapse; }
table.table th, table.table td { padding: 8px 4px; text-align: left; border-bottom: 1px solid var(--color-border); font-size: 13.5px; }

/* ---------- 響應式 ---------- */

@media (max-width: 880px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar-brand { padding: 14px 16px; }
  .sidebar-nav { flex-direction: row; padding: 8px; }
  .sidebar-section-label { display: none; }
  .sidebar-footer { display: none; }
  .main { padding: 22px 18px 40px; }
  .form-row { flex-direction: column; }
}

/* 異動紀錄 */
.audit-changes { min-width: 280px; font-size: 13px; line-height: 1.6; }
.audit-change { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; padding: 2px 0; }
.audit-change + .audit-change { border-top: 1px dashed #eef0f6; }
.audit-field { color: var(--color-text-muted); min-width: 84px; }
.audit-old { color: var(--color-danger); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.audit-new { color: var(--color-success); }
.audit-arrow { color: var(--color-text-muted); }
/* 報價單:施工項目(大項)卡片,底下是商品(小項)列 */
.work-items { margin-bottom: 10px; }
.products-block .wi-header, .products-block .add-work-item, .products-block .wi-subtotal { display: none; }
.products-block.uses-work-items .wi-header { display: flex; }
.products-block.uses-work-items .add-work-item { display: inline-flex; margin-bottom: 4px; }
.products-block.uses-work-items .wi-subtotal { display: inline; }
.products-block.uses-work-items .work-item {
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  padding: 12px 12px 10px; margin-bottom: 12px; background: #fafbfe;
}
.wi-header { align-items: center; gap: 10px; margin-bottom: 10px; }
.wi-title { font-weight: 600; font-size: 13px; color: var(--color-primary); white-space: nowrap; }
.wi-header .wi-name { flex: 1; }
.wi-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 2px; }
.wi-subtotal { font-size: 13px; color: var(--color-text-muted); }
/* 員工帳號:角色下拉 */
.role-select { min-width: 130px; padding: 6px 10px; height: auto; }
/* 報價單管理:本月成交率、本月報價分類占比 */
.quote-insight-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 18px; margin-bottom: 26px; }
.deal-rate-main { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.deal-rate-value { font-size: 34px; font-weight: 700; color: var(--color-success); line-height: 1; }
.deal-rate-sub { font-size: 13px; margin-top: 10px; }
.insight-bar { height: 8px; background: #eef0f6; border-radius: 99px; overflow: hidden; }
.insight-bar-fill { height: 100%; background: var(--color-primary); border-radius: 99px; transition: width .3s; }
.insight-bar-fill.success { background: var(--color-success); }
.category-rank-row { display: grid; grid-template-columns: 26px 130px minmax(60px, 1fr) 44px 150px; align-items: center; gap: 12px; padding: 7px 0; font-size: 14px; }
.category-rank-row + .category-rank-row { border-top: 1px dashed var(--color-border); }
.category-rank-no { width: 24px; height: 24px; border-radius: 50%; background: #eef0f6; color: var(--color-text-muted); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.category-rank-no.top { background: var(--color-primary-soft); color: var(--color-primary); }
.category-rank-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-rank-share { font-weight: 700; text-align: right; }
.category-rank-meta { font-size: 12px; text-align: right; white-space: nowrap; }
@media (max-width: 1100px) {
  .quote-insight-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .category-rank-row { grid-template-columns: 26px 1fr 44px; }
  .category-rank-row .insight-bar, .category-rank-meta { display: none; }
}
/* 庫存總覽:本月供應商交易排名、本月品名交易排名 左右並排(圓餅圖放在各自卡片表格下方) */
.rank-pair-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-bottom: 26px; align-items: start; }
.rank-pair-grid .vendor-rank-donut { border-top: 1px solid var(--color-border); padding: 22px; }
@media (max-width: 1100px) {
  .rank-pair-grid { grid-template-columns: 1fr; }
}