@layer legacy {
  /* Scoped edition: the original Docker keeps its own entry and appearance. */
  html[data-edition="space"] {
    background: var(--space-background);
  }
  html[data-edition="space"] body {
    background: var(--space-background);
    font-family: var(--ui-font);
    color: var(--space-ink);
  }
  html[data-edition="space"] .app-shell {
    --canvas: var(--space-background);
    --surface: var(--ui-surface);
    --line: var(--space-line);
    --ink: var(--space-ink);
    --muted: var(--space-muted);
    --brand: var(--space-brand);
    font-family: var(--ui-font);
    letter-spacing: 0;
    background: var(--canvas);
  }
  html[data-edition="space"] .app-shell .sidebar,
  html[data-edition="space"] .app-shell .sidebar:hover,
  html[data-edition="space"] .app-shell .sidebar:focus-within {
    width: 224px;
    margin: 0;
    height: 100%;
    padding: 18px 12px 12px;
    border: 0;
    border-right: 1px solid var(--ui-line);
    border-radius: 0;
    background: var(--ui-soft);
    transition: none;
  }
  html[data-edition="space"] .app-shell .sidebar .sidebar-brand,
  html[data-edition="space"] .app-shell .sidebar:hover .sidebar-brand,
  html[data-edition="space"] .app-shell .sidebar:focus-within .sidebar-brand {
    width: 100%;
    height: 66px;
    flex-basis: 66px;
    margin: 0 0 18px;
  }
  html[data-edition="space"] .sidebar-brand img {
    left: 8px;
    top: -13px;
    width: 172px;
  }
  html[data-edition="space"] .app-shell .sidebar nav {
    gap: 5px;
    padding: 8px 0;
    margin: 0;
  }
  html[data-edition="space"] .app-shell .sidebar .nav-text,
  html[data-edition="space"] .app-shell .sidebar:hover .nav-text,
  html[data-edition="space"] .app-shell .sidebar:focus-within .nav-text {
    display: block;
    opacity: 1;
    transform: none;
    font-size: 12px;
    white-space: normal;
  }
  html[data-edition="space"] .app-shell .sidebar nav a,
  html[data-edition="space"] .app-shell .sidebar-bottom button {
    flex-basis: 43px;
    min-height: 43px;
    height: 43px;
    margin-right: 0;
    padding: 0 10px;
    gap: 9px;
    color: var(--ui-muted);
    border-radius: 5px;
    font-weight: 400;
  }
  html[data-edition="space"] .app-shell .sidebar .nav-icon {
    width: 24px;
    flex-basis: 24px;
  }
  html[data-edition="space"] .app-shell .sidebar .nav-icon svg {
    width: 19px;
    height: 19px;
  }
  html[data-edition="space"] .app-shell .sidebar nav a:hover,
  html[data-edition="space"] .app-shell .sidebar-bottom button:hover {
    background: var(--ui-brand-soft);
    color: var(--ui-ink);
  }
  html[data-edition="space"] .app-shell .sidebar nav a[aria-current="page"] {
    color: var(--ui-ink);
    background: var(--ui-brand-soft);
    border-radius: 5px;
    box-shadow: inset 3px 0 var(--ui-brand);
    font-weight: 500;
  }
  html[data-edition="space"]
    .app-shell
    .sidebar
    nav
    a[aria-current="page"]::before,
  html[data-edition="space"]
    .app-shell
    .sidebar
    nav
    a[aria-current="page"]::after {
    content: none;
  }
  html[data-edition="space"] .sidebar-bottom {
    border-top: 1px solid var(--ui-line);
    padding: 12px 0 0;
  }
  html[data-edition="space"] .app-shell .sidebar-bottom button {
    width: 100%;
  }
  html[data-edition="space"] .app-shell .workspace {
    /* Keep positioned descendants inside this scroll area, not the document. */
    position: relative;
    min-height: 0;
    overscroll-behavior-y: contain;
    margin-left: 0;
  }
  html[data-edition="space"] .app-shell .classic-file-input {
    inset: 0 auto auto 0;
    min-height: 0;
    padding: 0;
    border: 0;
  }
  html[data-edition="space"] .app-shell .topbar,
  html[data-edition="space"] .app-shell.has-company-picker .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    padding: 18px 30px 8px;
    gap: 16px;
  }
  .space-topbar-title {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1.6px;
    color: var(--ui-muted);
  }
  .space-topbar-title span {
    padding: 0 10px;
    color: var(--ui-muted);
  }
  html[data-edition="space"] .app-shell .company-select {
    align-items: center;
    gap: 10px;
    color: var(--ui-muted);
  }
  html[data-edition="space"] .app-shell .company-select select {
    border-radius: 5px;
    background: var(--ui-brand-softer);
    min-height: 34px;
    max-width: 275px;
    font-size: 11px;
  }
  html[data-edition="space"] .app-shell #page-content,
  html[data-edition="space"] .app-shell.has-company-picker #page-content {
    padding: 20px 30px 40px;
    min-height: calc(100% - 72px);
    max-width: 1660px;
    margin-inline: auto;
  }
  html[data-edition="space"] .app-shell .page-stack {
    gap: 22px;
  }
  html[data-edition="space"] .app-shell .page-heading h1 {
    color: var(--ui-ink);
    font-family: var(--ui-font);
    font-weight: 500;
    font-size: 29px;
    letter-spacing: -0.7px;
  }
  html[data-edition="space"] .app-shell .page-heading p {
    color: var(--ui-muted);
    font-size: 13px;
  }

  html[data-edition="space"] .app-shell :is(input, select, textarea) {
    background-color: var(--ui-brand-softer);
    border-color: var(--ui-line);
    color: var(--ui-ink);
  }
  html[data-edition="space"] .app-shell input::placeholder {
    color: var(--ui-muted);
  }
  html[data-edition="space"] .app-shell :is(.field, .field > span) {
    color: var(--ui-muted);
  }
  html[data-edition="space"] .app-shell .classic-view-switch {
    display: none;
  }
  html[data-edition="space"] .app-shell .management-toolbar {
    gap: 14px;
    padding: 17px 20px;
    margin-bottom: 20px;
  }
  html[data-edition="space"] .app-shell .company-directory > .module-toolbar {
    margin: 0 0 18px;
    padding: 0;
    background: transparent;
    border: 0;
  }
  html[data-edition="space"] .app-shell .management-toolbar :is(input, select) {
    border-radius: 5px;
  }

  html[data-edition="space"] .app-shell .table-actions {
    min-width: 165px;
    white-space: normal;
  }
  html[data-edition="space"] .app-shell .table-actions .button {
    display: inline-flex;

    margin: 1px;
  }
  html[data-edition="space"] .app-shell .person-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  html[data-edition="space"] .app-shell .person-cell strong {
    font-weight: 500;
  }
  html[data-edition="space"] .app-shell .person-cell small {
    color: var(--ui-muted);
    font-size: 11px;
  }

  html[data-edition="space"] .app-shell .classic-reports {
    padding: 22px;
  }

  html[data-edition="space"]
    .app-shell
    .classic-report-actions
    .classic-download {
    background: var(--ui-brand-softer);
    color: var(--ui-muted);
    border-color: var(--ui-line);
  }
  html[data-edition="space"] .app-shell .classic-report-total {
    color: var(--ui-muted);
    background: var(--ui-brand-soft);
  }

  html[data-edition="space"] .app-shell .space-import .classic-upload-card {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    min-height: 100px;
    padding: 18px 22px;
    border: 1px solid var(--ui-line);
    border-radius: 6px;
  }
  html[data-edition="space"] .space-import .classic-upload-card::after,
  html[data-edition="space"]
    .space-import
    :is(.classic-upload-outline, .classic-upload-icon) {
    display: none;
  }
  html[data-edition="space"] .space-import .classic-upload-content {
    display: grid;
    flex: 1 1 540px;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 4px 20px;
    width: auto;
    text-align: left;
    align-items: center;
  }
  html[data-edition="space"] .space-import .classic-upload-content h2 {
    font-size: 15px;
    font-weight: 500;
    margin: 0;
    color: var(--ui-muted);
  }
  html[data-edition="space"] .space-import .classic-upload-content > p {
    grid-column: 1;
    grid-row: 2;
    color: var(--ui-muted);
    font-size: 11px;
    line-height: 1.4;
  }
  html[data-edition="space"] .space-import .classic-upload-document {
    display: inline;
    margin: 0;
  }
  html[data-edition="space"] .app-shell .space-import .import-controls {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: auto;
    padding: 0;
    gap: 8px;
  }
  html[data-edition="space"] .app-shell .space-import .classic-file-button {
    min-height: 38px;
    width: auto;
    padding: 9px 15px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: none;
  }
  html[data-edition="space"] .app-shell .space-import .classic-review-button {
    min-height: 38px;
  }
  html[data-edition="space"] .app-shell .space-import .classic-template-button {
    position: static;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
    width: auto;
    height: 38px;
    padding: 9px 13px;
    border: 1px solid var(--ui-line);
    border-radius: 5px;
    background: var(--ui-brand-softer);
    color: var(--ui-muted);
    box-shadow: none;
  }
  html[data-edition="space"] .space-import .classic-template-button > span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }
  html[data-edition="space"] .space-import .classic-template-button svg {
    width: 15px;
    height: 15px;
  }
  html[data-edition="space"]
    .space-import
    .classic-upload-content
    > .classic-upload-feedback {
    grid-column: 1 / -1;
    grid-row: auto;
    margin: 4px 0 0;
  }
  html[data-edition="space"] .space-import .classic-upload-feedback:empty {
    display: none;
  }
  html[data-edition="space"] .space-import .classic-upload-card.is-dragging {
    background: var(--ui-brand-softer);
    border-color: var(--ui-line-strong);
  }

  html[data-edition="space"] dialog .primary {
    background: var(--ui-brand);
    border-color: var(--ui-brand);
    color: var(--ui-on-brand);
  }
  html[data-edition="space"] .management-dialog.employee-drawer {
    inset: 0;
    margin: 16px 16px 16px auto;
    width: min(640px, calc(100% - 32px));

    max-height: calc(100dvh - 32px);

    overflow: hidden;
  }
  html[data-edition="space"] .app-dialog.capture-dialog {
    width: min(1120px, calc(100vw - 32px));
    max-height: calc(100dvh - 48px);

    overflow: hidden;
  }
  html[data-edition="space"] .capture-dialog[open] {
    display: flex;
    flex-direction: column;
  }
  html[data-edition="space"] .capture-dialog > header {
    flex: 0 0 auto;
    padding: 16px 22px;
    border-bottom: 1px solid var(--ui-line);
    background: var(--ui-surface);
  }
  html[data-edition="space"] .capture-dialog > header h2 {
    color: var(--ui-ink);
    font-size: 18px;
    font-weight: 500;
  }

  html[data-edition="space"] .capture-dialog > .dialog-body {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 20px 22px;
    background: var(--ui-soft);
    scrollbar-width: thin;
    scrollbar-color: var(--ui-line-strong) var(--ui-soft);
  }
  html[data-edition="space"] .capture-details,
  html[data-edition="space"] .capture-details .capture-gallery {
    gap: 18px;
  }

  html[data-edition="space"]
    .capture-details
    :is(.panel-heading, .capture-step > header) {
    gap: 10px;

    border-bottom: 1px solid var(--ui-line);
  }

  html[data-edition="space"] .capture-details .capture-step-number {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    background: var(--ui-brand-soft);
    color: var(--ui-muted);
    font-size: 12px;
  }
  html[data-edition="space"]
    .capture-details
    :is(.capture-status, .capture-test-mode) {
    padding: 2px 8px;
    min-height: 22px;
    box-sizing: border-box;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 400;
    line-height: 18px;
  }
  html[data-edition="space"]
    .capture-details
    :is(.status-error, .status-errores, .status-failed, .status-fallido) {
    background: var(--ui-danger-bg);
    color: var(--ui-danger);
  }
  html[data-edition="space"]
    .capture-details
    :is(
      .status-ok,
      .status-success,
      .status-completed,
      .status-completado,
      .status-finalizado
    ) {
    background: var(--ui-hover);
    color: var(--ui-ink);
  }
  html[data-edition="space"]
    .capture-details
    :is(.capture-test-mode, .status-omitido, .status-skipped) {
    background: var(--ui-warning-bg);
    color: var(--ui-warning);
  }
  html[data-edition="space"]
    .capture-details
    :is(.capture-step-time, .capture-step-url, .capture-facts dt) {
    color: var(--ui-muted);
    font-size: 11px;
  }
  html[data-edition="space"] .capture-details .capture-facts dd {
    color: var(--ui-muted);
    font-size: 12px;
  }
  html[data-edition="space"] .capture-details .capture-facts {
    margin-top: 16px;
  }
  html[data-edition="space"] .capture-details .capture-step-note {
    margin: 14px 17px 0;
    padding: 9px 12px;
    border-left: 2px solid var(--ui-warning);
    background: var(--ui-warning-bg);
    color: var(--ui-warning);
    font-size: 12px;
  }
  html[data-edition="space"] .capture-details .capture-step-url {
    margin: 10px 17px 0;
  }
  html[data-edition="space"] .capture-details .capture-image-slot {
    padding: 16px 17px;
  }
  html[data-edition="space"] .capture-details .capture-image-slot img {
    border: 1px solid var(--ui-line);
    border-radius: 4px;
  }
  @media (max-width: 600px) {
    html[data-edition="space"] .app-dialog.capture-dialog {
      width: calc(100vw - 20px);
      max-height: calc(100dvh - 20px);
    }
    html[data-edition="space"] .capture-dialog > :is(header, .dialog-body) {
      padding: 14px 12px;
    }
    html[data-edition="space"] .capture-details .capture-step-time {
      flex-basis: 100%;
    }
  }
  /* Company forms follow the compact controls and square panels of this edition. */
  html[data-edition="space"] .management-dialog.company-form-dialog {
    width: min(780px, calc(100vw - 32px));
    max-width: 780px !important;
    max-height: calc(100dvh - 48px);

    overflow: hidden;
  }
  html[data-edition="space"] .company-form-dialog[open] {
    display: flex;
    flex-direction: column;
  }
  html[data-edition="space"] .company-form-dialog > header {
    flex: 0 0 auto;
    padding: 16px 22px;
    background: var(--ui-soft);
    border-bottom: 1px solid var(--ui-line);
  }
  html[data-edition="space"] .company-form-dialog > header h2 {
    font-size: 18px !important;
    font-weight: 500;
    color: var(--ui-ink);
  }
  html[data-edition="space"] .company-form-dialog > .dialog-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 22px;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-line-strong) var(--ui-soft);
  }
  html[data-edition="space"] .company-form-dialog .form-grid {
    gap: 14px 20px;
  }
  html[data-edition="space"] .company-form-dialog .field {
    align-content: start;
  }
  html[data-edition="space"] .company-form-dialog .form-section {
    margin-top: 6px;
    padding-bottom: 8px;
    border-color: var(--ui-line);
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 500;
  }
  html[data-edition="space"] .company-form-dialog .form-section:first-child {
    margin-top: 0;
  }
  html[data-edition="space"] .company-form-dialog .field > span:first-child {
    font-size: 12px;
    font-weight: 400;
    color: var(--ui-muted);
  }
  html[data-edition="space"]
    .company-form-dialog
    .field
    :is(input, select, .form-menu-trigger) {
    box-sizing: border-box;
    height: 36px;
    min-height: 36px;
    padding: 7px 10px;
    background: var(--ui-surface);
    border: 1px solid var(--ui-line);
    border-radius: 4px;
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 400;
  }
  html[data-edition="space"]
    .company-form-dialog
    .field
    :is(input, select, .form-menu-trigger):focus-visible {
    outline: 2px solid var(--ui-line-strong);
    outline-offset: 1px;
  }
  html[data-edition="space"] .company-form-dialog .field small {
    color: var(--ui-muted);
    line-height: 1.4;
    font-size: 11px;
  }

  html[data-edition="space"] .company-form-footer {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--ui-line);
    background: var(--ui-soft);
  }
  html[data-edition="space"] .company-form-footer .form-feedback {
    flex-basis: 100%;
    margin: 0;
    font-size: 12px;
  }
  html[data-edition="space"] .company-form-footer .form-submit {
    background: var(--ui-brand) !important;
    border-color: var(--ui-brand);
  }
  @media (max-width: 600px) {
    html[data-edition="space"] .management-dialog.company-form-dialog {
      width: calc(100vw - 20px);
      max-height: calc(100dvh - 20px);
    }
    html[data-edition="space"] .company-form-dialog .form-grid {
      grid-template-columns: minmax(0, 1fr);
    }
    html[data-edition="space"]
      .company-form-dialog
      > :is(header, .dialog-body, .company-form-footer) {
      padding: 14px 16px;
    }
  }
  html[data-edition="space"] .employee-drawer > header {
    flex-shrink: 0;
  }
  html[data-edition="space"] .employee-drawer .dialog-body {
    min-height: 0;
    overscroll-behavior: contain;
  }
  html[data-edition="space"]
    :is(
      .worker-heading,
      .worker-heading .management-avatar,
      .company-metrics article
    ) {
    border-radius: 6px;
  }
  html[data-edition="space"] .dashboard-recent {
    padding-top: 0;
  }
  html[data-edition="space"]
    .app-shell
    :is(.classic-setting-card, .settings-addresses) {
    border: 1px solid var(--ui-line);
    border-radius: 6px;
    box-shadow: none;
  }
  html[data-edition="space"]
    .app-shell
    :is(.classic-setting-card h2, .settings-addresses h2) {
    color: var(--ui-ink);
    font-size: 17px;
    font-weight: 500;
  }
  html[data-edition="space"] .app-shell .dashboard-aside {
    border-radius: 6px;
    background: transparent;
    padding: 0;
    gap: 20px;
  }
  html[data-edition="space"] .app-shell .dashboard-calendar {
    padding: 20px;
  }
  html[data-edition="space"]
    .app-shell
    :is(.activity-charts, .dashboard-distribution) {
    border: 0;
    background: transparent;
  }

  html[data-edition="space"] .app-shell .bot-card-avatar {
    background: var(--ui-brand-soft);
  }
  html[data-edition="space"] .app-shell .bot-card-counts > span {
    background: var(--ui-brand);
  }
  html[data-edition="space"] .app-shell .calendar-day {
    border-color: transparent;
  }
  html[data-edition="space"] .app-shell .calendar-day[aria-pressed="true"] {
    background: var(--ui-brand);
    color: var(--ui-on-brand);
  }
  html[data-edition="space"] .classic-dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  html[data-edition="space"] .dashboard-father .classic-dashboard-layout {
    display: block;
  }
  html[data-edition="space"] .dashboard-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  @media (max-width: 1200px) {
    html[data-edition="space"] .classic-dashboard-layout {
      grid-template-columns: 1fr;
    }
    html[data-edition="space"] .dashboard-aside {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 18px;
    }
    html[data-edition="space"] .app-shell .sidebar,
    html[data-edition="space"] .app-shell .sidebar:hover,
    html[data-edition="space"] .app-shell .sidebar:focus-within {
      width: 205px;
    }
    html[data-edition="space"] .app-shell #page-content,
    html[data-edition="space"] .app-shell.has-company-picker #page-content {
      padding-inline: 22px;
    }
  }
  @media (max-width: 760px) {
    html[data-edition="space"] .app-shell .sidebar,
    html[data-edition="space"] .app-shell .sidebar:hover,
    html[data-edition="space"] .app-shell .sidebar:focus-within {
      width: 224px;
      transform: translateX(-100%);
      visibility: hidden;
      position: fixed;
      inset: 0 auto 0 0;
      margin: 0;
      height: 100%;
      transition:
        transform 0.2s,
        visibility 0.2s;
    }
    html[data-edition="space"] .app-shell.menu-open .sidebar,
    html[data-edition="space"] .app-shell.menu-open .sidebar:hover,
    html[data-edition="space"] .app-shell.menu-open .sidebar:focus-within {
      transform: none;
      visibility: visible;
    }
    html[data-edition="space"] .app-shell .workspace {
      margin-left: 0;
      width: 100%;
    }
    html[data-edition="space"] .app-shell .topbar {
      justify-content: flex-start;
      height: 65px;
      padding: 12px 14px;
      gap: 10px;
    }
    html[data-edition="space"] .space-topbar-title {
      font-size: 11px;
      letter-spacing: 0.7px;
    }
    html[data-edition="space"]
      .app-shell.has-company-picker
      .space-topbar-title {
      display: none;
    }
    html[data-edition="space"] .app-shell .company-picker {
      margin-left: auto;
    }
    html[data-edition="space"] .app-shell .company-select select {
      max-width: 230px;
    }
    html[data-edition="space"] .app-shell #page-content,
    html[data-edition="space"] .app-shell.has-company-picker #page-content {
      padding: 12px 14px 30px;
    }
    html[data-edition="space"] .app-shell .page-heading h1 {
      font-size: 26px;
    }
    html[data-edition="space"] .app-shell .management-toolbar .field,
    html[data-edition="space"] .app-shell .management-toolbar .search-field {
      min-width: min(100%, 170px);
    }
    html[data-edition="space"] .space-import .classic-upload-content {
      grid-template-columns: 1fr;
      gap: 5px;
      flex-basis: 100%;
    }
    html[data-edition="space"] .app-shell .space-import .import-controls {
      grid-column: 1;
      grid-row: 3;
      margin-top: 10px;
    }
    html[data-edition="space"] .app-shell .space-import .classic-upload-card {
      padding: 18px;
      gap: 12px;
    }
    html[data-edition="space"] .app-shell .classic-reports {
      padding: 18px;
    }

    html[data-edition="space"] .dashboard-overview,
    html[data-edition="space"] .dashboard-aside {
      grid-template-columns: 1fr;
    }
    html[data-edition="space"] .app-shell .company-select > span {
      display: none;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    html[data-edition="space"] .app-shell .sidebar {
      transition: none;
    }
  }
}
