- New Cost_Tracker class: logs every API call (model, tokens, cost), enforces monthly budgets with hard-stop mode, provides aggregated reporting - New llm_costs database table with indexes on created_at, model, operation - Modified LLM class: call_openrouter_with_usage() extracts token usage from OpenRouter responses; budget gate checks before each API call - Admin settings: monthly budget (USD), enforcement mode (disabled/warn/hard-stop), cost log retention period - Admin cost dashboard: budget progress bar, daily cost chart (Chart.js), per-model and per-operation breakdowns, recent API call log - PHPUnit tests: 16 tests covering cost calculation, pricing lookups, budget enforcement logic, and model validation - Updated ARCHITECTURE.md with new table schema, data flow, and key decisions - Updated CONVENTIONS.md with "how to add cost tracking for a new operation" - Version bump to 2.4.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
140 lines
2.2 KiB
CSS
Executable File
140 lines
2.2 KiB
CSS
Executable File
/**
|
|
* Peptide News — Admin Styles
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
/* Dashboard layout */
|
|
.peptide-news-dashboard {
|
|
max-width: 1400px;
|
|
}
|
|
|
|
/* Date filter bar */
|
|
.pn-date-filter {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
margin: 20px 0;
|
|
padding: 15px 20px;
|
|
background: #fff;
|
|
border: 1px solid #e2e8f0;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.pn-date-filter input[type="date"] {
|
|
padding: 6px 10px;
|
|
border: 1px solid #cbd5e1;
|
|
border-radius: 6px;
|
|
}
|
|
|
|
/* Summary cards */
|
|
.pn-summary-cards {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 16px;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
.pn-card {
|
|
background: #fff;
|
|
border: 1px solid #e2e8f0;
|
|
border-radius: 10px;
|
|
padding: 24px;
|
|
text-align: center;
|
|
transition: box-shadow 0.2s ease;
|
|
}
|
|
|
|
.pn-card:hover {
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
|
}
|
|
|
|
.pn-card h3 {
|
|
font-size: 32px;
|
|
font-weight: 700;
|
|
color: #1e293b;
|
|
margin: 0 0 4px;
|
|
}
|
|
|
|
.pn-card p {
|
|
font-size: 13px;
|
|
color: #64748b;
|
|
margin: 0;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
/* Charts */
|
|
.pn-charts-row {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 20px;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
.pn-chart-wide {
|
|
grid-column: 1 / -1;
|
|
}
|
|
|
|
.pn-chart-box {
|
|
background: #fff;
|
|
border: 1px solid #e2e8f0;
|
|
border-radius: 10px;
|
|
padding: 20px;
|
|
position: relative;
|
|
}
|
|
|
|
.pn-chart-box canvas {
|
|
max-height: 300px;
|
|
width: 100% !important;
|
|
}
|
|
|
|
.pn-chart-box h2 {
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
color: #334155;
|
|
margin: 0 0 16px;
|
|
padding: 0;
|
|
}
|
|
|
|
/* Tables */
|
|
.pn-table-section {
|
|
margin: 30px 0;
|
|
background: #fff;
|
|
border: 1px solid #e2e8f0;
|
|
border-radius: 10px;
|
|
padding: 20px;
|
|
}
|
|
|
|
.pn-table-section h2 {
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
color: #334155;
|
|
margin: 0 0 16px;
|
|
}
|
|
|
|
.pn-table-section .wp-list-table {
|
|
border: none;
|
|
}
|
|
|
|
/* Articles page title count */
|
|
.title-count {
|
|
font-weight: 400;
|
|
color: #64748b;
|
|
font-size: 16px;
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 782px) {
|
|
.pn-charts-row {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.pn-summary-cards {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
|
|
.pn-date-filter {
|
|
flex-wrap: wrap;
|
|
}
|
|
}
|