/* ============================================================
   Isskabet – Modern Freezer Management
   ============================================================ */

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

/* ---------- CSS Variables ---------- */
:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #EEF2FF;
    --secondary: #0EA5E9;
    --secondary-dark: #0284C7;
    --accent: #06B6D4;
    --bg: #F1F5F9;
    --bg-dark: #0F172A;
    --card: #FFFFFF;
    --text: #1E293B;
    --text-light: #64748B;
    --text-xlight: #94A3B8;
    --border: #E2E8F0;
    --border-dark: #CBD5E1;
    --danger: #EF4444;
    --danger-light: #FEF2F2;
    --success: #10B981;
    --success-light: #ECFDF5;
    --warning: #F59E0B;
    --warning-light: #FFFBEB;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-height: 64px;
    --max-width: 1200px;
}

/* ---------- Dark Mode Variables ---------- */
[data-theme="dark"] {
    --primary: #818CF8;
    --primary-dark: #6366F1;
    --primary-light: rgba(99, 102, 241, 0.15);
    --secondary: #38BDF8;
    --secondary-dark: #0EA5E9;
    --accent: #22D3EE;
    --bg: #0F172A;
    --bg-dark: #020617;
    --card: #1E293B;
    --text: #E2E8F0;
    --text-light: #94A3B8;
    --text-xlight: #64748B;
    --border: #334155;
    --border-dark: #475569;
    --danger: #F87171;
    --danger-light: rgba(239, 68, 68, 0.15);
    --success: #34D399;
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #FBBF24;
    --warning-light: rgba(245, 158, 11, 0.15);
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.3);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ---------- Navbar ---------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    margin-right: 2rem;
    text-decoration: none;
}

.navbar__brand svg { flex-shrink: 0; }

.navbar__links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    flex: 1;
}

.navbar__links a {
    color: #CBD5E1;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}

.navbar__links a:hover,
.navbar__links a.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.navbar__right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.navbar__user {
    color: #94A3B8;
    font-size: 0.8125rem;
}

.navbar__logout {
    color: #94A3B8 !important;
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem !important;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xs);
}

.navbar__logout:hover {
    color: #fff !important;
    border-color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.05);
}

/* Hamburger */
.navbar__toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: auto;
}

.navbar__toggle svg { display: block; }

@media (max-width: 768px) {
    .navbar__links {
        display: none;
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-dark);
        flex-direction: column;
        padding: 1rem;
        gap: 0.25rem;
        overflow-y: auto;
    }
    .navbar__links.open { display: flex; }
    .navbar__links a { font-size: 1rem; padding: 0.75rem 1rem; }
    .navbar__toggle { display: block; }
    .navbar__right { display: none; }
    .navbar__links.open .mobile-user-section { display: block; }
}

/* ---------- Main content area ---------- */
.main-content {
    margin-top: var(--nav-height);
    flex: 1;
    padding: 2rem 1.5rem;
    max-width: var(--max-width);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Page Header ---------- */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--text-light);
    font-size: 0.9375rem;
}

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card__header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card__header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.card__body { padding: 1.5rem; }
.card__footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: #F8FAFC;
}

/* ---------- Filter Bar ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.filter-bar .filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-bar label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
}

.filter-bar .search-input {
    flex: 1;
    min-width: 200px;
}

/* ---------- Form controls ---------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text);
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

select { cursor: pointer; }

textarea { resize: vertical; min-height: 100px; }

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.form-group .hint {
    font-size: 0.8125rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

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

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #DC2626; color: #fff; }

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover { background: #059669; color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--text-light);
    padding: 0.5rem 0.75rem;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block { width: 100%; }

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ---------- Tags / Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: #065F46; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-danger  { background: var(--danger-light); color: #991B1B; }
.badge-neutral { background: var(--bg); color: var(--text-light); }

/* ---------- Item List ---------- */
.item-list {
    list-style: none;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.item-card:last-child { border-bottom: none; }
.item-card:hover { background: #F8FAFC; }

.item-card__icon {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.item-card__body {
    display: block;
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
    overflow: hidden;
}

.item-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-card__meta {
    font-size: 0.8125rem;
    color: var(--text-light);
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
}

.item-card__break {
    display: none;
}

.item-card__amount {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    background: var(--bg);
    border-radius: var(--radius-xs);
    flex-shrink: 0;
    overflow: hidden;
}

.item-card__amount-text {
    padding: 0.375rem 0.75rem;
    min-width: 4rem;
    text-align: center;
}

.item-action-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 0;
    overflow: hidden;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
    line-height: 1;
    font-family: inherit;
    border-left: 1px solid var(--border);
    flex-shrink: 0;
}

.item-card:hover .item-action-btn,
.item-card:focus-within .item-action-btn {
    display: inline-flex;
    width: 34px;
    height: 100%;
    padding: 0.375rem 0;
}

.item-action-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.item-action-btn--delete:hover {
    color: var(--danger);
    background: var(--danger-light);
}

.item-action-btn:active {
    transform: scale(0.95);
}

/* Deleted / zero-amount card state */
.item-card--deleted {
    opacity: 0.55;
    pointer-events: none;
    background: var(--bg);
}

.item-card--deleted .item-action-btn {
    display: none !important;
}

.item-card--deleted .item-card__undo {
    pointer-events: auto;
}

.item-card__undo {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-xs);
    background: var(--primary-light);
    color: var(--primary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.item-card__undo:hover {
    background: var(--primary);
    color: #fff;
}

/* ---------- Stats Grid ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-card__label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

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

.stat-card__change {
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

.stat-card__change.positive { color: var(--success); }
.stat-card__change.negative { color: var(--danger); }

/* ---------- Bar Chart (CSS-only) ---------- */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 150px;
    padding: 0.5rem 0;
}

.bar-chart__bar {
    flex: 1;
    min-width: 20px;
    background: var(--primary);
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
    position: relative;
    transition: height var(--transition);
    cursor: default;
}

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

.bar-chart__label {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6875rem;
    color: var(--text-light);
    white-space: nowrap;
}

.bar-chart__val {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text);
}

/* ---------- Wizard ---------- */
.wizard { margin-bottom: 2rem; }

.wizard__steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.wizard__step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
    transition: all var(--transition);
}

.wizard__step.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.wizard__step.completed {
    background: var(--success-light);
    color: #065F46;
    border-color: #A7F3D0;
}

.wizard__step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.wizard__step.active .wizard__step-num { background: rgba(255,255,255,0.2); }
.wizard__step.completed .wizard__step-num { background: rgba(16,185,129,0.2); }

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

.wizard__actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* ---------- Inventory check item ---------- */
.inv-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

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

.inv-item__info { flex: 1; }

.inv-item__name {
    font-weight: 600;
    font-size: 1rem;
}

.inv-item__detail {
    font-size: 0.8125rem;
    color: var(--text-light);
}

.inv-item__actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

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

.inv-item.deleted {
    opacity: 0.35;
    text-decoration: line-through;
}

/* ---------- Recipe Cards ---------- */
.recipe-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.recipe-card__header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-light), #EDE9FE);
    border-bottom: 1px solid var(--border);
}

.recipe-card__title {
    font-size: 1.25rem;
    font-weight: 700;
}

.recipe-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.recipe-card__body { padding: 1.5rem; }

.recipe-card__section {
    margin-bottom: 1.25rem;
}

.recipe-card__section:last-child { margin-bottom: 0; }

.recipe-card__section h4 {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.recipe-card__section ul {
    padding-left: 1.25rem;
}

.recipe-card__section li {
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.recipe-card__ingredient {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.recipe-card__freezer-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #DBEAFE;
    color: #1D4ED8;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.recipe-card__section ol li {
    margin-bottom: 0.5rem;
}

.recipe-fallback-card__title {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
}

.recipe-fallback-card__details {
    margin-top: 1rem;
}

.recipe-fallback-card__details summary {
    cursor: pointer;
    color: var(--text-light);
    font-weight: 600;
}

.recipe-fallback-card__raw {
    margin-top: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: #F8FAFC;
    color: var(--text);
    white-space: pre-wrap;
    overflow-x: auto;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.875rem;
}

.recipe-results__notice {
    margin-bottom: 1rem;
}

/* ---------- Modal / Overlay ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease-out;
}

.modal--wide { max-width: 720px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal__header h3 { font-size: 1.125rem; font-weight: 600; }

.modal__close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
}

.modal__close:hover { background: var(--bg); color: var(--text); }

.modal__body { padding: 1.5rem; }

.modal__footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ---------- Alerts / Toasts ---------- */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success { background: var(--success-light); color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger  { background: var(--danger-light); color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: var(--warning-light); color: #92400E; border: 1px solid #FDE68A; }
.alert-info    { background: var(--primary-light); color: #3730A3; border: 1px solid #C7D2FE; }

.toast-container {
    position: fixed;
    top: calc(var(--nav-height) + 1rem);
    right: 1rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    animation: toastIn 0.3s ease-out;
    min-width: 250px;
    max-width: 400px;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

.toast.removing {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(100%); }
}

/* ---------- Table ---------- */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: #F8FAFC;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
}

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

.data-table tr:hover td { background: #F8FAFC; }

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    white-space: nowrap;
}

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

/* ---------- Loading spinner ---------- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg { width: 36px; height: 36px; }

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

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 0.75rem;
    color: var(--text-light);
}

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

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.empty-state__text {
    font-size: 0.9375rem;
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

/* ---------- Category pills ---------- */
.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition);
}

.category-pill:hover { border-color: var(--primary); color: var(--primary); }
.category-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.category-pill__icon {
    font-size: 0.95rem;
    line-height: 1;
}

/* ---------- Login page ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
    padding: 1.5rem;
}

.login-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.login-card__logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-card__logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}

.login-card__logo p {
    color: var(--text-light);
    font-size: 0.9375rem;
    margin-top: 0.25rem;
}

/* ---------- Slider / Range ---------- */
.range-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.range-group input[type="range"] {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    outline: none;
    border: none;
    padding: 0;
}

.range-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.range-group .range-value {
    font-weight: 700;
    font-size: 0.9375rem;
    min-width: 3rem;
    text-align: right;
}

/* ---------- Checkbox / Toggle ---------- */
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ---------- Footer ---------- */
.footer {
    background: var(--bg-dark);
    color: #64748B;
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8125rem;
    margin-top: auto;
}

/* ---------- Configuration sections ---------- */
.config-section {
    margin-bottom: 2rem;
}

.config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

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

.config-item__name {
    font-weight: 600;
    font-size: 1rem;
}

.config-item__sub {
    font-size: 0.8125rem;
    color: var(--text-light);
}

.config-item__actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

.config-item--category {
    align-items: center;
}

.category-config__details {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
}

.category-config__text {
    min-width: 0;
}

.category-icon-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.35rem;
}

.category-create-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.category-icon-button {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
}

.category-icon-button:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.category-icon-picker__summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #F8FAFC;
    margin-bottom: 1.25rem;
}

.category-icon-picker__preview {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.category-icon-picker__custom-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.category-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.category-icon-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.85rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text);
    font: inherit;
}

.category-icon-option:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.category-icon-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.category-icon-option__emoji {
    font-size: 1.6rem;
    line-height: 1;
}

.category-icon-option__label {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

kbd {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.35rem;
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    background: #F8FAFC;
    font-size: 0.75rem;
    font-family: inherit;
    line-height: 1.2;
}

@media (max-width: 720px) {
    .category-create-row,
    .category-icon-picker__custom-row {
        flex-direction: column;
        align-items: stretch;
    }

    .config-item--category {
        align-items: flex-start;
    }

    .config-item--category .config-item__actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

/* ---------- Utility classes ---------- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ---------- Responsive helpers ---------- */
@media (max-width: 600px) {
    .main-content { padding: 1rem; }
    .page-header h1 { font-size: 1.5rem; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .item-card {
        display: grid;
        grid-template-columns: 40px 1fr;
        grid-template-rows: auto auto;
        column-gap: 0.75rem;
        row-gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    .item-card__icon {
        grid-column: 1;
        grid-row: 1;
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        align-self: center;
    }
    .item-card__body {
        grid-column: 2;
        grid-row: 1;
        width: auto;
        flex: none;
        overflow: hidden;
        align-self: center;
    }
    .item-card__break { display: none; }
    .item-card__amount {
        grid-column: 2;
        grid-row: 2;
        justify-self: end;
    }
    .item-action-btn { display: inline-flex; width: 30px; height: 100%; padding: 0.25rem 0; }
}

/* ---------- Dark Mode Toggle ---------- */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.75rem;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.theme-toggle__track {
    position: relative;
    width: 40px;
    height: 22px;
    background: #334155;
    border-radius: 999px;
    transition: background var(--transition);
    flex-shrink: 0;
}

.theme-toggle__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle__thumb svg {
    width: 12px;
    height: 12px;
}

.theme-toggle input {
    display: none;
}

.theme-toggle input:checked + .theme-toggle__track {
    background: var(--primary);
}

.theme-toggle input:checked + .theme-toggle__track .theme-toggle__thumb {
    transform: translateX(18px);
}

/* ---------- Dark Mode Overrides ---------- */
[data-theme="dark"] .card__footer {
    background: #0F172A;
}

[data-theme="dark"] .item-card:hover {
    background: #273548;
}

[data-theme="dark"] .data-table th {
    background: #0F172A;
}

[data-theme="dark"] .data-table tr:hover td {
    background: #273548;
}

[data-theme="dark"] .recipe-card__header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
}

[data-theme="dark"] .recipe-fallback-card__raw {
    background: #0F172A;
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .alert-success { background: rgba(16, 185, 129, 0.15); color: #6EE7B7; border-color: rgba(16, 185, 129, 0.3); }
[data-theme="dark"] .alert-danger  { background: rgba(239, 68, 68, 0.15); color: #FCA5A5; border-color: rgba(239, 68, 68, 0.3); }
[data-theme="dark"] .alert-warning { background: rgba(245, 158, 11, 0.15); color: #FCD34D; border-color: rgba(245, 158, 11, 0.3); }
[data-theme="dark"] .alert-info    { background: rgba(99, 102, 241, 0.15); color: #A5B4FC; border-color: rgba(99, 102, 241, 0.3); }

[data-theme="dark"] .login-card {
    background: var(--card);
}

[data-theme="dark"] .badge-primary { background: rgba(99, 102, 241, 0.15); color: #A5B4FC; }
[data-theme="dark"] .badge-success { background: rgba(16, 185, 129, 0.15); color: #6EE7B7; }
[data-theme="dark"] .badge-warning { background: rgba(245, 158, 11, 0.15); color: #FCD34D; }
[data-theme="dark"] .badge-danger  { background: rgba(239, 68, 68, 0.15); color: #FCA5A5; }

[data-theme="dark"] .wizard__step.completed {
    background: rgba(16, 185, 129, 0.15);
    color: #6EE7B7;
    border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .recipe-card__freezer-tag {
    background: rgba(59, 130, 246, 0.2);
    color: #93C5FD;
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #0F172A;
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
}

@media (max-width: 768px) {
    .theme-toggle {
        padding: 0.75rem 1rem;
        margin-left: 0;
    }
}
