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

:root {
    --primary: #00B894;
    --secondary: #55EFC4;
    --accent: #E17055;
    --bg: #0A1A14;
    --bg-card: #0F2519;
    --bg-elevated: #153525;
    --bg-input: #1A3D2A;
    --border: rgba(0, 184, 148, .15);
    --border-hover: rgba(0, 184, 148, .35);
    --text: #E8F5F0;
    --text-sec: #8FBAA8;
    --text-muted: #5A8A72;
    --radius: 12px;
    --font: 'Inter', system-ui, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --tr: 250ms ease;
}

html {
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 1.5rem;
    background-image: radial-gradient(ellipse at 50% 0%, rgba(0, 184, 148, .08) 0%, transparent 50%);
}

.app {
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.header {
    text-align: center;
    padding: 0.5rem 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-sec);
    font-size: 0.82rem;
    margin-top: 0.15rem;
}

/* Setup */
.setup-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.setup-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.setup-field:last-child {
    grid-column: 1 / -1;
}

.setup-field label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.setup-input {
    flex: 1;
    padding: 0.55rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--mono);
    text-align: center;
    outline: none;
    transition: border-color var(--tr);
}

.setup-input:focus {
    border-color: var(--primary);
}

.salary-input {
    text-align: left;
}

.currency {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.step-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--tr);
    font-family: var(--font);
}

.step-btn:hover {
    background: var(--primary);
    color: white;
    border-color: transparent;
}

.toggle-group {
    display: flex;
    gap: 0.5rem;
}

.toggle-btn {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-sec);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--tr);
}

.toggle-btn:hover {
    background: var(--bg-elevated);
}

.toggle-btn.active {
    background: var(--primary);
    color: white;
    border-color: transparent;
}

/* Cost Display */
.cost-display {
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-image: radial-gradient(ellipse at 50% 20%, rgba(0, 184, 148, .1) 0%, transparent 70%);
}

.cost-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.cost-amount {
    font-size: 3.5rem;
    font-weight: 800;
    font-family: var(--mono);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

.cost-rates {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.rate {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
}

.rate-val {
    font-size: 1rem;
    font-weight: 700;
    color: var(--secondary);
    font-family: var(--mono);
}

.rate-label {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.rate-divider {
    width: 1px;
    height: 16px;
    background: var(--border);
}

.timer-display {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-sec);
    font-family: var(--mono);
    letter-spacing: 0.08em;
}

/* Controls */
.controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.ctrl-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--tr);
}

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

.ctrl-btn.start,
.ctrl-btn.resume {
    background: var(--primary);
    color: white;
    border-color: transparent;
}

.ctrl-btn.start:hover,
.ctrl-btn.resume:hover {
    background: #00a383;
}

.ctrl-btn.pause {
    background: var(--accent);
    color: white;
    border-color: transparent;
}

.ctrl-btn.pause:hover {
    background: #d66248;
}

.ctrl-btn.reset {
    background: var(--bg-input);
    color: var(--text-sec);
}

.ctrl-btn.reset:hover {
    background: var(--bg-elevated);
    color: var(--text);
}

.hidden {
    display: none !important;
}

/* Panels */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-size: 0.85rem;
    font-weight: 700;
}

.panel-actions {
    display: flex;
    gap: 0.35rem;
}

.btn-sm {
    padding: 0.25rem 0.55rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-sec);
    font-size: 0.68rem;
    font-weight: 600;
    font-family: var(--font);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--tr);
}

.btn-sm:hover {
    background: var(--primary);
    color: white;
    border-color: transparent;
}

/* Agenda */
.agenda-list {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.agenda-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.5rem;
}

.agenda-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    background: var(--bg-input);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.agenda-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(0, 184, 148, .15);
}

.agenda-name {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.82rem;
    font-family: var(--font);
    outline: none;
}

.agenda-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--mono);
    min-width: 50px;
    text-align: right;
}

.agenda-cost {
    font-size: 0.72rem;
    color: var(--secondary);
    font-family: var(--mono);
    min-width: 60px;
    text-align: right;
}

.agenda-start {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--tr);
}

.agenda-start:hover {
    background: var(--primary);
    color: white;
    border-color: transparent;
}

.agenda-remove {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    border-radius: 4px;
    transition: var(--tr);
}

.agenda-remove:hover {
    color: var(--accent);
}

/* History */
.history-list {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 250px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.65rem;
    background: var(--bg-input);
    border-radius: 8px;
    font-size: 0.78rem;
}

.history-date {
    color: var(--text-muted);
    font-size: 0.68rem;
}

.history-detail {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.history-cost {
    font-weight: 700;
    color: var(--secondary);
    font-family: var(--mono);
}

.history-meta {
    color: var(--text-muted);
    font-size: 0.68rem;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}

.stat-card {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: var(--bg-input);
    border-radius: 8px;
}

.stat-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary);
    font-family: var(--mono);
}

.stat-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 0.15rem;
}

.chart-container {
    padding: 0.5rem 1rem 1rem;
}

.chart-bar-group {
    display: flex;
    align-items: flex-end;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.chart-bar {
    background: linear-gradient(to top, var(--primary), var(--secondary));
    border-radius: 4px 4px 0 0;
    min-width: 24px;
    transition: height 0.5s ease;
    position: relative;
    cursor: default;
}

.chart-bar:hover {
    opacity: 0.85;
}

.chart-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.2rem;
    width: 100%;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 0.6rem 1.2rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--text);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
    opacity: 0;
    transition: 350ms cubic-bezier(.16, 1, .3, 1);
    z-index: 100;
    pointer-events: none;
}

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

@media (max-width: 480px) {
    body {
        padding: 1rem;
    }

    .setup-grid {
        grid-template-columns: 1fr;
    }

    .cost-amount {
        font-size: 2.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .controls {
        flex-wrap: wrap;
    }
}