/* ============================================================
   HOME INVENTORY — Try Swiss Knife
   Follows TSK design system & canonical patterns from class-timetable
   ============================================================ */

:root {
    --color-primary: #003d5c;
    --color-accent: #00a8e8;
    --color-accent-hover: #0096c7;
    --color-white: #ffffff;
    --color-background: #f5f7fa;
    --color-border: #e0e6ed;
    --color-text-dark: #1a1a2e;
    --color-text-medium: #555f6d;
    --color-text-light: #8a95a3;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-danger-light: #fef2f2;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.09);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.13);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

body {
    font-family: var(--font);
    background: linear-gradient(160deg, #f0f4f8 0%, #e2e8f0 100%);
    min-height: 100vh;
    color: var(--color-text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ─── SEO H1 ─── */
.seo-h1 {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* ─── Container ─── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem 56px;
}

/* ═══════════════════════════════════════════
   HEADER
═══════════════════════════════════════════ */
.header {
    width: 100%;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
}
.header-logo-link:hover { opacity: 0.85; }

.logo-image {
    width: 85px;
    height: 85px;
    object-fit: contain;
    display: block;
}

.tool-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a2332;
    white-space: nowrap;
    line-height: 1.2;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}

.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--color-text-medium);
    font-family: inherit;
}
.header-icon-btn:hover {
    border-color: var(--color-accent);
    background: var(--color-background);
    color: var(--color-accent);
}
.header-icon-btn svg { width: 20px; height: 20px; }

.lang-short {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-dark);
    letter-spacing: 0.02em;
}
.header-icon-btn:hover .lang-short { color: var(--color-accent); }

/* ─── Language Selector ─── */
.language-selector { position: relative; }

.language-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 140px;
    z-index: 1100;
    overflow: hidden;
}
.language-dropdown.active { display: block; }

.lang-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--color-text-dark);
    transition: background 0.15s;
    font-family: inherit;
}
.lang-option:hover { background: var(--color-background); }
.lang-option.active { background: rgba(0,168,232,0.08); color: var(--color-accent); }
.lang-check { font-size: 0.75rem; opacity: 0; transition: opacity 0.15s; }
.lang-option.active .lang-check { opacity: 1; }

/* ─── Site Row (below search bar) ─── */
.site-row {
    display: flex;
    align-items: center;
    margin: 10px 0 4px;
}

/* ─── Site Switcher ─── */
.site-switcher-wrapper { position: relative; }

.site-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    background: rgba(0,168,232,0.06);
    border: 1.5px solid rgba(0,168,232,0.25);
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-dark);
    transition: all 0.2s;
}
.site-switcher-btn:hover {
    background: rgba(0,168,232,0.12);
    border-color: var(--color-accent);
    color: var(--color-accent);
}
.site-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}
.site-icon { font-size: 0.9rem; flex-shrink: 0; }
.site-caret { font-size: 0.65rem; color: var(--color-text-light); flex-shrink: 0; }

.site-switcher-dropdown {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    max-width: 280px;
    z-index: 1100;
    overflow: hidden;
}
.site-switcher-dropdown.active { display: block; }

.site-switcher-list {
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
}

.site-option {
    display: flex;
    align-items: center;
    transition: background 0.15s;
}
.site-option:hover { background: var(--color-background); }
.site-option.active { background: rgba(0,168,232,0.08); }
.site-option.active .site-option-name { color: var(--color-accent); font-weight: 600; }

.site-option-name {
    flex: 1;
    min-width: 0;
    padding: 0.65rem 0.5rem 0.65rem 1rem;
    font-size: 0.875rem;
    color: var(--color-text-dark);
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-edit-btn {
    background: none;
    border: none;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.site-option:hover .site-edit-btn { opacity: 0.6; }
.site-edit-btn:hover { opacity: 1 !important; }

.site-option-add {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--color-text-dark);
    font-family: inherit;
    transition: background 0.15s;
}
.site-option-add:hover { background: var(--color-background); }
.site-option-add {
    color: var(--color-accent);
    font-weight: 600;
    border-top: 1px solid var(--color-border);
}

/* ═══════════════════════════════════════════
   INFO BANNERS — full-width, edge-to-edge (matches counter)
═══════════════════════════════════════════ */
.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #e1f5fe 100%);
    border: 1.5px solid #4fc3f7;
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 12px 16px;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(79, 195, 247, 0.1);
}
.info-banner + .info-banner { border-top: none; }
.info-banner-mobile {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #6ee7b7;
}
.info-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.info-text {
    flex: 1;
    color: #01579b;
    font-size: 0.875rem;
    line-height: 1.5;
}
.info-banner-mobile .info-text { color: #065f46; }
.info-close {
    background: none;
    border: none;
    color: #01579b;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 1px;
    font-family: inherit;
    transition: all 0.2s;
}
.info-close:hover { background: rgba(1, 87, 155, 0.12); color: #004d7a; }
.info-banner-mobile .info-close { color: #065f46; }
.info-banner-mobile .info-close:hover { background: rgba(6, 95, 70, 0.12); color: #064e3b; }

/* ═══════════════════════════════════════════
   SEARCH BAR
═══════════════════════════════════════════ */
.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin: 16px 0 0;
    background: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-sm);
}
.search-bar-wrapper:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0,168,232,0.12);
}
.search-icon {
    padding: 0 12px;
    font-size: 1rem;
    flex-shrink: 0;
    color: var(--color-text-light);
}
.search-input {
    flex: 1;
    height: 48px;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font);
    font-size: 1rem;
    color: var(--color-text-dark);
}
.search-input::placeholder { color: var(--color-text-light); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--color-text-light);
    padding: 0 14px;
    height: 100%;
    font-family: inherit;
    transition: color 0.15s;
}
.search-clear-btn:hover { color: var(--color-text-dark); }
.search-hint {
    font-size: 0.78rem;
    color: var(--color-text-light);
    margin: 6px 0 0 4px;
    font-style: italic;
}

/* ═══════════════════════════════════════════
   ONBOARDING
═══════════════════════════════════════════ */
.onboarding {
    text-align: center;
    padding: 4rem 2rem;
}
.onboarding-icon { font-size: 4rem; margin-bottom: 1rem; }
.onboarding-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: 0.5rem;
}
.onboarding-hint {
    font-size: 0.9rem;
    color: var(--color-text-medium);
    margin-bottom: 1.5rem;
}

/* ═══════════════════════════════════════════
   SEARCH RESULTS
═══════════════════════════════════════════ */
.search-results { margin-top: 16px; }

.search-result-item {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-result-item:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-sm);
}
.result-name {
    font-weight: 600;
    color: var(--color-text-dark);
    font-size: 0.95rem;
    margin-bottom: 3px;
}
.result-name mark {
    background: rgba(0,168,232,0.18);
    color: var(--color-primary);
    border-radius: 2px;
    padding: 0 1px;
}
.result-breadcrumb {
    font-size: 0.8rem;
    color: var(--color-text-medium);
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-medium);
    font-size: 0.95rem;
}

/* ═══════════════════════════════════════════
   BROWSE VIEW — AREA CARDS GRID
═══════════════════════════════════════════ */
.browse-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    align-items: start;
    margin-top: 14px;
}

.area-card {
    background: var(--color-white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    transition: box-shadow 0.2s, transform 0.2s;
}
.area-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

/* ─── Coloured header ─── */
.area-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 12px 12px;
    cursor: pointer;
    user-select: none;
}

.area-header-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.area-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1;
}

.area-name {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.area-meta {
    font-size: 0.72rem;
    opacity: 0.65;
    white-space: nowrap;
}

.area-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    margin-top: -2px;
}

/* Buttons on coloured header — all same size, neutral style */
.area-header .icon-btn,
.area-header .icon-btn-add {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    color: rgba(0,0,0,0.45);
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(0,0,0,0.1);
}
.area-header .icon-btn:hover,
.area-header .icon-btn-add:hover {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.85) !important;
    color: rgba(0,0,0,0.7) !important;
    border-color: rgba(0,0,0,0.18) !important;
    transform: none;
    box-shadow: none;
}

/* ─── 8-colour palette ─── */
.area-color-0 .area-header { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.area-color-0 .area-name   { color: #1e40af; }

.area-color-1 .area-header { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }
.area-color-1 .area-name   { color: #5b21b6; }

.area-color-2 .area-header { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }
.area-color-2 .area-name   { color: #065f46; }

.area-color-3 .area-header { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.area-color-3 .area-name   { color: #92400e; }

.area-color-4 .area-header { background: linear-gradient(135deg, #ffe4e6, #fecdd3); }
.area-color-4 .area-name   { color: #9f1239; }

.area-color-5 .area-header { background: linear-gradient(135deg, #cffafe, #a5f3fc); }
.area-color-5 .area-name   { color: #155e75; }

.area-color-6 .area-header { background: linear-gradient(135deg, #ffedd5, #fed7aa); }
.area-color-6 .area-name   { color: #9a3412; }

.area-color-7 .area-header { background: linear-gradient(135deg, #fae8ff, #f0abfc); }
.area-color-7 .area-name   { color: #86198f; }

.expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--color-text-light);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    font-family: inherit;
}
.expand-btn:hover {
    color: var(--color-accent);
    background: rgba(0,168,232,0.08);
}

/* ─── Section blocks ─── */
.area-body { border-top: 1.5px solid rgba(0,0,0,0.06); }

.section-block {
    border-bottom: 1px solid var(--color-border);
}
.section-block:last-child { border-bottom: none; }

.section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px 9px 28px;
    min-height: 44px;
}

.section-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
    opacity: 0.6;
}

.section-name {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--color-text-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-meta {
    font-size: 0.72rem;
    color: var(--color-text-light);
    background: var(--color-background);
    border-radius: 10px;
    padding: 2px 7px;
    flex-shrink: 0;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.expand-btn-sm {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
}

/* ─── Item rows ─── */
.section-body { padding: 4px 0 8px 0; }

.item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 78px;
    min-height: 36px;
    transition: background 0.12s;
    border-radius: var(--radius-sm);
}
.item-row:hover { background: rgba(0,0,0,0.025); }

.item-bullet {
    color: var(--color-accent);
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}
.item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.item-name {
    font-size: 0.88rem;
    color: var(--color-text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item-desc {
    font-size: 0.78rem;
    color: var(--color-text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item-qty {
    font-size: 0.72rem;
    font-weight: 500;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
.item-row.highlight {
    background: rgba(0,168,232,0.12);
    border-radius: var(--radius-sm);
    animation: pulse-highlight 2s ease forwards;
}

@keyframes pulse-highlight {
    0% { background: rgba(0,168,232,0.25); }
    100% { background: transparent; }
}

/* ─── Drag and drop ─── */
.item-drag-handle {
    font-size: 0.75rem;
    color: var(--color-border);
    cursor: grab;
    flex-shrink: 0;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
    user-select: none;
}
.item-row:hover .item-drag-handle { opacity: 1; }
.item-row[draggable="true"] { cursor: default; }
.item-row.dragging {
    opacity: 0.35;
    cursor: grabbing;
}
.section-block.drag-over {
    outline: 2px dashed var(--color-accent);
    outline-offset: -2px;
    background: rgba(0, 168, 232, 0.04);
    border-radius: var(--radius-md);
}

/* ─── Move item modal — item name display ─── */
.move-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text-dark);
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-bottom: 4px;
}

/* ─── Add inline button ─── */
.add-inline-btn {
    display: block;
    width: calc(100% - 92px);
    margin: 4px 14px 4px 78px;
    padding: 5px 8px;
    background: none;
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.82rem;
    color: var(--color-text-light);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, color 0.15s;
}
.add-inline-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* ─── Empty inline state ─── */
.empty-inline {
    padding: 8px 14px 8px 78px;
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-style: italic;
}

/* ─── Icon buttons (+ and ⋮) ─── */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--color-text-light);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    font-family: inherit;
    flex-shrink: 0;
}
.icon-btn:hover {
    color: var(--color-accent);
    background: rgba(0,168,232,0.08);
}
.icon-btn-sm {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
}

/* ─── Prominent + add button (area and section level) ─── */
.icon-btn-add {
    color: var(--color-accent);
    background: rgba(0,168,232,0.1);
    border: 1.5px solid rgba(0,168,232,0.3);
    font-weight: 700;
}
.icon-btn-add:hover {
    background: var(--color-accent) !important;
    color: #fff !important;
    border-color: var(--color-accent) !important;
}

/* ─── Add Area dashed button — spans all grid columns ─── */
.add-area-btn {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 10px 14px;
    background: none;
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text-light);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.add-area-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: rgba(0,168,232,0.04);
}

/* ─── Empty state ─── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}
.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-text {
    font-size: 0.95rem;
    color: var(--color-text-medium);
    margin-bottom: 1.25rem;
}

/* ═══════════════════════════════════════════
   KEBAB CONTEXT MENU
═══════════════════════════════════════════ */
.kebab-menu {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 140px;
    overflow: hidden;
}
.kebab-item {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    background: none;
    border: none;
    font-family: var(--font);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    color: var(--color-text-dark);
    transition: background 0.15s;
}
.kebab-item:hover { background: var(--color-background); }
.kebab-item-danger { color: var(--color-error); }
.kebab-item-danger:hover { background: var(--color-danger-light); }

/* ═══════════════════════════════════════════
   BOTTOM STATS BAR (matches counter's footer-stats)
═══════════════════════════════════════════ */
.stats-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-white);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 900;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.stat-block {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 20px;
    border-right: 1px solid var(--color-border);
}
.stat-block:last-child { border-right: none; }

.stat-icon { font-size: 0.9rem; }
.stat-num {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-dark);
    line-height: 1;
}
.stat-label {
    font-size: 0.7rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ═══════════════════════════════════════════
   MENU BUTTON
═══════════════════════════════════════════ */
.menu-btn {
    background: none;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: 40px;
    width: 40px;
    justify-content: center;
}
.menu-btn:hover {
    border-color: #00a8e8;
    background-color: #f7fafc;
    color: #1a2332;
}

/* ═══════════════════════════════════════════
   MENU OVERLAY
═══════════════════════════════════════════ */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-content {
    position: absolute;
    top: 100px;
    right: max(calc((100vw - 1200px) / 2 + 1.5rem), 1.5rem);
    transform: scale(0.9);
    transform-origin: top right;
    background: var(--color-white);
    border-radius: 16px;
    padding: 20px 24px 24px;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
}
.menu-overlay.active .menu-content {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 600px) {
    .menu-content {
        top: 50%;
        right: 50%;
        transform: translate(50%, -50%) scale(0.9);
        transform-origin: center;
        width: 92%;
        max-width: 360px;
    }
    .menu-overlay.active .menu-content {
        transform: translate(50%, -50%) scale(1);
    }
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 8px;
}
.menu-header h3 { margin: 0; color: var(--color-text); font-size: 1.1rem; }

.close-menu {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 1.25rem;
    color: #64748b;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.15s;
}
.close-menu:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

.menu-action {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    color: var(--color-text);
    font-weight: 500;
    text-align: left;
    font-family: inherit;
}
.menu-action:hover {
    background: #ffffff;
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.action-icon { font-size: 1.5rem; flex-shrink: 0; }
.action-content { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.action-hint { font-size: 0.75rem; color: #94a3b8; font-weight: 400; font-style: italic; }

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.btn-primary {
    background: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
}
.btn-outline {
    background: var(--color-white);
    color: var(--color-text-dark);
    border-color: var(--color-border);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--color-accent);
    color: var(--color-accent);
}
.btn-danger {
    background: var(--color-error);
    color: var(--color-white);
    border-color: var(--color-error);
}
.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
}
.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
}

/* ═══════════════════════════════════════════
   MODALS
═══════════════════════════════════════════ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal.hidden { display: none; }

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

.modal-content {
    position: relative;
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}
.modal-content-sm { max-width: 360px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-dark);
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-light);
    padding: 0 4px;
    font-family: inherit;
    transition: color 0.15s;
}
.modal-close:hover { color: var(--color-text-dark); }

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 1.25rem;
}

.confirm-msg {
    font-size: 0.95rem;
    color: var(--color-text-dark);
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

/* ─── Add Modal — type row ─── */
.add-type-row {
    display: flex;
    gap: 6px;
    margin-bottom: 1rem;
}
.add-type-btn {
    flex: 1;
    padding: 0.45rem 0.25rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-white);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-text-medium);
    transition: all 0.15s;
    text-align: center;
}
.add-type-btn:hover:not(:disabled) {
    border-color: var(--color-accent);
    color: var(--color-accent);
}
.add-type-btn.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-white);
}
.add-type-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ─── Form elements ─── */
.form-group { margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-medium);
    margin-bottom: 6px;
}
.form-input, .form-select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--color-text-dark);
    background: var(--color-white);
    transition: border-color 0.2s;
    outline: none;
}
.form-input:focus, .form-select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0,168,232,0.12);
}
.form-select { cursor: pointer; appearance: auto; }

/* ─── Item extras section ─── */
.item-extras {
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
    padding-top: 12px;
}
.item-extras .form-group:last-child { margin-bottom: 0; }

.field-optional {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--color-text-light);
    margin-left: 6px;
    font-style: italic;
}

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 120px; /* above stats bar + FAB */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--color-text-dark);
    color: var(--color-white);
    padding: 0.55rem 1.25rem;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    white-space: nowrap;
}
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--color-error); }
.toast-success { background: #15803d; }

/* ═══════════════════════════════════════════
   ABOUT / SEO SECTION — full-width, edge-to-edge (matches counter)
═══════════════════════════════════════════ */
.about-section { margin-bottom: 0; }

.about-toggle {
    width: 100%;
    background: linear-gradient(135deg, #e3f2fd 0%, #e1f5fe 100%);
    border: 1.5px solid #4fc3f7;
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 600;
    color: #01579b;
    text-align: left;
}
.about-toggle:hover {
    background: linear-gradient(135deg, #bbdefb 0%, #b3e5fc 100%);
    border-color: #00a8e8;
}
.about-toggle[aria-expanded="true"] .toggle-icon { transform: rotate(180deg); }
.about-icon { font-size: 1.1rem; flex-shrink: 0; }
.about-title { flex: 1; }
.toggle-icon { font-size: 0.875rem; transition: transform 0.3s; flex-shrink: 0; }

@keyframes aboutSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.about-content {
    background: var(--color-white);
    border: 1.5px solid #e3f2fd;
    border-top: none;
    padding: 28px 24px;
    animation: aboutSlideDown 0.3s ease;
}
.about-content h2 {
    color: var(--color-primary);
    font-size: 1.25rem;
    margin-bottom: 20px;
    line-height: 1.4;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 10px;
}
.about-content h3 {
    color: var(--color-text-dark);
    font-size: 1rem;
    margin-top: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}
.about-content p { font-size: 0.9rem; color: var(--color-text-medium); margin-bottom: 0.5rem; }
.about-content ul, .about-content ol {
    margin: 12px 0;
    padding-left: 22px;
}
.about-content li { margin-bottom: 8px; line-height: 1.6; color: var(--color-text-dark); }
.about-content strong { color: var(--color-text-dark); }

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-bottom: 24px;
}
.how-to-steps { counter-reset: step-counter; list-style: none; padding-left: 0; }
.how-to-steps li {
    counter-increment: step-counter;
    margin-bottom: 18px;
    padding-left: 44px;
    position: relative;
}
.how-to-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0; top: 0;
    background: var(--color-accent);
    color: white;
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}
.how-to-steps li strong { display: block; margin-bottom: 4px; color: var(--color-text-dark); }
.how-to-steps li p { margin: 0; line-height: 1.6; color: var(--color-text-medium); }

.features-section {
    background: var(--color-background);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 12px;
}
.feature-item {
    background: var(--color-white);
    padding: 14px;
    border-radius: 8px;
    border-left: 3px solid var(--color-accent);
}
.feature-item strong { display: block; font-size: 0.9rem; margin-bottom: 5px; color: var(--color-text-dark); }
.feature-item p { font-size: 0.85rem; line-height: 1.5; color: var(--color-text-medium); margin: 0; }

.use-cases-section { margin-top: 20px; }
.use-cases-section ul { margin-top: 12px; padding-left: 22px; }
.use-cases-section li { margin-bottom: 8px; line-height: 1.6; }

/* ═══════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════ */
.app-footer {
    text-align: center;
    padding: 2rem 0 0.5rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
    line-height: 2;
}
.footer-link {
    color: var(--color-text-medium);
    text-decoration: none;
    transition: color 0.15s;
}
.footer-link:hover { color: var(--color-accent); }
.footer-separator { margin: 0 6px; color: var(--color-border); }
.version-badge {
    background: none;
    border: none;
    font-size: 0.8rem;
    color: var(--color-text-light);
    cursor: pointer;
    font-family: var(--font);
    padding: 0;
    transition: color 0.15s;
}
.version-badge:hover { color: var(--color-accent); }

/* ═══════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════ */
.hidden { display: none !important; }

/* ═══════════════════════════════════════════
   RESPONSIVE (breakpoints match counter)
═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .about-grid { grid-template-columns: 1fr; gap: 16px; }
    .about-content { padding: 20px 16px; }
    .features-grid { grid-template-columns: 1fr; }
    .about-toggle { font-size: 0.875rem; padding: 12px 16px; }
    .tool-name {
        white-space: normal;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        line-height: 1.15;
    }
    .tool-name-eyebrow {
        font-size: 0.85rem;
        font-weight: 600;
        color: #1a2332;
        line-height: 1.3;
        transition: color 0.15s;
    }
}

@media (max-width: 480px) {
    .browse-view { grid-template-columns: 1fr; }
    .header-inner { padding: 0.5rem 1rem; }
    .logo-image { width: 60px; height: 60px; }
    .header-icon-btn { width: 36px; height: 36px; }
    .container { padding: 0.5rem 1rem 56px; }

    .modal-content { padding: 1.25rem; border-radius: var(--radius-lg); }
    .add-type-row { gap: 4px; }
    .add-type-btn { font-size: 0.72rem; padding: 0.4rem 0.15rem; }

    .item-row { padding-left: 64px; }
    .section-header { padding-left: 24px; }
    .add-inline-btn { margin-left: 64px; width: calc(100% - 78px); }
    .empty-inline { padding-left: 64px; }
}
