/* =========================================================
   Lab: Harbor Dental automation demo
   Left: the client's form (navy, seafoam). Middle: the automation
   itself, in Kev's Atelier gold. Right: the apps it updates.
   ========================================================= */

.au {
  display: grid; gap: 16px;
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (min-width: 1100px) { .au { grid-template-columns: 330px minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; } }
.au [hidden] { display: none !important; }
.au :focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

.au-label { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-family: var(--body); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.au-label b { color: var(--gold-bright); font-weight: 600; }

/* ---------- Client form ---------- */
.au-form-col .browser { box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.9); }
.hd-site {
  --hd-navy: #12355b; --hd-sea: #2fa596; --hd-bg: #f4f8fa; --hd-line: #d5e2ea; --hd-text: #2b4256; --hd-muted: #6a8195;
  color-scheme: light;
  background: var(--hd-bg); color: var(--hd-text); font-size: 14.5px; line-height: 1.45;
}
.hd-head { display: flex; align-items: center; gap: 9px; padding: 12px 16px; background: var(--hd-navy); color: #fff; font-weight: 700; }
.hd-head svg { width: 22px; height: 22px; }
.hd-body { padding: 16px; display: grid; gap: 10px; }
.hd-body h3 { margin: 0; color: var(--hd-navy); font-size: 1.15rem; font-weight: 800; }
.hd-body p.sub { margin: -4px 0 4px; color: var(--hd-muted); font-size: 0.85rem; }
.hd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hd-field { display: grid; gap: 3px; min-width: 0; }
.hd-field label { font-size: 0.76rem; font-weight: 700; color: var(--hd-muted); }
.hd-field input, .hd-field select {
  width: 100%; min-width: 0;
  padding: 9px 10px; border: 1.5px solid var(--hd-line); border-radius: 8px;
  background: #fff; color: var(--hd-navy); font: 600 0.92rem/1.2 inherit; font-family: inherit;
}
.hd-field input:focus, .hd-field select:focus { outline: none; border-color: var(--hd-sea); box-shadow: 0 0 0 3px rgba(47, 165, 150, 0.18); }
.hd-send {
  margin-top: 4px; padding: 12px; border: 0; border-radius: 10px;
  background: var(--hd-sea); color: #fff; font: 800 0.98rem/1 inherit; font-family: inherit; cursor: pointer;
  transition: background 200ms;
}
.hd-send:hover { background: #24877a; }
.hd-send:disabled { background: #8fb9b2; cursor: progress; }
.hd-privacy { margin: 0; font-size: 0.76rem; color: var(--hd-muted); text-align: center; }

/* What-if switches */
.au-whatif { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); display: grid; gap: 10px; }
.au-whatif h3 { margin: 0 0 2px; font-family: var(--display); font-weight: 500; font-size: 1.3rem; }
.au-switch { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; cursor: pointer; }
.au-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.au-switch .tr { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #2a2722; border: 1px solid var(--line); transition: background 200ms; }
.au-switch .tr::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 250ms var(--ease-out), background 200ms; }
.au-switch input:checked + .tr { background: rgba(201, 162, 75, 0.35); border-color: var(--gold); }
.au-switch input:checked + .tr::after { transform: translateX(16px); background: var(--gold-bright); }
.au-switch input:focus-visible + .tr { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.au-switch b { display: block; font-weight: 600; font-family: var(--body); font-size: 0.95rem; color: var(--ivory); }
.au-switch small { display: block; color: var(--muted); font-size: 0.82rem; font-family: var(--body); }
.au-reset { justify-self: start; padding: 0; border: 0; background: none; color: var(--muted); font: 600 0.82rem/1 var(--body); text-decoration: underline; cursor: pointer; }
.au-reset:hover { color: var(--gold-bright); }

/* ---------- The automation (Kev's side) ---------- */
.au-engine { border: 1px solid var(--line); border-radius: 8px; background: radial-gradient(120% 80% at 100% 0%, #1b170d, #0b0a08 60%); overflow: hidden; }
.au-engine-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.au-engine-head h3 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 1.35rem; color: var(--ivory); }
.au-engine-head h3 small { display: block; font-family: var(--body); font-size: 0.78rem; color: var(--muted); }
.au-tools { display: inline-flex; padding: 3px; border: 1px solid var(--line-soft); border-radius: 6px; }
.au-tools button { padding: 6px 10px; border: 0; border-radius: 4px; background: none; color: var(--muted); font: 600 0.78rem/1 var(--body); cursor: pointer; }
.au-tools button[aria-pressed="true"] { background: rgba(201, 162, 75, 0.18); color: var(--gold-bright); }

.au-flow { position: relative; margin: 0; padding: 14px 16px 16px; list-style: none; display: grid; gap: 6px; }
.au-flow::before { content: ""; position: absolute; left: 33px; top: 30px; bottom: 30px; width: 1px; background: var(--line); }
.au-step { position: relative; display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 9px 10px 9px 0; border-radius: 6px; transition: background 300ms; }
.au-dot {
  position: relative; z-index: 1;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: #0b0a08;
  font: italic 500 0.95rem/1 var(--display); color: var(--muted);
  transition: background 300ms, color 300ms, border-color 300ms, box-shadow 300ms;
}
.au-step b { display: block; font-family: var(--body); font-weight: 600; font-size: 0.98rem; color: var(--ivory); opacity: 0.7; transition: opacity 300ms; }
.au-tool { display: block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.74rem; color: var(--muted); }
.au-detail { display: block; font-family: var(--body); font-size: 0.86rem; color: var(--gold-bright); min-height: 0; }
.au-detail:empty { display: none; }
.au-state { font: 600 0.7rem/1 var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }

.au-step.running { background: rgba(201, 162, 75, 0.08); }
.au-step.running .au-dot { border-color: var(--gold-bright); color: var(--gold-bright); box-shadow: 0 0 0 6px rgba(232, 200, 115, 0.12), 0 0 20px rgba(232, 200, 115, 0.5); animation: au-pulse 1s ease-in-out infinite; }
.au-step.running b, .au-step.done b, .au-step.failed b, .au-step.retry b { opacity: 1; }
.au-step.running .au-state { color: var(--gold-bright); }
.au-step.done .au-dot { background: var(--gold-bright); border-color: var(--gold-bright); color: #060606; }
.au-step.done .au-state { color: #9fd49a; }
.au-step.failed .au-dot { background: #e07a5f; border-color: #e07a5f; color: #060606; }
.au-step.failed .au-state, .au-step.failed .au-detail { color: #e07a5f; }
.au-step.retry .au-dot { border-color: #e8b25a; color: #e8b25a; animation: au-pulse 0.6s ease-in-out infinite; }
.au-step.retry .au-state, .au-step.retry .au-detail { color: #e8b25a; }
@keyframes au-pulse { 50% { transform: scale(1.08); } }

.au-summary { margin: 0 16px 16px; padding: 12px 14px; border: 1px solid var(--gold); border-radius: 6px; background: rgba(201, 162, 75, 0.08); font-family: var(--body); font-size: 0.92rem; color: var(--ivory); }
.au-summary b { color: var(--gold-bright); }

/* ---------- Output apps ---------- */
.au-apps { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f3f4f6; color: #1f2933; color-scheme: light; }
.au-tabs { display: flex; overflow-x: auto; gap: 2px; padding: 6px; background: #e5e7eb; scrollbar-width: none; }
.au-tabs::-webkit-scrollbar { display: none; }
.au-tabs button {
  position: relative; flex: 1 0 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 12px; border: 0; border-radius: 6px; background: none;
  color: #52606d; font: 700 0.82rem/1 inherit; font-family: inherit; cursor: pointer;
}
.au-tabs button svg { width: 15px; height: 15px; }
.au-tabs button[aria-selected="true"] { background: #fff; color: #111827; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.au-tabs button.has-new::after { content: ""; position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #e0563c; }
.au-pane { min-height: 360px; padding: 16px; background: #fff; }
.au-flash { animation: au-flash 900ms ease-out; }
@keyframes au-flash { from { box-shadow: inset 0 0 0 3px rgba(201, 162, 75, 0.85); } to { box-shadow: inset 0 0 0 3px rgba(201, 162, 75, 0); } }
.au-empty { display: grid; place-items: center; min-height: 300px; color: #9aa5b1; font-size: 0.92rem; text-align: center; border: 1.5px dashed #e4e7eb; border-radius: 10px; }

/* CRM */
.au-crm-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid #edf0f3; }
.au-crm-head .av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #12355b; color: #fff; font-weight: 800; }
.au-crm-head b { display: block; font-size: 1.05rem; color: #111827; }
.au-crm-head div span { font-size: 0.82rem; color: #616e7c; word-break: break-all; }
.au-badge { margin-left: auto; flex: none; padding: 4px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 800; }
.au-badge.new { background: #e3f6f1; color: #1f7a6d; }
.au-badge.ret { background: #e8eefb; color: #2d4fa3; }
.au-fields { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 14px 0; font-size: 0.88rem; }
.au-fields dt { color: #7b8794; }
.au-fields dd { margin: 0; color: #1f2933; font-weight: 600; }
.au-timeline b { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: #7b8794; }
.au-timeline ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 0.86rem; }
.au-timeline li { display: flex; align-items: center; gap: 8px; }
.au-timeline i { width: 8px; height: 8px; border-radius: 50%; background: #2fa596; }

/* Mail */
.au-mail-meta { display: grid; gap: 2px; font-size: 0.8rem; color: #616e7c; padding-bottom: 10px; border-bottom: 1px solid #edf0f3; word-break: break-all; }
.au-mail-meta b { color: #323f4b; margin-right: 4px; }
#au-mail h4 { margin: 12px 0; font-size: 1.1rem; color: #111827; font-weight: 800; }
.au-mail-body { padding: 16px; border: 1px solid #edf0f3; border-radius: 10px; font-size: 0.9rem; color: #323f4b; }
.au-mail-body p { margin: 0 0 10px; }
.au-mail-brand { margin: -16px -16px 14px; padding: 12px 16px; border-radius: 10px 10px 0 0; background: #12355b; color: #fff; font-weight: 800; }
.au-mail-btn { display: inline-block; padding: 10px 16px; border-radius: 8px; background: #2fa596; color: #fff; font-weight: 800; font-size: 0.86rem; }

/* Phone */
.au-phone-frame { max-width: 300px; margin: 0 auto; padding: 14px; border-radius: 28px; background: #f9fafb; border: 8px solid #1f2933; min-height: 320px; }
.au-phone-top { text-align: center; font-weight: 800; font-size: 0.9rem; color: #111827; padding-bottom: 10px; border-bottom: 1px solid #e4e7eb; }
.au-sched { margin: 12px 0 8px; text-align: center; font-size: 0.74rem; color: #7b8794; }
.au-bubble { padding: 10px 12px; border-radius: 16px 16px 16px 4px; background: #e4e7eb; color: #1f2933; font-size: 0.88rem; }
.au-phone-note { margin-top: 8px; font-size: 0.74rem; color: #9aa5b1; }
.au-phone-frame .au-empty { min-height: 230px; border: 0; }

/* Chat */
.au-chat-head { margin: -16px -16px 12px; padding: 12px 16px; background: #3f0e40; color: #fff; font-weight: 800; }
.au-msg { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 8px 4px; font-size: 0.88rem; }
.au-msg .av { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: #e4e7eb; color: #323f4b; font-weight: 800; font-size: 0.8rem; }
.au-msg.bot .av { background: #12355b; color: #fff; }
.au-msg.alert .av { background: #e0563c; color: #fff; }
.au-msg b { color: #111827; }
.au-msg small { color: #9aa5b1; }
.au-msg p { margin: 2px 0 0; color: #323f4b; }
.au-msg.old { opacity: 0.6; }
.au-msg .mention { display: inline-block; margin-top: 6px; padding: 1px 6px; border-radius: 4px; background: #e8f0fe; color: #1d4ed8; font-weight: 700; }

/* Sheet */
.au-sheet-name { margin-bottom: 10px; font-weight: 800; color: #1f7a4d; font-size: 0.92rem; }
.au-sheet-scroll { overflow-x: auto; }
.au-pane table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 0.82rem; }
.au-pane th, .au-pane td { padding: 7px 8px; border: 1px solid #e4e7eb; text-align: left; white-space: nowrap; }
.au-pane thead th { background: #f3f4f6; color: #52606d; font-weight: 700; }
.au-pane td:first-child, .au-pane th:first-child { background: #f3f4f6; color: #9aa5b1; text-align: center; width: 28px; }
.au-pane tr.new td { background: #fff7e0; font-weight: 700; }
.au-pane tr.new td:first-child { background: #fde9b0; color: #7a5a00; }

/* ---------- Run log ---------- */
.au-logwrap { grid-column: 1 / -1; border: 1px solid var(--line-soft); border-radius: 8px; background: #0b0a08; }
.au-logwrap > summary { display: flex; justify-content: space-between; padding: 12px 16px; cursor: pointer; list-style: none; font: 600 0.78rem/1 var(--body); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-bright); }
.au-logwrap > summary::-webkit-details-marker { display: none; }
.au-logwrap > summary::after { content: "+"; color: var(--gold-bright); }
.au-logwrap[open] > summary::after { content: "–"; }
.au-log { max-height: 260px; overflow-y: auto; margin: 0; padding: 0 16px 14px; list-style: none; font: 0.8rem/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #d9d2c2; }
.au-log li { display: grid; grid-template-columns: 64px 18px 1fr; gap: 4px 6px; padding: 4px 0; border-bottom: 1px dashed rgba(201, 162, 75, 0.12); }
.au-log .t { color: var(--muted); }
.au-log .ok .k { color: #9fd49a; }
.au-log .err .k, .au-log .err .m { color: #e07a5f; }
.au-log .info .k { color: var(--gold-bright); }
.au-log details { grid-column: 3; }
.au-log details summary { cursor: pointer; color: var(--gold); font-size: 0.74rem; letter-spacing: 0; text-transform: none; padding: 0; }
.au-log pre { margin: 6px 0 0; padding: 10px; border-radius: 4px; background: #14120e; color: #cfc6b4; white-space: pre-wrap; word-break: break-word; }

@media (prefers-reduced-motion: reduce) {
  .au-step.running .au-dot, .au-step.retry .au-dot { animation: none; }
  .au-flash { animation: none; }
}

/* Let every column shrink to the screen; wide content scrolls inside its own box */
.au > * { min-width: 0; }
.hd-field select { text-overflow: ellipsis; }
