:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --text: #111827;
  --muted: #64748b;
  --line: #d0d7de;
  --brand: #050a30;
  --brand-2: #1e3a8a;
  --brand-3: #2563eb;
  --brand-soft: #eef4ff;
  --brand-line: #c7d7f5;
  --ok: #137a4d;
  --warning: #9a6b12;
  --danger: #a3261f;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(5, 10, 48, 0.88), rgba(30, 58, 138, 0.88)),
    #050a30;
}

a {
  color: var(--brand);
  font-weight: 700;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 24px;
  background: var(--brand);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: var(--brand-2);
  color: #fff;
  font-size: 11px;
  letter-spacing: 0;
}

.main-nav {
  display: flex;
  gap: 2px;
}

.main-nav a {
  padding: 6px 8px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 650;
  text-decoration: none;
  border-radius: 6px;
}

.main-nav a:hover,
.main-nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px;
}

body[data-page="apps"] main {
  max-width: 1400px;
}

.page-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 8px 0 2px;
}

.page-title h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: 0;
}

.page-title p:last-child {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.panel {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: none;
}

.panel.compact {
  padding-bottom: 10px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

h2,
h3,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.button,
button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.button.primary,
button.primary {
  background: var(--brand-2);
  border-color: var(--brand-2);
  color: #fff;
}

.button.primary:hover,
button.primary:hover {
  background: var(--brand);
  border-color: var(--brand);
}

.button.secondary:hover,
button:hover {
  border-color: var(--brand-2);
}

.table-wrap,
.panel {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.catalog-table {
  min-width: 1280px;
}

.catalog-table th:nth-child(1) { width: 21%; }
.catalog-table th:nth-child(2) { width: 10%; }
.catalog-table th:nth-child(3) { width: 31%; }
.catalog-table th:nth-child(4) { width: 7%; }
.catalog-table th:nth-child(5) { width: 8%; }
.catalog-table th:nth-child(6) { width: 14%; }
.catalog-table th:nth-child(7) { width: 9%; }

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #eef4ff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 16px;
}

.badge,
.status-ok {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e6f5ef;
  color: var(--ok);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.muted {
  background: #edf2f7;
  color: var(--muted);
}

.manual-list,
.steps {
  margin: 0;
  padding-left: 18px;
}

.manual-list.columns {
  columns: 2;
}

.manual-list li,
.steps li {
  margin: 6px 0;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 18px;
  padding-left: 20px;
}

.muted {
  color: var(--muted);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 8px 24px 24px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 320px;
  padding: 12px 14px;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
}

.login-shell {
  width: min(100%, 430px);
  padding: 24px;
}

.login-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

.login-card p {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 8px;
  margin: 18px 0 12px;
}

.login-form label {
  font-weight: 800;
}

.login-form input {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.login-form button {
  width: 100%;
  background: var(--brand-2);
  border-color: var(--brand-2);
  color: #fff;
}

.login-error,
.login-ok {
  margin: 12px 0 0;
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 650;
}

.login-error { background: #fdecec; color: #a3261f; }
.login-ok { background: #e6f5ef; color: var(--ok); }

.login-powered {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.repo-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 18px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.repo-title {
  min-width: 0;
}

.repo-title h1 {
  margin: 0 0 4px;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

.repo-title p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.repo-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.repo-meta {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 4px 0 0;
  color: var(--muted);
}

.repo-meta div {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.repo-meta dt {
  font-size: 12px;
  font-weight: 800;
}

.repo-meta dd {
  margin: 0;
  color: var(--brand);
  font-weight: 800;
}

.repo-readme {
  margin-bottom: 18px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.repo-readme h2 {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}

.repo-readme ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.welcome-links {
  display: grid;
  gap: 0;
}

.welcome-links a {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.welcome-links a:last-child {
  border-bottom: 0;
}

.welcome-links span {
  color: var(--muted);
}

.welcome-panel {
  display: grid;
  gap: 12px;
  margin: 22px 0 18px;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(30, 58, 138, 0.08), rgba(30, 58, 138, 0)),
    var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-2);
  border-radius: 6px;
}

.welcome-panel h1 {
  max-width: 820px;
  margin: 0;
  font-size: 38px;
  line-height: 1.12;
  letter-spacing: 0;
}

.welcome-copy {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.decision-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0 0;
  padding: 0;
  align-items: center;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.decision-flow span {
  color: var(--muted);
  font-weight: 700;
}

.embed-main {
  max-width: none;
  padding: 14px 24px 18px;
}

.embed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto 12px;
}

.embed-toolbar h1 {
  margin: 0;
  font-size: 22px;
}

.embed-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.embed-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 180px);
  background: #000;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 2px 0 8px;
}

.section-heading h2 {
  margin: 0;
}

.catalog-panel {
  padding-top: 12px;
}

.path-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.path-card {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand-2);
  border-radius: 6px;
}

.path-card h2 {
  font-size: 18px;
}

.path-card .button {
  align-self: flex-start;
  margin-top: auto;
}

.path-steps {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

/* Catálogo: controles, agrupamento e tabela operacional */
.catalog-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.catalog-controls .control {
  display: grid;
  gap: 4px;
}

.catalog-controls label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
}

.catalog-controls input,
.catalog-controls select {
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.catalog-controls #catalog-search {
  min-width: 220px;
}

.check-control {
  margin-left: auto;
}

.check-control label {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  text-transform: none;
}

.check-control input {
  width: 14px;
  height: 14px;
  min-height: auto;
  padding: 0;
  border: 0;
}

.catalog-group + .catalog-group {
  margin-top: 20px;
}

.group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.group-heading .count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #edf2f7;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.catalog-empty {
  padding: 12px 4px;
}

.manual-links,
.catalog-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 7px;
}

.manual-links a {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.catalog-actions .button {
  min-height: 30px;
  padding-right: 9px;
  padding-left: 9px;
}

.catalog-table td:nth-child(3) {
  color: var(--muted);
}

.team-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.team-add input {
  flex: 1;
  min-width: 220px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.team-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.permission-toolbar {
  display: grid;
  gap: 12px;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.toggle-line.small {
  font-size: 13px;
  font-weight: 600;
}

.toggle-line input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.permission-user {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.permission-user:first-child {
  padding-top: 0;
}

.permission-user:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.permission-user-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.permission-user-head h2 {
  margin-bottom: 2px;
  font-size: 17px;
  word-break: break-word;
}

.permission-user-head p {
  margin-bottom: 0;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.permission-app {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.permission-versions {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-left: 24px;
}

@media (max-width: 760px) {
  .topbar,
  .page-title,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .main-nav {
    flex-wrap: wrap;
  }

  main {
    padding: 18px;
  }

  .split,
  .steps,
  .path-grid {
    grid-template-columns: 1fr;
  }

  .repo-header {
    grid-template-columns: 1fr;
  }

  .repo-actions {
    order: 3;
  }

  .repo-meta {
    gap: 6px 12px;
  }

  .welcome-panel h1 {
    font-size: 30px;
  }

  .welcome-panel {
    padding: 20px;
  }

  .welcome-links a {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .embed-main {
    padding: 12px;
  }

  .embed-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .embed-actions {
    justify-content: flex-start;
  }

  .embed-frame {
    min-height: calc(100vh - 250px);
  }

  .manual-list.columns {
    columns: 1;
  }

  .check-control {
    margin-left: 0;
  }

  .permission-user-head {
    flex-direction: column;
  }
}
