/* AIOS V20 | restored barcode scanner, compact scanner layout, role identities and light theme */
/* Header: show scanner action next to a consistent service indicator and role crest. */
body.ai-platform .topbar-identity{display:flex;align-items:center;gap:8px;min-width:0}
body.ai-platform .header-scan-action{display:inline-flex;align-items:center;gap:7px;justify-content:center;padding:8px 13px;min-height:40px;border-radius:12px;border:1px solid #258e84;background:linear-gradient(125deg,#007470,#0b8d83);color:#fff;font-size:12px;font-weight:750;white-space:nowrap;box-shadow:0 5px 16px #00747022}
body.ai-platform .header-scan-action .ui-icon{width:19px;height:19px;flex:0 0 19px}
body.ai-platform .role-home-button{display:inline-flex;align-items:center;gap:8px;width:auto;min-width:40px;min-height:40px;padding:0 10px;border-radius:13px;white-space:nowrap}
body.ai-platform .role-home-button.role-admin{background:linear-gradient(135deg,#594328,#2a3244);border-color:#b89453;color:#ffe0a0}
body.ai-platform .role-home-button.role-representative{background:linear-gradient(135deg,#16495d,#123446);border-color:#55acc7;color:#b9f4ff}
body.ai-platform .role-home-button.role-customer{background:linear-gradient(135deg,#0b514d,#193746);border-color:#40b3a6;color:#b5fff1}
body.ai-platform .role-home-button .role-label{font-size:10px;font-weight:800}
body.ai-platform .status-pill.aios-service-pill{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:40px;padding:7px 12px;border-radius:999px;white-space:nowrap;background:#193d33;color:#d2ffeb;border:1px solid #3a8266;font-size:11px;font-weight:700}
body.ai-platform .status-pill.aios-service-pill i{display:inline-block;width:9px;height:9px;border-radius:50%;background:#59dfaa;box-shadow:0 0 0 4px #59dfaa22}
body.ai-platform .theme-toggle{display:inline-grid;place-items:center;flex:0 0 40px;width:40px;height:40px;border:1px solid var(--ava-border);border-radius:12px;background:var(--ava-surface);color:#ffe2a0;cursor:pointer}
body.ai-platform .theme-toggle:hover{border-color:var(--ava-accent);background:var(--ava-surface-hover)}
body.ai-platform .theme-toggle-icon{font-size:23px;line-height:1}
/* Fixed-sized scanner window matching the supplied reference. Media dimensions never shift after camera start. */
#scannerModal .scanner-card{width:min(620px,calc(100vw - 20px));max-width:100%;max-height:calc(100dvh - 20px);overflow-y:auto;overflow-x:hidden;padding:clamp(14px,2.4vw,26px);box-sizing:border-box;background:#132638;border:1px solid #3e6675;color:#effbff}
#scannerModal .scanner-card .modal-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
#scannerModal .scanner-card .modal-head strong{color:#effbff;font-size:15px}
#scannerModal .scanner-card .video-shell{position:relative;display:block;width:100%;height:clamp(160px,23dvh,195px);min-height:160px;max-height:195px;flex:0 0 auto;margin:13px 0 12px;border:1px solid #008c8a;border-radius:13px;background:#061e2c;overflow:hidden;isolation:isolate}
#scannerModal .scanner-card .video-shell video{display:block;width:100%;height:100%;object-fit:cover;object-position:center;min-width:0;max-width:100%;max-height:100%}
#scannerModal .scanner-card .scan-frame{pointer-events:none;position:absolute;inset:12% 7%;border:1px solid #65c4ac66;border-radius:8px;z-index:2}
#scannerModal .scanner-card .scan-line{position:absolute;top:12%;left:7%;right:7%;height:2px;width:auto;border-radius:10px;background:linear-gradient(90deg,transparent,#67ffe4,#ffca78,#67ffe4,transparent);box-shadow:0 0 11px #5af6d2;z-index:3;pointer-events:none;animation:aiosBarcodeSweep 2.6s cubic-bezier(.55,0,.45,1) infinite alternate}
@keyframes aiosBarcodeSweep {from {top:13%;opacity:.45} to {top:86%;opacity:.95}}
#scannerModal .scanner-card .scanner-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:12px 0}
#scannerModal .scanner-card .scanner-actions .btn{display:flex;align-items:center;justify-content:center;margin:0;padding:9px 10px;min-height:43px;white-space:normal;text-align:center;line-height:1.45;font-size:12px}
#scannerModal .scanner-card .scanner-actions .scanner-ocr,#scannerModal .scanner-card .scanner-actions .scanner-photo-button{grid-column:1/-1}
#scannerModal .scanner-card .scanner-actions .scanner-photo-button{cursor:pointer;border:1px solid #527d8b;background:#213d50;color:#e9ffff}
#scannerModal .scanner-card .scanner-actions .scanner-photo-button:hover{border-color:#7cc9b5}
#scannerModal .scanner-card .scanner-actions .scanner-photo-input{position:absolute!important;clip:rect(0,0,0,0)!important;clip-path:inset(50%)!important;width:1px!important;height:1px!important;overflow:hidden!important;white-space:nowrap!important}
#scannerModal .scanner-card .scanner-activity{min-height:50px;height:auto;margin:8px 0 9px}
#scannerModal .scanner-card .scanner-result{display:flex!important;visibility:visible;min-height:43px;padding:8px 12px;margin:8px 0 0}
#scannerModal .scanner-card .scanner-result.hidden{visibility:hidden!important;display:flex!important}
#scannerModal .scanner-card #scannerHint{color:#d6eaf0;min-height:48px;max-height:75px;overflow-y:auto;margin:10px 0;line-height:1.7;font-size:12px}
#scannerModal .scanner-card .scanner-footer{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:12px 0 0;padding-top:12px}
#scannerModal .scanner-card .scanner-footer .btn{min-width:0;width:100%;min-height:44px;font-size:12px}
/* Serial field has a constant height. Scanning-line animation never changes layout. */
.inspection-page .serial-input-shell{position:relative;isolation:isolate;height:64px;min-height:64px;max-height:64px;overflow:hidden;display:flex;align-items:center}
.inspection-page .serial-input-shell .serial-input{position:relative;z-index:2;min-width:0;height:100%;line-height:1.5;background:transparent!important}
.inspection-page .serial-input-shell .serial-ico{z-index:2;position:relative}
.inspection-page .serial-input-shell.is-scan-waiting::after{content:"";pointer-events:none;position:absolute;left:9px;right:9px;top:7px;height:2px;border-radius:10px;background:linear-gradient(90deg,transparent,#47ddc5,#ffe0a5,transparent);box-shadow:0 0 10px #60ebd45a;z-index:1;animation:aiosSerialSweep 2.35s ease-in-out infinite alternate}
@keyframes aiosSerialSweep {from{top:7px;opacity:.4}to{top:calc(100% - 9px);opacity:1}}
@media (max-width:760px){
  body.ai-platform .topbar{gap:6px;padding-inline:8px}
  body.ai-platform .top-title-group{min-width:0;max-width:90px}
  body.ai-platform .top-kicker{display:none}
  body.ai-platform .top-title{font-size:12px;max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  body.ai-platform .header-scan-action{padding-inline:9px;min-width:39px}
  body.ai-platform .header-scan-action span{display:none}
  body.ai-platform .status-pill.aios-service-pill{padding-inline:8px;font-size:10px;min-height:36px}
  body.ai-platform .role-home-button .role-label{display:none}
  body.ai-platform .role-home-button{padding-inline:7px;min-height:36px}
  body.ai-platform .theme-toggle{width:36px;height:36px;flex-basis:36px}
  #scannerModal .scanner-card{padding:14px}
  #scannerModal .scanner-card .video-shell{height:170px;min-height:170px;max-height:170px}
  #scannerModal .scanner-card .scanner-actions .btn{font-size:11px;min-height:41px}
}
@media(max-width:390px){body.ai-platform .top-title-group{display:none}body.ai-platform .status-pill.aios-service-pill{font-size:9px}}
/* "Request desktop site" on a physically narrow touchscreen may report 980 CSS px.
   Keep a drawer navigation and full-width panel even when the usual 900px media query fails. */
html.aios-touch-compact body.ai-platform .sidebar{position:fixed!important;top:0;right:0;bottom:0;max-height:100dvh;transform:translateX(100%)!important;width:min(315px,85vw);max-width:85vw;z-index:210!important;transition:transform .22s ease}
html.aios-touch-compact body.ai-platform .sidebar.open{transform:translateX(0)!important}
html.aios-touch-compact body.ai-platform .main-wrap{width:100%!important;margin-right:0!important;min-width:0!important}
html.aios-touch-compact body.ai-platform .mobile-menu{display:grid!important;place-items:center;flex:0 0 42px;width:42px;height:42px;border-radius:11px;border:1px solid var(--ava-border);background:var(--ava-surface);color:var(--ava-text)}
html.aios-touch-compact body.ai-platform .sidebar-scrim.is-visible{display:block!important;position:fixed;inset:0;z-index:200;background:rgba(3,14,23,.6)}
html.aios-touch-compact body.ai-platform .page-content{width:100%!important;max-width:100%!important;padding-inline:14px!important}
html.aios-touch-compact body.ai-platform .topbar{padding-inline:12px!important}
html.aios-touch-compact body.ai-platform .header-scan-action span{display:none}
html.aios-touch-compact body.ai-platform .role-home-button .role-label{display:none}
html.aios-touch-compact body.ai-platform #scannerModal .scanner-card{width:min(620px,calc(100vw - 20px))}
/* Light theme: full semantic palette for shell, panels, forms and dialogs. Dark scanner camera stage remains dark for contrast. */
html[data-theme="light"]{color-scheme:light;
 --ava-text:#173340;--ava-muted:#5b7887;--ava-bg:#f3f8fb;--ava-deep:#ffffff;
 --ava-secondary:#ecf3f7;--ava-surface:#ffffff;--ava-surface-hover:#e9f6f4;
 --ava-border:#d2e1e9;--ava-accent:#d48a27;--ava-focus:#007470;
 --bg:#f3f8fb;--surface:#ffffff;--surface-soft:#edf5f8;--ink:#173340;--muted:#5b7887;--line:#d2e1e9;--line-strong:#a9c6d0;
}
html[data-theme="light"] body.ai-platform{background:radial-gradient(circle at 90% 5%,#dbf4ef,transparent 33%),#f3f8fb!important;color:#173340!important}
html[data-theme="light"] body.ai-platform .main-wrap{background:transparent}
html[data-theme="light"] body.ai-platform .topbar{background:#ffffffed!important;border-color:#d3e4e8!important;box-shadow:0 5px 18px #0e45500c}
html[data-theme="light"] body.ai-platform .top-title{color:#163746!important}
html[data-theme="light"] body.ai-platform .top-kicker{color:#648491}
html[data-theme="light"] body.ai-platform .sidebar{background:linear-gradient(165deg,#f0f8f9,#e8f3f6)!important;border-color:#cddfe6!important;box-shadow:-8px 0 30px #12343c10}
html[data-theme="light"] body.ai-platform .side-brand{border-color:#c8dce2}
html[data-theme="light"] body.ai-platform .brand-copy strong{color:#173945!important}
html[data-theme="light"] body.ai-platform .brand-copy span,html[data-theme="light"] body.ai-platform .nav-caption{color:#587581!important}
html[data-theme="light"] body.ai-platform .side-nav .nav-link{color:#2f5261!important}
html[data-theme="light"] body.ai-platform .side-nav .nav-link:hover{color:#006e65!important;background:#d9eeec!important}
html[data-theme="light"] body.ai-platform .side-nav .nav-link.active{background:linear-gradient(110deg,#d4f1eb,#e9f8f3)!important;color:#00665c!important;border-color:#94d8c9!important;box-shadow:inset -3px 0 0 #007470!important}
html[data-theme="light"] body.ai-platform .side-nav .nav-link.active .nav-ico{color:#007470!important;background:#bce8e0!important}
html[data-theme="light"] body.ai-platform .side-user{background:#fff!important;color:#163845!important;border-color:#cddfe6!important}
html[data-theme="light"] body.ai-platform .side-user .user-copy strong{color:#173a46!important}
html[data-theme="light"] body.ai-platform .page-content .card,html[data-theme="light"] body.ai-platform .card,html[data-theme="light"] body.ai-platform .table-card,html[data-theme="light"] body.ai-platform .acip-card{background:#fff!important;color:#173a46!important;border-color:#d3e2e8!important;box-shadow:0 7px 24px #17405008}
html[data-theme="light"] body.ai-platform .card h1,html[data-theme="light"] body.ai-platform .card h2,html[data-theme="light"] body.ai-platform .card h3,html[data-theme="light"] body.ai-platform .section-head strong,html[data-theme="light"] body.ai-platform .page-head h1{color:#173a46!important}
html[data-theme="light"] body.ai-platform .field label,html[data-theme="light"] body.ai-platform .field-help,html[data-theme="light"] body.ai-platform .metric strong,html[data-theme="light"] body.ai-platform table td{color:#224354!important}
html[data-theme="light"] body.ai-platform .metric,html[data-theme="light"] body.ai-platform .warranty-summary>div{background:#f0f7f9!important;border-color:#d4e5ec!important;color:#153949!important}
html[data-theme="light"] body.ai-platform input:not([type="checkbox"]):not([type="radio"]),html[data-theme="light"] body.ai-platform select,html[data-theme="light"] body.ai-platform textarea,html[data-theme="light"] body.ai-platform .search-select__control{background:#f9fcfd!important;color:#173a46!important;border-color:#c3d9e1!important}
html[data-theme="light"] body.ai-platform input::placeholder,html[data-theme="light"] body.ai-platform textarea::placeholder{color:#65808b!important}
html[data-theme="light"] body.ai-platform .btn.ghost{background:#f2f8fa!important;color:#27505c!important;border-color:#bdd5dc!important}
html[data-theme="light"] body.ai-platform .btn.ghost:hover{background:#e0f1f1!important;color:#00695e!important}
html[data-theme="light"] body.ai-platform .search-select__menu,html[data-theme="light"] body.ai-platform .search-select__options,html[data-theme="light"] body.ai-platform .modal-card{background:#fff!important;color:#173a46!important;border-color:#d1e1e7!important}
html[data-theme="light"] body.ai-platform .modal-card .modal-head strong{color:#153946!important}
html[data-theme="light"] body.ai-platform .chat-thread{background:#f2f7fa!important;border-color:#d5e5ec!important}
html[data-theme="light"] body.ai-platform .chat-message{color:#163948!important}
html[data-theme="light"] body.ai-platform .chat-message.admin{background:#d8f2eb!important;color:#185348!important}
html[data-theme="light"] body.ai-platform .chat-message.user{background:#e9f0fb!important}
html[data-theme="light"] body.ai-platform .ai-hero{background:linear-gradient(115deg,#eaf8f5,#e3eff9)!important;color:#173a46!important;border-color:#d6e8e9!important}
html[data-theme="light"] body.ai-platform .ai-hero h1,html[data-theme="light"] body.ai-platform .ai-hero p{color:#184554!important}
html[data-theme="light"] body.ai-platform .ai-hero .neural-scene{opacity:.6}
html[data-theme="light"] body.ai-platform .theme-toggle{background:#fff;color:#b46a18;border-color:#bdd9e3}
html[data-theme="light"] body.ai-platform .status-pill.aios-service-pill{background:#e7f9ee;color:#086849;border-color:#a3daba}
html[data-theme="light"] body.ai-platform .role-home-button.role-admin{background:#fff2d9;color:#80510a;border-color:#d9b26b}
html[data-theme="light"] body.ai-platform .role-home-button.role-representative{background:#e1f6ff;color:#136785;border-color:#a6d8e8}
html[data-theme="light"] body.ai-platform .role-home-button.role-customer{background:#e5f9f1;color:#086c5b;border-color:#a3d9c8}
html[data-theme="light"] body.ai-platform .inspection-page #warrantyMessage.ok{background:#e2f8ed!important;color:#126944!important;border-color:#75c79f!important}
html[data-theme="light"] body.ai-platform .inspection-page #warrantyMessage.bad,html[data-theme="light"] body.ai-platform .inspection-page .photo-identity-status.is-invalid{background:#fff0f1!important;color:#9b2941!important;border-color:#e9a3b1!important}
html[data-theme="light"] body.ai-platform .inspection-page .photo-identity-status.is-valid{background:#e7f8eb!important;color:#116648!important;border-color:#83c4a0!important}
html[data-theme="light"] body.ai-platform .inspection-page .photo-identity-status.is-idle{background:#eef5f8!important;color:#375d6a!important;border-color:#c9dfe6!important}
/* The scanner itself stays dark in both themes for consistent camera framing and high visibility. */
html[data-theme="light"] body.ai-platform #scannerModal .scanner-card{background:#132638!important;color:#effbff!important;border-color:#3e6675!important}
html[data-theme="light"] body.ai-platform #scannerModal .scanner-card .modal-head strong{color:#effbff!important}
html[data-theme="light"] body.ai-platform #scannerModal .scanner-card .scanner-actions .btn{background:#213d50!important;color:#eaffff!important;border-color:#4b7280!important}
html[data-theme="light"] body.ai-platform #scannerModal .scanner-card .scanner-result{background:#0d2b3a!important;color:#d5f4fb!important;border-color:#46757e!important}
html[data-theme="light"] body.ai-platform #scannerModal .scanner-card .scanner-result bdi{color:#adffeb!important}
html[data-theme="light"] body.ai-platform #scannerModal .scanner-card #scannerHint{color:#d8ecf2!important}
html[data-theme="light"] body.ai-platform #scannerModal .scanner-card .scanner-activity{color:#e5f4fb!important;background:#152a3a!important}
@media(prefers-reduced-motion:reduce){
 #scannerModal .scanner-card .scan-line,.inspection-page .serial-input-shell.is-scan-waiting::after{animation:none;top:50%}
}

/* Keep the scan sweep visible beneath the text field in light mode as well. */
html[data-theme="light"] body.ai-platform .inspection-page .serial-input-shell .serial-input{background:transparent!important;}
