/* v1.5.1 — mobile presentation only. No API, permissions or data changes. */
:root { --mobile-nav-height: 66px; --visual-height: 100dvh; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-block: 130px 90px; }
body { overflow-wrap: break-word; }
button, input, select, textarea { font-family: inherit; }
button, a, select, input, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #8275eb; outline-offset: 3px; }
[hidden] { display: none !important; }
img, video, iframe { max-inline-size: 100%; }
.grid > *, .dashboard-layout > *, .employee-hero > *, .ws-campaign-grid > *,
.profile-main > *, .person-main, .search, .ops-form > *, .modal-cols > * { min-inline-size: 0; }
.topbar, .content, .card, .ws-panel, .ws-dialog, .ops-modal, .modal-card { overflow-wrap: anywhere; }
.sidebar { height: 100dvh; }
.mobile-brand, .mobile-bottom-nav, .mobile-nav-close, .mobile-nav-backdrop { display: none; }
.kpi-source-row { flex-wrap: wrap; }
.kpi-source-row small { font-size: 11px; color: #66758a; }
.kpi-meta, .kpi-foot { flex-wrap: wrap; gap: 6px; }
.section-head { gap: 10px; flex-wrap: wrap; }
.section-head > h3 { flex: 1 1 150px; }
.section-head > .filters { flex: 1 1 100%; }
.ws-file footer { gap: 12px; flex-wrap: wrap; }
.ws-file-top { gap: 10px; }
.ws-pill, .pill { max-inline-size: 100%; white-space: normal; line-height: 1.5; }
.ws-file-icon, .kpi-icon { flex-shrink: 0; }
.agent-input input { min-width: 0; width: 0; }
.agent-drawer { max-height: 85vh; max-height: 85dvh; }
.toast { max-inline-size: calc(100vw - 32px); line-height: 1.7; overflow-wrap: anywhere; z-index: 3000; }
/* A scrollable modal always has a reachable heading/close button and footer. */
.ws-dialog, .ops-modal, .modal-card { overscroll-behavior: contain; }
.ws-dialog > header { z-index: 3; }
.ws-dialog form > .ws-actions:last-child,
.ops-modal form > button[type="submit"],
.meeting-modal form > .ai-actions:last-child {
  position: sticky; bottom: 0; z-index: 2;
}
.ws-dialog form > .ws-actions:last-child, .meeting-modal form > .ai-actions:last-child {
  padding-block: 12px; background: #fff; border-top: 1px solid var(--border);
}
.mobile-card-table { /* semantic table roles and data labels are added by mobile.js */ }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media (max-width: 1100px) and (min-width: 931px) {
  .kpi-grid, .manager-page .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  .manager-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .manager-main-grid, .manager-ops-grid, .manager-bottom-grid { grid-template-columns: minmax(0,1fr); }
  .topbar { gap: 10px; padding-inline: 16px; }
  .topbar .date { font-size: 11px; }
}

@media (max-width: 930px) {
  .app-shell { display: block; min-height: 100dvh; }
  .main, .content { inline-size: 100%; min-inline-size: 0; }
  .content {
    padding: 18px max(16px,env(safe-area-inset-right)) calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 28px) max(16px,env(safe-area-inset-left));
  }
  /* Navigation drawer stays in the DOM but is neither focusable nor visible when closed. */
  .sidebar {
    position: fixed; inset: 0 0 auto auto; inline-size: min(320px,calc(100vw - 48px));
    height: 100vh; height: var(--visual-height,100dvh);
    max-height: 100dvh; z-index: 850; padding: max(18px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom));
    visibility: hidden; transform: translateX(103%); pointer-events: none;
    transition: transform .2s ease; gap: 18px;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  }
  .sidebar.mobile-open { transform: translateX(0); visibility: visible; pointer-events: auto; }
  /* Keep account controls reachable while the growing navigation scrolls independently. */
  .sidebar { overflow: hidden; }
  .sidebar > .brand, .sidebar > .sidebar-user, .sidebar > .preview-account-switch,
  .sidebar > .ai-credit-balance { flex: 0 0 auto; }
  .sidebar > .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .sidebar .nav-item, .sidebar .nav-more { flex-shrink: 0; }
  .sidebar > .sidebar-spacer { display: none; }
  .mobile-nav-close { display: grid; background: #24344e; color: white; border-color: #40516b; flex-shrink: 0; }
  .sidebar .brand { gap: 12px; padding-inline: 0; }
  .sidebar .brand-copy { margin-inline-end: auto; }
  .sidebar .brand-mark { display: none; }
  .sidebar .nav-item { min-height: 46px; padding: 12px; font-size: 14px; }
  .sidebar .sidebar-user { flex-wrap: wrap; padding: 4px; }
  .sidebar .sidebar-user > div:not(.avatar) { min-inline-size: 0; flex: 1; }
  .sidebar .ai-mini { display: none; }
  .mobile-nav-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 840; background: #06132688; border: 0; padding: 0; }
  body.mobile-menu-open, body.mobile-modal-open { overflow: hidden; }
  .mobile-bottom-nav {
    display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); direction: rtl;
    position: fixed; bottom: 0; inset-inline: 0; z-index: 60;
    min-height: var(--mobile-nav-height); background: #fffffff5; backdrop-filter: blur(14px);
    border-top: 1px solid #e0e6f0; box-shadow: 0 -6px 24px #1d325509;
    padding: 5px max(4px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left));
  }
  .mobile-nav-item {
    display: flex; align-items: center; justify-content: center; flex-direction: column;
    gap: 5px; min-height: 54px; border: 0; background: transparent; border-radius: 12px;
    color: #69758a; font-family: inherit; font-weight: 600; line-height: 1.3; font-size: 11px; padding: 6px 2px;
  }
  .mobile-nav-item .mobile-nav-icon { font-size: 21px; height: 23px; line-height: 23px; }
  .mobile-nav-item.active, .mobile-nav-item[aria-expanded="true"] { color: #5243c1; background: #f0edff; }
  .mobile-brand { display: flex; min-width: 0; flex-direction: column; margin-inline-end: auto; gap: 2px; }
  .mobile-brand strong { font-size: 16px; }
  .mobile-brand small { color: #6b7890; font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar {
    height: auto; min-height: 64px; padding: 10px max(16px,env(safe-area-inset-right)) 10px max(16px,env(safe-area-inset-left));
    gap: 10px; flex-wrap: wrap; padding-top: max(10px,env(safe-area-inset-top));
  }
  .topbar .date { display: none; }
  .topbar .search { display: block; max-width: none; order: 10; flex: 1 1 100%; margin: 0; }
  .topbar .search input { height: 44px; font-size: 16px; width: 100%; }
  .topbar .search::before { top: 9px; }
  .top-actions { margin-inline-start: auto; gap: 8px; }
  .icon-btn { min-width: 44px; min-height: 44px; border-radius: 12px; }
  .logout-btn { min-width: 44px; min-height: 44px; }
  .btn, .filter, .tab, .mini-edit, .link-btn { min-height: 44px; font-size: 13px; }
  .btn, .filter { padding: 10px 13px; line-height: 1.55; }
  .btn, .filter, .tab { max-inline-size: 100%; }
  .task-link, .ws-text-btn, .mm-text-link { min-height: 44px; display: inline-flex; align-items: center; font-size: 14px; line-height: 1.75; }
  .ws-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 44px; font-size: 16px !important; max-width: 100%; min-width: 0; }
  input[type="checkbox"], input[type="radio"] { inline-size: 20px !important; block-size: 20px; min-height: 20px; flex-shrink: 0; accent-color: #5b51f1; }
  .ws-check, .ops-check, .attendee-option { min-height: 44px; }
  .page-head { gap: 12px; margin-bottom: 18px; }
  .page-head h1, .ws-head h1 { font-size: 24px; line-height: 1.5; letter-spacing: -.4px; }
  .page-head p, .ws-head p { font-size: 13px; line-height: 1.85; }
  .notice { font-size: 12px; line-height: 1.8; width: 100%; max-width: none; padding: 10px 12px; }
  .content .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 12px; }
  .manager-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 12px; }
  .manager-summary-grid > :first-child:nth-last-child(odd),
  .kpi-grid > .mobile-stat:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
  .manager-summary-card { padding: 16px; min-height: 116px; gap: 12px; }
  .manager-summary-card b { font-size: 25px; line-height: 1.4; }
  .manager-summary-card span, .manager-summary-card small { line-height: 1.7; font-size: 12px; }
  .manager-summary-card:not(:first-child) .manager-summary-icon { display: none; }
  .kpi-card { padding: 16px; border-radius: 16px; }
  .kpi-top { font-size: 13px; line-height: 1.65; align-items: flex-start; }
  .kpi-top > span:first-child { flex: 1; }
  .kpi-value { font-size: 27px; line-height: 1.4; }
  .kpi-meta { line-height: 1.6; }
  .kpi-meta, .kpi-source-row { gap: 8px; }
  .kpi-source-row { padding-top: 10px; border-top: 1px solid #edf0f6; align-items: center; }
  .kpi-source-row small, .source-tag { font-size: 11px; }
  .section-head h3 { font-size: 17px; line-height: 1.6; }
  .section-head .filters { margin-top: 4px; gap: 8px; }
  .filters, .page-subnav, .ws-tabs { max-inline-size: 100%; }
  .page-subnav { flex-wrap: wrap; overflow: visible; }
  .page-subnav .tab { white-space: normal; text-align: center; line-height: 1.6; }
  .employee-picker { width: 100%; flex-wrap: wrap; padding: 12px; }
  .employee-picker select { width: 100%; min-width: 0; max-width: 100%; }
  .employee-picker span { flex-basis: 100%; }
  .employee-row, .dept-row { min-height: 52px; grid-template-columns: minmax(0,1fr) auto auto; }
  .manager-person-row { grid-template-columns: 36px minmax(0,1fr) auto; min-height: 62px; }
  .manager-person-row .person-arrow { display: none; }
  .manager-person-row > .pill { grid-column: 2 / -1; justify-self: start; }
  .manager-person-row .person-main b { font-size: 13px; }
  .manager-person-row .person-main small { font-size: 11px; line-height: 1.5; }
  .profile-meta > div { font-size: 12px; line-height: 1.7; }
  .chart-wrap { height: clamp(170px,48vw,270px); }
  .chart-legend { flex-wrap: wrap; font-size: 12px; }
  .campaign-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  .campaign-metrics { grid-template-columns: 1fr; }
  .campaign-metrics > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .campaign-metrics span { font-size: 11px; }
  .manager-campaign-row { grid-template-columns: 1fr; gap: 10px; }
  .launch-box { flex-wrap: wrap; gap: 16px; }
  .launch-stats { min-width: 140px; }
  .mm-controls { flex-wrap: wrap; width: 100%; }
  .mm-controls label { flex: 1; min-width: 0; }
  .mm-controls select { width: 100%; }
  .mm-kpi-link { min-height: 44px; }
  .mm-card-title { font-size: 12px; line-height: 1.65; }
  .mm-comparison span, .mm-delta, .mm-drill, .mm-card-status small { font-size: 11px; }
  .mm-detail .table-wrap { max-height: none; }
  .mm-target > div { flex-wrap: wrap; }
  .mm-target input { flex: 1 1 100%; }
  .meeting-card { min-width: 0; gap: 12px; }
  .meeting-card-main { min-width: 0; }
  .meeting-card-head, .minutes-head, .decision-card, .mm-meeting-row { flex-wrap: wrap; gap: 10px; }
  .meeting-meta { flex-direction: column; gap: 6px; }
  .meeting-card-head b { font-size: 14px; line-height: 1.7; }
  .ai-actions { flex-wrap: wrap; }
  .ai-actions > .btn { flex: 1 1 145px; }
  .decision-draft, .modal-cols { grid-template-columns: minmax(0,1fr); }
  .attendee-picker { grid-template-columns: 1fr; max-height: none; }
  .ws-toolbar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 10px; }
  .ws-toolbar > input { grid-column: 1 / -1; width: 100%; min-width: 0; }
  .ws-toolbar label { min-width: 0; }
  .ws-toolbar select { width: 100%; }
  .ws-library-grid, .ws-agenda { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ws-file h3 { font-size: 16px; }
  .ws-file p, .ws-version p, .ws-section p { font-size: 13px; }
  .ws-actions { gap: 10px; }
  .ws-actions h3 { flex: 1 1 100%; line-height: 1.7; }
  .ws-head > .ws-actions { width: 100%; }
  .ws-actions > .btn { flex: 1 1 auto; }
  .ws-budget-top, .ws-budget-row { flex-wrap: wrap; }
  .ws-budget-top strong { font-size: 23px; }
  .ws-budget details, .ws-source-details { font-size: 12px; }
  .ws-budget-line { grid-template-columns: minmax(0,1fr); }
  .ws-prose, .ws-version pre, .ws-source-details pre, .ws-table pre { max-height: none; padding: 12px; font-size: 13px; }
  .ws-ref-list > div { flex-direction: column; }
  /* All operational rows reflow without removing columns or cloning controls. */
  .table-wrap, .ws-table-wrap { max-inline-size: 100%; width: 100%; }
  .table-wrap:has(> .mobile-card-table), .ws-table-wrap:has(> .mobile-card-table) { overflow: visible; }
  .table-wrap > table.mobile-card-table, .ws-table-wrap > table.mobile-card-table, .mm-detail table.mobile-card-table {
    display: block; min-width: 0; width: 100%; max-width: 100%; border: 0;
  }
  .mobile-card-table > thead {
    position: absolute; inline-size: 1px; block-size: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .mobile-card-table > tbody { display: grid; gap: 14px; width: 100%; }
  .mobile-card-table > tbody > tr {
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 14px;
    padding: 14px; border: 1px solid #e2e8f2; border-radius: 14px; background: #fff; min-width: 0;
  }
  .mobile-card-table > tbody > tr > td {
    display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
    padding: 12px 0; border: 0; border-bottom: 1px solid #edf1f6; max-width: 100%; min-width: 0;
    font-size: 13px; line-height: 1.75; white-space: normal !important; overflow-wrap: anywhere;
  }
  .mobile-card-table > tbody > tr > td::before {
    content: attr(data-mobile-label); color: #64748b; font-size: 11px; font-weight: 500; line-height: 1.6;
  }
  .mobile-card-table > tbody > tr > td.mobile-card-title { grid-column: 1 / -1; order: -2; padding-top: 0; }
  .mobile-card-table > tbody > tr > td.mobile-card-title::before { display: none; }
  .mobile-card-table .mobile-card-title b, .mobile-card-table .mobile-card-title button { font-size: 14px; color: #1e2b48; }
  .mobile-card-table > tbody > tr > td.mobile-card-full { grid-column: 1 / -1; }
  .mobile-card-table > tbody > tr > td.mobile-card-full[colspan]::before { display: none; }
  .mobile-card-table > tbody > tr > td > small { font-size: 11px; line-height: 1.65; }
  .mobile-card-table td > .select-inline { width: 100%; }
  .mobile-card-table td > .task-code { font-size: 13px; }
  .mobile-card-table td .btn { white-space: normal; }
  .mobile-card-table .task-title br { display: none; }
  /* Assistant behaves as a sheet on mobile, with the composer outside the message scroller. */
  .agent-fab { left: auto; right: 18px; bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 14px); font-size: 12px; min-height: 46px; padding: 10px 16px; }
  .agent-fab.mobile-agent-active { display: none; }
  .agent-drawer {
    left: 10px; right: 10px; width: auto; max-width: none;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 8px);
    max-height: calc(var(--visual-height,100dvh) - var(--mobile-nav-height) - 32px); z-index: 120;
  }
  .agent-drawer.open { display: flex; flex-direction: column; }
  .agent-head, .agent-input { flex: 0 0 auto; }
  .agent-body { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
  .agent-message { font-size: 14px; }
  .agent-input { padding: 10px; }
  body.mobile-keyboard-open .mobile-bottom-nav, body.mobile-keyboard-open .agent-fab { display: none; }
  body.mobile-keyboard-open .agent-drawer { bottom: var(--keyboard-inset,0px); max-height: calc(var(--visual-height,100dvh) - 16px); }
  .toast { left: 16px; right: 16px; top: auto; bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 12px); font-size: 13px; }
  /* Full-width editing sheets; scrolling is inside the sheet, not behind it. */
  .modal-backdrop { padding: 0; align-items: stretch; overflow: hidden; }
  .ops-modal, .modal-card, .mm-detail, .meeting-modal {
    width: 100%; max-width: 100%; height: var(--visual-height,100dvh); max-height: var(--visual-height,100dvh);
    border-radius: 0; padding: max(18px,env(safe-area-inset-top)) max(18px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left));
    overflow-y: auto; margin: 0;
  }
  .ops-modal > .section-head, .modal-card > .modal-head {
    position: sticky; top: -18px; z-index: 3; background: #fff; padding: 12px 0; align-items: start;
    border-bottom: 1px solid #e8edf4;
  }
  .ops-modal > .section-head h2 { font-size: 21px; line-height: 1.5; flex: 1; margin: 0; }
  .ws-dialog {
    position: fixed; inset: 0; margin: 0; width: 100%; max-width: none;
    height: var(--visual-height,100dvh); max-height: var(--visual-height,100dvh);
    border-radius: 0; overflow-y: auto;
  }
  .ws-dialog > header { padding: max(14px,env(safe-area-inset-top)) max(18px,env(safe-area-inset-right)) 14px max(18px,env(safe-area-inset-left)); }
  .ws-dialog > header > div { flex: 1; min-width: 0; }
  .ws-dialog h2 { font-size: 20px; line-height: 1.6; }
  .ws-dialog-body { padding: 18px max(18px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left)); }
  .ws-close { width: 44px; flex: 0 0 44px !important; }
  .ops-form, .ws-form-grid { grid-template-columns: minmax(0,1fr); }
  .ops-form label, .ws-form-grid label { font-size: 13px; line-height: 1.8; }
  .ops-form fieldset, .ws-form-grid fieldset { min-width: 0; }
  .ws-wide { grid-column: 1 / -1; }
  .ops-modal form > button[type="submit"] { width: 100%; min-height: 48px; box-shadow: 0 -4px 10px #fff; }
  .ws-dialog form > .ws-actions:last-child > button, .meeting-modal form > .ai-actions:last-child > button { min-height: 48px; }
  .ops-modal textarea { min-height: 100px; }
}
@media (max-width: 600px) {
  .ws-library-grid, .ws-agenda, .ws-campaign-grid { grid-template-columns: minmax(0,1fr); }
  .ws-head { align-items: stretch; }
  .ws-file { padding: 18px; }
  .section-card, .ws-panel { padding: 16px; }
  .content .kpi-grid > .mobile-metric { grid-column: 1 / -1; }
  .manager-summary-card { padding: 14px; }
  .ws-toolbar label, .ws-toolbar > .btn { min-width: 0; }
  .ws-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ws-stat { padding: 15px; }
  .ws-stat strong { font-size: 27px; }
  .ws-stat > span { font-size: 12px; line-height: 1.8; }
  .kpi-library { grid-template-columns: minmax(0,1fr); }
  .meeting-card { flex-direction: column; }
  .meeting-card-date { align-self: flex-start; }
  .meeting-card-date b { font-size: 18px; }
  .meeting-card-head { align-items: start; }
}
@media (max-width: 360px) {
  .content { padding-inline: max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-left)); }
  .topbar { padding-inline: 12px; gap: 8px; }
  .topbar .help-button { display: none; }
  .ws-toolbar, .mm-grid, .campaign-grid { grid-template-columns: minmax(0,1fr) !important; }
  .ws-stat { padding: 12px; }
  .mobile-card-table > tbody > tr { gap: 0 10px; padding: 12px; }
}
@media print {
  .mobile-bottom-nav, .mobile-nav-backdrop, .agent-fab { display: none !important; }
}
/* The assistant is in the phone header: no floating button obscures a card or action. */
@media(max-width:930px){
  .agent-fab{display:none!important}
  .topbar .help-button{display:grid}
  .content .mobile-stat{min-height:126px}
}
@media(max-width:930px){
  summary{min-height:44px;padding-block:10px;line-height:1.7}
  .preview-ribbon summary{padding-block:0}
  input[type=date],input[type=datetime-local]{inline-size:100%;max-inline-size:100%;min-inline-size:0}
}

/* v1.5.2: useful startup feedback before app.js mounts. */
.startup-notice{max-width:520px;margin:8vh auto;padding:28px;background:#fff;border:1px solid #e2e8f1;border-radius:18px;font:16px/1.9 system-ui,sans-serif;overflow-wrap:anywhere}
.startup-brand{font-size:26px;color:#564ad7;font-weight:800}.startup-notice h1{font-size:24px}.startup-notice p{color:#64718a}.startup-notice summary{cursor:pointer;min-height:44px}.startup-warning{background:#fff5d8;padding:12px;border-radius:10px}.startup-notice button{min-height:48px;margin-top:14px}
@media(max-width:600px){.startup-notice{margin:24px 16px;padding:22px}.startup-notice h1{font-size:22px}}

/* v1.5.4 strategic KPI refinements */
@media(max-width:430px){
  .strategic-kpi-grid{grid-template-columns:1fr 1fr!important;gap:9px!important}
  .strategic-kpi-card{min-height:168px!important;border-radius:16px!important}
  .strategic-kpi-icon{width:30px;height:30px;border-radius:9px}
  .strategic-kpi-value{font-size:22px!important;margin-top:10px}
  .strategic-kpi-benchmarks{margin-top:9px;padding-top:8px}
  .strategic-kpi-updated{display:none}
}
@media(max-width:350px){.strategic-kpi-grid{grid-template-columns:1fr!important}}
@media(max-width:820px){
  .preview-account-switch{padding:12px 4px 6px}
  .preview-account-switch select{min-height:44px;font-size:14px}
}
