:root {
    --bg-main: #F0FFF4;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #F8F9FA;

    --primary: #00B894;
    --primary-hover: #00A383;
    --secondary: #55EFC4;
    --accent: #FDCB6E;

    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-muted: #B2BEC3;

    --border: #DFE6E9;
    --border-light: #F1F2F6;

    --error: #FF7675;
    --error-bg: rgba(255, 118, 117, 0.1);

    --success: #00B894;
    --success-bg: rgba(0, 184, 148, 0.1);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-round: 50%;

    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.08);

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Utilities */
.text-primary {
    color: var(--primary);
}

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

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

.text-error {
    color: var(--error);
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.span-2 {
    grid-column: span 2;
}

/* App Layout */
.app-layout {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
    background: var(--bg-surface);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo span {
    color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Workspace */
.workspace {
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
}

/* Card */
.card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 24px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

/* Add Item Form */
.add-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    align-items: flex-end;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--text-primary);
    background-color: var(--bg-surface);
    transition: all 0.2s;
    outline: none;
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--success-bg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px var(--success-bg);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
}

.btn-icon {
    background: transparent;
    padding: 8px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

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

/* Budget Overview */
.budget-overview {
    display: flex;
    justify-content: space-around;
    padding: 16px 24px;
}

.budget-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

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

.stat-muted .stat-value {
    color: var(--text-primary);
    font-weight: 700;
}

/* Toggles */
.view-toggles {
    display: flex;
    background-color: var(--bg-surface);
    border-radius: 100px;
    padding: 4px;
    width: max-content;
    box-shadow: var(--shadow-soft);
    margin: 8px 0;
}

.toggle-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px var(--success-bg);
}

/* List Area */
.list-area {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.group-section {
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.group-header {
    background-color: var(--border-light);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.group-subtotal {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.item-row {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    gap: 16px;
    transition: background-color 0.2s;
}

.item-row:hover {
    background-color: var(--bg-surface-hover);
}

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

/* Checkbox Checkmark style */
.item-check {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-round);
    border: 2px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    background: transparent;
}

.item-row.checked .item-check {
    background-color: var(--primary);
    border-color: var(--primary);
}

.item-row.checked .item-check::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
    transition: color 0.2s, text-decoration 0.2s;
}

.item-row.checked .item-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.item-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    align-items: center;
}

.item-tag {
    background-color: var(--border-light);
    padding: 2px 8px;
    border-radius: 100px;
    font-weight: 500;
}

.item-tag.person-tag {
    background-color: var(--bg-main);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.item-price {
    font-weight: 600;
    color: var(--text-primary);
    font-feature-settings: "tnum";
}

.item-row.checked .item-price {
    color: var(--text-muted);
}

.item-delete {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s;
}

.item-row:hover .item-delete {
    opacity: 1;
}

.item-delete:hover {
    color: var(--error);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--text-primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 100px;
    font-weight: 500;
    box-shadow: var(--shadow-hover);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Print Styles */
@media print {
    body {
        background-color: white;
    }

    .print-hide {
        display: none !important;
    }

    .app-layout {
        padding: 0;
        margin: 0;
        max-width: none;
    }

    .card,
    .group-section {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    .item-delete {
        display: none;
    }

    .item-row {
        border-bottom: 1px solid #eee;
    }

    .item-check {
        border-color: #999;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .add-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .span-2 {
        grid-column: auto;
    }

    .budget-overview {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .item-delete {
        opacity: 1;
    }
}