/* Certus Deploy — page-specific layouts. */

/* ---------- Painel: KPI strip ---------- */

.metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: var(--space-6); border-radius: var(--radius-md); overflow: hidden;
  background:
    radial-gradient(80% 140% at 100% 0%, rgba(0, 202, 255, 0.12), transparent 55%),
    linear-gradient(135deg, var(--certus-navy-900) 0%, var(--certus-primary) 55%, var(--certus-blue-700) 100%);
  box-shadow: 0 16px 32px -22px rgba(2, 8, 23, 0.6);
  color: #fff;
}
.metric { position: relative; padding: 18px 22px 16px; }
.metric + .metric { border-left: 1px solid var(--line-on-dark); }
.metric::before {
  content: ""; position: absolute; left: 22px; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--metric-c, var(--certus-cyan));
}
.metric-running { --metric-c: var(--certus-cyan); }
.metric-queued { --metric-c: var(--warning-solid); }
.metric-ok { --metric-c: var(--success-solid); }
.metric-fail { --metric-c: var(--danger-solid); }
.metric-label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.86rem; font-weight: 600; color: #B9C6DE; }
.metric-label .mdi { font-size: 1.1rem; color: var(--metric-c); }
.metric-value { margin-top: 6px; font-weight: 700; font-size: 2.3rem; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.metric-foot { margin-top: 6px; font-size: 0.78rem; color: var(--text-on-dark-subtle); }
.metric-fail.has-failures .metric-value { color: #FCA5A5; }

/* ---------- Aplicação ---------- */

.exec-strip {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: stretch;
  margin-bottom: var(--space-5); border-radius: var(--radius-md); overflow: hidden;
  background: var(--certus-navy-950); color: #DCE6F6; box-shadow: var(--shadow-card);
  border: 1px solid #0F2350;
}
.exec-cmd { display: grid; align-content: center; gap: 0.35rem; padding: 1.1rem 1.35rem; background: linear-gradient(90deg, rgba(0, 202, 255, 0.07), transparent); }
.exec-label { font-size: 0.76rem; font-weight: 600; color: #6F82A6; }
.exec-path { display: flex; align-items: center; gap: 0.45rem; }
.exec-path .mdi { color: var(--certus-cyan); font-size: 1.15rem; }
.exec-path code { font-size: 0.95rem; color: #E7EEFA; word-break: break-all; }
.exec-target { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--text-on-dark-subtle); }
.exec-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.exec-facts > div { padding: 1.1rem 1rem; border-left: 1px solid var(--line-on-dark); }
.exec-facts dt { font-size: 0.74rem; color: #6F82A6; }
.exec-facts dd { margin: 0.3rem 0 0; font-weight: 600; color: #fff; }
.exec-facts .text-warn { color: #FCD34D; }

.key-form .field { flex: 1 1 260px; }
.key-form .btn { align-self: flex-start; margin-top: 1.6rem; }
.key-name { font-weight: 600; color: var(--text); }
code.key-prefix { padding: 0.12rem 0.45rem; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text-2); letter-spacing: 0.02em; }
code.key-prefix span { color: var(--text-subtle); }

.secret-reveal {
  position: relative; margin-bottom: var(--space-6); padding: 1.25rem 1.35rem; border-radius: var(--radius-lg);
  color: var(--text-on-dark);
  background:
    repeating-linear-gradient(-45deg, rgba(245, 158, 11, 0.07) 0 10px, transparent 10px 20px),
    linear-gradient(135deg, var(--certus-navy-900), var(--certus-primary));
  border: 1px solid rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12), 0 20px 40px -24px rgba(2, 8, 23, 0.7);
}
.secret-head { display: flex; gap: 0.85rem; align-items: flex-start; }
.secret-head > .mdi { font-size: 1.7rem; color: var(--warning-solid); line-height: 1; }
.secret-head h2 { font-size: 1.05rem; font-weight: 700; color: #FFF7E6; }
.secret-head p { margin-top: 0.2rem; font-size: 0.88rem; color: var(--text-on-dark-muted); }
.secret-head code { color: #FCD34D; }
.secret-value {
  display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0 0.75rem; padding: 0.6rem 0.6rem 0.6rem 1rem;
  border-radius: var(--radius-md); background: var(--certus-navy-950); border: 1px solid rgba(255, 255, 255, 0.1);
}
.secret-value .key { flex: 1; min-width: 0; font-size: 0.95rem; color: #fff; word-break: break-all; user-select: all; }
.btn-copy { flex: none; background: var(--warning-solid); border-color: #D97706; color: var(--certus-navy-950); box-shadow: none; }
.btn-copy:hover { background: #FBBF24; border-color: #D97706; }
.btn-copy.is-copied { background: var(--success-solid); border-color: #16A34A; color: var(--certus-navy-950); }
.secret-dismiss { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.86rem; font-weight: 600; color: #93C5FD; }

/* ---------- Publicação ---------- */

.dep-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-5); align-items: start; }
.dep-aside { display: grid; gap: var(--space-5); position: sticky; top: calc(var(--appbar-h) + 20px); }
.dep-aside .panel { margin-bottom: 0; }

/* ---------- Conexões seguras ---------- */

.profile-list { list-style: none; margin: 0; padding: 0; }
.profile { display: grid; gap: 0.8rem; padding: 1.1rem var(--space-5); border-bottom: 1px solid var(--border); }
.profile:last-child { border-bottom: 0; }
.profile form { margin: 0; }
.profile-main { display: flex; align-items: center; gap: 0.8rem; }
.profile-main > div:nth-child(2) { flex: 1; min-width: 0; }
.profile-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius); font-size: 1.3rem; color: var(--certus-cyan); background: var(--certus-navy-900); }
.profile-name { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-weight: 700; color: var(--text); }
.profile-host { font-size: 0.875rem; color: var(--text-muted); }
.profile-host .mono { color: var(--text-2); }
.profile-status { flex: none; }
.profile-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 1.5rem; margin: 0; }
.profile-facts > div { display: contents; }
.profile-facts dt { font-size: 0.8rem; color: var(--text-muted); padding: 0.15rem 0; }
.profile-facts dd { margin: 0; font-size: 0.86rem; padding: 0.15rem 0; min-width: 0; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.25rem; }
.profile .inline-form { display: grid; gap: 0.5rem; margin-top: 0.4rem; }
.check-list { list-style: none; margin: 0; padding: 0; font-size: 0.84rem; }
.check-list li { display: flex; align-items: baseline; gap: 0.35rem; padding: 0.15rem 0; }
.check-OK { color: var(--success); }
.check-WARN { color: var(--warning); }
.check-FAIL { color: var(--danger); }

/* ---------- Usuários & auditoria ---------- */

.person { display: flex; align-items: center; gap: 0.7rem; }
.person-name { font-weight: 600; color: var(--text); }
.role { display: inline-flex; align-items: center; gap: 0.3rem; height: 24px; padding: 0 0.55rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600; }
.role-admin { color: var(--certus-blue-700); background: #EAF0FF; }
.role-viewer { color: var(--text-2); background: var(--neutral-bg); }
.you { margin-left: 0.25rem; padding: 0.05rem 0.4rem; border-radius: 5px; font-size: 0.7rem; font-weight: 600; color: #0369A1; background: #E0F2FE; vertical-align: middle; }

.event-label { font-weight: 600; color: var(--text); }
.actor-pipeline { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; color: var(--certus-blue-700); }
.actor-pipeline .mdi { color: var(--certus-accent); }

/* ---------- Secrets compartilhadas ---------- */

.share-actions { display: inline-flex; align-items: center; gap: 0.45rem; }
.share-actions form { margin: 0; }
.share-link { display: flex; align-items: center; gap: 0.45rem; }
.share-link-url {
  max-width: 320px; padding: 0.3rem 0.5rem; border-radius: var(--radius-sm); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text-2); user-select: all;
}
.share-ua { max-width: 220px; }
.share-label-cell { min-width: 220px; overflow-wrap: anywhere; }

.share-card { display: grid; justify-items: center; gap: 0.75rem; padding: 2.25rem 1.75rem 2rem; text-align: center; }
.share-card h1 { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.share-card form { margin: 0; }
.share-icon {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--radius-md);
  font-size: 1.6rem; color: var(--certus-cyan); background: var(--certus-primary);
}
.share-label { max-width: 46ch; font-weight: 600; color: var(--text-2); overflow-wrap: anywhere; }
.share-masked {
  width: 100%; padding: 0.85rem 1rem; border-radius: var(--radius-md); background: var(--surface-2);
  border: 1px dashed var(--border-strong); font: 600 1.15rem/1 var(--font-mono); letter-spacing: 0.2em; color: var(--text-subtle);
}
.share-value {
  width: 100%; max-height: 50vh; margin: 0; padding: 0.85rem 1rem; overflow: auto; text-align: left;
  border-radius: var(--radius-md); background: var(--certus-navy-950); color: var(--text-on-dark);
  font: 0.9rem/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; user-select: all;
}
.share-author { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.86rem; color: var(--success); font-weight: 600; }
.share-fp {
  width: 100%; display: grid; gap: 0.4rem; padding: 0.85rem 1rem; text-align: left;
  border-radius: var(--radius-md); background: var(--info-bg); border: 1px solid var(--info-border);
}
.share-fp-title { display: flex; align-items: center; gap: 0.35rem; font-size: 0.86rem; font-weight: 600; color: var(--info); }
.share-fp-value { font-size: 0.9rem; color: var(--text); overflow-wrap: anywhere; user-select: all; }
.share-fp-hint { font-size: 0.82rem; color: var(--text-muted); }
.share-fp-cell { display: flex; align-items: flex-start; gap: 0.3rem; }
.share-fp-cell code { font-size: 0.74rem; word-break: break-all; }
.field .alert { margin: 0.4rem 0 0; }
.alert-actions { margin-top: 0.5rem; }
.key-confirm { margin-bottom: var(--space-6); }
.key-confirm h2 { display: flex; align-items: center; gap: 0.4rem; font-size: var(--fs-section); font-weight: 700; color: var(--text); }
.key-confirm h2 .mdi { color: var(--certus-accent); }
.key-confirm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--space-5); margin-top: var(--space-4); }
.key-confirm-label { margin-bottom: 0.4rem; font-size: var(--fs-caption); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.key-confirm-admins { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.key-confirm-admins li {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-2);
}
.key-confirm-mail {
  margin: 0 0 0.6rem; padding: 0.85rem 1rem; border-radius: var(--radius-md); background: var(--surface-2);
  border: 1px solid var(--border-soft); font: 0.84rem/1.55 var(--font-mono); color: var(--text-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.share-note { max-width: 52ch; font-size: 0.86rem; color: var(--text-muted); }
.share-note-warn { color: var(--warning); font-weight: 600; }

/* ---------- Erros (404/403/500) ---------- */

.error-page { display: grid; justify-items: center; gap: 0.6rem; padding: 3.5rem 1.5rem 3.75rem; text-align: center; }
.error-page h1 { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.error-page p { max-width: 52ch; color: var(--text-muted); }
.error-page .actions { justify-content: center; margin-top: 0.75rem; width: auto; }
.error-code { font: 700 0.8rem/1 var(--font-mono); letter-spacing: 0.12em; color: var(--text-subtle); }
.error-standalone { display: grid; place-items: center; padding: var(--space-6) var(--space-4); }
.error-standalone-main { display: grid; gap: var(--space-5); width: min(560px, 100%); }
.error-brand {
  display: flex; align-items: center; gap: var(--space-3); justify-self: center;
  padding: 12px 18px; border-radius: var(--radius-md); background: var(--certus-primary);
}
.error-brand:hover { text-decoration: none; }
.error-brand .sidebar-product { font-size: 17px; }

/* ---------- Login / acesso negado ---------- */

.login-body {
  min-height: 100dvh; overflow-x: hidden; color: var(--text-on-dark);
  background:
    radial-gradient(60% 50% at 0% 0%, rgba(0, 202, 255, 0.14), transparent 60%),
    radial-gradient(50% 60% at 100% 100%, rgba(37, 99, 235, 0.2), transparent 60%),
    linear-gradient(160deg, #050B18 0%, var(--certus-navy-900) 50%, var(--certus-navy-800) 100%);
}
.login { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100dvh; }
.login-hero { display: flex; flex-direction: column; justify-content: space-between; gap: 2.5rem; padding: 48px clamp(1.5rem, 6vw, 80px) 40px; }
.login-brand { display: inline-flex; align-self: flex-start; border-radius: var(--radius-sm); }
.login-brand .certus-logo { width: auto; height: 48px; }
.login-copy { max-width: 560px; animation: rise 0.6s 0.05s var(--ease) both; }
.login-product {
  display: inline-block; margin-bottom: 16px;
  font-size: 20px; font-weight: 700; letter-spacing: 0.04em; line-height: 1.3;
  background: linear-gradient(90deg, #22D3EE 0%, #60A5FA 55%, #A78BFA 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.login-copy h1 { font-weight: 800; font-size: clamp(2.2rem, 4.2vw, 3.4rem); line-height: 1.06; letter-spacing: -0.035em; color: #fff; }
.login-copy h1 .hl { color: var(--certus-cyan); }
.login-copy > p:not(.login-product):not(.login-note) { margin-top: 1.1rem; font-size: 1.06rem; line-height: 1.6; color: var(--text-on-dark-muted); max-width: 46ch; }
.btn-google {
  width: 100%; max-width: 420px; height: 56px; margin-top: 2rem; padding: 0 1.4rem; gap: 0.75rem;
  border: 0; border-radius: var(--radius); background: #fff; color: #111827; font-size: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.btn-google:hover { background: #F0F4FA; border-color: transparent; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38); }
.btn-google:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28); }
.btn-google:focus-visible { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); outline: 3px solid rgba(96, 165, 250, 0.55); outline-offset: 3px; }
.google-icon { width: 20px; height: 20px; flex-shrink: 0; }
.btn-hero {
  height: 54px; margin-top: 2rem; padding: 0 1.4rem; gap: 0.6rem; border-radius: var(--radius);
  font-size: 1rem; color: #111827; background: #fff; border-color: transparent; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.btn-hero:hover { background: #F0F4FA; border-color: transparent; }
.login-note { display: flex; align-items: center; gap: 0.4rem; margin-top: 1rem; font-size: 0.86rem; color: var(--text-on-dark-muted); }
.login-note-quiet { margin-top: 0.4rem; font-size: 0.8rem; color: var(--text-on-dark-subtle); }
.login-foot { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; letter-spacing: 0.02em; color: #6F82A6; }
.alert-on-dark { margin: 1.5rem 0 0; background: rgba(239, 68, 68, 0.12); color: #FECACA; border-color: rgba(239, 68, 68, 0.35); border-left-color: var(--danger-solid); }
.alert-on-dark > .mdi { color: #F87171; }

.login-visual {
  position: relative; display: grid; place-items: center; padding: 3rem;
  border-left: 1px solid rgba(0, 202, 255, 0.08);
  background: radial-gradient(70% 60% at 50% 50%, rgba(37, 99, 235, 0.16), transparent 70%);
}
.pipeline { position: relative; display: grid; gap: 0.85rem; width: min(400px, 100%); }
.pipeline::before {
  content: ""; position: absolute; left: 25px; top: 26px; bottom: 26px; width: 2px;
  background: linear-gradient(180deg, rgba(0, 202, 255, 0.6), rgba(34, 197, 94, 0.6));
}
.pipe-step {
  position: relative; display: flex; align-items: center; gap: 0.9rem; padding: 0.7rem 1rem 0.7rem 0.55rem;
  border-radius: 14px; background: rgba(7, 20, 46, 0.75); border: 1px solid rgba(148, 178, 230, 0.12);
  backdrop-filter: blur(6px);
  animation: step-in 0.5s var(--ease) both, step-glow 6s ease-in-out infinite;
}
.pipe-step > .mdi {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: var(--radius);
  font-size: 1.2rem; color: var(--certus-cyan); background: var(--certus-navy-950); border: 1px solid rgba(0, 202, 255, 0.3);
}
.pipe-step strong { display: block; font: 600 0.95rem/1.3 var(--font); color: #E7EEFA; }
.pipe-step small { font-size: 0.76rem; color: var(--text-on-dark-subtle); }
.pipe-final > .mdi { color: var(--success-solid); border-color: rgba(34, 197, 94, 0.4); }
.pipe-step:nth-child(1) { animation-delay: 0.2s, 0.8s; }
.pipe-step:nth-child(2) { animation-delay: 0.3s, 2s; }
.pipe-step:nth-child(3) { animation-delay: 0.4s, 3.2s; }
.pipe-step:nth-child(4) { animation-delay: 0.5s, 4.4s; }
.pipe-step:nth-child(5) { animation-delay: 0.6s, 5.6s; }
@keyframes step-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes step-glow {
  0%, 22%, 100% { border-color: rgba(148, 178, 230, 0.12); box-shadow: none; }
  8% { border-color: rgba(0, 202, 255, 0.55); box-shadow: 0 0 24px -6px rgba(0, 202, 255, 0.55); }
}

/* ---------- Responsive pages ---------- */

@media (max-width: 1280px) {
  .dep-layout { grid-template-columns: minmax(0, 1fr); }
  .dep-aside { position: static; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
}

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line-on-dark); }
  .exec-strip { grid-template-columns: minmax(0, 1fr); }
  .exec-facts > div:first-child { border-left: 0; }
  .exec-facts { border-top: 1px solid var(--line-on-dark); }
}

@media (max-width: 960px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-visual { display: none; }
}

@media (max-width: 640px) {
  .metric { padding: 16px; }
  .metric::before { left: 16px; }
  .metric-value { font-size: 1.9rem; }
  .exec-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exec-facts > div:nth-child(3) { border-left: 0; }
  .secret-value { flex-direction: column; align-items: stretch; }
  .share-actions { flex-direction: column; align-items: flex-end; }
  .share-link-url { max-width: 180px; }
  .share-card { padding: 1.75rem 1.1rem 1.5rem; }
  .key-confirm-grid { grid-template-columns: minmax(0, 1fr); }
  .login-hero { padding: 28px 20px; gap: 2rem; }
  .login-brand .certus-logo { height: 40px; }
  .profile-main { flex-wrap: wrap; }
}
