/* ALA final refinement. Presentation only; component order and handlers unchanged.
   Intrinsic sizes, shared spacing tokens and one alignment axis per region. */

/* Team: identical cell rhythm; status remains a badge, configuration an action. */
html[data-ala-theme][data-ala-theme] #team#team :is(th,td):last-child {
  text-align:center!important;vertical-align:middle!important;
  padding:var(--ala-space-8) var(--ala-space-16)!important;
}
html[data-ala-theme][data-ala-theme] #team#team .team-access-actions {
  display:flex;align-items:center;justify-content:center;
  min-height:var(--ala-control-height);gap:var(--ala-space-8);width:100%;
}
html[data-ala-theme][data-ala-theme] #team#team .team-access-label {
  justify-content:center;min-height:var(--ala-space-32);box-sizing:border-box;
  padding:var(--ala-space-4) var(--ala-space-12)!important;
}
html[data-ala-theme][data-ala-theme] #team#team tbody td {
  padding-top:var(--ala-space-8)!important;padding-bottom:var(--ala-space-8)!important;
  vertical-align:middle!important;
}

/* Consistent heading rhythm on the migrated list surfaces. */
html[data-ala-theme][data-ala-theme] :is(#team#team,#audit#audit,#leads#leads,#tasks#tasks) > .hero,
html[data-ala-theme][data-ala-theme] #pipeline#pipeline .opp-hero,
html[data-ala-theme][data-ala-theme] #properties#properties .properties-hero {
  margin-bottom:var(--ala-space-16)!important;gap:var(--ala-space-16)!important;
}
html[data-ala-theme][data-ala-theme] :is(#team#team,#audit#audit) .hero h2 {
  margin-bottom:var(--ala-space-4)!important;
}

/* Filter grids: intrinsic captions, common control baseline and full final cell. */
html[data-ala-theme][data-ala-theme] #tasks#tasks .task-filters {
  padding:var(--ala-space-12)!important;gap:var(--ala-space-8) var(--ala-space-12)!important;
}
html[data-ala-theme][data-ala-theme] #tasks#tasks .task-filters > .btn {
  width:100%!important;justify-self:stretch!important;align-self:end!important;
}
html[data-ala-theme][data-ala-theme] #tasks#tasks .task-filters label {
  font-size:var(--ala-type-caption-size)!important;line-height:var(--ala-type-caption-line)!important;
  margin-bottom:var(--ala-space-4)!important;min-height:0!important;
}
html[data-ala-theme][data-ala-theme] #tasks#tasks .task-summary-item {
  padding:var(--ala-space-8) var(--ala-space-12)!important;
}
html[data-ala-theme][data-ala-theme] #audit#audit[data-ala-phase6] .audit-filters {
  padding:var(--ala-space-12)!important;gap:var(--ala-space-8) var(--ala-space-12)!important;
}
html[data-ala-theme][data-ala-theme] #audit#audit[data-ala-phase6] .audit-filters label {
  margin:0!important;gap:var(--ala-space-4)!important;
}
html[data-ala-theme][data-ala-theme] #audit#audit[data-ala-phase6] tbody td {
  padding-top:var(--ala-space-8)!important;padding-bottom:var(--ala-space-8)!important;
}

/* Contact row density, keeping all text and the existing accessible row actions. */
html[data-ala-theme][data-ala-theme] #leads#leads tbody td {
  padding-top:var(--ala-space-8)!important;padding-bottom:var(--ala-space-8)!important;
}

/* Dashboard: same sequence, chart sizes and data; remove accumulated spacing. */
html[data-ala-theme][data-ala-theme] #control#control #ctlFunnel .ceo-funnel-step {
  grid-template-columns:minmax(0,1fr) auto!important;
  grid-template-rows:auto auto!important;gap:0 var(--ala-space-12)!important;
  padding:var(--ala-space-8) var(--ala-space-12)!important;
  min-height:var(--ala-control-height)!important;align-items:center!important;
}
html[data-ala-theme][data-ala-theme] #control#control #ctlFunnel .stage-value {
  grid-column:2;grid-row:1 / span 2;align-self:center;
}
html[data-ala-theme][data-ala-theme] #control#control #ctlFunnel .stage-conv {
  grid-column:1!important;grid-row:2;
}
html[data-ala-theme][data-ala-theme] #control#control .cohort-origin {
  gap:var(--ala-space-4) var(--ala-space-8)!important;
}
html[data-ala-theme][data-ala-theme] #control#control #ctlEfficiency .ceo-micro {
  gap:var(--ala-space-4)!important;justify-content:flex-start!important;min-height:0!important;
}
html[data-ala-theme][data-ala-theme] #control#control #ctlEfficiency .ceo-micro :is(b,small) {
  margin:0!important;
}
html[data-ala-theme][data-ala-theme] #control#control .commercial-insight {
  padding:var(--ala-space-8) 0!important;gap:var(--ala-space-12)!important;
}
html[data-ala-theme][data-ala-theme] #control#control .health-icon {
  width:var(--ala-space-32)!important;height:var(--ala-space-32)!important;
  flex:0 0 var(--ala-space-32)!important;
}
html[data-ala-theme][data-ala-theme] #control#control #ctlAlerts {
  display:grid;gap:var(--ala-space-4);
}

/* Property content: balanced internal rhythm without shrinking project imagery. */
html[data-ala-theme][data-ala-theme] #properties#properties .property-card-body {
  padding:var(--ala-space-12)!important;gap:var(--ala-space-8)!important;
}
html[data-ala-theme][data-ala-theme] #propertyModal#propertyModal .property-alternative-plan {
  margin-top:var(--ala-space-8)!important;padding-top:var(--ala-space-8)!important;
}

/* Shared modal controls retain a single intrinsic axis, never absolute offsets. */
html[data-ala-theme][data-ala-theme] :is(#leadModal#leadModal,#taskModal#taskModal,#completeTaskModal#completeTaskModal,#sellerModal#sellerModal,#permissionsModal#permissionsModal,#pwModal#pwModal) .ux-window-footer {
  gap:var(--ala-space-8)!important;align-items:center!important;
}
@media(max-width:600px) {
  html[data-ala-theme][data-ala-theme] #control#control .cohort-origin {
    grid-template-columns:minmax(0,1fr) auto!important;
  }
}

/* Small-screen contact actions keep their existing order and share available space. */
@media(max-width:600px) {
  html[data-ala-theme][data-ala-theme] #leadModal#leadModal .ux-window-footer > button:not([hidden]) {
    flex:1 1 auto!important; margin-left:0!important; margin-right:0!important;
  }
  html[data-ala-theme][data-ala-theme] #leadModal#leadModal .ux-window-footer > .btn.primary {
    flex-basis:100%!important;
  }
}

/* Agenda detail uses the same semantic tokens as the inline Foco rows. */
html[data-ala-theme][data-ala-theme] #focusDialog .focus-meta {
  display:flex;align-items:baseline;justify-content:space-between;
  flex-wrap:wrap;gap:var(--ala-space-4) var(--ala-space-12);
}
html[data-ala-theme][data-ala-theme] #focusDialog .focus-meta time {
  color:var(--ala-text-secondary)!important;
}
html[data-ala-theme][data-ala-theme] #focusDialog .focus-meta > span {
  color:var(--ala-warning)!important;
}

/* A horizontal flex-basis must not become 320px of height when the hero stacks. */
html[data-ala-theme][data-ala-theme] #pipeline#pipeline .opp-hero-actions {
  flex:0 1 auto!important;min-height:0!important;height:auto!important;
  align-content:flex-start!important;
}
@media(max-width:1100px) {
  html[data-ala-theme][data-ala-theme] #pipeline#pipeline .opp-hero {
    align-items:flex-start!important;
  }
}
/* Fit the five-column team table on notebook/tablet; mobile scrolling stays local. */
html[data-ala-theme][data-ala-theme] #team#team table {
  min-width:680px!important;
}

html[data-ala-theme][data-ala-theme] #focusDialog .urgent .focus-meta > span {color:var(--ala-error)!important;}
html[data-ala-theme][data-ala-theme] #focusDialog .resume .focus-meta > span {color:var(--ala-info)!important;}
/* Use the existing legend region at wide widths; DOM/read order and donut size stay intact. */
@media(min-width:1101px) {
  html[data-ala-theme][data-ala-theme] #control#control #ctlStageChart .legend {
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    gap:var(--ala-space-4) var(--ala-space-16);flex:1;min-width:0;
  }
}
