/* ═══════════════════════════════════════════════
   Mise — Design System v2
   Theme: Sharp, Direct, No-Nonsense
   Font: Outfit (Google Fonts)
   ═══════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────── */
:root {
    /* Brand greens */
    --ims-900: #0D2420;
    --ims-800: #162E28;
    --ims-700: #1F3E36;
    --ims-600: #276458;
    --ims-500: #2A7A6C;
    --ims-400: #3A9485;
    --ims-300: #6BBFB2;
    --ims-200: #B2DDD8;
    --ims-100: #DFF0EE;
    --ims-50:  #F0F8F7;

    /* Surfaces */
    --ims-bg:      #F3F6F5;
    --ims-surface: #FDFDFD;
    --ims-border:  #DDE8E5;
    --ims-text:    #182825;
    --ims-muted:   #5D726E;

    /* Sidebar */
    --nav-bg:          #162E28;
    --nav-text:        rgba(255,255,255,0.62);
    --nav-hover:       rgba(255,255,255,0.07);
    --nav-active-bg:   rgba(255,255,255,0.13);
    --nav-active-text: #FFFFFF;
    --nav-accent:      #5BC4B5;
    --nav-section:     rgba(255,255,255,0.28);
    --nav-divider:     rgba(255,255,255,0.1);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.04);
    --shadow:    0 2px 8px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.09), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.11), 0 3px 10px rgba(0,0,0,0.06);

    /* Radius */
    --r-sm: 6px;
    --r:    10px;
    --r-lg: 14px;
    --r-xl: 20px;

    /* Bootstrap overrides */
    --bs-primary:            #2A7A6C;
    --bs-primary-rgb:        42, 122, 108;
    --bs-body-bg:            #F3F6F5;
    --bs-body-color:         #182825;
    --bs-border-color:       #DDE8E5;
    --bs-border-radius:      10px;
    --bs-border-radius-sm:   6px;
    --bs-border-radius-lg:   14px;
    --bs-card-border-color:  #DDE8E5;
    --bs-font-sans-serif:    'Outfit', system-ui, sans-serif;
    --bs-body-font-family:   'Outfit', system-ui, sans-serif;
    --bs-body-line-height:   1.6;
    --bs-link-color:         #2A7A6C;
    --bs-link-hover-color:   #1E5C51;
}

/* ── Base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Outfit', system-ui, sans-serif;
    background: var(--ims-bg);
    color: var(--ims-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', system-ui, sans-serif;
    font-weight: 600;
    color: var(--ims-text);
    letter-spacing: -0.02em;
}

a { color: var(--ims-500); }
a:hover { color: var(--ims-600); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C0D4D1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #95B5B1; }

/* ── Layout Shell ────────────────────────────── */
.sidebar {
    width: 232px;
    min-width: 232px;
    background: var(--nav-bg);
    border-right: none;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.875rem 1rem;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar .navbar-brand {
    font-size: 1rem;
    font-weight: 700;
    color: #FDFDFD;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.125rem 0.5rem 0.25rem;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}
.sidebar .navbar-brand i {
    font-size: 1.25rem;
    color: var(--nav-accent);
}

/* ── Nav Links ───────────────────────────────── */
.nav-link {
    color: var(--nav-text);
    border-radius: var(--r-sm);
    padding: 0.46rem 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: background 0.14s, color 0.14s;
    gap: 0.5rem;
}
.nav-link i { width: 1.05rem; text-align: center; flex-shrink: 0; font-size: 0.9375rem; }
.nav-link:hover { background: var(--nav-hover); color: rgba(255,255,255,0.9); }
.nav-link.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
    font-weight: 600;
}
.nav-link.active i { color: var(--nav-accent); }
.nav-link.disabled,
.nav-link.disabled:hover {
    color: rgba(255,255,255,0.22);
    background: transparent;
    cursor: default;
}
.nav-link .me-2 { margin-right: 0 !important; }

.nav-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--nav-section);
    padding: 0 0.625rem;
    margin: 0.625rem 0 0.125rem;
}

.sidebar hr {
    border-color: var(--nav-divider);
    margin: 0.5rem 0;
    opacity: 1;
}

/* ── Nav User Footer ─────────────────────────── */
.nav-user {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--nav-divider);
}
.nav-user-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.4375rem 0.625rem;
    text-decoration: none;
    border-radius: var(--r-sm);
    transition: background 0.14s;
    margin-bottom: 0.375rem;
}
.nav-user-info:hover { background: var(--nav-hover); }
.nav-user-info small { color: var(--nav-text); font-size: 0.8125rem; line-height: 1.3; }

.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--nav-accent);
    color: var(--nav-bg);
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}

.btn-signout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4375rem;
    width: 100%;
    padding: 0.4375rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: 'Outfit', system-ui, sans-serif;
    color: var(--nav-text);
    background: transparent;
    border: 1px solid var(--nav-divider);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.btn-signout:hover {
    background: rgba(220,53,69,0.14);
    color: #ff8f8f;
    border-color: rgba(220,53,69,0.28);
}

/* ── Mobile Topbar ───────────────────────────── */
.mobile-topbar {
    background: var(--nav-bg);
    padding: 0.625rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.mobile-topbar .topbar-brand {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #FDFDFD;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: -0.02em;
}
.mobile-topbar .topbar-brand i { color: var(--nav-accent); }
.btn-nav-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.75);
    border-radius: var(--r-sm);
    padding: 0.375rem 0.625rem;
    line-height: 1;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.14s, color 0.14s;
}
.btn-nav-toggle:hover { background: var(--nav-hover); color: #FDFDFD; }

.offcanvas-start { background: var(--nav-bg); }
.offcanvas-header { border-bottom: 1px solid var(--nav-divider); padding: 1rem 0.875rem; }
.offcanvas-title { color: #FDFDFD; font-weight: 700; font-size: 0.9375rem; letter-spacing: -0.01em; }
.offcanvas-title i { color: var(--nav-accent); }
.offcanvas .btn-close { filter: invert(1) brightness(0.7); }

/* ── Main Content ────────────────────────────── */
main { background: var(--ims-bg); }

/* ── Cards ───────────────────────────────────── */
.card {
    background: var(--ims-surface);
    border: 1px solid var(--ims-border);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--ims-border);
    padding: 0.875rem 1rem;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--ims-text);
}
.card-body { padding: 1rem; }
.card-footer {
    background: transparent;
    border-top: 1px solid var(--ims-border);
    padding: 0.75rem 1rem;
}

/* ── Page Headers ────────────────────────────── */
.ims-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.ims-page-header h4,
.ims-page-title {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}
.ims-page-title { margin-bottom: 1.5rem; }

.ims-back-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1.375rem;
    flex-wrap: wrap;
    justify-content: space-between;
}
.ims-back-header-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

/* ── Buttons ─────────────────────────────────── */
.btn {
    font-weight: 500;
    font-family: 'Outfit', system-ui, sans-serif;
    border-radius: var(--r-sm);
    letter-spacing: -0.01em;
    transition: all 0.14s;
}
.btn-primary {
    background: var(--ims-500);
    border-color: var(--ims-500);
    color: #FDFDFD;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--ims-600);
    border-color: var(--ims-600);
    color: #FDFDFD;
}
.btn-primary:disabled { background: var(--ims-300); border-color: var(--ims-300); }
.btn-outline-primary {
    color: var(--ims-500);
    border-color: var(--ims-500);
}
.btn-outline-primary:hover {
    background: var(--ims-500);
    border-color: var(--ims-500);
    color: #FDFDFD;
}
.btn-outline-secondary {
    color: var(--ims-muted);
    border-color: var(--ims-border);
    background: var(--ims-surface);
}
.btn-outline-secondary:hover {
    background: var(--ims-50);
    border-color: #c0d0cd;
    color: var(--ims-text);
}
.btn-success { background: #059669; border-color: #059669; color: #FDFDFD; }
.btn-success:hover { background: #047857; border-color: #047857; color: #FDFDFD; }
.btn-sm { font-size: 0.8125rem; padding: 0.3125rem 0.75rem; }

/* ── Forms ───────────────────────────────────── */
.form-control, .form-select {
    border-color: var(--ims-border);
    border-radius: var(--r-sm);
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 0.9375rem;
    color: var(--ims-text);
    background-color: var(--ims-surface);
    transition: border-color 0.14s, box-shadow 0.14s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--ims-400);
    box-shadow: 0 0 0 3px rgba(42,122,108,0.12);
    outline: none;
    background-color: var(--ims-surface);
}
.form-control::placeholder { color: #9BB5B1; }
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ims-text);
    margin-bottom: 0.3125rem;
}
.form-text { font-size: 0.8125rem; color: var(--ims-muted); }
.form-check-input:checked { background-color: var(--ims-500); border-color: var(--ims-500); }

.valid.modified:not([type=checkbox]) { border-color: #059669; outline: none; box-shadow: none; }
.invalid { border-color: #DC3545 !important; outline: none; box-shadow: none; }
.validation-message { color: #DC3545; font-size: 0.8125rem; margin-top: 0.25rem; display: block; }

/* ── Tables ──────────────────────────────────── */
.table { color: var(--ims-text); font-size: 0.9rem; }
.table-hover > tbody > tr:hover > * { background-color: var(--ims-50); }
.table thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ims-muted);
    border-bottom-width: 1px;
    border-bottom-color: var(--ims-border);
    padding: 0.625rem 0.875rem;
    background: var(--ims-50);
    white-space: nowrap;
}
.table td { padding: 0.75rem 0.875rem; vertical-align: middle; border-color: var(--ims-border); }
.table-responsive { border-radius: var(--r); overflow: hidden; border: 1px solid var(--ims-border); box-shadow: var(--shadow-sm); }

/* ── Badges ──────────────────────────────────── */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    border-radius: 4px;
    padding: 0.25em 0.55em;
}
.bg-primary { background-color: var(--ims-500) !important; }

/* ── Alerts — full border, no side-stripe ────── */
.alert {
    border-radius: var(--r);
    font-size: 0.9rem;
    border: 1px solid;
    padding: 0.875rem 1rem;
}
.alert-danger  { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.alert-info    { background: var(--ims-50); border-color: var(--ims-200); color: var(--ims-600); }
.alert-success { background: #F0FDF4; border-color: #BBF7D0; color: #065F46; }
.alert-dismissible .btn-close { padding: 1rem; }

/* ── Spinner ─────────────────────────────────── */
.spinner-border { color: var(--ims-500) !important; }
.ims-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}

/* ── Empty States ────────────────────────────── */
.ims-empty {
    background: var(--ims-surface);
    border: 1px solid var(--ims-border);
    border-radius: var(--r-lg);
    padding: 3.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.ims-empty > i, .ims-empty > .display-3 {
    font-size: 2.75rem;
    color: var(--ims-muted);
    opacity: 0.35;
    margin-bottom: 1rem;
    display: block;
}
.ims-empty h5 { font-size: 1rem; margin-bottom: 0.375rem; }
.ims-empty p  { color: var(--ims-muted); font-size: 0.9rem; margin-bottom: 0; }

/* ── List Groups ─────────────────────────────── */
.list-group-item {
    border-color: var(--ims-border);
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    color: var(--ims-text);
}

/* ── Auth Pages ──────────────────────────────── */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 1rem;
}
.auth-card {
    background: var(--ims-surface);
    border: 1px solid var(--ims-border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem 2rem;
}
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo-icon {
    width: 52px;
    height: 52px;
    background: var(--ims-100);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--ims-500);
    margin-bottom: 0.875rem;
}
.auth-logo h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0;
}
.auth-logo p { color: var(--ims-muted); font-size: 0.875rem; margin: 0.25rem 0 0; }
.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--ims-muted);
}
.auth-footer a { color: var(--ims-500); font-weight: 500; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }
.auth-submit { margin-top: 0.25rem; }

/* ── Household Setup ─────────────────────────── */
.setup-page { max-width: 500px; margin: 0 auto; padding-top: 1rem; }
.setup-divider {
    text-align: center;
    color: var(--ims-muted);
    font-size: 0.875rem;
    position: relative;
    margin: 1.25rem 0;
}
.setup-divider::before, .setup-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: var(--ims-border);
}
.setup-divider::before { left: 0; }
.setup-divider::after  { right: 0; }

/* ── Section Headers ─────────────────────────── */
.ims-section-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ims-text);
    margin-bottom: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.ims-section-title i { color: var(--ims-muted); font-size: 1rem; }

/* ── Filter Bar ──────────────────────────────── */
.ims-filter-bar {
    background: var(--ims-surface);
    border: 1px solid var(--ims-border);
    border-radius: var(--r);
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-xs);
}

/* ── Category ─────────────────────────────────── */
.category-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    vertical-align: middle;
    flex-shrink: 0;
}
.category-color-strip {
    width: 3px;
    border-radius: 2px;
    align-self: stretch;
    flex-shrink: 0;
}

/* ── Log Date Header ─────────────────────────── */
.log-date-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ims-muted);
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--ims-border);
    margin-bottom: 0.625rem;
}

/* ── Summary Card ────────────────────────────── */
.ims-summary {
    background: var(--ims-50);
    border: 1px solid var(--ims-100);
    border-radius: var(--r);
    padding: 1rem 1.25rem;
}

/* ── Modal ───────────────────────────────────── */
.modal-content {
    border: 1px solid var(--ims-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom-color: var(--ims-border); padding: 1.125rem 1.25rem; }
.modal-footer { border-top-color: var(--ims-border); padding: 0.875rem 1.25rem; }
.modal-title { font-weight: 600; font-size: 1rem; }

/* ── Dashboard — Status Row ──────────────────── */
.ims-status-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
}
.ims-all-good {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: var(--r);
    color: #065F46;
    font-size: 0.9rem;
    font-weight: 500;
}
.ims-all-good i { color: #059669; font-size: 1rem; flex-shrink: 0; }
.ims-status-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--r);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: filter 0.14s;
}
.ims-status-alert:hover { filter: brightness(0.97); text-decoration: none; }
.ims-status-alert i { flex-shrink: 0; }
.ims-status-alert strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.ims-status-alert .ms-auto { margin-left: auto; opacity: 0.45; font-size: 0.875rem; }
.ims-status-warning {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    color: #92400E;
}
.ims-status-danger {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

/* ── Dashboard — Quick Actions ───────────────── */
.ims-quick-actions {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}
.ims-action-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    padding: 0.625rem 1.25rem;
    background: var(--ims-500);
    color: #FDFDFD;
    border-radius: var(--r);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    letter-spacing: -0.01em;
    transition: background 0.14s;
}
.ims-action-primary:hover { background: var(--ims-600); color: #FDFDFD; text-decoration: none; }
.ims-action-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    padding: 0.625rem 1.125rem;
    background: var(--ims-surface);
    color: var(--ims-text);
    border: 1px solid var(--ims-border);
    border-radius: var(--r);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    letter-spacing: -0.01em;
    transition: background 0.14s, border-color 0.14s;
}
.ims-action-secondary:hover {
    background: var(--ims-50);
    border-color: var(--ims-200);
    color: var(--ims-text);
    text-decoration: none;
}

/* ── Dashboard — Inventory Meta ──────────────── */
.ims-inventory-meta {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
    padding: 0.875rem 0;
    border-top: 1px solid var(--ims-border);
    border-bottom: 1px solid var(--ims-border);
    margin-bottom: 1.75rem;
}
.ims-meta-count {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--ims-text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.ims-meta-label {
    font-size: 0.875rem;
    color: var(--ims-muted);
    font-weight: 400;
}

/* ── Borderless List ──────────────────────────── */
.ims-list-section { margin-bottom: 1.75rem; }
.ims-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ims-muted);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--ims-border);
    margin-bottom: 0;
}
.ims-list-header a {
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--ims-500);
}
.ims-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--ims-border);
    gap: 1rem;
}
.ims-list-row:last-child { border-bottom: none; }
.ims-list-row-name {
    font-weight: 500;
    color: var(--ims-text);
    text-decoration: none;
    font-size: 0.9rem;
}
.ims-list-row-name:hover { color: var(--ims-500); text-decoration: none; }

/* ── Legacy stat cards ────────────────────────── */
.ims-stat-card {
    background: var(--ims-surface);
    border: 1px solid var(--ims-border);
    border-radius: var(--r-lg);
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    display: block;
    color: inherit;
    height: 100%;
    transition: box-shadow 0.14s;
}
.ims-stat-card:hover { box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.ims-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    margin: 0 auto 0.75rem;
}
.ims-stat-num {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.05em;
    margin-bottom: 0.3rem;
    font-variant-numeric: tabular-nums;
}
.ims-stat-label { font-size: 0.8125rem; font-weight: 500; color: var(--ims-muted); }

.stat-primary .ims-stat-icon  { background: var(--ims-100); color: var(--ims-500); }
.stat-primary .ims-stat-num   { color: var(--ims-500); }
.stat-warning .ims-stat-icon  { background: #FFF3CD; color: #D97706; }
.stat-warning .ims-stat-num   { color: #D97706; }
.stat-danger .ims-stat-icon   { background: #FDECEA; color: #DC3545; }
.stat-danger .ims-stat-num    { color: #DC3545; }
.stat-muted .ims-stat-icon    { background: var(--ims-50); color: var(--ims-muted); }
.stat-muted .ims-stat-num     { color: var(--ims-text); }

.ims-add-card {
    background: var(--ims-500);
    border: 1px solid var(--ims-500);
    border-radius: var(--r-lg);
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(42,122,108,0.28);
    transition: box-shadow 0.18s, background 0.18s;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #FDFDFD;
    height: 100%;
}
.ims-add-card:hover {
    background: var(--ims-600);
    box-shadow: 0 4px 18px rgba(42,122,108,0.38);
    color: #FDFDFD;
    text-decoration: none;
}
.ims-add-card .ims-stat-icon { background: rgba(255,255,255,0.18); color: #FDFDFD; margin-bottom: 0; }
.ims-add-card .ims-stat-label { color: rgba(255,255,255,0.75); }

/* ── Blazor internals ────────────────────────── */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

#blazor-error-ui {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #b32121;
    color: white;
    padding: .5rem 1rem;
    display: none;
    z-index: 9999;
}

/* ── Utility ─────────────────────────────────── */
.text-muted     { color: var(--ims-muted) !important; }
.fw-semibold    { font-weight: 600; }
.small          { font-size: 0.8125rem; }
.table-responsive { border-radius: var(--r); }

/* ── AI Surfaces ──────────────────────────────── */

/* Dashboard compact panel */
.ai-dash-panel {
    background: var(--ims-50);
    border: 1px solid var(--ims-border);
    border-radius: var(--r-lg);
    padding: 1rem;
    margin-top: 1.25rem;
}
.ai-dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.ai-dash-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ims-text);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.ai-dash-title .bi-stars { color: var(--ims-500); font-size: 0.9375rem; }
.ai-dash-link { font-size: 0.8125rem; color: var(--ims-500); text-decoration: none; }
.ai-dash-link:hover { text-decoration: underline; color: var(--ims-600); }
.ai-dash-loading {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--ims-muted);
    font-size: 0.875rem;
    padding: 0.25rem 0;
}
.ai-dash-empty { font-size: 0.875rem; color: var(--ims-muted); margin: 0; }
.ai-dash-footer {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.625rem;
    border-top: 1px solid var(--ims-border);
}
.ai-dash-footer .btn-link {
    font-size: 0.8125rem;
    color: var(--ims-muted);
    text-decoration: none;
}
.ai-dash-footer .btn-link:hover { color: var(--ims-500); }

/* Compact row (dashboard list) */
.ai-compact-list { display: flex; flex-direction: column; gap: 0.5rem; }
.ai-compact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--ims-border);
}
.ai-compact-list .ai-compact-row:last-child { border-bottom: none; padding-bottom: 0; }
.ai-compact-name { font-size: 0.875rem; font-weight: 500; color: var(--ims-text); }
.ai-compact-meta { display: flex; align-items: center; gap: 0.625rem; flex-shrink: 0; }
.ai-compact-time { font-size: 0.8125rem; color: var(--ims-muted); display: flex; align-items: center; gap: 0.25rem; }
.ai-compact-missing {
    font-size: 0.75rem;
    font-weight: 500;
    color: #92400E;
    background: #FFF3CD;
    padding: 0.125rem 0.5rem;
    border-radius: var(--r-sm);
}
.ai-compact-ready {
    font-size: 0.75rem;
    font-weight: 500;
    color: #065F46;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.ai-compact-ready .bi { color: #059669; }

/* Recipes page full panel */
.ai-recipe-panel {
    background: var(--ims-50);
    border: 1px solid var(--ims-border);
    border-radius: var(--r-lg);
    padding: 1rem 1.125rem;
    margin-bottom: 1.25rem;
}
.ai-recipe-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
}
.ai-recipe-panel-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ims-text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.ai-recipe-panel-title .bi-stars { color: var(--ims-500); }
.ai-refresh-btn { font-size: 0.8125rem; color: var(--ims-muted); text-decoration: none; }
.ai-refresh-btn:hover { color: var(--ims-500); }
.ai-recipe-loading {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--ims-muted);
    font-size: 0.875rem;
    padding: 0.5rem 0;
}
.ai-recipe-trigger { }
.ai-recipe-trigger-inputs,
.ai-recipe-refine {
    display: flex;
    gap: 0.625rem;
    align-items: center;
    flex-wrap: wrap;
}
.ai-pref-input { flex: 1; min-width: 200px; max-width: 420px; }
.ai-recipe-refine {
    margin-top: 0.875rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ims-border);
}

/* Full suggestion cards grid */
.ai-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.875rem;
    margin-top: 0.125rem;
}
@media (min-width: 768px) { .ai-cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .ai-cards-grid { grid-template-columns: repeat(3, 1fr); } }

/* Individual suggestion card */
.ai-card {
    background: var(--ims-surface);
    border: 1px solid var(--ims-border);
    border-radius: var(--r);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    transition: box-shadow 0.14s;
}
.ai-card:hover { box-shadow: var(--shadow); }

.ai-card-header { display: flex; flex-direction: column; gap: 0.4rem; }
.ai-card-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ims-text);
    margin: 0;
    line-height: 1.3;
}
.ai-card-chips { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.ai-chip {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ims-600);
    background: var(--ims-100);
    border-radius: var(--r-sm);
    padding: 0.2rem 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}
.ai-card-desc {
    font-size: 0.8125rem;
    color: var(--ims-muted);
    margin: 0;
    line-height: 1.5;
}

/* Ingredient grid */
.ai-ingredient-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 0.5rem;
}
@media (max-width: 480px) { .ai-ingredient-grid { grid-template-columns: 1fr; } }

.ai-ing {
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-ing .bi { flex-shrink: 0; font-size: 0.75rem; }
.ai-ing-qty { color: var(--ims-muted); font-size: 0.75rem; margin-left: 0.1rem; }

.ai-ing--have { color: var(--ims-600); }
.ai-ing--have .bi { color: var(--ims-500); }

.ai-ing--missing {
    color: #92400E;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.12s;
}
.ai-ing--missing .bi { color: #D97706; }
.ai-ing--missing:hover { color: #D97706; text-decoration: underline; }

.ai-missing-note {
    font-size: 0.75rem;
    color: #92400E;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.ai-missing-note .bi { color: #D97706; }

/* Steps */
.ai-steps-toggle {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ims-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.125rem;
    transition: color 0.12s;
}
.ai-steps-toggle:hover { color: var(--ims-600); }
.ai-steps {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.ai-steps li { font-size: 0.8125rem; color: var(--ims-text); line-height: 1.55; }

/* ── AI loading: skeleton shimmer ── */
@keyframes ai-shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}

.ai-skel {
    display: block;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        var(--ims-100) 0%,
        var(--ims-50)  50%,
        var(--ims-100) 100%
    );
    background-size: 300% 100%;
    animation: ai-shimmer 1.8s ease-in-out infinite;
}

/* Dashboard compact skeletons */
.ai-skel-list { display: flex; flex-direction: column; }
.ai-skel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--ims-border);
}
.ai-skel-row:last-child { border-bottom: none; padding-bottom: 0; }

/* Full card skeletons (recipes page) */
.ai-skel-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.875rem;
    margin-bottom: 0.25rem;
}
@media (min-width: 768px)  { .ai-skel-cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .ai-skel-cards-grid { grid-template-columns: repeat(3, 1fr); } }

.ai-skel-card {
    background: var(--ims-surface);
    border: 1px solid var(--ims-border);
    border-radius: var(--r);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}
/* Stagger shimmer phase so each card sweeps independently */
.ai-skel-card:nth-child(2) .ai-skel { animation-delay: -0.6s; }
.ai-skel-card:nth-child(3) .ai-skel { animation-delay: -1.2s; }

/* Rotating status message */
@keyframes ai-msg-in {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-status-msg {
    font-size: 0.8125rem;
    color: var(--ims-muted);
    margin: 0.75rem 0 0;
    animation: ai-msg-in 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Stars icon pulse while the AI is thinking */
@keyframes ai-stars-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}
.ai-stars-active { animation: ai-stars-pulse 2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
    .ai-skel         { animation: none; background: var(--ims-100); }
    .ai-stars-active { animation: none; }
    .ai-status-msg   { animation: none; }
}
