@layer legacy {
  @font-face {
    font-family: Inter;
    src: local("Inter");
  }
  * {
    box-sizing: border-box;
  }
  body {
    margin: 0;
    font-family: var(--ui-font);
    color: var(--ui-ink);
    background: var(--ui-soft);
    font-size: 14px;
    line-height: 1.5;
  }
  button,
  input,
  select,
  textarea {
    font: inherit;
  }
  button,
  a,
  input,
  select,
  textarea {
    -webkit-tap-highlight-color: transparent;
  }
  button {
    cursor: pointer;
  }
  button:disabled {
    cursor: wait;
    opacity: 0.5;
  }
  a {
    color: var(--ui-brand-text);
    text-decoration: none;
  }
  h1,
  h2,
  h3,
  p {
    margin: 0;
  }
  button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: 3px solid var(--ui-brand-line);
    outline-offset: 3px;
  }
  [hidden] {
    display: none !important;
  }
  .app-shell {
    display: grid;
    grid-template-columns: 238px minmax(0, 1fr);
    min-height: 100vh;
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--ui-surface);
    border-right: 1px solid var(--ui-line);
    padding: 32px 20px 20px;
    display: flex;
    flex-direction: column;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ui-brand-text);
    font-size: 30px;
    font-weight: 760;
    letter-spacing: -1.2px;
  }
  .brand img {
    width: 32px;
    height: 32px;
    object-fit: contain;
  }
  .brand span {
    font-size: 11px;
    letter-spacing: 0.8px;
    font-weight: 600;
    align-self: flex-end;
    margin-bottom: 7px;
    text-transform: uppercase;
    color: var(--ui-muted);
  }
  .nav-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.8px;
    color: var(--ui-muted);
    margin: 45px 12px 18px;
  }
  .sidebar nav {
    display: grid;
    gap: 6px;
  }
  .sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--ui-muted);
    border-radius: 7px;
    padding: 11px 12px;
  }
  .sidebar nav a > span {
    font-size: 21px;
    line-height: 1;
    width: 22px;
    text-align: center;
  }
  .sidebar nav a:hover {
    background: var(--ui-soft);
  }
  .sidebar nav a[aria-current="page"] {
    background: var(--ui-brand-soft);
    color: var(--ui-brand-text);
    font-weight: 650;
  }
  .sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--ui-line);
    display: flex;
    gap: 10px;
    align-items: center;
    padding-top: 20px;
  }
  .sidebar-footer strong {
    display: block;
    font-size: 11px;
    max-width: 145px;
    overflow-wrap: anywhere;
  }
  .sidebar-footer small {
    display: block;
    font-size: 11px;
    color: var(--ui-muted);
  }
  .avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ui-brand-soft);
    color: var(--ui-brand-text);
    font-size: 12px;
  }
  .workspace {
    min-width: 0;
  }
  .topbar {
    height: 78px;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 38px;
    border-bottom: 1px solid var(--ui-line);
    background: color-mix(in srgb, var(--ui-surface) 72%, transparent);
  }
  .breadcrumb {
    font-size: 11px;
    color: var(--ui-muted);
  }
  .breadcrumb span {
    padding: 0 12px;
    color: var(--ui-muted);
  }
  .company-picker {
    margin-left: auto;
    max-width: 350px;
    font-size: 11px;
  }
  .company-select {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--ui-muted);
  }
  .company-select select {
    max-width: 240px;
    padding: 7px 10px;
    border: 1px solid var(--ui-line);
    border-radius: 6px;
    background: var(--ui-surface);
    color: var(--ui-muted);
    font-size: 11px;
  }

  .menu-toggle {
    display: none;
  }
  #page-content {
    padding: 38px;
    min-height: calc(100vh - 125px);
  }
  .page-stack {
    display: grid;
    gap: 26px;
    max-width: 1600px;
    margin: 0 auto;
  }
  .eyebrow {
    font-size: 11px;
    letter-spacing: 2px;
    font-weight: 750;
    color: var(--ui-muted);
  }
  .page-heading h1 {
    font-size: 30px;
    letter-spacing: -1.1px;
    line-height: 1.2;
    color: var(--ui-ink);
    font-weight: 600;
    margin: 10px 0;
  }
  .page-heading p {
    font-size: 12px;
    color: var(--ui-muted);
  }
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .panel {
    min-width: 0;
    overflow: hidden;
  }
  .panel-heading {
    border-bottom: 1px solid var(--ui-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .panel-heading p {
    margin-top: 4px;
  }

  .robot-view {
    min-width: 0;
    border-radius: 12px;
  }
  .robot-view robot-contrato {
    display: block;
  }
  .robot-view-tools {
    display: flex;
    justify-content: flex-end;
    padding: 8px;
  }
  .robot-view-tools button {
    font-size: 11px;
    background: transparent;
    border: 0;
    color: var(--ui-muted);
  }
  .quick-actions {
    display: flex;
    gap: 10px;
  }
  .button {
    white-space: nowrap;
    transition: background 0.15s;
  }

  .module-toolbar,
  .directory-toolbar,
  .import-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 15px;
    padding: 20px 24px;
  }
  .module-toolbar {
    justify-content: flex-end;
  }
  .directory-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 24px 20px;
  }
  .directory-filters .field {
    min-width: 130px;
    flex: 1;
  }
  .directory-filters input,
  .directory-filters select {
    font-size: 11px;
  }
  .directory-toolbar .field:first-child {
    flex: 1;
    min-width: 200px;
  }
  .field {
    display: grid;
    gap: 7px;
    min-width: 0;
  }
  .field > span {
    font-size: 11px;
    font-weight: 550;
    color: var(--ui-muted);
  }
  .field input,
  .field select,
  .field textarea {
    width: 100%;
    border: 1px solid var(--ui-line);
    border-radius: 6px;
    padding: 10px 12px;
    background: var(--ui-surface);
    color: var(--ui-ink);
    min-height: 40px;
    font-size: 12px;
  }
  .field input::placeholder {
    color: var(--ui-muted);
  }
  .field small {
    font-size: 11px;
    line-height: 1.6;
    color: var(--ui-muted);
  }
  .form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
  .form-submit,
  .form-feedback {
    grid-column: 1/-1;
  }
  .form-feedback {
    color: var(--ui-danger);
    font-size: 12px;
    background: var(--ui-danger-bg);
    border-radius: 6px;
    padding: 12px;
  }

  .person-cell strong {
    display: block;
    font-size: 12px;
    color: var(--ui-ink);
    font-weight: 600;
  }
  .person-cell small {
    display: block;
    font-size: 11px;
    color: var(--ui-muted);
    margin-top: 3px;
  }
  .table-actions {
    white-space: nowrap;
  }

  .empty-state {
    padding: 35px;
    text-align: center;
    color: var(--ui-muted);
    font-size: 12px;
    white-space: pre-wrap;
  }
  .empty-state.error {
    background: var(--ui-danger-bg);
    color: var(--ui-danger);
    border-radius: 8px;
  }
  .workspace-footer {
    padding: 15px 38px;
    color: var(--ui-muted);
    font-size: 11px;
    letter-spacing: 0.4px;
    border-top: 1px solid var(--ui-line);
  }
  .settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }
  .settings-grid > section:last-child {
    grid-column: 1/-1;
  }
  .app-dialog {
    width: min(760px, 92vw);
    max-height: 90vh;
  }
  .app-dialog::backdrop {
    backdrop-filter: blur(3px);
  }
  .app-dialog > header {
    position: sticky;
    top: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

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

  .dialog-body {
    padding: 26px;
  }
  .dialog-body > div > p {
    margin-bottom: 20px;
  }
  .detail-list {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px;
    font-size: 12px;
  }
  .detail-list dt {
    color: var(--ui-muted);
  }
  .detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
  }
  .capture-gallery {
    display: grid;
    gap: 20px;
  }
  .capture-gallery figure {
    margin: 0;
  }
  .capture-gallery img {
    width: 100%;
    border: 1px solid var(--ui-line);
    border-radius: 6px;
  }
  .capture-gallery figcaption {
    font-size: 12px;
    margin-top: 8px;
    color: var(--ui-muted);
  }
  .import-panel .import-controls {
    padding: 0 0 20px;
  }
  .import-summary {
    color: var(--ui-muted);
    font-size: 12px;
    margin: 12px 0;
  }
  .import-results > .button {
    margin-top: 20px;
  }
  #notifications {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2000;
    display: grid;
    gap: 8px;
    max-width: min(420px, 90vw);
  }
  .toast {
    border: 1px solid var(--ui-brand-line);
    box-shadow: 0 10px 35px #34527a22;
    background: var(--ui-surface);
    border-radius: 8px;
    padding: 16px 22px;
    color: var(--ui-muted);
    font-size: 12px;
  }
  .toast.error {
    border-color: var(--ui-danger-line);
    color: var(--ui-danger);
  }
  .boot-state {
    display: grid;
    place-items: center;
    height: 100vh;
    color: var(--ui-muted);
    font-size: 13px;
  }
  .login-page {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    min-height: 100vh;
    background: var(--ui-surface);
  }
  .login-story {
    background: var(--ui-brand-soft);
    padding: 65px 10%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
  }
  .login-story > .eyebrow {
    margin-top: 100px;
  }
  .login-story h1 {
    font-size: clamp(35px, 4vw, 62px);
    line-height: 1.08;
    color: var(--ui-ink);
    letter-spacing: -2.2px;
    margin: 20px 0;
    font-weight: 550;
  }
  .login-story > p {
    color: var(--ui-muted);
    font-size: 14px;
    max-width: 340px;
    line-height: 1.9;
  }
  .login-story > small {
    margin-top: auto;
    color: var(--ui-muted);
    font-size: 11px;
  }
  .login-illustration {
    margin: 65px 0;
    display: flex;
    width: 100%;
    gap: 6px;
    position: relative;
    padding-top: 100px;
  }
  .login-illustration span {
    flex: 1;
    font-size: 11px;
    border-top: 1px solid var(--ui-brand-line);
    padding-top: 15px;
    color: var(--ui-muted);
  }
  .architecture-line {
    position: absolute;
    inset: 0 8% 50px;
    background:
      linear-gradient(
        145deg,
        transparent 46%,
        #9bbce24f 47%,
        #9bbce24f 48%,
        transparent 49%
      ),
      linear-gradient(
        35deg,
        transparent 46%,
        #9bbce24f 47%,
        #9bbce24f 48%,
        transparent 49%
      );
    background-size: 110px 60px;
    transform: skewY(-8deg);
  }
  .login-form-panel {
    display: grid;
    place-items: center;
    padding: 45px;
  }
  .login-form-content {
    width: min(100%, 355px);
  }
  .login-form-content h2 {
    font-size: 28px;
    font-weight: 550;
    letter-spacing: -0.8px;
    margin: 10px 0;
    color: var(--ui-ink);
  }
  .login-form-content > p {
    color: var(--ui-muted);
    font-size: 12px;
    margin-bottom: 32px;
  }
  .login-form-content .form-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .login-form-content input {
    padding: 13px;
  }
  .login-form-content .primary {
    margin-top: 7px;
    padding: 13px;
  }
  .login-link {
    display: block;
    font-size: 11px;
    margin-top: 22px;
    text-align: center;
  }
  .login-link.muted {
    color: var(--ui-muted);
    margin-top: 40px;
  }
  .status-detail {
    font-size: 12px;
    overflow-wrap: anywhere;
  }
  @media (min-width: 1700px) {
    #page-content {
      padding: 50px 60px;
    }
    .topbar {
      padding: 0 60px;
    }
  }
  @media (max-width: 1100px) {
    .app-shell {
      grid-template-columns: 195px minmax(0, 1fr);
    }
    .sidebar {
      padding: 25px 12px;
    }
    .brand {
      font-size: 26px;
    }
    .brand span {
      display: none;
    }
    .sidebar nav a {
      font-size: 11px;
    }
    #page-content {
      padding: 26px;
    }
    .topbar {
      padding: 0 26px;
    }
    .breadcrumb {
      display: none;
    }
    .settings-grid {
      grid-template-columns: 1fr;
    }
    .page-heading h1 {
      font-size: 26px;
    }
    .table-actions {
      white-space: normal;
    }
    .stats-grid {
      gap: 10px;
    }

    .login-story {
      padding: 45px 9%;
    }
  }
  @media (max-width: 760px) {
    .app-shell {
      display: block;
    }
    .sidebar {
      position: fixed;
      left: -250px;
      visibility: hidden;
      width: 238px;
      z-index: 50;
      box-shadow: 20px 0 60px #21456d20;
      transition: left 0.2s;
    }
    .menu-open .sidebar {
      left: 0;
      visibility: visible;
    }
    .menu-toggle {
      display: block;
      border: 0;
      background: transparent;
      color: var(--ui-brand-text);
      padding: 10px;
      margin-left: -10px;
    }
    .topbar {
      height: 65px;
      padding: 0 20px;
      gap: 10px;
    }
    .company-picker {
      max-width: calc(100% - 90px);
    }
    .company-select > span {
      display: none;
    }
    .company-select select {
      max-width: 185px;
    }
    .page-heading h1 {
      font-size: 24px;
      letter-spacing: -0.7px;
    }
    .page-heading p {
      font-size: 11px;
      line-height: 1.8;
    }
    #page-content {
      padding: 24px 16px;
    }
    .page-stack {
      gap: 20px;
    }
    .stats-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 7px;
    }

    .directory-toolbar,
    .module-toolbar {
      padding: 16px;
    }
    .directory-filters {
      padding: 0 16px 16px;
    }
    .directory-filters .field {
      min-width: 100px;
    }

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

    .quick-actions {
      flex-wrap: wrap;
    }
    .workspace-footer {
      padding: 15px 20px;
    }
    .login-page {
      display: block;
    }
    .login-story {
      padding: 30px;
      min-height: 300px;
    }
    .login-story > .eyebrow {
      margin-top: 35px;
    }
    .login-story h1 {
      font-size: 36px;
      margin: 12px 0;
    }
    .login-story > p {
      font-size: 12px;
    }
    .login-story > small,
    .login-illustration {
      display: none;
    }
    .login-form-panel {
      padding: 40px 24px;
    }

    .dialog-body {
      padding: 20px;
    }
    .detail-list {
      grid-template-columns: 1fr;
    }
    .detail-list dd {
      margin-bottom: 12px;
    }
  }
  .documentation-page {
    max-width: 1000px;
    margin: auto;
    padding: 40px 24px 64px;
  }
  .documentation-page .panel-body:empty {
    display: none;
  }
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      transition: none !important;
      animation-duration: 0.01ms !important;
    }
  }
}
