:root {
    --primary-slate: #0f172a;
    --dark-slate: #1e293b;
    --amber-brand: #f59e0b;
    --amber-hover: #d97706;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;
}

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

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8fafc;
    color: #0f172a;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

input, textarea, select {
    user-select: auto;
    -webkit-user-select: auto;
}

/* App Header */
.app-header {
    height: 52px;
    background-color: var(--primary-slate);
    width: 100%;
    max-width: 100%;
}

.brand-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.brand-logo-login {
    width: 64px;
    height: 64px;
    object-fit: contain;
    display: inline-block;
}

.brand-icon-sm {
    width: 28px;
    height: 28px;
    background-color: var(--amber-brand);
    color: #ffffff;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

/* Main Container Constraint with plenty of bottom space */
.max-w-container {
    width: 100%;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

main.max-w-container {
    padding-bottom: 95px !important; /* Prevents bottom items from hiding behind nav */
}

/* Segmented Filter Control (Apple style) */
.segmented-control {
    background-color: #e2e8f0;
    border-radius: 12px;
    padding: 3px;
    display: flex;
    gap: 2px;
    width: 100%;
    box-sizing: border-box;
}

.segmented-btn {
    flex: 1 1 0%;
    min-width: 0;
    text-align: center;
    padding: 7px 2px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    border-radius: 9px;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.segmented-btn.active {
    background-color: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.segmented-btn:active {
    transform: scale(0.98);
}

/* Horizontal Category Scroll */
.category-scroll {
    gap: 6px;
    max-width: 100%;
    box-sizing: border-box;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.cat-pill {
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 20px;
    white-space: nowrap;
    text-decoration: none;
    color: #475569;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.cat-pill.active {
    background-color: var(--primary-slate);
    color: #ffffff;
    border-color: var(--primary-slate);
}

/* Ultra-Clean Inventory Item Row */
.inventory-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.inventory-item {
    background-color: #ffffff;
    border-radius: 14px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    border: 1px solid #edf2f7;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Left colored accent indicator line */
.inventory-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
}

.inventory-item.item-critico::before {
    background-color: var(--danger-color);
}

.inventory-item.item-aviso::before {
    background-color: var(--warning-color);
}

.inventory-item.item-seguro::before {
    background-color: var(--success-color);
}

/* Left side of item: Product Info */
.item-left {
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-text {
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
}

.item-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.item-subtitle {
    font-size: 0.72rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin-top: 2px;
}

/* Status Dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot-critico {
    background-color: var(--danger-color);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.status-dot-aviso {
    background-color: var(--warning-color);
}

.status-dot-seguro {
    background-color: var(--success-color);
}

/* Stepper Controls - NEVER shrinks, ALWAYS fits inside card */
.stepper-container {
    flex: 0 0 auto !important;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stepper-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    transition: transform 0.1s ease, background-color 0.15s ease;
    touch-action: manipulation;
    flex-shrink: 0;
}

.stepper-btn-minus {
    background-color: #fee2e2;
    color: #dc2626;
}

.stepper-btn-plus {
    background-color: #dcfce7;
    color: #16a34a;
}

.stepper-btn:active {
    transform: scale(0.88);
}

.stepper-value {
    width: 52px;
    min-width: 52px;
    height: 38px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0 2px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.stepper-value:active {
    background-color: #e2e8f0;
}

.stepper-num {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}

.stepper-unit {
    font-size: 0.62rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1;
    margin-top: 1px;
}

/* Extra small devices (<= 340px) */
@media (max-width: 340px) {
    .stepper-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
    }
    .stepper-value {
        width: 46px;
        min-width: 46px;
        height: 34px;
    }
    .stepper-num {
        font-size: 0.95rem;
    }
    .inventory-item {
        padding: 6px 8px;
    }
}

/* Pulse animation on value update */
@keyframes qtyPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.18); color: var(--amber-brand); }
    100% { transform: scale(1); }
}

.qty-updated {
    animation: qtyPulse 0.25s ease-out;
}

/* Bottom Navigation */
.bottom-nav {
    height: 58px;
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    z-index: 1030;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.bottom-nav-inner {
    height: 100%;
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0;
}

.nav-item-mobile {
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 25%;
    height: 100%;
    padding: 2px 0;
    margin: 0;
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-item-mobile.active {
    color: var(--amber-brand);
}

.nav-icon {
    font-size: 1.3rem;
    line-height: 1;
    margin-bottom: 2px;
}

.nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 2px;
}

/* Search Input */
.search-pill-input {
    border-radius: 20px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    padding-left: 36px;
    font-size: 0.85rem;
    height: 38px;
    width: 100%;
    box-sizing: border-box;
}

.search-icon-pos {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
}

.extra-small {
    font-size: 0.75rem;
}

.cursor-pointer {
    cursor: pointer;
}

.bg-amber {
    background-color: var(--amber-brand) !important;
}

.bg-amber-subtle {
    background-color: #fef3c7 !important;
}

.item-checked .item-title {
    text-decoration: line-through;
    color: #94a3b8 !important;
}

.item-checked {
    opacity: 0.7;
}

.check-shopping-item {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
}
