:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-strong: #f9fbfb;
  --ink: #14201f;
  --muted: #60706d;
  --line: #d8e2df;
  --teal: #0d6f68;
  --teal-strong: #064d49;
  --teal-soft: #dff3ef;
  --amber: #a15f00;
  --amber-soft: #fff1d6;
  --red: #a43f3f;
  --red-soft: #ffe8e6;
  --blue: #2f5f8f;
  --shadow: 0 16px 44px rgba(17, 31, 29, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

textarea {
  min-height: 154px;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
  color: var(--ink);
  line-height: 1.45;
}

textarea:focus,
button:focus-visible,
.remote-stage:focus-visible {
  outline: 3px solid rgba(13, 111, 104, 0.25);
  outline-offset: 2px;
}

label {
  display: block;
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar h1,
.section-heading h2,
.panel h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

.topbar h1 {
  display: inline-block;
  margin-right: 10px;
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
}

.version-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  vertical-align: middle;
}

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

.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--surface-strong);
  color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.status-dot.is-on {
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}

.sidebar {
  padding: 24px 14px;
  border-right: 1px solid var(--line);
  background: #edf4f2;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  margin-bottom: 8px;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 800;
}

.nav-button.is-active {
  background: var(--surface);
  color: var(--teal-strong);
  box-shadow: 0 1px 0 rgba(17, 31, 29, 0.05);
}

.nav-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-size: 0.82rem;
}

.workspace {
  min-width: 0;
  padding: 24px clamp(16px, 3vw, 36px) 36px;
}

.session-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.session-band > div {
  min-width: 0;
  padding: 18px;
  background: var(--surface);
}

.session-band strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: clamp(1.32rem, 2vw, 1.8rem);
}

.quiet-note,
.panel-copy,
.helper-copy,
.toggle-row small,
.consent-box span,
.audio-tools span,
.audio-status-row {
  color: var(--muted);
  line-height: 1.48;
}

.quiet-note {
  max-width: 340px;
  text-align: right;
}

.tool-grid,
.device-grid,
.remote-layout {
  display: grid;
  gap: 18px;
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.remote-layout,
.device-grid {
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  margin-top: 18px;
  align-items: start;
}

.panel,
.screen-surface,
.control-panel,
.audit-timeline {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(17, 31, 29, 0.04);
}

.panel,
.control-panel,
.audit-timeline {
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title h3 {
  font-size: 1rem;
}

.step-badge,
.state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.state-pill {
  background: var(--amber-soft);
  color: var(--amber);
}

.primary-action,
.secondary-action,
.danger-action,
.quick-actions button,
.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 850;
}

.primary-action {
  width: 100%;
  margin-top: 12px;
  background: var(--teal);
  color: #ffffff;
}

.secondary-action,
.quick-actions button,
.icon-action {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.danger-action {
  background: var(--red-soft);
  color: var(--red);
}

.compact {
  width: auto;
  margin: 0;
}

.screen-surface {
  overflow: hidden;
}

.screen-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 850;
}

.remote-stage {
  position: relative;
  display: grid;
  min-height: 420px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  place-items: center;
  background: #111a1a;
}

.remote-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111a1a;
}

.screen-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    #111a1a;
  background-size: 42px 42px;
  color: #d9e8e5;
  text-align: center;
}

.screen-placeholder.is-hidden {
  display: none;
}

.remote-cursor,
.host-cursor {
  position: absolute;
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(161, 95, 0, 0.28);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.remote-cursor.is-visible,
.host-cursor.is-visible {
  display: block;
}

.capability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.capability {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.capability.is-on {
  border-color: transparent;
  background: var(--teal-soft);
  color: var(--teal-strong);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.quick-actions button {
  width: 100%;
  margin: 0;
}

.audio-tools {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-strong);
}

.audio-tools strong,
.audio-tools span {
  display: block;
}

.audio-tools label {
  margin: 0;
}

.audio-tools input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.inline-check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 12px 0 0;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 750;
}

.inline-check input {
  width: 19px;
  height: 19px;
  accent-color: var(--teal);
}

.audio-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 800;
}

.mini-log {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.86rem;
}

.mini-log:empty::before {
  content: "Sin eventos todavia.";
}

.toggle-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.toggle-row input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--teal);
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row.is-muted {
  opacity: 0.72;
}

.consent-box {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  padding: 12px;
  background: var(--amber-soft);
}

.audit-timeline {
  display: grid;
  gap: 10px;
  min-height: 360px;
}

.audit-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.audit-item:last-child {
  border-bottom: 0;
}

.audit-time {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px clamp(16px, 3vw, 24px);
  }

  .nav-button {
    width: auto;
    min-width: 168px;
    margin: 0;
  }

  .two-columns,
  .remote-layout,
  .device-grid,
  .session-band {
    grid-template-columns: 1fr;
  }

  .quiet-note {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip,
  .danger-action,
  .secondary-action.compact {
    width: 100%;
    justify-content: center;
  }

  .remote-stage {
    min-height: 260px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .audit-item {
    grid-template-columns: 1fr;
  }
}
