.tiktok-automation-body {
  min-width: 320px;
  padding-bottom: 0;
  background: var(--cream);
}

.tiktok-automation-body main { overflow: hidden; }

.automation-hero {
  position: relative;
  isolation: isolate;
  width: 100%;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6.5rem) max(14px, calc((100% - var(--max)) / 2)) clamp(2.4rem, 7vw, 5rem);
  display: grid;
  gap: clamp(2rem, 6vw, 4rem);
  background:
    radial-gradient(circle at 4% 8%, rgba(226, 165, 43, .18), transparent 28rem),
    var(--forest-deep);
  color: white;
}

.automation-hero::before {
  content: none;
}

.automation-hero-copy { max-width: 45rem; }

.automation-hero h1 {
  max-width: 10ch;
  margin-bottom: 1.25rem;
  font-size: clamp(3rem, 11vw, 6.2rem);
}

.automation-lede {
  max-width: 42rem;
  color: rgba(255, 255, 255, .78);
  font-size: clamp(1.03rem, 2.2vw, 1.22rem);
}

.automation-hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-top: 1.5rem;
}

.automation-hero .button-primary {
  background: var(--honey);
  color: var(--forest-deep);
}

.automation-button-light {
  border-color: rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .08);
  color: white;
}

.issue-card {
  min-width: 0;
  align-self: end;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid rgba(244, 207, 114, .32);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0, rgba(226, 165, 43, .17), transparent 44%),
    rgba(255, 255, 255, .07);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .2);
}

.issue-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.issue-id {
  margin: 0;
  color: var(--honey-light);
  font-size: .73rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.issue-card h2 {
  margin-bottom: .85rem;
  color: white;
  font-size: clamp(1.65rem, 5vw, 2.5rem);
}

.issue-card > p:not(.issue-id, .record-time) { color: rgba(255, 255, 255, .74); }

.state-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  padding: .35rem .65rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: var(--honey-light);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  line-height: 1.15;
  text-transform: uppercase;
}

.state-verified,
.state-complete,
.state-published,
.state-ready { color: #bfe7c0; }

.state-held,
.state-blocked,
.state-attention,
.state-failed { color: #ffd28a; }

.state-pending,
.state-prepared,
.state-queued,
.state-loading { color: #d5e7de; }

.next-action {
  margin-top: 1.25rem;
  padding: 1rem;
  border-left: 4px solid var(--honey);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(0, 0, 0, .18);
}

.next-action span,
.next-action strong { display: block; }

.next-action span {
  margin-bottom: .35rem;
  color: var(--honey-light);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.record-time {
  margin: 1rem 0 0;
  color: rgba(255, 255, 255, .56);
  font-size: .78rem;
}

.automation-shell {
  width: min(var(--max), calc(100% - 28px));
  margin: 0 auto;
  padding: clamp(2.2rem, 7vw, 5rem) 0 clamp(4rem, 9vw, 7rem);
}

.automation-alert {
  padding: 1rem 1.1rem;
  border: 1px solid rgba(153, 90, 22, .35);
  border-left: 5px solid var(--amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #fff4dc;
  color: #603b12;
  font-weight: 750;
}

.automation-section {
  padding: clamp(2.8rem, 8vw, 6.5rem) 0;
  border-bottom: 1px solid var(--line);
}

.automation-heading { margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.automation-heading > p { max-width: 38rem; color: var(--muted); }
.automation-heading h2 { max-width: 15ch; margin-bottom: 0; }

.count-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
  margin: 0;
}

.count-grid > div {
  min-width: 0;
  min-height: 138px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 240, .82);
  box-shadow: var(--shadow-small);
}

.count-grid dt {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 850;
  letter-spacing: .06em;
  line-height: 1.25;
  text-transform: uppercase;
}

.count-grid dd {
  margin: 0;
  color: var(--forest-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 9vw, 4.3rem);
  font-weight: 800;
  letter-spacing: -.06em;
  line-height: .9;
}

.profile-grid,
.implementation-grid { display: grid; gap: .85rem; }

.profile-card,
.implementation-card {
  min-width: 0;
  padding: clamp(1.15rem, 4vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-small);
}

.profile-card-top,
.implementation-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: .8rem;
}

.profile-card h3,
.implementation-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.35rem, 5vw, 1.8rem);
}

.profile-card h3 a,
.implementation-card h3 a {
  color: var(--forest-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.profile-route,
.implementation-meta {
  margin: .7rem 0 0;
  color: var(--amber);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.profile-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
  margin: 1.25rem 0 0;
}

.profile-counts div {
  min-width: 0;
  padding: .75rem;
  border-radius: var(--radius-sm);
  background: var(--cream);
}

.profile-counts dt {
  color: var(--muted);
  font-size: .65rem;
  font-weight: 850;
  text-transform: uppercase;
}

.profile-counts dd {
  margin: .2rem 0 0;
  color: var(--forest-deep);
  font-family: Georgia, serif;
  font-size: 1.65rem;
  font-weight: 800;
}

.profile-next {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.profile-next strong { color: var(--forest-deep); }

.control-list,
.event-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.control-list { display: grid; gap: .65rem; }

.control-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .9rem;
  align-items: start;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 240, .82);
}

.control-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--forest-deep);
  color: var(--honey-light);
  font-size: .75rem;
  font-weight: 950;
}

.control-item h3 {
  margin: 0 0 .35rem;
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: 0;
}

.control-item p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}

.control-state {
  display: inline-block;
  margin-top: .55rem;
  color: var(--amber);
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.queue-search {
  padding: clamp(1rem, 4vw, 1.5rem);
  border: 1px solid rgba(18, 59, 44, .18);
  border-radius: var(--radius-md);
  background: var(--forest-deep);
  color: white;
  box-shadow: var(--shadow);
}

.queue-search label {
  display: block;
  margin-bottom: .65rem;
  color: var(--honey-light);
  font-weight: 900;
}

.queue-search-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
}

.queue-search input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 13px;
  padding: .8rem .9rem;
  background: white;
  color: var(--ink);
  font: inherit;
}

.queue-search button {
  min-width: 68px;
  min-height: 50px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 13px;
  padding: .7rem;
  background: rgba(255, 255, 255, .1);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

.queue-search p {
  margin: .65rem 0 0;
  color: rgba(255, 255, 255, .65);
  font-size: .78rem;
}

.queue-results-heading { min-height: 2rem; margin: 1.25rem 0 .75rem; }

.queue-results-heading p {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 850;
}

.queue-grid { display: grid; gap: .75rem; }

.queue-card {
  min-width: 0;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 0 9px 25px rgba(92, 56, 19, .07);
}

.queue-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: .75rem;
}

.queue-order {
  margin: 0 0 .4rem;
  color: var(--amber);
  font-size: .69rem;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.queue-card h3 { margin: 0; font-size: clamp(1.3rem, 4vw, 1.65rem); }

.queue-caption {
  margin: 1rem 0;
  color: var(--muted);
  white-space: pre-line;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .75rem 0 0;
  padding: 0;
  list-style: none;
}

.tag-list li {
  max-width: 100%;
  padding: .3rem .55rem;
  border: 1px solid rgba(18, 59, 44, .16);
  border-radius: 999px;
  background: rgba(18, 59, 44, .06);
  color: var(--forest);
  font-size: .7rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.queue-destinations {
  margin: .85rem 0 0;
  color: var(--forest-deep);
  font-size: .78rem;
  font-weight: 850;
}

.empty-state {
  padding: 2rem 1rem;
  border: 1px dashed rgba(18, 59, 44, .3);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.event-list { position: relative; }

.event-list::before {
  position: absolute;
  top: .5rem;
  bottom: .5rem;
  left: 9px;
  width: 2px;
  background: var(--cream-deep);
  content: "";
}

.event-item { position: relative; padding: 0 0 1.6rem 2rem; }
.event-item:last-child { padding-bottom: 0; }

.event-item::before {
  position: absolute;
  top: .3rem;
  left: 3px;
  width: 14px;
  height: 14px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--honey);
  box-shadow: 0 0 0 1px var(--amber);
  content: "";
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .7rem;
  align-items: center;
  margin-bottom: .35rem;
}

.event-meta time {
  color: var(--muted);
  font-size: .73rem;
  font-weight: 800;
}

.event-item h3 {
  margin: 0 0 .35rem;
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: 0;
}

.event-item > p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}

.implementation-card p:last-child { margin: .85rem 0 0; color: var(--muted); }

.implementation-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.public-boundary {
  margin-top: clamp(3rem, 8vw, 6rem);
  padding: clamp(1.4rem, 5vw, 2.5rem);
  border: 1px solid rgba(226, 165, 43, .4);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0, rgba(244, 207, 114, .16), transparent 46%),
    var(--forest-deep);
  color: white;
}

.public-boundary h2 { max-width: 16ch; color: white; }

.public-boundary > p:last-child {
  max-width: 48rem;
  margin-bottom: 0;
  color: rgba(255, 255, 255, .72);
}

.loading-copy { margin: 0; color: var(--muted); }

@media (min-width: 600px) {
  .count-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .queue-grid,
  .implementation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 760px) {
  .automation-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, .65fr);
    gap: 2rem;
    align-items: end;
  }
  .automation-heading > p { margin-bottom: .35rem; }
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 960px) {
  .automation-hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(22rem, .72fr);
    align-items: end;
  }
  .count-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .count-grid > div { min-height: 155px; }
  .queue-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .implementation-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .automation-hero-links .button { width: 100%; }
  .queue-search-field { grid-template-columns: 1fr; }
  .queue-search button { width: 100%; }
  .profile-card-top,
  .queue-card-top,
  .implementation-card-top {
    align-items: start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tiktok-automation-body *,
  .tiktok-automation-body *::before,
  .tiktok-automation-body *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .state-pill,
  .control-item,
  .profile-card,
  .queue-card,
  .implementation-card { border: 1px solid CanvasText; }
}
