/* MykoStock — Pastel theme (plain CSS, no Tailwind) */
:root {
    --pink-light: #FFF0F2;
    --pink-medium: #FFD3DA;
    --pink-dark: #C98B94;
    --pink-accent: #FCA1AC;
    --pink-btn: #FFE3E7;
    --pink-btn-hover: #FFD3DA;
    --pink-btn-text: #A6606A;
    --bg: #FAF6F6;
    --border: #FFE6E9;
    --text: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --white: #fff;
    --emerald: #059669;
    --emerald-bg: #ecfdf5;
    --amber: #b45309;
    --amber-bg: #fffbeb;
    --rose: #e11d48;
    --rose-bg: #fff1f2;
    --shadow: 0 4px 14px rgba(201, 139, 148, 0.12);
    --radius-sm: 0.75rem;
    --radius: 1rem;
    --radius-lg: 1.5rem;
    --radius-full: 9999px;
    --nav-h: 4.5rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Sarabun', sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: calc(var(--nav-h) + 1rem);
    line-height: 1.5;
}

@media (min-width: 768px) {
    body { padding-bottom: 1.5rem; }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--pink-medium); border-radius: var(--radius-full); }

.hidden { display: none !important; }

/* ---- Layout ---- */
.container { max-width: 56rem; margin: 0 auto; padding: 0 1rem; }
.page-section { margin-bottom: 1.5rem; }

.page-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 768px) {
    .page-header { flex-direction: row; justify-content: space-between; align-items: center; }
    .page-header--start { align-items: flex-start; }
}

.page-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--pink-dark);
}
.page-title i { margin-right: 0.5rem; }
.page-desc { margin: 0.25rem 0 0; font-size: 0.75rem; color: var(--text-muted); }

.actions-row { display: flex; gap: 0.5rem; width: 100%; }
@media (min-width: 768px) { .actions-row { width: auto; } }

.grid-products {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 640px) { .grid-products { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) { .grid-products { grid-template-columns: repeat(3, 1fr); } }

.grid-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 768px) { .grid-stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid-stats { grid-template-columns: repeat(5, 1fr); } }

.grid-stats-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.grid-sales {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 1024px) {
    .grid-sales { grid-template-columns: 2fr 1fr; }
}

.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm { gap: 0.75rem; }

.center-narrow { max-width: 28rem; margin: 0 auto; }

.flex-wrap { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: 0.5rem; align-items: center; }

/* ---- App shell ---- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 211, 218, 0.45);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow);
}
.app-header__inner {
    max-width: 56rem;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand { display: flex; align-items: center; gap: 0.5rem; }
.brand__icon {
    width: 2.5rem; height: 2.5rem;
    background: linear-gradient(135deg, #FFF0F2, #FFD3DA, #FFEBEF);
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    color: var(--pink-dark);
    font-size: 1.125rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.brand__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--pink-dark);
    letter-spacing: 0.02em;
}
.brand__sub { font-size: 0.75rem; font-weight: 400; color: var(--text-light); }
.brand__tagline {
    margin: -0.15rem 0 0;
    font-size: 9px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.user-pill {
    display: none;
    align-items: center;
    gap: 0.35rem;
    background: var(--pink-light);
    border: 1px solid var(--pink-medium);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 10px;
}
@media (min-width: 640px) { .user-pill { display: flex; } }
.user-pill i { color: var(--pink-dark); }
.sync-pill {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--pink-light);
    border: 1px solid var(--pink-medium);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 11px;
}
.sync-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #34d399;
}
.sync-dot--offline { background: #fbbf24; }

.app-main {
    max-width: 56rem;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* ---- Bottom nav ---- */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 40;
    background: var(--white);
    border-top: 1px solid var(--pink-light);
    padding: 0.5rem 0;
    box-shadow: var(--shadow);
}
.bottom-nav__inner {
    max-width: 42rem;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    color: var(--text-light);
    font-size: 10px;
    transition: color 0.15s;
}
.nav-item--active { color: var(--pink-dark); font-weight: 600; }
.nav-item__icon {
    width: 1.75rem; height: 1.75rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
}
.nav-item--active .nav-item__icon { background: var(--pink-light); }

/* ---- Cards & panels ---- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.card--pad { padding: 1rem; }
.card--pad-lg { padding: 1.25rem; }
.card--rounded-xl { border-radius: var(--radius); }

.panel-summary {
    background: linear-gradient(135deg, var(--pink-light), var(--white));
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    height: fit-content;
}
.panel-summary--pink {
    background: #FFEBEF;
    border-color: var(--pink-medium);
}

.stat-card { background: var(--white); padding: 1rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat-card--highlight { background: #FFEBEF; border-color: var(--pink-medium); }
.stat-card__label { display: block; font-size: 10px; color: var(--text-light); margin-bottom: 0.25rem; }
.stat-card__value { font-size: 1.125rem; font-weight: 700; }
.stat-card__value--lg { font-size: 1.25rem; font-weight: 800; color: #73353E; }
.stat-card__value--pink { color: var(--pink-dark); }
.stat-card__value--green { color: var(--emerald); }

.mini-stat {
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    text-align: center;
}
.mini-stat--amber { background: var(--amber-bg); border: 1px solid #fef3c7; }
.mini-stat--gray { background: #f8fafc; }
.mini-stat--white { background: var(--white); border: 1px solid var(--border); }
.mini-stat__label { display: block; font-size: 9px; color: var(--text-muted); }
.mini-stat--amber .mini-stat__label { color: var(--amber); }
.mini-stat__value { font-weight: 700; }
.mini-stat--amber .mini-stat__value { color: #92400e; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ---- Product card ---- */
.product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s;
}
.product-card:hover { transform: scale(1.02); }
.product-card__img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #f8fafc;
}
.product-card__body { padding: 0.75rem; flex: 1; }
.product-card__top { display: flex; justify-content: space-between; align-items: flex-start; }
.product-card__code { font-size: 10px; font-family: monospace; font-weight: 700; color: var(--text-muted); }
.product-card__price { font-size: 10px; font-weight: 700; color: var(--pink-dark); }
.product-card__name { margin: 0.25rem 0; font-size: 0.75rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-card__meta { font-size: 9px; color: var(--text-light); margin: 0; }
.product-card__badges { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.5rem; }
.product-card__actions {
    padding: 0.75rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 0.5rem;
}

/* ---- Bill card ---- */
.bill-card { background: var(--white); border-radius: var(--radius); padding: 1rem; border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 0.75rem; }
.bill-card__top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.bill-card__id { font-weight: 700; font-size: 0.875rem; }
.bill-card__meta { font-size: 10px; color: var(--text-light); margin: 0.25rem 0 0; }
.bill-card__amount { font-weight: 700; color: var(--pink-dark); }
.bill-card__items { font-size: 10px; color: var(--text-muted); margin-bottom: 0.75rem; }

/* ---- Forms ---- */
label.field-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.input, .select, .textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--pink-light);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.75rem;
    background: var(--white);
    color: var(--text);
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--pink-medium);
    box-shadow: 0 0 0 2px rgba(255, 211, 218, 0.6);
}
.input--mono { font-family: monospace; }
.input--search { padding-left: 2.25rem; }
.textarea { resize: vertical; min-height: 3rem; }
.select--flex { flex: 1; min-width: 200px; }
.input--price { width: 5rem; text-align: center; font-weight: 700; padding: 0.25rem; }

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.form-stack > * + * { margin-top: 0.75rem; }

.search-box { position: relative; }
.search-box__icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pink-dark);
    pointer-events: none;
}
.search-hint { font-size: 9px; color: var(--text-light); margin: 0.25rem 0 0; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    border-radius: var(--radius-sm);
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn--pink {
    background: var(--pink-btn);
    color: var(--pink-btn-text);
    border: 1px solid var(--pink-medium);
}
.btn--pink:hover { background: var(--pink-btn-hover); }
.btn--pink-round {
    background: var(--pink-btn);
    color: var(--pink-btn-text);
    border: 1px solid var(--pink-medium);
    border-radius: var(--radius-full);
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
    flex: 1;
}
@media (min-width: 768px) { .btn--pink-round { flex: none; } }
.btn--icon {
    background: var(--pink-light);
    color: var(--pink-dark);
    border: 1px solid var(--pink-medium);
    border-radius: 50%;
    width: 2.5rem; height: 2.5rem;
    padding: 0;
    flex-shrink: 0;
}
.btn--accent {
    background: var(--pink-accent);
    color: var(--white);
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
}
.btn--accent:hover { background: var(--pink-dark); }
.btn--accent-full { width: 100%; padding: 0.75rem; }
.btn--amber {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    width: 100%;
    padding: 0.625rem;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}
.btn--amber:hover { background: #fde68a; }
.btn--light {
    background: var(--pink-light);
    color: var(--pink-dark);
    border: 1px solid var(--pink-medium);
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}
.btn--gray {
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 0.375rem 0.75rem;
    font-size: 10px;
}
.btn--green {
    background: var(--emerald-bg);
    color: #047857;
    padding: 0.375rem 0.75rem;
    font-size: 10px;
}
.btn--rose {
    background: var(--rose-bg);
    color: var(--rose);
    padding: 0.375rem 0.75rem;
    font-size: 10px;
}
.btn--sm { font-size: 10px; padding: 0.375rem 0.75rem; }
.btn--edit { flex: 1; background: #f8fafc; border: 1px solid #e2e8f0; color: var(--text-muted); font-size: 10px; padding: 0.375rem; }
.btn--barcode {
    background: var(--pink-light);
    color: var(--pink-dark);
    border: 1px solid var(--pink-medium);
    border-radius: var(--radius-sm);
    width: 2rem; height: 2rem;
    padding: 0;
}
.btn--ghost-icon {
    background: none;
    border: none;
    color: #fb7185;
    cursor: pointer;
    padding: 0.25rem;
}
.btn--logout {
    background: none;
    border: none;
    color: #fb7185;
    cursor: pointer;
    margin-left: 0.25rem;
    padding: 0;
}
.btn--flex1 { flex: 1; }

.filter-pill {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--border);
    background: var(--white);
    cursor: pointer;
    font-family: inherit;
}
.filter-pill.active {
    background: var(--pink-light);
    color: var(--pink-dark);
    border-color: var(--pink-medium);
}

.report-tab {
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    font-family: inherit;
}
.report-tab.active {
    background: var(--pink-light);
    color: var(--pink-dark);
}

.report-filter { margin-bottom: 1.25rem; }
.report-filter__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}
.report-filter__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.report-filter__pickers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.report-filter__label {
    margin: 0.75rem 0 0;
    font-size: 0.75rem;
    color: var(--text-light);
}
.select--sm {
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
    min-width: 8rem;
}
.data-table tr.row--highlight td {
    background: rgba(252, 161, 172, 0.15);
}
.stat-card__note {
    display: block;
    font-size: 0.625rem;
    color: var(--text-light);
    font-weight: 500;
    margin-top: 0.25rem;
}

/* ---- Report Stock ---- */
.stock-report {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stock-report__panel {
    margin-bottom: 0;
}

.stock-report__panel-head {
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--pink-light);
}

.stock-report__section-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--pink-dark);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.stock-report__section-title i {
    font-size: 0.8rem;
    opacity: 0.85;
}

.stock-report__overview {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .stock-report__overview {
        grid-template-columns: minmax(7rem, 9rem) 1fr;
        align-items: stretch;
        gap: 1.25rem;
    }
}

.stock-report__hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem 0.75rem;
    background: linear-gradient(145deg, #FFEBEF, #FFF5F7);
    border: 1px solid var(--pink-medium);
    border-radius: var(--radius-lg);
    min-height: 100%;
}

.stock-report__hero-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.stock-report__hero-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stock-report__hero-unit {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.stock-report__metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
}

@media (min-width: 640px) {
    .stock-report__metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .stock-report__metrics {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stock-metric {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 4.25rem;
}

.stock-metric--highlight {
    background: #FFEBEF;
    border-color: var(--pink-medium);
}

.stock-metric__label {
    display: block;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.stock-metric__value {
    font-size: 1rem;
    font-weight: 700;
    color: #73353E;
    word-break: break-word;
}

.stock-metric__value--pink {
    color: var(--pink-dark);
}

.stock-report__status {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}

.stock-status {
    border-radius: var(--radius);
    padding: 0.65rem 0.75rem;
    text-align: center;
}

.stock-status--amber {
    background: var(--amber-bg);
    border: 1px solid #fde68a;
}

.stock-status--gray {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.stock-status--total {
    background: var(--pink-light);
    border: 1px solid var(--pink-medium);
}

.stock-status__label {
    display: block;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.stock-status--amber .stock-status__label { color: var(--amber); }
.stock-status--total .stock-status__label { color: var(--pink-dark); }

.stock-status__value {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #334155;
}

.stock-status--amber .stock-status__value { color: #92400e; }
.stock-status--total .stock-status__value { color: var(--pink-dark); }

.stock-report__period-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
}

@media (min-width: 768px) {
    .stock-report__period-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.data-table--stock td:first-child {
    white-space: nowrap;
}

.data-table--stock td:nth-child(2) {
    min-width: 6rem;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
table.data-table th {
    font-size: 10px;
    color: var(--text-light);
    border-bottom: 1px solid var(--pink-light);
    padding: 0.5rem 0.25rem;
    text-align: left;
    font-weight: 600;
}
table.data-table th.text-center, table.data-table td.text-center { text-align: center; }
table.data-table th.text-right, table.data-table td.text-right { text-align: right; }
table.data-table td {
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid rgba(255, 230, 233, 0.5);
    vertical-align: middle;
}
table.data-table tr:hover td { background: #f8fafc; }
.td-product-id { font-family: monospace; font-size: 9px; color: var(--text-light); display: block; }
.td-product-name { font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    font-size: 9px;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
}
.badge--available { background: var(--emerald-bg); color: var(--emerald); }
.badge--reserved { background: var(--amber-bg); color: var(--amber); }
.badge--sold { background: #f1f5f9; color: var(--text-muted); }
.badge--bill-reserved { background: var(--amber-bg); color: var(--amber); font-size: 10px; }
.badge--bill-sold { background: var(--emerald-bg); color: var(--emerald); font-size: 10px; }
.badge--bill-cancelled { background: var(--rose-bg); color: var(--rose); font-size: 10px; }
.badge--id {
    background: var(--pink-light);
    color: var(--pink-dark);
    border: 1px solid var(--pink-medium);
    font-family: monospace;
    font-size: 10px;
}

/* ---- Modals ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.hidden { display: none !important; }

/* ลำดับชั้น modal — สแกนอยู่บนสุด (เปิดจากแก้ไขบิลได้) */
#product-modal { z-index: 50; }
#bill-modal { z-index: 52; }
#confirm-modal { z-index: 65; }
#scanner-modal { z-index: 70; }

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--pink-light);
    box-shadow: var(--shadow);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal--sm { max-width: 24rem; }
.modal--md { max-width: 28rem; }
.modal--lg { max-width: 32rem; }

.modal__head {
    background: linear-gradient(90deg, var(--pink-light), var(--white));
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--pink-light);
    position: relative;
    flex-shrink: 0;
}
.modal__head--row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}
.modal__title { margin: 0; font-size: 0.875rem; font-weight: 700; color: var(--pink-dark); }
.modal__close {
    position: absolute;
    right: 1rem; top: 0.75rem;
    background: none; border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.875rem;
}
.modal__close--round {
    position: absolute;
    right: 1rem; top: 1rem;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 1.75rem; height: 1.75rem;
    cursor: pointer;
    color: var(--text-muted);
    z-index: 10;
}
.modal__body { overflow-y: auto; padding: 1.25rem; flex: 1; }
.modal__body--form { font-size: 0.75rem; }
.modal__foot {
    padding: 1rem;
    border-top: 1px solid var(--pink-light);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
}
.modal__actions { display: flex; gap: 0.5rem; }
.modal__actions .btn { flex: 1; padding: 0.625rem; font-size: 0.75rem; }

.barcode-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--pink-light);
}
.barcode-preview__label { font-size: 10px; color: var(--text-light); margin-bottom: 0.5rem; }

.image-preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    position: relative;
}
.image-preview-box__img {
    width: 7rem; height: 7rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--pink-light);
}
.image-preview-box__img img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-box__clear {
    position: absolute;
    right: 0.5rem; top: 0.5rem;
    background: #f43f5e;
    color: white;
    border: none;
    border-radius: 50%;
    width: 1.25rem; height: 1.25rem;
    font-size: 9px;
    cursor: pointer;
}

.status-summary {
    background: rgba(255, 240, 242, 0.6);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 10px;
    color: var(--text-muted);
}

.scanner-box {
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--pink-light);
}
.scanner-box > div { width: 100%; height: 100%; }

.confirm-icon { font-size: 2.25rem; color: var(--pink-accent); margin-bottom: 0.75rem; }
.confirm-text { font-size: 11px; color: var(--text-light); margin: 0 0 1.25rem; line-height: 1.6; }

.edit-bill-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}
.edit-bill-row__info { flex: 1; font-size: 10px; }
.edit-bill-row__name { font-weight: 700; }
.edit-bill-row__code { color: var(--text-light); font-family: monospace; }

/* ---- Check page ---- */
.check-card { text-align: center; }
.check-card__img-wrap {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.check-card__img { width: 100%; height: 100%; object-fit: cover; }
.check-status { font-size: 1.125rem; font-weight: 800; }
.check-status--available { color: var(--emerald); }
.check-status--reserved { color: var(--amber); }
.check-status--sold { color: var(--text-light); }
.check-unit-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}
.check-stock-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin: 0.75rem 0;
    text-align: center;
}
.check-stock-summary__item {
    padding: 0.65rem 0.35rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.check-stock-summary__item--available {
    background: var(--emerald-bg);
    border-color: #a7f3d0;
}
.check-stock-summary__item--reserved {
    background: var(--amber-bg);
    border-color: #fde68a;
}
.check-stock-summary__item--sold {
    background: #f8fafc;
    border-color: #e2e8f0;
}
.check-stock-summary__label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.3;
    margin-bottom: 0.25rem;
}
.check-stock-summary__item--available .check-stock-summary__label { color: var(--emerald); }
.check-stock-summary__item--reserved .check-stock-summary__label { color: var(--amber); }
.check-stock-summary__value {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
}
.check-stock-summary__item--available .check-stock-summary__value { color: var(--emerald); }
.check-stock-summary__item--reserved .check-stock-summary__value { color: #92400e; }
.check-stock-summary__item--sold .check-stock-summary__value { color: var(--text-muted); }
.check-stock-summary__unit {
    display: block;
    font-size: 9px;
    color: var(--text-light);
}
.check-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; font-size: 0.75rem; }
.check-mini { background: #f8fafc; padding: 0.5rem; border-radius: var(--radius-sm); }
.check-mini__label { display: block; font-size: 9px; color: var(--text-light); }
.check-notes { font-size: 10px; color: var(--text-light); }
.btn--instagram {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(135deg, #f91f76, #ff8c00);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
}

.suggest-list {
    margin-top: 0.5rem;
    max-height: 10rem;
    overflow-y: auto;
    border: 1px solid var(--pink-light);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}
.suggest-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 230, 233, 0.5);
}
.suggest-item:hover { background: rgba(255, 240, 242, 0.5); }
.suggest-item:last-child { border-bottom: none; }

.placeholder-box {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-light);
    font-size: 0.75rem;
}
.placeholder-box i { font-size: 1.875rem; display: block; margin-bottom: 0.5rem; color: #cbd5e1; }

/* ---- Toast ---- */
#toast-container {
    position: fixed;
    top: 5rem;
    right: 1rem;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 20rem;
}
.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid;
    box-shadow: var(--shadow);
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(0.5rem);
    transition: opacity 0.3s, transform 0.3s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast--success { background: #EBFBF2; color: #2F6B42; border-color: #C3EED1; }
.toast--error { background: #FFF0F2; color: #A63A50; border-color: #FFD3DA; }
.toast--info { background: #FFF9EA; color: #856404; border-color: #FFEEC7; }

/* ---- Login ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--bg);
}
.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 24rem;
    width: 100%;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.login-card__icon {
    width: 4rem; height: 4rem;
    margin: 0 auto 0.75rem;
    background: linear-gradient(135deg, #FFF0F2, #FFD3DA);
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    color: var(--pink-dark);
    font-size: 1.5rem;
}
.login-card__title { text-align: center; margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--pink-dark); }
.login-card__desc { text-align: center; font-size: 0.75rem; color: var(--text-light); margin: 0.25rem 0 1.5rem; }
.login-error { font-size: 0.75rem; color: var(--rose); }
.login-hint { text-align: center; font-size: 10px; color: var(--text-light); margin-top: 1rem; }
.login-link { color: var(--pink-dark); font-weight: 700; text-decoration: none; }
.login-link:hover { text-decoration: underline; }
.login-success { font-size: 0.75rem; color: #16a34a; }
.login-form > * + * { margin-top: 1rem; }

.popup-overlay {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.popup-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    max-width: 24rem;
    width: 100%;
    border: 1px solid var(--pink-light);
    box-shadow: var(--shadow);
}

.text-green { color: var(--emerald); }
.text-amber { color: var(--amber); }
.text-rose { color: var(--rose); }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: monospace; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.popup-box__title { font-size: 0.75rem; font-weight: 700; color: var(--pink-dark); margin: 0 0 0.25rem; }
.popup-box__desc { font-size: 10px; color: var(--text-light); margin: 0 0 0.75rem; }
.popup-box__barcode {
    display: flex; justify-content: center;
    padding: 0.75rem; background: #f8fafc;
    border-radius: var(--radius); border: 1px solid #e2e8f0;
    margin-bottom: 0.75rem;
}
.popup-box__actions { display: flex; gap: 0.5rem; }

.edit-bill-add { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--pink-light); }
.edit-bill-add__scan { margin-bottom: 0.35rem; }
.edit-bill-add .search-hint { margin-bottom: 0.5rem; }
.edit-bill-add__row { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.edit-bill-add__row .select { flex: 1; font-size: 0.75rem; }

.edit-bill-table-wrap { margin-bottom: 0.75rem; overflow-x: auto; }
.edit-bill-table { font-size: 0.75rem; }
.edit-bill-table .edit-bill-row__name { font-weight: 700; font-size: 0.75rem; }
.edit-bill-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.75rem;
    background: var(--pink-light);
    border-radius: var(--radius-sm);
    border: 1px solid var(--pink-medium);
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
}
.edit-bill-summary__amount { color: var(--pink-dark); font-size: 1rem; }

.qty-stepper {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}
.qty-stepper__btn {
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid var(--pink-medium);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 1;
    color: var(--pink-dark);
}
.qty-stepper__btn:hover { background: var(--pink-light); }
.qty-stepper__input {
    width: 2.5rem !important;
    text-align: center;
    padding: 0.2rem !important;
    font-weight: 700;
}

.td-mono { font-family: monospace; font-size: 10px; }
