/* The hosted app in the extension's own look (the dashboard's tokens: --bg, --bg2, --bg3, --border, --accent, --text-*, --loss).
   The strip under the page header is styled in every layout but the phone reader (reader.css owns that one) and is not shown
   in the extension layout; the rest is that layout's, which extension-shell.ts marks on the body. */

.cloud-sign-in-dialog {
    /* The page's own reset (`* { margin: 0 }`) beats the browser's `dialog { margin: auto }`, which is what centres a modal dialog: without this the sheet sits in the corner. */
    margin: auto;
    width: min(520px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg2, #fff);
    color: var(--text, #173d37);
    font: 16px/1.5 system-ui, sans-serif;
}
.cloud-sign-in-dialog::backdrop { background: rgba(0, 0, 0, .5); }
/* The sheet's own dialog (.cloud-sign-in-dialog) and the same form inside the secure sign-in overlay's card (.cloud-sign-in-inline) are drawn alike. The card's slot is
   deliberately not a .cloud-sign-in-dialog: that class means a credentials sheet is open, and an empty slot is not one. */
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) form { display: grid; gap: 14px; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) h2 { margin: 0; font-size: 22px; }
.cloud-sign-in-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.cloud-sign-in-logo { box-sizing: border-box; width: auto; min-width: 56px; max-width: 220px; height: 56px; object-fit: contain; padding: 6px 14px; border-radius: 12px; background: #fff; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) .cloud-sign-in-password-label { margin-bottom: -9px; }
.cloud-sign-in-password-field { position: relative; display: block; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) .cloud-sign-in-password-field input { padding-right: 52px; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) .cloud-sign-in-reveal { position: absolute; top: 50%; right: 5px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 40px; min-height: 40px; padding: 0; background: transparent; color: inherit; border: 0; }
.cloud-sign-in-reveal [hidden] { display: none; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) p { margin: 0; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) label { display: grid; gap: 5px; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) :is(input:not([type="checkbox"]), select) { width: 100%; box-sizing: border-box; min-height: 44px; font: inherit; padding: 10px 12px; border: 1px solid #b7c9c6; border-radius: 8px; background: #f7faf9; color: inherit; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) .cloud-sign-in-choice { display: flex; align-items: flex-start; gap: 10px; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) .cloud-sign-in-actions { display: flex; justify-content: flex-end; gap: 12px; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) button { min-height: 44px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; border: 1px solid #b7c9c6; border-radius: 8px; background: #fff; color: #193d37; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) button[type="submit"] { background: #006565; border-color: #006565; color: #fff; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) :is(button, input, select, summary):focus-visible { outline: 2px solid #006565; outline-offset: 3px; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) button:disabled { cursor: default; opacity: .6; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) [data-entry-error] { color: var(--loss, #a12525); font-size: 13px; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) [data-entry-error]:empty { display: none; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) [data-login-page-state] { font-size: 13px; color: #526963; }
.cloud-sign-in-other-options { border-top: 1px solid #e1e9e6; padding-top: 12px; font-size: 14px; }
.cloud-sign-in-other-options summary { width: fit-content; color: #526963; cursor: pointer; padding: 6px 0; }
:is(.cloud-sign-in-dialog, .cloud-sign-in-inline) .cloud-sign-in-myself { min-height: 44px; padding: 8px 0; border: 0; background: transparent; color: #006565; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* The card's own slot for the form (hosted-sign-in-dialog.ts); the card already shows the provider's logo and name. */
.cloud-sign-in-inline { flex: 1; min-height: 0; box-sizing: border-box; padding: 20px 24px 24px; background: transparent; color: #193d37; font: 15px/1.5 system-ui, sans-serif; overflow-y: auto; }
.cloud-sign-in-inline[hidden] { display: none; }
.cloud-sign-in-inline .cloud-sign-in-brand { display: none; }
/* What the card shows after its form was answered, until the read's sign-in page is ready and the viewer takes its place (hosted-sign-in-dialog.ts): the viewer's own opening words. */
.cloud-sign-in-waiting { flex: 1; min-height: 0; box-sizing: border-box; display: flex; align-items: flex-start; gap: 10px; padding: 25px 24px 20px; color: #193d37; font: 16px/1.5 system-ui, sans-serif; }
.cloud-sign-in-waiting[hidden] { display: none; }
.cloud-sign-in-waiting p { margin: 0; }
.cloud-sign-in-waiting-text { font-size: 24px; font-weight: 700; line-height: 1.3; }
.cloud-sign-in-waiting-note { margin-top: 8px !important; color: #5a716c; font-size: 14px; }
.cloud-sign-in-waiting-note[hidden] { display: none; }
.cloud-sign-in-spinner { flex: none; box-sizing: border-box; width: 16px; height: 16px; margin-top: 7px; border: 2px solid #b7c9c6; border-top-color: #006565; border-radius: 50%; animation: cloud-sign-in-spin .9s linear infinite; }
@keyframes cloud-sign-in-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cloud-sign-in-spinner { animation: none; } }

#optimal-web-settings #optimal-device-account { display: grid; gap: 12px; }
#optimal-web-settings #optimal-device-account :is(h3, p) { margin: 0; }
#optimal-web-settings #optimal-device-account h3 { font-size: 16px; }
#optimal-web-settings #optimal-device-account button { min-height: 44px; margin: 4px 8px 4px 0; padding: 10px 14px; border: 1px solid #b7c9c6; border-radius: 8px; background: #fff; color: #193d37; font: 600 14px system-ui; cursor: pointer; }
#optimal-web-settings #optimal-device-account button:focus-visible { outline: 2px solid #006565; outline-offset: 3px; }
#optimal-web-settings #optimal-device-account button:disabled { opacity: .6; cursor: default; }

/* ----- the strip under the page header ----- */
body:not([data-optimal-local-reader="true"]) #optimal-web-preview-status {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    padding: 8px 24px !important;
    border-bottom: 1px solid var(--border) !important;
    background: var(--bg3) !important;
    color: var(--text-dim);
    font-size: 11px !important;
    line-height: 1.5 !important;
}
body:not([data-optimal-local-reader="true"]) #optimal-web-canonical-status { flex: 1 1 320px; min-width: 0; margin: 0; }
body:not([data-optimal-local-reader="true"]) #optimal-web-preview-status button {
    font: inherit;
    font-size: 10px;
    letter-spacing: 0.3px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg2);
    color: var(--text-dim);
    cursor: pointer;
}
body:not([data-optimal-local-reader="true"]) #optimal-web-preview-status button:hover { border-color: var(--accent); color: var(--accent); }
body:not([data-optimal-local-reader="true"]) #optimal-web-preview-status button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body:not([data-optimal-local-reader="true"]) #optimal-web-sample-mode { margin-left: auto; }
/* In the extension layout (extension-shell.ts) the strip is not shown: the dashboard has none of the preview's bar. */
html body[data-optimal-ui="extension"] #optimal-web-preview-status { display: none !important; }

/* ----- the sidebar: the two sections only this app has ----- */
body[data-optimal-ui="extension"] .sidebar-nav-heading {
    margin: 12px 24px 2px;
    padding-top: 14px;
    border-top: 1px solid rgba(16, 185, 129, 0.15);
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(6, 78, 59, 0.82);
}
/* The sidebar's items and this heading were #064e3b at 70% and 55% on the sidebar's #ecfdf5 (4.2:1 and 2.9:1); at 82% both are 5.7:1. The active item keeps its full ink.
   The footer's links (Settings, Support) were the items' 70% and the tagline under the name --text-muted (4.27:1): the same treatment, and each keeps the hover it had. */
body[data-optimal-ui="extension"] .sidebar-nav-item { color: rgba(6, 78, 59, 0.82); }
body[data-optimal-ui="extension"] .sidebar-nav-item.active { color: #064e3b; }
body[data-optimal-ui="extension"] .sidebar-footer-link { color: rgba(6, 78, 59, 0.82); }
body[data-optimal-ui="extension"] .sidebar-footer-link:hover { color: #064e3b; }
body[data-optimal-ui="extension"] .sidebar-header p { color: var(--text-dim); }
/* The first screen's message was --text-muted on --bg (4.49:1), and the drawer's close mark 4.07:1: --text-dim is 9:1. The close mark's own hover (the only cue it has) stays. */
body[data-optimal-ui="extension"] .locked-state-msg, body[data-optimal-ui="extension"] .drawer-close { color: var(--text-dim); }
body[data-optimal-ui="extension"] .drawer-close:hover { color: var(--text); }
body[data-optimal-ui="extension"] .sidebar-nav-item.needs-attention::after {
    content: '';
    flex: none;
    width: 8px;
    height: 8px;
    margin-left: auto;
    border-radius: 50%;
    background: var(--loss);
}

/* ----- their panels ----- */
body[data-optimal-ui="extension"] [data-view-panel^="optimal-"] .panel-body { padding: 16px 20px 20px; }
body[data-optimal-ui="extension"] #optimal-local-connections,
body[data-optimal-ui="extension"] #optimal-local-read-panel {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    min-width: 0;
    font-size: 12px;
    color: var(--text);
}
/* The panel header already names the section; the heading stays for assistive technology. */
body[data-optimal-ui="extension"] #optimal-local-connections > h2,
body[data-optimal-ui="extension"] #optimal-local-read-panel > h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
body[data-optimal-ui="extension"] #optimal-local-connections p,
body[data-optimal-ui="extension"] #optimal-local-read-panel > p { margin: 6px 0; color: var(--text-dim); font-size: 12px; line-height: 1.5; }
body[data-optimal-ui="extension"] #optimal-local-connections button,
body[data-optimal-ui="extension"] #optimal-local-read-panel button {
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 7px 14px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg2);
    color: var(--text);
    cursor: pointer;
}
body[data-optimal-ui="extension"] #optimal-local-connections button:hover:not(:disabled),
body[data-optimal-ui="extension"] #optimal-local-read-panel button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
body[data-optimal-ui="extension"] #optimal-local-connections button:disabled,
body[data-optimal-ui="extension"] #optimal-local-read-panel button:disabled { opacity: 0.55; cursor: default; }
body[data-optimal-ui="extension"] #optimal-local-connections .local-reader-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 101, 101, 0.12);
}
body[data-optimal-ui="extension"] #optimal-local-connections .local-reader-primary:hover:not(:disabled) { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
body[data-optimal-ui="extension"] #optimal-local-connections [data-action="disconnect"] { border-color: transparent; background: transparent; color: var(--loss); }
body[data-optimal-ui="extension"] #optimal-local-connections input,
body[data-optimal-ui="extension"] #optimal-local-connections select,
body[data-optimal-ui="extension"] #optimal-local-read-panel select {
    font: inherit;
    font-size: 12px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg2);
    color: var(--text);
}
body[data-optimal-ui="extension"] #optimal-local-connections button:focus-visible,
body[data-optimal-ui="extension"] #optimal-local-connections input:focus-visible,
body[data-optimal-ui="extension"] #optimal-local-connections select:focus-visible,
body[data-optimal-ui="extension"] #optimal-local-connections summary:focus-visible,
body[data-optimal-ui="extension"] #optimal-local-read-panel button:focus-visible,
body[data-optimal-ui="extension"] #optimal-local-read-panel select:focus-visible,
body[data-optimal-ui="extension"] #optimal-local-read-panel summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body[data-optimal-ui="extension"] #optimal-local-connections > label { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 8px; color: var(--text-dim); font-size: 12px; }
body[data-optimal-ui="extension"] #optimal-local-connections > [data-connection-id] { gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--border); }
body[data-optimal-ui="extension"] .local-connection-heading { flex: 1 1 220px; min-width: 0; }
body[data-optimal-ui="extension"] .local-connection-heading strong { display: block; font-size: 14px; color: var(--text); }
body[data-optimal-ui="extension"] .local-connection-heading p { margin: 2px 0 0; color: var(--text-muted); font-size: 11px; }
body[data-optimal-ui="extension"] #optimal-local-connections > [role]:empty { display: none; }
body[data-optimal-ui="extension"] #optimal-local-connections > [role="alert"],
body[data-optimal-ui="extension"] #optimal-local-read-panel > [role="alert"] {
    padding: 8px 12px;
    border-left: 3px solid var(--loss);
    background: rgba(186, 26, 26, 0.05);
    color: var(--loss);
}
body[data-optimal-ui="extension"] #optimal-local-add-connection { margin-top: 14px; }
body[data-optimal-ui="extension"] #optimal-local-connections summary,
body[data-optimal-ui="extension"] #optimal-local-read-panel summary { cursor: pointer; padding: 8px 0; font-size: 12px; font-weight: 700; color: var(--text); }
body[data-optimal-ui="extension"] #optimal-local-read-panel [data-read] { padding: 10px 0; border-top: 1px solid var(--border); }
body[data-optimal-ui="extension"] #optimal-local-read-panel table { width: 100%; border-collapse: collapse; font-size: 12px; }
body[data-optimal-ui="extension"] #optimal-local-read-panel caption { padding-bottom: 8px; text-align: left; color: var(--text-muted); font-size: 11px; }
body[data-optimal-ui="extension"] #optimal-local-read-panel th {
    padding: 8px 12px;
    background: var(--bg3);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-align: left;
    text-transform: uppercase;
}
body[data-optimal-ui="extension"] #optimal-local-read-panel td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
body[data-optimal-ui="extension"] #optimal-local-read-empty { margin-top: 14px; padding: 32px 16px; border: 1px dashed var(--border); border-radius: 10px; text-align: center; }
body[data-optimal-ui="extension"] #optimal-local-read-empty h3 { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--text); }
body[data-optimal-ui="extension"] #optimal-local-read-empty p { max-width: 520px; margin: 0 auto; color: var(--text-dim); }
body[data-optimal-ui="extension"] .local-read-explanation { color: var(--text-dim); font-size: 11px; margin-top: 8px; }
body[data-optimal-ui="extension"] #optimal-local-reads-host { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
body[data-optimal-ui="extension"] .local-read-source-filter { margin-bottom: 0; font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
body[data-optimal-ui="extension"] #optimal-local-read-panel > button { margin-right: 10px; }
body[data-optimal-ui="extension"] #optimal-local-read-status { display: inline-block; margin: 0; vertical-align: middle; font-size: 12px; color: var(--text-muted); }
body[data-optimal-ui="extension"] #optimal-local-read-panel .local-read-sections { margin-top: 10px; }
body[data-optimal-ui="extension"] #optimal-local-read-panel th,
body[data-optimal-ui="extension"] #optimal-local-read-panel td { vertical-align: middle; white-space: nowrap; font-variant-numeric: tabular-nums; }
body[data-optimal-ui="extension"] #optimal-read-schedule {
    margin-top: 16px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg3);
    display: grid;
    gap: 12px;
    font-size: 12.5px;
}
body[data-optimal-ui="extension"] #optimal-read-schedule h3 { font-size: 13.5px; font-weight: 700; margin: 0; color: var(--text); }
body[data-optimal-ui="extension"] #optimal-read-schedule form { display: grid; gap: 14px; }
body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px 24px; max-width: none; align-items: start; }
body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-field { display: grid; gap: 5px; align-content: start; }
body[data-optimal-ui="extension"] #optimal-read-schedule input[type="number"] { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg2); max-width: 140px; }
body[data-optimal-ui="extension"] #optimal-read-schedule fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; background: var(--bg2); }
body[data-optimal-ui="extension"] #optimal-read-schedule legend { padding: 0 6px; margin-bottom: 4px; font-size: 11.5px; font-weight: 700; color: var(--text-dim); }
body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-connection-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 6px 14px; margin-top: 2px; }
body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-toggle,
body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-connection-list label { display: inline-flex; align-items: center; gap: 8px; }
body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-actions { display: flex; gap: 8px; flex-wrap: wrap; }
body[data-optimal-ui="extension"] #optimal-read-schedule button { font: inherit; font-size: 12px; font-weight: 600; padding: 7px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2); color: var(--text); cursor: pointer; }
body[data-optimal-ui="extension"] #optimal-read-schedule #optimal-read-schedule-save { background: var(--accent); border-color: var(--accent); color: #fff; }
body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-helper { color: var(--text-muted); font-size: 11.5px; margin: 2px 0 0; }
body[data-optimal-ui="extension"] #optimal-read-schedule > [role] { margin: 2px 0 0; font-size: 12px; color: var(--text-dim); }
body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-details { margin-top: 2px; font-size: 11.5px; }
body[data-optimal-ui="extension"] #optimal-read-schedule-notices { display: grid; gap: 8px; }
body[data-optimal-ui="extension"] #optimal-read-schedule-notices > [role="alert"] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(180, 83, 9, 0.25);
    background: #fffbeb;
    color: #78350f;
}
body[data-optimal-ui="extension"] #optimal-read-schedule-notices > [role="alert"] > p { margin: 0; flex: 1 1 200px; font-size: 12px; line-height: 1.4; }
body[data-optimal-ui="extension"] .local-read-source-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-dim);
}
body[data-optimal-ui="extension"] .local-read-source-filter select {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg2, #fff);
    color: var(--text);
}
@media (min-width: 901px) {
    body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-toggle { min-height: 28px; font-size: 13px; }
    body[data-optimal-ui="extension"] #optimal-read-schedule button,
    body[data-optimal-ui="extension"] #optimal-read-schedule input[type="number"] {
        min-height: 34px;
        padding: 6px 12px;
        font-size: 12.5px;
        border-radius: 7px;
    }
    body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-connection {
        min-height: 30px;
        padding: 3px 6px;
        border-radius: 6px;
        font-size: 12.5px;
    }
    body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-connection:hover { background: var(--bg3); }
    body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-connection input[type="checkbox"] {
        flex: 0 0 15px;
        width: 15px;
        height: 15px;
        min-height: 15px;
    }
    body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-details > summary { min-height: 28px; padding: 4px 0; }
}
@media (max-width: 900px) {
    body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-settings { grid-template-columns: minmax(0, 1fr); }
    body[data-optimal-ui="extension"] #optimal-read-schedule .read-schedule-connection-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ----- the extension's provider modal, driven by the Mac app (hosted-provider-sync.ts) ----- */
#provider-modal-overlay[data-auth-view="true"] { visibility: hidden; pointer-events: none; }
/* The modal's "15,000+ other institutions" line is the extension's own aggregator, which does not exist here, so it is not offered.
   The connected rows' ··· menu is: "Add another account" connects a further login on the Mac, and removing one asks its confirmation inside
   the open overlay (hosted-connection-door.ts); renaming a login is kept with the settings on the Mac. */
body[data-optimal-ui="extension"] #provider-modal-overlay .pm-search-link { display: none !important; }
/* Read out by screen readers, not drawn: the state word of a tile whose drawn line says something else ("Disconnected" under a provider's description). */
.pm-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ----- the provider picker as a grid of tiles (the design approved in PR #246) -----
   Two columns of tiles that are all one size and never move: the list is by name, so a provider does not change place when its state changes, and
   what a tile says (its state, a colour, one line) changes inside it. Everything there is to do with a connected provider is in its own ··· menu. A tile
   is a .pm-provider-row too, so the extension's row rules reach it: every rule here names body, to be after the stylesheet the modal adds to the page. */
#provider-modal-overlay .pm-provider-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 97px; gap: 8px; align-content: start; }
body #provider-modal-card[data-hosted-picker="true"] { width: min(1040px, calc(100vw - 32px)); height: min(660px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); }
body #provider-modal-card[data-hosted-picker="true"] .pm-layout { flex-direction: column; min-height: 0; }
body #provider-modal-card[data-hosted-picker="true"] .pm-left { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 24px; padding: 16px 64px 16px 24px; border-radius: 20px 20px 0 0; overflow: visible; }
body #provider-modal-card[data-hosted-picker="true"] :is(.pm-left-icon, .pm-left-blob) { display: none; }
body #provider-modal-card[data-hosted-picker="true"] .pm-left-heading { grid-column: 1; grid-row: 1; margin: 0; font-size: 22px; line-height: 1.2; }
body #provider-modal-card[data-hosted-picker="true"] .pm-left-sub { grid-column: 1; grid-row: 2; flex: none; margin: 0; font-size: 13px; color: #355d53; }
body #provider-modal-card[data-hosted-picker="true"] .pm-left-badges { grid-column: 2; grid-row: 1 / span 2; flex-direction: row; flex-wrap: nowrap; gap: 12px; margin: 0; }
body #provider-modal-card[data-hosted-picker="true"] .pm-badge { font-size: 10px; white-space: nowrap; }
body #provider-modal-card[data-hosted-picker="true"] .pm-right { flex: 1; min-height: 0; padding: 16px 24px 20px; border-radius: 0 0 20px 20px; overflow: hidden; }
body #provider-modal-card[data-hosted-picker="true"] .pm-right-top { margin-bottom: 12px; }
body #provider-modal-card[data-hosted-picker="true"] .pm-select-label { font-size: 11px; }
body #provider-modal-card[data-hosted-picker="true"] .pm-close-btn { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; }
body #provider-modal-card[data-hosted-picker="true"] .pm-provider-list { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 106px; min-height: 0; overflow-y: auto; padding: 2px 4px 4px 2px; }
body #provider-modal-card[data-hosted-picker="true"] .pm-tile { height: 106px; }
body #provider-modal-card[data-hosted-picker="true"] .pm-footer { flex: none; margin-top: 12px; }
@media (max-width: 959px) {
    body #provider-modal-card[data-hosted-picker="true"] .pm-provider-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 719px) {
    body #provider-modal-card[data-hosted-picker="true"] { width: calc(100vw - 16px); height: calc(100dvh - 20px); max-height: calc(100dvh - 20px); }
    body #provider-modal-card[data-hosted-picker="true"] .pm-provider-list { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(112px, auto); gap: 8px; padding-bottom: 64px; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile { grid-template-rows: auto; min-height: 112px; height: auto; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile > .pm-provider-main { height: auto; min-height: 100%; padding: 20px 10px 10px; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile .pm-provider-logo-pill.pm-provider-logo-image { width: min(108px, calc(100% - 24px)); max-width: calc(100% - 24px); height: 38px; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile > .pm-menu-btn,
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile > .pm-hosted-stop { min-width: 44px; min-height: 44px; width: 44px; height: 44px; margin: 0; border: 0; border-radius: 10px; background: transparent; align-items: flex-start; justify-content: flex-end; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile > .pm-menu-btn { padding: 6px 8px 0 0; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile[data-state="error"] > .pm-menu-btn,
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile[data-hosted-active="true"] > .pm-menu-btn { justify-content: flex-start; padding: 6px 0 0 8px; margin: 0; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile > .pm-hosted-stop { padding: 6px 6px 0 0; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile > .pm-hosted-stop svg { width: 22px; height: 22px; padding: 5px; box-sizing: border-box; border: 1px solid #c9d2d2; border-radius: 50%; background: #fff; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-tile > .pm-hosted-stop:hover svg { border-color: #ba1a1a; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-left { grid-template-columns: minmax(0, 1fr); gap: 2px 12px; padding: 12px 52px 10px 14px; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-left-heading { font-size: 17px; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-left-sub { font-size: 12px; line-height: 1.35; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-left-badges { grid-column: 1; grid-row: 3; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-right { padding: 10px 12px 12px; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-right-top { margin-bottom: 8px; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-close-btn { top: 10px; right: 10px; }
    body #provider-modal-card[data-hosted-picker="true"] .pm-footer { margin-top: 8px; }
}
@media (max-width: 335px) {
    body #provider-modal-card[data-hosted-picker="true"] .pm-provider-list { grid-template-columns: minmax(0, 1fr); }
}
body .pm-tile {
    position: relative;
    display: grid;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    box-sizing: border-box;
    width: auto;
    height: 97px;
    padding: 0;
    border: 1px solid #e4e7e7;
    border-radius: 10px;
    background: #ffffff;
    text-align: center;
}
/* What a tile is: the whole tile is its one action (connect, try again, or the way to the sign-in page), which is why it is a button or a link and not a div. */
body .pm-tile > .pm-provider-main {
    grid-area: 1 / 1;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    box-sizing: border-box; width: 100%; height: 100%; min-width: 0; margin: 0; padding: 11px 6px 0; gap: 0; border: 0;
    border-radius: inherit; background: none; color: inherit; font: inherit; text-align: center; text-decoration: none; cursor: pointer;
}
body .pm-tile > .pm-provider-main:focus-visible { outline: 2px solid #006565; outline-offset: -4px; }
.pm-hosted-observe { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); padding: 2px 6px; border-radius: 4px; color: #006565; font-size: 11px; font-weight: 600; white-space: nowrap; text-underline-offset: 2px; }
.pm-hosted-observe:focus-visible { outline: 2px solid #006565; outline-offset: 1px; }
body .pm-tile-observing > .pm-provider-main { padding-top: 6px; }
body .pm-tile-observing .pm-provider-logo-pill { height: 32px; }
body .pm-provider-row[data-hosted-active="true"][data-state="reading"] .pm-hosted-stop { left: 6px; right: auto; }
/* The mark gets the room the design gives it (up to 118 by 40): a wide lockup is drawn at the tile's width, a square one at 40. It stops short of the tile's top
   corners (where the ··· and the stop are) by their width, so a wide lockup never runs under them. */
body .pm-tile .pm-provider-logo-pill { flex: none; width: 118px; max-width: calc(100% - 42px); height: 40px; margin: 0; border-radius: 0; opacity: 1; }
body .pm-tile .pm-provider-logo-image { padding: 0; border: 0; background: transparent; }
body .pm-tile .pm-provider-logo-pill:not(.pm-provider-logo-image) { width: 56px; border-radius: 8px; font-size: 13px; }
body .pm-tile .pm-provider-info { flex: none; width: 100%; min-width: 0; margin-top: 4px; text-align: center; }
body .pm-tile .pm-provider-name { overflow: hidden; font-size: 11px; font-weight: 700; line-height: 12px; color: #191c1d; text-overflow: ellipsis; white-space: nowrap; }
/* The state is read at a glance, so it is not the provider list's small grey caption: 10px, one line, and two at most (the rest is cut with an ellipsis; a
   tile does not grow). Its dot, when it has one, is beside the first line. */
body .pm-tile .pm-provider-sub { display: flex; align-items: flex-start; justify-content: center; gap: 5px; margin-top: 4px; font-size: 10px; line-height: 12px; color: #5f6a6a; }
body .pm-tile .pm-sub-text { display: -webkit-box; min-width: 0; overflow: hidden; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
body .pm-tile .pm-active-indicator, body .pm-tile .pm-active-indicator-login { flex: none; margin-top: 2px; }
@media (prefers-reduced-motion: reduce) { body .pm-tile .pm-active-indicator, body .pm-tile .pm-active-indicator-login { animation: none; } }

/* The states: connected is mint, a read under way is plain, a read that failed is pink; an unconnected tile is white and becomes teal when it is pointed at. */
body .pm-tile[data-state="connected"], body .pm-tile[data-state="connected"]:hover { border-color: #9bd9c4; background: #f4fcf9; cursor: default; }
body .pm-tile[data-state="connected"] > .pm-provider-main { cursor: default; }
body .pm-tile[data-state="error"] { border-color: #f1b8b8; background: #fffbfb; }
body .pm-tile[data-state="error"]:hover { border-color: #ba1a1a; background: #fff5f5; }
body .pm-tile[data-hosted-active="true"], body .pm-tile[data-hosted-active="true"]:hover { border-color: #d5dddd; background: #fff; cursor: default; }
body .pm-tile[data-hosted-active="true"] > .pm-provider-main:not(.pm-hosted-link) { cursor: default; }
body .pm-tile.pm-tile-linked:hover { border-color: #006565; background: #f0fafa; cursor: pointer; }
body .pm-tile > .pm-hosted-link { cursor: pointer; }
body .pm-tile > .pm-hosted-link .pm-provider-sub { text-decoration: underline; text-underline-offset: 2px; }
body .pm-tile[data-state="connected"] .pm-provider-sub { color: #4a5757; font-weight: 500; }
body .pm-tile .pm-provider-sub.pm-provider-status-live { color: #006565; font-weight: 600; font-style: italic; }
body .pm-tile .pm-provider-sub.pm-status-error { color: #ba1a1a; font-style: normal; font-weight: 700; }
body .pm-tile .pm-provider-sub.pm-provider-status-live.pm-status-login { color: #c2410c !important; }
body .pm-tile .pm-tile-retry { position: absolute; top: 6px; right: 9px; font-size: 15px; line-height: 1; color: #ba1a1a; }
/* A failure no retry changes says why in full on its tile (overlay-failed-row.ts): up to three lines, with the mark a little smaller so the tile stays the size of every other. */
body .pm-tile[data-reason="connection-out-of-date"] .pm-provider-logo-pill { height: 28px; }
body .pm-tile[data-reason="connection-out-of-date"] .pm-sub-text { -webkit-line-clamp: 3; line-clamp: 3; }

/* The two controls of a tile sit in its top corner, in the same cell as the tile: ··· (a connected provider's menu), and Stop (a read under way). Neither is
   a positioned box, so a menu is placed from the tile, not from its button. A ··· on a tile that is not connected shows when the tile is pointed at or
   focused (and always on a touch screen, which has no pointing). They are small (the ··· reaches about 30px in from the tile's edge, the stop 27px), so a wide
   mark, which stops 28px short of the edge at the design's tile, is clear of them but for the margin inside its own box. */
body .pm-tile > .pm-menu-btn,
body .pm-tile > .pm-hosted-stop { grid-area: 1 / 1; justify-self: end; align-self: start; margin: 7px 5px 0 0; z-index: 2; }
body .pm-tile > .pm-menu-btn {
    position: static;
    display: inline-flex; align-items: center; box-sizing: border-box; height: 17px; padding: 0 3px;
    border: 1px solid transparent; border-radius: 4px; background: none;
    font-size: 14px; line-height: 1; letter-spacing: 1px; color: #5f6a6a;
}
body .pm-tile > .pm-menu-btn:hover, body .pm-tile > .pm-menu-btn[aria-expanded="true"] { color: #191c1d; border-color: #d5dddd; background: #fff; }
body .pm-tile:not([data-state="connected"]) > .pm-menu-btn { opacity: 0; transition: opacity 0.12s; }
body .pm-tile:hover > .pm-menu-btn, body .pm-tile:focus-within > .pm-menu-btn, body .pm-tile > .pm-menu-btn[aria-expanded="true"] { opacity: 1; }
/* An open menu is above every tile after its own, including their corner controls (which sit at z-index 2, as the ··· does, so the later tile would be drawn over it). */
body .pm-tile > .pm-menu-btn[aria-expanded="true"] { z-index: 30; }
/* On a touch screen nothing is pointed at: the ··· is always there. It is the hiding rule's own selector, so that it is not outranked by it. */
@media (hover: none) { body .pm-tile:not([data-state="connected"]) > .pm-menu-btn { opacity: 1; } }
/* The top right of a tile that failed, or is being read, is its retry mark or its Stop: the menu goes to the left. */
body .pm-tile[data-state="error"] > .pm-menu-btn, body .pm-tile[data-hosted-active="true"] > .pm-menu-btn { justify-self: start; margin: 7px 0 0 5px; }
body .pm-tile > .pm-hosted-stop {
    display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: 20px; height: 20px; padding: 0;
    border: 1px solid #c9d2d2; border-radius: 50%; background: #fff; color: #4a5555; cursor: pointer;
}
body .pm-tile > .pm-hosted-stop:hover { border-color: #ba1a1a; color: #ba1a1a; }
body .pm-tile > .pm-hosted-stop:focus-visible { outline: 2px solid #006565; outline-offset: 2px; }

/* A provider's tile in the Mac app is the provider and whether it is connected, and nothing else. What can be done with it (add another login, disconnect it)
   is in the tile's ··· menu (provider-modal.ts). */
.pm-provider-main:focus-visible, .pm-menu-btn:focus-visible { outline: 2px solid #006565; outline-offset: 2px; border-radius: 6px; }
body #provider-modal-overlay .pm-select-label { color: #5f6a6a; }
body #provider-modal-overlay .pm-footer-text, body #provider-modal-overlay .pm-footer-link { color: #5f6a6a; }
/* The menu is wider than the extension's two items: it names each login and its accounts. Its text is its own (the ··· button's
   letter spacing and weight are not inherited). It hangs from the tile, not from the ··· in its corner: from the tile's left edge in the left column
   and its right edge in the right one, so it stays inside the list, and upward when there is no room below. */
body .pm-tile .pm-menu-popover { top: calc(100% + 4px); right: auto; left: 0; margin: 0; min-width: 210px; max-width: 300px; max-height: min(260px, 55dvh); overflow-y: auto; letter-spacing: normal; font-size: 11px; font-weight: 500; line-height: 1.3; color: #191c1d; text-align: left; white-space: normal; cursor: default; }
body .pm-tile:nth-child(even) .pm-menu-popover { right: 0; left: auto; }
body .pm-tile .pm-menu-popover.pm-menu-up { top: auto; bottom: calc(100% + 4px); }
.pm-menu-section { padding: 2px 0; }
.pm-menu-label { padding: 6px 14px 2px; font-size: 9px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: #5f6a6a; }
.pm-menu-info { padding: 2px 14px; font-size: 11px; line-height: 1.4; color: #5f6b6b; overflow-wrap: anywhere; }
.pm-menu-item:disabled { opacity: 0.5; cursor: default; }
.pm-menu-item:disabled:hover { background: none; }
.pm-menu-item:focus-visible { outline: 2px solid #006565; outline-offset: -2px; }
/* A login in the menu: the pencil and "Disconnect" are controls, so they are as dark as the rest of the menu's text allows (the extension's #9eadad is 2.3:1). "Disconnect" is words, on a line with the login it is for. */
body .pm-tile .pm-conn-count { font-size: 11px; color: #5f6a6a; }
body .pm-tile .pm-menu-rename-conn { color: #5f6a6a; }
body .pm-tile .pm-menu-rename-conn:hover { color: #191c1d; }
body .pm-tile .pm-menu-remove-conn { color: #b91c1c; font-size: 11px; font-weight: 600; padding: 4px 8px; white-space: nowrap; }
body .pm-tile .pm-menu-remove-conn:hover { background: #fef2f2; }

/* The left of the card: what this is (the owner's approved words), as large as a paragraph is read at. */
body #provider-modal-overlay .pm-left-sub { font-size: 12px; line-height: 1.55; color: #2f5f52; }
body #provider-modal-overlay .pm-badge { font-size: 10px; }

/* The search is not on yet: it is drawn, switched off, and says so. Its words are the owner's, and are as dark as a caption is allowed to be. */
.pm-search { display: flex; align-items: center; gap: 8px; box-sizing: border-box; height: 36px; margin: 0 0 6px; padding: 0 8px 0 12px; border: 1px solid #e4e7e7; border-radius: 10px; background: #f5f7f7; color: #5f6a6a; flex-shrink: 0; }
.pm-search-icon { flex: none; }
.pm-search-label { flex: 1 1 0; min-width: 0; overflow: hidden; font-size: 13px; color: #5f6a6a; text-overflow: ellipsis; white-space: nowrap; cursor: not-allowed; }
.pm-search-pill { flex: none; padding: 3px 8px; border-radius: 999px; background: #e9eded; font-size: 9px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: #4a5555; }
.pm-search-note { flex-shrink: 0; margin: 0 0 10px; font-size: 11px; line-height: 1.3; color: #5f6a6a; }
/* The overlay is one card: it is as tall as its content up to the page's height less 16px above and below (the design is 834px tall, which has all eleven
   tiles in view on a 900px page), and what does not fit is the provider list, which scrolls, so the terms and "SEE 360° VIEW" stay in view.
   (The extension's own card clips what does not fit; its list is short.) */
body[data-optimal-ui="extension"] #provider-modal-card { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
body[data-optimal-ui="extension"] #provider-modal-card .pm-layout { flex: 1 1 auto; min-height: 0; height: auto; }
body[data-optimal-ui="extension"] #provider-modal-card .pm-right { min-height: 0; overflow-y: hidden; }
body[data-optimal-ui="extension"] #provider-modal-card .pm-provider-list { min-height: 0; overflow-y: auto; }
