/* Module: sections 07-10 of automation 08 (AI Inbox Assistant): #features, #dashboard, #stack and
   #industries. Mirrors automation 03's sections. Every rule is scoped under its section id; every
   class invented here starts with ia-. Shared frames (features.css, dashboard.css) and tokens
   (site.css) come from the page. */

/* ---------- 07 / Features: every title reserves two lines, so each body starts on the same y ---------- */

#features .features-tile .cell-t {
  min-height: 2.3em;
  max-width: 14ch;
  text-wrap: pretty;
}

#features .features-tile .cell-p {
  text-wrap: pretty;
}

@media (min-width: 1280px) {
  #features .features-tile .cell-t {
    max-width: 20ch;
  }
}

/* ---------- 08 / Dashboard: window body (rail | main) ---------- */

#dashboard .ia-dash-body {
  display: block;
}

@media (min-width: 1280px) {
  #dashboard .ia-dash-body {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
  }
}

#dashboard .ia-dash-main {
  min-width: 0;
}

/* The rail is 200px: each nav label stays on one line ('Approval queue', 'Labels and routing') */
#dashboard .ia-dash .dashboard-nav-item {
  height: auto;
  min-height: 36px;
  padding: 8px 10px;
  line-height: 1.45;
  white-space: nowrap;
}

#dashboard .ia-dash .dashboard-rail-name b {
  white-space: normal;
  line-height: 1.25;
}

#dashboard .ia-dash .dashboard-nav {
  min-width: 0;
}

/* Labels and sub-lines wrap rather than truncate: the cards are narrow at 1024 and 390 */
#dashboard .ia-dash .dashboard-stat-l,
#dashboard .ia-dash .dashboard-stat-s,
#dashboard .ia-dash .dashboard-meta {
  white-space: normal;
  text-overflow: clip;
}

#dashboard .ia-dash .dashboard-stat-l {
  text-wrap: balance;
}

/* The window title may wrap on phones instead of being cut off */
#dashboard .ia-dash .dashboard-bar-title {
  white-space: normal;
  line-height: 1.4;
}

@media (max-width: 639px) {
  #dashboard .ia-dash .dashboard-bar {
    height: auto;
    min-height: 40px;
    padding-block: 10px;
  }
}

/* The footer keeps "Synced from info@" on phones too */
#dashboard .ia-dash .dashboard-foot-sync {
  display: inline;
}

/* ---------- Panels: volume and reply time side by side from 1024, log below ---------- */

#dashboard .ia-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

#dashboard .ia-panel {
  min-width: 0;
}

#dashboard .ia-columns > .ia-panel + .ia-panel {
  border-top: 1px solid var(--line);
}

#dashboard .ia-panel-log {
  border-top: 1px solid var(--line);
}

#dashboard .ia-panel .dashboard-toolbar {
  flex-wrap: wrap;
}

@media (min-width: 1024px) {
  #dashboard .ia-columns {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }

  #dashboard .ia-panel-vol {
    border-right: 1px solid var(--line);
  }

  #dashboard .ia-columns > .ia-panel-reply {
    border-top: 0;
  }
}

/* ---------- Volume by type: stacked columns ---------- */

#dashboard .ia-chart {
  padding: 0 20px 20px;
}

#dashboard .ia-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

#dashboard .ia-legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--ash);
}

#dashboard .ia-sw {
  display: block;
  width: 8px;
  height: 8px;
  flex: none;
}

#dashboard .ia-plot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 232px;
  padding: 0 4px;
  border-bottom: 1px solid var(--line);
}

#dashboard .ia-col {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  min-width: 22px;
  max-width: 34px;
  height: 100%;
}

#dashboard .ia-col-total {
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 14px;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--bone-70);
  font-variant-numeric: tabular-nums;
}

#dashboard .ia-stack {
  display: flex;
  flex-direction: column;
  transform-origin: 50% 100%;
}

#dashboard .ia-seg {
  display: block;
  flex: none;
  box-sizing: border-box;
}

#dashboard .ia-seg--top {
  border-radius: 4px 4px 0 0;
}

#dashboard .ia-seg--sep {
  border-bottom: 2px solid var(--surface);
}

#dashboard .ia-days {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 4px 0;
}

#dashboard .ia-day {
  flex: 1 1 0;
  min-width: 22px;
  max-width: 34px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--ash);
}

#dashboard .ia-day--now {
  color: var(--bone);
}

#dashboard .ia-day small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ash);
  white-space: nowrap;
}

/* Columns grow once when the window is seen (script adds ia-dash--play) */
#dashboard .ia-dash--play .ia-stack {
  animation: ia-grow-y 0.9s var(--ease-out) both;
  animation-delay: var(--d, 0s);
}

@keyframes ia-grow-y {
  from {
    transform: scaleY(0);
  }

  to {
    transform: scaleY(1);
  }
}

/* ---------- Time to first reply: bars ---------- */

#dashboard .ia-panel-reply {
  display: flex;
  flex-direction: column;
}

#dashboard .ia-bars {
  display: grid;
  flex: 1 1 auto;
  align-content: space-evenly;
  gap: 22px;
  margin: 0;
  padding: 0 20px 20px;
  list-style: none;
}

#dashboard .ia-bar-row {
  display: grid;
  gap: 8px;
  min-width: 0;
}

#dashboard .ia-bar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

#dashboard .ia-bar-name {
  min-width: 0;
  font-size: 15px;
  line-height: 1.3;
  color: var(--bone);
}

#dashboard .ia-bar-val {
  flex: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--ash);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#dashboard .ia-bar-track {
  display: block;
  height: 4px;
  background: var(--line);
}

#dashboard .ia-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: hsl(42 30% 94% / 0.22);
  transform-origin: left center;
}

#dashboard .ia-bar-fill--gold {
  background: var(--accent);
}

#dashboard .ia-dash--play .ia-bar-fill {
  animation: ia-grow-x 0.9s var(--ease-out) both;
  animation-delay: var(--d, 0s);
}

@keyframes ia-grow-x {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

/* ---------- Approval log: table ---------- */

#dashboard .ia-tablewrap {
  overflow-x: auto;
}

#dashboard .ia-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#dashboard .ia-table th {
  height: 36px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ash);
  white-space: nowrap;
}

#dashboard .ia-table td {
  height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
  color: var(--bone-80);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#dashboard .ia-table th:first-child,
#dashboard .ia-table td:first-child {
  padding-left: 20px;
}

#dashboard .ia-table th:last-child,
#dashboard .ia-table td:last-child {
  padding-right: 20px;
}

#dashboard .ia-table th:nth-child(1) { width: 15%; }
#dashboard .ia-table th:nth-child(2) { width: 29%; }
#dashboard .ia-table th:nth-child(3) { width: 19%; }
#dashboard .ia-table th:nth-child(4) { width: 24%; }
#dashboard .ia-table th:nth-child(5) { width: 13%; }

#dashboard .ia-table tbody tr:last-child td {
  border-bottom: 0;
}

#dashboard .ia-table tbody tr {
  transition: background-color 0.2s var(--ease-std);
}

#dashboard .ia-table tbody tr:hover {
  background: var(--elev);
}

#dashboard .ia-when {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--ash);
  font-variant-numeric: tabular-nums;
}

#dashboard .ia-email {
  min-width: 0;
  color: var(--bone);
}

#dashboard .ia-type {
  white-space: normal;
}

#dashboard .ia-type .ia-chip + .ia-chip {
  margin-left: 6px;
}

#dashboard .ia-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px 1px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ia-c, var(--bone-70));
  border-color: color-mix(in srgb, var(--ia-c, var(--ash)) 60%, transparent);
}

#dashboard .ia-chip--urgent {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 60%, transparent);
}

#dashboard .ia-chip--approved {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
}

#dashboard .ia-chip--edited {
  color: var(--bone-80);
  border-color: var(--bone-50);
}

#dashboard .ia-chip--rejected {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

#dashboard .ia-chip-ico {
  width: 11px;
  height: 11px;
  flex: none;
}

#dashboard .ia-by-w {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

#dashboard .ia-by-i {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--elev);
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--bone);
}

#dashboard .ia-by-n {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14.5px;
  color: var(--bone-80);
}

/* Phone: each draft becomes three lines (when + result; email; type + by) */
@media (max-width: 639px) {
  #dashboard .ia-table,
  #dashboard .ia-table tbody {
    display: block;
  }

  #dashboard .ia-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  #dashboard .ia-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "when result"
      "email email"
      "type by";
    gap: 8px 12px;
    padding: 16px 16px 14px;
    border-bottom: 1px solid var(--line-soft);
  }

  #dashboard .ia-table tbody tr:last-child {
    border-bottom: 0;
  }

  #dashboard .ia-table td {
    display: block;
    height: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
    overflow: visible;
  }

  #dashboard .ia-table td:first-child,
  #dashboard .ia-table td:last-child {
    padding: 0;
  }

  #dashboard .ia-table td.ia-when { grid-area: when; }
  #dashboard .ia-table td.ia-email { grid-area: email; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
  #dashboard .ia-table td.ia-type { grid-area: type; align-self: center; }
  #dashboard .ia-table td.ia-result { grid-area: result; justify-self: end; }
  #dashboard .ia-table td.ia-by { grid-area: by; justify-self: end; min-width: 0; }

  #dashboard .ia-chip {
    font-size: 10.5px;
  }
}

/* ---------- Dashboard foot ---------- */

@media (max-width: 1023px) {
  #dashboard .ia-dash .dashboard-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

/* ---------- 09 / Stack: seven tools on hairlines ----------
   Each cell draws its own hairlines, so any column count works. 7 across from 1280,
   4 + 3 from 1024, 2 wide from 640 and one wide below that. */

#stack .ia-stack {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#stack .ia-stack > * {
  min-width: 0;
  padding: 28px 22px;
  border-left: 0;
  border-top: 0;
}

#stack .ia-stack .features-glyph {
  margin-bottom: 24px;
}

/* The caption sits 24px under the grid at every width */
#stack .features-caption {
  margin-top: 24px;
}

#stack .ia-tool-text {
  display: grid;
  gap: 8px;
  min-width: 0;
}

#stack .ia-tool-r {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ash);
  text-wrap: pretty;
}

#stack .ia-stack > *:hover .ia-tool-r {
  color: var(--bone-70);
}

@media (min-width: 1280px) {
  #stack .ia-stack {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  #stack .ia-stack > *:nth-child(n + 2) {
    border-left: 1px solid var(--line);
  }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  #stack .ia-stack > *:nth-child(4n + 2),
  #stack .ia-stack > *:nth-child(4n + 3),
  #stack .ia-stack > *:nth-child(4n + 4) {
    border-left: 1px solid var(--line);
  }

  #stack .ia-stack > *:nth-child(n + 5) {
    border-top: 1px solid var(--line);
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  #stack .ia-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #stack .ia-stack > *:nth-child(2n) {
    border-left: 1px solid var(--line);
  }

  #stack .ia-stack > *:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 639px) {
  #stack .ia-stack {
    grid-template-columns: minmax(0, 1fr);
  }

  #stack .ia-stack > *:nth-child(n + 2) {
    border-top: 1px solid var(--line);
  }

  /* One tool per row: glyph on the left, name with its line of copy beside it */
  #stack .ia-stack > * {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 0;
  }

  #stack .ia-stack .features-glyph {
    flex: none;
    margin: 2px 0 0;
  }

  #stack .ia-stack .ia-tool-r {
    font-size: 1rem;
  }
}

/* ---------- 10 / Built for: name and one line per row ---------- */

#industries .ia-ind-row {
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: start;
  padding: 24px 0;
}

#industries .ia-ind-text {
  display: grid;
  gap: 8px;
  min-width: 0;
}

#industries .ia-ind-row .features-hex {
  margin-top: 8px;
}

#industries .ia-ind-line {
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ash);
  text-wrap: pretty;
}

@media (max-width: 767px) {
  #industries .ia-ind-row {
    min-height: 0;
    padding: 20px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #dashboard .ia-dash--play .ia-stack,
  #dashboard .ia-dash--play .ia-bar-fill {
    animation: none;
  }
}

#cta .btn {
  scroll-margin-top: 96px;
}
