:root {
    color-scheme: light;
    --bg: #f7f8f4;
    --surface: #ffffff;
    --ink: #18211b;
    --muted: #68756c;
    --line: #dce3dc;
    --green: #166534;
    --green-soft: #e8f5eb;
    --blue: #1d4ed8;
    --blue-soft: #eaf0ff;
    --orange: #c2410c;
    --orange-soft: #fff0e7;
    --red: #b91c1c;
    --shadow: 0 14px 40px rgba(24, 33, 27, 0.09);
}

* { box-sizing: border-box; }

html { font-family: "Kanit", system-ui, -apple-system, sans-serif; background: var(--bg); }

body { margin: 0; color: var(--ink); background: var(--bg); }

button, input, select, textarea { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-decoration: none; }

svg { width: 1.25rem; height: 1.25rem; stroke-width: 2; }

.auth-body {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(22, 101, 52, 0.07), transparent 45%),
        var(--bg);
}

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }

.login-panel { width: min(100%, 26rem); padding: 2rem 1.25rem; }

.login-panel h1 { margin: 0.15rem 0 0.25rem; font-size: clamp(1.8rem, 8vw, 2.35rem); line-height: 1.1; }

.brand-mark { width: 3.5rem; height: 3.5rem; display: grid; place-items: center; color: white; background: var(--green); }

.brand-mark svg { width: 2rem; height: 2rem; }

.brand-mark.small { width: 2.65rem; height: 2.65rem; flex: 0 0 auto; }

.brand-mark.small svg { width: 1.5rem; height: 1.5rem; }

.eyebrow { margin: 1.15rem 0 0; color: var(--green); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; }

.muted { color: var(--muted); margin: 0.5rem 0 1.5rem; }

.stack-form { display: grid; gap: 0.6rem; margin-top: 1.25rem; }

.stack-form label { font-size: 0.9rem; font-weight: 500; margin-top: 0.35rem; }

.input-with-icon { position: relative; }

.input-with-icon svg { position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); color: #758078; }

.input-with-icon input {
    width: 100%; min-height: 3.25rem; padding: 0.75rem 0.9rem 0.75rem 2.8rem;
    border: 1px solid #cbd4cc; border-radius: 0.45rem; background: white; color: var(--ink); outline: none;
}

.input-with-icon input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.12); }

.btn { min-height: 2.75rem; padding: 0.55rem 0.9rem; border: 1px solid transparent; border-radius: 0.4rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem; cursor: pointer; font-weight: 600; }

.btn-primary { color: white; background: var(--green); }

.btn-primary:hover { background: #14532d; }

.btn-secondary { color: #24352a; background: #e4e9e4; border-color: #d2dad3; }
.btn-secondary:hover { background: #d8e0d9; }
.btn-ghost { color: #425048; background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: #edf0ed; }
.btn-danger { color: #fff; background: var(--red); }
.btn-danger:hover { background: #991b1b; }

.btn-large { min-height: 3.25rem; margin-top: 0.8rem; border-radius: 0.45rem; padding: 0.75rem 1.2rem; }

.login-help { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 1.2rem 0 0; }

.alert { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.85rem 1rem; margin: 1rem 0; border-left: 4px solid; font-size: 0.9rem; }

.alert svg { flex: 0 0 auto; margin-top: 0.05rem; }

.alert-error { background: #fff1f1; color: #861b1b; border-color: var(--red); }
.alert-success { background: var(--green-soft); color: #14532d; border-color: var(--green); }
.alert-warning { background: #fff8e7; color: #854d0e; border-color: #d97706; }

.offline-banner { position: fixed; inset: 0 0 auto; z-index: 100; min-height: 2.75rem; padding: 0.6rem 1rem; align-items: center; justify-content: center; gap: 0.55rem; color: white; background: #9a3412; font-size: 0.85rem; }

.app-shell { min-height: 100vh; }

.sidebar { display: none; }

.main-column { min-width: 0; padding-bottom: 5rem; }

.mobile-topbar { height: 3.75rem; padding: 0 1rem; display: flex; align-items: center; justify-content: space-between; color: white; background: var(--green); }

.mobile-topbar a { display: flex; align-items: center; gap: 0.55rem; }

.mobile-topbar form, .sidebar-user form { margin: 0; }

.mobile-topbar button, .sidebar-user button { border: 0; color: inherit; background: transparent; cursor: pointer; padding: 0.55rem; }

.app-content { width: min(100%, 76rem); margin: 0 auto; padding: 1.25rem 1rem 2rem; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 0.4rem 0 1.1rem; border-bottom: 1px solid var(--line); }

.page-heading .eyebrow { margin: 0; }

.page-heading h1 { margin: 0.2rem 0 0; font-size: clamp(1.55rem, 6vw, 2.25rem); }

.role-badge { flex: 0 0 auto; color: var(--green); background: var(--green-soft); padding: 0.35rem 0.65rem; font-size: 0.75rem; font-weight: 600; }

.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: 1.6rem 0 0.75rem; }

.section-title h2, .status-strip h2 { margin: 0; font-size: 1.1rem; }

.section-title span { display: none; color: var(--muted); font-size: 0.78rem; }

.action-grid { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line); }

.action-item { width: 100%; min-height: 5rem; display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: 0.75rem; text-align: left; padding: 0.8rem 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); }

.action-item:disabled { opacity: 1; cursor: not-allowed; }
.action-item.available { cursor: pointer; }
.action-item.available:hover { background: rgba(255, 255, 255, 0.65); }

.action-icon { width: 3rem; height: 3rem; display: grid; place-items: center; }

.action-icon svg { width: 1.55rem; height: 1.55rem; }

.tone-green .action-icon { color: var(--green); background: var(--green-soft); }
.tone-orange .action-icon { color: var(--orange); background: var(--orange-soft); }
.tone-blue .action-icon { color: var(--blue); background: var(--blue-soft); }

.action-copy { display: grid; gap: 0.15rem; }
.action-copy strong { font-size: 1rem; }
.action-copy small { color: var(--muted); }
.phase-tag { color: #7a817c; background: #ecefeb; padding: 0.2rem 0.45rem; font-size: 0.68rem; }

.status-strip { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.status-strip p { color: var(--muted); margin: 0.2rem 0 0; font-size: 0.85rem; }

.status-online { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--green); font-size: 0.8rem; font-weight: 600; }
.status-online span { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #22c55e; }

.bottom-nav { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 0.45rem max(0.35rem, env(safe-area-inset-right)) max(0.45rem, env(safe-area-inset-bottom)) max(0.35rem, env(safe-area-inset-left)); background: white; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(24, 33, 27, 0.06); }

.bottom-nav a, .bottom-nav > span { min-height: 3.45rem; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; color: #727b74; font-size: 0.68rem; }

.bottom-nav a.active { color: var(--green); }

.bottom-nav b { font-weight: 400; }

.bottom-nav small { position: absolute; top: 0; right: 6%; color: #8a918b; font-size: 0.52rem; }

.heading-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem; }
.heading-actions form { margin: 0; }

.filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin: 1.25rem 0 0.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
}

.filter-bar input,
.filter-bar select,
.field input,
.field select,
.field textarea,
.stack-form.compact input,
.stack-form.compact select,
.stack-form.compact textarea {
    width: 100%;
    min-height: 2.85rem;
    border: 1px solid #cbd4cc;
    border-radius: 0.35rem;
    background: #fff;
    color: var(--ink);
    outline: none;
}

.filter-bar input,
.filter-bar select,
.field input,
.field select,
.stack-form.compact input,
.stack-form.compact select { padding: 0.65rem 0.75rem; }

.field textarea,
.stack-form.compact textarea { padding: 0.7rem 0.75rem; resize: vertical; }

.filter-bar input:focus,
.filter-bar select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.stack-form.compact input:focus,
.stack-form.compact select:focus,
.stack-form.compact textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.1);
}

.search-field { position: relative; }
.search-field svg { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: #748078; }
.search-field input { padding-left: 2.6rem; }

.list-summary { min-height: 2.7rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: 0.85rem; }
.list-summary a { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--green); font-weight: 500; }

.product-list { display: grid; border-top: 1px solid var(--line); }
.product-row {
    display: grid;
    grid-template-columns: 4rem minmax(0, 1fr);
    grid-template-areas:
        "thumb main"
        "thumb stock"
        "actions actions";
    gap: 0.35rem 0.8rem;
    align-items: center;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--line);
}
.product-thumb { grid-area: thumb; width: 4rem; height: 4rem; display: grid; place-items: center; overflow: hidden; color: #788279; background: #e8ece8; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb svg { width: 1.7rem; height: 1.7rem; }
.product-main { grid-area: main; min-width: 0; }
.product-title-line { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.product-title-line > a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.product-main p { margin: 0.18rem 0; color: #354239; font-size: 0.82rem; }
.product-main small { display: block; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; }
.status-pill { display: inline-flex; align-items: center; width: max-content; padding: 0.18rem 0.45rem; font-size: 0.65rem; font-weight: 600; white-space: nowrap; }
.status-pill.active { color: #166534; background: #dcfce7; }
.status-pill.inactive { color: #6b7280; background: #e5e7eb; }
.stock-figure { grid-area: stock; display: flex; align-items: baseline; gap: 0.3rem; }
.stock-figure strong { font-size: 1rem; }
.stock-figure > span { color: var(--muted); font-size: 0.75rem; }
.stock-state { margin-left: 0.35rem; font-size: 0.68rem; font-weight: 600; }
.stock-state.normal { color: var(--green); }
.stock-state.low { color: #b45309; }
.stock-state.out { color: var(--red); }
.row-actions { grid-area: actions; display: flex; align-items: center; justify-content: flex-end; gap: 0.35rem; }
.row-actions form { margin: 0; }
.icon-btn { width: 2.5rem; height: 2.5rem; padding: 0; border: 0; display: grid; place-items: center; color: #556159; background: transparent; cursor: pointer; }
.icon-btn:hover { color: var(--green); background: #e8eee9; }
.icon-btn.danger:hover { color: var(--red); background: #fee2e2; }
.row-action-link,
.action-menu summary {
    min-height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.38rem;
    padding: 0.45rem 0.65rem;
    color: #475569;
    background: #fff;
    border: 1px solid #dbe3ea;
    border-radius: 0.65rem;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
}
.row-action-link:hover,
.action-menu summary:hover,
.action-menu[open] summary { color: var(--green); border-color: #99d8c9; background: #f0fdfa; }
.row-action-link svg,
.action-menu summary svg { width: 1rem; height: 1rem; }
.action-menu { position: relative; }
.action-menu summary { list-style: none; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu summary svg:last-child { width: 0.8rem; height: 0.8rem; transition: transform 0.18s ease; }
.action-menu[open] summary svg:last-child { transform: rotate(180deg); }
.action-menu-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.4rem);
    right: 0;
    width: 13rem;
    padding: 0.4rem;
    background: #fff;
    border: 1px solid #dbe3ea;
    border-radius: 0.75rem;
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.15);
}
.action-menu-panel a,
.action-menu-panel button,
.action-menu-disabled {
    width: 100%;
    min-height: 2.65rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    color: #334155;
    background: transparent;
    border: 0;
    border-radius: 0.5rem;
    text-align: left;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}
.action-menu-panel a:hover,
.action-menu-panel button:hover { color: var(--green); background: #f0fdfa; }
.action-menu-panel button.danger { color: #b91c1c; }
.action-menu-panel button.danger:hover { background: #fef2f2; }
.action-menu-panel svg,
.action-menu-disabled svg { width: 1rem; height: 1rem; flex: 0 0 auto; }
.action-menu-disabled { color: #94a3b8; cursor: not-allowed; }
.action-menu-disabled span { display: grid; }
.action-menu-disabled small { font-size: 0.66rem; font-weight: 400; }
.list-help { display: inline-flex; align-items: center; gap: 0.35rem; }
.list-help svg { width: 1rem; height: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.empty-state { min-height: 18rem; display: grid; place-items: center; align-content: center; gap: 0.45rem; text-align: center; color: var(--muted); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.empty-state svg { width: 2.8rem; height: 2.8rem; color: #929c94; }
.empty-state h2, .empty-state p { margin: 0; }
.empty-state.small { min-height: 9rem; }

.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; margin-top: 1.3rem; }
.pagination a { min-width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; }
.pagination a.active { color: #fff; background: var(--green); border-color: var(--green); }

.entity-form { display: grid; gap: 0; }
.form-section { display: grid; gap: 1rem; padding: 1.4rem 0; border-bottom: 1px solid var(--line); }
[hidden] { display: none !important; }
.form-section-heading { display: flex; align-items: flex-start; gap: 0.7rem; }
.form-section-heading > span { width: 1.75rem; height: 1.75rem; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: var(--green); font-size: 0.8rem; font-weight: 600; }
.form-section-heading > span svg { width: 1rem; height: 1rem; }
.form-section-heading h2 { margin: 0; font-size: 1rem; }
.form-section-heading p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.78rem; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0.9rem; }
.field { display: grid; align-content: start; gap: 0.35rem; }
.field label { font-size: 0.85rem; font-weight: 500; }
.field label b { color: var(--red); }
.field-error { color: var(--red); font-size: 0.75rem; }
.image-upload { display: grid; grid-template-columns: 7rem minmax(0, 1fr); align-items: center; gap: 1rem; }
.image-preview { width: 7rem; height: 7rem; display: grid; place-items: center; overflow: hidden; color: var(--muted); background: #e8ece8; text-align: center; font-size: 0.72rem; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview svg { width: 1.8rem; height: 1.8rem; }
.check-line { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; color: var(--muted); font-size: 0.8rem; cursor: pointer; }
.check-line input {
    flex: 0 0 1rem;
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: #0d9488;
    cursor: pointer;
}
.form-actions { display: flex; justify-content: flex-end; gap: 0.65rem; padding: 1.25rem 0; }
.workflow-guide {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.15rem;
    color: #134e4a;
    border: 1px solid #99f6e4;
    border-radius: 1rem;
    background: linear-gradient(135deg, #f0fdfa, #ecfeff);
}
.workflow-guide-heading { display: flex; align-items: flex-start; gap: 0.75rem; }
.workflow-guide-heading > svg { width: 1.5rem; height: 1.5rem; flex: 0 0 auto; color: #0d9488; }
.workflow-guide h2, .workflow-guide p { margin: 0; }
.workflow-guide h2 { font-size: 1rem; }
.workflow-guide p { margin-top: 0.2rem; color: #47736f; font-size: 0.8rem; }
.workflow-guide ol { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.workflow-guide li { display: flex; align-items: center; gap: 0.65rem; padding: 0.7rem; color: #64748b; border: 1px solid #dbe7e5; border-radius: 0.75rem; background: rgba(255,255,255,0.72); }
.workflow-guide li > span { width: 1.75rem; height: 1.75rem; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #64748b; background: #e2e8f0; font-size: 0.75rem; font-weight: 700; }
.workflow-guide li > span svg { width: 1rem; height: 1rem; }
.workflow-guide li > div { display: grid; }
.workflow-guide li small { color: #64748b; font-size: 0.7rem; }
.workflow-guide li.active { color: #0f766e; border-color: #5eead4; background: #fff; box-shadow: 0 5px 14px rgba(13,148,136,0.08); }
.workflow-guide li.active > span { color: #fff; background: #0d9488; }
.workflow-guide li.complete > span { color: #fff; background: #10b981; }
.workflow-note { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.65rem 0.75rem; color: #475569; border-radius: 0.65rem; background: #fff; font-size: 0.78rem; }
.workflow-note svg { width: 1rem; height: 1rem; flex: 0 0 auto; color: #0d9488; }
.workflow-note strong { color: #0f766e; }
.quantity-input-wrap { position: relative; }
.quantity-input-wrap input { padding-right: 5rem !important; font-size: 1.2rem; font-weight: 700; }
.quantity-input-wrap > span { position: absolute; top: 50%; right: 0.8rem; transform: translateY(-50%); color: #64748b; font-size: 0.8rem; pointer-events: none; }
.entity-form > .form-actions { position: sticky; z-index: 10; bottom: 0; padding: 0.85rem; border: 1px solid rgba(226,232,240,.9); border-radius: 1rem; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); box-shadow: 0 -8px 28px rgba(15,23,42,.08); }

.product-detail { display: grid; gap: 1.2rem; padding: 1.4rem 0; }
.detail-image { aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; color: var(--muted); background: #e8ece8; }
.detail-image img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.detail-image svg { width: 3rem; height: 3rem; }
.detail-content { min-width: 0; }
.detail-status { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding-bottom: 0.8rem; color: var(--muted); font-size: 0.75rem; border-bottom: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.detail-grid div { min-height: 4.5rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.detail-grid div:nth-child(odd) { padding-right: 0.7rem; }
.detail-grid div:nth-child(even) { padding-left: 0.7rem; border-left: 1px solid var(--line); }
.detail-grid dt { color: var(--muted); font-size: 0.72rem; }
.detail-grid dd { margin: 0.25rem 0 0; font-weight: 500; overflow-wrap: anywhere; }
.detail-grid .highlight dd { color: var(--green); font-size: 1.1rem; }
.notes-block { padding: 1rem 0; }
.notes-block p { margin: 0.35rem 0 0; color: #455148; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; border-top: 1px solid #efb8b8; }
.danger-zone h2 { margin: 0; color: #991b1b; font-size: 0.95rem; }
.danger-zone p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.78rem; }

.master-tabs { display: grid; grid-template-columns: 1fr; gap: 0.4rem; padding: 1.2rem 0; border-bottom: 1px solid var(--line); }
.master-tabs a { display: flex; align-items: center; gap: 0.65rem; padding: 0.75rem; border-left: 3px solid transparent; }
.master-tabs a > span { display: grid; }
.master-tabs small { color: var(--muted); font-size: 0.7rem; }
.master-tabs a.active { color: var(--green); background: var(--green-soft); border-left-color: var(--green); }
.master-layout { display: grid; gap: 1.5rem; padding-top: 1rem; }
.master-form-panel { align-self: start; padding-bottom: 1.4rem; border-bottom: 1px solid var(--line); }
.stack-form.compact { gap: 0.4rem; margin-top: 0.6rem; }
.stack-form.compact .form-actions { padding-bottom: 0; }
.master-list { display: grid; border-top: 1px solid var(--line); }
.master-list article { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; grid-template-areas: "icon copy status" "icon actions actions"; align-items: center; gap: 0.35rem 0.7rem; padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.master-icon { grid-area: icon; width: 2.5rem; height: 2.5rem; display: grid; place-items: center; color: var(--green); background: var(--green-soft); }
.master-list article > div:first-of-type { grid-area: copy; min-width: 0; display: grid; }
.master-list article > div:first-of-type strong, .master-list article > div:first-of-type small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.master-list article > div:first-of-type small { color: var(--muted); }
.master-list article > .status-pill { grid-area: status; }
.master-list article > .row-actions { grid-area: actions; justify-self: end; }

@media (min-width: 700px) {
    .login-panel { padding: 2.5rem; background: var(--surface); box-shadow: var(--shadow); }
    .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; }
    .section-title span { display: inline; }
    .filter-bar { grid-template-columns: minmax(15rem, 1fr) 11rem 9rem auto auto; align-items: center; }
    .form-section { grid-template-columns: 13rem minmax(0, 1fr); gap: 1.5rem; }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .form-grid .span-2 { grid-column: span 2; }
    .product-detail { grid-template-columns: minmax(15rem, 0.8fr) minmax(20rem, 1.2fr); }
    .master-tabs { grid-template-columns: repeat(3, 1fr); }
    .master-layout { grid-template-columns: minmax(15rem, 0.65fr) minmax(24rem, 1.35fr); }
    .master-form-panel { padding-right: 1.5rem; padding-bottom: 0; border-right: 1px solid var(--line); border-bottom: 0; }
    .master-list article { grid-template-columns: 2.5rem minmax(0, 1fr) auto auto; grid-template-areas: "icon copy status actions"; }
    .workflow-guide ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .app-shell { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); }
    .sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; padding: 1.25rem 1rem; background: #102719; color: #eaf3ec; }
    .sidebar-brand { display: flex; align-items: center; gap: 0.7rem; padding: 0 0.4rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.12); }
    .sidebar-brand span:last-child { display: grid; }
    .sidebar-brand small { color: #acc0b0; font-size: 0.68rem; }
    .desktop-nav { display: grid; gap: 0.3rem; padding-top: 1.25rem; }
    .desktop-nav a, .desktop-nav > span { display: grid; grid-template-columns: 1.5rem 1fr auto; align-items: center; gap: 0.65rem; min-height: 2.85rem; padding: 0.55rem 0.7rem; color: #bfd0c2; }
    .desktop-nav a.active { color: white; background: #1e4c2e; border-left: 3px solid #70d28b; }
    .desktop-nav .nav-disabled { opacity: 0.55; }
    .desktop-nav small { font-size: 0.55rem; }
    .sidebar-user { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.12); display: grid; grid-template-columns: 2.3rem 1fr auto; align-items: center; gap: 0.55rem; }
    .sidebar-user > span:nth-child(2) { display: grid; min-width: 0; }
    .sidebar-user strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.83rem; }
    .sidebar-user small { color: #acc0b0; font-size: 0.68rem; }
    .avatar { width: 2.3rem; height: 2.3rem; display: grid; place-items: center; color: #12341e; background: #bde6c8; font-weight: 600; }
    .main-column { padding-bottom: 0; }
    .mobile-topbar, .bottom-nav { display: none; }
    .app-content { padding: 2.5rem 3rem; }
    .action-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .product-row { grid-template-columns: 4rem minmax(0, 1fr) 10rem auto; grid-template-areas: "thumb main stock actions"; gap: 1rem; }
    .stock-figure { display: grid; grid-template-columns: auto 1fr; }
    .stock-state { grid-column: 1 / -1; margin-left: 0; }
}

.inline-control { display: flex; gap: .5rem; }
.inline-control input { flex: 1; min-width: 0; }
.field-hint { color: var(--muted); font-size: .75rem; }
.bottom-nav.five-items { grid-template-columns: repeat(5, 1fr); }
.data-list, .movement-list, .issue-cart { display: grid; border-top: 1px solid var(--line); }
.data-row, .movement-row, .issue-line { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; align-items: center; gap: .75rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.data-row-main, .movement-row > div:nth-child(2), .issue-line > div { min-width: 0; display: grid; }
.data-row-main span, .data-row-main small, .movement-row small, .movement-row span, .issue-line span, .issue-line small { color: var(--muted); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; }
.quantity-cell { display: grid; justify-items: end; white-space: nowrap; }
.quantity-cell small { color: var(--muted); font-size: .7rem; }
.summary-grid { display: grid; grid-template-columns: repeat(2,1fr); margin-top: 1rem; }
.summary-grid > div { min-height: 5rem; display: grid; align-content: center; padding: .8rem; border: 1px solid var(--line); }
.summary-grid small, .summary-grid span, .movement-line small, .movement-line time { color: var(--muted); font-size: .72rem; }
.summary-grid .highlight strong { color: var(--green); }
.section-block { margin-top: 1.5rem; border-top: 1px solid var(--line); }
.section-block .section-title a { color: var(--green); font-size: .8rem; }
.movement-line { min-height: 4rem; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .75rem; border-bottom: 1px solid var(--line); }
.movement-line > div, .movement-line > a { min-width: 0; display: grid; }
.movement-type { padding: .22rem .45rem; color: var(--blue); background: var(--blue-soft); font-size: .62rem; font-weight: 600; }
.movement-type.receive, .movement-type.adjustment_in { color: var(--green); background: var(--green-soft); }
.movement-type.issue, .movement-type.adjustment_out { color: var(--orange); background: var(--orange-soft); }
.movement-type.reversal, .movement-type.defect { color: var(--red); background: #fee2e2; }
.scan-workspace, .stock-out-workspace { padding: 1.2rem 0; }
.manual-scan, .create-strip form { display: grid; gap: .45rem; }
.manual-scan input, .create-strip input, .create-strip select, .count-entry input { width: 100%; min-height: 2.85rem; padding: .6rem .7rem; border: 1px solid #cbd4cc; background: #fff; }
.camera-actions { display: flex; align-items: center; gap: .7rem; margin: 1rem 0; }
.camera-panel { position: relative; max-width: 38rem; margin: 1rem auto; background: #111; }
.camera-panel video { width: 100%; max-height: min(42vh, 360px); display: block; object-fit: contain; }
.camera-panel .btn { position: absolute; right: .6rem; bottom: .6rem; }
.camera-status { margin: .55rem 0; color: var(--muted); font-size: .85rem; }
.scan-found { display: grid; gap: .3rem; padding: 1rem; border-left: 4px solid var(--green); background: var(--green-soft); }
.scan-found > div { display: flex; flex-wrap: wrap; gap: .5rem; }
.scanned-code { overflow-wrap: anywhere; user-select: all; }
.scan-metrics { display: grid; grid-template-columns: repeat(2,1fr); margin: 1rem 0; }
.scan-metrics > div { display: grid; padding: .65rem; border-bottom: 1px solid var(--line); }
.scan-metrics small { color: var(--muted); }
.scanner-test-layout, .scan-controls, .scan-modes { display: grid; gap: .65rem; }
.settings-panel, .issue-details, .count-entry { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.scanner-ready-card {
    display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: .8rem;
    margin-bottom: 1rem; padding: .9rem 1rem; color: #065f46; border: 1px solid #a7f3d0;
    border-radius: 1rem; background: linear-gradient(135deg, #ecfdf5, #f0fdfa); box-shadow: var(--shadow-soft);
}
.scanner-ready-card > div { min-width: 0; display: grid; gap: .12rem; }
.scanner-ready-card strong { color: #065f46; }
.scanner-ready-card small { color: #47756b; }
.scanner-ready-card .btn { grid-column: 1 / -1; justify-self: start; background: rgba(255,255,255,.72); }
.scanner-ready-icon {
    position: relative; width: 2.8rem; height: 2.8rem; display: grid; place-items: center;
    color: #0d9488; border-radius: .8rem; background: #fff; box-shadow: 0 4px 12px rgba(13,148,136,.12);
}
.scanner-ready-icon svg { width: 1.35rem; height: 1.35rem; }
.scanner-ready-icon b {
    position: absolute; right: -.12rem; bottom: -.12rem; width: .72rem; height: .72rem;
    border: 2px solid #ecfdf5; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.13);
}
.issue-steps { display: grid; gap: .65rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.issue-steps li {
    display: grid; grid-template-columns: 2rem minmax(0,1fr); align-items: center; gap: .65rem;
    padding: .65rem .75rem; border: 1px solid #e2e8f0; border-radius: .85rem; background: rgba(255,255,255,.76);
}
.issue-steps li > span {
    width: 2rem; height: 2rem; display: grid; place-items: center; color: #fff;
    border-radius: 50%; background: #14b8a6; font-size: .78rem; font-weight: 700;
}
.issue-steps li div { min-width: 0; display: grid; }
.issue-steps strong { color: #334155; font-size: .8rem; }
.issue-steps small { color: #64748b; font-size: .7rem; }
.stock-out-workspace .manual-scan input:focus { border-color: #14b8a6; box-shadow: 0 0 0 4px rgba(20,184,166,.13); }
.scan-modes { grid-template-columns: 1fr; margin: 1rem 0; padding: 0; border: 0; }
.scan-modes legend { margin-bottom: .55rem; color: #334155; font-size: .82rem; font-weight: 700; }
.scan-modes label {
    position: relative; display: flex; align-items: center; gap: .7rem; padding: .75rem;
    border: 1px solid #dbe3ec; border-radius: .85rem; background: #fff; cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.scan-modes label:hover { border-color: #99f6e4; background: #f8fffd; }
.scan-modes label:has(input:checked) { border-color: #2dd4bf; background: #f0fdfa; box-shadow: 0 0 0 3px rgba(20,184,166,.1); }
.scan-modes input { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; accent-color: #0d9488; }
.scan-modes label span { min-width: 0; display: grid; gap: .08rem; }
.scan-modes strong { color: #334155; font-size: .82rem; }
.scan-modes small { color: #64748b; font-size: .7rem; }
.scan-status {
    display: flex; align-items: center; gap: .55rem; min-height: 2.7rem; margin-bottom: .8rem; padding: .65rem .8rem;
    color: #475569; border: 1px solid #e2e8f0; border-radius: .75rem; background: #f8fafc; font-size: .78rem;
}
.scan-status svg { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; }
.scan-status[data-state="loading"] { color: #075985; border-color: #bae6fd; background: #f0f9ff; }
.scan-status[data-state="success"] { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.scan-status[data-state="error"] { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.issue-line { grid-template-columns: minmax(0,1fr) 7rem 2.5rem; }
.issue-line input { width: 100%; min-height: 2.4rem; border: 1px solid #cbd4cc; }
.create-strip { display: grid; gap: 1rem; padding: 1.2rem 0; border-bottom: 1px solid var(--line); }
.create-strip h2, .create-strip p { margin: 0; }
.create-strip p { color: var(--muted); font-size: .8rem; }
.count-entry form { display: grid; grid-template-columns: minmax(0,1fr) minmax(8rem,.5fr) auto auto; align-items: end; gap: .6rem; }
.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; background: #fff; }
.table-wrap th, .table-wrap td { padding: .7rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-wrap th { background: #edf1ed; font-size: .75rem; }
.table-wrap td:first-child { white-space: normal; }
.table-wrap td small { display: block; color: var(--muted); }
.inline-count-form, .reverse-form { display: flex; gap: .35rem; }
.text-success { color: var(--green); font-weight: 600; }
.text-danger { color: var(--red); font-weight: 600; }
.movement-row { grid-template-columns: auto minmax(0,1fr) auto; }
.reverse-form { grid-column: 2 / -1; justify-content: flex-end; }
.history-filter, .report-filter { grid-template-columns: repeat(2,minmax(0,1fr)); }
.wide-content { width: min(100%,92rem); }
.report-tabs { display: flex; gap: .3rem; overflow-x: auto; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.report-tabs a { flex: 0 0 auto; padding: .5rem .65rem; color: var(--muted); border-bottom: 2px solid transparent; font-size: .76rem; }
.report-tabs a.active { color: var(--green); border-color: var(--green); font-weight: 600; }
.label-page {
    min-height: 100vh; margin: 0; padding: 1.25rem; color: #1e293b;
    background: radial-gradient(circle at top, #dff7f3 0, #edf3f7 34rem, #e7edf2 100%);
    font-family: "Noto Sans Thai", Arial, sans-serif;
}
.label-control-panel {
    max-width: 68rem; margin: 0 auto 1rem; overflow: hidden; border: 1px solid rgba(203,213,225,.9);
    border-radius: 1.15rem; background: rgba(255,255,255,.94); box-shadow: 0 18px 45px -24px rgba(15,23,42,.34);
}
.label-toolbar { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 1rem; padding: 1rem; }
.label-toolbar-copy { min-width: 0; display: grid; gap: .08rem; }
.label-toolbar-copy span { color: #0d9488; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.label-toolbar-copy strong { color: #1e293b; font-size: 1rem; }
.label-toolbar-copy small { color: #64748b; font-size: .74rem; }
.label-print-button { min-height: 2.8rem; padding-inline: 1.1rem; }
.label-format-switch { display: flex; gap: .45rem; padding: .75rem 1rem; overflow-x: auto; border-top: 1px solid #eef2f7; border-bottom: 1px solid #eef2f7; background: #f8fafc; }
.label-format-switch a { flex: 0 0 auto; padding: .55rem .75rem; color: #475569; border: 1px solid #dbe3ec; border-radius: .7rem; background: #fff; font-size: .76rem; font-weight: 700; }
.label-format-switch a:hover { color: #0f766e; border-color: #99f6e4; }
.label-format-switch a.active { color: #fff; border-color: #0d9488; background: linear-gradient(135deg,#0d9488,#14b8a6); box-shadow: 0 5px 12px rgba(13,148,136,.18); }
.printer-ready-note { display: grid; gap: .16rem; margin: .85rem 1rem; padding: .75rem .85rem; color: #065f46; border: 1px solid #a7f3d0; border-radius: .75rem; background: #ecfdf5; }
.printer-ready-note strong { font-size: .78rem; }
.printer-ready-note span { color: #47756b; font-size: .7rem; }
.printer-ready-note .printer-size-warning { margin-top: .35rem; padding: .45rem .55rem; color: #9a3412; border-radius: .4rem; background: #fff7ed; font-weight: 700; }
.backup-card { margin-bottom: 1rem; }
.backup-list { margin: .75rem 0 1.25rem; padding-left: 1.5rem; color: #475569; line-height: 1.8; }
.backup-command { overflow-x: auto; margin: .75rem 0; padding: 1rem; border-radius: .75rem; background: #0f172a; color: #e2e8f0; font-size: .82rem; }
.backup-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.printer-help { margin: 0 1rem 1rem; padding: .7rem .85rem; border: 1px solid #dbe3ec; border-radius: .75rem; background: #fff; font-size: .74rem; }
.printer-help summary { color: #334155; font-weight: 700; cursor: pointer; }
.printer-help ol { margin: .7rem 0; padding-left: 1.2rem; color: #64748b; }
.printer-help li + li { margin-top: .3rem; }
.printer-help > div { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.printer-help a { color: #0d9488; font-weight: 700; text-decoration: underline; text-underline-offset: .15rem; }
.label-preview-stage {
    max-width: 68rem; min-height: 38rem; display: grid; align-content: start; justify-items: center; gap: .75rem;
    margin: 0 auto; padding: 1.5rem; border: 1px solid rgba(148,163,184,.35); border-radius: 1.15rem;
    background-color: #cbd5e1; background-image: linear-gradient(45deg,rgba(255,255,255,.2) 25%,transparent 25%),linear-gradient(-45deg,rgba(255,255,255,.2) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,rgba(255,255,255,.2) 75%),linear-gradient(-45deg,transparent 75%,rgba(255,255,255,.2) 75%); background-position: 0 0,0 6px,6px -6px,-6px 0; background-size: 12px 12px;
    box-shadow: inset 0 2px 10px rgba(15,23,42,.08);
}
.label-preview-caption { padding: .38rem .65rem; color: #475569; border: 1px solid rgba(255,255,255,.75); border-radius: 999px; background: rgba(255,255,255,.84); font-size: .68rem; font-weight: 700; }
.thermal-label { box-sizing: border-box; margin: 0; overflow: hidden; color: #050505; background: #fff; font-family: Arial,"Noto Sans Thai",sans-serif; box-shadow: 0 12px 28px rgba(15,23,42,.25); }
.label-40x30 { width: 30mm; height: 40mm; }
.label-100x100 { width: 100mm; height: 100mm; }
.thermal-label-header { grid-area: header; display: flex; align-items: flex-start; justify-content: space-between; gap: 3mm; padding-bottom: 2mm; border-bottom: .4mm solid #000; }
.thermal-label-header > div { display: grid; }
.thermal-label-header span { font-size: 6.5pt; font-weight: 700; letter-spacing: .08em; }
.thermal-label-header strong { font-size: 10pt; }
.thermal-label-header > b { padding: 1.1mm 2mm; color: #fff; background: #000; font-size: 7pt; }
.thermal-product-copy { grid-area: product; min-width: 0; }
.thermal-product-copy h1 { display: -webkit-box; margin: 0; overflow: hidden; font-size: 15pt; line-height: 1.24; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.thermal-product-copy p { margin: 1mm 0 0; color: #222; font-size: 8.5pt; line-height: 1.25; }
.thermal-barcode { grid-area: barcode; min-width: 0; display: grid; align-content: center; justify-items: center; gap: 1mm; overflow: hidden; padding: 2mm 0; border-top: .25mm solid #888; border-bottom: .25mm solid #888; }
.thermal-barcode svg { width: 100%; height: 21mm; display: block; color: #000; shape-rendering: crispEdges; }
.thermal-barcode > strong { max-width: 100%; font-size: 9pt; line-height: 1; letter-spacing: .3mm; overflow-wrap: anywhere; text-align: center; }
.thermal-barcode > small { color: #333; font-size: 6.5pt; }
.thermal-qr { grid-area: qr; display: grid; align-content: center; justify-items: center; gap: 1mm; }
.thermal-qr svg { width: 21mm; height: 21mm; display: block; }
.thermal-qr small { font-size: 6pt; font-weight: 700; letter-spacing: .08em; }
.thermal-details { grid-area: details; min-width: 0; display: grid; align-content: start; gap: 0; margin: 0; }
.thermal-details > div { min-width: 0; display: grid; grid-template-columns: 20mm minmax(0,1fr); gap: 2mm; padding: 2mm 0; border-bottom: .25mm solid #bbb; }
.thermal-details dt { color: #444; font-size: 7.5pt; }
.thermal-details dd { min-width: 0; margin: 0; font-size: 8.5pt; font-weight: 700; overflow-wrap: anywhere; }
.thermal-footer { grid-area: footer; display: flex; align-items: center; justify-content: space-between; gap: 3mm; padding-top: 2mm; border-top: .4mm solid #000; font-size: 7pt; }
.thermal-footer strong { overflow-wrap: anywhere; text-align: right; }
.barcode-fallback { font-size: 8pt; text-align: center; }
.label-error { max-width: 68rem; margin: 0 auto 1rem; padding: .8rem 1rem; color: #991b1b; border: 1px solid #fecaca; border-radius: .75rem; background: #fef2f2; }
.stock-label.label-100x100 { display: grid; grid-template-columns: minmax(0,1fr) 26mm; grid-template-rows: auto auto 30mm minmax(0,1fr) auto; grid-template-areas: "header header" "product product" "barcode barcode" "details qr" "footer footer"; gap: 2.5mm; padding: 5mm; }
.product-barcode-label.label-100x100 { display: grid; grid-template-columns: minmax(0,1fr) 28mm; grid-template-rows: 8mm 13mm 26mm minmax(0,1fr); grid-template-areas: "header header" "product product" "barcode barcode" "details qr"; gap: 1.5mm; padding: 4mm; }
.product-barcode-label.label-100x100 .thermal-label-header { align-items: center; padding-bottom: .8mm; }
.product-barcode-label.label-100x100 .thermal-product-copy h1 { font-size: 12pt; line-height: 1.1; }
.product-barcode-label.label-100x100 .thermal-product-copy p { margin-top: .4mm; font-size: 7pt; }
.product-barcode-label.label-100x100 .thermal-barcode { gap: .8mm; padding: .5mm 0; }
.product-barcode-label.label-100x100 .thermal-barcode svg { height: 17mm; }
.product-barcode-label.label-100x100 .thermal-barcode > strong { font-size: 8pt; letter-spacing: .2mm; }
.product-barcode-label.label-100x100 .thermal-details > div { grid-template-columns: 14mm minmax(0,1fr); gap: 1mm; padding: 1.1mm 0; }
.product-barcode-label.label-100x100 .thermal-details dt { font-size: 7pt; }
.product-barcode-label.label-100x100 .thermal-details dd { font-size: 8pt; }
.product-barcode-label.label-100x100 .thermal-qr { align-content: start; padding-top: 2mm; }
.product-barcode-label.label-100x100 .thermal-qr svg { width: 25mm; height: 25mm; }
.label-100x100 .thermal-barcode svg { height: 23mm; }
.label-100x100 .thermal-qr svg { width: 23mm; height: 23mm; }
.stock-label.label-40x30 { display: grid; grid-template-rows: 5mm 16mm 9mm minmax(0,1fr); grid-template-areas: "product" "qr" "barcode" "details"; gap: .4mm; padding: 1.2mm; }
.product-barcode-label.label-40x30 { display: grid; grid-template-rows: 5.5mm 11mm 15mm minmax(0,1fr); grid-template-areas: "product" "barcode" "qr" "details"; gap: .35mm; padding: 1mm; }
.label-40x30 .thermal-label-header, .label-40x30 .thermal-footer { display: none; }
.label-40x30 .thermal-product-copy h1 { font-size: 6.6pt; line-height: 1.1; white-space: nowrap; text-overflow: ellipsis; }
.label-40x30 .thermal-product-copy p { margin-top: .25mm; overflow: hidden; font-size: 4.8pt; white-space: nowrap; text-overflow: ellipsis; }
.label-40x30 .thermal-barcode { gap: .25mm; padding: .3mm 0; border: 0; }
.label-40x30 .thermal-barcode svg { height: 5.5mm; }
.label-40x30 .thermal-barcode > strong { font-size: 4.8pt; letter-spacing: 0; }
.label-40x30 .thermal-barcode > small { display: none; }
.label-40x30 .thermal-qr { gap: .2mm; }
.label-40x30 .thermal-qr svg { width: 14mm; height: 14mm; }
.label-40x30 .thermal-qr small { display: none; }
.label-40x30 .thermal-details { overflow: hidden; }
.label-40x30 .thermal-details > div { grid-template-columns: 8mm minmax(0,1fr); gap: .5mm; padding: .15mm 0; border: 0; }
.label-40x30 .thermal-details dt, .label-40x30 .thermal-details dd { font-size: 4.3pt; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-40x30 .thermal-details > div:nth-child(n+4) { display: none; }
.product-barcode-label.label-40x30 .thermal-details > div:nth-child(n+2) { display: none; }
.product-barcode-label.label-40x30 .thermal-barcode svg { height: 6.5mm; }
.product-barcode-label.label-40x30 .thermal-barcode > strong { font-size: 5pt; letter-spacing: 0; }
.product-barcode-label.label-40x30 .thermal-qr svg { width: 14mm; height: 14mm; }
@media (min-width:700px) {
    .summary-grid { grid-template-columns: repeat(4,1fr); }
    .scanner-test-layout { grid-template-columns: minmax(0,1.35fr) minmax(17rem,.65fr); }
    .scan-controls { grid-template-columns: minmax(0,1fr) auto; align-items: end; }
    .scanner-ready-card { grid-template-columns: auto minmax(0,1fr) auto; }
    .scanner-ready-card .btn { grid-column: auto; justify-self: end; }
    .issue-steps, .scan-modes { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .scan-modes legend { grid-column: 1 / -1; }
    .create-strip { grid-template-columns: minmax(0,1fr) minmax(26rem,1.4fr); align-items: center; }
    .create-strip form { grid-template-columns: 1fr 1fr auto; }
    .report-filter { grid-template-columns: repeat(2,10rem) minmax(14rem,1fr) minmax(12rem,.8fr) auto; }
}
@media (max-width:699px) {
    .data-row { grid-template-columns: minmax(0,1fr) auto; }
    .data-row .status-pill, .data-row .row-actions { grid-column: 1 / -1; justify-self: start; }
    .count-entry form { grid-template-columns: 1fr 1fr; }
    .movement-row { grid-template-columns: auto minmax(0,1fr); }
    .reverse-form { grid-column: 1 / -1; }
    .label-page { padding: .7rem; }
    .label-toolbar { grid-template-columns: auto minmax(0,1fr); gap: .7rem; }
    .label-toolbar-copy { grid-column: 1 / -1; grid-row: 2; }
    .label-print-button { justify-self: end; }
    .label-preview-stage { min-height: 34rem; padding: 1rem .5rem; overflow-x: auto; }
}
@media print {
    @page { margin: 0; }
    .no-print { display: none !important; }
    html, body.label-page { margin: 0 !important; padding: 0 !important; background: #fff !important; }
    body.label-page { min-height: 0; width: fit-content; }
    .label-preview-stage { min-height: 0; display: block; margin: 0; padding: 0; border: 0; border-radius: 0; background: #fff; box-shadow: none; }
    .thermal-label { margin: 0; break-inside: avoid; page-break-inside: avoid; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Premium teal interface — adapted from the supplied dashboard design. */
:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --ink: #1e293b;
    --muted: #64748b;
    --line: #e2e8f0;
    --green: #0d9488;
    --green-soft: #f0fdfa;
    --blue: #3b82f6;
    --blue-soft: #eff6ff;
    --orange: #f97316;
    --orange-soft: #fff7ed;
    --red: #dc2626;
    --shadow: 0 15px 35px -12px rgba(15, 23, 42, 0.14);
    --shadow-soft: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
    --radius: 1.25rem;
}

html { font-family: "Inter", "Noto Sans Thai", system-ui, -apple-system, sans-serif; background: var(--bg); }
body {
    color: var(--ink);
    background-color: var(--bg);
    background-image:
        radial-gradient(at 0% 0%, rgba(204, 251, 241, 0.9) 0, transparent 42%),
        radial-gradient(at 100% 100%, rgba(219, 234, 254, 0.8) 0, transparent 46%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}
::selection { color: #062925; background: #99f6e4; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.app-body { height: 100vh; overflow: hidden; }
.app-shell { width: 100%; height: 100vh; display: flex; }
.main-column { min-width: 0; height: 100vh; flex: 1; overflow-y: auto; padding-bottom: 0; scroll-behavior: smooth; }

.mobile-backdrop {
    position: fixed; inset: 0; z-index: 80; display: block;
    background: rgba(15, 23, 42, 0.62); backdrop-filter: blur(4px);
    opacity: 0; transition: opacity .3s ease;
}
.mobile-backdrop[hidden] { display: none; }
.mobile-backdrop.is-open { opacity: 1; }
.drawer-open { overflow: hidden; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 90; width: min(18rem, 88vw); height: 100vh;
    display: flex; flex-direction: column; overflow: hidden; padding: 0;
    color: #cbd5e1; background: #0a1917;
    border-right: 1px solid rgba(255,255,255,.06); box-shadow: 0 24px 60px rgba(2, 6, 23, .34);
    transform: translateX(-102%); transition: transform .3s ease;
}
.sidebar.is-open { transform: translateX(0); }
.sidebar-brand {
    min-height: 6rem; display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.75rem;
    color: #fff; border-bottom: 1px solid rgba(255,255,255,.06);
    background: linear-gradient(180deg, rgba(255,255,255,.05), transparent);
}
.sidebar-brand .brand-mark.small {
    width: 3rem; height: 3rem; border-radius: .85rem;
    background: linear-gradient(135deg, #0d9488, #2dd4bf);
    box-shadow: 0 10px 26px rgba(20,184,166,.28);
}
.sidebar-brand .brand-mark.small svg { width: 1.65rem; height: 1.65rem; }
.sidebar-brand > span:last-child { display: grid; min-width: 0; }
.sidebar-brand strong { font-size: 1.08rem; letter-spacing: .015em; white-space: nowrap; }
.sidebar-brand small { display: flex; align-items: center; gap: .45rem; color: rgba(94,234,212,.75); font-size: .63rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-brand small b { width: .45rem; height: .45rem; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,.08); animation: premiumPulse 2.5s ease-in-out infinite; }

.desktop-nav { flex: 1; display: block; overflow-y: auto; padding: 1.2rem 1rem; }
.desktop-nav .nav-section-title {
    position: relative; width: max-content; margin: 1.25rem .75rem .65rem;
    color: rgba(255,255,255,.28); font-size: .63rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
}
.desktop-nav .nav-section-title:first-child { margin-top: .25rem; }
.desktop-nav .nav-section-title::after {
    content: ""; position: absolute; left: calc(100% + .65rem); top: 50%; width: 3rem; height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,.18), transparent);
}
.desktop-nav a {
    position: relative; min-height: 3.15rem; display: grid; grid-template-columns: 1.5rem minmax(0,1fr) auto;
    align-items: center; gap: .85rem; margin: .15rem 0; padding: .7rem .85rem;
    color: rgba(255,255,255,.55); border-radius: .8rem; overflow: hidden;
    transition: color .2s ease, background .2s ease, transform .2s ease;
}
.desktop-nav a::before {
    content: ""; position: absolute; left: 0; top: 50%; width: 4px; height: 0;
    border-radius: 0 4px 4px 0; background: #34d399; transform: translateY(-50%); transition: height .25s ease;
}
.desktop-nav a:hover { color: #fff; background: rgba(255,255,255,.05); transform: translateX(2px); }
.desktop-nav a:hover::before { height: 65%; }
.desktop-nav a.active { color: #fff; background: linear-gradient(90deg, rgba(20,184,166,.17), transparent); }
.desktop-nav a.active::before { height: 100%; }
.desktop-nav a svg { width: 1.2rem; height: 1.2rem; }
.desktop-nav a.active svg { color: #2dd4bf; }
.desktop-nav .nav-new { padding: .14rem .4rem; color: #2dd4bf; background: rgba(20,184,166,.14); border: 1px solid rgba(45,212,191,.2); border-radius: .35rem; font-size: .52rem; font-weight: 700; }

.sidebar-user {
    margin: 0; padding: 1rem; display: grid; grid-template-columns: 2.65rem minmax(0,1fr) 2.2rem;
    align-items: center; gap: .7rem; border-top: 1px solid rgba(255,255,255,.06); background: rgba(0,0,0,.12);
}
.sidebar-user::before { content: ""; position: absolute; }
.sidebar-user .avatar {
    position: relative; width: 2.65rem; height: 2.65rem; display: grid; place-items: center;
    color: #fff; background: linear-gradient(135deg, #2dd4bf, #0d9488); border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255,255,255,.08);
}
.sidebar-user .avatar i { position: absolute; right: 0; bottom: 0; width: .7rem; height: .7rem; border: 2px solid #0a1917; border-radius: 50%; background: #4ade80; }
.sidebar-user > span:nth-child(2) { display: grid; min-width: 0; }
.sidebar-user strong { overflow: hidden; color: #fff; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { overflow: hidden; color: rgba(255,255,255,.38); font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user form { margin: 0; }
.sidebar-user button { width: 2.15rem; height: 2.15rem; display: grid; place-items: center; padding: 0; color: rgba(255,255,255,.42); border: 0; border-radius: .6rem; background: transparent; }
.sidebar-user button:hover { color: #fff; background: rgba(255,255,255,.08); }

.topbar {
    position: sticky; top: 0; z-index: 50; min-height: 4.5rem; display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid rgba(226,232,240,.72);
    background: rgba(255,255,255,.82); backdrop-filter: blur(14px); box-shadow: 0 2px 12px rgba(15,23,42,.04);
}
.topbar-leading, .topbar-actions { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.mobile-menu-button {
    width: 2.65rem; height: 2.65rem; display: grid; place-items: center; flex: 0 0 auto;
    color: #64748b; background: transparent; border: 0; border-radius: .8rem; cursor: pointer;
}
.mobile-menu-button:hover { color: var(--green); background: #f1f5f9; }
.mobile-brand { display: flex; align-items: center; gap: .55rem; min-width: 0; color: #1e293b; }
.mobile-brand svg { color: #14b8a6; }
.mobile-brand strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb { display: none; align-items: center; gap: .65rem; color: #cbd5e1; font-size: .8rem; }
.breadcrumb svg { width: 1rem; color: #94a3b8; }
.breadcrumb strong { color: #334155; font-weight: 600; }
.global-search { position: relative; display: none; }
.global-search svg { position: absolute; left: .85rem; top: 50%; width: 1rem; color: #94a3b8; transform: translateY(-50%); pointer-events: none; }
.global-search input { width: 17rem; min-height: 2.55rem; padding: .55rem .9rem .55rem 2.45rem; color: #334155; border: 1px solid #e2e8f0; border-radius: 999px; outline: 0; background: rgba(248,250,252,.7); }
.global-search input:focus { border-color: #2dd4bf; background: #fff; box-shadow: 0 0 0 3px rgba(20,184,166,.12); }
.topbar-role { display: none; align-items: center; gap: .5rem; padding: .45rem .8rem; color: #047857; border: 1px solid #d1fae5; border-radius: 999px; background: #ecfdf5; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.topbar-role i { width: .42rem; height: .42rem; border-radius: 50%; background: #10b981; }

.app-content { width: min(100%, 88rem); margin: 0 auto; padding: 1.5rem 1rem 3rem; animation: premiumFadeUp .45s ease-out both; }
.wide-content { width: min(100%, 92rem); }
.page-heading { padding: .35rem 0 1.35rem; border: 0; }
.page-heading .eyebrow { display: flex; align-items: center; margin: 0 0 .35rem; color: #0d9488; font-size: .86rem; font-weight: 600; letter-spacing: 0; }
.page-heading h1 { margin: 0; color: #1e293b; font-size: clamp(1.8rem, 5vw, 2.5rem); font-weight: 800; letter-spacing: -.025em; }
.hello-wave { display: inline-block; margin-left: .35rem; font-size: 1.1rem; transform-origin: bottom right; }
.hello-wave:hover { animation: premiumWave .7s ease-in-out; }
.role-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .42rem .75rem; color: #047857; border: 1px solid #d1fae5; border-radius: 999px; background: #ecfdf5; box-shadow: 0 2px 5px rgba(15,23,42,.03); }

.alert {
    position: relative; min-height: 4rem; align-items: center; gap: .9rem; margin: .75rem 0; padding: .85rem 1rem;
    border: 1px solid; border-left-width: 5px; border-radius: 1rem; box-shadow: 0 2px 8px rgba(15,23,42,.03);
    transition: opacity .25s ease, transform .25s ease;
}
.alert.is-closing { opacity: 0; transform: translateY(-8px); }
.alert .alert-icon { width: 2.5rem; height: 2.5rem; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; }
.alert .alert-icon svg { margin: 0; }
.alert > button { width: 2rem; height: 2rem; display: grid; place-items: center; margin-left: auto; padding: 0; color: currentColor; border: 0; border-radius: .55rem; background: transparent; opacity: .5; cursor: pointer; }
.alert > button:hover { opacity: 1; background: rgba(255,255,255,.45); }
.alert-success { color: #065f46; border-color: #a7f3d0; border-left-color: #10b981; background: rgba(236,253,245,.88); }
.alert-success .alert-icon { color: #059669; background: #d1fae5; }
.alert-warning { color: #92400e; border-color: #fde68a; border-left-color: #f59e0b; background: rgba(255,251,235,.9); }
.alert-warning .alert-icon { color: #d97706; background: #fef3c7; }
.alert-error { color: #991b1b; border-color: #fecaca; border-left-color: #ef4444; background: rgba(254,242,242,.92); }

.section-title { align-items: flex-end; margin: 2rem 0 1rem; }
.section-title h2, .status-strip h2 { color: #1e293b; font-size: 1.2rem; font-weight: 700; }
.section-title span { padding: .35rem .65rem; color: #64748b; border: 1px solid #e2e8f0; border-radius: 999px; background: rgba(248,250,252,.8); }
.action-grid { grid-template-columns: 1fr; gap: 1rem; border: 0; }
.action-item {
    position: relative; min-height: 7rem; grid-template-columns: 4rem minmax(0,1fr) 2.5rem; gap: 1rem;
    padding: 1.25rem; overflow: hidden; border: 1px solid #f1f5f9; border-radius: 1.4rem;
    background: #fff; box-shadow: var(--shadow-soft); transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.action-item::before { content: ""; position: absolute; inset: 0; opacity: 0; background: linear-gradient(90deg, var(--card-tint, #f0fdfa), transparent); transition: opacity .3s ease; }
.action-item.available:hover { transform: translateY(-4px) scale(1.005); border-color: var(--card-border, #ccfbf1); background: #fff; box-shadow: 0 18px 34px -12px rgba(15,23,42,.16); }
.action-item.available:hover::before { opacity: .7; }
.action-item > * { position: relative; z-index: 1; }
.action-icon { width: 4rem; height: 4rem; border-radius: 1rem; transition: transform .35s ease, color .3s ease, background .3s ease; }
.action-icon svg { width: 1.7rem; height: 1.7rem; }
.action-item:hover .action-icon { color: #fff; transform: scale(1.08) rotate(4deg); box-shadow: 0 8px 20px color-mix(in srgb, currentColor 25%, transparent); }
.action-copy { gap: .25rem; }
.action-copy strong { color: #1e293b; font-size: 1.05rem; }
.action-copy small { color: #64748b; font-size: .8rem; }
.action-item > svg { width: 2.5rem; height: 2.5rem; padding: .75rem; color: #94a3b8; border-radius: 50%; background: #f8fafc; transition: color .25s ease, background .25s ease, transform .25s ease; }
.action-item:hover > svg { color: var(--tone, #0d9488); background: var(--card-tint, #f0fdfa); transform: translateX(3px); }
.tone-blue { --tone: #3b82f6; --card-tint: #eff6ff; --card-border: #bfdbfe; }
.tone-green { --tone: #10b981; --card-tint: #ecfdf5; --card-border: #a7f3d0; }
.tone-orange { --tone: #f97316; --card-tint: #fff7ed; --card-border: #fed7aa; }
.tone-indigo { --tone: #4f46e5; --card-tint: #eef2ff; --card-border: #c7d2fe; }
.tone-purple { --tone: #a855f7; --card-tint: #faf5ff; --card-border: #e9d5ff; }
.tone-blue .action-icon { color: #3b82f6; background: #eff6ff; }
.tone-green .action-icon { color: #10b981; background: #ecfdf5; }
.tone-orange .action-icon { color: #f97316; background: #fff7ed; }
.tone-indigo .action-icon { color: #4f46e5; background: #eef2ff; }
.tone-purple .action-icon { color: #a855f7; background: #faf5ff; }
.tone-blue:hover .action-icon { background: #3b82f6; }
.tone-green:hover .action-icon { background: #10b981; }
.tone-orange:hover .action-icon { background: #f97316; }
.tone-indigo:hover .action-icon { background: #4f46e5; }
.tone-purple:hover .action-icon { background: #a855f7; }

.status-strip {
    position: relative; justify-content: flex-start; margin-top: 2rem; padding: 1.15rem; overflow: hidden;
    border: 1px solid rgba(226,232,240,.75); border-radius: 1rem;
    background: rgba(255,255,255,.78); backdrop-filter: blur(12px); box-shadow: var(--shadow-soft);
}
.status-strip::before { content: ""; position: absolute; left: -2rem; top: -2rem; width: 9rem; height: 9rem; border-radius: 50%; background: rgba(204,251,241,.55); filter: blur(2px); }
.status-server { position: relative; width: 2.7rem; height: 2.7rem; display: grid; place-items: center; flex: 0 0 auto; color: #14b8a6; border-radius: 50%; background: #f0fdfa; }
.status-copy { position: relative; min-width: 0; }
.status-online { position: relative; margin-left: auto; padding: .55rem .8rem; color: #059669; border: 1px solid #f1f5f9; border-radius: .75rem; background: #fff; box-shadow: 0 2px 6px rgba(15,23,42,.04); }
.status-online span { position: relative; background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.12); }

.btn { border-radius: .75rem; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #0d9488, #14b8a6); box-shadow: 0 8px 18px rgba(13,148,136,.18); }
.btn-primary:hover { background: linear-gradient(135deg, #0f766e, #0d9488); box-shadow: 0 10px 22px rgba(13,148,136,.24); }
.btn-secondary { color: #334155; background: #f1f5f9; border-color: #e2e8f0; }
.btn-secondary:hover, .btn-ghost:hover { background: #e2e8f0; }
.btn-ghost { color: #475569; border-color: #e2e8f0; }
.btn-danger { background: linear-gradient(135deg, #dc2626, #ef4444); }

.filter-bar,
.product-list,
.data-list,
.movement-list,
.issue-cart,
.entity-form,
.product-detail,
.master-tabs,
.master-layout,
.scan-workspace,
.stock-out-workspace,
.scanner-test-layout,
.create-strip,
.table-wrap,
.report-tabs,
.count-entry,
.section-block {
    border: 1px solid rgba(226,232,240,.8); border-radius: var(--radius);
    background: rgba(255,255,255,.92); box-shadow: var(--shadow-soft);
}
.filter-bar { margin: 1rem 0; padding: 1rem; border-bottom: 1px solid rgba(226,232,240,.8); }
.filter-bar input, .filter-bar select, .field input, .field select, .field textarea,
.stack-form.compact input, .stack-form.compact select, .stack-form.compact textarea,
.manual-scan input, .create-strip input, .create-strip select, .count-entry input, .issue-line input {
    border-color: #dbe3ec; border-radius: .7rem; background: #fff;
}
.filter-bar input:focus, .filter-bar select:focus, .field input:focus, .field select:focus, .field textarea:focus,
.stack-form.compact input:focus, .stack-form.compact select:focus, .stack-form.compact textarea:focus {
    border-color: #2dd4bf; box-shadow: 0 0 0 3px rgba(20,184,166,.12);
}
.product-list, .data-list, .movement-list, .issue-cart { padding: .3rem 1rem; border-top: 1px solid rgba(226,232,240,.8); }
.product-row, .data-row, .movement-row, .issue-line { border-color: #edf2f7; }
.product-thumb, .image-preview, .detail-image { border-radius: .85rem; background: #f1f5f9; }
.status-pill, .movement-type { border-radius: 999px; }
.status-pill.active { color: #047857; background: #d1fae5; }
.icon-btn { border-radius: .65rem; }
.icon-btn:hover { background: #f0fdfa; }
.desktop-nav a.active { border-left: 0; }
.empty-state { border: 1px dashed #cbd5e1; border-radius: var(--radius); background: rgba(255,255,255,.7); }
.pagination a { border-radius: .65rem; }
.pagination a.active { background: linear-gradient(135deg, #0d9488, #14b8a6); border-color: #0d9488; }

.entity-form { gap: 1rem; padding: 1rem; background: transparent; border: 0; box-shadow: none; }
.form-section { padding: 1.25rem; border: 1px solid rgba(226,232,240,.8); border-radius: 1rem; background: rgba(255,255,255,.94); box-shadow: var(--shadow-soft); }
.form-section-heading > span { border-radius: .55rem; background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.form-section-primary { border-color: #99f6e4; }
.quantity-field label { color: #0f766e; font-size: 0.95rem; }
.product-detail { padding: 1.25rem; }
.detail-status, .detail-grid div, .danger-zone { border-color: #edf2f7; }
.master-tabs { padding: .7rem; }
.master-tabs a { border-radius: .75rem; border-left: 0; }
.master-tabs a.active { color: #0f766e; background: #f0fdfa; border-left: 0; }
.master-layout { padding: 1.2rem; }
.master-form-panel { border-color: #edf2f7; }
.master-list, .master-list article { border-color: #edf2f7; }
.master-icon { border-radius: .7rem; color: #0d9488; background: #f0fdfa; }
.summary-grid { gap: .7rem; }
.summary-grid > div { border-color: #e2e8f0; border-radius: .9rem; background: rgba(255,255,255,.9); box-shadow: 0 2px 8px rgba(15,23,42,.03); }
.section-block { padding: 1rem; border-top: 1px solid rgba(226,232,240,.8); }
.scan-workspace, .stock-out-workspace, .scanner-test-layout, .create-strip, .count-entry { padding: 1.2rem; }
.settings-panel, .issue-details { border-color: #edf2f7; }
.camera-panel { overflow: hidden; border-radius: 1rem; box-shadow: var(--shadow); }
.scan-found { border-radius: .8rem; border-left-color: #14b8a6; background: #f0fdfa; }
.scan-metrics > div { border-color: #edf2f7; }
.table-wrap { overflow: auto; }
.table-wrap table { background: transparent; }
.table-wrap th { color: #475569; background: #f8fafc; }
.table-wrap th, .table-wrap td { border-color: #edf2f7; }
.report-tabs { padding: .65rem; border-bottom: 1px solid rgba(226,232,240,.8); }
.report-tabs a { border-radius: .6rem; border-bottom: 0; }
.report-tabs a.active { color: #0f766e; background: #f0fdfa; }

.auth-body { background-color: #0f172a; background-image: radial-gradient(at 20% 15%, rgba(20,184,166,.28), transparent 40%), radial-gradient(at 85% 85%, rgba(59,130,246,.18), transparent 45%); }
.login-shell { padding: 1.25rem; }
.login-panel {
    position: relative; width: min(100%, 28rem); padding: 2rem; overflow: hidden;
    border: 1px solid rgba(255,255,255,.72); border-radius: 1.5rem;
    background: rgba(255,255,255,.92); backdrop-filter: blur(16px); box-shadow: 0 28px 70px rgba(2,6,23,.32);
}
.login-panel::before { content: ""; position: absolute; right: -4rem; top: -4rem; width: 11rem; height: 11rem; border-radius: 50%; background: rgba(153,246,228,.35); }
.login-panel > * { position: relative; }
.login-panel .brand-mark { border-radius: 1rem; background: linear-gradient(135deg, #0d9488, #2dd4bf); box-shadow: 0 10px 24px rgba(20,184,166,.25); }
.input-with-icon input { border-color: #dbe3ec; border-radius: .8rem; }
.input-with-icon input:focus { border-color: #2dd4bf; box-shadow: 0 0 0 3px rgba(20,184,166,.12); }

@keyframes premiumFadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes premiumPulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes premiumWave { 0%,100% { transform: rotate(0); } 30% { transform: rotate(18deg); } 65% { transform: rotate(-8deg); } }

@media (min-width: 640px) {
    .topbar { padding-inline: 1.5rem; }
    .topbar-role { display: inline-flex; }
    .app-content { padding: 2rem 2rem 4rem; }
    .action-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (min-width: 768px) {
    .global-search { display: block; }
    .section-title span { display: inline-flex; }
}

@media (min-width: 1024px) {
    .mobile-backdrop { display: none !important; }
    .sidebar { position: relative; inset: auto; width: 18rem; flex: 0 0 18rem; transform: none; box-shadow: none; }
    .main-column { padding-bottom: 0; }
    .mobile-menu-button, .mobile-brand { display: none; }
    .breadcrumb { display: flex; }
    .topbar { min-height: 4.75rem; padding-inline: 2rem; }
    .app-content { padding: 2.5rem 3rem 4rem; }
    .action-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1.25rem; }
}

@media (max-width: 639px) {
    .topbar-role { display: none; }
    .page-heading { align-items: flex-start; }
    .page-heading .role-badge { margin-top: .2rem; }
    .section-title { align-items: flex-start; }
    .action-item { min-height: 6.25rem; grid-template-columns: 3.4rem minmax(0,1fr) 2.25rem; gap: .75rem; padding: 1rem; }
    .action-icon { width: 3.4rem; height: 3.4rem; }
    .action-item > svg { width: 2.25rem; height: 2.25rem; padding: .65rem; }
    .status-strip { flex-wrap: wrap; }
    .status-online { margin-left: 3.4rem; }
    .filter-bar, .product-list, .data-list, .movement-list, .issue-cart, .scan-workspace, .stock-out-workspace, .scanner-test-layout, .create-strip, .count-entry { border-radius: 1rem; }
}

/* Task-first navigation and simplified daily workflow. */
.page-intro { max-width: 38rem; margin: .55rem 0 0; color: #64748b; font-size: .92rem; line-height: 1.65; }
.home-scan-card {
    padding: 1.25rem; border: 1px solid #99f6e4; border-radius: 1.25rem;
    background: linear-gradient(135deg, rgba(240,253,250,.96), rgba(255,255,255,.96));
    box-shadow: 0 14px 32px -18px rgba(13,148,136,.38);
}
.home-scan-heading { display: flex; align-items: center; gap: .85rem; margin-bottom: 1rem; }
.home-scan-heading h2 { margin: 0; color: #134e4a; font-size: 1.08rem; font-weight: 750; }
.home-scan-heading p { margin: .2rem 0 0; color: #64748b; font-size: .78rem; }
.home-scan-icon { width: 2.9rem; height: 2.9rem; display: grid; place-items: center; flex: 0 0 auto; color: #0f766e; border-radius: .85rem; background: #ccfbf1; }
.home-scan-form { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .65rem; }
.home-scan-form > svg { position: absolute; left: 1rem; top: 50%; width: 1.15rem; color: #94a3b8; transform: translateY(-50%); pointer-events: none; }
.home-scan-form input { width: 100%; min-height: 3.15rem; padding: .75rem 1rem .75rem 2.8rem; color: #1e293b; border: 1px solid #cbd5e1; border-radius: .85rem; outline: none; background: #fff; }
.home-scan-form input:focus { border-color: #14b8a6; box-shadow: 0 0 0 4px rgba(20,184,166,.12); }
.home-scan-form .btn { min-width: 6rem; }
.home-scan-hint { display: flex; align-items: center; gap: .4rem; margin: .75rem 0 0; color: #64748b; font-size: .73rem; }
.home-scan-hint svg { width: .9rem; }

.simple-section-title { margin-top: 1.75rem; align-items: flex-start; }
.simple-section-title p { margin: 0 0 .2rem; color: #0d9488; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.simple-section-title h2 { margin: 0; }
.primary-task-grid { display: grid; grid-template-columns: 1fr; gap: .85rem; }
.primary-task {
    --task-color: #0d9488; --task-bg: #f0fdfa; --task-line: #99f6e4;
    min-height: 7.25rem; display: grid; grid-template-columns: 3.75rem minmax(0,1fr) 2rem;
    align-items: center; gap: 1rem; padding: 1.15rem; color: #1e293b;
    border: 1px solid var(--task-line); border-radius: 1.15rem; background: #fff;
    box-shadow: var(--shadow-soft); transition: transform .2s ease, box-shadow .2s ease;
}
.primary-task:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.primary-task-icon { width: 3.75rem; height: 3.75rem; display: grid; place-items: center; color: var(--task-color); border-radius: 1rem; background: var(--task-bg); }
.primary-task-icon svg { width: 1.75rem; height: 1.75rem; }
.primary-task > span:nth-child(2) { display: grid; gap: .3rem; }
.primary-task strong { font-size: 1.08rem; }
.primary-task small { color: #64748b; font-size: .78rem; line-height: 1.5; }
.primary-task > svg { width: 1.15rem; color: var(--task-color); }
.task-receive { --task-color: #059669; --task-bg: #ecfdf5; --task-line: #a7f3d0; }
.task-issue { --task-color: #ea580c; --task-bg: #fff7ed; --task-line: #fed7aa; }
.task-stock { --task-color: #4f46e5; --task-bg: #eef2ff; --task-line: #c7d2fe; }

.secondary-tools { margin-top: .25rem; }
.secondary-tool-grid { display: grid; grid-template-columns: 1fr; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 1rem; background: rgba(255,255,255,.9); box-shadow: var(--shadow-soft); }
.secondary-tool-grid > a { min-height: 4.75rem; display: grid; grid-template-columns: 2.5rem minmax(0,1fr) 1rem; align-items: center; gap: .8rem; padding: .85rem 1rem; color: #334155; border-bottom: 1px solid #edf2f7; }
.secondary-tool-grid > a:last-child { border-bottom: 0; }
.secondary-tool-grid > a > svg:first-child { width: 1.15rem; color: #0d9488; }
.secondary-tool-grid > a > svg:last-child { width: 1rem; color: #94a3b8; }
.secondary-tool-grid span { display: grid; gap: .15rem; }
.secondary-tool-grid strong { font-size: .9rem; }
.secondary-tool-grid small { color: #64748b; font-size: .72rem; }
.secondary-tool-grid > a:hover { background: #f8fafc; }

.optional-details { padding: 0; overflow: hidden; }
.optional-details > summary { min-height: 4.5rem; display: grid; grid-template-columns: 2.5rem minmax(0,1fr) 1.25rem; align-items: center; gap: .75rem; padding: 1rem 1.25rem; cursor: pointer; list-style: none; }
.optional-details > summary::-webkit-details-marker { display: none; }
.optional-details > summary > span:first-child { width: 2.5rem; height: 2.5rem; display: grid; place-items: center; color: #0f766e; border-radius: .7rem; background: #f0fdfa; }
.optional-details > summary > span:nth-child(2) { display: grid; gap: .15rem; }
.optional-details > summary strong { color: #334155; font-size: .95rem; }
.optional-details > summary small { color: #64748b; font-size: .72rem; }
.optional-details > summary > svg { width: 1.1rem; color: #94a3b8; transition: transform .2s ease; }
.optional-details[open] > summary > svg { transform: rotate(180deg); }
.optional-details-content { padding: 0 1.25rem 1.25rem; border-top: 1px solid #edf2f7; }

.simple-bottom-nav { grid-template-columns: repeat(5, minmax(0,1fr)); }
.simple-bottom-nav button { min-height: 3.45rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; padding: 0; color: #727b74; border: 0; background: transparent; font-size: .68rem; cursor: pointer; }
.simple-bottom-nav button.active { color: var(--green); }
.simple-bottom-nav button svg { width: 1.25rem; height: 1.25rem; }
.simple-bottom-nav b { font-weight: 500; }
.primary-task:focus-visible, .secondary-tool-grid > a:focus-visible, .simple-bottom-nav a:focus-visible, .simple-bottom-nav button:focus-visible { outline: 3px solid rgba(20,184,166,.35); outline-offset: 2px; }

@media (min-width: 640px) {
    .home-scan-card { padding: 1.5rem; }
    .primary-task-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .primary-task { min-height: 11rem; grid-template-columns: 1fr 1.5rem; align-content: center; }
    .primary-task-icon { grid-column: 1 / -1; }
    .secondary-tool-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .secondary-tool-grid > a { border-right: 1px solid #edf2f7; border-bottom: 0; }
    .secondary-tool-grid > a:last-child { border-right: 0; }
}

@media (max-width: 1023px) {
    .main-column { padding-bottom: 5.25rem; }
}

@media (max-width: 480px) {
    .home-scan-form { grid-template-columns: 1fr; }
    .home-scan-form > svg { top: 1.58rem; }
    .home-scan-form .btn { min-height: 3rem; }
}
