:root {
    --accent: rgb(92, 92, 255);
    --accent-hover: rgb(75, 75, 230);
    --bg: #f9fafb;
    --surface: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --border-dash: #d1d5db;
    --radius-lg: 20px;
    --radius-sm: 10px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 16px;
}

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

.header-content h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.075,0.82,0.165,1);
    border: 1px solid transparent;
}

.btn.primary {
    background-color: var(--accent);
    color: white;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

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

.btn.secondary {
    background-color: transparent;
    border-color: var(--border);
    color: var(--text-main);
}

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

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.icon-btn:hover {
    color: var(--text-main);
    background: var(--bg);
}

.icon-btn.danger:hover {
    color: #ef4444;
    background: #fee2e2;
}

/* Week Header */
.week-header-container {
    display: flex;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-dash);
}

.habit-name-spacer {
    flex: 1;
    min-width: 150px;
}

.week-header {
    display: flex;
    gap: 8px;
}

.day-header {
    width: 40px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.day-header .date {
    font-weight: 600;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

/* Habits List */
.habits-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.habit-row {
    display: flex;
    align-items: center;
    background: var(--surface);
    padding: 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s cubic-bezier(0.075,0.82,0.165,1), opacity 0.3s;
}

.habit-info {
    flex: 1;
    min-width: 150px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 24px;
}

.habit-name {
    font-weight: 500;
    font-size: 16px;
    word-break: break-word;
}

.habit-days {
    display: flex;
    gap: 8px;
}

.day-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.075,0.82,0.165,1);
    color: transparent;
}

.day-toggle.completed {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.day-toggle:hover:not(.completed) {
    background: var(--bg);
}

.day-toggle svg {
    width: 20px;
    height: 20px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 16px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-dash);
}

.empty-state[hidden] {
    display: none;
}

.empty-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Modal */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s cubic-bezier(0.075,0.82,0.165,1);
}

.overlay[hidden] {
    display: none;
    opacity: 0;
}

.modal {
    background: var(--surface);
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 20px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@media (max-width: 640px) {
    .habit-row {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .habit-info {
        padding-right: 0;
    }
    .week-header-container {
        display: none;
    }
    .habit-days {
        justify-content: space-between;
    }
    .day-toggle {
        width: 100%;
        max-width: 40px;
    }
}
