/* ZebraFish desktop surfaces.
 * Explicit opt-in: the desktop portal/admin and non-PWA, non-native readers only.
 * Business apps retain their own styles. No global theme/filter or image recolouring.
 */
html:not([data-hb-surface="pwa"]) body.hb-web {
    --color-primary: #275dda;
    --color-primary-active: #204fbd;
    --color-primary-soft: rgba(39, 93, 218, .09);
    --color-accent-teal: #087e73;
    --color-canvas: #f2f6fc;
    --color-surface-soft: #eef4fa;
    --color-surface-card: #ffffff;
    --color-surface-cream-strong: #e7eff8;
    --color-hairline: #d1ddea;
    --color-hairline-soft: #e2eaf3;
    --color-ink: #10243a;
    --color-body-strong: #263e57;
    --color-body: #3c5269;
    --color-muted: #566c82;
    --color-muted-soft: #667c90;
    --font-display: var(--font-body);
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-xl: 24px;
    --web-glass: rgba(255, 255, 255, .74);
    --web-shadow: 0 12px 36px rgba(58, 88, 130, .055), inset 0 1px 0 rgba(255, 255, 255, .9);
    min-height: 100vh;
    background: radial-gradient(ellipse at 8% 92%, rgba(143, 211, 202, .19), transparent 48%), radial-gradient(ellipse at 83% 2%, rgba(166, 185, 246, .2), transparent 46%), #f2f6fc;
    background-attachment: fixed;
    color: var(--color-ink);
    color-scheme: light;
}
html:not([data-hb-surface="pwa"]) .hb-web :is(button, input, select, textarea) { font-family: var(--font-body); }
/* Business-controlled hidden fields/dialogs must win over legacy .field display:flex. */
html:not([data-hb-surface="pwa"]) .hb-web [hidden] { display: none !important; }
html:not([data-hb-surface="pwa"]) .hb-web :is(button, a, input, select, textarea):focus-visible {
    outline: 3px solid rgba(39, 93, 218, .66);
    outline-offset: 3px;
}
html:not([data-hb-surface="pwa"]) .hb-web :is(h1, h2, h3, h4) { font-weight: 650; }

/* The desktop is a viewport workspace, not a centred document. Use real type and
 * component sizes (~125% of the initial design), not zoom/transform scaling. */
.hb-web-portal { font-size: 1rem; }
.hb-web-portal .app-shell {
    grid-template-columns: clamp(220px, 18vw, 280px) minmax(0, 1fr) clamp(340px, 27vw, 420px);
    gap: 28px;
    /* Match the admin shell's small inset while keeping the workspace full width. */
    padding: 16px;
    width: 100%;
    max-width: none;
    margin: 0;
}
.hb-web-portal .col-left {
    top: 0;
    height: 100%;
    min-height: 0;
    min-width: 0;
    padding: 28px 18px 20px;
    background: var(--web-glass);
    border: 1px solid rgba(255, 255, 255, .96);
    border-radius: 28px;
    box-shadow: var(--web-shadow);
    backdrop-filter: blur(22px) saturate(125%);
    -webkit-backdrop-filter: blur(22px) saturate(125%);
}
.hb-web-portal .brand-row { align-items: flex-start; gap: 12px; padding: 2px 6px 32px; }
.hb-web-portal .brand-logo { width: 42px; height: 42px; }
.hb-web-portal .brand-name { font-size: 1.625rem; font-weight: 750; line-height: 1.2; }
.hb-web-portal .brand-name small { display: block; font-size: .75rem; font-weight: 500; color: var(--color-muted); margin-top: 8px; letter-spacing: 0; line-height: 1.5; }
.hb-web-portal .menu-card { padding: 0; background: transparent; }
.hb-web-portal .menu-list { gap: 6px; }
.hb-web-portal .menu-item { height: 3.625rem; border-radius: 18px; padding-inline: 20px; font-size: 1.125rem; }
.hb-web-portal .menu-icon svg { width: 22px; height: 22px; }
.hb-web-portal .menu-item:hover { background: rgba(221, 232, 246, .35); }
.hb-web-portal .menu-item.is-active { color: #087468; font-weight: 700; }
.hb-web-portal .menu-indicator { background: #d7eee9; border: 1px solid #c5e5df; border-radius: 18px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7); }
.hb-web-portal .menu-card .menu-footnote { margin-top: 22px; padding: 18px 10px 10px; font-size: .875rem; line-height: 1.75; }
.hb-web-portal .auth-pill { margin: 16px 0 0; border-radius: 16px; background: #f4f8fc; border: 1px solid var(--color-hairline-soft); font-size: 1rem; }
.hb-web-portal .auth-pill-name { font-size: 1rem; }
.hb-web-portal .auth-pill :is(.auth-pill-hint, .auth-pill-cta, .auth-pill-logout) { font-size: .875rem; }
.hb-web-portal .auth-pill.is-verified { background: #eef8f5; }
.hb-web-portal .auth-pill.is-unverified { color: var(--color-body); }
.hb-web-portal .auth-pill.is-unverified .auth-pill-hint { color: var(--color-muted); }
.hb-web-portal .auth-pill.is-unverified .auth-pill-cta { background: #e3ecff; color: #204fbd; border-radius: 10px; }
.hb-web-portal .cat-toc { margin-top: 20px; padding: 0 6px; min-height: 0; flex: 1 1 auto; background: transparent; }
.hb-web-portal .cat-toc-title { font-size: .75rem; font-weight: 700; letter-spacing: .06em; flex-shrink: 0; }
.hb-web-portal .cat-toc-list { max-height: none; min-height: 0; flex: 1 1 auto; overscroll-behavior-y: contain; }
.hb-web-portal .cat-toc-item { border-radius: 12px; flex-shrink: 0; font-size: 1rem; padding-block: 10px; }
.hb-web-portal .cat-toc-item .cat-toc-count { font-size: .8125rem; }
.hb-web-portal .cat-toc-label { min-width: 0; overflow-wrap: anywhere; }
.hb-web-portal .cat-toc-item.is-active { background: #eaf1fb; }
.hb-web-portal .col-left .menu-bottom { padding-top: 20px; font-size: .75rem; flex-shrink: 0; }
.hb-web-portal .submit-btn { border-radius: 12px; background: rgba(255, 255, 255, .75); border-color: var(--color-hairline); font-size: .875rem; padding: 8px 10px; }
.hb-web-portal .col-middle { height: 100%; min-height: 0; padding-top: 32px; }
.hb-web-portal .greeting { padding: 0 4px 14px; gap: 8px; }
.hb-web-portal .greeting .greeting-name { font-size: 1.125rem; font-weight: 650; }
.hb-web-portal .greeting .greeting-text { font-size: 1rem; }
.hb-web-portal .greeting .greeting-icon { font-size: 1.375rem; }
.hb-web-portal .greeting .greeting-sep { font-size: 15px; }
.hb-web-portal .middle-header { padding-bottom: 24px; }
.hb-web-portal .workspace-eyebrow { font-size: .75rem; color: var(--color-muted); letter-spacing: .16em; font-weight: 650; margin-bottom: 8px; }
.hb-web-portal .middle-title { font-size: 2.5rem; font-weight: 750; line-height: 1.3; letter-spacing: -.035em; }
.hb-web-portal .middle-sub { font-size: 1rem; margin-top: 10px; }
.hb-web-portal .middle-scroll { padding: 4px 6px 32px; scrollbar-gutter: stable; overscroll-behavior-y: contain; }
.hb-web-portal .workspace-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; }
.hb-web-portal .workspace-search { flex: 1 1 200px; display: flex; align-items: center; gap: 12px; padding: 6px 16px; min-height: 60px; background: rgba(255, 255, 255, .85); border: 1px solid #d5e1ee; border-radius: 20px; color: var(--color-muted); }
.hb-web-portal .workspace-search:focus-within { border-color: #7197e5; box-shadow: 0 0 0 3px rgba(39, 93, 218, .08); }
.hb-web-portal .workspace-search svg { flex: 0 0 auto; }
.hb-web-portal .workspace-search input { min-width: 0; width: 100%; border: 0; background: transparent; outline: 0; box-shadow: none; color: var(--color-ink); font: inherit; font-size: 1rem; line-height: 1.5; padding: 7px 0; }
.hb-web-portal .workspace-search input::-webkit-search-cancel-button { display: none; }
.hb-web-portal .workspace-search button { border: 0; background: #edf3fb; color: var(--color-muted); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 18px; flex: 0 0 auto; }
.hb-web-portal .workspace-count { font-size: .875rem; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.hb-web-portal .workspace-count:empty { display: none; }
.hb-web-portal .cat-heading { font-size: 1.125rem; font-weight: 650; gap: 12px; margin: 30px 0 14px; }
.hb-web-portal .cat-heading.is-first { margin-top: 0; }
.hb-web-portal .cat-heading::after { margin-bottom: 4px; background: #dbe5f1; }
.hb-web-portal .cat-heading-count { font-size: .8125rem; }
.hb-web-portal .card-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.hb-web-portal .tile {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 16px;
    row-gap: 6px;
    align-items: start;
    min-height: 158px;
    padding: 24px 20px;
    border: 1px solid rgba(255, 255, 255, .98);
    border-radius: 26px;
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 5px 18px rgba(78, 108, 148, .035);
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.hb-web-portal .tile:hover { background: #fff; border-color: #bdcee4; box-shadow: 0 8px 20px rgba(70, 102, 151, .08); transform: translateY(-2px); }
.hb-web-portal .tile.tile-paused:hover { transform: none; box-shadow: 0 5px 18px rgba(78, 108, 148, .035); }
.hb-web-portal .tile-icon { grid-column: 1; grid-row: 1 / 4; width: 60px; height: 60px; margin-top: 4px; background: transparent; border-radius: 15px; }
.hb-web-portal .tile-icon img { width: 60px; height: 60px; }
.hb-web-portal .tile-title { grid-column: 2; font-size: 1.125rem; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; padding-right: 4px; }
.hb-web-portal .tile-desc { grid-column: 2; font-size: .875rem; line-height: 1.65; color: var(--color-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hb-web-portal .tile-foot { grid-column: 2; font-size: .8125rem; line-height: 1.5; margin-top: 4px; padding-right: 44px; color: #55718d; }
.hb-web-portal .native-corner-badge { width: auto; height: auto; background: none; clip-path: none; top: auto; bottom: 13px; right: 12px; }
.hb-web-portal .native-corner-badge span { position: static; display: block; width: auto; transform: none; color: #52768c; background: #edf5f9; padding: 3px 6px; font-size: .75rem; letter-spacing: 0; border-radius: 5px; }
.hb-web-portal.is-unverified .tile.gated::after { position: static; grid-column: 2; grid-row: 4; background: #edf2fa; color: #526b88; font-size: .8125rem; justify-self: start; padding: 3px 7px; }
.hb-web-portal .article-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.hb-web-portal .article-card { border: 1px solid rgba(255, 255, 255, .9); border-radius: 22px; background: #fff; box-shadow: var(--web-shadow); }
.hb-web-portal .article-card:hover { background: #fafdff; }
.hb-web-portal .article-body { padding: 16px 18px 20px; }
.hb-web-portal .article-title { font-size: 1.3125rem; font-weight: 650; line-height: 1.5; }
.hb-web-portal .article-summary { font-size: .9375rem; }
.hb-web-portal :is(.article-meta, .res-type-badge, .announce-date) { font-size: .8125rem; }
.hb-web-portal .announce-card { background: #fff; border: 1px solid rgba(220, 231, 242, .85); padding: 24px; border-radius: 22px; }
.hb-web-portal .announce-card::before { top: 23px; left: 24px; background: #087e73; }
.hb-web-portal .announce-title { font-size: 21px; font-weight: 650; }
.hb-web-portal .announce-body { font-size: 1rem; }
.hb-web-portal .empty { border: 1px dashed #cbd8e8; border-radius: 20px; background: rgba(255, 255, 255, .5); }
.hb-web-portal .empty h3 { font-size: 20px; }

/* Search and AI remain available beside the workspace on wide screens. */
.hb-web-portal .col-right { top: 0; height: 100%; min-width: 0; gap: 18px; }
.hb-web-portal :is(.search-card, .notice-ticker, .chat-card) { border: 1px solid rgba(255, 255, 255, .94); border-radius: 24px; box-shadow: var(--web-shadow); }
.hb-web-portal .search-card { background: var(--web-glass); padding: 22px; }
.hb-web-portal .search-card-head { font-size: 1rem; font-weight: 650; color: var(--color-body); }
.hb-web-portal .search-form { background: rgba(255, 255, 255, .9); border-radius: 16px; min-height: 52px; }
.hb-web-portal .search-form:focus-within { box-shadow: 0 0 0 3px rgba(39, 93, 218, .08); }
.hb-web-portal .search-submit { width: 38px; height: 38px; border-radius: 12px; }
.hb-web-portal .search-input { font-size: .9375rem; }
.hb-web-portal .search-foot { font-size: .75rem; text-align: left; margin-left: 2px; }
.hb-web-portal .notice-ticker { padding: 18px 20px 14px; }
.hb-web-portal .notice-ticker-head { font-size: 1rem; }
.hb-web-portal .notice-ticker-stage { min-height: 3em; }
.hb-web-portal .notice-item-text { font-size: 1rem; }
.hb-web-portal :is(.chat-card, .chat-fullscreen) { --color-on-dark: #10243a; --color-on-dark-soft: #566c82; background: rgba(255, 255, 255, .78); color: var(--color-ink); }
.hb-web-portal .chat-head { padding: 20px; gap: 12px; border-color: var(--color-hairline-soft); background: linear-gradient(120deg, #f7fcfd, #f1f5ff); flex-shrink: 0; }
.hb-web-portal .workspace-ai-icon { width: 44px; height: 44px; object-fit: contain; flex: 0 0 auto; }
.hb-web-portal .chat-head .title { font-size: 1.125rem; font-weight: 700; }
.hb-web-portal .chat-head .title small { display: block; font-size: .75rem; font-weight: 400; color: var(--color-muted); margin-top: 3px; }
.hb-web-portal .chat-head .sub { font-size: .75rem; }
.hb-web-portal .chat-stream { padding: 18px 14px; gap: 18px; }
.hb-web-portal .chat-stream::-webkit-scrollbar-thumb { background: var(--color-hairline); }
.hb-web-portal .msg { font-size: 1rem; line-height: 1.75; flex-shrink: 0; overflow-wrap: anywhere; }
.hb-web-portal .msg-bot { max-width: 100%; background: transparent; padding: 4px 3px; }
.hb-web-portal .msg-user { background: #e8effc; color: #173f78; border-radius: 16px 16px 5px 16px; }
.hb-web-portal .msg-bot :is(.chat-reasoning, .chat-reasoning-body) { border-color: #d8e4f0; }
.hb-web-portal .msg-bot .chat-reasoning { background: #eef4fa; }
.hb-web-portal .msg-bot.md-content a { color: #275dda; }
.hb-web-portal .msg-bot.md-content a:hover { color: #1743a2; }
.hb-web-portal .msg-bot.md-content code { background: #e6eef8; }
.hb-web-portal .msg-bot.md-content pre { background: #172b42; color: #eef5fc; border-radius: 13px; }
.hb-web-portal .msg-bot.md-content pre code { color: inherit; background: transparent; }
.hb-web-portal .msg-bot.md-content :is(th, td, hr) { border-color: #d7e2ee; }
.hb-web-portal .msg-bot.md-content blockquote { border-color: #becfe5; }
.hb-web-portal :is(.chat-foot, .cf-foot) { background: rgba(246, 250, 255, .95); border-color: #e2eaf3; flex-shrink: 0; }
/* Multiple attachments + a tall draft must not push send controls outside the
 * bounded sidebar card. This does not constrain the full-screen chat composer. */
.hb-web-portal .col-right .chat-foot { min-height: 0; max-height: 55%; overflow-y: auto; overscroll-behavior-y: contain; }
.hb-web-portal .chat-input-wrap { border: 1px solid #d1dfee; background: #fff; border-radius: 19px; padding: 6px; gap: 5px; }
.hb-web-portal .chat-input-wrap:focus-within { border-color: #769be5; box-shadow: 0 0 0 3px rgba(39, 93, 218, .06); }
.hb-web-portal .chat-input { font-size: .9375rem; min-width: 0; }
.hb-web-portal .chat-send { border-radius: 14px; width: 44px; height: 44px; flex-basis: 44px; }
.hb-web-portal .chat-attach { width: 40px; height: 40px; flex-basis: 40px; }
.hb-web-portal .chat-hint { color: #64788f; font-size: .75rem; line-height: 1.6; }
.hb-web-portal .chat-fullscreen { background: #f2f6fc; }
.hb-web-portal .cf-side { background: rgba(232, 242, 248, .97); border-color: var(--color-hairline); }
.hb-web-portal .cf-head { background: rgba(255, 255, 255, .75); border-color: var(--color-hairline); }
.hb-web-portal .cf-head .title { font-weight: 650; }
.hb-web-portal .cf-item.is-current { background: #d7e7f5; }
.hb-web-portal .cf-item.is-current .cf-item-title { color: #275dda; }
.hb-web-portal .cf-item:hover { background: #dfebf8; }
.hb-web-portal .cf-side-foot { border-color: var(--color-hairline); }
.hb-web-portal .cf-stream .msg-bot { max-width: min(100%, 860px); }
.hb-web-portal .cf-exit { border-color: var(--color-hairline); }
.hb-web-portal :is(.auth-card, .submit-card) { border-radius: 26px; background: #fafdff; border: 1px solid #fff; box-shadow: 0 24px 80px rgba(28, 60, 105, .2); }
.hb-web-portal :is(.auth-title, .submit-card h2) { font-size: 25px; }
.hb-web-portal :is(.auth-backdrop, .submit-backdrop) { background: rgba(28, 49, 77, .35); }
.hb-web-portal :is(.auth-input, .submit-field input, .submit-field textarea, .submit-field select):focus { box-shadow: 0 0 0 3px rgba(39, 93, 218, .1); }
.hb-web-portal .cal-stage { background: #fff; border-radius: 18px; }
.hb-web-portal .cal-viewtoggle { overflow: hidden; isolation: isolate; }

/* Shared administration shell. Inner application dashboards do not opt in. */
.hb-web-admin .admin-shell { grid-template-columns: 222px minmax(0, 1fr); gap: 24px; padding: 20px; max-width: 1920px; margin: auto; }
.hb-web-admin .admin-side { top: 20px; height: calc(100dvh - 40px); border: 1px solid #fff; border-radius: 25px; background: var(--web-glass); padding: 22px 12px 16px; box-shadow: var(--web-shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.hb-web-admin .admin-side .brand { font-weight: 750; font-size: 21px; padding: 0 8px 16px; align-items: center; }
.hb-web-admin .admin-side .brand small { display: block; font-size: 11px; color: var(--color-muted); font-weight: 450; margin-top: 3px; }
.hb-web-admin .admin-nav-label { display: block; margin: 16px 12px 7px; font-size: 10px; letter-spacing: .08em; color: var(--color-muted); font-weight: 650; }
.hb-web-admin .admin-nav a { min-height: 38px; padding: 8px 12px; font-size: 12px; border-radius: 11px; margin: 2px 0; }
.hb-web-admin .admin-nav a.is-active, .hb-web-admin .admin-nav a.is-active:hover { background: #d7eee9; color: #087468; font-weight: 700; }
.hb-web-admin .admin-side .side-foot { margin: 20px 8px 0; padding-top: 12px; }
.hb-web-admin .admin-main { min-width: 0; padding: 18px 12px 60px; max-width: none; }
.hb-web-admin .admin-head { margin-bottom: 26px; }
.hb-web-admin .admin-head h1 { font-size: 30px; font-weight: 750; }
.hb-web-admin .admin-head .sub { margin-top: 8px; font-size: 13px; }
.hb-web-admin .app-metadata-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; gap: 24px; }
.hb-web-admin .app-metadata-copy { display: grid; gap: 18px; }
.hb-web-admin :is(.stat-card, .row-form, .editor-card) { border: 1px solid rgba(255, 255, 255, .98); background: rgba(255, 255, 255, .87); box-shadow: var(--web-shadow); border-radius: 20px; }
.hb-web-admin .stat-card .num { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hb-web-admin .tbl { background: #fff; border: 1px solid var(--color-hairline-soft); box-shadow: 0 5px 24px rgba(51, 87, 129, .035); }
.hb-web-admin .tbl thead { background: #eaf1f9; }
.hb-web-admin .tbl th { font-size: 12px; color: var(--color-muted); font-weight: 650; }
.hb-web-admin .tbl td { font-size: 13px; }
.hb-web-admin .tbl tbody tr:hover { background: #f5f9fd; }
.hb-web-admin .tbl .ico { width: 42px; height: 42px; background: transparent; }
.hb-web-admin .tbl .ico img { width: 36px; height: 36px; }
.hb-web-admin :is(.field input, .field textarea, .field select, .md-input):focus { box-shadow: 0 0 0 3px rgba(39, 93, 218, .1); }
.hb-web-admin .row-form .form-grid { column-gap: 16px; row-gap: 18px; }
.hb-web-admin .field label { font-weight: 600; }
.hb-web-login .login-wrap { background: transparent; }
.hb-web-login .login-card { max-width: 420px; border: 1px solid #fff; border-radius: 28px; background: rgba(255, 255, 255, .86); box-shadow: 0 20px 70px rgba(57, 88, 135, .11); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.hb-web-login .login-brand-logo { display: block; margin-bottom: 26px; border-radius: 10px; }
.hb-web-login .login-card h1 { font-size: 27px; font-weight: 700; }
.hb-web-login .field input:focus { box-shadow: 0 0 0 3px rgba(39, 93, 218, .1); }
.hb-web-intro .zip-half.left { background: linear-gradient(145deg, #f4f8fd, #e7f3f4); }
.hb-web-intro .zip-half.right { background: linear-gradient(215deg, #f1f5ff, #f7fafc); }
.hb-web-intro .zip-half::after { opacity: .15; }
.hb-web-intro .cover-title { font-size: clamp(32px, 4.6vw, 74px); font-weight: 750; line-height: 1.15; }
.hb-web-intro .cover-eyebrow { font-size: 11px; }
.hb-web-intro .cover-sub { font-size: 15px; }
.hb-web-intro .zip-slider { background: #d5ede9; border: 1px solid #b9dbd6; color: #087468; box-shadow: 0 12px 36px rgba(45, 101, 128, .12), inset 0 1px 0 #fff; }
.hb-web-intro .intro-skip { background: rgba(255, 255, 255, .8); border: 1px solid #d1ddea; border-radius: 999px; padding: 9px 16px; }
.hb-web-intro .tl-dot { box-shadow: 0 0 0 6px rgba(39, 93, 218, .07); }
.hb-web-intro .tl-title { font-size: clamp(24px, 3vw, 34px); font-weight: 650; }
.hb-web-intro .tl-final { background: #173c57; border: 1px solid #38647e; box-shadow: 0 18px 46px rgba(40, 76, 112, .14); }
.hb-web-intro .tl-final .final-eyebrow { color: #b9e2dd; }

/* Standalone readers opt out in native sessions and when the PWA theme is active. */
html:not([data-hb-surface="pwa"]) .hb-web-reader :is(.reader, .resource-view) { margin: 32px auto; padding: 28px 38px 48px; border: 1px solid rgba(255, 255, 255, .94); border-radius: 28px; background: rgba(255, 255, 255, .89); box-shadow: var(--web-shadow); max-width: min(1100px, calc(100% - 48px)); }
html:not([data-hb-surface="pwa"]) .hb-web-reader .reader { max-width: min(940px, calc(100% - 48px)); }
html:not([data-hb-surface="pwa"]) .hb-web-reader .back-link { font-size: 13px; color: var(--color-muted); margin-bottom: 26px; }
html:not([data-hb-surface="pwa"]) .hb-web-reader :is(.reader-title, .rv-title) { font-size: clamp(27px, 3vw, 40px); font-weight: 700; line-height: 1.4; }
html:not([data-hb-surface="pwa"]) .hb-web-reader :is(.reader-cover, .rv-cover, .rv-player) { border-radius: 20px; }
html:not([data-hb-surface="pwa"]) .hb-web-reader .reader-body { font-size: 16px; line-height: 1.9; }
html:not([data-hb-surface="pwa"]) .hb-web-reader .noaccess-card { border: 1px solid #fff; border-radius: 26px; box-shadow: var(--web-shadow); }

@media (min-width: 981px) {
    html:not([data-hb-surface="pwa"]) body.hb-web-portal { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
    .hb-web-portal .app-shell { height: 100vh; height: 100dvh; min-height: 0; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
    .hb-web-portal :is(.col-left, .col-right) { position: relative; align-self: stretch; }
    .hb-web-portal .col-left > :not(.cat-toc) { flex-shrink: 0; }
    .hb-web-portal :is(.greeting, .middle-header) { flex-shrink: 0; }
    .hb-web-portal .middle-scroll { overflow-y: auto; min-height: 0; }
    .hb-web-portal .chat-stream { overflow-y: auto; overscroll-behavior-y: contain; }
    /* Six-row months keep readable cells on short displays; only the centre
     * scrolls. Do not scale the week timeline's JS-calculated hour geometry. */
    .hb-web-portal .pane[data-pane="schedule"].is-active { min-height: 580px; }
}
@media (min-width: 981px) and (max-width: 1599px) {
    .hb-web-portal .app-shell { gap: 24px; }
}
@media (min-width: 681px) and (max-height: 900px) {
    .hb-web-portal .col-left { padding-top: 16px; }
    .hb-web-portal .brand-row { padding-bottom: 16px; }
    .hb-web-portal .col-left .menu-card .menu-footnote { display: none; }
    .hb-web-portal .menu-item { height: 3rem; }
    .hb-web-portal .menu-list { gap: 4px; }
    .hb-web-portal .auth-pill { padding: 9px 10px; }
    .hb-web-portal .cat-toc { margin-top: 16px; }
    .hb-web-portal .cat-toc-item { padding-block: 7px; }
    .hb-web-portal .col-left .menu-bottom { padding-top: 12px; }
    .hb-web-portal .col-middle { padding-top: 20px; }
    .hb-web-portal .middle-header { padding-bottom: 18px; }
    .hb-web-portal .search-card { padding: 16px 18px; }
    .hb-web-portal .notice-ticker { padding: 14px 18px 12px; }
    .hb-web-portal .col-right { gap: 12px; }
}
@media (min-width: 981px) and (max-width: 1179px) {
    .hb-web-portal .app-shell { grid-template-columns: 220px minmax(0, 1fr) 340px; gap: 20px; }
    .hb-web-portal .col-left { padding-inline: 12px; }
    .hb-web-portal .brand-row { gap: 8px; padding-inline: 0; }
    .hb-web-portal .card-grid { grid-template-columns: minmax(0, 1fr); }
    .hb-web-portal .chat-head { padding-inline: 12px; gap: 6px; }
    .hb-web-portal .workspace-ai-icon { width: 36px; height: 36px; }
}
/* Very short windows/large browser zoom must still expose every control. These
 * are panel-local safety scrolls, never a second document scrollbar. */
@media (min-width: 981px) and (max-height: 600px) {
    .hb-web-portal .col-left { overflow-y: auto; overscroll-behavior-y: contain; }
    .hb-web-portal .cat-toc { flex: 0 0 auto; }
    .hb-web-portal .cat-toc-list { max-height: 140px; }
    .hb-web-portal .col-right { overflow-y: auto; overscroll-behavior-y: contain; }
    .hb-web-portal .chat-card { flex: 1 0 280px; }
}
@media (max-width: 980px) {
    .hb-web-portal .app-shell { grid-template-columns: 180px minmax(0, 1fr); gap: 20px; padding: 16px; }
    .hb-web-portal .col-left { position: sticky; top: 16px; grid-row: 1 / 3; height: calc(100dvh - 32px); min-height: 580px; border-radius: 24px; padding-inline: 12px; }
    .hb-web-portal .brand-row { flex-wrap: wrap; gap: 8px; padding-inline: 0; }
    .hb-web-portal .brand-name { font-size: 1.375rem; }
    .hb-web-portal .menu-item { padding-inline: 12px; font-size: 1rem; }
    .hb-web-portal .col-middle { height: auto; min-height: 520px; padding-top: 12px; }
    .hb-web-portal .middle-scroll { overflow: visible; padding-bottom: 0; }
    .hb-web-portal .menu-list { flex-direction: column; }
    .hb-web-portal .menu-item { width: 100%; }
    .hb-web-portal .menu-card .menu-footnote { display: block; }
    .hb-web-portal .col-right { grid-column: 2; position: relative; top: 0; height: auto; }
    .hb-web-portal .chat-card { flex: auto; height: 540px; }
    .hb-web-portal .cat-toc-list { flex-direction: column; flex-wrap: nowrap; }
    .hb-web-portal .cat-toc-item { flex: 0 0 auto; width: 100%; }
    .hb-web-portal .cat-toc-item { font-size: .875rem; }
    .hb-web-admin .admin-shell { grid-template-columns: 188px minmax(0, 1fr); padding: 14px; gap: 16px; }
    .hb-web-admin .admin-main { padding-inline: 0; overflow-x: auto; }
    .hb-web-admin .admin-side { height: calc(100dvh - 28px); top: 14px; }
}
@media (max-width: 680px) {
    .hb-web-admin .app-metadata-grid { grid-template-columns: minmax(0, 1fr); }
    .hb-web-portal .app-shell { display: block; padding: 12px; }
    .hb-web-portal .col-left { position: relative; top: 0; min-height: 0; height: auto; padding: 14px 12px; border-radius: 22px; }
    .hb-web-portal .brand-row { align-items: center; flex-wrap: nowrap; padding: 0 3px 15px; }
    .hb-web-portal .brand-name small { display: inline; margin-left: 9px; }
    .hb-web-portal .menu-list { flex-direction: row; gap: 3px; }
    .hb-web-portal .menu-item { height: 44px; padding-inline: 6px; gap: 5px; justify-content: center; font-size: .875rem; }
    .hb-web-portal .menu-indicator { display: none; }
    .hb-web-portal .menu-item.is-active { background: #d7eee9; }
    .hb-web-portal .menu-icon svg { width: 15px; height: 15px; }
    .hb-web-portal .menu-card .menu-footnote, .hb-web-portal .cat-toc { display: none; }
    .hb-web-portal .col-left .menu-bottom { flex-direction: row; justify-content: space-between; align-items: center; padding-top: 10px; }
    .hb-web-portal .menu-bottom > span { display: none; }
    .hb-web-portal .col-middle { padding: 24px 4px; min-height: 0; }
    .hb-web-portal .middle-title { font-size: 29px; }
    .hb-web-portal .middle-header { padding-bottom: 19px; }
    .hb-web-portal .card-grid { grid-template-columns: minmax(0, 1fr); }
    .hb-web-portal .col-right { padding-inline: 4px; }
    .hb-web-portal .workspace-eyebrow { font-size: .75rem; }
    .hb-web-admin .admin-shell { display: block; padding: 12px; }
    .hb-web-admin .admin-side { position: relative; top: 0; height: auto; padding: 14px; }
    .hb-web-admin .admin-side .brand { padding-bottom: 14px; }
    .hb-web-admin .admin-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
    .hb-web-admin .admin-nav a { flex: 0 0 auto; border: 1px solid #dce6f0; }
    .hb-web-admin .admin-nav-label { display: none; }
    .hb-web-admin .admin-side .side-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; }
    .hb-web-admin .admin-main { padding-top: 25px; }
    .hb-web-admin .admin-head h1 { font-size: 27px; }
    html:not([data-hb-surface="pwa"]) .hb-web-reader :is(.reader, .resource-view) { max-width: calc(100% - 24px); margin: 12px auto; padding: 20px 18px 32px; border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) {
    .hb-web-portal :is(.tile, .article-card, .menu-indicator, .pane, .msg) { animation: none; transition: none; }
    .hb-web-portal .tile:hover { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
    html:not([data-hb-surface="pwa"]) body.hb-web { --web-glass: #f8fbfe; }
    .hb-web-portal .col-left, .hb-web-admin .admin-side, .hb-web-login .login-card { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    html:not([data-hb-surface="pwa"]) body.hb-web { --web-glass: #f8fbfe; }
}
