/* SIMO PWA theme settings — KOKI light/dark palette plus optional OS preference. */
/* This stylesheet intentionally loads last: older forced-dark tokens and native light badges must not win. */
html:has(.personal-token){color-scheme:light dark}
html[data-simo-theme="dark"]:has(.personal-token){color-scheme:dark!important;background:#0d1420!important}
html[data-simo-theme="light"]:has(.personal-token){color-scheme:light!important;background:#eef2f7!important}
html[data-simo-theme="dark"] body:has(.personal-token){background:#0d1420!important;color:#edf4ff!important}
html[data-simo-theme="light"] body:has(.personal-token){background:#eef2f7!important;color:#182331!important}
html[data-simo-theme="light"] .personal-token,
html[data-simo-theme="light"] body:has(.personal-token) main.personal-token{
 --ink:#17202d!important;--ink2:#47576c!important;--ink3:#667488!important;--muted:#65758a!important;
 --surface:#ffffff!important;--subtle:#edf2f8!important;--line:#d9e1ec!important;
 --blue:#365de6!important;--blue-soft:#eaf0ff!important;
 background:#eef2f7!important;color:#17202d!important;color-scheme:light!important
}
html[data-simo-theme="dark"] .personal-token,
html[data-simo-theme="dark"] body:has(.personal-token) main.personal-token{
 --ink:#f2f5ff!important;--ink2:#cfdaeb!important;--ink3:#aebed1!important;--muted:#abbcd2!important;
 --surface:#172230!important;--subtle:#223247!important;--line:#35465d!important;
 --blue:#7d9eff!important;--blue-soft:#273959!important;
 background:#0d1420!important;color:#edf5ff!important;color-scheme:dark!important
}

/* Native badge and empty-state: the original source of the white tile in dark mode. */
html[data-simo-theme="dark"] .personal-token .token-count,
html[data-simo-theme="dark"] .personal-token .token-empty>span,
html[data-simo-theme="dark"] .personal-token .token-empty>svg,
html[data-simo-theme="dark"] .personal-token .token-empty>.token-empty-icon{
 background:#24423d!important;color:#a1ead5!important;border:1px solid #365e55!important;
 box-shadow:none!important
}
html[data-simo-theme="dark"] .personal-token .token-count{background:#26384d!important;color:#b6c9f4!important;border:1px solid #395573!important;border-radius:11px!important}
html[data-simo-theme="light"] .personal-token .token-count{background:#eaf0ff!important;color:#3258c8!important;border:1px solid #cedcfb!important;border-radius:11px!important;box-shadow:none!important}

/* Shared light surfaces for every primary menu. */
html[data-simo-theme="light"] .personal-token .token-brand>span:not(.token-mark),
html[data-simo-theme="light"] .personal-token .token-brand strong,
html[data-simo-theme="light"] .personal-token .token-welcome h1,
html[data-simo-theme="light"] .personal-token h1,
html[data-simo-theme="light"] .personal-token h2,
html[data-simo-theme="light"] .personal-token h3,
html[data-simo-theme="light"] .personal-token strong,
html[data-simo-theme="light"] .personal-token label{color:#17202d!important}
html[data-simo-theme="light"] .personal-token .token-brand>span:not(.token-mark)>small::after{color:#67768b!important}
html[data-simo-theme="light"] .personal-token .token-welcome>p:not(.token-eyebrow),
html[data-simo-theme="light"] .personal-token .token-card p,
html[data-simo-theme="light"] .personal-token .token-card small,
html[data-simo-theme="light"] .personal-token .token-card label,
html[data-simo-theme="light"] .personal-token .token-empty p{color:#5f6d7e!important}
html[data-simo-theme="light"] .personal-token .token-eyebrow{color:#4766df!important}
html[data-simo-theme="light"] .personal-token .token-card,
html[data-simo-theme="light"] .personal-token .simo-code-pane,
html[data-simo-theme="light"] .personal-token .token-profile-card,
html[data-simo-theme="light"] .personal-token .token-history-card{
 background:#fff!important;border:1px solid #d9e1ec!important;color:#17202d!important;
 box-shadow:0 5px 22px rgba(26,41,64,.05)!important
}
html[data-simo-theme="light"] .personal-token .token-card .token-section-title>span:first-child,
html[data-simo-theme="light"] .personal-token .token-card .acho-mini-mark{
 background:#ebf0ff!important;color:#3d61df!important
}
html[data-simo-theme="light"] .personal-token .token-card .token-empty,
html[data-simo-theme="light"] .personal-token .token-history-card>.token-empty{
 background:#f5f8fc!important;border:1px dashed #d4deeb!important;color:#526175!important;border-radius:14px!important
}
html[data-simo-theme="light"] .personal-token .token-empty>span,
html[data-simo-theme="light"] .personal-token .token-empty>svg,
html[data-simo-theme="light"] .personal-token .token-empty>.token-empty-icon{
 background:#dff6ec!important;color:#188967!important;border-color:#c4e6da!important;box-shadow:none!important
}
html[data-simo-theme="light"] .personal-token .token-card button:not(.token-primary):not(.simo-request-open):not(.token-request-action):not(.simo-sheet-confirm):not(.simo-sheet-cancel),
html[data-simo-theme="light"] .personal-token .token-card .token-profile-menu button,
html[data-simo-theme="light"] .personal-token .token-card .token-refresh{
 background:#f3f6fb!important;color:#27374a!important;border:1px solid #d2dce9!important;box-shadow:none!important
}
html[data-simo-theme="light"] .personal-token .token-card .token-profile-menu button strong{color:#213249!important}
html[data-simo-theme="light"] .personal-token .token-card .token-profile-menu button small{color:#65758a!important}
html[data-simo-theme="light"] .personal-token .token-card .token-profile-menu button svg{color:#4664bb!important}
html[data-simo-theme="light"] .personal-token .token-profile-summary{border-bottom:1px solid #e0e6ee!important}
html[data-simo-theme="light"] .personal-token .token-avatar{background:#e7edff!important;color:#3257cf!important;border:1px solid #cad8fc!important}
html[data-simo-theme="light"] .personal-token .token-verified{color:#188f72!important}
html[data-simo-theme="light"] .personal-token .token-card input,
html[data-simo-theme="light"] .personal-token .token-card select,
html[data-simo-theme="light"] .personal-token .token-card textarea{
 background:#f9fbfe!important;color:#1b2d41!important;border:1px solid #c6d4e5!important
}
html[data-simo-theme="light"] .personal-token .token-card input::placeholder{color:#708297!important}
html[data-simo-theme="light"] .personal-token .token-card .token-primary,
html[data-simo-theme="light"] .personal-token .token-card .simo-request-open,
html[data-simo-theme="light"] .personal-token .token-card .token-request-action{background:#365de6!important;color:#fff!important;border:0!important}
html[data-simo-theme="light"] .personal-token .token-card .token-logout{background:#fff4f5!important;color:#ac394c!important;border:1px solid #f0c8cf!important}
html[data-simo-theme="light"] .personal-token .token-card .token-logout strong,
html[data-simo-theme="light"] .personal-token .token-card .token-logout svg{color:#a63d50!important}
html[data-simo-theme="light"] .personal-token .token-info-row{border-color:#dce4ef!important}
html[data-simo-theme="light"] .personal-token .token-info-row span{color:#68788c!important}
html[data-simo-theme="light"] .personal-token .token-profile-card details,
html[data-simo-theme="light"] .personal-token .token-help{background:#f7faff!important;border-color:#d9e4f0!important;color:#26384b!important}
html[data-simo-theme="light"] .personal-token .token-profile-card .simo-pin-setting::after{color:#3968a0!important}

/* Documents, hybrid requests, and existing/native pending invitation cards. */
html[data-simo-theme="light"] .personal-token .simo-code-action,
html[data-simo-theme="light"] .personal-token .simo-request-entry,
html[data-simo-theme="light"] .personal-token .token-request{
 background:#f4f7fd!important;border:1px solid #d3dfec!important;color:#27384d!important
}
html[data-simo-theme="light"] .personal-token .simo-code-action strong,
html[data-simo-theme="light"] .personal-token .simo-request-info strong,
html[data-simo-theme="light"] .personal-token .token-request strong{color:#23324a!important}
html[data-simo-theme="light"] .personal-token .simo-code-action small,
html[data-simo-theme="light"] .personal-token .simo-request-info small,
html[data-simo-theme="light"] .personal-token .token-request span{color:#64758d!important}
html[data-simo-theme="light"] .personal-token .simo-queue-heading h2{color:#1b2d41!important}
html[data-simo-theme="light"] .personal-token .simo-queue-heading p{color:#596d84!important}
html[data-simo-theme="light"] .personal-token .simo-queue-count{background:#e3f6f1!important;color:#147d75!important}
html[data-simo-theme="light"] .personal-token .simo-code-symbol,
html[data-simo-theme="light"] .personal-token .simo-request-icon{background:#e4ecff!important;color:#456bd8!important}
html[data-simo-theme="light"] .personal-token .simo-code-pane .acho-otp input{background:#f5f8fc!important;color:#1e2e43!important;border-color:#baccea!important}
html[data-simo-theme="light"] .personal-token .simo-review-assurance,
html[data-simo-theme="light"] .personal-token .simo-awaiting-state p{color:#60768c!important}
html[data-simo-theme="light"] .personal-token .simo-awaiting-state{background:#f1f7fa!important;border-color:#c2d6e4!important}
html[data-simo-theme="light"] .personal-token .simo-inline-review,
html[data-simo-theme="light"] .personal-token .simo-review-footer{border-color:#d5deea!important}

/* Unified history in both modes. */
html[data-simo-theme="light"] .personal-token .token-history-item,
html[data-simo-theme="light"] .personal-token .simo-history-entry{
 background:#f6f9fd!important;border-color:#d9e3ef!important;color:#1c2d40!important
}
html[data-simo-theme="light"] .personal-token .token-history-head strong{color:#1d2d40!important}
html[data-simo-theme="light"] .personal-token .token-history-head .token-history-status{background:#e1f5ec!important;color:#18876a!important}
html[data-simo-theme="light"] .personal-token .token-history-item p,
html[data-simo-theme="light"] .personal-token .token-history-item small{color:#64748a!important}
html[data-simo-theme="light"] .personal-token .token-version-links a,
html[data-simo-theme="light"] .personal-token .token-version-links button{background:#eef3ff!important;color:#3655ae!important;border-color:#d4def4!important}
html[data-simo-theme="light"] .personal-token .token-history-card .token-details{background:#f0f5fc!important;border-color:#d3deeb!important;color:#3e5675!important}
html[data-simo-theme="light"] .personal-token .simo-hybrid-history{border-top-color:#d9e3ed!important}
html[data-simo-theme="light"] .personal-token .simo-hybrid-history h3{color:#253850!important}

/* Floating navigation and dialogs follow the same selection. */
html[data-simo-theme="light"] .personal-token nav.token-nav{
 background:rgba(255,255,255,.97)!important;border-color:#d9e1ed!important;
 box-shadow:0 10px 28px rgba(24,39,61,.12)!important
}
html[data-simo-theme="light"] .personal-token nav.token-nav button{color:#6b7b90!important}
html[data-simo-theme="light"] .personal-token nav.token-nav button[aria-current="page"],
html[data-simo-theme="light"] .personal-token nav.token-nav button.simo-current-tab{background:#e8efff!important;color:#345cda!important}
html[data-simo-theme="light"] .simo-pending-alert{background:#fff!important;border-color:#d9e4ec!important;color:#1c3048!important;box-shadow:0 14px 35px #233e6025!important}
html[data-simo-theme="light"] .simo-pending-alert small{color:#687e94!important}
html[data-simo-theme="light"] .simo-sign-sheet-body{background:#fff!important;color:#192b42!important;border-color:#d5deed!important}
html[data-simo-theme="light"] .simo-sign-sheet h2{color:#1d2f47!important}
html[data-simo-theme="light"] .simo-sign-sheet p,
html[data-simo-theme="light"] .simo-sign-sheet .simo-sheet-security{color:#66788f!important}
html[data-simo-theme="light"] .simo-sign-sheet .simo-sheet-file{background:#f1f5fc!important;color:#213851!important}
html[data-simo-theme="light"] .simo-sign-sheet .simo-sheet-cancel{background:#edf2fb!important;color:#29405e!important;border-color:#cdd9e8!important}
html[data-simo-theme="light"] .personal-token .token-loading{background:rgba(234,239,246,.88)!important;color:#1c2d43!important}
html[data-simo-theme="light"] .personal-token .token-loading>div{background:#fff!important;border-color:#d2dfea!important}

/* Theme setting lives alongside profile; changes immediately and persists per device. */
.personal-token .simo-theme-settings{margin:13px 0 22px!important;padding:18px!important}
.personal-token .simo-theme-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin:0 0 16px}
.personal-token .simo-theme-heading h2{font-size:17px!important;margin:0 0 5px!important;line-height:1.25!important}
.personal-token .simo-theme-heading p{margin:0!important;font-size:12px!important;line-height:1.4!important}
.personal-token .simo-theme-effective{font-size:11px!important;font-weight:700!important;white-space:nowrap;padding:6px 9px;border-radius:999px}
html[data-simo-theme="dark"] .personal-token .simo-theme-effective{background:#22354b!important;color:#93b5e9!important}
html[data-simo-theme="light"] .personal-token .simo-theme-effective{background:#eaf0ff!important;color:#355db7!important}
.personal-token .simo-theme-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.personal-token .simo-theme-option{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;min-width:0;padding:12px 5px!important;border-radius:14px!important;min-height:104px!important;cursor:pointer}
.personal-token .simo-theme-option .simo-theme-icon{width:32px;height:32px;display:grid;place-items:center;border-radius:10px}
.personal-token .simo-theme-icon svg{width:20px;height:20px}
.personal-token .simo-theme-option strong{font-size:12px!important;line-height:1.2!important}
.personal-token .simo-theme-option small{font-size:10px!important;text-align:center;line-height:1.25!important}
html[data-simo-theme="dark"] .personal-token .simo-theme-option{background:#202f42!important;border:1px solid #3b4f67!important;color:#e3efff!important}
html[data-simo-theme="dark"] .personal-token .simo-theme-option .simo-theme-icon{background:#2a405a;color:#a9bcff}
html[data-simo-theme="light"] .personal-token .simo-theme-option{background:#f4f7fc!important;border:1px solid #d2dded!important;color:#263b50!important}
html[data-simo-theme="light"] .personal-token .simo-theme-option .simo-theme-icon{background:#e7eeff;color:#4965b6}
html[data-simo-theme] .personal-token .simo-theme-option.simo-theme-selected{border-color:#547bf1!important;box-shadow:0 0 0 1px #547bf1 inset!important}
html[data-simo-theme="dark"] .personal-token .simo-theme-option.simo-theme-selected{background:#283b61!important}
html[data-simo-theme="light"] .personal-token .simo-theme-option.simo-theme-selected{background:#e9efff!important}
.personal-token .simo-theme-note{font-size:11px!important;margin:13px 0 0!important}
html[data-simo-theme="light"] .personal-token .simo-theme-note{color:#6a788a!important}
html[data-simo-theme="dark"] .personal-token .simo-theme-note{color:#9cb0c7!important}
@media(max-width:355px){.personal-token .simo-theme-choices{gap:5px}.personal-token .simo-theme-option{padding:8px 2px!important}.personal-token .simo-theme-option strong{font-size:11px!important}}

/* Default follows OS while JavaScript initializes saved preference. */
@media(prefers-color-scheme:light){
 html:not([data-simo-theme]):has(.personal-token){color-scheme:light!important}
}

/* KOKI-style quick theme control in token header; full choices remain in Profile. */
.personal-token .token-top .simo-theme-quick{
 display:grid!important;place-items:center!important;flex:0 0 35px!important;
 width:35px!important;height:35px!important;min-width:35px!important;min-height:35px!important;
 margin:0 10px 0 auto!important;padding:0!important;border-radius:12px!important;
 cursor:pointer!important;line-height:1!important;box-shadow:none!important;
}
.personal-token .token-top .simo-theme-quick svg{width:19px!important;height:19px!important}
html[data-simo-theme="dark"] .personal-token .token-top .simo-theme-quick{background:#1d2e43!important;color:#a8bfff!important;border:1px solid #364e6c!important}
html[data-simo-theme="light"] .personal-token .token-top .simo-theme-quick{background:#fff!important;color:#4463c7!important;border:1px solid #cedbeb!important}
.personal-token .token-top .simo-theme-quick:focus-visible{outline:2px solid #698af1!important;outline-offset:2px!important}
.personal-token .token-top .token-badge{margin-left:0!important;white-space:nowrap!important}
@media(max-width:350px){.personal-token .token-top .simo-theme-quick{width:32px!important;height:32px!important;flex-basis:32px!important;margin-right:6px!important}}

/* Selected mode must be unmistakable, not just a subtle border. */
html[data-simo-theme] .personal-token .token-card .simo-theme-choices button.simo-theme-selected{
 position:relative!important;border:2px solid #466cf1!important;
 box-shadow:0 0 0 1px #466cf1 inset!important;
}
html[data-simo-theme] .personal-token .token-card .simo-theme-choices button.simo-theme-selected::after{
 content:"✓";position:absolute;right:4px;top:4px;width:16px;height:16px;
 display:grid;place-items:center;background:#365de6;color:#fff;border-radius:50%;
 font-size:11px;font-weight:900;line-height:1
}
