@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --bg-base: #0f0f14;
    --bg-card: #1a1a24;
    --bg-card-hover: #21212e;
    --bg-input: #12121a;
    --bg-sidebar: #13131c;
    --border: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(99, 102, 241, 0.5);

    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-light: rgba(99, 102, 241, 0.12);
    --primary-glow: rgba(99, 102, 241, 0.3);

    --accent-green: #22c55e;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;

    --text-main: #f1f1f3;
    --text-muted: #8b8ba7;
    --text-faint: #4a4a6a;

    --radius: 14px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.7);

    --sidebar-width: 260px;
    --topbar-height: 64px;

    /* Module colors */
    --c-grocery: #22c55e;
    --c-stock: #3b82f6;
    --c-recipes: #f97316;
    --c-vacation-short: #06b6d4;
    --c-vacation-long: #8b5cf6;
    --c-movies: #ec4899;
    --c-tasks: #f59e0b;
    --c-restaurants: #ef4444;
    --c-calendar: #6366f1;
}

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input,
textarea,
select {
    font-family: inherit;
}

img {
    max-width: 100%;
}

ul {
    list-style: none;
}

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-faint);
    border-radius: 99px;
}

/* ─── Auth Page ────────────────────────────────────────────────────────────── */
#auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

#auth-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, transparent 70%);
    top: -200px;
    left: -100px;
    pointer-events: none;
}

#auth-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, transparent 70%);
    bottom: -100px;
    right: -50px;
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 36px;
}

.auth-logo .logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px var(--primary-glow);
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-logo p {
    color: var(--text-muted);
    margin-top: 6px;
    font-size: 14px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.auth-form input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white;
    font-size: 15px;
    font-weight: 600;
    padding: 13px;
    border-radius: var(--radius-sm);
    transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--primary-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.auth-error {
    color: var(--accent-red);
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    display: none;
}

/* ─── App Layout ───────────────────────────────────────────────────────────── */
#app {
    display: none;
    min-height: 100vh;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-logo h2 {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint);
    padding: 0 8px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary-hover);
}

.nav-item .nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-item.active .nav-icon {
    background: var(--primary-light);
}

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 99px;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.user-pill:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
}

.user-pill .user-info {
    flex: 1;
    min-width: 0;
}

.user-pill .user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-pill .user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ─── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: rgba(15, 15, 20, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.topbar-title h1 {
    font-size: 20px;
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Live indicator */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.04);
}

.live-dot {
    width: 7px;
    height: 7px;
    background: var(--accent-green);
    border-radius: 50%;
}

.live-dot.connected {
    animation: pulse-green 2s infinite;
}

.live-dot.disconnected {
    background: var(--accent-red);
    animation: none;
}

@keyframes pulse-green {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
    }
}

.page-content {
    flex: 1;
    padding: 28px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

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

.card-header {
    padding: 20px 24px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 700;
    flex: 1;
}

.card-body {
    padding: 20px 24px;
}

/* ─── Add Form (inline) ────────────────────────────────────────────────────── */
.add-form {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-input);
    align-items: center;
    flex-wrap: wrap;
}

.add-form input,
.add-form select {
    flex: 1;
    min-width: 120px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.add-form input:focus,
.add-form select:focus {
    border-color: var(--primary);
}

.add-form select {
    cursor: pointer;
}

.btn-add {
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

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

/* ─── List Items ───────────────────────────────────────────────────────────── */
.list-container {
    min-height: 200px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    position: relative;
}

.list-item:hover {
    background: var(--bg-card-hover);
}

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

.list-item.checked {
    opacity: 0.5;
}

.list-item.checked .item-name {
    text-decoration: line-through;
}

.item-check {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.item-check:hover {
    border-color: var(--accent-green);
}

.item-check.checked {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.item-check.checked::after {
    content: '✓';
    color: white;
    font-size: 13px;
    font-weight: 700;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 14px;
    font-weight: 500;
}

.item-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.list-item:hover .item-actions {
    opacity: 1;
}

.btn-icon {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.15s;
    color: var(--text-muted);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.btn-icon.delete:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

/* ─── Category Badge ───────────────────────────────────────────────────────── */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 99px;
    white-space: nowrap;
}

.badge-green {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green);
}

.badge-blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.badge-amber {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-amber);
}

.badge-red {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.badge-purple {
    background: rgba(168, 85, 247, 0.1);
    color: var(--accent-purple);
}

.badge-pink {
    background: rgba(236, 72, 153, 0.1);
    color: var(--accent-pink);
}

.badge-cyan {
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

.badge-gray {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* ─── Stars Rating ─────────────────────────────────────────────────────────── */
.stars {
    display: flex;
    gap: 2px;
}

.star {
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s;
}

.star:hover {
    transform: scale(1.2);
}

.star.filled {
    filter: none;
}

.star.empty {
    opacity: 0.3;
}

/* ─── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    padding: 16px 24px 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: color 0.15s, background 0.15s;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary-hover);
    border-bottom-color: var(--primary);
}

/* ─── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
    box-shadow: var(--shadow-lg);
}

.modal-overlay.open .modal {
    transform: scale(1);
}

.modal-header {
    padding: 24px 28px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    flex: 1;
}

.modal-body {
    padding: 24px 28px;
}

.modal-footer {
    padding: 16px 28px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group select {
    cursor: pointer;
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-save {
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, transform 0.1s;
}

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

/* ─── Dashboard (Home) ─────────────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow);
}

.module-card .icon {
    font-size: 28px;
    margin-bottom: 12px;
}

.module-card .mod-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.module-card .mod-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── Activity Feed ────────────────────────────────────────────────────────── */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.activity-time {
    font-size: 11px;
    color: var(--text-faint);
    white-space: nowrap;
    margin-top: 2px;
}

.activity-text {
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
}

.activity-text strong {
    color: var(--text-main);
}

/* ─── Recipes ──────────────────────────────────────────────────────────────── */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    padding: 20px 24px;
}

.recipe-card {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.recipe-card:hover {
    border-color: var(--c-recipes);
    transform: translateY(-2px);
}

.recipe-card .recipe-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
}

.recipe-card .recipe-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

.recipe-score {
    margin-top: 12px;
}

.score-bar {
    height: 6px;
    background: var(--bg-card);
    border-radius: 99px;
    margin-top: 6px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--c-recipes), #fbbf24);
    transition: width 0.5s;
}

/* ─── Calendar ─────────────────────────────────────────────────────────────── */
.calendar-wrapper {
    padding: 20px 24px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.calendar-nav h3 {
    font-size: 18px;
    font-weight: 700;
}

.cal-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    color: var(--text-muted);
    font-size: 18px;
}

.cal-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.cal-header {
    background: var(--bg-card);
    padding: 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.cal-day {
    background: var(--bg-card);
    min-height: 90px;
    padding: 8px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.cal-day:hover {
    background: var(--bg-card-hover);
}

.cal-day.other-month {
    opacity: 0.3;
}

.cal-day.today .cal-day-num {
    background: var(--primary);
    color: white;
    border-radius: 50%;
}

.cal-day-num {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.cal-event {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* ─── Toast ────────────────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    min-width: 280px;
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: slide-in 0.3s ease;
}

@keyframes slide-in {
    from {
        transform: translateX(100px) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-body {
    flex: 1;
}

.toast-title {
    font-size: 13px;
    font-weight: 600;
}

.toast-msg {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.toast-close {
    font-size: 18px;
    color: var(--text-faint);
    cursor: pointer;
}

.toast-close:hover {
    color: var(--text-main);
}

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

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* ─── Settings ─────────────────────────────────────────────────────────────── */
.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

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

.setting-label {
    font-size: 14px;
    font-weight: 500;
}

.setting-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Toggle switch */
.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 99px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: var(--text-faint);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.toggle input:checked+.toggle-slider {
    background: var(--primary);
    border-color: var(--primary);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(18px);
    background: white;
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
.hamburger {
    display: none;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 99;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        font-size: 20px;
        color: var(--text-muted);
        cursor: pointer;
        transition: background 0.15s;
    }

    .hamburger:hover {
        background: rgba(255, 255, 255, 0.06);
    }

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

    .page-content {
        padding: 12px;
        overflow-x: hidden;
    }

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

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

    /* ── Empêcher le scroll horizontal global ── */
    body,
    #app,
    .app-layout,
    .main-content {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* ── Topbar compacte ── */
    .topbar {
        padding: 0 12px;
        gap: 8px;
    }

    .topbar-title h1 {
        font-size: 16px;
    }

    .live-indicator span {
        display: none;
    }

    /* ── Formulaires d'ajout : passage en colonne sur mobile ── */
    .add-form {
        flex-direction: column !important;
        padding: 12px 16px !important;
        gap: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .add-form input,
    .add-form select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: unset !important;
        flex: unset !important;
        box-sizing: border-box !important;
    }

    .btn-add {
        width: 100%;
        justify-content: center;
    }

    /* ── Liste items : réduction du padding et masquage des actions au hover ── */
    .list-item {
        padding: 12px 14px;
        gap: 10px;
        flex-wrap: wrap;
        width: 100%;
        box-sizing: border-box;
        overflow-wrap: anywhere;
    }

    .item-info {
        min-width: 0;
        word-break: break-word;
    }

    .item-name,
    .item-meta {
        white-space: normal !important;
        word-break: break-word !important;
    }

    /* Les boutons d'action sont toujours visibles sur mobile (pas de hover) */
    .list-item .item-actions {
        opacity: 1;
    }

    /* ── Badges : retour à la ligne si besoin ── */
    .badge {
        font-size: 10px;
        padding: 2px 7px;
        flex-shrink: 0;
    }

    /* ── Cards : padding réduit ── */
    .card-header {
        padding: 14px 16px;
    }

    .card-body {
        padding: 14px 16px;
    }

    /* ── Calendrier : jours plus petits ── */
    .cal-day {
        min-height: 50px;
        padding: 4px;
    }

    .cal-event {
        font-size: 9px;
        padding: 1px 4px;
    }

    .cal-header {
        font-size: 10px;
        padding: 6px 4px;
    }

    .cal-day-num {
        font-size: 11px;
    }

    /* ── Modales : plein écran sur mobile ── */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    /* ── Dashboard home : activité ── */
    .activity-item {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* ── Recettes : score bar ── */
    .recipe-card {
        padding: 16px;
    }

    /* ── Tabs : scroll horizontal propre ── */
    .tabs {
        padding: 12px 16px 0;
        gap: 2px;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ─── Utilities ────────────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-2 {
    gap: 8px;
}

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

.text-sm {
    font-size: 13px;
}

.w-full {
    width: 100%;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}