:root {
  --bg: #101114;
  --bg-elevated: #17191f;
  --panel: #1d2028;
  --panel-strong: #242832;
  --text: #f4f0e8;
  --muted: #a9adbb;
  --soft: #777e91;
  --line: #353a46;
  --accent: #57d68d;
  --accent-ink: #07130d;
  --warn: #f5b85b;
  --danger: #ff6b6b;
  --info: #79b7ff;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: "Aptos", "Soehne", "SF Pro Text", "Segoe UI Variable", system-ui, sans-serif;
  background:
    linear-gradient(135deg, rgba(87, 214, 141, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(121, 183, 255, 0.10), transparent 32%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--info);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2.25rem, 8vw, 5.8rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(29, 32, 40, 0.86);
  box-shadow: var(--shadow);
}

.status-dot {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border-radius: 99px;
  background: var(--soft);
  box-shadow: 0 0 0 5px rgba(119, 126, 145, 0.12);
}

.status-dot.ready {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(87, 214, 141, 0.16);
}

.status-dot.warn {
  background: var(--warn);
  box-shadow: 0 0 0 5px rgba(245, 184, 91, 0.16);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(255, 107, 107, 0.16);
}

.status-label {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(340px, 1.35fr);
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(36, 40, 50, 0.94), rgba(29, 32, 40, 0.94));
  box-shadow: var(--shadow);
}

.config-panel,
.action-panel,
.autocapture-panel,
.log-panel {
  padding: 18px;
}

.config-panel {
  position: sticky;
  top: 16px;
}

.action-panel {
  grid-row: span 2;
}

.panel-heading {
  margin-bottom: 16px;
}

.panel-heading.compact {
  margin-top: 2px;
  margin-bottom: 12px;
}

.panel-heading.inline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

fieldset.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 7px;
  padding: 0;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #11141a;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

::placeholder {
  color: #687083;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #11141a;
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
}

.segmented input:checked + span {
  color: var(--accent-ink);
  background: var(--accent);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.toggle-row input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.button-row {
  display: flex;
  gap: 10px;
}

.button-row.wrap {
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  background: #2c313d;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.button.primary {
  color: var(--accent-ink);
  background: var(--accent);
}

.button.secondary {
  border-color: rgba(121, 183, 255, 0.42);
  background: rgba(121, 183, 255, 0.13);
}

.button.ghost {
  border-color: var(--line);
  background: transparent;
}

.button.small {
  min-height: 34px;
  padding-inline: 10px;
  font-size: 0.85rem;
}

.link-button {
  border-color: rgba(87, 214, 141, 0.32);
  background: rgba(87, 214, 141, 0.10);
}

.identity-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.identity-list div {
  min-width: 0;
}

.identity-list dt {
  margin-bottom: 4px;
  color: var(--soft);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.identity-list dd {
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.event-button {
  display: grid;
  gap: 10px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #11141a;
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.event-button:hover {
  transform: translateY(-2px);
  border-color: rgba(87, 214, 141, 0.52);
  background: #151a21;
}

.event-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.event-button span {
  align-self: end;
  font-size: 1.05rem;
  font-weight: 800;
}

.event-button small {
  overflow-wrap: anywhere;
  color: var(--muted);
}

.custom-event {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.event-log {
  display: grid;
  gap: 10px;
  min-height: 120px;
  max-height: 450px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-log:empty::before {
  content: "No actions yet";
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--soft);
}

.log-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #11141a;
}

.log-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.log-name {
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 800;
}

.log-status {
  color: var(--accent);
  white-space: nowrap;
}

.log-status.error {
  color: var(--danger);
}

.log-json {
  overflow: auto;
  margin: 0;
  color: #d8dfeb;
  font-size: 0.78rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .hero,
  .workspace {
    display: grid;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .config-panel {
    position: static;
  }

  .action-panel {
    grid-row: auto;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 22px, 1180px);
    padding: 20px 0;
  }

  .hero {
    gap: 14px;
  }

  .status-card {
    min-width: 0;
  }

  .config-panel,
  .action-panel,
  .autocapture-panel,
  .log-panel {
    padding: 14px;
  }

  .event-grid {
    grid-template-columns: 1fr;
  }

  .button-row,
  .panel-heading.inline {
    flex-direction: column;
    align-items: stretch;
  }

  .button {
    width: 100%;
  }
}

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