* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #dcdcdc;
    color: #1a1c19;
}

#back-cont {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

#backdrop {
    background: #000000aa;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 99997;
}

#drawr {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 360px;
    max-width: 88vw;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    padding: 1rem;
    z-index: 99998;
    background: #ffffff;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
}

#drawr-nav-cont {
    display: flex;
    flex-direction: column;
    width: 85%;
    gap: 0.25rem;
}

a.drawr-nav-link:first-child {
    border-top: 1px solid #e0e0e0;
}

a.drawr-nav-link,
button.drawer-btn-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.95rem 0.85rem;
    text-decoration: none;
    color: #1a1c19;
    background: transparent;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    text-align: right;
}

a.drawr-nav-link:hover,
button.drawer-btn-link:hover {
    background: #e6f4ea;
    color: #114d11;
}

#drawr-session-status {
    margin: 0 0 0.75rem 0;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: #e6f4ea;
    color: #114d11;
    font-size: 0.85rem;
    font-weight: 600;
}

#main-wrapper * {
    box-sizing: border-box;
}

#main-wrapper {
    display: flex;
    flex-direction: column;
    width: 78%;
    max-width: 1180px;
    min-height: 100vh;
    margin: auto;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.15);
    background: #f2f4f1;
}

#main-content {
    display: flex;
    flex-flow: column wrap;
    justify-content: flex-start;
    align-items: center;
    padding: 0.5rem 0.85rem;
    flex: 1;
}

/* Top Application Bar */
#head-cont {
    display: flex;
    padding: 0.75rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    background: #226d22;
    color: white;
    box-shadow: 0 2px 8px rgba(17, 77, 17, 0.35);
}

.head-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#brand-header-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: white;
    font-weight: 700;
    font-size: 1.15rem;
}

#brand-header-logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
}

.session-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.session-badge:hover {
    background: rgba(255, 255, 255, 0.28);
}

#head-cont a,
#nav-footer a,
#head-cont button {
    color: white;
}

/* iOS / Android Material You (M3) Bottom Navigation Bar */
#nav-footer {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    display: flex;
    width: 78%;
    max-width: 1180px;
    height: 72px;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    background: #1b571b;
    color: white;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 0.25rem 0.5rem;
}

.footer-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 0.35rem 0.6rem;
    gap: 0.2rem;
    flex: 1;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.75rem;
    font-weight: 600;
}

.footer-nav-link .nav-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 32px;
    border-radius: 999px;
    font-size: 1.35rem;
    transition: background-color 0.18s ease;
}

.footer-nav-link:hover .nav-pill,
.footer-nav-link.active .nav-pill {
    background: #a3f7b5;
    color: #0b3b0b;
}

.footer-nav-link:hover .nav-label,
.footer-nav-link.active .nav-label {
    color: #ffffff;
    font-weight: 700;
}

.nav-badge {
    position: absolute;
    top: -2px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ffb703;
    color: #1a1c19;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#footer-placeholder {
    height: 5.5rem;
}

img#drawr-ico {
    border-radius: 100%;
    max-width: 84px;
}

img#user-ico {
    border-radius: 100%;
    width: 24px;
    height: 24px;
    object-fit: cover;
}

#drawr-title {
    text-align: center;
    font-size: 1.35rem;
    margin: 0.5rem 0 0.25rem 0;
}

#drawr-subtitle {
    font-size: smaller;
}

#drawr-btn,
#drawr-back-btn {
    background: none;
    border: none;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#drawr-btn:hover,
#drawr-back-btn:hover {
    background: rgba(0, 0, 0, 0.18);
}

.vr {
    display: inline-flex;
    height: 26px;
    border-left: 1px solid #bbb;
}

#catalog-search-cont {
    display: flex;
    align-items: center;
    padding: 0.7rem 1.3rem;
    width: 94%;
}

#search-box-cont {
    display: flex;
    width: 100%;
    border: 1px solid #b5b5b5;
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#search-box-cont input#search-box {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    border: none;
    border-radius: 999px;
    flex-grow: 3;
    outline: none;
}

#catalog-top-bar {
    display: flex;
    width: 94%;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

#catalog-top-bar select#catalog-selection {
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    border: 1px solid #888;
    background: white;
}

#catalog-view-sel-cont {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

#catalog-view-sel-cont button {
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    border: 1px solid #888;
    background: white;
    cursor: pointer;
}

button#search-btn {
    border: none;
    background: none;
    color: #226d22;
    border-radius: 100%;
    width: 42px;
    height: 42px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-size: 1.2rem;
}

#catalog-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    width: 100%;
    gap: 0.85rem;
    padding: 0.5rem 0;
}

.catalog-card h1,
.catalog-card h2,
.catalog-card h3,
.catalog-card h4,
.catalog-card h5,
.catalog-card img {
    margin: 0;
    padding: 0;
}

.catalog-card hr {
    width: 85%;
    margin: 6px 0;
    border: none;
    border-top: 1px solid #e0e0e0;
}

.catalog-card {
    display: inline-flex;
    flex-flow: row wrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    border-radius: 20px;
    padding: 1rem;
    width: 264px;
    justify-content: space-evenly;
    align-items: center;
    background: white;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 1px solid transparent;
}

.catalog-card:hover,
.catalog-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(34, 109, 34, 0.22);
    border-color: #226d22;
}

.catalog-ico {
    width: 96px;
    height: 96px;
    border-radius: 14px;
    object-fit: contain;
}

.catalog-head-cont {
    width: 100%;
    text-align: center;
    margin-top: 0.35rem;
}

.catalog-itm-name {
    font-size: 1.2rem;
}

.catalog-body-cont {
    display: inline-flex;
    flex-flow: column wrap;
    width: 58%;
}

.catalog-foot-cont {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
}

.catalog-add-cont {
    display: inline-flex;
    width: 44px;
    height: 44px;
    justify-content: center;
    align-items: center;
    background: #226d22;
    color: white;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.catalog-add-cont:hover {
    background: #114d11;
    color: white;
    transform: scale(1.06);
}

p#error {
    font-family: 'Courier New', monospace;
    border: 1px solid grey;
    background: #eaeaea;
    color: black;
    padding: 1rem;
    max-width: 90%;
    overflow-x: auto;
}

#tight-wrapper {
    display: flex;
    max-width: 100vw;
    flex-flow: column wrap;
    align-items: center;
    justify-content: center;
}

/* Completed Views & Role Portals Layout */
.page-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 0.6rem;
    gap: 1rem;
}

.page-section-header {
    text-align: center;
    width: 100%;
}

.page-section-header h1 {
    margin: 0.25rem 0;
}

.page-subtitle {
    margin-top: 0;
    color: #444;
}

.auth-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    width: 100%;
}

.auth-grid > .panel-card {
    flex: 1 1 380px;
    max-width: 520px;
}

.hero-card,
.panel-card,
.detail-card {
    display: flex;
    flex-direction: column;
    width: 94%;
    background: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    padding: 1.25rem;
    gap: 0.75rem;
}

.hero-card {
    align-items: center;
    text-align: center;
}

.detail-card {
    flex-flow: row wrap;
    justify-content: space-evenly;
    align-items: center;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 520px;
}

.section-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.combo-showcase-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    width: 100%;
    gap: 0.85rem;
}

.category-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    background: #226d22;
    color: white;
    text-decoration: none;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

a.category-pill:hover {
    background: #114d11;
    color: white;
}

#catalog-grid.list-view {
    flex-direction: column;
    align-items: center;
    width: 94%;
}

#catalog-grid.list-view .catalog-card {
    width: 100%;
    max-width: 100%;
    justify-content: space-between;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-top: 0.4rem;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.6rem 1.05rem;
    border-radius: 12px;
    border: 1px solid #226d22;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
}

.btn-primary {
    background: #226d22;
    color: white;
}

.btn-primary:hover {
    background: #114d11;
    border-color: #114d11;
    color: white;
}

.btn-secondary {
    background: white;
    color: #226d22;
}

.btn-secondary:hover {
    background: #e6f4ea;
    color: #114d11;
}

.btn-danger {
    background: #c1121f;
    border-color: #c1121f;
    color: white;
}

.btn-danger:hover {
    background: #780000;
    border-color: #780000;
    color: white;
}

.form-group,
.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    width: 100%;
}

.form-input {
    padding: 0.6rem 0.75rem;
    border: 1px solid #999;
    border-radius: 10px;
    width: 100%;
    font-size: 0.95rem;
}

.hint {
    font-size: 0.85rem;
    color: #555;
}

.summary-block {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
}

.summary-total {
    font-size: 1.15rem;
    border-top: 1px solid #ccc;
    padding-top: 0.45rem;
}

.cart-item-row,
.confirm-item-row,
.message-item,
.ops-card,
.tracker-step-item,
.saved-address-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
}

.ops-card {
    flex-direction: column;
    align-items: flex-start;
    background: #f8faf8;
    border: 1px solid #d0ddd0;
    border-radius: 14px;
    margin-bottom: 0.65rem;
    width: 100%;
}

.ops-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cart-item-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.qty-btn {
    padding: 0.25rem 0.65rem;
    border-radius: 8px;
    border: 1px solid #999;
    background: #ebebeb;
    cursor: pointer;
    font-weight: bold;
}

.message-item,
.tracker-step-item {
    flex-direction: column;
    align-items: flex-start;
    background: #f7f9f7;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    width: 100%;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.85rem;
    color: #555;
}

.message-compose {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    flex-wrap: wrap;
}

.message-compose > .form-input {
    flex: 1 1 200px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.spacer {
    flex: 1;
}

.role-hero-icon {
    font-size: 2.5rem;
    color: #226d22;
}

.confirm-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #226d22;
}

.confirm-badge i {
    font-size: 2rem;
}

.status-banner {
    padding: 0.65rem;
    border-radius: 10px;
    background: #e6f4ea;
    color: #114d11;
    text-align: center;
    font-weight: 600;
    width: 100%;
}

.error-banner {
    padding: 0.65rem;
    border-radius: 10px;
    background: #fde8e8;
    color: #9b1c1c;
    text-align: center;
    font-weight: 600;
    width: 100%;
}

/* Native Modal Dialog for Multi-Step Admin Confirmations */
dialog#admin-danger-dialog {
    border: none;
    border-radius: 20px;
    padding: 1.5rem;
    max-width: 480px;
    width: 92vw;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

dialog#admin-danger-dialog::backdrop {
    background: rgba(0, 0, 0, 0.65);
}

.dialog-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media screen and (max-width: 768px) {
    #main-wrapper {
        width: 100vw;
    }

    #nav-footer {
        width: 100vw;
        border-radius: 0;
    }

    #drawr {
        width: 78%;
    }

    .catalog-card {
        width: 224px;
    }

    #catalog-search-cont {
        width: 100%;
    }
}

@media screen and (max-width: 425px) {
    #drawr {
        width: 100%;
        max-width: 100vw;
        background: #fff;
    }

    .catalog-card {
        max-width: 158px;
        padding: 0.75rem;
    }

    #main-content {
        padding: 0.25rem;
    }

    .brand-header-title {
        font-size: 1rem;
    }
}

/* PWA Install Prompt Banner (Displayed only when NOT installed as a PWA) */
.pwa-install-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 96%;
    max-width: 920px;
    margin: 0.65rem auto 0 auto;
    padding: 0.75rem 1rem;
    background: #f0f9f0;
    border: 1.5px solid #226d22;
    border-radius: 16px;
    box-shadow: 0 3px 10px rgba(34, 109, 34, 0.14);
}

.pwa-install-banner[hidden] {
    display: none !important;
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 280px;
}

.pwa-install-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pwa-install-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.9rem;
    color: #164916;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
    #pwa-install-banner,
    #drawer-install-pwa-btn {
        display: none !important;
    }
}

