/* KIC Food Service — mobile-first theme layered on Bootstrap 5.
   Reference viewport 390 × 844; everything works down to 320 px. */

:root {
    --kic-primary: #0b6e4f;
    --kic-primary-dark: #08523b;
    --kic-primary-soft: #e3f3ec;
    --kic-accent: #f08c00;
    --kic-surface: #f4f5f2;
    --kic-card: #ffffff;
    --kic-ink: #1d2420;
    --kic-muted: #66706a;
    --kic-line: #e6e8e3;
    --kic-radius: 16px;
    --kic-radius-sm: 10px;
    --kic-shadow: 0 1px 2px rgba(20, 30, 25, 0.06), 0 4px 16px rgba(20, 30, 25, 0.06);
    --kic-header-h: 60px;
    --kic-bottom-h: 64px;
    --shop-accent: var(--kic-primary);
    --shop-accent-soft: var(--kic-primary-soft);
    --bs-body-font-family: "Noto Sans Thai", "Sarabun", "Leelawadee UI", "Thonburi", Tahoma, system-ui,
        -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-color: var(--kic-ink);
    --bs-border-radius: 12px;
    --bs-border-radius-lg: 16px;
    --bs-link-color-rgb: 11, 110, 79;
    --bs-link-hover-color-rgb: 8, 82, 59;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--kic-surface);
    font-family: var(--bs-body-font-family);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

main {
    flex: 1 0 auto;
}

h1, h2, h3, .h1, .h2, .h3, .h4, .h5, .h6 {
    line-height: 1.35;
}

img {
    max-width: 100%;
}

/* Thai has no spaces between words: let long words wrap instead of overflowing. */
.card, .list-group-item, .alert, td, th, .app-main {
    overflow-wrap: anywhere;
}

.ico {
    width: 1.35em;
    height: 1.35em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    vertical-align: -0.3em;
}

/* ---- header ------------------------------------------------------------------ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--kic-line);
}

.app-header-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--kic-header-h);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--kic-ink);
    text-decoration: none;
    font-weight: 700;
    min-width: 0;
}

.app-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--kic-primary);
    color: #fff;
}

.app-brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    object-fit: cover;
}

.app-brand-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 359.98px) {
    .app-brand-name {
        display: none;
    }
}

.app-desktop-nav {
    list-style: none;
    margin: 0 0 0 1rem;
    padding: 0;
    gap: 0.25rem;
}

.app-desktop-nav a {
    display: block;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    color: var(--kic-muted);
    text-decoration: none;
    font-weight: 500;
}

.app-desktop-nav a:hover {
    color: var(--kic-ink);
    background: var(--kic-surface);
}

.app-desktop-nav a.active {
    color: var(--kic-primary);
    background: var(--kic-primary-soft);
}

/* Narrow phones: wrap whole header buttons onto a second row instead of breaking Thai words. */
.kic-nav-actions .btn,
.kic-nav-actions .nav-link {
    white-space: nowrap;
}

.header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--kic-surface);
    color: var(--kic-ink);
    text-decoration: none;
}

.header-icon-btn:hover {
    background: var(--kic-primary-soft);
    color: var(--kic-primary);
}

.header-badge {
    position: absolute;
    top: 2px;
    right: 0;
    font-size: 0.65rem;
    border-radius: 999px;
}

.header-cart {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 44px;
    padding: 0 0.9rem;
    border-radius: 999px;
    background: var(--kic-primary);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

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

.header-cart .badge {
    border-radius: 999px;
}

@media (max-width: 389.98px) {
    .header-cart {
        padding: 0 0.7rem;
    }
}

/* ---- bottom navigation (phones and tablets) ----------------------------------- */

.app-main {
    padding-top: 1rem;
    padding-bottom: 1.5rem;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    justify-content: space-around;
    background: #fff;
    border-top: 1px solid var(--kic-line);
    box-shadow: 0 -4px 16px rgba(20, 30, 25, 0.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--kic-bottom-h);
    min-width: 0;
    color: var(--kic-muted);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 500;
}

.bottom-nav-item .ico {
    width: 1.55rem;
    height: 1.55rem;
}

.bottom-nav-item.active {
    color: var(--kic-primary);
}

.bottom-nav-item.active .ico {
    stroke-width: 2.2;
}

.bottom-nav-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0 2px;
}

.bottom-nav-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e03131;
    color: #fff;
    font-size: 0.68rem;
    line-height: 18px;
    text-align: center;
}

@media (max-width: 991.98px) {
    body {
        padding-bottom: calc(var(--kic-bottom-h) + env(safe-area-inset-bottom, 0));
    }

    .kic-toasts {
        bottom: calc(var(--kic-bottom-h) + 0.75rem + env(safe-area-inset-bottom, 0)) !important;
    }
}

/* ---- base components ------------------------------------------------------------ */

.bg-kic {
    background-color: var(--kic-primary) !important;
}

.text-kic {
    color: var(--kic-primary) !important;
}

.btn {
    border-radius: 999px;
    font-weight: 500;
}

.btn-kic {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--kic-primary);
    --bs-btn-border-color: var(--kic-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--kic-primary-dark);
    --bs-btn-hover-border-color: var(--kic-primary-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--kic-primary-dark);
    --bs-btn-active-border-color: var(--kic-primary-dark);
    --bs-btn-disabled-bg: #9cb8ad;
    --bs-btn-disabled-border-color: #9cb8ad;
    --bs-btn-focus-shadow-rgb: 11, 110, 79;
}

.btn-outline-kic {
    --bs-btn-color: var(--kic-primary);
    --bs-btn-border-color: var(--kic-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--kic-primary);
    --bs-btn-hover-border-color: var(--kic-primary);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--kic-primary-dark);
    --bs-btn-focus-shadow-rgb: 11, 110, 79;
}

/* Comfortable touch targets on phones. */
.btn,
.form-control,
.form-select {
    min-height: 44px;
}

.btn-sm {
    min-height: 36px;
}

.form-control,
.form-select {
    border-radius: 12px;
    border-color: #d5d9d2;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--kic-primary);
    box-shadow: 0 0 0 0.2rem rgba(11, 110, 79, 0.15);
}

.form-check-input:checked {
    background-color: var(--kic-primary);
    border-color: var(--kic-primary);
}

.card {
    border: 0;
    border-radius: var(--kic-radius);
    box-shadow: var(--kic-shadow);
}

.card.shadow-sm {
    box-shadow: var(--kic-shadow) !important;
}

.list-group {
    border-radius: var(--kic-radius);
}

.list-group.shadow-sm {
    box-shadow: var(--kic-shadow) !important;
}

.list-group-item {
    border-color: var(--kic-line);
}

.alert {
    border-radius: 14px;
    border: 0;
}

.alert.border {
    border: 1px solid var(--kic-line) !important;
}

.badge {
    font-weight: 600;
}

.nav-pills .nav-link {
    border-radius: 999px;
    color: var(--kic-muted);
    background: #fff;
    border: 1px solid var(--kic-line);
    margin-right: 0.4rem;
    white-space: nowrap;
}

.nav-pills .nav-link.active {
    background: var(--kic-primary);
    border-color: var(--kic-primary);
    color: #fff;
}

.nav-pills.flex-nowrap {
    scrollbar-width: none;
    padding-bottom: 2px;
}

.nav-pills.flex-nowrap::-webkit-scrollbar {
    display: none;
}

.breadcrumb {
    margin-bottom: 0.75rem;
}

.dropdown-menu {
    border: 0;
    border-radius: 14px;
    min-width: 13rem;
}

.dropdown-item {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.app-flash {
    box-shadow: var(--kic-shadow);
}

.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 1.5rem 0 0.75rem;
}

.section-title h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.section-title a {
    font-size: 0.9rem;
    white-space: nowrap;
    text-decoration: none;
}

.skip-link:focus {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 1080;
    padding: 0.5rem 1rem;
    background: #fff;
    border-radius: 0.375rem;
}

.error-page .error-code {
    font-size: 4rem;
    line-height: 1;
}

.debug-output {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 60vh;
    overflow: auto;
}

/* ---- homepage --------------------------------------------------------------------- */

.hero {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    min-height: 220px;
    display: flex;
    align-items: flex-end;
    background: var(--kic-primary) center / cover no-repeat;
    color: #fff;
    box-shadow: var(--kic-shadow);
}

.hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0.8) 100%);
}

.hero-body {
    position: relative;
    z-index: 1;
    padding: 1.25rem 1.25rem 2.6rem; /* room for the search bar that overlaps the bottom edge */
    width: 100%;
}

.hero-title {
    font-size: 1.45rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.hero-subtitle {
    margin: 0;
    opacity: 0.92;
}

@media (min-width: 768px) {
    .hero {
        min-height: 320px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-body {
        padding: 2rem 2rem 3rem;
    }
}

.search-bar {
    position: relative;
}

.search-bar .ico {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--kic-muted);
    pointer-events: none;
}

.search-bar .form-control {
    padding-left: 2.85rem;
    border-radius: 999px;
    min-height: 50px;
    background: #fff;
    box-shadow: var(--kic-shadow);
    border-color: transparent;
}

.search-bar .btn {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    min-height: 0;
    padding: 0 1.1rem;
}

.home-search {
    margin-top: -1.6rem;
    position: relative;
    z-index: 2;
    padding: 0 0.75rem;
}

/* Horizontally scrolling rows (promotions, featured dishes) with snap points. */
.h-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0.25rem 0.1rem 0.75rem;
    margin: 0 -0.1rem;
    scrollbar-width: none;
}

.h-scroll::-webkit-scrollbar {
    display: none;
}

.h-scroll > * {
    scroll-snap-align: start;
    flex-shrink: 0;
}

.promo-card {
    position: relative;
    width: 82%;
    max-width: 340px;
    aspect-ratio: 16 / 9;
    border-radius: var(--kic-radius);
    overflow: hidden;
    color: #fff;
    text-decoration: none;
    box-shadow: var(--kic-shadow);
    background: var(--kic-primary);
}

.promo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.promo-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.75) 100%);
}

.promo-card-body {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    padding: 0.75rem 0.9rem;
}

.promo-card-title {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
}

.promo-card-sub {
    font-size: 0.8rem;
    opacity: 0.9;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 40px;
    padding: 0 1rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--kic-line);
    color: var(--kic-ink);
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.9rem;
}

.chip:hover,
.chip.active {
    border-color: var(--kic-primary);
    color: var(--kic-primary);
    background: var(--kic-primary-soft);
}

.dish-card {
    width: 150px;
    color: var(--kic-ink);
    text-decoration: none;
}

.dish-card img,
.dish-card .img-fallback {
    width: 150px;
    height: 150px;
    border-radius: var(--kic-radius);
    object-fit: cover;
    box-shadow: var(--kic-shadow);
}

.dish-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.35;
    margin-top: 0.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dish-card-shop {
    font-size: 0.78rem;
    color: var(--kic-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.price {
    font-weight: 700;
    color: var(--kic-ink);
    white-space: nowrap;
}

.img-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--shop-accent-soft), #fff);
    color: var(--shop-accent);
}

.img-fallback .ico {
    width: 40%;
    height: 40%;
    opacity: 0.55;
    stroke-width: 1.4;
}

/* ---- shop directory --------------------------------------------------------------- */

.shop-card {
    position: relative;
    display: block;
    height: 100%;
    border-radius: var(--kic-radius);
    background: #fff;
    box-shadow: var(--kic-shadow);
    overflow: hidden;
    color: var(--kic-ink);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shop-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(20, 30, 25, 0.12);
    color: var(--kic-ink);
}

.shop-card-cover {
    position: relative;
    aspect-ratio: 16 / 8;
    background: var(--shop-accent-soft);
}

.shop-card-cover img,
.shop-card-cover .img-fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-card-status {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
}

.shop-card-body {
    position: relative;
    padding: 0.5rem 0.9rem 0.9rem 5.2rem;
    min-height: 4.6rem;
}

.shop-card-logo {
    position: absolute;
    left: 0.9rem;
    top: -1.8rem;
    width: 3.8rem;
    height: 3.8rem;
    border-radius: 14px;
    object-fit: cover;
    background: #fff;
    border: 3px solid #fff;
    box-shadow: var(--kic-shadow);
}

.shop-card-logo.img-fallback {
    display: flex;
}

.shop-card-name {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.35;
}

.shop-card-meta {
    font-size: 0.82rem;
    color: var(--kic-muted);
    margin: 0.15rem 0 0;
}

.shop-closed .shop-card-cover img,
.shop-closed .shop-card-cover .img-fallback {
    filter: grayscale(0.7);
    opacity: 0.8;
}

/* ---- storefront ------------------------------------------------------------------- */

.shop-theme-green { --shop-accent: #0b6e4f; --shop-accent-soft: #e3f3ec; }
.shop-theme-orange { --shop-accent: #d9480f; --shop-accent-soft: #fff0e6; }
.shop-theme-red { --shop-accent: #c92a2a; --shop-accent-soft: #fdecec; }
.shop-theme-blue { --shop-accent: #1864ab; --shop-accent-soft: #e7f1fb; }
.shop-theme-purple { --shop-accent: #6741d9; --shop-accent-soft: #f0ebff; }
.shop-theme-brown { --shop-accent: #7c4a1e; --shop-accent-soft: #f6eee6; }

.storefront-cover {
    position: relative;
    margin: -1rem calc(var(--bs-gutter-x, 1.5rem) * -0.5) 0;
    aspect-ratio: 16 / 8;
    max-height: 340px;
    background: var(--shop-accent-soft);
    overflow: hidden;
}

.storefront-cover img,
.storefront-cover .img-fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (min-width: 768px) {
    .storefront-cover {
        margin: 0;
        width: 100%;
        aspect-ratio: auto;
        height: 300px;
        border-radius: 22px;
    }
}

.storefront-head {
    position: relative;
    background: #fff;
    border-radius: 22px;
    box-shadow: var(--kic-shadow);
    padding: 3rem 1rem 1rem;
    margin-top: -2.5rem;
    border-top: 4px solid var(--shop-accent);
}

.storefront-logo {
    position: absolute;
    top: -2.4rem;
    left: 1rem;
    width: 4.8rem;
    height: 4.8rem;
    border-radius: 18px;
    object-fit: cover;
    background: #fff;
    border: 4px solid #fff;
    box-shadow: var(--kic-shadow);
}

.storefront-status {
    position: absolute;
    top: 0.85rem;
    right: 1rem;
}

.storefront-head h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.storefront-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    color: var(--kic-muted);
    font-size: 0.85rem;
}

.storefront-tabs {
    position: sticky;
    top: var(--kic-header-h);
    z-index: 5;
    background: var(--kic-surface);
    padding: 0.6rem 0;
    margin: 0.75rem 0 0.25rem;
}

.storefront-tabs .nav-link.active {
    background: var(--shop-accent);
    border-color: var(--shop-accent);
}

.menu-group-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 1.25rem 0 0.6rem;
    color: var(--kic-ink);
}

.menu-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.8rem;
    background: #fff;
    border-radius: var(--kic-radius);
    box-shadow: var(--kic-shadow);
    height: 100%;
}

.menu-item-img {
    width: 104px;
    height: 104px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
}

.menu-item-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.menu-item-name {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.35;
}

.menu-item-desc {
    font-size: 0.82rem;
    color: var(--kic-muted);
    margin: 0.15rem 0 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.menu-item-foot {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.menu-item .price {
    color: var(--shop-accent);
    font-size: 1.05rem;
}

.add-form {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}

.add-form .btn .ico {
    width: 1.1em;
    height: 1.1em;
}

.add-form .qty-input {
    width: 3.6rem;
    min-height: 40px;
    padding: 0.25rem 0.4rem;
    text-align: center;
}

.add-form .btn {
    min-height: 40px;
    background: var(--shop-accent);
    border-color: var(--shop-accent);
    color: #fff;
    padding: 0 0.9rem;
    white-space: nowrap;
}

.add-form .btn:hover {
    filter: brightness(0.92);
    color: #fff;
}

.featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--shop-accent);
    background: var(--shop-accent-soft);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    margin-bottom: 0.2rem;
}

.featured-badge .ico {
    width: 0.95em;
    height: 0.95em;
}

.product-sold-out .menu-item-img {
    filter: grayscale(0.8);
    opacity: 0.7;
}

/* ---- shared older classes ----------------------------------------------------------- */

.shop-logo {
    width: 64px;
    height: 64px;
    object-fit: cover;
    background: #fff;
}

.qr-preview {
    max-width: 260px;
    background: #fff;
}

.product-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 12px !important;
}

.product-photo {
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.product-sold-out {
    opacity: 0.6;
}

.qty-btn {
    width: 44px;
    font-weight: 700;
}

.qty-input {
    max-width: 5.5rem;
}

/* Keep the total / submit button reachable on phones (above the bottom navigation). */
.sticky-summary {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 0.25rem 0;
    background: transparent;
}

@media (max-width: 991.98px) {
    .sticky-summary {
        bottom: calc(var(--kic-bottom-h) + env(safe-area-inset-bottom, 0) + 0.5rem);
    }
}

.sticky-summary.card {
    border: 1px solid var(--kic-line);
}

/* Order progress tracker */
.order-progress {
    background: #fff;
    border-radius: var(--kic-radius);
    box-shadow: var(--kic-shadow);
    padding: 1rem 0.25rem 0.75rem;
}

.order-progress li {
    position: relative;
    color: #6c757d;
    padding-top: 1.6rem;
    font-size: 0.72rem;
    line-height: 1.3;
}

.order-progress li::before {
    content: "";
    position: absolute;
    top: 0.5rem;
    left: -50%;
    width: 100%;
    height: 3px;
    background: #dee2e6;
    z-index: 0;
}

.order-progress li:first-child::before {
    display: none;
}

.order-progress li.done::before {
    background: var(--kic-primary);
}

.order-progress .dot {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 1;
    width: 1.1rem;
    height: 1.1rem;
    margin-left: -0.55rem;
    border-radius: 50%;
    background: #dee2e6;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px #dee2e6;
}

.order-progress li.done {
    color: var(--kic-primary);
}

.order-progress li.done .dot {
    background: var(--kic-primary);
    box-shadow: 0 0 0 1px var(--kic-primary);
}

.order-progress li.current {
    font-weight: 700;
}

.order-progress li.current .dot {
    box-shadow: 0 0 0 4px rgba(11, 110, 79, 0.25);
}

.slip-preview {
    width: 140px;
    max-height: 220px;
    object-fit: contain;
    background: #fff;
}

/* Merchant / admin tiles */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(140px, 42%), 1fr));
    gap: 0.75rem;
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem;
    border-radius: var(--kic-radius);
    background: #fff;
    box-shadow: var(--kic-shadow);
    color: var(--kic-ink);
    text-decoration: none;
    min-height: 92px;
}

.tile:hover {
    color: var(--kic-primary);
}

.tile .ico {
    width: 1.7rem;
    height: 1.7rem;
    color: var(--kic-primary);
}

.tile-label {
    font-weight: 600;
    font-size: 0.92rem;
}

/* Theme picker on the merchant storefront page */
.theme-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.theme-swatch input {
    position: absolute;
    opacity: 0;
}

.theme-swatch label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0 0.9rem 0 0.5rem;
    border-radius: 999px;
    border: 2px solid var(--kic-line);
    background: #fff;
    cursor: pointer;
    font-size: 0.9rem;
}

.theme-swatch .dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--shop-accent);
}

.theme-swatch input:checked + label {
    border-color: var(--shop-accent);
    background: var(--shop-accent-soft);
    font-weight: 600;
}

.theme-swatch input:focus-visible + label {
    outline: 3px solid rgba(11, 110, 79, 0.35);
}

.cms-thumb {
    width: 100%;
    aspect-ratio: 16 / 8;
    object-fit: cover;
    border-radius: 12px;
    background: var(--kic-surface);
}

.cms-asset-thumb {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 14px;
    background: var(--kic-surface);
}

/* Notification toasts and session banner */
.kic-toasts {
    position: fixed;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(22rem, calc(100vw - 1.5rem));
}

.kic-toast {
    background: #fff;
    border-left: 4px solid var(--kic-primary);
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.15);
    padding: 0.75rem 2.25rem 0.75rem 0.75rem;
    position: relative;
    font-size: 0.9rem;
}

.kic-toast.new-order {
    border-left-color: #dc3545;
}

.kic-toast .btn-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.kic-session-banner {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 1100;
    background: #dc3545;
    color: #fff;
    text-align: center;
    padding: 0.5rem;
}

.kic-session-banner a {
    color: #fff;
    font-weight: 700;
}

.min-w-0 {
    min-width: 0;
}

.shop-closed {
    opacity: 0.85;
}

.text-pre-line {
    white-space: pre-line;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.site-footer {
    flex-shrink: 0;
    padding: 1rem 0 1.25rem;
}

/* Admin section pills scroll sideways on phones. */
.admin-nav {
    scrollbar-width: none;
}

.admin-nav::-webkit-scrollbar {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .shop-card {
        transition: none;
    }

    .h-scroll {
        scroll-behavior: auto;
    }
}
