@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ===================== BASE & RESET ===================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

body {
    font-family: 'DM Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: contain;
    background-color: #f4f6f5;
    color: #17211f;
    /* Safe Area Support untuk Smartphone Notch / Home Indicator */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

[x-cloak] {
    display: none !important;
}

.skip-link {
    position: fixed;
    z-index: 120;
    top: 10px;
    left: 10px;
    padding: 10px 14px;
    color: #fff;
    background: #26332f;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
    outline: 3px solid #1769aa;
    outline-offset: 3px;
}

/* ===================== SCROLLBAR UTILS ===================== */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* ===================== COMPONENTS ===================== */
.card {
    background: #ffffff;
    border: 1px solid #e1e7e4;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(23, 33, 31, 0.04);
}

h1, h2, h3, .brand-title {
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
    letter-spacing: 0;
}

.lbl {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 6px;
}

.inp {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 16px; /* 16px mencegah auto-zoom di Safari iOS */
    color: #0f172a;
    outline: none;
    transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}

.inp:focus {
    background: #ffffff;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .15);
}

.inp::placeholder {
    color: #94a3b8;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    letter-spacing: .02em;
}

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    border-radius: 8px;
    padding: 11px 14px;
    min-height: 42px; /* Ukuran sentuh optimal di HP */
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color .15s ease, transform .05s ease, opacity .15s ease, border-color .15s ease;
    white-space: nowrap;
    user-select: none;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(.97);
}

.btn:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none !important;
}

.btn:focus-visible,
.chip:focus-visible {
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

.btn-primary {
    background: #dc2626;
    color: #ffffff;
    box-shadow: 0 4px 10px -6px rgba(220, 38, 38, .7);
}

.btn-primary:hover {
    background: #b91c1c;
}

.btn-dark {
    background: #0f172a;
    color: #ffffff;
}

.btn-dark:hover {
    background: #dc2626;
}

.btn-soft {
    background: #f1f5f9;
    color: #334155;
}

.btn-soft:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
}

.btn-ghost-dark {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

.btn-ghost-dark:hover {
    background: #334155;
}

.btn-icon {
    padding: 10px;
    width: 42px;
    height: 42px;
}

/* ===================== CHIPS ===================== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
    user-select: none;
    touch-action: manipulation;
}

.chip:hover {
    border-color: #94a3b8;
}

.chip.on {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

.chip-sm {
    padding: 6px 11px;
    font-size: 12px;
}

/* ===================== CAMERA & SCANNER OVERLAY ===================== */
#scan-reader {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none !important;
    padding: 0 !important;
    background: #000000;
    overflow: hidden;
}

#scan-reader__scan_region {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
}

#scan-reader__scan_region > img {
    display: none !important;
}

#scan-reader video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 0 !important;
}

#scan-reader canvas {
    display: none !important;
}

#qr-shaded-region,
#scan-reader__dashboard,
#scan-reader__header_message {
    display: none !important;
}

/* ===================== ANIMATIONS ===================== */
@keyframes scanLaser {
    0%, 100% {
        top: 8%;
        opacity: .95;
    }
    50% {
        top: 88%;
        opacity: .35;
    }
}

.laser-line {
    position: absolute;
    left: 4%;
    right: 4%;
    height: 2px;
    background: #ef4444;
    box-shadow: 0 0 12px 2px #ef4444;
    animation: scanLaser 1.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.ocr-pulse {
    animation: pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes slideUp {
    from {
        transform: translateY(24px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.anim-up {
    animation: slideUp .22s cubic-bezier(0, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===================== FIELD OPERATIONS DASHBOARD ===================== */
.site-header {
    background: rgba(255, 255, 255, .96);
    color: #17211f;
    border-bottom: 1px solid #e1e7e4;
    box-shadow: 0 2px 8px rgba(23, 33, 31, .035);
    backdrop-filter: blur(14px);
}

.site-header-inner,
.app-main {
    max-width: 1200px;
}

.brand-mark {
    display: block;
    width: 126px;
    line-height: 0;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.splash-brand {
    display: grid;
    width: 220px;
    min-height: 82px;
    margin: 0 auto;
    padding: 16px 20px;
    place-items: center;
    background: #fff;
    border-radius: 10px;
}

.splash-brand img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.splash-status { min-height: 1.5em; }
.splash-typing::after {
    display: inline-block;
    width: 1px;
    height: 1em;
    margin-left: 3px;
    vertical-align: -2px;
    background: currentColor;
    content: '';
    animation: splashCaret .8s steps(2, start) infinite;
}

@keyframes splashCaret { to { visibility: hidden; } }

.brand-title { color: #17211f; }
.brand-subtitle { color: #75817d; }
.offline-badge { color: #8a5b00; background: #fff4d6; border: 1px solid #f1dda6; }
.settings-button { background: #f1f4f2; color: #34413d; border-color: #e3e8e5; }
.settings-button:hover { background: #e7ece9; }

.dashboard-view { padding-bottom: 32px; }
.dashboard-stack { display: grid; gap: 24px; }
.dashboard-heading {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 12px 2px 4px;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    color: #7b8984;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: .08em;
}

.eyebrow-dot, .overview-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #dc2637;
    box-shadow: 0 0 0 3px rgba(220, 38, 55, .12);
}

.dashboard-heading h1 {
    margin: 0;
    color: #17211f;
    font-size: 30px;
    line-height: 1.08;
    font-weight: 700;
}

.dashboard-intro {
    margin: 8px 0 0;
    color: #74817c;
    font-size: 13px;
}

.overview-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 112px 1px minmax(200px, .8fr);
    align-items: center;
    gap: 28px;
    padding: 24px 28px;
    color: #fff;
    background: #17211f;
    border: 1px solid #26332f;
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(23, 33, 31, .1);
}

.overview-label {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #b8c4bf;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
}

.overview-pulse { background: #ff5965; box-shadow: 0 0 0 3px rgba(255, 89, 101, .14); }
.overview-count { display: flex; align-items: baseline; gap: 9px; margin-top: 10px; }
.overview-count strong { font-family: 'Space Grotesk', sans-serif; font-size: 36px; line-height: 1; }
.overview-count span { color: #bdc7c3; font-size: 13px; font-weight: 600; }
.overview-count b { color: #fff; }

.progress-track {
    width: 100%;
    height: 7px;
    margin-top: 17px;
    overflow: hidden;
    background: #35423e;
    border-radius: 99px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e53946, #f17a51);
    border-radius: inherit;
    transition: width .6s ease;
}

.overview-caption { margin: 8px 0 0; color: #9eaaa5; font-size: 11px; }
.overview-ring-wrap { display: grid; place-items: center; }
.overview-ring {
    display: grid;
    width: 100px;
    aspect-ratio: 1;
    place-items: center;
    background: conic-gradient(from -90deg, #f04a54 var(--progress), #35423e var(--progress));
    border-radius: 50%;
}

.overview-ring > div {
    display: flex;
    width: 78px;
    aspect-ratio: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #17211f;
    border-radius: 50%;
}

.overview-ring strong { font-family: 'Space Grotesk', sans-serif; font-size: 21px; line-height: 1; }
.overview-ring span { margin-top: 4px; color: #aab5b0; font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.overview-divider { width: 1px; height: 72px; background: #35423e; }
.overview-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.overview-metrics > div { display: grid; grid-template-columns: 32px 1fr; align-items: center; column-gap: 9px; }
.metric-icon { display: grid; width: 32px; height: 32px; grid-row: span 2; place-items: center; border-radius: 8px; }
.metric-red { color: #ff8e96; background: rgba(220, 38, 55, .18); }
.metric-green { color: #69d6a0; background: rgba(34, 160, 102, .16); }
.overview-metrics strong { font-family: 'Space Grotesk', sans-serif; font-size: 18px; line-height: 1.1; }
.overview-metrics > div > span:last-child { color: #aab5b0; font-size: 10px; white-space: nowrap; }

.store-browser { display: grid; gap: 16px; padding: 0; }
.browser-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0; }
.browser-heading .eyebrow { margin-bottom: 5px; }
.browser-heading h2 { margin: 0; color: #17211f; font-size: 20px; line-height: 1.2; font-weight: 700; }
.store-total { color: #68756f; font-size: 12px; font-weight: 700; }
.store-browser .inp { background: #fff; border-color: #dce4e0; }
.store-browser .inp:focus { border-color: #dc2637; box-shadow: 0 0 0 3px rgba(220, 38, 55, .11); }
.scan-store-button { background: #d92332; color: #fff; box-shadow: none; }
.scan-store-button:hover { background: #b91c2b; }
.scan-button-label { font-size: 12px; }
.browser-controls { display: grid; gap: 12px; }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.region-filters { flex: 1; }
.region-filters .chip { padding: 7px 12px; background: #fff; border-radius: 7px; font-size: 12px; }
.region-filters .chip.on { color: #fff; background: #26332f; border-color: #26332f; }
.region-filters .chip.on span:first-child { box-shadow: 0 0 0 2px rgba(255,255,255,.45); }
.status-filters { display: flex; flex: 0 0 auto; padding: 3px; background: #e9eeeb; border: 1px solid #dfe6e2; border-radius: 8px; }
.status-filters button { min-height: 30px; padding: 0 11px; color: #66736e; background: transparent; border: 0; border-radius: 5px; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.status-filters button.active { color: #17211f; background: #fff; box-shadow: 0 1px 3px rgba(23,33,31,.12); }

.region-section { display: grid; gap: 12px; margin: 0; }
.region-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 10px; border-bottom: 1px solid #dce4e0; }
.region-heading h2 { color: #26332f; font-size: 12px; }
.region-marker { width: 9px; height: 9px; background: var(--region-color); border-radius: 3px; }
.region-heading > span { color: #89948f; font-size: 11px; }
.store-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 0; }
.store-card { display: flex; min-width: 0; align-items: center; gap: 14px; padding: 14px; border-radius: 8px; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.store-card:hover { border-color: #c4d0ca !important; box-shadow: 0 5px 14px rgba(23,33,31,.07); transform: translateY(-1px); }
.store-card-content { display: grid; flex: 1; min-width: 0; gap: 7px; }
.store-card-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.store-code { flex: 0 0 auto; padding: 4px 7px; color: #fff; background: #26332f; border-radius: 4px; font-size: 10px; font-weight: 800; }
.store-card-title h3 { overflow: hidden; margin: 0; color: #202b27; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.store-address { display: flex; align-items: center; gap: 5px; overflow: hidden; margin: 0; color: #82908a; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.store-address svg { flex: 0 0 auto; color: #a1aba6; }
.store-progress-list { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; }
.sheet-progress { padding: 3px 6px; border-radius: 4px; font-size: 9px; font-weight: 800; }
.store-card-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; }
.map-button { width: 36px; height: 36px; min-height: 36px; padding: 8px; color: #56635e; background: #f3f6f4; border-color: #e6ebe8; border-radius: 7px; }
.open-store-button { min-height: 36px; gap: 7px; padding: 0 11px; border-radius: 7px; background: #26332f; font-size: 11px; }
.open-store-button:hover { background: #d92332; }
.empty-results { display: flex; min-height: 210px; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; padding: 20px; color: #697771; text-align: center; background: #fff; border: 1px dashed #ccd6d1; border-radius: 8px; }
.empty-results > span { display: grid; width: 38px; height: 38px; place-items: center; color: #d92332; background: #fff0f1; border-radius: 8px; }
.empty-results strong { color: #26332f; font-family: 'Space Grotesk', sans-serif; font-size: 14px; }
.empty-results p { margin: 0 0 5px; font-size: 12px; }

.app-footer {
    width: min(100% - 40px, 1160px);
    margin: 0 auto;
    padding: 18px 0 calc(22px + env(safe-area-inset-bottom));
    border-top: 1px solid #e0e7e3;
}

.app-footer-inner,
.footer-brand,
.footer-meta,
.footer-storage {
    display: flex;
    align-items: center;
}

.app-footer-inner {
    justify-content: space-between;
    gap: 16px;
}

.footer-brand { gap: 12px; }
.footer-brand img { display: block; width: 94px; height: auto; object-fit: contain; }
.footer-brand span { color: #52615b; font-size: 11px; font-weight: 700; }
.footer-meta { flex-wrap: wrap; justify-content: flex-end; gap: 14px; color: #87938d; font-size: 10px; }
.footer-storage { gap: 6px; }
.footer-storage svg { color: #718079; }

@media (max-width: 760px) {
    .overview-panel { grid-template-columns: minmax(0, 1fr) 90px; gap: 14px; padding: 19px; }
    .overview-ring { width: 82px; }
    .overview-ring > div { width: 65px; }
    .overview-divider { display: none; }
    .overview-metrics { grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid #35423e; }
    .store-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .app-main { padding: 14px 14px 24px; }
    .site-header-inner { height: 60px; }
    .dashboard-heading { align-items: flex-start; flex-direction: column; gap: 12px; padding-top: 6px; }
    .dashboard-heading h1 { font-size: 25px; }
    .dashboard-intro { max-width: 34ch; font-size: 12px; }
    .overview-panel { padding: 17px 15px; }
    .overview-count strong { font-size: 31px; }
    .overview-count span { font-size: 11px; }
    .overview-metrics { gap: 8px; }
    .overview-metrics > div { grid-template-columns: 28px 1fr; column-gap: 7px; }
    .metric-icon { width: 28px; height: 28px; }
    .overview-metrics > div > span:last-child { font-size: 9px; }
    .browser-heading h2 { font-size: 18px; }
    .filter-row { align-items: stretch; flex-direction: column; gap: 7px; }
    .region-filters { width: 100%; }
    .status-filters { align-self: flex-start; }
    .store-card { gap: 8px; padding: 11px; }
    .store-card-title { align-items: flex-start; flex-direction: column; gap: 5px; }
    .store-card-title h3 { max-width: 100%; }
    .store-card-actions { gap: 5px; }
    .map-button { display: none; }
    .open-store-button { padding: 0 9px; }
    .scan-button-label { display: none; }
    .app-footer { width: calc(100% - 28px); padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
    .app-footer-inner { align-items: flex-start; flex-direction: column; gap: 10px; }
    .footer-meta { justify-content: flex-start; gap: 7px 12px; }
}

/* ===================== APP-WIDE POLISH & MOBILE NAVIGATION ===================== */
.bg-slate-100 { background-color: #f4f6f5; }
.app-main { min-height: calc(100vh - 64px); padding-bottom: 48px; }
.app-main > div[x-show^="view ==="] { width: 100%; }
.app-main .card { border-color: #e0e7e3; box-shadow: 0 2px 8px rgba(23, 33, 31, .035); }
.app-main button.card { transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.app-main button.card:hover { border-color: #cbd6d0; box-shadow: 0 5px 16px rgba(23, 33, 31, .07); transform: translateY(-1px); }
.app-main .btn { border-radius: 8px; }
.app-main .btn-soft { color: #43514b; background: #eef2ef; border-color: #e2e8e4; }
.app-main .btn-soft:hover { background: #e4eae6; border-color: #d4ded8; }
.app-main .btn-dark { background: #26332f; }
.app-main .btn-dark:hover { background: #d92332; }
.app-main .btn-primary { background: #d92332; }
.app-main .btn-primary:hover { background: #ba1e2c; }
.app-main .chip { border-radius: 7px; }
.app-main .chip.on { background: #26332f; border-color: #26332f; }
.app-main .inp { border-color: #dce4e0; background: #f9fbfa; border-radius: 8px; }
.app-main .inp:focus { border-color: #d92332; box-shadow: 0 0 0 3px rgba(217, 35, 50, .12); }
.app-main .lbl { color: #52615b; font-size: 11px; letter-spacing: .01em; }

.app-main [x-show="view === 'units'"] > .card,
.app-main [x-show="view === 'reader'"] > .card,
.app-main [x-show="view === 'form'"] > .card {
    border-radius: 8px;
}

.app-main [x-show="view === 'units'"] > .card:first-of-type {
    padding: 20px;
    background: linear-gradient(125deg, #fff 50%, #f4f7f5 100%);
}

.app-main [x-show="view === 'units'"] > section,
.app-main [x-show="view === 'reader'"] > section { margin-top: 20px; }
.app-main [x-show="view === 'units'"] > section > .card { transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.app-main [x-show="view === 'units'"] > section > .card:hover { border-color: #cbd6d0; box-shadow: 0 5px 16px rgba(23,33,31,.06); transform: translateY(-1px); }
.app-main [x-show="view === 'form'"] > .card:nth-of-type(3) { padding: 24px; }
.app-main [x-show="view === 'form'"] .space-y-2 > .border-b { color: #d92332; }
.app-main [x-show="view === 'settings'"] > div > button.card { min-height: 78px; }
.app-main [x-show="view === 'settings'"] .card { border-radius: 8px; }
.app-main [x-show="view === 'settings'"] .card h3 { color: #26332f; }

.lock-panel {
    background: #1b2824 !important;
    border: 1px solid #34433d !important;
    border-radius: 10px !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .32) !important;
}
.lock-panel input { border-radius: 8px !important; }
.lock-panel button[type="submit"] { border-radius: 8px !important; }

.mobile-nav { display: none; }

@media (max-width: 760px) {
    .app-main { min-height: calc(100vh - 60px); padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
    .mobile-nav {
        position: fixed;
        z-index: 40;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 3px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, .96);
        border-top: 1px solid #e1e7e4;
        box-shadow: 0 -6px 22px rgba(23, 33, 31, .06);
        backdrop-filter: blur(16px);
    }
    .mobile-nav button {
        display: flex;
        min-width: 0;
        min-height: 48px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 4px 2px;
        color: #82908a;
        background: transparent;
        border: 0;
        border-radius: 8px;
        font: 700 9px 'DM Sans', sans-serif;
        cursor: pointer;
        transition: color .18s ease, background-color .18s ease, transform .18s ease;
    }
    .mobile-nav button.active { color: #d92332; background: #fff1f2; }
    .mobile-nav button:disabled { opacity: .38; cursor: not-allowed; }
    .mobile-nav button:active:not(:disabled) { transform: scale(.96); }
    .mobile-nav svg { width: 19px; height: 19px; }
    .site-header-inner { padding-inline: 14px; }
    .app-main [x-show="view === 'form'"] > .card:nth-of-type(3) { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .app-main button.card:hover,
    .mobile-nav button:active:not(:disabled) { transform: none; }
}

/* ===================== CONSISTENT INTERACTION SYSTEM ===================== */
:root {
    color-scheme: light;
    --ui-ink: #17211f;
    --ui-muted: #74817c;
    --ui-border: #dfe7e2;
    --ui-surface: #fff;
    --ui-canvas: #f4f6f5;
    --ui-brand: #d92332;
    --ui-focus: #1769aa;
    --ui-radius: 8px;
    --ui-shadow: 0 2px 8px rgba(23, 33, 31, .045);
    --ui-space: 16px;
}

body { color: var(--ui-ink); background-color: var(--ui-canvas); }
button, input, textarea, select { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--ui-focus);
    outline-offset: 3px;
}

.app-main .btn { min-height: 44px; border-radius: var(--ui-radius); }
.app-main .btn-icon { width: 44px; height: 44px; padding: 10px; }
.app-main .chip { min-height: 40px; border-radius: var(--ui-radius); }
.app-main .card { border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); }
.app-main .inp { min-height: 46px; border-radius: var(--ui-radius); }
.app-main textarea.inp { min-height: 88px; resize: vertical; }
.app-main input:disabled,
.app-main textarea:disabled,
.app-main select:disabled { color: #78857f; background: #eef1ef; cursor: not-allowed; }
.app-main [x-show="view === 'form'"] > .flex:first-child { flex-wrap: wrap; row-gap: 8px; }
.app-main [x-show="view === 'form'"] > .flex:first-child > div { flex-wrap: wrap; }
.app-main [x-show="view === 'units'"] section { display: grid; gap: 10px; }
.app-main [x-show="view === 'units'"] section > div:first-child { margin: 0; }
.app-main [x-show="view === 'reader'"] section .card { overflow: hidden; }

.card,
.btn,
.chip,
.inp,
.mobile-nav button {
    transition-timing-function: cubic-bezier(.2, .7, .2, 1);
}

.site-header { border-color: var(--ui-border); }
.app-footer { border-color: var(--ui-border); }
.empty-results { border-radius: var(--ui-radius); }

@media (max-width: 520px) {
    .app-main { padding-inline: 12px; }
    .app-main .btn { min-height: 44px; }
    .app-main [x-show="view === 'form'"] > .flex:first-child { align-items: flex-start; }
    .app-main [x-show="view === 'form'"] > .flex:first-child > div { width: 100%; }
    .app-main [x-show="view === 'form'"] > .flex:first-child > div .btn { flex: 1 1 auto; }
    .app-main [x-show="view === 'units'"] section > div.card { flex-wrap: wrap; }
    .app-main [x-show="view === 'units'"] section > div.card > .flex:last-child { width: 100%; justify-content: flex-end; }
}

/* ===================== MOBILE INTERACTION & LIQUID GLASS NAV ===================== */
@media (max-width: 760px) {
    .dashboard-stack { grid-template-columns: minmax(0, 1fr); }
    .dashboard-stack > *,
    .overview-main,
    .store-browser,
    .region-section { min-width: 0; }
    .store-browser,
    .browser-controls { grid-template-columns: minmax(0, 1fr); }
    .browser-heading,
    .browser-controls > .relative,
    .browser-controls .relative.flex-1,
    .browser-controls .inp { min-width: 0; }

    .app-main {
        padding-bottom: calc(116px + env(safe-area-inset-bottom));
    }

    .mobile-nav {
        right: 12px;
        bottom: max(10px, env(safe-area-inset-bottom));
        left: 12px;
        gap: 6px;
        padding: 7px;
        overflow: hidden;
        background: rgba(249, 252, 250, .72);
        border: 1px solid rgba(255, 255, 255, .86);
        border-radius: 24px;
        box-shadow: 0 14px 38px rgba(24, 37, 31, .18), inset 0 1px 0 rgba(255, 255, 255, .9);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
    }

    .mobile-nav::before {
        position: absolute;
        top: 0;
        right: 10%;
        left: 10%;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .98), transparent);
        content: '';
        pointer-events: none;
    }

    .mobile-nav button {
        position: relative;
        z-index: 1;
        min-height: 56px;
        gap: 5px;
        border-radius: 17px;
        font-size: 10px;
        touch-action: manipulation;
    }

    .mobile-nav button.active {
        color: #c91f31;
        background: rgba(255, 255, 255, .78);
        box-shadow: 0 3px 12px rgba(23, 33, 31, .09), inset 0 1px 0 rgba(255, 255, 255, .95);
    }

    .mobile-nav button:focus-visible {
        outline-offset: -2px;
    }

    .store-card-actions { gap: 7px; }
    .map-button { display: inline-flex; width: 44px; height: 44px; min-height: 44px; }
    .open-store-button { min-height: 44px; padding-inline: 12px; }
    .scan-button-label { display: inline; }
    .browser-controls > .relative,
    .browser-controls .relative.flex-1 { min-width: 0; }
    .status-filters button { min-height: 40px; padding-inline: 14px; }
    .region-filters .chip { min-height: 40px; }
    .overview-panel { width: 100%; }
    .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .overview-metrics > div { min-width: 0; }
    .overview-metrics > div > span:last-child { white-space: normal; }
}

@media (max-width: 360px) {
    .mobile-nav { right: 8px; left: 8px; gap: 3px; }
    .mobile-nav button { font-size: 9px; }
    .scan-button-label { font-size: 10px; }
    .store-card { align-items: flex-start; }
    .store-card-actions { align-self: flex-end; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    @media (max-width: 760px) {
        .mobile-nav { background: rgba(249, 252, 250, .97); }
    }
}

/* ===================== RESPONSIVE HEADER & FOOTER ===================== */
.site-header {
    border-bottom-color: rgba(218, 228, 222, .88);
    box-shadow: 0 5px 18px rgba(23, 33, 31, .055);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.footer-top-link {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 12px;
    color: #43514b;
    background: #fff;
    border: 1px solid #dfe7e2;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.footer-top-link:hover {
    color: #c91f31;
    background: #fff8f8;
    border-color: #f0c8cc;
}

.footer-top-link:active { transform: translateY(1px); }

@media (max-width: 760px) {
    .app-footer {
        width: calc(100% - 28px);
        padding: 22px 0 calc(116px + env(safe-area-inset-bottom));
    }

    .app-footer-inner {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 14px;
    }

    .footer-brand { min-width: 0; }
    .footer-meta { min-width: 0; justify-content: flex-start; gap: 10px 14px; }
}

@media (max-width: 520px) {
    .site-header-inner {
        height: auto;
        min-height: 60px;
        gap: 6px;
        padding: 7px 12px;
    }

    .site-header-inner > button:first-child {
        flex: 1 1 auto;
        min-width: 0;
        gap: 8px;
    }

    .site-header-inner > button:first-child > span:last-child { flex: 1; min-width: 0; }
    .brand-mark { width: clamp(76px, 25vw, 98px); }
    .site-header .brand-title {
        display: -webkit-box;
        overflow: hidden;
        font-size: 12px;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .site-header .brand-subtitle { font-size: 10px; }
    .site-header .settings-button,
    .site-header .install-button { min-width: 42px; min-height: 42px; padding: 9px; }
    .app-footer-inner { flex-direction: column; gap: 12px; }
    .footer-brand { align-items: flex-start; flex-direction: column; gap: 6px; }
    .footer-brand img { width: 88px; }
    .footer-meta { align-items: flex-start; flex-direction: column; gap: 9px; }
    .footer-storage { flex-wrap: wrap; }
    .footer-top-link { width: 100%; justify-content: center; }
}

@media (max-width: 360px) {
    .site-header .brand-mark { width: 72px; }
    .site-header .brand-subtitle { display: none; }
}

/* ===================== FOOTER LAYOUT ===================== */
.app-footer {
    position: relative;
    width: 100%;
    margin: 28px 0 0;
    padding: 24px max(16px, calc((100% - 1160px) / 2)) calc(20px + env(safe-area-inset-bottom));
    background: #edf2ef;
    border: 0;
    border-top: 1px solid #dce5df;
}

.app-footer::before {
    position: absolute;
    top: -1px;
    left: max(16px, calc((100% - 1160px) / 2));
    width: 54px;
    height: 3px;
    background: #d92332;
    border-radius: 0 0 4px 4px;
    content: '';
}

.app-footer-inner {
    display: flex;
    max-width: 1160px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 0 auto;
}

.footer-brand { gap: 14px; }
.footer-brand img { width: 96px; }
.footer-brand-copy { display: grid; gap: 3px; }
.footer-brand-copy strong { color: #26332f; font-size: 13px; line-height: 1.2; }
.footer-brand-copy span { color: #738079; font-size: 11px; line-height: 1.35; }

.footer-meta {
    align-items: center;
    gap: 16px;
    color: #738079;
    font-size: 11px;
}

.footer-meta-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.footer-copyright { color: #66746d; }
.footer-storage { gap: 7px; color: #43564c; }
.footer-storage svg { flex: 0 0 auto; color: #16845b; }

.footer-top-link {
    min-height: 40px;
    padding: 0 14px;
    color: #fff;
    background: #26332f;
    border-color: #26332f;
    border-radius: 8px;
    font-size: 12px;
}

.footer-top-link:hover { color: #fff; background: #d92332; border-color: #d92332; }

@media (max-width: 760px) {
    .app-footer { padding: 22px 16px calc(116px + env(safe-area-inset-bottom)); }
    .app-footer::before { left: 16px; }
    .app-footer-inner { align-items: flex-start; flex-direction: column; gap: 18px; }
    .footer-meta { width: 100%; justify-content: space-between; gap: 12px; }
}

@media (max-width: 520px) {
    .app-footer { margin-top: 20px; padding: 20px 16px calc(116px + env(safe-area-inset-bottom)); }
    .footer-brand { align-items: center; flex-direction: row; gap: 12px; }
    .footer-brand img { width: 82px; }
    .footer-brand-copy strong { font-size: 14px; }
    .footer-brand-copy span { font-size: 12px; }
    .footer-meta { align-items: flex-start; flex-direction: column; gap: 12px; }
    .footer-meta-info { align-items: flex-start; flex-direction: column; gap: 9px; font-size: 12px; }
    .footer-top-link { width: auto; min-width: 104px; align-self: flex-start; }
}

@media (max-width: 360px) {
    .app-footer { padding-inline: 12px; }
    .app-footer::before { left: 12px; }
    .footer-brand img { width: 74px; }
    .footer-brand-copy span { font-size: 11px; }
}

/* ===================== PHONE TOAST & HEADER ===================== */
.site-header-inner {
    min-height: 82px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.header-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.header-kicker {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #77847e;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .08em;
}

.header-kicker-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    background: #d92332;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(217, 35, 50, .11);
}

.header-title {
    width: fit-content;
    max-width: 100%;
    padding: 0;
    color: #17211f;
    background: transparent;
    border: 0;
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.15;
    text-align: left;
    cursor: pointer;
}

.header-description { color: #52615b; font-size: 12px; line-height: 1.3; }
.header-subtitle { color: #849089; font-size: 10px; line-height: 1.2; }

.header-logo-link {
    display: grid;
    width: 142px;
    min-width: 110px;
    height: 54px;
    flex: 0 0 auto;
    padding: 7px 10px;
    place-items: center;
    background: #fff;
    border: 1px solid #e4ebe6;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(23, 33, 31, .05);
}

.header-logo-link img { display: block; width: 100%; max-height: 38px; object-fit: contain; }

.footer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-action {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 12px;
    color: #43514b;
    background: #fff;
    border: 1px solid #dfe7e2;
    border-radius: 8px;
    font: 700 12px 'DM Sans', sans-serif;
    cursor: pointer;
}

.footer-action:hover { color: #c91f31; border-color: #f0c8cc; }

@media (max-width: 760px) {
    [role="status"] {
        top: 50%;
        right: auto;
        bottom: auto !important;
        left: 50vw;
        width: max-content;
        min-width: min(280px, calc(100vw - 32px));
        max-width: calc(100vw - 32px);
        padding: 16px 20px;
        border: 1px solid rgba(255, 255, 255, .2);
        border-radius: 14px;
        box-shadow: 0 18px 48px rgba(15, 23, 42, .28);
        font-size: 14px;
        line-height: 1.45;
        transform: translate(-50%, -50%) !important;
        translate: none !important;
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }

    .footer-settings-link { display: none; }
}

@media (max-width: 520px) {
    .site-header-inner { min-height: 78px; gap: 10px; padding-inline: 14px; }
    .header-kicker { font-size: 8px; }
    .header-title { font-size: 17px; }
    .header-description { font-size: 11px; }
    .header-subtitle { font-size: 9px; }
    .header-logo-link { width: clamp(88px, 28vw, 116px); min-width: 88px; height: 48px; padding: 7px; }
    .footer-actions { width: 100%; }
}

@media (max-width: 360px) {
    .site-header-inner { gap: 7px; padding-inline: 11px; }
    .header-title { font-size: 15px; }
    .header-description { font-size: 10px; }
    .header-subtitle { font-size: 8px; }
    .header-logo-link { width: 82px; min-width: 82px; height: 44px; }
}

/* ===================== MOBILE TOAST, STICKY FOOTER & NAV DOCK ===================== */
body {
    width: 100%;
    min-width: 0;
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
}

.app-main {
    width: 100%;
    min-width: 0;
    min-height: 0;
    flex: 1 0 auto;
}

.app-main > .dashboard-view { width: 100%; min-width: 0; }

.app-footer { margin-top: auto; }

@media (max-width: 760px) {
    [role="status"] {
        top: auto;
        bottom: calc(104px + env(safe-area-inset-bottom)) !important;
        left: 50vw;
        transform: translateX(-50%) !important;
    }

    .mobile-nav {
        bottom: calc(18px + env(safe-area-inset-bottom));
        box-shadow: 0 18px 42px rgba(24, 37, 31, .22), inset 0 1px 0 rgba(255, 255, 255, .92);
    }
}