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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
}

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

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

header {
    text-align: center;
    padding: 2rem 0 3rem;
    position: relative;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

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

.language-selector {
    position: absolute;
    top: 2rem;
    right: 0;
}

.language-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background-color: var(--surface);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.language-selector select:hover {
    border-color: var(--primary-color);
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-suffix {
    position: absolute;
    right: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="number"],
input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper input[type="number"] {
    padding-left: 2rem;
}

.input-wrapper .input-suffix + input[type="number"] {
    padding-right: 2.5rem;
}

input[type="number"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.tip-presets {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tip-preset {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tip-preset:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tip-preset:active {
    background: var(--primary-color);
    color: white;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin-bottom: 0;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

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

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

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

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

.btn-remove {
    padding: 0.25rem 0.75rem;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: var(--danger);
    color: white;
}

.people-list,
.items-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.person-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.person-name {
    font-weight: 500;
}

.item-entry {
    padding: 1rem;
    background: var(--background);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.item-row {
    display: grid;
    grid-template-columns: 1fr 150px auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.item-name-input {
    width: 100%;
}

.item-price-input {
    width: 100%;
}

.item-assignment {
    margin-top: 1rem;
}

.assignment-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-right: 1rem;
}

.assignment-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.summary-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid var(--border);
}

.summary-details {
    margin-bottom: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

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

.summary-row.total {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--primary-color);
    padding-top: 1rem;
}

.results-section {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.results-section h2 {
    color: white;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.result-item:last-child {
    margin-bottom: 1.5rem;
}

.person-amount {
    font-weight: 600;
}

.hidden {
    display: none;
}

footer {
    text-align: center;
    padding: 3rem 0 2rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@media (max-width: 640px) {
    h1 {
        font-size: 2rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .item-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .tip-presets {
        flex-wrap: wrap;
    }
    
    .assignment-options {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .language-selector {
        position: static;
        margin-top: 1rem;
    }
}