/* LVLLine shared product UI — responsive overrides for the existing app. */
:root {
  --primary: #FD6B34;
  --primary-dark: #c83f12;
  --primary-light: #ff7b4f;
  --charcoal: #1D1E1C;
  --charcoal-hover: #2A2B28;
  --bg: #F5F4F1;
  --bg-secondary: #ECEAE5;
  --card-bg: #fff;
  --border: #DEDCD6;
  --border-light: #ECEAE5;
  --text-main: #20221F;
  --text-muted: #6D716B;
  --text-light: #969993;
  --success: #16865a;
  --danger: #c73b32;
  --warning: #d58a0a;
  --info: #2563a9;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(29, 30, 28, .06);
  --shadow-md: 0 8px 28px rgba(29, 30, 28, .09);
  --shadow-lg: 0 18px 48px rgba(29, 30, 28, .15);
}

html { background: var(--bg); }
body {
  background:
    radial-gradient(circle at 12% -12%, rgba(241, 90, 41, .08), transparent 25rem),
    var(--bg);
  color: var(--text-main);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -.006em;
}

button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid rgba(241, 90, 41, .28); outline-offset: 2px; }
.app-icon-sprite { position:absolute; width:0; height:0; overflow:hidden; }
.app-icon { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex:0 0 auto; }
.nav-drawer-header,.nav-section-label,.nav-mobile-account,.nav-backdrop { display:none; }

.navbar {
  background: rgba(29, 30, 28, .97);
  box-shadow: 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
}
.navbar-inner { max-width: 1440px; }
.navbar-brand img { height: 32px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.25)); }
.nav-menu a { border-radius: 10px; color: rgba(255,255,255,.78); }
.nav-menu a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-menu a { display:inline-flex; align-items:center; gap:8px; }
body[data-path="/dashboard"] .nav-menu a[href="/dashboard"],
body[data-path^="/calendar"] .nav-menu a[href="/calendar"],
body[data-path^="/projects"] .nav-menu a[href="/projects"],
body[data-path^="/project-comms"] .nav-menu a[href="/project-comms"],
body[data-path^="/subs"] .nav-menu a[href="/subs"],
body[data-path^="/realtor-hub"] .nav-menu a[href="/realtor-hub"] { color:#fff; background:rgba(253,107,52,.17); }

.page-wrapper { max-width: 1440px; padding: 20px clamp(16px, 3vw, 38px) 104px; }
.page-header { align-items: center; margin-bottom: 24px !important; }
.page-header-title, h1, h2, h3 { letter-spacing: -.035em; }
.page-header-title, h1, h2, h3, h4,
.card-title, .section-heading h2,
.project-view-tabs button, .dashboard-metric span,
.quick-add-grid strong, .settings-tab {
  text-transform: capitalize;
}
.card-subtitle::first-letter,
.product-page-header p::first-letter,
.dashboard-overview p::first-letter,
.empty-state p::first-letter {
  text-transform: uppercase;
}
.card-title, .section-heading h2 { font-weight: 750; }
.card-subtitle { font-weight: 500; }
.page-header-title { font-size: clamp(1.5rem, 4vw, 2.1rem); }
.logo-section { display: none !important; }

.card, .subdivision-card, .project-card, .mobile-card {
  border: 1px solid rgba(29, 30, 28, .08);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
}
.card { padding: clamp(16px, 2.5vw, 24px); }
.card:hover { border-color: rgba(29, 30, 28, .12); }
.card-header { border: 0; padding: 0; }
.card-title { font-size: 1.05rem; }
.card-subtitle { color: var(--text-muted); line-height: 1.55; }

.btn {
  min-height: 46px;
  border-radius: 12px;
  padding: 11px 18px;
  color: #fff !important;
  background: var(--primary);
  box-shadow: 0 2px 0 rgba(87, 26, 7, .18);
  font-weight: 700;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-secondary { background: var(--charcoal); color: #fff !important; }
.btn-secondary:hover { background: var(--charcoal-hover); }
.btn-danger { background: var(--danger); }
.btn-ghost { color: var(--text-main) !important; background: transparent; box-shadow: none; }
.btn-sm { min-height: 42px; padding: 9px 14px; }

label { font-weight: 700; color: #41433F; margin-bottom: 7px; }
body input:not([type]),
body input[type="text"], body input[type="search"], body input[type="date"],
body input[type="time"], body input[type="datetime-local"], body input[type="month"],
body input[type="week"], body input[type="email"], body input[type="password"],
body input[type="number"], body input[type="tel"], body input[type="url"],
body select, body textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  color: var(--text-main);
  caret-color: var(--primary);
  border: 1px solid #d6d2ca;
  border-radius: 12px;
  background-color: #fcfbf9;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 1px 2px rgba(29,30,28,.04);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
body[data-subcontractors="disabled"] a[href="/subs"],
body[data-subcontractors="disabled"] a[href="/subs/new"] { display:none !important; }
body[data-subcontractors="disabled"] .metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
body textarea { min-height: 112px; line-height: 1.5; resize: vertical; }
body input::placeholder, body textarea::placeholder { color: #979991; opacity: 1; }
body input:not([type]):hover,
body input[type="text"]:hover, body input[type="search"]:hover, body input[type="date"]:hover,
body input[type="time"]:hover, body input[type="datetime-local"]:hover, body input[type="month"]:hover,
body input[type="week"]:hover, body input[type="email"]:hover, body input[type="password"]:hover,
body input[type="number"]:hover, body input[type="tel"]:hover, body input[type="url"]:hover,
body select:hover, body textarea:hover { border-color: #bbb7ae; background-color: #fff; }
body input:focus, body select:focus, body textarea:focus {
  outline: 0;
  border-color: var(--primary);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(253,107,52,.12), 0 2px 6px rgba(29,30,28,.06);
}
body input:disabled:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]),
body select:disabled, body textarea:disabled,
body input[readonly], body textarea[readonly] {
  color: var(--text-muted);
  border-color: var(--border-light);
  background: #f0efeb;
  box-shadow: none;
  cursor: not-allowed;
}

.status-pill, .pill { border-radius: 999px; font-weight: 700; }
.table-container { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table { background: #fff; }
th { background: #F7F6F3; color: var(--text-muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }

.project-card { position: relative; overflow: hidden; padding: 20px; }
.project-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--primary); opacity: .75; }
.project-card:hover { border-color: rgba(241,90,41,.25); box-shadow: var(--shadow-md); }
.project-card-name { font-size: 1.05rem; letter-spacing: -.02em; }

.mobile-tabbar { display: none; }
.eyebrow { display:block; color:var(--primary-dark); font-size:.72rem; font-weight:800; letter-spacing:.1em; text-transform:uppercase; margin-bottom:8px; }
.home-hero { display:flex; align-items:end; justify-content:space-between; gap:28px; padding:clamp(22px,5vw,48px); margin-bottom:18px; border-radius:24px; color:#fff; background:linear-gradient(125deg,var(--charcoal) 0%,var(--charcoal-hover) 72%,#383936 100%); box-shadow:var(--shadow-md); overflow:hidden; position:relative; }
.home-hero::after { content:""; position:absolute; width:240px; height:240px; right:-70px; top:-100px; border-radius:50%; border:46px solid rgba(241,90,41,.2); }
.home-hero > * { position:relative; z-index:1; }
.home-hero .eyebrow { color:#ff9a78; }
.home-hero h1 { margin:0; font-size:clamp(2rem,6vw,3.7rem); line-height:.98; max-width:700px; }
.home-hero p { color:rgba(255,255,255,.7); max-width:620px; margin:16px 0 0; font-size:clamp(1rem,2vw,1.14rem); }
.home-hero__actions { display:flex; flex-wrap:wrap; gap:10px; flex-shrink:0; }
.home-hero__actions .btn-secondary { background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.2); }
.metric-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:18px; }
.metric-card { display:flex; flex-direction:column; min-height:155px; padding:20px; border-radius:18px; background:#fff; border:1px solid rgba(29,30,28,.08); color:var(--text-main); box-shadow:var(--shadow-sm); text-decoration:none; }
.metric-card:hover { text-decoration:none; transform:translateY(-2px); box-shadow:var(--shadow-md); }
.metric-card--accent { background:#fff5f0; border-color:rgba(241,90,41,.18); }
.metric-card__label { color:var(--text-muted); font-weight:700; font-size:.84rem; }
.metric-card strong { margin:7px 0 auto; font-size:2.4rem; line-height:1; letter-spacing:-.06em; }
.metric-card__link { color:var(--primary-dark); font-size:.78rem; font-weight:800; }
.section-heading { display:flex; justify-content:space-between; align-items:end; gap:20px; margin-bottom:18px; }
.section-heading h2 { margin:0; font-size:1.35rem; }
.action-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.action-tile { display:flex; align-items:center; gap:13px; min-height:80px; padding:14px; color:var(--text-main); background:#f7f8f5; border:1px solid var(--border-light); border-radius:14px; text-decoration:none; }
.action-tile:hover { text-decoration:none; background:#fff; border-color:rgba(241,90,41,.25); }
.action-tile__mark { display:grid; place-items:center; flex:0 0 38px; height:38px; border-radius:11px; color:#fff; background:var(--charcoal); font-size:1.1rem; font-weight:800; }
.action-tile strong,.action-tile small { display:block; }
.action-tile small { color:var(--text-muted); margin-top:2px; }
.product-page-header { display:flex; align-items:end; justify-content:space-between; gap:24px; margin:4px 0 22px; }
.product-page-header h1 { margin:0; font-size:clamp(1.75rem,4vw,2.45rem); }
.product-page-header p { margin:7px 0 0; color:var(--text-muted); }
.dashboard-overview { display:grid; grid-template-columns:minmax(240px,.75fr) minmax(0,1.45fr); gap:24px; align-items:end; margin-bottom:18px; padding:24px; border-radius:22px; color:#fff; background:linear-gradient(125deg,var(--charcoal),var(--charcoal-hover)); box-shadow:var(--shadow-md); }
.dashboard-overview h1 { margin:0; font-size:clamp(1.7rem,4vw,2.4rem); }
.dashboard-overview p { margin:8px 0 0; color:rgba(255,255,255,.68); line-height:1.5; }
.dashboard-overview .eyebrow { color:#ff9a78; }
.dashboard-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; }
.dashboard-metric { display:flex; flex-direction:column; justify-content:center; min-height:104px; padding:14px; color:#fff; text-decoration:none; border:1px solid rgba(255,255,255,.12); border-radius:15px; background:rgba(255,255,255,.07); }
.dashboard-metric:hover { color:#fff; text-decoration:none; background:rgba(255,255,255,.12); }
.dashboard-metric strong { font-size:1.85rem; line-height:1; }
.dashboard-metric span { margin-top:8px; color:rgba(255,255,255,.68); font-size:.75rem; font-weight:700; }
.dashboard-metric--attention { border-color:rgba(253,107,52,.42); background:rgba(253,107,52,.16); }
.dashboard-upload-card summary { list-style:none; cursor:pointer; }
.dashboard-upload-card summary::-webkit-details-marker { display:none; }
.dashboard-upload-summary__action { color:var(--primary-dark); font-size:.78rem; font-weight:800; }
.dashboard-upload-body { padding-top:18px; }
.empty-state { display:grid; place-items:center; min-height:220px; padding:28px; text-align:center; border:1px dashed var(--border); border-radius:16px; background:#fafbf9; }
.empty-state h2,.empty-state h4 { margin:10px 0 4px; }
.empty-state p { max-width:440px; margin:0; color:var(--text-muted); }
.empty-state__icon { display:grid; place-items:center; width:48px; height:48px; color:var(--primary-dark); border-radius:14px; background:#fff0e9; }
.empty-state--compact { min-height:0; padding:18px; place-items:start; text-align:left; }
.empty-state--compact h4 { margin:0 0 4px; }
.empty-state--compact .btn { margin-top:12px; }
.activity-feed { display:flex; flex-direction:column; }
.activity-item { display:flex; align-items:flex-start; gap:11px; padding:11px 0; color:var(--text-main); text-decoration:none; border-bottom:1px solid var(--border-light); }
.activity-item:last-child { border-bottom:0; }
.activity-item:hover { text-decoration:none; }
.activity-item__mark { display:grid; place-items:center; flex:0 0 32px; height:32px; border-radius:10px; color:#fff; background:var(--charcoal); font-size:.72rem; font-weight:850; }
.activity-item strong,.activity-item small { display:block; }
.activity-item strong { font-size:.84rem; }
.activity-item small { margin-top:3px; color:var(--text-muted); font-size:.72rem; }
.dashboard-reminders { overflow:hidden; }
.dashboard-filter-header { align-items:center; }
.dashboard-filter-header .card-title { flex:1; min-width:0; }
.dashboard-card-filter { width:min(180px,46%); min-height:38px; padding:7px 32px 7px 10px; font-size:.78rem; }
.reminder-add-form { display:flex; align-items:center; gap:7px; margin:14px 0 10px; padding:5px; border:1px solid var(--border); border-radius:13px; background:#fff; }
.reminder-add-form input { flex:1; min-width:0; min-height:38px !important; margin:0; padding:7px 9px !important; border:0 !important; background:transparent !important; box-shadow:none !important; }
.reminder-add-form input:focus { box-shadow:none !important; }
.reminder-add-form .btn { min-height:36px; padding:7px 14px; border-radius:9px; }
.reminder-list { display:flex; flex-direction:column; max-height:230px; overflow-y:auto; }
.reminder-row { display:flex; align-items:center; gap:9px; min-height:42px; padding:6px 2px; border-top:1px solid var(--border-light); transition:opacity .16s ease,transform .16s ease; }
.reminder-row.is-leaving { opacity:0; transform:translateX(8px); }
.reminder-row form { flex:0 0 auto; margin:0; }
.reminder-check { display:grid; place-items:center; width:28px; height:28px; padding:0; border:2px solid var(--border); border-radius:9px; color:#fff; background:#fff; cursor:pointer; }
.reminder-check:hover { border-color:var(--primary); background:#fff5f0; }
.reminder-check:hover::after { content:'✓'; color:var(--primary); font-size:.75rem; font-weight:850; }
.reminder-text { flex:1; min-width:0; color:var(--text-main); font-size:.86rem; font-weight:600; line-height:1.35; overflow-wrap:anywhere; }
.reminder-delete { width:28px; height:28px; padding:0; border:0; border-radius:8px; color:var(--text-light); background:transparent; font-size:1.05rem; cursor:pointer; }
.reminder-delete:hover { color:var(--danger); background:#fdeeed; }
.reminder-empty { margin:12px 0 2px; font-size:.82rem; }
.global-search-form { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:10px; align-items:center; padding:9px 9px 9px 16px; border:1px solid var(--border); border-radius:16px; background:#fff; box-shadow:var(--shadow-sm); }
.global-search-form input { min-height:46px; padding:8px; border:0; box-shadow:none; }
.global-search-form input:focus { box-shadow:none; }
.search-summary { margin:18px 0 10px; color:var(--text-muted); font-size:.85rem; }
.search-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.search-group { padding:18px; border:1px solid var(--border); border-radius:18px; background:#fff; }
.search-group h2 { margin:0 0 8px; font-size:1rem; }
.search-result { display:flex; justify-content:space-between; gap:16px; padding:12px 0; color:var(--text-main); text-decoration:none; border-top:1px solid var(--border-light); }
.search-result:hover { color:var(--primary-dark); text-decoration:none; }
.search-result span { color:var(--text-muted); font-size:.78rem; text-align:right; }
.legacy-project-header { display:none !important; }
.project-hero { display:flex; align-items:end; justify-content:space-between; gap:24px; margin-bottom:16px; padding:24px 26px; border:1px solid var(--border); border-radius:20px; background:#fff; box-shadow:var(--shadow-sm); }
.project-hero h1 { margin:0; font-size:clamp(1.8rem,4vw,2.6rem); }
.project-hero p { margin:7px 0 0; color:var(--text-muted); }
.project-back { display:inline-block; margin-bottom:14px; color:var(--text-muted); font-size:.78rem; font-weight:750; text-decoration:none; }
.project-hero__actions { display:flex; align-items:center; gap:10px; }
.project-view-tabs { position:sticky; top:69px; z-index:40; display:flex; gap:4px; margin-bottom:18px; padding:5px; overflow-x:auto; border:1px solid var(--border); border-radius:14px; background:rgba(255,255,255,.95); box-shadow:var(--shadow-sm); backdrop-filter:blur(14px); scrollbar-width:none; }
.project-view-tabs::-webkit-scrollbar { display:none; }
.project-view-tabs button { flex:1 0 auto; min-height:42px; padding:9px 16px; border:0; border-radius:10px; color:var(--text-muted); background:transparent; font-weight:750; }
.project-view-tabs button.is-active { color:#fff; background:var(--charcoal); box-shadow:var(--shadow-sm); }
.project-panel[hidden] { display:none !important; }
.checklist-list { display:flex; flex-direction:column; gap:4px; margin-bottom:14px; }
.checklist-row { display:flex; align-items:center; gap:8px; min-height:42px; padding:5px 8px; border:1px solid var(--border-light); border-radius:10px; background:#FAF9F7; transition:opacity .15s, transform .15s, box-shadow .15s; }
.checklist-row.is-dragging { opacity:.55; transform:scale(.995); box-shadow:var(--shadow-md); }
.checklist-row.is-complete { opacity:.68; }
.checklist-row.is-complete .checklist-label { text-decoration:line-through; }
.checklist-label { flex:1; min-width:0; font-weight:650; overflow-wrap:anywhere; }
.checklist-drag-handle { width:26px; height:30px; padding:0; border:0; color:var(--text-muted); background:transparent; font-size:1rem; line-height:1; cursor:grab; touch-action:none; }
.checklist-drag-handle:active { cursor:grabbing; }
.checklist-toggle { width:30px; height:30px; padding:0; border:2px solid var(--border); border-radius:9px; color:#fff; background:#fff; font-weight:800; }
.checklist-row.is-complete .checklist-toggle { border-color:var(--primary); background:var(--primary); }
.checklist-edit-button { padding:6px 8px; border:0; color:var(--text-muted); background:transparent; font-size:.76rem; font-weight:750; }
.checklist-edit-form { display:none; flex:1; margin:0; }
.checklist-edit-form.is-editing { display:flex; }
.checklist-edit-form input { width:100%; margin:0; padding:8px 10px; }
.checklist-add-form { display:flex; align-items:center; gap:7px; padding:5px; border:1px solid var(--border); border-radius:12px; background:#fff; }
.checklist-add-form input { flex:1; min-width:0; width:100%; margin:0; padding:8px 10px; border:0; background:transparent; box-shadow:none; }
.checklist-add-form input:focus { outline:0; box-shadow:none; }
.checklist-add-form .btn { min-height:36px; padding:7px 15px; border-radius:9px; }
.checklist-default-action { margin-top:9px; }
.checklist-default-action button { padding:3px 0; border:0; color:var(--text-muted); background:transparent; font-size:.76rem; font-weight:700; }
.checklist-default-action button:hover { color:var(--primary); }
.inspection-plan-list { display:flex; flex-direction:column; gap:4px; }
.scheduled-inspection-list { display:flex; flex-direction:column; gap:5px; }
.scheduled-inspection-row { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; padding:8px 10px; border:1px solid var(--border-light); border-radius:9px; color:var(--text-main); background:#FAF9F7; text-align:left; }
.scheduled-inspection-row:hover { border-color:rgba(253,107,52,.35); background:#fff7f3; }
.scheduled-inspection-row span { display:flex; flex-direction:column; min-width:0; }
.scheduled-inspection-row strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.88rem; }
.scheduled-inspection-row small { color:var(--text-muted); font-size:.72rem; }
.scheduled-inspection-row time { flex:none; color:var(--primary); font-size:.8rem; font-weight:750; }
.inspection-plan-row { display:flex; align-items:center; gap:6px; padding:4px 6px; border:1px solid var(--border-light); border-radius:9px; background:#FAF9F7; }
.inspection-plan-row.is-complete { opacity:.65; }
.inspection-plan-row.is-complete .checklist-toggle { border-color:var(--primary); background:var(--primary); color:#fff; }
.inspection-plan-row.is-complete .inspection-name-input { text-decoration:line-through; }
.inspection-plan-fields { display:grid; grid-template-columns:minmax(160px,1fr) 138px auto; align-items:center; gap:5px; flex:1; margin:0; }
.inspection-plan-fields input { min-width:0; min-height:34px; margin:0; padding:5px 8px; font-size:.86rem; border-radius:8px; }
.inspection-plan-row .checklist-toggle { width:27px; height:27px; border-radius:8px; }
.inspection-plan-row .checklist-edit-button { padding:4px 6px; font-size:.72rem; }
.inspection-plan-row .delete-btn { width:27px; height:27px; }
.inspection-name-input { font-weight:650; }
.inspection-plan-actions { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-top:12px; flex-wrap:wrap; }
.inspection-add-form { display:flex; align-items:center; gap:7px; flex:1; max-width:480px; margin:0; }
.inspection-add-form input { flex:1; min-width:0; margin:0; padding:9px 10px; }
.text-action { padding:4px 0; border:0; color:var(--text-muted); background:transparent; font-size:.78rem; font-weight:700; }
.text-action:hover { color:var(--primary); }
@media (max-width: 680px) {
  .inspection-plan-row { align-items:flex-start; }
  .inspection-plan-fields { grid-template-columns:1fr auto; }
  .inspection-plan-fields .inspection-name-input { grid-column:1 / -1; }
  .inspection-plan-row .checklist-toggle, .inspection-plan-row .delete-btn { width:34px; height:34px; }
  .inspection-plan-actions, .inspection-add-form { align-items:stretch; width:100%; max-width:none; }
}
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.field-item-card,
#deliveries .mobile-card { position:relative; padding-right:64px; }
.field-item-card .mobile-card-actions,
#deliveries .mobile-card .mobile-card-actions { position:absolute; top:10px; right:10px; margin:0; padding:0; border:0; }
.field-item-card .delete-btn,
#deliveries .mobile-card .delete-btn { width:34px; min-width:34px; height:34px; min-height:34px; padding:0; color:var(--text-muted); background:#F7F6F3; border:1px solid var(--border); font-size:.88rem; }
.field-item-card .delete-btn:hover,
#deliveries .mobile-card .delete-btn:hover { color:var(--danger); background:#FDEDEC; border-color:#F4C7C3; }
.quick-add-backdrop { position:fixed; inset:0; z-index:1390; visibility:hidden; opacity:0; background:rgba(10,17,12,.46); transition:.2s; }
.quick-add-backdrop.is-open { visibility:visible; opacity:1; }
.quick-add-sheet { position:fixed; z-index:1400; right:18px; bottom:18px; width:min(430px,calc(100vw - 36px)); padding:20px; visibility:hidden; opacity:0; transform:translateY(20px); border:1px solid var(--border); border-radius:22px; background:#fff; box-shadow:var(--shadow-lg); transition:.2s; }
.quick-add-sheet.is-open { visibility:visible; opacity:1; transform:translateY(0); }
.quick-add-sheet__header { display:flex; justify-content:space-between; align-items:start; gap:16px; }
.quick-add-sheet__header h2 { margin:0; }
.quick-add-sheet__header > button { display:grid; place-items:center; width:40px; height:40px; padding:0; border:1px solid var(--border); border-radius:12px; background:#f5f6f3; font-size:1.3rem; }
.quick-add-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin-top:16px; }
.quick-add-grid a,.quick-add-grid > button { display:flex; align-items:flex-start; flex-direction:column; min-height:88px; padding:14px; color:var(--text-main); text-align:left; text-decoration:none; border:1px solid var(--border); border-radius:14px; background:#f8f9f6; }
.quick-add-grid a:hover,.quick-add-grid > button:hover { border-color:rgba(253,107,52,.3); background:#fff5f0; text-decoration:none; }
.quick-add-grid span { margin-top:4px; color:var(--text-muted); font-size:.74rem; }
.global-create-button { position:fixed; z-index:1180; right:22px; bottom:22px; display:grid; place-items:center; width:54px; height:54px; padding:0; border:0; border-radius:18px; color:#fff; background:var(--primary); box-shadow:0 10px 30px rgba(33,25,20,.22); font-size:2rem; line-height:1; cursor:pointer; }
.global-create-button:hover { background:var(--primary-dark); transform:translateY(-1px); }
.global-create-backdrop { position:fixed; inset:0; z-index:1380; display:block; visibility:hidden; opacity:0; padding:0; border:0; background:rgba(10,17,12,.46); transition:.2s; }
.global-create-backdrop.is-open { visibility:visible; opacity:1; }
.global-create-sheet { position:fixed; z-index:1390; right:22px; bottom:88px; width:min(430px,calc(100vw - 36px)); padding:20px; visibility:hidden; opacity:0; transform:translateY(16px); border:1px solid var(--border); border-radius:22px; background:#fff; box-shadow:var(--shadow-lg); transition:.2s; }
.global-create-sheet.is-open { visibility:visible; opacity:1; transform:translateY(0); }
.global-create-sheet h2 { margin:0; }

@media (max-width: 767px) {
  body { font-size: 15px; }
  .navbar { min-height: 58px; padding: calc(9px + var(--safe-top)) 16px 9px; }
  .navbar-brand img { height: 31px; }
  .nav-toggle { width: 42px; height: 42px; }
  .nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(88vw, 360px);
    height: 100dvh;
    padding: calc(18px + var(--safe-top)) 16px calc(22px + var(--safe-bottom));
    background: #fff;
    color: var(--text-main);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    z-index: 1300;
    display:flex;
    flex-direction:column;
    visibility:hidden;
    transform:translateX(104%);
    transition:transform .24s ease,visibility .24s;
    box-shadow:-24px 0 60px rgba(12,20,15,.18);
  }
  .nav-menu.active { visibility:visible; transform:translateX(0); }
  .nav-menu a { min-height: 50px; font-size: .96rem; padding: 12px 13px; color:var(--text-main); border:1px solid transparent; border-radius:12px; }
  .nav-menu a:hover,.nav-menu a:active { color:var(--text-main); background:#f5f6f3; }
  body[data-path="/dashboard"] .nav-menu a[href="/dashboard"],
  body[data-path^="/calendar"] .nav-menu a[href="/calendar"],
  body[data-path^="/projects"] .nav-menu a[href="/projects"],
  body[data-path^="/project-comms"] .nav-menu a[href="/project-comms"],
  body[data-path^="/subs"] .nav-menu a[href="/subs"],
  body[data-path^="/realtor-hub"] .nav-menu a[href="/realtor-hub"] { color:var(--primary-dark); background:#fff3ed; border-color:rgba(253,107,52,.16); }
  .nav-drawer-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:0 2px 16px; margin-bottom:6px; border-bottom:1px solid var(--border-light); }
  .nav-drawer-header strong { display:block; font-size:1.35rem; letter-spacing:-.035em; }
  .nav-drawer-eyebrow { display:block; color:var(--primary-dark); font-size:.66rem; font-weight:850; letter-spacing:.12em; text-transform:uppercase; }
  .nav-drawer-close { display:grid; place-items:center; width:42px; height:42px; padding:0; border:1px solid var(--border); border-radius:12px; color:var(--text-main); background:#f7f8f5; }
  .nav-section-label { display:block; padding:14px 12px 5px; color:var(--text-light); font-size:.65rem; font-weight:850; letter-spacing:.12em; text-transform:uppercase; }
  .nav-divider,.nav-dropdown { display:none; }
  .nav-mobile-account { display:block; margin-top:auto; padding-top:8px; border-top:1px solid var(--border-light); }
  .nav-mobile-account a { width:100%; }
  .nav-mobile-account .nav-logout { margin-top:4px; color:var(--danger); }
  .nav-backdrop { position:fixed; inset:0; z-index:1290; border:0; padding:0; background:rgba(10,17,12,.46); backdrop-filter:blur(2px); opacity:0; visibility:hidden; transition:opacity .24s ease,visibility .24s; }
  body.nav-open .nav-backdrop { display:block; opacity:1; visibility:visible; }
  .nav-dropdown-content { display:none !important; }

  .page-wrapper { padding: 18px 14px calc(92px + var(--safe-bottom)); }
  .page-header { gap: 12px; }
  .page-header-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-header-actions > * { width: 100%; }
  .card { margin-bottom: 14px; }
  .form-row { grid-template-columns: 1fr !important; gap: 12px; }
  .quick-actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions .btn { width: 100%; min-width: 0; }
  .projects-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  .subdivision-card { padding: 14px !important; }
  .subdivision-card-header { margin-bottom: 12px !important; }
  .project-tabs { overflow-x: auto; scrollbar-width: none; }
  .project-tab { min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap; }
  .modal { width: calc(100vw - 20px) !important; max-height: calc(100dvh - 24px); border-radius: 20px !important; }
  .modal-body { overflow-y: auto; }

  .mobile-tabbar {
    position: fixed;
    z-index: 1200;
    left: 0; right: 0; bottom: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: calc(66px + var(--safe-bottom));
    padding: 7px 0 var(--safe-bottom);
    background: rgba(255,255,255,.96);
    border-top: 1px solid rgba(29, 30, 28, .1);
    box-shadow: 0 -8px 26px rgba(29, 30, 28, .08);
    backdrop-filter: blur(18px);
  }
  .mobile-tabbar__item {
    appearance: none;
    border: 0;
    background: transparent;
    color: #778079;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 3px 2px;
    font-size: .67rem;
    line-height: 1.1;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    min-width: 0;
    position: relative;
  }
  .mobile-tabbar__item + .mobile-tabbar__item { border-left: 1px solid rgba(29, 30, 28, .08); }
  .mobile-tabbar__item:hover { text-decoration: none; }
  .mobile-tabbar__item.is-active { color: var(--primary); }
  .mobile-tabbar__icon { font-size: 1.25rem; line-height: 1; font-weight: 800; }
  .mobile-tabbar__icon.app-icon { width:20px; height:20px; }
  .home-hero { align-items:stretch; flex-direction:column; padding:24px 20px; border-radius:20px; }
  .home-hero h1 { font-size:2.35rem; }
  .home-hero__actions { display:grid; grid-template-columns:1fr 1fr; }
  .home-hero__actions .btn { width:100%; padding-left:10px; padding-right:10px; }
  .metric-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
  .metric-card { min-height:125px; padding:14px 11px; }
  .metric-card strong { font-size:2rem; }
  .metric-card__link { font-size:.67rem; }
  .action-grid { grid-template-columns:1fr; }
  .product-page-header { align-items:flex-start; flex-direction:column; gap:14px; }
  .dashboard-overview { grid-template-columns:1fr; padding:21px 18px; }
  .dashboard-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dashboard-metric { min-height:88px; }
  .search-groups { grid-template-columns:1fr; }
  .global-search-form { grid-template-columns:auto minmax(0,1fr); }
  .global-search-form .btn { grid-column:1/-1; width:100%; }
  .project-hero { align-items:flex-start; padding:19px 17px; }
  .project-hero__actions { align-items:flex-end; flex-direction:column; }
  .project-view-tabs { top:calc(58px + var(--safe-top)); gap:6px; margin-left:-14px; margin-right:-14px; border-left:0; border-right:0; border-radius:0; padding-left:14px; padding-right:14px; scroll-padding-inline:14px; scroll-snap-type:x proximity; }
  .project-view-tabs button { flex:0 0 auto; min-width:88px; padding:8px 13px; font-size:.82rem; text-align:center; white-space:nowrap; scroll-snap-align:start; }
  .quick-add-sheet { right:0; bottom:0; width:100%; border-radius:22px 22px 0 0; padding-bottom:calc(20px + var(--safe-bottom)); }
  .global-create-button { right:16px; bottom:calc(78px + var(--safe-bottom)); width:50px; height:50px; border-radius:16px; }
  .global-create-sheet { right:0; bottom:0; width:100%; border-radius:22px 22px 0 0; padding-bottom:calc(20px + var(--safe-bottom)); }
  .section-heading > .text-muted { display:none; }
  body.nav-open .mobile-tabbar { display: none; }

  /* Prevent legacy settings and action rows from widening the viewport. */
  html,body { max-width:100%; overflow-x:hidden; }
  .settings-tabs { overflow-x:auto; max-width:100%; scrollbar-width:none; -webkit-overflow-scrolling:touch; }
  .settings-tabs::-webkit-scrollbar { display:none; }
  .settings-tabs > * { flex:0 0 auto; white-space:nowrap; }
  pre,code,.invite-link,.invite-url { max-width:100%; overflow-wrap:anywhere; white-space:normal; }
}

@media (min-width: 768px) {
  .page-wrapper { padding-top: 30px; }
  .navbar { padding: 10px 28px; }
  .dashboard-grid { gap: 24px; }
}

@media (max-width: 767px) {
  /* Flatten the two desktop columns so Field cards can use one mobile reading order. */
  .project-layout > .project-col-main,
  .project-layout > .project-col-side { display: contents; }
  .project-layout > .project-col-main > #issues { order: 100; }
}

@media (min-width: 1024px) {
  .dashboard-grid__column { min-width:0; }
  .dashboard-grid__column > .card {
    overflow-y:auto;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
  }
  .dashboard-grid__column > .card > .list,
  .dashboard-grid__column > .card > .activity-feed,
  .dashboard-grid__column > .card > .reminder-list,
  .dashboard-grid__column > .card > .scheduled-tasks-list {
    max-height:none !important;
    overflow:visible !important;
  }
  #quick-actions { height:240px; overflow-y:hidden; scrollbar-gutter:auto; }
  #scheduled-tasks { height:620px; }
  #recent-files { height:240px; }
  #reminders { height:280px; }
  #deliveries { height:280px; }
  #upcoming-inspections { height:280px; }
  #recent-activity { height:236px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
