/* ============ TOKENS ============ */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e6e8ec;
  --text: #16181d;
  --text-2: #5d6470;
  --text-3: #9aa1ad;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #e3ecfb;
  --green: #16a34a;
  --green-soft: #e8f7ee;
  --amber: #d97706;
  --amber-soft: #fdf3e3;
  --red: #dc2626;
  --red-soft: #fdecec;
  --shadow: 0 1px 2px rgba(16, 18, 27, .04);
  --radius: 10px;
}

[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #16191f;
  --surface-2: #1c2027;
  --border: #262b33;
  --text: #eef0f4;
  --text-2: #a3abb8;
  --text-3: #6b7280;
  --accent: #5b9bd5;
  --accent-hover: #84b8e4;
  --accent-soft: #16283d;
  --green: #34d399;
  --green-soft: #12362a;
  --amber: #fbbf24;
  --amber-soft: #3a2f12;
  --red: #f87171;
  --red-soft: #3c1a1a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

/* ============ BASE ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

.app { display: flex; min-height: 100vh; }

/* ============ SIDEBAR ============ */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 10px 20px;
}

.brand-logo { height: 26px; width: auto; display: block; }
.brand-logo--light { display: none; }
[data-theme="dark"] .brand-logo--light { display: block; }
[data-theme="dark"] .brand-logo--dark { display: none; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-3);
  padding: 0 10px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: var(--surface-2); color: var(--text); }

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-item--logout {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  border-radius: 0 9px 9px 0;
  color: var(--red);
}
.nav-item--logout:hover { background: var(--red-soft); color: var(--red); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-2);
  transition: color .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-3); }
.theme-toggle svg { width: 15px; height: 15px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============ MAIN ============ */
.main {
  flex: 1;
  padding: 24px 32px 48px;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* ---- Busca ---- */
.search-box {
  width: 230px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text-3);
}
.search-box svg { width: 15px; height: 15px; }
.search-box input {
  border: none;
  outline: none;
  background: none;
  font: inherit;
  color: var(--text);
  width: 100%;
}

.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot--online { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
}
.btn svg { width: 15px; height: 15px; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
[data-theme="dark"] .btn--primary { color: #10121a; }

.btn--ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-2);
  padding: 8px 12px;
}
.btn--ghost:hover { color: var(--text); border-color: var(--text-3); }

/* ---- Hero ---- */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 8px 4px 0;
}

.hero h1 { font-size: 24px; font-weight: 700; letter-spacing: -.5px; }

.hero__ssh {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}
.hero__ssh-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); white-space: nowrap; }
.hero__ssh-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  padding-right: 12px;
  border-right: 1px solid var(--border);
}
.hero__ssh code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
}
.hero__ssh .btn { padding: 7px 9px; }

.hero__ssh-cmd {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Recursos do plano ---- */
.plan__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.plan__header h2 { font-size: 18px; font-weight: 700; letter-spacing: -.4px; }
.plan__header p { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.plan__auto { font-size: 12.5px; font-weight: 600; color: var(--accent); }

.plan__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.resource {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .15s;
}
.resource:hover { border-color: var(--text-3); }

.resource__icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}
.resource__icon svg { width: 22px; height: 22px; }

.resource__label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-3);
}
.resource__value { font-size: 24px; font-weight: 700; letter-spacing: -.5px; }

.resource__usage {
  align-self: flex-start;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 12px;
}
.resource__usage b { font-weight: 700; }

/* ---- Features (segurança, snapshot) ---- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  transition: border-color .15s;
}
.feature:hover { border-color: var(--text-3); }

.feature__text {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.2px;
  line-height: 1.45;
  margin: 4px 0 10px;
  flex: 1;
}

.feature__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background .15s, color .15s, opacity .15s;
}
.feature__btn:hover { background: var(--accent); color: #fff; }
[data-theme="dark"] .feature__btn:hover { color: #10121a; }
.feature__btn:disabled { opacity: .6; cursor: wait; background: var(--surface); color: var(--accent); }
.feature__btn svg { width: 14px; height: 14px; }

/* ---- Instalar aplicativos ---- */
.inline-code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 2px 7px;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.apps-more {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  transition: border-color .15s;
}
.app-card:hover { border-color: var(--text-3); }

.app-card__icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 8px;
}

.app-card__name { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }

.app-card__desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
  flex: 1;
  margin-bottom: 10px;
}

.app-card__btn {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.app-card__btn:hover { background: var(--accent-hover); }
[data-theme="dark"] .app-card__btn { color: #10121a; }
.app-card__btn:disabled { opacity: .65; cursor: wait; }

.app-card__btn--installed {
  background: var(--surface);
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.app-card__btn--installed:hover { background: var(--accent-soft); }
[data-theme="dark"] .app-card__btn--installed { color: var(--accent); }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card__header h2 { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.card__hint { font-size: 12.5px; color: var(--text-2); }

/* ---- Status do ambiente ---- */
.env-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow);
}

.env-checks {
  list-style: none;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.env-checks li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  opacity: 0;
  transform: translateY(5px);
  animation: env-in .45s cubic-bezier(.2, .7, .3, 1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes env-in { to { opacity: 1; transform: none; } }

.env-tick {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.env-tick svg { width: 11px; height: 11px; }

.env-live {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green);
}
.env-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: env-pulse 2s ease-out infinite;
}
@keyframes env-pulse {
  0% { box-shadow: 0 0 0 0 var(--green-soft); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  box-shadow: var(--shadow);
}

.tab {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-2);
  background: none;
  border: none;
  border-radius: 9px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: tab-in .2s ease-out;
}
.tab-panel[hidden] { display: none; }
@keyframes tab-in { from { opacity: 0; transform: translateY(4px); } }

/* ---- Table ---- */
.card--table { padding-bottom: 8px; }

.table__tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Controles da tabela com a mesma altura (UX consistente) */
.table__tools .search-box,
.table__tools .select,
.table__tools .btn,
.apps-tools .search-box,
.apps-tools .select {
  height: 38px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 13.5px;
}
.table__tools .search-box { width: 240px; }
.table__tools .btn { padding-left: 16px; padding-right: 16px; }

/* ---- Busca e filtro de aplicativos ---- */
.apps-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.apps-tools .search-box { width: 260px; }

.apps-empty {
  text-align: center;
  color: var(--text-3);
  padding: 24px 0 8px;
}
.apps-empty[hidden] { display: none; }

.select {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 34px 0 12px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%239aa1ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.select:hover { color: var(--text); }
.select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 13px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }

.proj { display: flex; align-items: center; gap: 11px; }
.proj__icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.proj__name { font-weight: 600; }
.proj__repo { font-size: 12px; color: var(--text-3); }

.domain-link { color: var(--text-2); text-decoration: none; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.domain-link:hover { color: var(--accent); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 11px;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--online { background: var(--green-soft); color: var(--green); }
.badge--building { background: var(--amber-soft); color: var(--amber); }
.badge--error { background: var(--red-soft); color: var(--red); }
.badge--building::before { animation: pulse 1.1s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: .35; } }

.row-date { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }

.row-actions { text-align: right; }
.icon-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 6px;
  border-radius: 7px;
  transition: all .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

.table-empty { text-align: center; color: var(--text-3); padding: 28px 0 20px; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(10, 12, 18, .45); backdrop-filter: blur(3px); }
.modal__box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: min(440px, calc(100vw - 40px));
  padding: 22px 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  animation: modal-in .18s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.modal__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal__header h2 { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.modal__close {
  background: none; border: none;
  font-size: 22px; line-height: 1;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 7px;
}
.modal__close:hover { color: var(--text); background: var(--surface-2); }

.modal__form { display: flex; flex-direction: column; gap: 14px; }
.modal__form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.modal__form input {
  font: inherit;
  font-weight: 400;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.modal__form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---- GPU Cloud ---- */
.view { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.view[hidden] { display: none; }

.gpu-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 4px 4px 0;
}
.gpu-hero__text h1 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; margin: 8px 0 6px; }
.gpu-hero__text p { color: var(--text-2); max-width: 520px; font-size: 13.5px; }

.gpu-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--accent);
}

.gpu-credit {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
}
.gpu-credit__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-3);
}
.gpu-credit__value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }

.gpu-models {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.model-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  transition: transform .15s, border-color .15s;
}
.model-card:hover { transform: translateY(-2px); border-color: var(--text-3); }
.model-card__name { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.model-card__desc { font-size: 13px; color: var(--text-2); flex: 1; margin-bottom: 8px; }
.model-card__meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.model-card__price { font-size: 13px; font-weight: 600; }
.model-card__price span { color: var(--text-3); font-weight: 500; }
.model-card .app-card__btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }

.gpu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.gpu-hint { font-size: 13px; color: var(--text-2); margin: -6px 0 14px; }

.gpu-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.gpu-field input {
  font: inherit;
  font-weight: 400;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.gpu-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.gpu-chips { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.gpu-chip {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 9px;
  padding: 7px 16px;
  cursor: pointer;
  transition: all .15s;
}
.gpu-chip:hover { color: var(--text); border-color: var(--text-3); }
.gpu-chip.is-active { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

.gpu-pay { width: 100%; justify-content: center; }

.api-key {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px 6px 12px;
  margin-bottom: 16px;
}
.api-key code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-example-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.api-example {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre;
}

.gpu-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  padding: 30px 0 22px;
  font-size: 13.5px;
}
.gpu-empty svg { width: 30px; height: 30px; }

/* ---- Chaves SSH e Portas ---- */
.gpu-field textarea {
  font: inherit;
  font-weight: 400;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.gpu-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.ssh-connect { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.ssh-tip {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 14px;
}
.ssh-tip strong { color: var(--accent); }
.ssh-tip--warn { background: var(--amber-soft); }
.ssh-tip--warn strong { color: var(--amber); }

.ssh-list {
  list-style: none;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ssh-list[hidden] { display: none; }
.ssh-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 12px;
}
.ssh-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.port-quick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.port-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.port-row:hover { color: var(--text); border-color: var(--accent); }
.port-row svg { width: 16px; height: 16px; color: var(--text-3); }
.port-row span { margin-left: auto; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; color: var(--accent); font-weight: 600; }

#agentKeyBox { margin-top: 14px; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  padding: 11px 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .16);
  z-index: 60;
  animation: toast-in .2s ease-out;
}
.toast[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---- Header mobile ---- */
.mobile-header { display: none; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(10, 12, 18, .45);
  backdrop-filter: blur(2px);
}
.sidebar-backdrop[hidden] { display: none; }

/* ============ LOGIN ============ */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  position: relative;
}

.login__theme { position: absolute; top: 18px; right: 18px; }

.login__card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 30px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modal-in .2s ease-out;
}

.login__brand { margin-bottom: 22px; }
.login__brand .brand-logo { height: 30px; }

.login__title { font-size: 21px; font-weight: 700; letter-spacing: -.5px; }
.login__subtitle {
  font-size: 13.5px;
  color: var(--text-2);
  text-align: center;
  margin: 6px 0 22px;
}

.login__form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login__form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }

.login__field {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0 12px;
  color: var(--text-3);
  transition: border-color .15s, box-shadow .15s;
}
.login__field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login__field svg { width: 16px; height: 16px; }
.login__field input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-weight: 400;
  border: none;
  outline: none;
  background: none;
  color: var(--text);
  padding: 10px 0;
}

.login__eye {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: color .15s;
}
.login__eye:hover { color: var(--text); }
.login__eye svg { display: none; }
.login__eye .eye-open { display: block; }
.login__eye.is-visible .eye-open { display: none; }
.login__eye.is-visible .eye-closed { display: block; }

.login__error {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 8px;
  padding: 8px 12px;
}
.login__error[hidden] { display: none; }

.login__submit { justify-content: center; width: 100%; padding: 11px 16px; margin-top: 4px; }
.login__submit:disabled { opacity: .65; cursor: wait; }

.login__hint {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  margin-top: 20px;
  line-height: 1.5;
}

/* ---- Rodapé do login ---- */
.login__footer {
  width: min(400px, 100%);
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.login__signup {
  width: 100%;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
}
.login__signup a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.login__signup a:hover { text-decoration: underline; }

.login__back {
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
}
.login__back:hover { color: var(--text); }

.login__badges {
  list-style: none;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.login__badges li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}
.login__badges svg { width: 14px; height: 14px; color: var(--accent); }

/* ============ PÁGINAS DE ERRO ============ */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
}

.error-page .login__brand { margin-bottom: 28px; }

.error-page__code {
  font-size: 72px;
  font-weight: 700;
  letter-spacing: -3px;
  line-height: 1;
  color: var(--accent);
}

.error-page__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.5px;
  margin-top: 14px;
}

.error-page__text {
  font-size: 14px;
  color: var(--text-2);
  max-width: 420px;
  margin-top: 8px;
}

.error-page__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 26px;
}
.error-page__actions .btn { text-decoration: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
  .search-box { flex: 1; width: auto; min-width: 180px; }
}

@media (max-width: 760px) {
  .app { flex-direction: column; }

  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .mobile-header .brand-logo { height: 32px; }
  .mobile-header .menu-toggle {
    display: grid;
    place-items: center;
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 9px;
  }
  .mobile-header .menu-toggle svg { width: 20px; height: 20px; }

  /* Hero empilhado: status em linha própria, comando ocupa a largura toda */
  .hero { flex-direction: column; align-items: stretch; gap: 14px; }
  .hero__ssh { flex-direction: column; align-items: stretch; gap: 10px; padding: 13px 14px; }
  .hero__ssh-status {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 0 10px;
    font-size: 13px;
  }
  .hero__ssh-cmd { gap: 8px; }
  .hero__ssh-cmd code {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .2s ease;
    top: 0;
    left: 0;
    box-shadow: 0 0 40px rgba(0, 0, 0, .18);
  }
  .sidebar.is-open { transform: none; }
  .main { padding: 18px 16px 40px; }
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }

  /* Ferramentas da tabela: busca em linha própria, select e botão dividindo a segunda */
  .table__tools { gap: 8px; }
  .table__tools .search-box { width: 100%; flex: none; min-width: 0; }
  .table__tools .select { flex: 1; min-width: 0; }
  .table__tools .btn { flex: 1; justify-content: center; white-space: nowrap; }

  /* Ferramentas de apps: busca e select dividem a linha */
  .apps-tools .search-box { flex: 1; width: auto; min-width: 0; }
  .apps-tools .select { flex: 1; min-width: 0; }

  /* Tabela vira cards: cada projeto em um cartão próprio */
  .card--table { overflow-x: visible; }
  .table { min-width: 0; }
  .table thead { display: none; }
  .table tbody { display: flex; flex-direction: column; gap: 12px; }
  .table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "proj    proj"
      "domain  status"
      "actions actions";
    gap: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
  }
  .table tbody tr:hover { background: var(--surface-2); }
  .table td { border: none; padding: 0; }
  .table td:nth-child(1) { grid-area: proj; }
  .table td:nth-child(2) { grid-area: domain; align-self: center; min-width: 0; }
  .table td:nth-child(3) { grid-area: status; justify-self: end; align-self: center; }
  .table td:nth-child(5) {
    grid-area: actions;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 2px;
  }
  .proj__repo { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .domain-link {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Status do ambiente em coluna */
  .env-status { flex-direction: column; align-items: flex-start; gap: 12px; }
  .env-checks { flex-direction: column; gap: 10px; }

  /* GPU Cloud empilhado */
  .gpu-hero { flex-direction: column; align-items: stretch; }
  .gpu-grid { grid-template-columns: 1fr; }
}
