/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --charcoal:     #1C1C1E;
  --charcoal-2:   #2A2A2D;
  --charcoal-3:   #3A3A3D;
  --steel:        #2C5F8A;
  --steel-light:  #3A7AB5;
  --steel-dim:    #1E4263;
  --amber:        #F5A623;
  --amber-dim:    #C4831A;
  --white:        #FFFFFF;
  --gray-50:      #F9F9F9;
  --gray-100:     #F0F0F0;
  --gray-200:     #E0E0E0;
  --gray-400:     #9E9E9E;
  --gray-500:     #757575;
  --gray-600:     #5E5E5E;
  --gray-700:     #424242;
  --gray-800:     #2A2A2D;
  --green:        #27AE60;
  --red:          #E53935;
  --orange:       #FB8C00;
  --border:       #E0E0E0;
  --warning-bg:   #FEF9E7;
  --sidebar-w:    240px;
  --radius:       8px;
  --shadow:       0 2px 12px rgba(0,0,0,0.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.18);
}

/* height:auto lets the document end where content ends - height:100% on html/body was leaving a tall empty band below short pages */
html {
  min-height: 100%;
  height: auto;
  background: var(--gray-50);
  color: var(--charcoal);
}
body {
  min-height: 100%;
  height: auto;
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--gray-50);
  color: var(--charcoal);
  overflow-x: hidden;
}

/*
  Browser extensions (e.g. Card Pointers) sometimes inject Vuetify and wrap the host page in
  .v-application / .v-application--wrap with min-height: 100vh, which creates a tall empty
  scroll region and fights Rivet’s flex layout. :has(#app) limits this reset to wrappers that
  actually enclose our root (Rivet does not ship Vuetify).
*/
.v-application:has(#app),
.v-application--wrap:has(#app) {
  min-height: 0 !important;
  min-block-size: 0 !important;
  height: auto !important;
  max-height: none !important;
}

button { font-family: inherit; cursor: pointer; border: none; outline: none; }
button:focus-visible {
  outline: 2px solid var(--steel-light);
  outline-offset: 2px;
}
input, textarea, select { font-family: inherit; outline: none; }
a { color: inherit; text-decoration: none; }

/* ─── Layout ────────────────────────────────────────────────── */
/* Stretch so main + sidebar share a predictable column height; min-height fills viewport for inner scroll panes */
#app {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--charcoal);
  background-image: repeating-linear-gradient(
    45deg, transparent, transparent 40px, rgba(255,255,255,0.02) 40px, rgba(255,255,255,0.02) 80px
  );
}

.sidebar {
  width: var(--sidebar-w); min-height: 100vh; background: var(--charcoal);
  display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
}

.main-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
  position: relative;
  z-index: 1;
  isolation: isolate;
  overflow-x: hidden;
  /* Scroll here when page content is taller than the column. Avoids flex:1 + overflow:auto on
     every page body, which stretched short pages to full viewport and showed a huge empty scroll band. */
  overflow-y: auto;
}

/*
  #app flex row defaults to align-items: stretch, so .main-content matched the sidebar height (100vh).
  That left a tall empty band below short pages (admin, dashboard, …). Project shells include a direct
  .tab-bar child - those still stretch so tasks/calendar/… can use flex:1 to fill the viewport.
*/
.main-content:not(:has(> .tab-bar)) {
  align-self: flex-start;
}

/* Shell: keep chrome fixed height; let tasks/calendar fill remaining space */
.main-content > .page-header,
.main-content > .tab-bar {
  flex-shrink: 0;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--charcoal-3);
}
.sidebar-logo h1 { font-size: 22px; font-weight: 800; color: var(--amber); letter-spacing: -0.5px; }
.sidebar-logo .tagline { font-size: 11px; color: var(--gray-400); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.8px; }

.sidebar-company {
  padding: 16px 20px; border-bottom: 1px solid var(--charcoal-3);
}
.sidebar-company .company-name { font-size: 13px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-company .invite-code {
  font-size: 11px; color: var(--gray-400); margin-top: 4px;
  cursor: pointer; display: flex; align-items: center; gap: 4px;
}
.sidebar-company .invite-code:hover { color: var(--amber); }

.sidebar-alerts {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--charcoal-3);
  cursor: pointer;
  color: var(--gray-400);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.sidebar-alerts:hover { background: var(--charcoal-2); color: var(--white); }
.sidebar-alerts:focus { outline: none; box-shadow: inset 0 0 0 2px var(--steel); }
.sidebar-alerts.has-alerts { color: var(--amber); }
.sidebar-alerts-icon { font-size: 16px; line-height: 1; }
.sidebar-alerts-label { flex: 1; }
.sidebar-alerts-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--red);
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.schedule-alert-list { display: flex; flex-direction: column; gap: 8px; max-height: min(60vh, 420px); overflow-y: auto; }
.schedule-alert-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: var(--white);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.schedule-alert-row:hover { border-color: var(--steel-light); box-shadow: var(--shadow); }
.schedule-alert-row-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.schedule-alert-row-meta { font-size: 12px; margin-bottom: 8px; }
.schedule-alert-blockers { font-size: 12px; line-height: 1.45; margin-top: 4px; white-space: normal; text-align: left; }
.schedule-alert-suggest { font-size: 12px; margin-top: 8px; white-space: normal; text-align: left; line-height: 1.45; }
.schedule-alert-suggest--dual .schedule-alert-suggest-line + .schedule-alert-suggest-line { margin-top: 6px; }
.schedule-alert-suggest-hint { font-size: 11px; }
.edit-task-schedule-alert {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  border-left: 4px solid #ea580c;
}
.edit-task-downstream-conflicts {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: var(--warning-bg);
  border: 1px solid var(--amber);
  border-radius: 8px;
  border-left: 4px solid var(--amber-dim);
  font-size: 13px;
  line-height: 1.45;
}
.edit-task-downstream-line + .edit-task-downstream-line { margin-top: 10px; }
#edit-task-schedule-panels:empty { display: none; }
.schedule-alert-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.schedule-alert-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: #FDEDEC;
  color: #922B21;
}

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  font-size: 14px; font-weight: 500; color: var(--gray-400);
  cursor: pointer; transition: background 0.15s, color 0.15s; border-radius: 0;
}
.nav-item:hover { background: var(--charcoal-2); color: var(--white); }
.nav-item.active { background: var(--steel-dim); color: var(--white); border-left: 3px solid var(--amber); padding-left: 17px; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.nav-section-label {
  padding: 16px 20px 6px; font-size: 10px; color: var(--charcoal-3);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
}

.sidebar-project-name {
  padding: 12px 20px; background: var(--charcoal-2);
  border-top: 1px solid var(--charcoal-3); border-bottom: 1px solid var(--charcoal-3);
}
.sidebar-project-name .label { font-size: 10px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.8px; }
.sidebar-project-name .name { font-size: 13px; font-weight: 600; color: var(--white); margin-top: 2px; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--charcoal-3); display: flex; flex-direction: column; gap: 8px; }
.sidebar-footer-link {
  width: 100%; background: transparent; border: none; color: var(--steel-light);
  padding: 6px 0; font-size: 12px; font-weight: 600; text-align: left; cursor: pointer;
}
.sidebar-footer-link:hover { color: var(--amber); text-decoration: underline; }
.btn-logout { width: 100%; background: transparent; border: 1px solid var(--charcoal-3); color: var(--gray-400); padding: 8px 12px; border-radius: var(--radius); font-size: 13px; transition: all 0.15s; }
.btn-logout:hover { border-color: var(--red); color: var(--red); }

.notif-pref-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; cursor: pointer; }
.notif-pref-row input { margin-top: 3px; flex-shrink: 0; }
.notif-pref-row-text { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.notif-pref-hint { font-size: 12px; display: block; line-height: 1.35; }

.notif-pref-subgroup {
  margin: 4px 0 8px 0;
  margin-left: 22px;
  padding-left: 16px;
  border-left: 2px solid var(--gray-200);
}
.notif-pref-subgroup .notif-pref-row:last-child { margin-bottom: 0; }
.notif-pref-subgroup-disabled {
  opacity: 0.5;
  pointer-events: none;
}
.notif-pref-subgroup-disabled .notif-pref-row { cursor: not-allowed; }
.notif-pref-subgroup-disabled input:disabled { cursor: not-allowed; }

/* ─── Page Header ───────────────────────────────────────────── */
.page-header {
  padding: 28px 32px 20px; border-bottom: 1px solid var(--gray-200);
  background: var(--white); display: flex; align-items: flex-start; justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 8;
}
.page-header h2 { font-size: 24px; font-weight: 700; color: var(--charcoal); }
.page-header .subtitle { font-size: 13px; color: var(--gray-400); margin-top: 4px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; }

/* Intro blocks inside tab scroll panels (team, audit): must not use global sticky + transparent,
   or body text scrolls underneath the title on phones. */
.page-header.page-header--tab-intro {
  position: static;
  z-index: auto;
  background: var(--gray-50);
  border-bottom: none;
  padding: 0 0 16px;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 600; transition: all 0.15s; }
.btn-primary { background: var(--steel); color: var(--white); }
.btn-primary:hover { background: var(--steel-light); }
.btn-secondary { background: var(--gray-100); color: var(--charcoal); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-amber { background: var(--amber); color: var(--charcoal); }
.btn-amber:hover { background: var(--amber-dim); }
.btn-ghost { background: transparent; color: var(--steel); padding: 6px 12px; font-size: 13px; }
.btn-ghost:hover { background: var(--gray-100); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-icon { padding: 6px 8px; background: transparent; color: var(--gray-400); border-radius: 4px; }
.btn-icon:hover { background: var(--gray-100); color: var(--charcoal); }

/* ─── Auth Card ─────────────────────────────────────────────── */
.auth-card {
  background: var(--white); border-radius: 16px; padding: 40px;
  width: 420px; box-shadow: var(--shadow-lg);
}
.auth-card-wide {
  width: min(100%, 480px);
  max-width: 480px;
}
.no-company-recovery { margin-top: 2px; }
.no-company-recovery-heading { font-size: 15px; font-weight: 700; margin: 0 0 6px; color: var(--charcoal); }
.no-company-recovery-hint { font-size: 12px; line-height: 1.45; margin: 0 0 12px; }
.no-company-recovery .form-group { margin-bottom: 12px; }
.no-company-recovery-divider {
  display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--gray-400);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.no-company-recovery-divider::before,
.no-company-recovery-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }
.auth-logo { font-size: 28px; font-weight: 800; color: var(--amber); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.brand-logo-img { display: inline-block; vertical-align: middle; border-radius: 5px; flex-shrink: 0; }
.auth-subtitle { font-size: 13px; color: var(--gray-400); margin-bottom: 28px; }
.auth-switch { font-size: 13px; color: var(--gray-400); text-align: center; margin-top: 20px; }
.auth-switch span { color: var(--steel); cursor: pointer; font-weight: 600; }
.auth-switch span:hover { text-decoration: underline; }
.auth-link { color: var(--steel); cursor: pointer; font-weight: 600; }
.auth-link:hover { text-decoration: underline; }

/* Inline action styled like a text link (prefer over <a href="#"> for keyboard + semantics) */
button.text-link-btn,
button.btn-link {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--steel);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-align: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.text-link-btn:hover,
button.btn-link:hover { color: var(--steel-light); }

.mode-toggle { display: flex; background: var(--gray-100); border-radius: var(--radius); padding: 3px; margin-bottom: 20px; }
.mode-toggle button { flex: 1; padding: 8px; border-radius: 5px; font-size: 13px; font-weight: 600; background: transparent; color: var(--gray-600); transition: all 0.15s; }
.mode-toggle button.active { background: var(--white); color: var(--charcoal); box-shadow: var(--shadow); }

/* ─── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--charcoal); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-200);
  border-radius: var(--radius); font-size: 14px; color: var(--charcoal);
  background: var(--white); transition: border-color 0.15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--steel); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239E9E9E' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.address-lookup-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.address-lookup-input {
  flex: 1;
  min-width: 0;
}
.project-map {
  height: 240px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  margin-bottom: 12px;
  background: var(--gray-100);
  z-index: 0;
}
.project-map .leaflet-container {
  font-family: inherit;
  border-radius: var(--radius);
}
.geo-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  max-height: 180px;
  overflow-y: auto;
}
.geo-suggestions.hidden { display: none !important; }
.geo-suggestion-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: var(--white);
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
  color: var(--charcoal);
}
.geo-suggestion-btn:hover {
  border-color: var(--steel-light);
  background: var(--gray-50);
}
.form-hint { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.form-submit { width: 100%; padding: 12px; background: var(--steel); color: var(--white); border-radius: var(--radius); font-size: 15px; font-weight: 700; transition: background 0.15s; }
.form-submit:hover { background: var(--steel-light); }

.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--steel); }
.checkbox-group label { font-size: 14px; font-weight: 400; margin-bottom: 0; }

/* ─── Dashboard ─────────────────────────────────────────────── */
.dashboard-body { padding: 28px 32px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-top: 20px; }

.project-card {
  background: var(--white); border-radius: 12px; padding: 22px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
  display: flex; flex-direction: column; min-height: 100%;
}
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--steel); }
.project-card-main { flex: 1; min-width: 0; }
.project-card-footer {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.project-card-remove-dash { color: var(--gray-600) !important; font-weight: 600; }
.project-card-remove-dash:hover { color: var(--steel) !important; }
.project-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.project-card h3 { font-size: 16px; font-weight: 700; color: var(--charcoal); line-height: 1.3; }
.project-card .dates { font-size: 12px; color: var(--gray-400); margin-top: 6px; }
.project-card .companies { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.company-chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--gray-100); color: var(--gray-600); }
.company-chip.gc { background: #EBF5FB; color: var(--steel); }
.company-chip.homeowner { background: #F4ECFC; color: #5B2C83; }
.company-chip.inspector { background: #E8F6F0; color: #1B5E3A; }

.project-progress { margin-top: 14px; }
.progress-bar-bg { height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 0.3s; }
.progress-label { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

.new-project-card {
  background: var(--gray-100); border-radius: 12px; padding: 22px;
  border: 2px dashed var(--gray-200); cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 160px; gap: 8px;
}
.new-project-card:hover { border-color: var(--steel); background: #EBF5FB; }
.new-project-card .plus { font-size: 28px; color: var(--gray-400); }
.new-project-card span { font-size: 14px; font-weight: 600; color: var(--gray-400); }
.new-project-card:hover .plus, .new-project-card:hover span { color: var(--steel); }

/* Site history page (#site-history) */
.site-history-page { padding: 0 32px 40px; max-width: 800px; }
.site-history-intro { font-size: 13px; line-height: 1.45; margin-bottom: 18px; max-width: 640px; }
.site-history-search-wrap { max-width: 420px; margin-bottom: 22px; }
.site-history-search-input {
  width: 100%;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}
.site-history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.site-history-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 14px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}
.site-history-address { font-size: 14px; color: var(--charcoal); line-height: 1.4; flex: 1; min-width: 160px; }
.site-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.site-history-delete { color: var(--red); }
.site-history-delete:hover { color: #c0392b; }
.site-history-empty { padding: 20px 14px; text-align: left; font-size: 14px; list-style: none; }

/* ─── Status Badges ─────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.4px; }
.badge-pending { background: var(--gray-100); color: var(--gray-600); }
.badge-in_progress { background: #EBF5FB; color: var(--steel); }
.badge-completed { background: #EAFAF1; color: var(--green); }
.badge-blocked { background: #FEF9E7; color: var(--orange); }
.badge-active { background: #EAFAF1; color: var(--green); }
.badge-paused { background: #FEF9E7; color: var(--orange); }
.badge-gc { background: #EBF5FB; color: var(--steel); }
.badge-subcontractor { background: var(--gray-100); color: var(--gray-600); }
.badge-vendor { background: var(--gray-100); color: var(--gray-600); }
.badge-homeowner { background: #F4ECFC; color: #5B2C83; }
.badge-inspector { background: #E8F6F0; color: #1B5E3A; }
.badge-archived { background: var(--gray-100); color: var(--gray-600); }
.badge-cancelled { background: #FDEDEC; color: #922B21; }
/* Clickable role badge */
.badge-role-btn { font: inherit; border: none; cursor: pointer; transition: opacity 0.12s; }
.badge-role-btn:hover { opacity: 0.75; }
.badge-role-btn:focus-visible { outline: 2px solid var(--steel-light); outline-offset: 2px; }
/* Role dropdown */
.role-dropdown {
  position: fixed;
  z-index: 1000;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 120px;
  overflow: hidden;
}
.role-dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--charcoal);
  transition: background 0.1s;
}
.role-dropdown-item:hover:not(:disabled) { background: var(--gray-100); }
.role-dropdown-item--current { font-weight: 700; color: var(--steel); }
.role-dropdown-item:disabled { color: var(--gray-400); cursor: not-allowed; }

.project-readonly-tag { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: lowercase; }

/* ─── Tabs ──────────────────────────────────────────────────── */
.tab-bar {
  display: flex; background: var(--white); border-bottom: 2px solid var(--gray-200); padding: 0 32px;
}
.tab {
  padding: 14px 20px; font-size: 14px; font-weight: 600; color: var(--gray-400);
  cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.15s;
}
.tab:hover { color: var(--charcoal); }
.tab.active { color: var(--steel); border-bottom-color: var(--steel); }

/* ─── Tasks View ─────────────────────────────────────────────── */
/* Fills space under header + tabs inside .main-content (flex column); avoids brittle 100vh − Npx when headers wrap */
.tasks-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.phases-panel {
  width: 220px;
  max-width: min(220px, 38vw);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.phases-panel-header { flex-shrink: 0; padding: 16px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.phases-panel-header h4 { font-size: 13px; font-weight: 700; color: var(--charcoal); }

/* Scroll phase list only; header stays visible (desktop + mobile) */
.phases-panel-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.phase-item {
  padding: 12px 16px; border-left: 3px solid transparent;
  font-size: 13px; font-weight: 500; color: var(--gray-600); transition: all 0.15s;
  display: flex; align-items: flex-start; gap: 8px;
}
.phase-item:hover { background: var(--gray-50); color: var(--charcoal); }
.phase-item.active { background: #EBF5FB; color: var(--steel); border-left-color: var(--steel); font-weight: 600; }
.phase-item .phase-task-count { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.phase-item.active .phase-task-count { color: var(--steel); opacity: 0.7; }
.phase-item-main { flex: 1; min-width: 0; cursor: pointer; }
.phase-order-list { display: flex; flex-direction: column; }
.phase-item-reorder {
  position: relative;
}
.task-card.rivet-dnd-insert-before::before {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  height: 3px;
  background: var(--steel);
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
}
.task-card.rivet-dnd-insert-after::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  background: var(--steel);
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
}
.phase-drop-zone.phase-item { cursor: default; }
.phase-drop-zone .phase-item-main { cursor: pointer; }

/* Narrow desktop (e.g. devtools docked): keep phases from crowding the task list */
@media (max-width: 1024px) and (min-width: 881px) {
  .phases-panel {
    width: min(188px, 32vw);
    max-width: min(188px, 32vw);
  }
}

.drag-handle {
  cursor: grab;
  user-select: none;
  color: var(--gray-400);
  font-size: 14px;
  line-height: 1.2;
  padding: 2px 0;
  flex-shrink: 0;
  letter-spacing: -2px;
}
.drag-handle:active { cursor: grabbing; }

.tasks-panel { flex: 1; overflow-y: auto; padding: 20px 24px; background: var(--gray-50); }
.tasks-no-assignment-banner {
  font-size: 13px;
  line-height: 1.45;
  color: var(--charcoal);
  background: #f0f7fb;
  border: 1px solid var(--steel-light);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.tasks-no-assignment-banner strong { color: var(--steel-dim); }
.schedule-alerts-section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 18px 0 6px;
  color: var(--charcoal);
}
.tasks-panel-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 16px;
}
.tasks-panel-header h3 { font-size: 16px; font-weight: 700; min-width: 0; flex: 1 1 160px; }
.tasks-panel-header-actions {
  display: flex;
  gap: 8px 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
  min-width: 0;
}

/* Narrow / tablet: stack title and filters so filters don’t sit in a lonely top-right column */
@media (max-width: 1024px) {
  .tasks-panel-header {
    flex-direction: column;
    align-items: stretch;
  }
  .tasks-panel-header h3 {
    flex: none;
  }
  .tasks-panel-header-actions {
    margin-left: 0;
    justify-content: flex-start;
  }
}
.my-tasks-filter-label { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-muted, #666); cursor: pointer; user-select: none; white-space: nowrap; }

.tasks-tab-sort-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted, #666);
  white-space: nowrap;
}
.tasks-tab-sort-label-text { flex-shrink: 0; }
.tasks-tab-sort-select {
  font: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--charcoal);
  min-width: 0;
  max-width: 160px;
}

.tasks-tab-search-label {
  display: flex;
  align-items: center;
  min-width: 0;
}
.tasks-tab-search-input {
  width: min(220px, 36vw);
  max-width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  font: inherit;
  font-size: 13px;
}
.tasks-tab-search-input:focus {
  outline: 2px solid var(--steel-light);
  outline-offset: 1px;
}

.task-card {
  position: relative;
  background: var(--white); border-radius: 10px; padding: 16px 18px;
  box-shadow: var(--shadow); margin-bottom: 10px; border-left: 4px solid transparent;
  transition: box-shadow 0.15s;
}
.task-card:hover { box-shadow: var(--shadow-lg); }
.task-card--openable { cursor: pointer; }
.task-card--openable[draggable="true"] { cursor: grab; }
.task-card--openable[draggable="true"]:active { cursor: grabbing; }
.task-card--openable .task-comments,
.task-card--openable .task-card-actions,
.task-card--openable .task-status-actions,
.task-card--openable label { cursor: default; }
.task-card--openable[draggable="true"] .task-drag-handle { cursor: grab; }
@media (pointer: coarse) {
  .task-card-header .task-drag-handle {
    display: none;
  }
}
.task-card.status-completed { border-left-color: var(--green); opacity: 0.75; }
.task-card.status-in_progress { border-left-color: var(--steel); }
.task-card.status-blocked { border-left-color: var(--orange); }
.task-card.status-pending { border-left-color: var(--gray-200); }

@keyframes task-card-focus-pulse {
  0% { box-shadow: var(--shadow), 0 0 0 0 rgba(44, 95, 138, 0.5); }
  40% { box-shadow: var(--shadow-lg), 0 0 0 6px rgba(44, 95, 138, 0.2); }
  70% { box-shadow: var(--shadow-lg), 0 0 0 3px rgba(44, 95, 138, 0.35); }
  100% { box-shadow: var(--shadow), 0 0 0 0 rgba(44, 95, 138, 0); }
}
.task-card.task-card--focus-flash {
  animation: task-card-focus-pulse 1s ease-out 1;
  position: relative;
  z-index: 1;
}

.task-card-header { display: flex; align-items: flex-start; gap: 10px; }
.task-card-header .task-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1.3;
  text-decoration: none;
}
.task-card-header .task-card-actions,
.task-card-header .task-card-actions-readonly { margin-left: auto; flex-shrink: 0; }

.task-meta .badge-blocked[title],
.task-card-actions-readonly .badge-blocked[title] { cursor: help; }
.task-card.status-completed .task-title { text-decoration: line-through; color: var(--gray-400); }
.task-card-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.task-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  max-width: min(280px, 100%);
}
.task-status-actions .btn-status {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  white-space: nowrap;
}
.task-card-actions-readonly { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }

.task-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.task-meta-item { font-size: 12px; color: var(--gray-400); display: flex; align-items: center; gap: 3px; }
.date-confirmed-badge { display: inline-block; font-size: 10px; font-weight: 700; color: var(--white); background: var(--steel); border-radius: 4px; padding: 1px 5px; letter-spacing: 0.02em; vertical-align: middle; }
.trade-tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--charcoal); color: var(--amber); }

.task-deps { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.dep-chip {
  font-size: 11px; padding: 3px 8px; border-radius: 4px; display: flex; align-items: center; gap: 4px;
}
.dep-chip.completed { background: #EAFAF1; color: var(--green); }
.dep-chip.pending { background: #FEF9E7; color: var(--orange); }
.task-deps-downstream { display: block; margin-top: 10px; width: 100%; }
.task-deps-label { display: block; }
.task-dep-chips-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dep-chip-downstream {
  background: var(--gray-50);
  border: 1px dashed var(--gray-200);
  color: var(--charcoal);
}
.dep-chip-remove {
  margin-left: 4px;
  border: none;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 4px;
}
.dep-chip-remove:hover { color: var(--red); background: rgba(229, 57, 53, 0.08); }

.calendar-dashboard-insights {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--gray-100);
  border-radius: 12px;
  background: var(--gray-50);
}

/* Job calendar: legend + panels sit below the grid in a short scroll region so the month stays in view. */
.calendar-insights {
  margin-top: 10px;
  margin-bottom: 0;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
  flex-shrink: 0;
}
.calendar-insights-scroll {
  max-height: min(260px, 36vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
@media (max-width: 880px) {
  .calendar-insights-scroll {
    max-height: min(200px, 30vh);
  }
}
.calendar-insights .calendar-legend-strip {
  font-size: 11px;
  gap: 6px 10px;
}
.calendar-insights .calendar-legend-hint {
  margin-left: 0;
  flex-basis: 100%;
  font-size: 10px;
  line-height: 1.35;
}
.calendar-insights .calendar-blockers-panel {
  margin-top: 8px;
  padding-top: 8px;
}
.calendar-insights .calendar-blockers-title {
  font-size: 11px;
  margin: 0 0 6px;
}
.calendar-insights .calendar-blockers-list {
  padding-left: 15px;
}
.calendar-insights .calendar-blocker-row {
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.35;
}
.calendar-insights .calendar-blocker-row strong {
  font-weight: 600;
}
.calendar-insights .calendar-insight-intro {
  font-size: 11px;
  line-height: 1.4;
  margin: 0 0 8px;
}
.calendar-insights .calendar-insight-meta {
  font-size: 11px;
  margin-top: 2px;
  line-height: 1.35;
}
.calendar-insights .calendar-blockers-empty {
  margin: 0;
  font-size: 11px;
}
.calendar-insights .calendar-blocker-count {
  font-size: 11px;
  font-weight: 500;
}

.calendar-legend-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  font-size: 13px;
  color: var(--charcoal);
}
.calendar-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.calendar-legend-hint {
  margin-left: 8px;
  font-size: 11px;
}
.calendar-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
  vertical-align: middle;
}
.calendar-blockers-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--gray-200); }
.calendar-blockers-title {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gray-600);
}
.calendar-blockers-list { margin: 0; padding-left: 18px; }
.calendar-blocker-row { margin-bottom: 10px; }

.task-status-select {
  font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 4px;
  border: 1.5px solid var(--gray-200); background: var(--white); cursor: pointer;
  appearance: none; text-align: center;
}

.task-comments { margin-top: 12px; border-top: 1px solid var(--gray-100); padding-top: 10px; }
.comment-item { font-size: 12px; color: var(--gray-600); margin-bottom: 6px; }
.comment-item strong { color: var(--charcoal); }
.comment-form { display: flex; gap: 6px; margin-top: 8px; }
.comment-form input { flex: 1; padding: 6px 10px; border: 1.5px solid var(--gray-200); border-radius: 6px; font-size: 12px; }
.comment-form button { padding: 6px 12px; background: var(--steel); color: var(--white); border-radius: 6px; font-size: 12px; font-weight: 600; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-400); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ─── Weather ───────────────────────────────────────────────── */
/* Workspace pages: height follows content; .main-content scrolls (avoids flex:1 empty scroll band on short pages). */
.main-content > .dashboard-body,
.main-content > .schedule-page,
.main-content > .site-history-page,
.main-content > .subscription-page,
.main-content > .templates-page,
.main-content > .templates-editor,
.main-content > .admin-page {
  flex: 0 1 auto;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

/* Project tab panels: fill space under header + tab bar and scroll inside (keep chrome fixed). */
.main-content > .calendar-view,
.main-content > .weather-view,
.main-content > .team-view,
.main-content > .verification-view {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.weather-view { padding: 28px 32px; }
.weather-grid { display: flex; gap: 12px; margin-top: 20px; overflow-x: auto; padding-bottom: 8px; }
.weather-card {
  background: var(--white); border-radius: 12px; padding: 18px 16px;
  min-width: 130px; text-align: center; box-shadow: var(--shadow); flex-shrink: 0;
}
.weather-card .day { font-size: 12px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.6px; }
.weather-card .w-icon { font-size: 36px; margin: 10px 0; }
.weather-card .temp-range { font-size: 14px; font-weight: 700; color: var(--charcoal); }
.weather-card .temp-range span { font-weight: 400; color: var(--gray-400); }
.weather-card .precip { font-size: 12px; color: var(--steel); margin-top: 6px; }
.weather-card .wind { font-size: 11px; color: var(--gray-400); margin-top: 3px; }
.weather-card.today { border: 2px solid var(--amber); }

.weather-sensitive-section { margin-top: 28px; }
.weather-sensitive-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.weather-task-row { background: var(--white); border-radius: 8px; padding: 12px 16px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow); }
.weather-task-row .task-info h4 { font-size: 14px; font-weight: 600; }
.weather-task-row .task-info p { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* ─── Calendar ──────────────────────────────────────────────── */
.calendar-view {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.calendar-view-primary {
  flex-shrink: 0;
  width: 100%;
  min-width: 0;
}
/* Month on top; Prev | Today | Next on one row */
.calendar-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 20px;
}
.calendar-nav--dashboard {
  grid-template-rows: auto auto;
}
.calendar-nav-month {
  grid-column: 1 / -1;
  grid-row: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  min-width: 0;
}
.calendar-nav-prev {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
}
.calendar-nav-today {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
}
.calendar-nav-next {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
}
.calendar-grid {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--charcoal);
  width: 100%;
  min-width: 0;
}
.calendar-day-label { padding: 10px 4px; text-align: center; font-size: 12px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; min-width: 0; }
.calendar-weeks { width: 100%; min-width: 0; }
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--gray-200);
  width: 100%;
  min-width: 0;
  position: relative;
  /* Below day number: pad (6) + date row (≤24 for “today”) + margin (4) */
  --calendar-span-strip-top: 34px;
  --calendar-span-lane-step: 20px;
}
/* Multi-day bars sit over the cells (below day numbers), aligned to column grid */
.calendar-week-span-overlay {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--calendar-span-strip-top);
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(var(--calendar-span-lanes, 1), minmax(17px, auto));
  gap: 3px 0;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
  min-height: calc(var(--calendar-span-lanes, 0) * var(--calendar-span-lane-step));
  overflow: hidden;
}
.calendar-week-span-overlay .calendar-task-span {
  pointer-events: auto;
}
/* Reserves the same vertical space inside each cell so pills sit below spanning bars */
.calendar-cell-span-gap {
  flex-shrink: 0;
  min-height: calc(var(--calendar-span-lanes, 0) * var(--calendar-span-lane-step));
  /* Space between multi-day strip and single-day pills (only when lanes > 0) */
  margin-bottom: clamp(0px, calc(var(--calendar-span-lanes, 0) * 6px), 6px);
}
.calendar-task-span {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--white);
  cursor: pointer;
  min-height: 17px;
  box-sizing: border-box;
  align-self: stretch;
  /* Match .calendar-cell horizontal padding (4px) so bars line up with single-day pills */
  margin-left: 4px;
  margin-right: 4px;
  min-width: 0;
}
.calendar-task-span.calendar-task-pill-dnd {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: element;
}
.calendar-task-span.calendar-task-pill-dnd:active { cursor: grabbing; }
.calendar-task-span-readonly {
  cursor: default;
  opacity: 0.92;
}
.calendar-cell {
  display: flex;
  flex-direction: column;
  min-height: 90px;
  min-width: 0;
  padding: 6px 4px;
  border-right: 1px solid var(--gray-200);
  overflow: hidden;
}
.calendar-cell:last-child { border-right: none; }
.calendar-cell.other-month { background: var(--gray-50); }

/* Calendar hint on narrow screens (same breakpoint as mobile shell) */
.calendar-mobile-hint {
  display: none;
  font-size: 12px;
  margin: -2px 0 14px;
  line-height: 1.45;
}
@media (max-width: 880px) {
  .calendar-mobile-hint {
    display: block;
    padding: 0 4px;
  }
}

/* Editable calendar: cursor + hover bg + "+" hint on empty cell area */
.calendar-view--editable .calendar-cell:not(.other-month) {
  position: relative;
  cursor: pointer;
}
.calendar-view--editable .calendar-cell:not(.other-month):hover {
  background: rgba(44, 95, 138, 0.05);
}
.calendar-view--editable .calendar-cell:not(.other-month)::after {
  content: '+';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-400);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  line-height: 1;
}
.calendar-view--editable .calendar-cell:not(.other-month):hover::after {
  opacity: 1;
}
/* Pills keep their own cursor; prevent cell cursor from fighting grab */
.calendar-view--editable .calendar-task-pill { cursor: pointer; }
.calendar-cell.today .cell-date { background: var(--amber); color: var(--charcoal); border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.cell-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 4px;
  min-height: 22px;
  box-sizing: border-box;
}
.cell-date.other { color: var(--gray-200); }
.calendar-task-pill {
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 3px; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  color: var(--white); background: var(--steel);
}
.calendar-task-pill-dnd {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: element;
}
.calendar-task-pill-dnd:active { cursor: grabbing; }
.calendar-cell-dragover { box-shadow: inset 0 0 0 2px var(--steel); background: rgba(44, 95, 138, 0.07); }
.calendar-task-pill-readonly { cursor: default; opacity: 0.92; }
.calendar-task-pill-multi {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  color: var(--white) !important;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}

/* ─── Stripe (subscription page) ─────────────────────────────── */
.subscription-stripe-box {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  max-width: 640px;
}
.subscription-stripe-title { font-size: 14px; font-weight: 700; margin: 0 0 8px; }
.subscription-stripe-copy { font-size: 12px; line-height: 1.45; margin: 0 0 12px; }
.subscription-stripe-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.subscription-stripe-hint { font-size: 11px; margin: 10px 0 0; line-height: 1.4; }
.billing-pay-mode { font-weight: 600; color: var(--steel); }

/* ─── Dashboard schedule (multi-project) ─────────────────────── */
.schedule-page { padding: 24px 32px 40px; max-width: 1100px; }
.schedule-toolbar { margin-bottom: 18px; max-width: 640px; }
.schedule-filter { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; margin-bottom: 8px; }
.schedule-calendar-wrap { margin-bottom: 28px; }
.schedule-feed-url-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.schedule-feed-input {
  flex: 1;
  min-width: 200px;
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--gray-50);
  font-family: inherit;
}
.schedule-feed-url-masked {
  color: var(--gray-400);
  letter-spacing: 0.12em;
  user-select: none;
  cursor: default;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mfa-setup-key-details summary {
  list-style: none;
}
.mfa-setup-key-details summary::-webkit-details-marker {
  display: none;
}
.mfa-setup-key-details summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 6px;
  border-left: 5px solid var(--steel);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: rotate(0deg);
  vertical-align: middle;
  transition: transform 0.15s ease;
}
.mfa-setup-key-details[open] summary::before {
  transform: rotate(90deg);
}
.schedule-feed-reveal-btn {
  flex-shrink: 0;
  min-width: 2.25rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  font-size: 1rem;
  line-height: 1;
}
.schedule-feed-reveal-btn[aria-pressed='true'] {
  background: var(--gray-200);
}
.schedule-feed-reveal-btn .schedule-feed-reveal-icon {
  font-size: 1.25rem;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

/* ─── Dependency verification ───────────────────────────────── */
.dep-verify-target { font-size: 14px; margin-bottom: 16px; padding: 12px; background: var(--gray-50); border-radius: 8px; }
.dep-verify-list { display: flex; flex-direction: column; gap: 16px; }
.dep-verify-row { border: 1px solid var(--gray-200); border-radius: 8px; padding: 12px 14px; }
.dep-verify-label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; line-height: 1.4; }
.dep-verify-label input { margin-top: 3px; flex-shrink: 0; }
.dep-verify-note { width: 100%; margin-top: 10px; font-size: 13px; padding: 8px; border: 1px solid var(--gray-200); border-radius: 6px; resize: vertical; min-height: 52px; }

/* ─── Verification report (owner) ─────────────────────────────── */
.verification-view { padding: 28px 32px; }
.verification-table-wrap { overflow-x: auto; background: var(--white); border-radius: 12px; box-shadow: var(--shadow); }
.verification-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.verification-table th, .verification-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.verification-table th { background: var(--charcoal); color: var(--gray-400); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.verification-table tr:last-child td { border-bottom: none; }
.verification-note { max-width: 220px; color: var(--gray-600); }
.verification-when { white-space: nowrap; color: var(--gray-600); font-size: 12px; }

.audit-trail-section { margin-top: 8px; }
.audit-trail-section-border { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--gray-100); }
.audit-trail-heading { font-size: 15px; font-weight: 700; margin: 0 0 8px; color: var(--charcoal); }
.audit-trail-lead { font-size: 13px; margin: 0 0 14px; max-width: 720px; line-height: 1.45; }
.audit-trail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; background: var(--white); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.audit-trail-item { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: 14px 20px; padding: 14px 16px; border-bottom: 1px solid var(--gray-100); align-items: start; }
.audit-trail-item:last-child { border-bottom: none; }
.audit-trail-when { font-size: 12px; color: var(--gray-600); white-space: nowrap; margin-top: 2px; }
.audit-trail-event-title { font-size: 12px; font-weight: 700; color: var(--charcoal); text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-bottom: 4px; }
.audit-trail-event-detail { font-size: 13px; line-height: 1.45; color: var(--gray-800); }
.audit-trail-note { color: var(--gray-600); font-size: 12px; }
.audit-trail-change-block { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--gray-100); }
.audit-trail-change-line { font-size: 12px; color: var(--gray-700); margin-top: 6px; line-height: 1.4; }
.audit-trail-change-line:first-child { margin-top: 0; }
@media (max-width: 640px) {
  .audit-trail-item { grid-template-columns: 1fr; }
}

.audit-trail-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 4px;
  border-bottom: 1px solid var(--gray-100);
}
.audit-trail-subtab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  margin-bottom: -1px;
}
.audit-trail-subtab:hover {
  color: var(--charcoal);
}
.audit-trail-subtab.audit-trail-subtab--active {
  color: var(--steel);
  border-bottom-color: var(--steel);
}
.audit-trail-subpanel {
  margin-top: 10px;
}
.audit-trail-subpanel--hidden {
  display: none !important;
}
.audit-trail-events-scroll {
  max-height: min(70vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.audit-trail-load-sentinel {
  height: 1px;
  margin: 0;
  visibility: hidden;
  pointer-events: none;
}
.audit-trail-load-sentinel--visible {
  visibility: visible;
  height: 8px;
}

/* ─── Company plan (subscription page) ───────────────────────── */
.subscription-page { padding: 0 32px 32px; max-width: 1200px; }
.subscription-page .hidden { display: none !important; }

.settings-section { margin-bottom: 28px; padding-bottom: 24px; }
.settings-section:not(:last-of-type) { border-bottom: 1px solid var(--border); }

.subscription-plan-section {
  margin-bottom: 40px;
}
.subscription-plan-section:last-of-type {
  margin-bottom: 0;
}
.subscription-plan-section-heading {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--charcoal);
}
.subscription-plan-section-intro {
  font-size: 13px;
  margin: 0 0 18px;
  max-width: 52rem;
  line-height: 1.45;
}
.subscription-per-project-cards-wrap {
  margin-bottom: 0;
}
.subscription-plan-grid--per-project {
  max-width: 360px;
  grid-template-columns: 1fr;
}

.subscription-pricing-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-bottom: 20px;
}
.subscription-pricing-toolbar-label { font-size: 13px; font-weight: 600; }
.subscription-cycle-toggle {
  display: inline-flex;
  gap: 4px;
  background: var(--gray-100);
  padding: 4px;
  border-radius: 8px;
}
.subscription-cycle-btn.is-active {
  background: var(--white);
  box-shadow: var(--shadow);
  font-weight: 600;
}

.subscription-plan-cards-wrap { margin-bottom: 28px; }
.subscription-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.subscription-plan-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.subscription-plan-card--current {
  border-color: var(--steel);
  box-shadow: 0 0 0 1px rgba(44, 95, 138, 0.2);
}
.subscription-plan-card-top { margin-bottom: 12px; }
.subscription-plan-card-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; color: var(--charcoal); }
.subscription-plan-card-headline { font-size: 12px; margin: 0 0 10px; line-height: 1.35; }
.subscription-plan-price { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--charcoal); line-height: 1.1; }
.subscription-plan-period { font-size: 12px; color: var(--gray-600); margin-top: 2px; }
.subscription-plan-why {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--gray-600);
  flex: 1;
}
.subscription-plan-why li { margin-bottom: 6px; }
.subscription-plan-cta { margin-top: auto; padding-top: 4px; }
.subscription-plan-admin-hint { font-size: 12px; margin: 0; line-height: 1.4; }
.subscription-plan-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border-radius: 20px;
  background: #e8f4ea;
  color: #1a5c2e;
}
.company-team-page .company-roster-wrap {
  overflow-x: auto;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.company-roster-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.company-roster-table th,
.company-roster-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.company-roster-table th {
  background: var(--charcoal);
  color: var(--gray-400);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.company-roster-table tr:last-child td { border-bottom: none; }
.company-roster-actions { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.company-plan-panel { min-height: 48px; }
.project-schedule-end-risk-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--charcoal);
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.12), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(217, 119, 6, 0.45);
}
.project-schedule-end-risk-banner-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--charcoal);
}
.project-schedule-end-risk-banner-body {
  font-size: 13px;
  margin: 0;
  line-height: 1.45;
}
.project-schedule-end-risk-banner-body strong {
  white-space: nowrap;
  font-weight: 700;
}
.project-schedule-end-risk-banner .text-muted { color: var(--gray-700); }

.billing-banner { border-radius: 10px; padding: 14px 18px; font-size: 14px; line-height: 1.45; }
.billing-banner-free { background: var(--gray-50); border: 1px solid var(--gray-200); color: var(--gray-600); }
.billing-banner-owner { background: linear-gradient(135deg, rgba(44,95,138,0.08), rgba(39,174,96,0.06)); border: 1px solid var(--gray-200); }
.billing-banner-owner h4 { font-size: 15px; font-weight: 700; margin: 0; color: var(--charcoal); }

.subscription-renewal-callout {
  font-size: 14px;
  line-height: 1.45;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--charcoal);
}
.subscription-renewal-callout--muted {
  background: transparent;
  border-style: dashed;
  color: var(--gray-600);
  font-size: 13px;
}
.billing-banner-free .subscription-renewal-callout {
  background: var(--white);
}
.billing-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.billing-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: baseline; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.billing-row:last-child { border-bottom: none; }
.billing-row-name { font-weight: 600; min-width: 140px; }
.plan-admin-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--gray-200);
}
.plan-admin-label { font-size: 12px; font-weight: 600; color: var(--gray-600); }
.plan-admin-select { font-size: 13px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--gray-200); }

/* ─── Templates ─────────────────────────────────────────────── */
.templates-page { padding: 0 32px 32px; max-width: 1200px; }
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.templates-empty { grid-column: 1 / -1; }
.template-card {
  background: var(--white);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.template-card-top h3 { font-size: 16px; font-weight: 700; margin: 8px 0 6px; }
.template-card-desc { font-size: 13px; line-height: 1.4; min-height: 2.8em; }
.template-card-actions { margin-top: auto; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.template-card-delete { color: var(--red) !important; }
.templates-editor { padding: 0 32px 40px; max-width: 1100px; }
.template-meta-form { margin-bottom: 24px; max-width: 560px; }
.template-table-wrap { overflow-x: auto; background: var(--white); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 24px; }
.template-task-table tbody tr[draggable="true"],
.template-task-table tbody tr[data-template-task-id]:not([draggable="true"]) { cursor: grab; }
.template-task-table tbody tr[draggable="true"]:active,
.template-task-table tbody tr[data-template-task-id]:not([draggable="true"]):active { cursor: grabbing; }
.template-task-table .template-row-actions,
.template-task-table .template-row-actions button { cursor: default; }

.template-task-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.template-task-table th, .template-task-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.template-task-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); background: var(--gray-50); }
.template-idx {
  font-weight: 700;
  color: var(--gray-500);
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}
.template-idx-inner {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
}
/* Table layout can ignore flex gap in some engines; margin is reliable. */
.template-idx-inner .drag-handle.template-row-handle {
  margin-right: 10px;
  flex-shrink: 0;
}
.template-idx-num { line-height: 1; }

/* Template task row DnD - bold black drop line (insert before / after this row).
   Per-cell inset shadow so it works in all browsers (tr::before is unreliable on tables). */
.template-task-table tbody tr.template-row-insert-before > td {
  box-shadow: inset 0 4px 0 0 #000;
}
.template-task-table tbody tr.template-row-insert-after > td {
  box-shadow: inset 0 -4px 0 0 #000;
}
.deps-code { font-size: 11px; background: var(--gray-50); padding: 2px 6px; border-radius: 4px; }
.template-row-actions { white-space: nowrap; }
.template-add-block { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 12px; padding: 18px; max-width: 720px; }
.template-add-block h4 { margin: 0 0 12px; font-size: 14px; font-weight: 700; }

/* Template dependency chart - draw.io-style pan/zoom canvas */
.template-deps-section {
  margin-bottom: 24px;
  max-width: 100%;
}
.template-deps-heading { font-size: 15px; font-weight: 700; margin: 0 0 6px; }
.template-deps-help { font-size: 12px; line-height: 1.45; margin: 0 0 14px; max-width: 720px; }
.template-deps-chart {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
}
.template-deps-canvas-wrap { display: flex; flex-direction: column; min-height: 420px; }
.template-deps-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  flex-shrink: 0;
}
.template-deps-toolbar-hint { margin: 0; font-size: 11px; line-height: 1.4; max-width: 640px; }
.template-deps-toolbar-btns { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
.template-deps-viewport {
  position: relative;
  flex: 1;
  min-height: 360px;
  overflow: hidden;
  background: var(--gray-100);
  cursor: default;
  touch-action: none;
}
.template-deps-world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.template-deps-plane {
  position: relative;
  background-color: #f0f2f5;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
}
.template-deps-plane-bg {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  cursor: grab;
}
.template-deps-plane-bg.is-panning { cursor: grabbing; }
.template-deps-svg-edges {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}
.template-deps-nodes-layer {
  position: relative;
  z-index: 2;
  pointer-events: none;
}
.template-deps-svg-hit {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}
.template-deps-svg-drag-vp {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 4;
}
.template-dep-node {
  position: absolute;
  display: flex;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
  box-sizing: border-box;
}
.template-dep-node.is-dragging-shape { opacity: 0.92; z-index: 10; }
.template-dep-node-draggable { cursor: grab; }
.template-dep-node-draggable:active { cursor: grabbing; }
.template-dep-port-spacer {
  width: 28px;
  flex-shrink: 0;
  align-self: center;
}
.template-dep-port-in,
.template-dep-port-out {
  position: relative;
  z-index: 6;
  width: 28px;
  min-height: 44px;
  flex-shrink: 0;
  align-self: center;
  border-radius: 8px;
  border: 2px dashed var(--steel);
  background: var(--gray-50);
  padding: 0;
  color: var(--steel);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: grab;
  transition: background 0.15s, border-color 0.15s;
  pointer-events: auto;
}
.template-dep-port-in { border-style: solid; cursor: default; }
.template-dep-port-out:active { cursor: grabbing; }
.template-dep-port-in:hover,
.template-dep-port-out:hover {
  background: rgba(44, 95, 138, 0.12);
  border-color: var(--steel-light);
}
.template-dep-node-inner {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--steel);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  pointer-events: auto;
}
.template-dep-node-idx {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  background: var(--charcoal);
  color: var(--amber);
  border-radius: 8px;
}
.template-dep-node-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.template-dep-node-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.template-dep-node-phase { font-size: 11px; color: var(--gray-600); }

/* Template dependency "Reading list" (alternative to flowchart canvas) */
.template-deps-list-shell {
  display: flex;
  flex-direction: column;
  min-height: 380px;
  max-height: min(78vh, 920px);
  background: var(--white);
}
.template-deps-list-toolbar {
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.template-deps-reading-list {
  list-style: none;
  margin: 0;
  padding: 12px 16px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.template-deps-list-item {
  margin: 0 0 14px;
  padding: 14px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  border-left: 4px solid var(--steel);
}
.template-deps-list-item:last-child { margin-bottom: 4px; }
.template-deps-list-item-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.template-deps-list-idx {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  background: var(--charcoal);
  color: var(--amber);
  border-radius: 8px;
}
.template-deps-list-text { min-width: 0; flex: 1; }
.template-deps-list-title { font-size: 15px; font-weight: 700; line-height: 1.35; color: var(--charcoal); }
.template-deps-list-phase { font-size: 12px; color: var(--gray-600); margin-top: 4px; }
.template-deps-list-prereq {
  font-size: 13px;
  line-height: 1.45;
  color: var(--charcoal);
  padding-top: 10px;
  border-top: 1px solid var(--gray-200);
}
.template-deps-list-prereq-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-600);
  margin-bottom: 6px;
}
.template-deps-list-dep { font-weight: 600; }
.template-deps-list-dep-title { font-weight: 500; color: var(--gray-600); }
.template-deps-list-dep-sep { color: var(--gray-400); font-weight: 400; }
.template-deps-list-prereq-none { color: var(--gray-600); font-style: italic; }
.template-dep-edge-remove {
  pointer-events: all;
}
.template-dep-edge-remove:hover {
  fill: rgba(44, 95, 138, 0.08);
  stroke: var(--steel-light);
}

/* ─── Gantt chart ────────────────────────────────────────────── */
.gantt-root {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: 16px 0;
  min-height: 200px;
}
.gantt-scroll {
  overflow: auto;
  max-height: calc(100vh - 210px);
  min-height: 200px;
}
.gantt-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  user-select: none;
}
.gantt-head-corner {
  position: sticky;
  left: 0;
  z-index: 11;
  flex-shrink: 0;
  width: 220px;
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
  display: flex;
  align-items: flex-end;
  padding: 4px 8px 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
}
/* Solid fill so day/month strips do not show scrolling task rows through any gap under sticky head */
.gantt-dates-wrap {
  position: relative;
  flex-shrink: 0;
  background: var(--gray-50);
}
.gantt-month-band {
  position: absolute;
  top: 0;
  height: 20px;
  display: flex;
  align-items: center;
  padding-left: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-600);
  border-right: 1px solid var(--gray-200);
  overflow: hidden;
  white-space: nowrap;
}
.gantt-day-cell {
  width: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--gray-400);
  border-right: 1px solid var(--gray-100);
}
.gantt-day-cell.is-today { color: var(--steel); font-weight: 700; }
.gantt-day-cell.is-weekend { background: var(--gray-50); }
.gantt-gap-marker {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-style: italic;
  color: var(--gray-400);
  border-left: 1px dashed var(--gray-300);
  border-right: 1px dashed var(--gray-300);
  background: repeating-linear-gradient(45deg, transparent, transparent 3px, var(--gray-50) 3px, var(--gray-50) 6px);
  cursor: default;
}
.gantt-gap-body-stripe {
  background: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(0,0,0,0.03) 4px, rgba(0,0,0,0.03) 8px);
  border-left: 1px dashed var(--gray-200);
  border-right: 1px dashed var(--gray-200);
}
.gantt-body { position: relative; }
.gantt-phase-row {
  display: flex;
  height: 28px;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
}
.gantt-phase-label {
  position: sticky;
  left: 0;
  z-index: 2;
  flex-shrink: 0;
  width: 220px;
  background: var(--gray-100);
  padding: 0 8px 0 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  border-right: 1px solid var(--gray-200);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.gantt-task-row {
  display: flex;
  height: 36px;
  border-bottom: 1px solid var(--gray-100);
}
.gantt-task-row:hover { background: var(--gray-50); }
.gantt-task-row:hover .gantt-row-label { background: var(--gray-50); }
.gantt-task-row.gantt-row-dragging { opacity: 0.4; }
.gantt-task-row.gantt-drag-over-top { border-top: 2px solid var(--steel); }
.gantt-task-row.gantt-drag-over-bottom { border-bottom: 2px solid var(--steel); }
.gantt-row-label {
  position: sticky;
  left: 0;
  z-index: 3;
  flex-shrink: 0;
  width: 220px;
  background: var(--white);
  padding: 0 8px 0 12px;
  font-size: 12px;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  border-right: 1px solid var(--gray-200);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: default;
}
.gantt-row-label-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gantt-row-grid { position: relative; flex-shrink: 0; }
.gantt-bar {
  position: absolute;
  top: 7px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  overflow: visible;
  color: var(--white);
  font-size: 10px;
  font-weight: 600;
  padding-left: 6px;
  white-space: nowrap;
  z-index: 2;
}
.gantt-bar:hover { filter: brightness(1.08); }
.gantt-bar-confirmed { outline: 2px solid rgba(0,0,0,0.35); outline-offset: -2px; }
.gantt-bar-lock { font-size: 9px; margin-right: 3px; pointer-events: none; flex-shrink: 0; }
.gantt-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  max-width: calc(100% - 18px);
}
.gantt-bar-label-out {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-700);
  white-space: nowrap;
  pointer-events: none;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 3;
}
.gantt-svg-layer {
  position: absolute;
  top: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}
.gantt-svg-hit {
  position: absolute;
  top: 0;
  overflow: visible;
  z-index: 2;
  pointer-events: none;
}
.gantt-unscheduled {
  font-size: 11px;
  color: var(--gray-400);
  font-style: italic;
  padding: 0 8px;
  line-height: 36px;
}
.gantt-empty {
  padding: 48px 24px;
  font-size: 14px;
  text-align: center;
}

/* ─── Project communications tab ─────────────────────────────── */
.communications-view { padding: 20px 8px 32px; }
.comm-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) 1fr minmax(220px, 280px);
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) {
  .comm-layout { grid-template-columns: 1fr; }
}
.comm-aside-title { font-size: 13px; font-weight: 700; margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-600); }
.comm-thread-search {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gray-100);
}
.comm-search-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--gray-600);
  min-width: 0;
}
.comm-search-label { font-weight: 600; color: var(--gray-600); }
.comm-search-input,
.comm-search-select {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  font: inherit;
  font-size: 13px;
  background: var(--white);
}
.comm-search-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.comm-search-clear { align-self: flex-start; }
.comm-thread-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; max-height: 52vh; overflow: auto; }
.comm-thread-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.comm-thread-btn:hover { border-color: var(--steel-light); background: var(--gray-50); }
.comm-thread-btn.active { outline: 2px solid var(--steel); outline-offset: 0; background: #f8fafc; }
.comm-thread-title { flex: 1 1 100%; font-weight: 600; color: var(--charcoal); }
.comm-sidebar-mt {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-100);
}
.comm-task-notes-thread-list { max-height: 40vh; }
.comm-unread-badge {
  font-size: 11px;
  font-weight: 700;
  background: #fee2e2;
  color: #991b1b;
  padding: 2px 8px;
  border-radius: 999px;
}
.comm-thread-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.comm-notes--files-only .comm-notes-section { margin-top: 0; padding-top: 0; border-top: none; }
.comm-thread-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.comm-thread-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.comm-messages {
  border: 1px solid var(--gray-100);
  border-radius: 12px;
  padding: 14px;
  background: var(--gray-50);
  min-height: 120px;
  max-height: min(52vh, 560px);
  overflow: auto;
}
.comm-msg { background: var(--white); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--gray-100); box-shadow: var(--shadow); }
.comm-msg:last-child { margin-bottom: 0; }
.comm-msg-head { margin-bottom: 8px; font-size: 14px; line-height: 1.35; }
.comm-msg-body { font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.comm-vis { font-size: 12px; margin-top: 8px; line-height: 1.4; }
.comm-msg-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.comm-msg-restricted,
.comm-msg-muted { font-size: 13px; padding: 12px; border-style: dashed; }
.comm-compose { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--gray-200); display: flex; flex-direction: column; gap: 10px; }
.comm-compose textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}
.comm-all-subs { font-size: 13px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.comm-extra-subs { font-size: 13px; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.comm-extra-subs .label { font-weight: 600; color: var(--gray-600); margin-right: 4px; }
.comm-sub-pick { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.comm-notes { border: 1px solid var(--gray-100); border-radius: 12px; padding: 14px 16px; background: var(--white); box-shadow: var(--shadow); }
.comm-notes-section--files {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-100);
}
.comm-notes-section-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(30vh, 320px);
  overflow: auto;
}
.comm-files-upload-row { margin-bottom: 12px; }
.comm-file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.comm-files-list { gap: 10px; }
.comm-file-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  line-height: 1.45;
}
.comm-file-row:last-child { border-bottom: none; padding-bottom: 0; }
.comm-file-meta { min-width: 0; flex: 1; }
.comm-file-name { font-weight: 600; text-align: left; padding: 0; max-width: 100%; word-break: break-word; }
.comm-file-sub { font-size: 12px; margin-top: 4px; line-height: 1.35; }
.comm-file-del { flex-shrink: 0; color: var(--red); text-decoration: none; }
.comm-file-del:hover { color: var(--red) !important; opacity: 0.75; }
.comm-task-notes-list { display: flex; flex-direction: column; gap: 12px; }
.comm-task-note { font-size: 13px; line-height: 1.45; padding-bottom: 10px; border-bottom: 1px solid var(--gray-100); }
.comm-task-note:last-child { border-bottom: none; padding-bottom: 0; }
.comment-item { position: relative; padding-right: 120px; }
.comment-item-actions { position: absolute; right: 0; top: 0; display: inline-flex; gap: 8px; }
.comment-item .btn-inline {
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--steel);
  cursor: pointer;
  text-decoration: underline;
}
.comment-item .btn-inline.comment-del { color: var(--red); }
.comment-item-editing { padding-right: 0; }
.task-comment-edit-area { width: 100%; box-sizing: border-box; margin-top: 6px; border-radius: 8px; border: 1px solid var(--gray-200); padding: 8px; font: inherit; }
.comment-item-edit-actions { margin-top: 8px; display: flex; gap: 8px; justify-content: flex-end; }

.comm-thread-visibility {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 14px 16px 16px;
  margin-bottom: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.comm-thread-vis-legend {
  font-size: 15px;
  font-weight: 700;
  padding: 0 4px;
  color: var(--charcoal);
}
.comm-thread-vis-lead { font-size: 13px; margin: 4px 0 12px; line-height: 1.45; }
.comm-thread-history-warning {
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--warning-bg);
  border: 1px solid var(--amber);
  color: var(--charcoal);
}
.comm-thread-vis-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; cursor: pointer; margin-bottom: 12px; }
.comm-thread-vis-row input { margin-top: 3px; flex-shrink: 0; }
.comm-thread-pick-block { margin-bottom: 12px; }
.comm-thread-pick-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-600);
  margin-bottom: 6px;
}
.comm-thread-pick-hint { font-size: 12px; margin: 0 0 10px; line-height: 1.45; }
.comm-thread-pick-list { display: flex; flex-direction: column; gap: 8px; }

/* ─── Team View ─────────────────────────────────────────────── */
.team-view { padding: 28px 32px; }
.team-invite-block { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.project-invite-email-lead { margin-bottom: 4px; }
.project-invite-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.project-invite-link-wrap { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--gray-200); }
.project-invite-link-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-600); margin-bottom: 6px; }
.project-invite-role-select {
  font-size: 12px;
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--charcoal);
  flex-shrink: 0;
}
.project-invite-link-input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--charcoal);
}
.team-card-actions { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--gray-100); display: flex; flex-wrap: wrap; gap: 8px; }
.team-card-remove { color: var(--red) !important; }
.team-card-cancel { color: var(--red) !important; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
.team-card { background: var(--white); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.team-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.team-card h3 { font-size: 16px; font-weight: 700; }
.team-card-header .badge { font-size: 9px; padding: 2px 7px; letter-spacing: 0.5px; }
.team-tasks-list { margin-top: 10px; }
.team-tasks-dropzone {
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--gray-100);
  padding: 4px 10px;
  background: var(--gray-50);
}
.team-tasks-empty { font-size: 12px; padding: 12px 0; text-align: center; }
.team-task-item {
  font-size: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-700);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.team-task-item:last-child { border-bottom: none; }
.team-task-item-title { flex: 1; min-width: 0; font-weight: 500; color: var(--charcoal); }
.team-task-item-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.team-task-item[draggable="true"],
.team-task-item[data-task-id]:not([draggable="true"]) { cursor: grab; }
.team-task-item[draggable="true"]:active,
.team-task-item[data-task-id]:not([draggable="true"]):active { cursor: grabbing; }
.team-task-dragging { opacity: 0.45; }
.team-card-drag-over { outline: 2px solid var(--steel); outline-offset: 2px; border-radius: 12px; }
.team-trade-assign { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--gray-100); }
.team-trade-assign-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-600); margin-bottom: 6px; }
.team-trade-assign-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.team-trade-select { flex: 1; min-width: 140px; font-size: 13px; padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: 6px; background: var(--white); color: var(--charcoal); }
.team-trade-assign-hint { font-size: 11px; margin-top: 10px; line-height: 1.4; }
.team-task-trade { font-size: 10px; }

/* ─── Modal ─────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
#modal-overlay.hidden { display: none; }

.modal {
  background: var(--white); border-radius: 16px; padding: 32px;
  width: 540px; max-width: calc(100vw - 40px); max-height: calc(100vh - 80px);
  overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-wide { width: 680px; }
.admin-email-preview-modal.modal-wide {
  width: min(920px, 96vw);
}
.admin-email-preview-frame {
  display: block;
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
}
.modal h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.tpl-preview-warning { background: var(--warning-bg); border: 1px solid var(--amber); border-radius: 6px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }
.tpl-preview-table-wrap { max-height: 340px; overflow-y: auto; border: 1px solid var(--border, #e0e0e0); border-radius: 6px; margin-bottom: 16px; }
.tpl-preview-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tpl-preview-table th { text-align: left; padding: 7px 10px; background: var(--surface-2, #f5f5f5); font-weight: 600; position: sticky; top: 0; }
.tpl-preview-table td { padding: 5px 10px; border-top: 1px solid var(--border, #e0e0e0); }
.tpl-preview-phase-row td { background: var(--surface-2, #f5f5f5); padding: 6px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #666); }
.confirm-modal-body {
  margin: 0 0 8px;
  line-height: 1.45;
  font-size: 14px;
  color: var(--charcoal);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ─── Calendar Status Panel (open task modal) ─────────────────────────── */
.task-calendar-status {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  border-left: 4px solid #757575;
}
.task-calendar-status--red { border-left-color: #C62828; background: #FDEDEC; border-color: #f1c5c0; }
.task-calendar-status--yellow { border-left-color: #F57F17; background: #FFF8E1; border-color: #f0d896; }
.task-calendar-status--green { border-left-color: #2E7D32; background: #E8F5E9; border-color: #b6dcb8; }
.task-calendar-status--gray { border-left-color: #757575; background: #f1f3f5; border-color: #d6dadd; }
.task-calendar-status-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--charcoal);
  margin-bottom: 8px;
}
.task-calendar-status-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.task-calendar-status-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--charcoal);
}
.task-calendar-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  margin-top: 4px;
  background: #757575;
}
.task-calendar-status-dot--red { background: #C62828; }
.task-calendar-status-dot--yellow { background: #F57F17; }
.task-calendar-status-dot--green { background: #2E7D32; }
.task-calendar-status-dot--gray { background: #757575; }

/* ─── Read-only Task Details Modal (non-owners) ───────────────────────── */
.task-view-modal h2 { margin-bottom: 12px; }
.task-view-grid { display: flex; flex-direction: column; gap: 16px; }
.task-view-readonly-tag {
  margin: 0; padding: 10px 14px; font-size: 13px; line-height: 1.45;
  background: var(--surface-2, #f5f5f5);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  color: var(--text-muted, #555);
}
.task-view-readonly-tag strong { color: var(--charcoal); }
.task-view-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.task-view-row-meta { grid-template-columns: 1fr; }
.task-view-field { display: flex; flex-direction: column; gap: 4px; }
.task-view-section { display: flex; flex-direction: column; gap: 6px; }
.task-view-label {
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-muted, #666);
}
.task-view-value { font-size: 14px; color: var(--charcoal); }
.task-view-confirmed-tag {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
  background: var(--success-bg, #e6f4ea); color: var(--green, #1e7e34);
  font-size: 11px; font-weight: 600;
}
.task-view-meta-pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2, #f5f5f5); color: var(--text-muted, #555);
  font-size: 12px;
}
.task-view-desc {
  margin: 0; font-size: 14px; line-height: 1.5; color: var(--charcoal);
  white-space: pre-wrap;
}
.task-view-empty { margin: 0; font-size: 13px; }
.task-view-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.task-view-dep {
  font-size: 13px; color: var(--charcoal); display: flex; align-items: center; gap: 6px;
  padding: 4px 0;
}
.task-view-dep-icon { font-size: 13px; }
.task-view-dep-done { color: var(--text-muted, #555); }
.task-view-comments { display: flex; flex-direction: column; gap: 6px; }
.task-view-comment {
  font-size: 13px; line-height: 1.45; color: var(--charcoal);
  padding: 6px 10px; background: var(--surface-2, #f7f7f7); border-radius: 6px;
}
.task-view-comment-edited { font-size: 11px; }
@media (max-width: 600px) {
  .task-view-row { grid-template-columns: 1fr; }
}

/* ─── Toast ─────────────────────────────────────────────────── */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); color: var(--white); min-width: 240px;
  animation: slideIn 0.2s ease; display: flex; align-items: center; gap: 8px;
}
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--steel); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
.toast.removing { animation: slideOut 0.2s ease forwards; }

/* ─── Loading ───────────────────────────────────────────────── */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--gray-200); border-top-color: var(--steel); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 60px; }

/* ─── Misc ──────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--gray-200); margin: 20px 0; }
.text-muted { color: var(--gray-400); font-size: 13px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.no-coords-notice { background: #FEF9E7; border: 1px solid var(--amber); border-radius: 8px; padding: 16px; font-size: 14px; color: var(--charcoal); }
.no-coords-notice strong { display: block; margin-bottom: 4px; }

/* Task form - prerequisite search-ahead */
.tf-dep-search-wrap,
.tf-trade-search-wrap { position: relative; }
.tf-dep-search {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--gray-200); border-radius: var(--radius);
  font-size: 14px; background: var(--white);
}
.tf-dep-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px;
  max-height: 220px; overflow-y: auto; background: var(--white); border: 1.5px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
/* Task trade picker: moved under #modal-overlay so it is not clipped by .modal overflow-y */
.tf-dep-results.tf-trade-results-fixed {
  position: fixed;
  left: 0;
  top: 0;
  right: auto;
  margin-top: 0;
  z-index: 120;
  max-height: min(220px, 42dvh);
}
.tf-dep-results.hidden { display: none; }
.tf-dep-result {
  display: block; width: 100%; text-align: left; padding: 10px 12px; font-size: 13px;
  border: none; background: transparent; cursor: pointer; color: var(--charcoal);
  border-bottom: 1px solid var(--gray-100);
}
.tf-dep-result:last-child { border-bottom: none; }
.tf-dep-result:hover { background: var(--gray-50); }
.tf-dep-result-empty { padding: 12px; font-size: 13px; color: var(--gray-400); }
.tf-trade-save-hint {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-200);
  font-size: 12px;
  line-height: 1.45;
  color: var(--gray-600);
}
.tf-trade-field-hint { margin-top: 6px; max-width: 42em; }
.tf-dep-selected { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; min-height: 28px; align-items: center; }
.tf-dep-empty { font-size: 13px; }
.tf-dep-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 10px;
  background: #EBF5FB; color: var(--steel-dim); border-radius: 6px; font-size: 12px; font-weight: 600;
}
.tf-dep-chip-remove {
  border: none; background: transparent; cursor: pointer; font-size: 16px; line-height: 1;
  color: var(--gray-600); padding: 0 2px; border-radius: 4px;
}
.tf-dep-chip-remove:hover { color: var(--red); background: rgba(229, 57, 53, 0.08); }

/* legacy multi-select (templates etc.) */
.multi-select { border: 1.5px solid var(--gray-200); border-radius: var(--radius); max-height: 140px; overflow-y: auto; }
.multi-select-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.multi-select-item:hover { background: var(--gray-50); }
.multi-select-item input { width: 14px; height: 14px; accent-color: var(--steel); }

.back-btn { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-400); cursor: pointer; padding: 10px 20px; border-bottom: 1px solid var(--charcoal-3); transition: color 0.15s; }
.back-btn:hover { color: var(--amber); }

/* ─── Mobile & touch ─────────────────────────────────────────── */
.mobile-shell-header,
.mobile-sidebar-backdrop {
  display: none;
}

@media (max-width: 880px) {
  :root {
    /* Sticky tab bar offset = safe area + shell header (menu + title row) */
    --rivet-mobile-header-h: calc(max(10px, env(safe-area-inset-top, 0px)) + 52px);
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--rivet-mobile-header-h) + 8px);
  }

  #app {
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: 100svh;
    min-height: -webkit-fill-available;
  }

  /*
    Logged-in shell only (#main-content): pin the viewport to #app and scroll inside <main>.
    Otherwise iOS often splits gestures between document scroll and flex children — one-finger
    vertical swipes feel dead until pinch/zoom changes the scroll root.
    Auth and marketing pages have no #main-content; they keep normal document scroll.
  */
  html:has(#main-content),
  body:has(#main-content) {
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
  }

  #app:has(#main-content) {
    height: 100%;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  /* Drawer closed: do not let off-canvas nav intercept taps on the main column */
  .sidebar {
    pointer-events: none;
  }
  #app.mobile-nav-open .sidebar {
    pointer-events: auto;
  }

  .main-content {
    position: relative;
    z-index: 1;
    isolation: isolate;
    width: 100%;
    min-width: 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
    /* Bottom safe area when scrolling short pages */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
  }

  .mobile-shell-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
    background: var(--charcoal);
    border-bottom: 1px solid var(--charcoal-3);
    position: sticky;
    top: 0;
    z-index: 35;
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin: -6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--charcoal-2);
    color: var(--white);
    font-size: 20px;
    line-height: 1;
    border: 1px solid var(--charcoal-3);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-menu-btn:active {
    background: var(--charcoal-3);
  }

  .mobile-shell-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--amber);
    letter-spacing: -0.3px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 40;
    -webkit-tap-highlight-color: transparent;
  }

  #app.mobile-nav-open .mobile-sidebar-backdrop {
    display: block;
    pointer-events: auto;
    touch-action: none;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(300px, calc(100vw - 48px));
    max-width: 100%;
    height: 100vh; /* fallback for browsers without dvh */
    height: 100dvh;
    max-height: 100dvh;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  #app.mobile-nav-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content {
    width: 100%;
    min-width: 0;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
  }

  .page-header h2 {
    font-size: 20px;
  }

  .page-header-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  /* Keep tab intro titles flush with panel padding (do not inherit mobile .page-header padding). */
  .page-header.page-header--tab-intro {
    padding: 0 0 14px;
  }

  .dashboard-body,
  .weather-view,
  .calendar-view,
  .verification-view,
  .team-view {
    padding: 16px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left));
  }

  .site-history-page,
  .schedule-page,
  .subscription-page,
  .templates-page,
  .templates-editor {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .tab-bar {
    position: sticky;
    top: var(--rivet-mobile-header-h);
    z-index: 30;
    padding: 0 max(12px, env(safe-area-inset-left)) 0 max(12px, env(safe-area-inset-right));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 0;
    flex-wrap: nowrap;
    background: var(--white);
    box-shadow: 0 1px 0 var(--gray-200);
    touch-action: pan-x pan-y;
  }

  .tab {
    flex-shrink: 0;
    padding: 14px 16px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .address-lookup-row {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-card {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 28px max(24px, env(safe-area-inset-left)) 32px max(24px, env(safe-area-inset-right));
  }

  .auth-wrapper {
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* Single vertical scroll on .main-content (reachable job header); tasks list grows with content */
  .main-content > .tasks-layout {
    flex: 0 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .tasks-layout {
    flex-direction: column;
    min-height: 0;
    overflow: visible;
  }

  .phases-panel {
    width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
    overflow: visible;
  }

  .phases-panel-header {
    padding: 12px 14px;
    position: static;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    box-shadow: none;
  }

  /* Phase chips share row width equally; horizontal scroll only if many phases hit min-width */
  .phases-panel,
  .phases-panel-body {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .phases-panel-body {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    padding: 10px max(10px, env(safe-area-inset-left)) 12px max(10px, env(safe-area-inset-right));
    overflow-x: auto;
    overflow-y: hidden;
    flex: none;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    /* Let vertical swipes chain to <main> scroll; avoids iOS treating this row as horizontal-only */
    touch-action: pan-x pan-y;
  }

  .phases-panel .phase-order-list {
    display: contents;
  }

  .phases-panel-body > .phase-item {
    flex: 0 0 auto;
    min-width: 76px;
    max-width: none;
    padding: 10px 8px;
    min-height: 0;
    border-radius: 10px;
    border: 1px solid var(--gray-200);
    border-left: 3px solid transparent;
    background: var(--white);
    box-shadow: var(--shadow);
  }

  .phases-panel-body > .phase-item.active {
    background: #EBF5FB;
    border-left-color: var(--steel);
    border-color: rgba(44, 95, 138, 0.22);
  }

  .tasks-panel {
    flex: 0 1 auto;
    min-height: 0;
    overflow: visible;
    padding: 14px max(14px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    touch-action: pan-y;
  }

  .task-card-header {
    flex-wrap: wrap;
  }

  .task-card-actions,
  .task-card-actions-readonly {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
    margin-top: 6px;
  }

  .calendar-nav-month {
    font-size: 16px;
  }

  .calendar-nav-prev,
  .calendar-nav-next {
    padding-left: 10px;
    padding-right: 10px;
  }

  .calendar-grid {
    overflow-x: hidden;
    border-radius: var(--radius);
  }

  .calendar-cell {
    min-height: 72px;
    padding: 4px 2px;
  }

  .cell-date {
    font-size: 11px;
  }

  .calendar-task-pill {
    font-size: 9px;
    padding: 2px 4px;
  }

  .weather-grid {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }

  .weather-task-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .modal {
    width: 100%;
    max-width: min(540px, calc(100vw - 24px));
    max-height: min(90vh, calc(100vh - 24px));
    max-height: min(90dvh, calc(100dvh - 24px));
    padding: 22px max(18px, env(safe-area-inset-right)) 24px max(18px, env(safe-area-inset-left));
    margin: max(12px, env(safe-area-inset-top)) auto max(12px, env(safe-area-inset-bottom));
    border-radius: 14px;
  }

  .modal-wide {
    width: 100%;
    max-width: calc(100vw - 24px);
  }

  .modal-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .modal-actions .btn {
    flex: 1 1 auto;
    min-width: 120px;
    justify-content: center;
  }

  #toast-container {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    align-items: stretch;
  }

  .toast {
    min-width: 0;
    width: 100%;
    justify-content: center;
    text-align: center;
    animation: toastSlideInUp 0.2s ease;
  }

  .toast.removing {
    animation: toastSlideOutDown 0.2s ease forwards;
  }

  .nav-item {
    min-height: 44px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .sidebar-alerts {
    min-height: 44px;
  }

  .btn {
    min-height: 40px;
    padding: 10px 16px;
    -webkit-tap-highlight-color: transparent;
  }

  .btn-sm {
    min-height: 36px;
  }

  .template-grid,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .template-deps-canvas-wrap {
    min-height: 280px;
  }

  .template-deps-viewport {
    min-height: 260px;
  }

  .company-roster-table th,
  .company-roster-table td,
  .verification-table th,
  .verification-table td,
  .template-task-table th,
  .template-task-table td {
    padding: 10px 8px;
    font-size: 12px;
  }

  .schedule-feed-url-row,
  .project-invite-row {
    flex-direction: column;
    align-items: stretch;
  }

  .schedule-feed-input,
  .schedule-feed-url-masked,
  .project-invite-link-input {
    min-width: 0;
    width: 100%;
  }

  .comment-form {
    flex-direction: column;
    align-items: stretch;
  }

  .comment-form button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .my-tasks-filter-label {
    white-space: normal;
    max-width: 100%;
    font-size: 12px;
    line-height: 1.3;
  }

  .page-header h2 {
    font-size: 18px;
  }

  .project-card,
  .new-project-card {
    padding: 18px;
  }

  .task-card {
    padding: 14px;
  }

  .billing-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─── Marketing landing (/) ─────────────────────────────────── */
/* Same full-viewport treatment as .auth-wrapper: charcoal + stripe pattern; content lives in .landing-sheet */
.landing-page {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
  background: var(--charcoal);
  background-image: repeating-linear-gradient(
    45deg, transparent, transparent 40px, rgba(255, 255, 255, 0.02) 40px, rgba(255, 255, 255, 0.02) 80px
  );
  color: var(--charcoal);
}

.landing-sheet {
  width: 100%;
  max-width: 920px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
}
.landing-brand { margin: 0; }
.landing-brand-btn {
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--amber);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 0;
}
.landing-brand-btn:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
}
.landing-nav-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.landing-hero {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  text-align: center;
}
.landing-tagline {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--steel);
  margin: 0 0 14px;
}
.landing-headline {
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  color: var(--charcoal);
}
.landing-elevator {
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--gray-600);
  margin: 0 0 28px;
  max-width: 56ch;
  margin-left: auto;
  margin-right: auto;
}
.landing-elevator strong { color: var(--charcoal); font-weight: 600; }
.landing-elevator--tight {
  margin-bottom: 20px;
}
.landing-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.landing-section {
  padding: 32px 24px 40px;
}
.landing-section h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 18px;
  text-align: center;
  color: var(--charcoal);
}
.landing-why {
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.landing-benefits {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}
.landing-benefits li {
  padding: 16px 18px;
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-600);
}
.landing-benefits strong { color: var(--charcoal); font-weight: 700; }

.landing-pricing {
  border-top: 1px solid var(--gray-200);
  background: var(--white);
}
.landing-pricing-intro {
  text-align: center;
  font-size: 14px;
  line-height: 1.55;
  max-width: 48rem;
  margin: 0 auto 28px;
}
.landing-price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.landing-price-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 20px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.landing-price-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  color: var(--charcoal);
}
.landing-price-card--featured {
  border-color: var(--steel);
  box-shadow: 0 0 0 1px rgba(44, 95, 138, 0.2);
}
.landing-price-popular {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--steel);
}
.landing-price-amount {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 8px 0 4px;
  color: var(--charcoal);
}
.landing-price-unit { font-size: 0.95rem; font-weight: 600; color: var(--gray-600); }
.landing-price-custom { font-size: 1.35rem; }
.landing-price-cap { font-size: 13px; font-weight: 600; color: var(--steel); margin: 0; }
.landing-price-note { font-size: 12px; margin: 0; line-height: 1.4; }
.landing-pricing-footnote {
  font-size: 12px;
  text-align: center;
  max-width: 40rem;
  margin: 0 auto;
  line-height: 1.45;
}

.landing-cta-block {
  text-align: center;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  padding-bottom: 48px;
}
.landing-cta-block h2 { margin-bottom: 10px; }
.landing-cta-block > .text-muted { margin: 0 0 22px; font-size: 14px; }

.landing-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  justify-content: center;
  padding: 22px 24px 26px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  font-size: 13px;
}
.landing-footer-brand { font-weight: 800; color: var(--amber); }

@media (max-width: 520px) {
  .landing-price-grid {
    grid-template-columns: 1fr;
  }
  .landing-page {
    justify-content: flex-start;
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .landing-sheet {
    border-radius: 12px;
  }
}

@keyframes toastSlideInUp {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toastSlideOutDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(12px);
    opacity: 0;
  }
}
