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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navbar */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--text);
}

.inline-form {
    display: inline;
}

.link-button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.link-button:hover {
    color: var(--text);
}

/* Auth */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-container {
    text-align: center;
    width: 100%;
    max-width: 360px;
    padding: 2rem;
}

.auth-container h1 {
    font-size: 1.875rem;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

.auth-links {
    margin-top: 1.5rem;
    color: var(--text-muted);
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input {
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

/* Buttons */
.btn {
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-block {
    width: 100%;
}

.btn-hit {
    background: var(--danger);
    color: white;
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-hit:hover {
    background: #b91c1c;
}

.btn-hit-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
}

.btn-hit-secondary:hover {
    background: var(--bg);
}

.btn-large {
    border-radius: var(--radius);
}

.btn-icon {
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.card h2 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

/* Dashboard */
.dashboard-header {
    margin: 1.5rem 0;
}

.dashboard-header h1 {
    font-size: 1.5rem;
}

.dashboard-header .date {
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.stat-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-today .stat-value {
    color: var(--danger);
}

.stat-target .stat-value {
    color: var(--primary);
}

.stat-remaining .stat-value {
    color: var(--success);
}

.stat-no-target {
    grid-column: span 2;
}

.action-section {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.hit-form {
    flex: 1;
}

.hit-form button {
    width: 100%;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--danger);
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    text-align: left;
    padding: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.table tr.on-target {
    background: rgba(22, 163, 74, 0.05);
}

.table tr.over-target {
    background: rgba(220, 38, 38, 0.05);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(202, 138, 4, 0.1);
    color: var(--warning);
}

.badge-neutral {
    background: var(--bg);
    color: var(--text-muted);
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

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

/* Plan */
.plan-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Responsive */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stat-no-target {
        grid-column: span 2;
    }
    
    .nav-links {
        gap: 0.75rem;
    }
    
    .nav-links a {
        font-size: 0.75rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}
