:root {
    /* Palette from STYLE_GUIDE.md */
    --sage: #7A8B6E;
    --cream: #FAF9F6;
    --dark-oak: #2D241E;
    --terracotta: #C16657;
    --soft-blue: #E1EAF2;
    --sage-light: #F1F4EF;

    /* Applying inverted theme: Green background, light text */
    --bg-primary: var(--sage);
    --bg-secondary: #6B7C5F;
    /* Slightly darker sage for contrast */
    --bg-card: rgba(255, 255, 255, 0.1);
    /* Glassy effect */

    --text-primary: var(--cream);
    --text-secondary: rgba(250, 249, 246, 0.8);
    --text-muted: rgba(250, 249, 246, 0.6);

    --border: rgba(255, 255, 255, 0.2);
    --radius: 32px;
    /* --radius-xl */

    --accent: #FFD700;
    /* Gold for highlights on green */
    --accent-alt: #98FF98;
    /* Mint */
    --danger: var(--terracotta);
    --success: #fff;

    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 600;
    color: var(--cream);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s, background 0.2s;
    backdrop-filter: blur(10px);
}

.card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.15);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 1;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-value {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.1;
}

.card-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Highlights */
.card.highlight {
    border-color: rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.1);
}

.card.highlight .card-value {
    color: #FFD700;
}

.card.highlight-alt {
    border-color: rgba(255, 255, 255, 0.4);
}

/* Insight Box */
.insight-box {
    background: rgba(45, 36, 30, 0.2);
    /* Dark Oak tint */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 3rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.insight-box strong {
    color: #FFD700;
    font-family: var(--font-heading);
    font-size: 1.3rem;
}

/* Tables */
.table-section {
    margin-bottom: 3rem;
}

.table-section h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--cream);
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    backdrop-filter: blur(5px);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

th {
    background: rgba(0, 0, 0, 0.1);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

td {
    font-size: 1rem;
    color: var(--text-primary);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

tbody tr:last-child td {
    border-bottom: none;
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
}

/* Chart */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    min-height: 250px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 180px;
    padding-top: 1rem;
}

.chart-bar {
    flex: 1;
    background: var(--cream);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    position: relative;
    transition: opacity 0.2s, height 0.5s ease;
    opacity: 0.8;
}

.chart-bar:hover {
    opacity: 1;
    background: #fff;
}

.chart-bar::after {
    content: attr(data-label);
    position: absolute;
    top: -2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    background: var(--dark-oak);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--cream);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 10;
}

.chart-bar:hover::after {
    opacity: 1;
}

.chart-labels {
    display: flex;
    gap: 6px;
    margin-top: 1rem;
}

.chart-label {
    flex: 1;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--cream);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    /* Pill shape */
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.last-updated {
    font-size: 0.9rem;
}

/* Cost colors - adjusted for visibility on green */
.cost-low {
    color: #fff;
}

.cost-medium {
    color: #FFD700;
}

.cost-high {
    color: #470143;
    filter: brightness(1.2);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

/* Additions for form elements */
.input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.input:focus {
    border-color: #7A8B6E;
    outline: none;
    background: #fff;
}

.card-section {
    margin-bottom: 2rem;
}

/* Model badges */
.model-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.model-haiku {
    background: rgba(152, 255, 152, 0.25);
    color: #98FF98;
    border: 1px solid rgba(152, 255, 152, 0.4);
}

.model-sonnet {
    background: rgba(255, 215, 0, 0.2);
    color: #FFD700;
    border: 1px solid rgba(255, 215, 0, 0.4);
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    backdrop-filter: blur(10px);
    max-width: 400px;
    width: 90%;
}

.login-box h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--cream);
    margin-bottom: 0.5rem;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

#loginForm {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#loginForm .input {
    padding: 1rem;
    font-size: 1rem;
    border-radius: 12px;
    text-align: center;
}

.login-btn {
    background: var(--cream);
    color: var(--sage);
    border: none;
    padding: 1rem 2rem;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.login-error {
    color: var(--terracotta);
    margin-top: 1rem;
    font-size: 0.9rem;
}

.login-overlay.hidden {
    display: none;
}