.usage-view { display: flex; flex-direction: column; gap: 18px; width: 100%; color: #172033; }
.usage-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; padding: 8px 4px 0; }
.usage-heading h2 { margin: 2px 0 0; font-size: clamp(1.45rem, 2.5vw, 2rem); letter-spacing: -.03em; }
.usage-heading > p { max-width: 660px; margin: 0; color: #596579; line-height: 1.7; }
.usage-eyebrow { margin: 0; color: #1677ff; font-size: 12px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }
.usage-method-note { padding: 13px 16px; border: 1px solid #cfe2ff; border-radius: 12px; background: #f3f8ff; color: #43536a; font-size: 13px; line-height: 1.65; }
.usage-method-note strong { color: #1f4f91; }
.usage-filters.filter-bar { margin: 0; }
.usage-filters .filter-btn { min-height: 42px; }
.usage-filters .dropdown-menu { min-width: 280px; }
.usage-model-menu { width: min(340px, calc(100vw - 32px)); }
.usage-price-menu { min-width: 300px !important; }
.usage-price-menu .slider-thumb { touch-action: none; }
.usage-search { box-sizing: border-box; width: 100%; margin-bottom: 12px; padding: 10px 12px; border: 1px solid rgba(23,32,51,.12); border-radius: 12px; background: rgba(255,255,255,.86); color: var(--text-primary); font: inherit; font-size: 13px; outline: none; }
.usage-search:focus { border-color: rgba(15,118,110,.45); box-shadow: 0 0 0 3px rgba(15,118,110,.08); }
.usage-inline-filter { cursor: default; }
.usage-inline-filter:hover { transform: none; }
.usage-inline-filter select, .usage-inline-filter input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text-primary); font: inherit; font-size: 13px; font-weight: 650; }
.usage-inline-filter select { width: 72px; cursor: pointer; }
.usage-score-filter input { width: 54px; }
.usage-score-filter input::placeholder { color: var(--text-tertiary); opacity: 1; }
.usage-color-control { display: inline-flex; align-items: center; gap: 9px; min-height: 42px; padding: 4px 6px 4px 14px; border: 1px solid rgba(23,32,51,.08); border-radius: 7px; background: #fff; color: var(--text-secondary); font-size: 13px; font-weight: 500; box-shadow: none; }
.usage-color-control .usage-segments { border: 0; background: rgba(23,32,51,.06); }
.usage-counts { color: var(--text-tertiary); font-size: 12px; white-space: nowrap; }
.usage-color-legend { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 7px 12px; padding: 1px 5px; color: #657187; font-size: 12px; }
.usage-color-legend strong { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.usage-color-legend > div { display: flex; flex-wrap: wrap; gap: 7px 14px; max-height: 66px; overflow: auto; scrollbar-width: thin; }
.usage-legend-item { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 7px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: inherit; font: inherit; white-space: nowrap; cursor: pointer; transition: color .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease, box-shadow .16s ease; }
.usage-legend-item:hover, .usage-legend-item.is-hovered { border-color: rgba(15,118,110,.2); background: rgba(255,255,255,.78); color: var(--text-primary); box-shadow: 0 5px 14px rgba(23,32,51,.08); }
.usage-legend-item:focus-visible { outline: 2px solid rgba(15,118,110,.48); outline-offset: 2px; }
.usage-legend-item.is-solo { border-color: rgba(15,118,110,.28); background: rgba(255,255,255,.92); color: var(--text-primary); box-shadow: 0 5px 14px rgba(23,32,51,.1); }
.usage-legend-item.is-muted { opacity: .42; }
.usage-legend-item.is-muted:hover, .usage-legend-item.is-muted.is-hovered { opacity: 1; }
.usage-color-legend i { width: 9px; height: 9px; border-radius: 50%; }
.usage-presets { padding: 20px; border: 1px solid #dbe4ee; border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.usage-presets[hidden] { display: none; }
.usage-preset-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 16px; }
.usage-preset-heading h3, .usage-explorer-heading h3 { margin: 2px 0 0; color: #172033; font-size: 20px; }
.usage-preset-heading > div > p:last-child, .usage-explorer-heading p { margin: 5px 0 0; color: #657187; font-size: 13px; line-height: 1.55; }
.usage-preset-heading-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }
.usage-preset-note { padding: 6px 10px; border: 1px solid rgba(15,118,110,.16); border-radius: 999px; background: rgba(236,253,245,.82); color: #0f766e; font-size: 11px; font-weight: 650; white-space: nowrap; }
.usage-preset-scope-control { flex: 0 0 auto; }
.usage-preset-scope-control button { font-size: 11px; white-space: nowrap; }
.usage-preset-grid { display: grid; gap: 14px; }
.usage-preset-grid + .usage-preset-grid { margin-top: 14px; }
.usage-preset-grid--single { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.usage-preset-grid--multi { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.usage-preset-card { min-width: 0; overflow: hidden; border: 1px solid #e0e7ee; border-radius: 14px; background: #fff; box-shadow: 0 7px 20px rgba(32,54,77,.045); }
.usage-preset-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 13px 14px 11px; border-bottom: 1px solid #e8edf2; background: #f8fafb; }
.usage-preset-card > header h4 { margin: 0; color: #1d293d; font-size: 14px; line-height: 1.35; }
.usage-preset-card > header p { margin: 3px 0 0; color: #8490a1; font-size: 10px; }
.usage-preset-card > header > span { padding: 3px 7px; border-radius: 999px; background: #edf2f7; color: #667489; font-size: 10px; white-space: nowrap; }
.usage-preset-table-scroll { width: 100%; overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.usage-preset-table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.usage-preset-table th { padding: 9px 10px; border-bottom: 1px solid #dfe6ed; background: #f3f6f9; color: #6c788a; font-size: 11px; font-weight: 600; text-align: left; white-space: nowrap; }
.usage-preset-table th:first-child { width: 68%; }
.usage-preset-table th:last-child { width: 32%; text-align: right; }
.usage-preset-table td { padding: 10px; border-bottom: 1px solid #edf1f4; color: #344258; font-size: 12px; line-height: 1.35; vertical-align: top; }
.usage-preset-table tbody tr:nth-child(even) td { background: #fbfcfd; }
.usage-preset-table tbody tr:hover td { background: #eef8f5; }
.usage-preset-table tbody tr:last-child td { border-bottom: 0; }
.usage-preset-table .numeric { font-variant-numeric: tabular-nums; text-align: right; }
.usage-preset-table .usage-platform-link { gap: 3px; }
.usage-preset-table .usage-platform-link strong { font-size: 12px; }
.usage-preset-primary-line, .usage-preset-secondary-line { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.usage-preset-primary-line { justify-content: space-between; color: #1f2c40; font-weight: 700; }
.usage-preset-primary-line .usage-table-model { overflow-wrap: anywhere; text-align: right; }
.usage-preset-price { flex: 0 0 auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-preset-secondary-line { margin-top: 4px; color: #7a8698; font-size: 10px; flex-wrap: wrap; }
.usage-preset-separator { color: #b0b9c5; }
.usage-preset-qualifier { display: inline; margin-left: -2px; color: #8a5a00; font-size: 9px; font-weight: 650; }
.usage-preset-metrics { font-variant-numeric: tabular-nums; text-align: right; }
.usage-preset-metric-primary { color: #243349; font-size: 12px; font-weight: 650; white-space: nowrap; }
.usage-preset-metric-secondary { justify-content: flex-end; white-space: nowrap; }
.usage-preset-table .usage-table-empty { padding: 22px 10px; color: #7a8699; text-align: center; }
/* Keep compact preset geometry together, including the shared visual overrides. */
.usage-preset-card .usage-preset-table td { padding: 8px 16px; line-height: 1.4; }
.usage-preset-card .usage-preset-secondary-line { margin-top: 2px; }
.usage-preset-card .usage-preset-plan { color: var(--text-primary); font-size: 13px; font-weight: 600; }
.usage-preset-card .usage-preset-primary-line .usage-table-model { font-weight: 600; }
.usage-preset-card .preset-model-filters { display:flex;align-items:center;flex-wrap:wrap;gap:4px;margin-top:8px;color:var(--text-secondary);font-size:12px; }
.usage-preset-card .preset-model-filters > span { flex-shrink:0; }
.usage-preset-card .preset-model-filters button { font:inherit;min-height:28px;max-width:100%;padding:3px 7px;border:1px solid var(--border-color);border-radius:6px;background:var(--bg-secondary);color:var(--text-secondary);overflow-wrap:anywhere;cursor:pointer;transition:color .16s,background .16s; }
.usage-preset-card .preset-model-filters button:hover { background:var(--bg-tertiary);color:var(--accent-primary); }
.usage-preset-card .preset-model-filters button[aria-pressed="true"] { color:var(--accent-primary);font-weight:600;background:var(--bg-tertiary); }
@media (max-width:800px), (pointer:coarse) {
  .usage-preset-card .preset-model-filters button { min-height:44px; }
}
@media (max-width: 768px) {
  .usage-preset-card .usage-preset-table td { padding: 8px 10px; }
}
.usage-explorer-heading { padding: 6px 4px 0; }
.usage-chart-card { position: relative; padding: 20px 22px 14px; border: 1px solid #dfe5ed; border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.usage-chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.usage-chart-head h3 { margin: 0; color: #172033; font-size: 19px; }
.usage-chart-head p { margin: 6px 0 0; color: #6a7689; font-size: 13px; }
.usage-chart-head label { display: flex; align-items: center; gap: 7px; color: #68758a; font-size: 12px; white-space: nowrap; }
.usage-chart-head select { min-height: 34px; padding: 0 28px 0 9px; border: 1px solid #d8dee8; border-radius: 8px; background: #fff; }
.usage-chart-controls { display: flex; align-items: center; gap: 12px; }
.usage-segments { display: flex; padding: 2px; border: 1px solid #d8dee8; border-radius: 9px; background: #f4f6f9; }
.usage-segments button { padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; color: #596579; cursor: pointer; }
.usage-segments button.is-active { background: #fff; color: var(--accent-primary); box-shadow: 0 1px 3px #17203318; }
.usage-chart-stage { position: relative; }
.usage-chart { width: 100%; height: 470px; margin-top: 4px; }
.usage-empty { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -10%); z-index: 3; padding: 13px 18px; border-radius: 10px; background: rgba(248,250,252,.95); color: #69768a; font-size: 13px; box-shadow: 0 4px 18px rgba(31,48,70,.08); }
.usage-data-card { padding-bottom: 22px; }
.usage-table-count { align-self: center; color: #7a8699; font-size: 12px; white-space: nowrap; }
.usage-table-section { margin: 18px -4px 0; padding-top: 18px; border-top: 1px solid #e7ebf1; }
.usage-table-scroll { overflow-x: auto; overflow-y: visible; border: 1px solid #e1e6ed; border-radius: 12px; background: #fff; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.usage-data-table { width: 100%; min-width: 2300px; border-collapse: separate; border-spacing: 0; }
.usage-data-table th { position: sticky; top: 0; z-index: 3; padding: 12px 14px; border-bottom: 1px solid #dfe5ed; background: #f5f7fb; color: #667287; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-align: left; white-space: nowrap; user-select: none; }
.usage-table-heading { display: inline-flex; align-items: baseline; gap: 7px; }
.usage-table-heading small { color: #8a96a8; font-size: 9px; font-weight: 500; letter-spacing: 0; }
.usage-data-table th.sortable { cursor: pointer; transition: background .15s ease, color .15s ease; }
.usage-data-table th.sortable:hover, .usage-data-table th.sortable:focus-visible { background: #edf2f8; color: #253247; outline: none; }
.usage-data-table th.sortable::after { content: ''; display: inline-block; width: 0; height: 0; margin-left: 7px; vertical-align: middle; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4px solid #9aa5b5; opacity: .5; }
.usage-data-table th.sort-asc::after { border-top: 0; border-bottom: 4px solid #1677ff; opacity: 1; }
.usage-data-table th.sort-desc::after { border-top-color: #1677ff; opacity: 1; }
.usage-data-table td { padding: 12px 14px; border-bottom: 1px solid #edf0f4; background: #fff; color: #36445a; font-size: 12px; line-height: 1.45; white-space: nowrap; }
.usage-data-table tbody tr:nth-child(even) td { background: #f9fafc; }
.usage-data-table tbody tr:hover td { background: #eef6ff; }
.usage-data-table tbody tr:last-child td { border-bottom: 0; }
.usage-data-table th.sticky-first, .usage-data-table td.sticky-first { position: sticky; left: 0; }
.usage-data-table th.sticky-first { z-index: 4; }
.usage-data-table td.sticky-first { z-index: 2; border-right: 1px solid #e5e9ef; }
.usage-data-table td.sticky-first strong { color: #1f2b3d; font-size: 12px; }
.usage-platform-link { display: inline-flex; align-items: center; gap: 5px; color: #1677ff; text-decoration: none; }
.usage-platform-link strong { color: inherit !important; }
.usage-platform-link span { font-size: 11px; transition: transform .15s ease; }
.usage-platform-link:hover { color: #0958d9; text-decoration: underline; }
.usage-platform-link:hover span { transform: translate(1px, -1px); }
.usage-platform-link:focus-visible { border-radius: 4px; outline: 2px solid rgba(22,119,255,.35); outline-offset: 2px; }
.usage-data-table tbody tr:nth-child(even) td.sticky-first { background: #f9fafc; }
.usage-data-table tbody tr:hover td.sticky-first { background: #eef6ff; }
.usage-data-table .numeric { font-variant-numeric: tabular-nums; }
.usage-table-model { color: #253247; font-weight: 650; }
.usage-table-unit-price { color: #0f766e; font-weight: 650; }
.usage-table-price-visual { min-width: 210px; width: 210px; }
.usage-price-bar { display: flex; align-items: center; width: 180px; min-height: 20px; }
.usage-price-bar-track { position: relative; display: block; width: 100%; height: 10px; overflow: hidden; border: 1px solid #dce4ee; border-radius: 999px; background: repeating-linear-gradient(90deg, #f1f5f9 0, #f1f5f9 calc(25% - 1px), #dbe4ee 25%); box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04); }
.usage-price-bar-fill { position: absolute; inset: 0 auto 0 0; width: max(4px, var(--usage-price-bar-width)); border-radius: inherit; background: var(--usage-price-bar-color); box-shadow: 0 0 0 1px rgba(255, 255, 255, .22) inset; opacity: .82; transition: width .2s ease, opacity .15s ease; }
.usage-price-bar-fill::after { content: ''; position: absolute; top: 50%; right: 2px; width: 3px; height: 3px; border-radius: 50%; background: rgba(255, 255, 255, .9); transform: translateY(-50%); }
.usage-data-table tbody tr:hover .usage-price-bar-fill { opacity: 1; }
.usage-price-bar-empty { display: inline-block; width: 180px; color: #9aa5b5; text-align: center; }
.usage-table-api-pricing { min-width: 280px; color: #475569; white-space: normal !important; }
.usage-table-note { min-width: 700px; white-space: normal !important; }
.usage-data-table .usage-table-empty { padding: 30px 14px; color: #7a8699; text-align: center; }
.usage-tooltip { min-width: 190px; line-height: 1.65; color: #263449; }
.usage-tooltip strong { display: block; margin-bottom: 3px; color: #111827; }
.usage-load-error { width: 100%; padding: 34px; border: 1px solid #fecaca; border-radius: 14px; background: #fff7f7; color: #991b1b; text-align: center; }

@media (max-width: 760px) {
  .usage-heading { display: block; padding-top: 0; }
  .usage-heading > p { margin-top: 8px; font-size: 13px; }
  .usage-filters.filter-bar { align-items: stretch; padding: 14px; border-radius: 22px; }
  .usage-filters .filter-dropdown { flex: 1 1 130px; }
  .usage-filters .filter-dropdown > .filter-btn { width: 100%; justify-content: space-between; }
  .usage-inline-filter { flex: 1 1 145px; justify-content: space-between; }
  .usage-score-filter { flex-basis: 100%; }
  .usage-inline-filter select, .usage-inline-filter input { text-align: right; }
  .usage-color-control { flex: 1 1 100%; justify-content: space-between; }
  .usage-filters .filter-trailing { width: 100%; margin-left: 0; justify-content: space-between; }
  .usage-filters .dropdown-menu { position: fixed; z-index: 100; top: 50%; left: 50%; width: calc(100vw - 32px); max-height: 70vh; transform: translate(-50%, -50%); animation-name: dropdownFadeCenter; }
  .usage-color-legend { grid-template-columns: 1fr; }
  .usage-color-legend > div { max-height: 72px; }
  .usage-presets { padding: 15px 10px; border-radius: 16px; }
  .usage-preset-heading { display: block; padding: 0 4px; }
  .usage-preset-heading-actions { align-items: flex-start; flex-direction: column; margin-top: 10px; }
  .usage-preset-grid--single { grid-template-columns: 1fr; }
  .usage-preset-grid--multi { grid-template-columns: 1fr; }
  .usage-preset-table th:first-child { width: 65%; }
  .usage-preset-table th:last-child { width: 35%; }
  .usage-chart-card { padding: 16px 10px 10px; border-radius: 14px; }
  .usage-chart-head { display: block; padding: 0 6px; }
  .usage-chart-controls { justify-content: space-between; margin-top: 12px; }
  .usage-chart-head > label { margin-top: 12px; }
  .usage-chart { height: 390px; }
  .usage-table-section { margin-left: 0; margin-right: 0; }
  .usage-table-scroll { border-radius: 10px; }
  .usage-data-table { min-width: 2180px; }
  .usage-data-table th, .usage-data-table td { padding: 10px 12px; }
  .usage-table-price-visual { min-width: 180px; width: 180px; }
  .usage-price-bar, .usage-price-bar-empty { width: 152px; }
}

@media (prefers-reduced-motion: reduce) {
  .usage-price-bar-fill { transition: none; }
}

/* 图表标题、控制区和图例各占一层，窄屏可完整操作。 */
.usage-chart-head { padding-bottom: 16px; border-bottom: 1px solid var(--border-light); align-items: center; }
.usage-chart-head h3 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.usage-chart-head p { font-size: 12px; line-height: 1.65; }
.usage-chart-controls { flex-wrap: wrap; gap: 8px; }
.usage-chart-head select { font: inherit; font-size: 12px; min-height: 36px; }
.usage-segments button { min-height: 30px; font: inherit; font-size: 12px; }
.usage-color-control { min-height: 38px; }
.usage-color-legend { padding: 4px 0; }
.usage-color-legend > div { max-height: 84px; }
.usage-view .usage-data-table .numeric { text-align: right; }
.usage-chart-head .usage-table-count { white-space: normal; text-align: right; }
.usage-segments button:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
@media (max-width: 760px) {
  .usage-chart-head { display: block; }
  .usage-chart-controls { justify-content: flex-start; margin-top: 12px; }
  .usage-chart-head label { flex-wrap: wrap; white-space: normal; }
  .usage-chart-head select { max-width: 100%; }
  .usage-empty { width: calc(100% - 32px); text-align: center; line-height: 1.8; }
  .usage-chart-head .usage-table-count { display: block; margin-top: 8px; text-align: left; }
}
