/* LCMS mobile UI contract. Shared tokens and semantic components are the
   baseline for every phone page; feature styles describe only feature layout. */
:root {
  --ui-surface:var(--surface,#fff);--ui-bg:var(--bg,#f3f6fa);--ui-ink:var(--text,#132b46);
  --ui-muted:var(--text2,#65788e);--ui-line:var(--border,#e3e9f1);--ui-accent:var(--ci-trust,#0083ca);
  --ui-radius:14px;--ui-gap:12px;--ui-field-height:46px;--ui-touch:44px;
}
.lcms-ui-button { display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:var(--ui-touch);padding:10px 14px;border:1px solid var(--ui-line);border-radius:10px;background:var(--ui-surface);color:var(--ui-ink);font:inherit;font-size:14px;font-weight:650;line-height:1.4;text-align:center;cursor:pointer;touch-action:manipulation; }
.lcms-ui-button:disabled { opacity:.5;cursor:default; }
.lcms-ui-primary { background:var(--ui-accent);border-color:var(--ui-accent);color:#fff; }
.lcms-ui-danger { color:var(--red,#b82d33);background:var(--red-bg,#fff1f2);border-color:var(--red-bd,#f4c8cb); }
.lcms-ui-field { display:flex;flex-direction:column;gap:7px;min-width:0;color:var(--ui-ink);font-size:13px;font-weight:600; }
.lcms-ui-input { min-width:0;width:100%;min-height:var(--ui-field-height);padding:10px 12px;border:1px solid var(--ui-line);border-radius:10px;background:var(--ui-surface);color:var(--ui-ink);font:inherit;font-size:16px;line-height:1.5; }
select.lcms-ui-input,.lcms-ui-input.form-select { background-repeat:no-repeat;background-position:right 12px center;background-size:12px;padding-right:32px; }
.lcms-ui-card { padding:16px;min-width:0;border:1px solid var(--ui-line);border-radius:var(--ui-radius);background:var(--ui-surface);color:var(--ui-ink); }
.lcms-ui-toolbar { display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0; }
.lcms-ui-empty { padding:28px 16px;text-align:center;color:var(--ui-muted);font-size:14px;line-height:1.7; }
.lcms-ui-help { color:var(--ui-muted);font-size:12px;line-height:1.6; }
.lcms-ui-error { color:var(--red,#b82d33);font-size:13px;line-height:1.6; }
.lcms-ui-sheet { width:min(560px,100%);max-height:var(--lcms-viewport-height,100dvh);background:var(--ui-surface);color:var(--ui-ink);border:1px solid var(--ui-line);border-radius:20px;overflow:auto; }
.lcms-ui-toast { position:fixed;z-index:16000;bottom:calc(var(--lcms-bottom-h,0px) + env(safe-area-inset-bottom,0px) + 12px);left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 32px);padding:12px 16px;border:1px solid var(--ui-line);border-radius:12px;background:var(--ui-ink);color:var(--ui-surface);box-shadow:0 6px 24px #0c284533;font:500 13px/1.6 system-ui,sans-serif; }
.lcms-ui-toast[hidden] { display:none; }
.lcms-ui-toast.is-error { background:#8e2530;color:#fff; }
.lcms-mobile-menu { display:none; }
@media(max-width:760px) {
  html.lcms-phone { --ui-surface:var(--phone-surface,var(--surface,#fff));--ui-bg:var(--phone-bg,var(--bg,#f3f6fa));--ui-ink:var(--phone-ink,var(--text,#132b46));--ui-muted:var(--phone-muted,var(--text2,#65788e));--ui-line:var(--phone-line,var(--border,#e3e9f1)); }
  html.lcms-phone :where(.page,.drawer,.lo-modal,.aia-detail-modal,.lcms-ui-sheet) :where(.btn-primary,.btn-ghost,.btn-danger) { min-height:44px;border-radius:10px;padding:10px 14px;font-size:13px;line-height:1.4;touch-action:manipulation; }
  html.lcms-phone :where(.page,.drawer,.lo-modal,.aia-detail-modal) .btn-primary { background:var(--ui-accent);border-color:var(--ui-accent);box-shadow:none;color:#fff; }
  html.lcms-phone :where(.page,.drawer,.lo-modal,.aia-detail-modal) .btn-ghost { background:var(--ui-surface);border-color:var(--ui-line);box-shadow:none;color:var(--ui-ink); }
  html.lcms-phone :where(.page,.drawer,.lcms-ui-sheet) :where(.form-input,.form-select,.form-textarea) { min-height:46px;border-radius:10px;border-color:var(--ui-line);padding:10px 12px;font-size:16px !important;line-height:1.5; }
  html.lcms-phone :where(.page,.drawer) textarea { resize:vertical;min-height:96px;max-width:100%; }
  html.lcms-phone :where(.page,.drawer,.lcms-ui-sheet) input[type="file"] { width:100%;max-width:100%;color:var(--ui-muted);font-size:13px; }
  html.lcms-phone :where(.page,.drawer,.lcms-ui-sheet) input[type="file"]::file-selector-button { min-height:44px;margin-right:10px;padding:8px 12px;border:1px solid var(--ui-line);border-radius:10px;background:var(--ui-bg);color:var(--ui-ink);font-family:inherit;font-size:13px;font-weight:600;line-height:1.4; }
  html.lcms-phone :where(.page,.drawer) .form-group { min-width:0;margin-bottom:16px; }
  html.lcms-phone :where(.page,.drawer) .form-label { display:block;margin-bottom:7px;color:var(--ui-ink);font-size:13px;line-height:1.5; }
  html.lcms-phone .page > .page-fixed-header { min-width:0;gap:12px;padding:14px !important;border-radius:14px 14px 0 0;background:var(--ui-surface);border-color:var(--ui-line); }
  html.lcms-phone .page > .page-fixed-header > div { min-width:0;max-width:100%; }
  html.lcms-phone .page :where(.page-meta,.page-subtitle) { color:var(--ui-muted);font-size:12px;line-height:1.5; }
  html.lcms-phone .page:not(#page-masterplan):not(#page-liftoffice):not(#page-assetledger):not(#page-assetissueapproval) :where(.table-wrap,.table-container) { max-width:100%;min-width:0;overflow-x:auto;overscroll-behavior-x:contain; }
  html.lcms-phone .page :where(.panel,.card) { border-color:var(--ui-line);border-radius:14px;box-shadow:none; }
  html.lcms-phone .drawer { padding:16px 16px calc(20px + env(safe-area-inset-bottom,0px));background:var(--ui-surface);border:0; }
  html.lcms-phone .drawer-header { align-items:center;gap:12px;margin-bottom:18px; }
  html.lcms-phone .drawer-title { font-size:20px;line-height:1.4;overflow-wrap:anywhere; }
  html.lcms-phone .drawer-close { width:44px;height:44px;min-width:44px;border-radius:12px;font-size:24px; }
  html.lcms-phone .drawer-body { padding:0; }
  html.lcms-phone .drawer.open select,html.lcms-phone .drawer.open option { visibility:visible; }
  html.lcms-phone .drawer-actions { display:flex;gap:8px;flex-wrap:wrap;position:sticky;bottom:0;padding:14px 0;background:var(--ui-surface);border-top:1px solid var(--ui-line); }
  html.lcms-phone .drawer-actions > button { flex:1; }
  html.lcms-phone :where(button,input,select,textarea,a,[tabindex]):focus-visible { outline:2px solid var(--ui-accent);outline-offset:2px; }
  html.lcms-phone #attach-preview-modal { padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom)) !important; }
  html.lcms-phone #attach-preview-modal button { min-width:44px;min-height:44px; }
  html.lcms-phone .lcms-mobile-menu[open] { display:flex;flex-direction:column;position:fixed;z-index:400;inset:var(--lcms-safe-top,env(safe-area-inset-top,0px)) 0 var(--lcms-bottom-h,0px);margin:0;width:100%;max-width:none;height:auto;max-height:none;padding:0;border:0;background:var(--ui-bg);color:var(--ui-ink);overflow:hidden; }
  html.lcms-phone .lcms-mobile-menu::backdrop { background:#071b3666; }
  html.lcms-phone .lcms-menu-heading { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:20px 18px 14px;background:var(--ui-surface); }
  html.lcms-phone .lcms-menu-heading h2 { font-size:22px;font-weight:750;letter-spacing:-.6px; }
  html.lcms-phone .lcms-menu-heading p { margin-top:4px;color:var(--ui-muted);font-size:12px;line-height:1.5; }
  html.lcms-phone .lcms-menu-heading button { width:44px;height:44px;min-width:44px;border:0;border-radius:12px;background:var(--ui-bg);color:var(--ui-ink);font-size:26px; }
  html.lcms-phone .lcms-menu-search { padding:0 18px 16px;background:var(--ui-surface); }
  html.lcms-phone .lcms-menu-search input { width:100%;height:46px;min-width:0;padding:0 14px;border:1px solid var(--ui-line);border-radius:12px;background:var(--ui-bg);color:var(--ui-ink);font-size:16px; }
  html.lcms-phone .lcms-menu-body { flex:1;min-height:0;overflow:auto;padding:16px 18px 28px;overscroll-behavior:contain; }
  html.lcms-phone .lcms-menu-section { margin-bottom:22px; }
  html.lcms-phone .lcms-menu-section h3 { margin:0 0 10px 2px;color:var(--ui-muted);font-size:12px;font-weight:650; }
  html.lcms-phone .lcms-menu-grid { display:grid;grid-template-columns:1fr 1fr;gap:10px; }
  html.lcms-phone .lcms-menu-item { min-width:0;display:flex;align-items:center;gap:10px;min-height:72px;padding:12px;border:1px solid var(--ui-line);border-radius:14px;background:var(--ui-surface);color:var(--ui-ink);text-align:left; }
  html.lcms-phone .lcms-menu-item { font-family:inherit; }
  html.lcms-phone .lcms-menu-item > svg { width:23px;height:23px;flex:none;color:var(--ui-accent); }
  html.lcms-phone .lcms-menu-item > span { min-width:0;font-size:13px;font-weight:650;line-height:1.5;overflow-wrap:anywhere; }
  html.lcms-phone .lcms-menu-item.is-active { border-color:var(--ui-accent);background:var(--blue-bg); }
  html.lcms-phone .lcms-menu-empty { padding:32px 12px;text-align:center;color:var(--ui-muted);font-size:14px;line-height:1.8; }
  html.lcms-phone body.lcms-material-mobile-active:has(.mlm-screen) .lcms-mobile-bottom-nav { display:flex !important; }
  html.lcms-phone body.lcms-material-mobile-active:has(.mlm-screen) #layout { height:calc(100dvh - var(--lcms-bottom-h)) !important; }
  html.lcms-phone body.lcms-material-mobile-active:has(.mlm-screen) .sidebar-overlay { bottom:var(--lcms-bottom-h); }
  html.lcms-phone body.lcms-material-mobile-active:not(:has(.mlm-screen)) .lcms-mobile-menu[open] { bottom:0; }
}
@media print { .lcms-mobile-menu,.lcms-ui-toast { display:none !important; } }
/* One compact context row leaves the records visible. Original controls stay
   in place and expand into a bounded, scrollable area; PC has the original DOM. */
.lcms-compact-heading { display:none; }
@media(max-width:760px) {
  html.lcms-phone .page .lcms-compact-header {
    display:block !important;flex:none !important;padding:2px 10px !important;
    max-height:calc(var(--lcms-viewport-height,100dvh) * .38);overflow:auto !important;
    min-height:48px;scroll-padding-top:48px;overscroll-behavior:contain;border-radius:10px 10px 0 0;
  }
  html.lcms-phone .lcms-compact-header:not(.lcms-tools-open) > [data-lcms-header-content] { display:none !important; }
  html.lcms-phone .lcms-compact-linked-tools:not(.lcms-linked-tools-open) { display:none !important; }
  html.lcms-phone .lcms-compact-linked-tools.lcms-linked-tools-open { max-height:calc(var(--lcms-viewport-height,100dvh) * .3);overflow:auto;overscroll-behavior:contain; }
  /* These legacy grid/contents rules use ID-specific !important displays. */
  html.lcms-phone :is(#page-nanopeople,#page-dailyplan) > .page-fixed-header.lcms-compact-header { display:block !important; }
  html.lcms-phone :is(#page-nanopeople,#page-dailyplan) > .lcms-compact-header:not(.lcms-tools-open) > [data-lcms-header-content] { display:none !important; }
  html.lcms-phone #page-masterplan > .lcms-compact-header:not(.lcms-tools-open) > #mp-gantt-header { display:none !important; }
  html.lcms-phone #page-liftoffice:has(> .lcms-compact-header:not(.lcms-tools-open)) .lo-sidebar > :is(.lo-search-wrap,.lo-filter-tabs,.lo-status-filter) { display:none !important; }
  html.lcms-phone .lcms-compact-heading {
    display:flex;align-items:center;gap:6px;min-height:44px;position:sticky;top:-2px;z-index:4;
    background:var(--ui-surface);padding:0;max-width:100%;
  }
  html.lcms-phone .lcms-compact-heading .lcms-compact-title { flex:1;min-width:0;margin:0;font:700 16px/1.35 system-ui,sans-serif !important;letter-spacing:-.35px;overflow-wrap:anywhere; }
  html.lcms-phone .lcms-compact-heading button { flex:none;display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:44px;max-width:88px;padding:6px 8px;border:1px solid var(--ui-line);border-radius:9px;background:var(--ui-surface);color:var(--ui-ink);font:600 12px/1.35 system-ui,sans-serif;cursor:pointer;touch-action:manipulation; }
  html.lcms-phone .lcms-compact-heading button[hidden] { display:none !important; }
  html.lcms-phone .lcms-compact-heading .lcms-compact-action { max-width:86px;color:var(--ui-accent);border-color:var(--ui-accent);white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
  html.lcms-phone .lcms-compact-toggle[aria-expanded="true"] { background:var(--ui-bg);border-color:var(--ui-accent); }
  html.lcms-phone .lcms-compact-heading .lcms-compact-toggle { max-width:none;white-space:nowrap; }
  html.lcms-phone .lcms-compact-toggle > span { white-space:nowrap; }
  html.lcms-phone .lcms-compact-header.lcms-tools-open > [data-lcms-header-content] { margin-top:6px; }
  html.lcms-phone .lcms-compact-header .page-title { font-size:14px !important; }
  html.lcms-phone .lcms-menu-heading { padding:12px 14px 8px;gap:8px; }
  html.lcms-phone .lcms-menu-heading h2 { font-size:18px; }
  html.lcms-phone .lcms-menu-heading p { margin-top:2px;max-width:calc(100vw - 90px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
  html.lcms-phone .lcms-menu-search { padding:0 14px 10px; }
  html.lcms-phone .lcms-menu-search input { height:44px; }
  html.lcms-phone .lcms-menu-body { padding:10px 14px 20px; }
  html.lcms-phone .lcms-menu-grid { gap:8px; }
  html.lcms-phone .lcms-menu-item { min-height:60px;padding:10px;gap:8px;border-radius:11px; }
  html.lcms-phone .lcms-menu-section { margin-bottom:16px; }
  /* Keep requirement summaries readable without repeating desktop row spacing. */
  html.lcms-phone #page-requirements .req-wrap { gap:8px; }
  html.lcms-phone #page-requirements table.mg-cards > tbody > tr { padding:12px;gap:8px 12px; }
  html.lcms-phone #page-requirements table.mg-cards > tbody > tr > td { font-size:12px !important;line-height:1.45 !important; }
  html.lcms-phone #page-requirements table.mg-cards > tbody > tr > .mg-primary-cell { min-height:26px;font-size:14px !important; }
  html.lcms-phone #page-requirements .req-link { font-weight:700;line-height:1.45; }
  html.lcms-phone #page-requirements .req-sub { font-size:11px;line-height:1.4; }
  html.lcms-phone #page-requirements .req-badge { padding:2px 7px;font-size:11px; }
}
@media(max-width:430px) {
  html.lcms-phone .lcms-compact-heading .lcms-compact-toggle { width:44px;min-width:44px;padding:6px; }
  html.lcms-phone .lcms-compact-toggle > span { display:none; }
}
