/* Structure and business-specific styles. Materio tokens/variants live in theme-materio.css. */
*{box-sizing:border-box}
    body{margin:0;font-family:'IBM Plex Sans Thai',system-ui,-apple-system,'Segoe UI',sans-serif;background:#f4f7f5;color:#0f172a}
    body.sidebar-open{overflow:hidden}
    h1,h2,h3{font-family:'Space Grotesk','IBM Plex Sans Thai',sans-serif;margin:0}
    .hidden{display:none!important}
    .loading-splash{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:20px;background:rgba(15,23,42,.72);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px)}
    .loading-splash-card{width:min(360px,calc(100vw - 40px));padding:34px 28px 30px;background:rgba(255,255,255,.97);border:1px solid rgba(255,255,255,.7);border-radius:24px;box-shadow:0 28px 70px rgba(15,23,42,.28);text-align:center}
    .loading-splash-logo{width:154px;height:154px;margin:0 auto 20px;border-radius:24px;overflow:hidden;background:#1a2f6b;display:grid;place-items:center}
    .loading-splash-logo img{width:100%;height:100%;object-fit:cover;display:block}
    .loading-splash-title{margin:0;color:#0f172a;font-size:22px;font-weight:700}
    .loading-splash-lead{margin:8px 0 18px;color:#64748b;font-size:14px}
    .loading-dots{display:flex;justify-content:center;gap:6px}
    .loading-dot{width:7px;height:7px;border-radius:50%;background:#0f766e;animation:loading-dot-pulse 1.1s infinite ease-in-out}
    .loading-dot:nth-child(2){animation-delay:.15s}
    .loading-dot:nth-child(3){animation-delay:.3s}
    @keyframes loading-dot-pulse{0%,80%,100%{opacity:.25;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}
    @media(max-width:640px){.loading-splash-card{padding:28px 22px 24px}.loading-splash-logo{width:128px;height:128px}}
    @media(prefers-reduced-motion:reduce){.loading-dot{animation:none;opacity:.7}}
    .host-main{display:flex;min-height:100vh}
    .topbar{display:none;align-items:center;gap:10px;padding:10px 14px;background:#fff;border-bottom:1px solid #e2e8f0;position:sticky;top:0;z-index:30}
    .topbar button{background:none;border:1px solid #e2e8f0;border-radius:10px;padding:6px;display:grid;place-items:center;cursor:pointer;color:#0f172a}
    .topbar button svg{width:22px;height:22px}
    .topbar-title{font-weight:600}
    .main-content{flex:1;min-width:0;padding:22px 26px 60px}
    .host-toolbar{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end;justify-content:space-between;margin-bottom:18px}
    .page-title{font-size:24px;font-weight:700}
    .page-subtitle{color:#64748b;font-size:13px;margin-top:4px}
    .host-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
    .host-btn{background:#0f766e;color:#fff;border:0;border-radius:10px;padding:9px 16px;font:inherit;font-weight:600;cursor:pointer}
    .host-btn:hover{background:#0d5f58}
    .host-btn:disabled{opacity:.55;cursor:not-allowed}
    .host-btn.ghost{background:#fff;color:#0f172a;border:1px solid #e2e8f0}
    .host-btn.ghost:hover{background:#f1f5f9}
    .host-btn.danger{background:#dc2626}
    .host-btn.danger:hover{background:#b91c1c}
    .host-btn.sm{padding:5px 11px;font-size:13px;border-radius:8px}
    .host-status{display:inline-flex;align-items:center;gap:6px;background:#ecfdf5;color:#047857;border:1px solid #a7f3d0;border-radius:999px;padding:4px 12px;font-size:12px;font-weight:600}
    .host-status.pending{background:#fef9c3;color:#854d0e;border-color:#fde68a}
    .host-status.danger{background:#fee2e2;color:#b91c1c;border-color:#fecaca}
    .host-muted{color:#64748b;font-size:13px}
    .host-input,.host-select{width:100%;padding:10px 12px;border:1px solid #cbd5e1;border-radius:10px;font:inherit;background:#fff;margin-top:6px}
    .host-input:focus,.host-select:focus{outline:2px solid #99f6e4;border-color:#0f766e}
    .host-panel{background:#fff;border:1px solid #e2e8f0;border-radius:16px;padding:20px;box-shadow:0 18px 40px -34px rgba(15,23,42,.45)}
    .card-title{font-size:16px;font-weight:700;margin-bottom:4px}
    .sidebar{width:290px;flex-shrink:0;background:#fff;border-right:1px solid #e2e8f0;display:flex;min-height:100vh;position:sticky;top:0;height:100vh}
    .sidebar-rail-menu{width:64px;flex-shrink:0;background:#0f172a;display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px 0}
    .sidebar-rail-brand{width:38px;height:38px;border-radius:10px;display:grid;place-items:center;overflow:hidden;background:#1a2f6b}
    .sidebar-rail-brand .logo-icon{display:grid;place-items:center;width:100%;height:100%;font-weight:700;color:#0f766e;font-size:15px}
    /* โลโก้บริษัท: เต็มกรอบไม่บิดสัดส่วน (โลโก้เป็นสี่เหลี่ยมจัตุรัสอยู่แล้ว) */
    .logo-img{width:100%;height:100%;object-fit:cover;display:block}
    .sidebar-rail-divider{width:26px;height:1px;background:rgba(255,255,255,.18);margin:6px 0}
    .sidebar-rail-btn{width:42px;height:42px;border:0;border-radius:12px;background:transparent;color:#94a3b8;display:grid;place-items:center;cursor:pointer}
    .sidebar-rail-btn:hover{background:rgba(255,255,255,.08);color:#fff}
    .sidebar-rail-btn.active{background:#0f766e;color:#fff}
    .menu-svg{width:20px;height:20px;display:block}
    .sidebar-nav{flex:1;min-width:0;display:flex;flex-direction:column;overflow-y:auto}
    .nav-section{border-bottom:1px solid #f1f5f9}
    .nav-section-trigger{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;background:none;border:0;font:inherit;font-weight:700;font-size:13px;color:#0f172a;padding:14px 16px;cursor:pointer;text-align:left}
    .nav-chevron{color:#94a3b8;transition:transform .18s}
    .nav-section.open .nav-chevron{transform:rotate(180deg)}
    .nav-menu{list-style:none;margin:0;padding:0 10px 10px;display:none}
    .nav-section.open .nav-menu{display:block}
    .nav-link{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:10px;color:#334155;text-decoration:none;font-size:14px}
    .nav-link:hover{background:#f1f5f9}
    .nav-link.active{background:#0f766e;color:#fff;font-weight:600}
    .nav-icon{display:grid;place-items:center;color:currentColor}
    .sidebar-account-card{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 16px;border-bottom:1px solid #f1f5f9}
    .sidebar-account-card>div:first-child{min-width:0}
    .user-name{font-weight:700;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
    .user-role{color:#64748b;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
    .sidebar-logout{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;gap:5px;background:#fff;border:1px solid #e2e8f0;border-radius:9px;padding:6px 9px;min-height:34px;font:inherit;font-size:12px;font-weight:600;color:#b91c1c;cursor:pointer;line-height:1}
    .sidebar-logout svg{width:15px;height:15px;flex-shrink:0}
    .sidebar-logout:hover{background:#fef2f2;border-color:#fecaca}
    .sidebar-logout:focus-visible{outline:2px solid #fecaca;outline-offset:1px}
    .sidebar-scrim{display:none;position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:35}
    .host-login{min-height:100vh;display:grid;grid-template-columns:minmax(0,1.05fr) minmax(360px,.7fr);background:#f4f7f5}
    .host-login-hero{position:relative;background:linear-gradient(150deg,#0f172a,#0f766e);color:#fff;padding:48px 46px;display:flex;flex-direction:column;justify-content:space-between;gap:26px}
    .host-brand{display:flex;align-items:center;gap:12px;font-weight:700;font-size:18px}
    .host-logo{width:44px;height:44px;border-radius:12px;background:#1a2f6b;display:grid;place-items:center;color:#0f766e;font-weight:700;overflow:hidden;font-size:13px}
    .host-hero-copy h1{font-size:40px;line-height:1.15;margin-bottom:14px}
    .host-hero-copy p{color:rgba(255,255,255,.82);max-width:38ch;line-height:1.65}
    .host-login-hero .host-status{background:rgba(255,255,255,.14);color:#fff;border-color:rgba(255,255,255,.28);align-self:flex-start}
    .host-login-card{display:grid;place-items:center;padding:32px}
    .host-login-form{width:100%;max-width:380px;background:#fff;border:1px solid #e2e8f0;border-radius:18px;padding:28px;box-shadow:0 30px 60px -46px rgba(15,23,42,.6)}
    .host-login-form h2{font-size:22px;margin-bottom:6px}
    .host-login-form>p{color:#64748b;font-size:13px;margin:0}
    .host-form-grid{display:grid;gap:14px}
    .host-form-grid label{font-size:13px;font-weight:600;color:#334155}
    .login-password-wrap{position:relative;display:block}
    .login-password-toggle{position:absolute;right:8px;top:calc(50% + 3px);transform:translateY(-50%);background:none;border:0;color:#0f766e;font:inherit;font-size:12px;font-weight:600;cursor:pointer;padding:4px 6px}
    .host-warn{background:#fffbeb;border:1px solid #fde68a;color:#92400e;border-radius:10px;padding:10px 12px;font-size:13px;margin-top:14px}
    .empty-state{background:#fff;border:1px dashed #cbd5e1;border-radius:16px;padding:46px 24px;text-align:center;color:#64748b}
    .empty-state h2{font-size:17px;color:#0f172a;margin-bottom:8px}
    .empty-state p{margin:0 auto;max-width:46ch;line-height:1.7;font-size:14px}
    .stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:14px;margin-bottom:20px}
    .stat-card{background:#fff;border:1px solid #e2e8f0;border-radius:16px;padding:18px}
    .stat-card .stat-label{color:#64748b;font-size:13px;font-weight:600}
    .stat-card .stat-value{font-family:'Space Grotesk',sans-serif;font-size:28px;font-weight:700;margin-top:6px}
    .stat-card .stat-hint{color:#94a3b8;font-size:12px;margin-top:4px}
    .table-wrap{overflow-x:auto;border:1px solid #e2e8f0;border-radius:14px;background:#fff}
    .host-table{width:100%;border-collapse:collapse;min-width:640px}
    .host-table th,.host-table td{padding:11px 14px;text-align:left;font-size:14px;border-bottom:1px solid #f1f5f9;white-space:nowrap}
    .host-table th{background:#f8fafc;font-weight:700;font-size:13px;color:#475569}
    .host-table tbody tr:last-child td{border-bottom:0}
    .host-table tbody tr:hover{background:#f8fafc}
    .num{text-align:right;font-variant-numeric:tabular-nums}
    .row-low{background:#fef2f2}
    .pos-layout{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(330px,.8fr);gap:16px;align-items:start}
    .pos-products{display:grid;gap:10px;margin-top:14px}
    .pos-product{border:1px solid #e2e8f0;border-radius:13px;background:#fff;padding:14px;text-align:left;cursor:pointer;font:inherit;color:#0f172a;min-height:126px;display:flex;flex-direction:column;justify-content:space-between;gap:8px}
    .pos-product:hover{border-color:#5eead4;box-shadow:0 12px 28px -24px rgba(15,118,110,.8)}
    .pos-product:disabled{opacity:.55;cursor:not-allowed;background:#f8fafc;box-shadow:none}
    .pos-product-code{font-size:12px;color:#64748b}
    .pos-product-name{font-weight:700;line-height:1.35}
    .pos-product-heading{display:flex;gap:12px;align-items:flex-start;min-width:0}
    .pos-product-info{min-width:0;overflow-wrap:anywhere}
    .pos-product-image{display:flex;flex:0 0 80px;flex-direction:column;align-items:center;gap:4px;text-align:center;font-size:11px}
    .pos-product-image img{display:block;width:72px;height:72px;object-fit:contain;border-radius:8px;background:#fff}
    .pos-product-image[hidden]{display:none}
    .pos-product-real-label{color:#176347;background:#e8f7ef;border:1px solid #b6dfcb;border-radius:4px;padding:2px 4px;line-height:1.4}
    .pos-product-meta{display:flex;justify-content:space-between;gap:10px;align-items:end;font-size:12px;color:#64748b}
    .pos-product-price{font:700 17px 'Space Grotesk',sans-serif;color:#0f766e}
    .pos-cart{position:sticky;top:22px}
    .pos-cart-row{display:grid;grid-template-columns:minmax(0,1fr) 82px 76px auto;gap:8px;align-items:center;padding:11px 0;border-bottom:1px solid #f1f5f9}
    .pos-cart-row:last-child{border-bottom:0}
    .pos-cart-row .host-input{margin:0;padding:7px 8px}
    .pos-summary{display:grid;gap:8px;padding:14px 0;border-top:1px solid #e2e8f0;margin-top:12px}
    .pos-summary-row{display:flex;justify-content:space-between;gap:14px;color:#475569;font-size:14px}
    .pos-summary-row.total{font-size:19px;font-weight:800;color:#0f172a}
    .pos-controls{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
    .pos-controls label{font-size:12px;font-weight:700;color:#475569}
    .return-line{display:grid;grid-template-columns:minmax(220px,1fr) 130px minmax(190px,.7fr);gap:12px;align-items:end;padding:12px;border:1px solid #e2e8f0;border-radius:12px;background:#f8fafc}
    .return-line label{font-size:12px;font-weight:700;color:#475569}
    .sale-receipt-head{text-align:center;margin-bottom:18px}
    .sale-receipt-meta{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:16px;font-size:13px}
    .transfer-payment{text-align:center}
    .transfer-qr{width:min(280px,100%);aspect-ratio:1;margin:18px auto 12px;padding:12px;border:1px solid #e2e8f0;border-radius:18px;background:#fff;display:grid;place-items:center}
    .transfer-qr svg{display:block;width:100%;height:100%}
    .transfer-total{font:700 34px 'Space Grotesk','IBM Plex Sans Thai',sans-serif;color:#0f766e;margin:8px 0}
    .transfer-account{background:#f8fafc;border-radius:12px;padding:12px;margin:12px 0;text-align:left}

    @media(max-width:640px){.pos-product{min-height:116px;padding:12px}.pos-controls{grid-template-columns:1fr}.pos-cart-row{grid-template-columns:minmax(0,1fr) 72px auto}.pos-line-total{display:none}.sale-receipt-meta{grid-template-columns:1fr}.return-line{grid-template-columns:1fr}}
    @page{margin:4mm}
    @media print{
      html,body{width:auto!important;height:auto!important;min-height:0!important;margin:0!important;padding:0!important;overflow:visible!important;background:#fff!important}
      body>:not(#modal-mount){display:none!important}
      #modal-mount{display:block!important;position:static!important;margin:0!important;padding:0!important}
      #modal-mount .modal-scrim{display:block!important;position:static!important;inset:auto!important;width:100%!important;height:auto!important;min-height:0!important;margin:0!important;padding:0!important;background:#fff!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
      #modal-mount .sale-receipt{display:block!important;position:static!important;width:100%!important;height:auto!important;max-width:none!important;max-height:none!important;margin:0!important;padding:0!important;overflow:visible!important;border:0!important;border-radius:0!important;box-shadow:none!important}
      #modal-mount .sale-receipt .table-wrap{overflow:visible!important}
      #modal-mount .sale-receipt .host-table{min-width:0!important}
      #modal-mount .sale-receipt .host-table th,#modal-mount .sale-receipt .host-table td{white-space:normal!important;break-inside:avoid}
      #modal-mount .sale-receipt .modal-actions{display:none!important}
    }
    .modal-scrim{position:fixed;inset:0;background:rgba(15,23,42,.5);z-index:50;display:grid;place-items:center;padding:20px}
    .modal{background:#fff;border-radius:18px;padding:24px;width:100%;max-width:560px;max-height:88vh;overflow:auto;box-shadow:0 40px 80px -50px rgba(0,0,0,.6)}
    .modal h2{font-size:19px;margin-bottom:16px}
    .modal-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
    .modal-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:20px}
    #toast-container{position:fixed;top:16px;right:16px;z-index:60;display:grid;gap:8px}
    .toast{background:#0f172a;color:#fff;padding:10px 16px;border-radius:10px;font-size:14px;box-shadow:0 12px 30px -18px rgba(0,0,0,.7);max-width:340px}
    .toast.err{background:#b91c1c}
    /* ---- แดชบอร์ดการเงิน ---- */
    .fin-panel{margin-bottom:16px}
    .fin-head{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-start;justify-content:space-between;margin-bottom:14px}
    .fin-block{margin-bottom:18px}
    .fin-block:last-child{margin-bottom:0}
    .fin-block h3{font-size:12px;font-weight:800;color:#475569;text-transform:uppercase;letter-spacing:.03em;margin-bottom:10px}
    .fin-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}
    .fin-kpi{border:1px solid #e2e8f0;border-radius:14px;padding:16px 18px;min-width:0}
    .fin-kpi span{display:block;font-size:11px;font-weight:800;letter-spacing:.4px;text-transform:uppercase}
    .fin-kpi strong{display:block;margin-top:6px;font-family:'Space Grotesk',sans-serif;font-size:23px;font-weight:700;color:#0b1f35;letter-spacing:-.5px;overflow-wrap:anywhere}
    .fin-kpi small{display:block;margin-top:5px;font-size:11px;font-weight:800}
    .fin-legend{display:flex;gap:12px;flex-wrap:wrap;font-size:12px;color:#475569;font-weight:600}
    .fin-legend span{display:inline-flex;align-items:center;gap:5px}
    .fin-legend .dot{width:10px;height:10px;border-radius:3px;display:inline-block}
    .dot.inc,.fin-bar.inc{background:#16a34a}
    .dot.exp,.fin-bar.exp{background:#f97316}
    .fin-legend .dot.net{position:relative;width:18px;height:3px;border-radius:2px;background:#367ab5}
    .fin-legend .dot.net::after{content:'';position:absolute;left:6px;top:-3px;width:7px;height:7px;border:2px solid #fff;border-radius:50%;background:#367ab5;box-shadow:0 0 0 1px #367ab5}
    .fin-chart{overflow-x:auto;padding-top:4px}
    .fin-combo-chart{display:block;width:100%;min-width:960px;height:215px;overflow:visible}
    .fin-chart-grid{stroke:#e8e7ec;stroke-width:1;stroke-dasharray:4 5;vector-effect:non-scaling-stroke}
    .fin-chart-axis{stroke:#cbc8d2;stroke-width:1;vector-effect:non-scaling-stroke}
    .fin-chart-active{fill:#f3edff}
    .fin-svg-bar{transition:opacity .2s;vector-effect:non-scaling-stroke}
    .fin-svg-bar.inc{fill:#23845b}.fin-svg-bar.exp{fill:#bf7425}
    .fin-combo-group:hover .fin-svg-bar{opacity:.76}
    .fin-net-line{fill:none;stroke:#367ab5;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}
    .fin-net-point{fill:#367ab5;stroke:#fff;stroke-width:2;vector-effect:non-scaling-stroke}
    .fin-data-label{font-size:9px;font-weight:800;text-anchor:middle;paint-order:stroke;stroke:#fff;stroke-width:3px;stroke-linejoin:round;letter-spacing:-.15px}
    .fin-data-label.inc{fill:#176341}.fin-data-label.exp{fill:#8e5015}.fin-data-label.net{fill:#205c8b}
    .fin-chart-month{fill:#817d8a;font-size:11px;font-weight:700;text-anchor:middle}
    .fin-chart-month.active{fill:#7344d8;font-weight:800}
    .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
    .fin-list{display:grid;gap:8px}
    .fin-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 13px;border:1px solid #eef2f7;border-radius:11px;background:#fdfefe}
    .fin-row strong{display:block;font-size:14px;color:#0b1f35;overflow-wrap:anywhere}
    .fin-row small{display:block;margin-top:2px;color:#64748b;font-size:12px}
    .fin-amt{font-weight:800;font-size:14px;white-space:nowrap;font-variant-numeric:tabular-nums}
    .fin-amt.inc{color:#15803d}
    .fin-amt.exp{color:#dc2626}
    .expense-category-grid,.expense-analysis-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px}
    .expense-category-card,.expense-analysis-card{border:1px solid #dbeafe;border-top:3px solid #38bdf8;border-radius:14px;padding:15px 17px;background:linear-gradient(145deg,#fff,#f8fbff);min-width:0}
    .expense-category-card:nth-child(4n+2),.expense-analysis-card.opex{border-top-color:#22c55e;background:linear-gradient(145deg,#fff,#f4fbf6)}
    .expense-category-card:nth-child(4n+3),.expense-analysis-card.capex{border-top-color:#f59e0b;background:linear-gradient(145deg,#fff,#fffbf2)}
    .expense-category-card:nth-child(4n+4),.expense-analysis-card.other{border-top-color:#f472b6;background:linear-gradient(145deg,#fff,#fff7fb)}
    .expense-category-card h3,.expense-analysis-card h3{margin:0;color:#0f766e;font-size:13px;line-height:1.4}
    .expense-analysis-card.opex h3{color:#15803d}.expense-analysis-card.capex h3{color:#b45309}.expense-analysis-card.other h3{color:#be185d}
    .expense-category-card strong,.expense-analysis-card strong{display:block;margin-top:9px;color:#0b1f35;font-family:'Space Grotesk',sans-serif;font-size:24px;font-variant-numeric:tabular-nums;letter-spacing:-.5px;overflow-wrap:anywhere}
    .expense-category-meta{display:flex;flex-wrap:wrap;gap:5px;margin-top:8px;color:#64748b;font-size:12px;font-weight:600}
    .expense-category-meta span+span:before{content:'•';margin-right:5px;color:#cbd5e1}
    .expense-mom{display:block;margin-top:7px;font-size:12px;font-weight:800}
    .expense-analysis-controls{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap}
    .expense-toggle{display:inline-flex;align-items:center;gap:7px;color:#334155;font-size:13px;font-weight:700;cursor:pointer}
    .expense-toggle input{width:16px;height:16px;accent-color:#0f766e}
    .expense-analysis-table{width:100%;border-collapse:collapse;min-width:690px;font-variant-numeric:tabular-nums}
    .expense-analysis-table th,.expense-analysis-table td{padding:11px 14px;border-bottom:1px solid #eef2f7;font-size:13px;white-space:nowrap}
    .expense-analysis-table th{background:#f8fafc;text-align:left;color:#475569;font-size:12px}
    .expense-analysis-table .num{text-align:right}
    .expense-analysis-table tbody tr:last-child td{border-bottom:0}
    .owner-dashboard{display:grid;gap:16px}
    .owner-dashboard .host-btn{min-height:44px}
    .owner-dashboard .host-input{min-height:44px}
    .owner-dashboard :is(.host-btn,.host-input):focus-visible{outline:3px solid #99f6e4;outline-offset:2px}
    .owner-headline-grid{display:grid}
    .owner-headline{background:#fff;border:1px solid #e2e8f0;border-radius:16px;padding:17px;min-width:0}
    .owner-headline-label{color:#475569;font-size:13px;font-weight:700}
    .owner-headline-value{margin-top:7px;color:#0f172a;font-family:'Space Grotesk',sans-serif;font-size:24px;font-weight:700;letter-spacing:-.5px;overflow-wrap:anywhere}
    .owner-headline-state{display:inline-flex;margin-top:8px;border-radius:999px;padding:3px 8px;font-size:11px;font-weight:800;line-height:1.25}
    .owner-headline.positive{border-color:#bbf7d0;background:#f0fdf4}.owner-headline.positive .owner-headline-state{background:#dcfce7;color:#166534}
    .owner-headline.neutral{border-color:#e2e8f0;background:#f8fafc}.owner-headline.neutral .owner-headline-state{background:#e2e8f0;color:#475569}
    .owner-headline.warning{border-color:#fde68a;background:#fffbeb}.owner-headline.warning .owner-headline-state{background:#fef3c7;color:#92400e}
    .owner-headline.negative{border-color:#fecaca;background:#fef2f2}.owner-headline.negative .owner-headline-value{color:#b91c1c}.owner-headline.negative .owner-headline-state{background:#fee2e2;color:#b91c1c}
    .owner-headline.urgent{box-shadow:inset 0 0 0 1px rgba(220,38,38,.15)}
    .owner-headline-meta{margin-top:6px;color:#64748b;font-size:12px;font-weight:600}
    .needs-attention{background:#fffbeb;border:1px solid #fde68a;border-radius:16px;padding:16px}
    .needs-attention-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:10px}
    .needs-attention-list{display:grid;gap:8px}
    .attention-item{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff;border:1px solid #fde68a;border-left:4px solid #f59e0b;border-radius:12px;padding:11px 12px}
    .attention-item .host-btn{min-width:0}
    .attention-item.danger{border-color:#fecaca;border-left-color:#dc2626}
    .attention-item.info{border-color:#bfdbfe;border-left-color:#2563eb}
    .attention-item.warning{border-color:#fde68a;border-left-color:#d97706}.attention-item.negative{border-color:#fecaca;border-left-color:#dc2626}.attention-item.urgent{box-shadow:inset 0 0 0 1px rgba(220,38,38,.12)}
    .attention-copy{min-width:0}.attention-copy strong{display:block;color:#0f172a;font-size:14px}.attention-copy span{display:block;margin-top:2px;color:#64748b;font-size:12px}
    .attention-severity{display:inline-flex;margin-top:5px;border-radius:999px;background:#fef3c7;color:#92400e;padding:2px 7px;font-size:11px;font-weight:800}
    .attention-item.danger .attention-severity{background:#fee2e2;color:#b91c1c}.attention-item.info .attention-severity{background:#dbeafe;color:#1d4ed8}
    .owner-dashboard-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(280px,.8fr);gap:16px}
    .owner-section-title{font-size:16px;font-weight:700;color:#0f172a}.owner-section-lead{margin-top:3px;color:#64748b;font-size:12px}
    .owner-category-list{display:grid;gap:9px;margin-top:14px}.owner-category{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 12px;align-items:center;border-bottom:1px solid #f1f5f9;padding-bottom:9px}.owner-category:last-child{border-bottom:0;padding-bottom:0}.owner-category-name{font-size:14px;font-weight:700;color:#334155}.owner-category-meta{grid-column:1;color:#64748b;font-size:12px}.owner-category-amount{grid-column:2;grid-row:1 / span 2;color:#b45309;font-weight:800;font-variant-numeric:tabular-nums}
    .owner-quick-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}
    .owner-dashboard .fin-row>div:first-child{min-width:0}
    @media(max-width:1100px){.owner-dashboard-grid{grid-template-columns:1fr}}
    @media(max-width:640px){
      .fin-kpis{grid-template-columns:1fr}
      .fin-kpi{padding:13px 15px}
      .fin-kpi strong{font-size:20px}
      .fin-chart{height:150px;gap:4px}
      .fin-col{min-width:26px}
      .fin-head .host-btn{width:100%}
      .expense-category-grid,.expense-analysis-grid{grid-template-columns:1fr}
      .expense-analysis-controls{justify-content:stretch;align-items:stretch}
      .expense-analysis-controls .host-btn{width:100%}
      .attention-item{align-items:flex-start;flex-direction:column}.attention-item .host-btn{width:100%}
      .owner-dashboard>.fin-head>.host-muted{width:100%}
      .owner-dashboard>.fin-head>.host-muted .host-input{width:100%;min-width:0}
      .owner-quick-actions{display:grid;grid-template-columns:1fr}
      .owner-quick-actions .host-btn{width:100%}
    }
    .month-bar{gap:8px;padding:10px 12px;background:#fff;border:1px solid #e2e8f0;border-radius:12px}
    .month-bar .host-input{min-width:150px}
    @media(max-width:640px){.month-bar .host-input{flex:1 1 100%;min-width:0}}
    .filter-bar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-bottom:14px}
    .filter-bar .host-input,.filter-bar .host-select{margin-top:0;width:auto;min-width:190px}
    @media(max-width:1100px){
      .host-login{grid-template-columns:1fr}
      .host-login-hero{padding:32px 24px}
      .host-hero-copy h1{font-size:30px}
      .host-main{min-height:100dvh}
      .topbar{display:flex;min-height:64px;padding:10px 14px}
      .topbar button{min-width:44px;min-height:44px;padding:8px}
      .main-content{padding:16px 14px 50px}
      .sidebar{position:fixed;left:0;top:0;bottom:0;z-index:40;width:min(88vw,340px);height:100dvh;min-height:100dvh;overflow:hidden;transform:translate3d(-102%,0,0);transition:transform .22s;box-shadow:18px 0 40px -28px rgba(15,23,42,.55)}
      .sidebar.open{transform:translate3d(0,0,0)}
      .sidebar-rail-menu{display:none}
      .sidebar-nav{overflow-y:auto;-webkit-overflow-scrolling:touch}
      .sidebar-account-card{padding:16px}
      .nav-section-trigger{min-height:48px;padding:14px 16px;font-size:14px}
      .nav-link{min-height:44px;padding:12px 14px;font-size:15px}
      .sidebar-logout{min-height:42px;padding:9px 11px}
    }
    @media(prefers-reduced-motion:reduce){.sidebar{transition:none}}

    .pick-shell{max-width:760px;margin:0 auto;padding-bottom:24px}.pick-toolbar{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:16px}.pick-order-list{display:grid;gap:10px}.pick-order-card,.pick-line-card{display:block;width:100%;text-align:left;border:1px solid #cbd5e1;background:#fff;border-radius:14px;padding:16px;color:#0f172a}.pick-order-card{cursor:pointer;min-height:72px}.pick-order-card:active,.pick-line-card:active{background:#f1f5f9}.pick-order-card strong,.pick-line-card strong{display:block;font-size:17px}.pick-line-card{margin-bottom:10px}.pick-line-card.active{border:2px solid #047857;background:#ecfdf5}.pick-meta{color:#475569;font-size:14px;margin-top:5px}.pick-progress{font-size:15px;font-weight:700;color:#065f46}.pick-scanner{background:#f8fafc;border:1px solid #cbd5e1;border-radius:16px;padding:16px;margin:16px 0}.pick-scanner label{display:block;font-weight:700;margin:12px 0 6px}.pick-scanner .host-input{font-size:18px;min-height:52px;width:100%}.pick-scanner .host-btn,.pick-toolbar .host-btn,.pick-finish{min-height:48px}.pick-scanner-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}.pick-scanner-actions .host-btn{flex:1 1 130px}.pick-status{min-height:28px;margin-top:10px;font-weight:600}.pick-status.error{color:#b91c1c}.pick-status.ok{color:#047857}.pick-finish{width:100%;margin-top:10px}.pick-shell :focus-visible{outline:3px solid #059669;outline-offset:2px}@media(max-width:640px){.pick-shell{padding:0 2px 24px}.pick-order-card,.pick-line-card{padding:15px}.pick-toolbar .host-btn{flex:1 1 120px}}
  .stock-controls{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:12px;margin:16px 0 10px}
  .stock-controls label{display:block;font-weight:600}
  .stock-controls .host-input,.stock-controls .host-select{width:100%;min-height:44px;margin-top:6px}
  .stock-filters{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:8px}
  .stock-filters .host-btn{min-height:44px}
  .stock-card-view{display:none}
  .stock-card{border:1px solid #e8e7ec;border-radius:14px;padding:14px;background:#fff;margin-bottom:10px}
  .stock-card.row-low{border-color:#ff4c51;background:#fff5f5}
  .stock-card-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:6px}
  .stock-card-qty{text-align:right;min-width:72px}
  .stock-card-qty span{display:block;font-size:12px;color:#6d6b77}
  .stock-card-qty strong{display:block;font-size:24px;line-height:1.1}
  .stock-card-actions{margin-top:10px;flex-wrap:wrap;gap:8px}
  .stock-card-actions .host-btn{min-height:44px;flex:1 1 120px}
  @media(max-width:640px){.stock-controls{grid-template-columns:1fr}.stock-table-view{display:none}.stock-card-view{display:block}}
  .scan-modes{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;margin-bottom:14px}
  .po-line{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center}
  .po-line .scan-qty{grid-template-columns:48px 72px 48px}
  .po-line .scan-qty .host-btn{min-height:48px}
  .count-diff-plus{color:#047857;font-weight:700}.count-diff-minus{color:#a9272d;font-weight:700}
  .scan-modes .host-btn{min-height:56px;font-size:16px}
  .scan-modes .host-btn[aria-pressed="true"].in{background:#047857;border-color:#047857;color:#fff}
  .scan-modes .host-btn[aria-pressed="true"].out{background:#b45309;border-color:#b45309;color:#fff}
  .scan-mode-banner{border-radius:12px;padding:10px 14px;font-weight:700;margin-bottom:12px}
  .scan-mode-banner.in{background:#ecfdf5;color:#065f46;border:2px solid #047857}
  .scan-mode-banner.out{background:#fffbeb;color:#92400e;border:2px solid #b45309}
  .scan-reasons{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .scan-reasons .host-btn{min-height:48px}
  .scan-reasons .host-btn[aria-pressed="true"]{background:#b45309;border-color:#b45309;color:#fff}
  .scan-qty{display:grid;grid-template-columns:56px 1fr 56px;gap:8px;align-items:center}
  .scan-qty .host-btn{min-height:52px;font-size:22px}
  .scan-qty .host-input{text-align:center;font-size:20px}
  .scan-log{list-style:none;padding:0;margin:8px 0 0;display:grid;gap:8px}
  .scan-log li{border:1px solid #cbd5e1;border-radius:12px;padding:10px 12px;background:#fff}
  .finance-voided td{color:var(--app-muted,#6d6b77)}
  .finance-voided td.num{text-decoration:line-through}
  .host-warn-text{display:block;color:#a9272d;font-size:13px;font-weight:600;margin-top:4px;min-height:0}
  .host-warn-text:empty{display:none}
  @media(max-width:480px){.pick-shell h2{font-size:20px;margin:8px 0}.pick-shell .pick-toolbar{gap:8px;margin-bottom:8px}.pick-shell .pick-scanner{padding:12px}.pick-shell .host-btn{min-height:44px}.pick-shell .scan-modes{gap:6px}.pick-shell input{font-size:16px}.pick-shell{padding-bottom:24px}}

/* Operational and accessibility layout */

    body.modal-open{overflow:hidden}
    .form-help{display:block;margin-top:6px;font-size:13px;color:var(--app-muted,#64748b);line-height:1.5}
    .field-error{display:block;margin-top:6px;color:#b42318;font-size:14px;min-height:0}
    [aria-invalid="true"]{border-color:#b42318!important}
    .modal :focus-visible{outline:2px solid var(--app-primary,#7367f0);outline-offset:3px}
    .stock-filters .host-btn,.stock-card-actions .host-btn{min-height:44px;font-size:14px}
    .pos-shift-compact{margin-bottom:12px;padding:12px 16px}
    .pos-shift-compact summary{display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:pointer;min-height:44px;list-style:none}
    .pos-shift-compact summary::-webkit-details-marker{display:none}
    .pos-shift-compact h2{font-size:16px;margin:0}
    .pos-shift-compact summary .host-muted{white-space:nowrap}
    .pos-shift-compact details[open] summary{margin-bottom:12px}
    .pos-shift-compact details[open] summary .pos-details-label::after{content:' ▴'}
    .pos-details-label::after{content:' ▾'}
    .pos-steps{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));list-style:none;gap:6px;padding:0;margin:0 0 16px}
    .pos-steps li{padding:8px;border-radius:8px;background:var(--app-surface,#fff);font-size:13px;color:var(--app-muted,#64748b);text-align:center}
    .pos-steps [aria-current="step"]{background:var(--app-primary,#7367f0);color:#fff;font-weight:700}
    .pos-steps .done{color:#166534;background:#eefbf2}
    .pos-action-bar{position:sticky;bottom:12px;z-index:25;display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:16px;padding:12px 16px;background:var(--app-surface,#fff);border:1px solid var(--app-border,#e2e8f0);border-radius:12px;box-shadow:0 4px 22px rgba(47,43,61,.15)}
    .pos-action-bar .pos-action-buttons{display:flex;gap:8px;flex-wrap:wrap}
    .pos-action-bar .pos-checkout{width:auto;margin:0}
    .pos-action-total{white-space:nowrap;font-size:20px;font-weight:700}
    .pos-checkout:focus-visible{outline:3px solid var(--app-primary,#7367f0);outline-offset:3px}
    .scanner-mode-toggle{min-height:44px;margin:8px 0}
    .fin-future-label{font-size:10px;fill:var(--app-muted,#64748b);text-anchor:middle}
    @media(max-width:640px){
      .pos-shift-compact{padding:10px 12px}.pos-shift-compact summary{align-items:flex-start}
      .pos-shift-compact h2{font-size:14px}.pos-steps li{font-size:12px;padding:8px 3px}
      .pos-action-bar{position:fixed;left:12px;right:12px;bottom:0;border-radius:12px 12px 0 0;flex-wrap:wrap;gap:8px;padding:12px 14px calc(12px + env(safe-area-inset-bottom))}
      .pos-action-bar .pos-action-buttons{width:100%}.pos-action-bar .pos-checkout{width:100%;min-height:48px}
      .main-content:has(.pos-action-bar){padding-bottom:240px}
      .pos-layout{scroll-margin-bottom:240px}.pos-controls input,.pos-controls select{scroll-margin-bottom:240px;scroll-margin-top:84px}
      .pos-products{max-height:360px;overflow-y:auto}
    }
    @media screen and (max-width:640px){
      .sale-receipt .host-table{min-width:0!important;width:100%;table-layout:fixed}
      .sale-receipt .host-table th,.sale-receipt .host-table td{white-space:normal;overflow-wrap:anywhere;padding:8px 6px;font-size:12px}
      .receipt-items th:first-child{width:40%}
      .sale-receipt .modal-actions{flex-wrap:wrap}
    }
    @media print{.pos-action-bar{display:none!important}}
/* รูปจริงจับคู่ด้วยรหัส บาร์โค้ด และชื่อที่ตรวจแล้ว */
.part-name-with-image{display:flex;gap:12px;align-items:flex-start;min-width:0}
.part-name-with-image>div{min-width:0;overflow-wrap:anywhere}
.part-image{margin:0;flex:0 0 72px;text-align:center}
.part-image img{display:block;width:72px;height:72px;object-fit:contain;background:#fff;border-radius:8px}
.part-image figcaption{font-size:12px;line-height:1.5;margin-top:4px}
.part-image figcaption a{display:inline-flex;align-items:center;min-height:44px;color:var(--primary,#5146af)}
.part-image[hidden]{display:none}
.part-image-preview{grid-column:1/-1;display:flex;justify-content:center}
.part-image-large{flex-basis:240px;max-width:100%}
.part-image-large img{width:240px;height:240px;max-width:100%}
.part-image-ai-label{display:inline-block;color:#715000;background:#fff4d4;border:1px solid #ead59b;border-radius:4px;padding:2px 4px;font-size:11px;line-height:1.4}
.part-image-ai-detail{display:block;margin-top:6px;color:var(--text-secondary,#666);line-height:1.5}
