/* ── AI Token Counter — Styles ─────────────────── */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #222535;
    --bg-input: #181b25;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-muted: #5f6368;
    --accent: #7c6aff;
    --accent-glow: rgba(124, 106, 255, 0.15);
    --border: #2d3040;
    --success: #34d399;
    --cheapest: #34d399;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
    --nav-height: 64px;
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + 16px);
    -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────── */

header {
    padding: 24px 20px 8px;
    text-align: center;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Main Content ────────────────────────────────── */

main {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
}

.view {
    display: none;
    animation: fadeSlideIn 0.25s ease-out;
}

.view.active {
    display: block;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Model Selector ──────────────────────────────── */

.model-selector,
.cost-model-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.model-selector label,
.cost-model-selector label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.model-selector select,
.cost-model-selector select {
    flex: 1;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
}

.model-selector select:focus,
.cost-model-selector select:focus {
    border-color: var(--accent);
}

.model-selector select optgroup,
.cost-model-selector select optgroup {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ── Text Input Area ─────────────────────────────── */

.input-area {
    position: relative;
    margin-bottom: 12px;
}

textarea {
    width: 100%;
    min-height: 160px;
    max-height: 400px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    padding-right: 48px;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea::placeholder {
    color: var(--text-muted);
}

.input-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* ── Input Footer (char counter + code badge) ───── */

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px 0;
    min-height: 22px;
}

.char-counter {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
}

.char-counter.has-text {
    color: var(--text-secondary);
}

.code-badge {
    display: none;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 2px 8px;
    border-radius: 10px;
    animation: fadeIn 0.3s ease;
}

.code-badge.visible {
    display: flex;
}

.code-badge svg {
    flex-shrink: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Presets Bar ─────────────────────────────────── */

.presets-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.presets-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.presets-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 0;
}

.presets-scroll::-webkit-scrollbar {
    display: none;
}

.preset-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-secondary);
    padding: 4px 10px;
    font-size: 0.7rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition);
}

.preset-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--accent-glow);
}

.preset-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Stats Grid ──────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    transition: transform 0.25s ease, border-color var(--transition), box-shadow 0.25s ease;
    position: relative;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stat-card.primary {
    background: linear-gradient(135deg, rgba(124, 106, 255, 0.12), rgba(124, 106, 255, 0.04));
    border-color: rgba(124, 106, 255, 0.3);
}

.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease, transform 0.15s ease;
}

.stat-card.primary .stat-value {
    color: var(--accent);
    font-size: 1.8rem;
}

.stat-value.updated {
    color: var(--success);
    transform: scale(1.05);
}

.stat-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* ── Copy Button (inside stat card) ─────────────── */

.copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-muted);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    opacity: 0;
}

.stat-card:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* ── Context Window Bar ─────────────────────────── */

.context-bar {
    margin-top: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
}

.context-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.context-bar-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.context-bar-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.context-bar-track {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.context-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease, background 0.3s ease;
    min-width: 0;
}

/* ── Compare View ────────────────────────────────── */

.compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.compare-sort {
    display: flex;
    align-items: center;
    gap: 6px;
}

.compare-sort label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sort-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 5px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.sort-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.sort-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-copy-all {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 5px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition);
}

.btn-copy-all:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

/* ── Cheapest Badge ─────────────────────────────── */

.cheapest-badge {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.25);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s;
}

.cheapest-badge.hidden {
    display: none;
}

.cheapest-icon {
    font-size: 1.1rem;
}

.cheapest-text {
    font-size: 0.82rem;
    color: var(--cheapest);
    font-weight: 500;
}

/* ── Compare Grid ───────────────────────────────── */

.compare-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.compare-provider {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.provider-name {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.compare-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition), transform 0.15s ease;
    border-radius: 4px;
    padding-left: 8px;
    padding-right: 8px;
    margin: 0 -8px;
}

.compare-row:hover {
    background: rgba(124, 106, 255, 0.06);
    transform: translateX(2px);
}

.compare-row:last-child {
    border-bottom: none;
}

.compare-row.row-cheapest {
    background: rgba(52, 211, 153, 0.04);
}

.compare-row.row-cheapest:hover {
    background: rgba(52, 211, 153, 0.08);
}

.compare-model-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.compare-rank {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-primary);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.compare-model {
    font-size: 0.9rem;
    font-weight: 500;
}

.compare-provider-tag {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.7;
}

.compare-values {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compare-tokens {
    font-size: 0.95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

.compare-cost {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.compare-badges {
    display: flex;
    gap: 6px;
}

.badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-cheapest {
    background: rgba(52, 211, 153, 0.12);
    color: var(--cheapest);
}

.badge-fewest {
    background: rgba(124, 106, 255, 0.12);
    color: var(--accent);
}

.compare-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}

.compare-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* ── Cost Calculator View ───────────────────────── */

.cost-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cost-summary-card,
.cost-batch-card,
.cost-pricing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cost-summary-header,
.cost-batch-header,
.cost-pricing-header {
    padding: 12px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cost-summary-body,
.cost-batch-body,
.cost-pricing-body {
    padding: 16px;
}

.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.cost-row-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cost-row-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.cost-total-row {
    padding-top: 10px;
}

.cost-total {
    font-size: 1.1rem;
    color: var(--accent);
}

.cost-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

.cost-output-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cost-output-control input[type="range"] {
    width: 100px;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

.cost-output-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.cost-output-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.cost-output-control input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* ── Batch Estimation ────────────────────────────── */

.cost-batch-input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.cost-batch-input-row label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cost-batch-input-row input[type="number"] {
    width: 120px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 0.85rem;
    text-align: right;
    outline: none;
    font-variant-numeric: tabular-nums;
    transition: border-color var(--transition);
}

.cost-batch-input-row input[type="number"]:focus {
    border-color: var(--accent);
}

.cost-batch-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cost-batch-result {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}

.cost-batch-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.cost-batch-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
}

/* ── Pricing Table ───────────────────────────────── */

.cost-pricing-row {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.cost-pricing-row:last-child {
    border-bottom: none;
}

.cost-pricing-row.pricing-header {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    padding-bottom: 10px;
}

.cost-pricing-model {
    font-size: 0.82rem;
    font-weight: 500;
}

.cost-pricing-model .provider-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.cost-pricing-amount {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--text-secondary);
}

/* ── History View ────────────────────────────────── */

.history-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-title {
    font-size: 1rem;
    font-weight: 600;
}

.btn-clear-history {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 5px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition);
}

.btn-clear-history:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    animation: fadeSlideIn 0.2s ease-out;
    animation-fill-mode: backwards;
}

.history-item:nth-child(1) { animation-delay: 0s; }
.history-item:nth-child(2) { animation-delay: 0.03s; }
.history-item:nth-child(3) { animation-delay: 0.06s; }
.history-item:nth-child(4) { animation-delay: 0.09s; }
.history-item:nth-child(5) { animation-delay: 0.12s; }

.history-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.history-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.history-item-model {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
}

.history-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.history-item-preview {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.history-item-stats {
    display: flex;
    gap: 12px;
}

.history-stat {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.history-stat strong {
    color: var(--text-primary);
    font-weight: 600;
}

.history-item-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity var(--transition);
}

.history-item:hover .history-item-actions {
    opacity: 1;
}

.history-action-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    padding: 3px 8px;
    font-size: 0.68rem;
    cursor: pointer;
    transition: all var(--transition);
}

.history-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.history-action-btn.delete-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ── Confirm Dialog ──────────────────────────────── */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.15s ease;
}

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

.confirm-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.confirm-text {
    font-size: 0.95rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-btn {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid var(--border);
}

.confirm-cancel {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.confirm-cancel:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.confirm-ok {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.confirm-ok:hover {
    opacity: 0.9;
}

/* ── Toast Notification ─────────────────────────── */

.toast {
    position: fixed;
    bottom: calc(var(--nav-height) + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--accent);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 200;
    pointer-events: none;
    visibility: hidden;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Keyboard Shortcuts Overlay ──────────────────── */

.shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.15s ease;
}

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

.shortcuts-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    max-width: 360px;
    width: 90%;
    animation: scaleIn 0.2s ease;
}

.shortcuts-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.shortcuts-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 4px;
    transition: color var(--transition);
}

.shortcuts-close:hover {
    color: var(--text-primary);
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.shortcut-row:last-child {
    border-bottom: none;
}

.shortcut-action {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.shortcut-keys {
    display: flex;
    gap: 4px;
}

kbd {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 0.75rem;
    font-family: inherit;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 24px;
    text-align: center;
}

/* ── View Placeholder ────────────────────────────── */

.view-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-size: 0.95rem;
}

/* ── Bottom Navigation ───────────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    z-index: 100;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 16px;
    cursor: pointer;
    transition: color var(--transition), transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.nav-btn.active {
    color: var(--accent);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
}

.nav-btn:hover {
    color: var(--text-primary);
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.nav-label {
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card.primary {
        grid-column: 1 / -1;
    }

    header h1 {
        font-size: 1.3rem;
    }

    .compare-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .cost-batch-results {
        grid-template-columns: 1fr;
    }

    .cost-pricing-row {
        grid-template-columns: 1fr 60px 60px;
    }
}

@media (min-width: 768px) {
    main {
        padding: 0 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    textarea {
        min-height: 200px;
    }
}

/* ── Scrollbar ───────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ── Focus Visible (accessibility) ───────────────── */

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
    outline: none;
}
