/* =========================================================
   NickAcademy Brazil — Internal Team Hub
   Light-first token system with full dark support.
   ========================================================= */

:root {
  /* brand */
  --blue: #1565C0;
  --blue-bright: #1783FF;
  --blue-deep: #0D47A1;
  --orange: #FF7A1A;
  --orange-soft: #FFF1E5;

  /* surfaces */
  --bg: #F7F9FC;
  --surface: #FFFFFF;
  --surface-2: #EFF4FA;
  --surface-3: #E7EEF7;
  --ink: #10213A;
  --ink-2: #44546A;
  --ink-3: #62748E;
  --line: #E3E9F2;
  --line-strong: #CBD6E4;

  --brand-tint: #E9F1FC;
  --brand-tint-ink: #0D47A1;
  --accent: var(--blue);
  --accent-ink: #FFFFFF;
  --link: #1268C3;

  --good: #0E9F6E;
  --good-tint: #E3F5EE;
  --warn: #B45309;
  --warn-tint: #FCF1DF;
  --danger: #D23B3B;
  --danger-tint: #FBEAEA;

  --shadow-1: 0 1px 2px rgba(16, 33, 58, .05), 0 1px 6px rgba(16, 33, 58, .04);
  --shadow-2: 0 4px 14px rgba(16, 33, 58, .08), 0 1px 3px rgba(16, 33, 58, .05);
  --shadow-3: 0 14px 40px rgba(16, 33, 58, .16);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  --font-ui: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;

  /* official Figma lockups: blue on light, white on dark */
  --logo-light: block;
  --logo-dark: none;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1422;
    --surface: #141F31;
    --surface-2: #1B2940;
    --surface-3: #223350;
    --ink: #E8EEF7;
    --ink-2: #A9B8CD;
    --ink-3: #718098;
    --line: #24344E;
    --line-strong: #35496A;
    --brand-tint: #17304F;
    --brand-tint-ink: #8FC0FF;
    --accent: #1783FF;
    --accent-ink: #FFFFFF;
    --link: #5FA8FF;
    --orange-soft: #3A2513;
    --good-tint: #123227;
    --warn-tint: #362811;
    --warn: #E5A455;
    --danger-tint: #3A1D1D;
    --danger: #F07A7A;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 4px 14px rgba(0, 0, 0, .35);
    --shadow-3: 0 14px 40px rgba(0, 0, 0, .5);
    --logo-light: none;
    --logo-dark: block;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1422;
  --surface: #141F31;
  --surface-2: #1B2940;
  --surface-3: #223350;
  --ink: #E8EEF7;
  --ink-2: #A9B8CD;
  --ink-3: #718098;
  --line: #24344E;
  --line-strong: #35496A;
  --brand-tint: #17304F;
  --brand-tint-ink: #8FC0FF;
  --accent: #1783FF;
  --accent-ink: #FFFFFF;
  --link: #5FA8FF;
  --orange-soft: #3A2513;
  --good-tint: #123227;
  --warn-tint: #362811;
  --warn: #E5A455;
  --danger-tint: #3A1D1D;
  --danger: #F07A7A;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-3: 0 14px 40px rgba(0, 0, 0, .5);
  --logo-light: none;
  --logo-dark: block;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; padding: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* ---------- header ---------- */
.hub-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.hub-header .wrap {
  display: flex; align-items: center; gap: 16px;
  min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 26px; width: auto; }
.brand .logo-light { display: var(--logo-light); }
.brand .logo-dark { display: var(--logo-dark); }
.brand .brand-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand .brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand .brand-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search-trigger {
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--ink-3);
  font-size: 13.5px;
  min-width: 230px;
  transition: border-color .15s ease, background .15s ease;
}
.search-trigger:hover { border-color: var(--line-strong); background: var(--surface); }
.search-trigger .kbd { margin-left: auto; }
.kbd {
  font-family: var(--font-mono); font-size: 11px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; color: var(--ink-3);
  background: var(--surface);
}

.lang-switch {
  display: flex; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: var(--surface-2);
}
.lang-switch button {
  min-width: 44px; min-height: 40px; font-size: 13px; font-weight: 600;
  color: var(--ink-3); transition: background .15s ease, color .15s ease;
}
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.lang-switch button:not([aria-pressed="true"]):hover { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: 10px; font-weight: 600; font-size: 13.5px;
  transition: background .15s ease, box-shadow .15s ease, transform .1s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: var(--blue-deep); }
:root[data-theme="dark"] .btn-primary:hover,
:root:not([data-theme="light"]) .btn-primary:hover { background: var(--blue-bright); }
.btn-ghost { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--line-strong); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn svg { flex: 0 0 auto; }

/* ---------- section nav ---------- */
.section-nav {
  position: sticky; top: 64px; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.section-nav .wrap {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding-top: 6px; padding-bottom: 6px;
}
.section-nav .wrap::-webkit-scrollbar { display: none; }
.section-nav a {
  flex: 0 0 auto;
  padding: 7px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: background .15s ease, color .15s ease;
}
.section-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.section-nav a.active { background: var(--brand-tint); color: var(--brand-tint-ink); }

/* ---------- hero strip ---------- */
.hero { padding: 34px 0 6px; }
.hero h1 {
  margin: 0; font-size: clamp(24px, 3.4vw, 32px); font-weight: 700;
  letter-spacing: -.02em; text-wrap: balance;
}
.hero h1 .flag { font-size: .8em; margin-left: 6px; }
.hero p { margin: 6px 0 0; color: var(--ink-2); font-size: 15.5px; max-width: 60ch; }

/* ---------- sections ---------- */
.section { padding: 26px 0 6px; scroll-margin-top: 128px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-head h2 {
  margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 9px;
}
.section-head h2 svg { color: var(--accent); }
.section-head .count { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.section-head .head-note { margin-left: auto; color: var(--ink-3); font-size: 12.5px; }

/* ---------- card grids ---------- */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.grid-wide { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }

/* resource card */
.card {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-1);
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}
.card:hover { box-shadow: var(--shadow-2); border-color: var(--line-strong); transform: translateY(-2px); }
.card-top { display: flex; align-items: flex-start; gap: 12px; }
.card-icon {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-tint-ink);
}
.card-icon.orange { background: var(--orange-soft); color: var(--orange); }
.card-titles { min-width: 0; }
.card-titles h3 { margin: 0; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.card-titles p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.card-tools { margin-left: auto; display: flex; gap: 2px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; color: var(--ink-3);
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.faved { color: var(--orange); }
.icon-btn.faved:hover { color: var(--orange); }

.card-cta { margin-top: auto; display: flex; align-items: center; gap: 8px; }
.card-cta .btn { min-height: 36px; font-size: 13px; padding: 0 13px; }
.type-chip {
  margin-left: auto; font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-3);
}

/* placeholder state */
.ph {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--warn); background: var(--warn-tint);
  border: 1px dashed color-mix(in srgb, var(--warn) 45%, transparent);
  border-radius: 7px; padding: 3px 9px;
}
.mono { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- demo launcher ---------- */
.launcher-band {
  background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 20px;
  box-shadow: var(--shadow-2);
  padding: 20px;
}
.launcher-intro { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.launcher-intro p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.launcher-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.launch-card {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg);
  overflow: hidden;
  transition: border-color .15s ease;
}
.launch-card[open], .launch-card:hover { border-color: var(--line-strong); }
.launch-summary {
  list-style: none; display: flex; align-items: center; gap: 11px;
  padding: 13px 14px; cursor: pointer; user-select: none;
}
.launch-summary::-webkit-details-marker { display: none; }
.launch-summary .card-icon { width: 34px; height: 34px; border-radius: 9px; }
.launch-summary strong { font-size: 14px; letter-spacing: -.01em; }
.launch-summary .env { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.launch-summary .chev { margin-left: auto; color: var(--ink-3); transition: transform .18s ease; }
.launch-card[open] .chev { transform: rotate(180deg); }
.launch-body { padding: 2px 14px 14px; display: flex; flex-direction: column; gap: 8px; }

.cred-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 8px 7px 12px;
}
.cred-row .cred-label {
  flex: 0 0 74px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3);
}
.cred-row .cred-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cred-row .icon-btn { width: 30px; height: 30px; }
.launch-actions { display: flex; gap: 8px; margin-top: 4px; }
.launch-actions .btn { flex: 1; min-height: 38px; font-size: 13px; }

/* ---------- recently used ---------- */
.recent-row { display: flex; gap: 8px; flex-wrap: wrap; }
.recent-chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 7px 14px 7px 9px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.recent-chip:hover { border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow-1); }
.recent-chip .dot {
  width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-tint-ink);
}

/* ---------- library filter chips ---------- */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.cat-block { margin-bottom: 22px; scroll-margin-top: 128px; }
.cat-block > h3 {
  margin: 0 0 10px; font-size: 13px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
  display: flex; align-items: center; gap: 8px;
}

/* ---------- empty states ---------- */
.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
  padding: 22px; text-align: center; color: var(--ink-3); font-size: 13.5px;
}

/* ---------- command palette ---------- */
.palette-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(9, 17, 30, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.palette {
  width: min(620px, 100%);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-3);
  overflow: hidden; display: flex; flex-direction: column;
  max-height: 62vh;
}
.palette-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette-input-row svg { color: var(--ink-3); flex: 0 0 auto; }
.palette input {
  flex: 1; border: none; outline: none; background: transparent;
  font: inherit; font-size: 15.5px; color: var(--ink);
}
.palette input::placeholder { color: var(--ink-3); }
.palette-list { overflow-y: auto; padding: 8px; }
.palette-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  padding: 10px 11px; border-radius: 10px;
}
.palette-item .card-icon { width: 32px; height: 32px; border-radius: 8px; }
.palette-item .pi-txt { min-width: 0; flex: 1; }
.palette-item .pi-title { font-size: 14px; font-weight: 600; }
.palette-item .pi-sub { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-cat { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.palette-item[aria-selected="true"] { background: var(--brand-tint); }
.palette-item[aria-selected="true"] .pi-title { color: var(--brand-tint-ink); }
.palette-footer {
  display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 11.5px;
}
.palette-empty { padding: 26px 16px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

/* ---------- modal / drawer ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(9, 17, 30, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  width: min(520px, 100%);
  max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-3);
  padding: 22px;
}
.modal h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.01em; }
.modal .modal-sub { margin: 0 0 16px; color: var(--ink-2); font-size: 13px; }
.modal form { display: grid; gap: 13px; grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 12px; min-height: 40px;
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent);
}
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.modal-actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.acct-fields {
  grid-column: 1 / -1; display: grid; gap: 13px; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  background: var(--surface-2);
}
.acct-fields .acct-title { grid-column: 1 / -1; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
@media (max-width: 560px) {
  .modal form, .acct-fields { grid-template-columns: 1fr; }
}

/* ---------- toast ---------- */
.toast-stack {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--ink); color: var(--bg);
  border-radius: 999px; padding: 9px 18px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-2);
  animation: toast-in .22s ease;
}
.toast svg { color: #4ADE80; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- footer ---------- */
.hub-footer {
  margin-top: 44px; border-top: 1px solid var(--line);
  padding: 22px 0 34px; color: var(--ink-3); font-size: 12.5px;
}
.hub-footer .wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hub-footer .sec { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- responsive header ---------- */
@media (max-width: 860px) {
  .search-trigger { min-width: 0; }
  .search-trigger .label, .search-trigger .kbd { display: none; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; }
  .btn-add .label { display: none; }
  .btn-add { width: 40px; padding: 0; }
}
@media (max-width: 640px) {
  .brand .brand-sub { display: none; }
  .brand img { height: 22px; }
  .hero { padding-top: 24px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .grid-wide { grid-template-columns: 1fr; }
  .card { padding: 13px; }
  .card-titles p { display: none; }
  .launcher-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
  .card-titles p { display: block; }
}

/* entrance (first paint only, JS adds .ready to stop replays) */
@media (prefers-reduced-motion: no-preference) {
  main:not(.ready) .section { animation: rise .4s ease both; }
  main:not(.ready) .section:nth-child(2) { animation-delay: .05s; }
  main:not(.ready) .section:nth-child(3) { animation-delay: .1s; }
  main:not(.ready) .section:nth-child(4) { animation-delay: .15s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
