/* Aletheia — TJRJ / SENUV · fiel ao mockup */

:root {
  --navy: #0a1628;
  --navy-deep: #07101c;
  --navy-mid: #12233d;
  --navy-soft: #1a3358;
  --navy-active: #1c3558;
  --gold: #c9a66b;
  --gold-hover: #d4b57a;
  --gold-deep: #a88848;
  --white: #ffffff;
  --paper: #edf0f5;
  --ink: #1c2434;
  --muted: #64748b;
  --line: #dce3ec;
  --ok: #22a06b;
  --err: #e24b4b;
  --warn: #e0a800;
  --font-display: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --font-ui: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --sidebar-w: 220px;
  --header-h: 58px;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(10, 22, 40, 0.07);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

/* ---------- Login ---------- */

body.page-login {
  color: var(--white);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 70% at 12% 45%, rgba(36, 63, 104, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse 70% 55% at 88% 70%, rgba(20, 40, 70, 0.45) 0%, transparent 50%),
    linear-gradient(165deg, #081320 0%, var(--navy) 45%, #0d1c30 100%);
}

.login-top {
  padding: 1.35rem 2.5rem 0.5rem;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.88);
}

.login-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: 0.5rem clamp(2rem, 8vw, 6rem) 1.5rem;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}

.login-brand {
  flex: 1 1 auto;
  max-width: 28rem;
}

.login-brand__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(4.5rem, 10vw, 6.5rem);
  line-height: 0.92;
  letter-spacing: 0.01em;
}

.login-brand__lead {
  margin: 1.2rem 0 0;
  max-width: 17rem;
  font-weight: 300;
  font-size: 1.08rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.74);
}

.login-card {
  flex: 0 0 320px;
  width: 320px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 2px;
  padding: 1.5rem 1.35rem 1.25rem;
  background: rgba(6, 14, 28, 0.28);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.95rem;
}

.login-field span {
  font-size: 0.88rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
}

.login-field input {
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  background: rgba(4, 10, 22, 0.55);
  color: var(--white);
  padding: 0.72rem 0.8rem;
  outline: none;
}

.login-field input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.login-field input:focus {
  border-color: var(--gold);
}

.login-forgot {
  display: inline-block;
  margin: 0.05rem 0 0.85rem;
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 500;
}

.login-forgot:hover {
  text-decoration: underline;
}

.login-error {
  display: none;
  margin: 0 0 0.65rem;
  color: #ffb4b4;
  font-size: 0.85rem;
}

.login-error.is-visible {
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: none;
  cursor: pointer;
  border-radius: 2px;
  padding: 0.75rem 1.1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn--gold {
  width: 100%;
  background: var(--gold);
  color: var(--navy-deep);
  text-transform: uppercase;
  font-size: 0.86rem;
  padding: 0.85rem 1rem;
}

.btn--gold:hover {
  background: var(--gold-hover);
}

.btn--outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 0.4rem 0.95rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
}

.btn--outline:hover {
  background: rgba(201, 166, 107, 0.12);
}

.btn--navy {
  background: var(--navy);
  color: var(--white);
  width: 100%;
  padding: 0.8rem 1.4rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.btn--navy:hover {
  background: var(--navy-soft);
}

.btn--sm {
  padding: 0.38rem 0.9rem;
  font-size: 0.75rem;
  width: auto;
  letter-spacing: 0.06em;
}

.login-foot {
  padding: 0.75rem 2.5rem 1.4rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 860px) {
  .login-stage {
    flex-direction: column;
    align-items: stretch;
    padding-top: 1.5rem;
  }

  .login-card {
    flex: none;
    width: 100%;
  }

  .login-brand__title {
    font-size: 3.4rem;
  }
}

/* ---------- App shell ---------- */

body.page-app {
  background: var(--paper);
}

#app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  flex-shrink: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.35rem 0 1.4rem;
  background: var(--navy);
  color: var(--white);
}

.app-header__left {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
}

.app-header__org {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.app-header__brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

.app-header__right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  font-weight: 400;
}

.user-chip__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #4a6288, #1c2d4d);
  border: 1.5px solid rgba(201, 166, 107, 0.45);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.user-chip__avatar::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(201, 166, 107, 0.55);
  margin-top: -6px;
  box-shadow: 0 12px 0 5px rgba(201, 166, 107, 0.35);
}

.app-body {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
}

.sidebar {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.88);
  padding: 1.1rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 0.85rem;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
  font-weight: 400;
}

/* Ícones — tamanho fixo (evita SVG 300×150 sem CSS) */
.ui-icon,
.nav-item svg,
.search svg,
.icon-btn svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  flex-shrink: 0;
  display: block;
}

.video-frame__play svg {
  width: 22px !important;
  height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.is-active {
  background: var(--navy-active);
  color: var(--white);
}

.content {
  padding: 0.9rem 1rem 1rem;
  min-width: 0;
}

.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem 1.15rem;
  min-height: calc(100vh - var(--header-h) - 1.9rem);
}

.panel--flush {
  display: flex;
  flex-direction: column;
}

.panel__title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
}

.search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.62rem 0.9rem;
  margin-bottom: 0.35rem;
  background: #fafbfd;
}

.search svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
  flex-shrink: 0;
}

.search input {
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  color: var(--ink);
  font-size: 0.92rem;
}

.search input::placeholder {
  color: #94a3b8;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 0.35rem;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th {
  text-align: left;
  font-weight: 600;
  color: var(--navy);
  padding: 0.85rem 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 0.88rem;
}

table.data td {
  padding: 0.95rem 0.55rem;
  border-bottom: 1px solid #eef2f6;
  vertical-align: middle;
  color: #334155;
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data tr:hover td {
  background: #f8fafc;
}

.cell-title {
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
  font-size: 0.88rem;
  white-space: nowrap;
}

.status__dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.65rem;
  line-height: 1;
  font-weight: 700;
}

.status--ok .status__dot {
  background: var(--ok);
  color: white;
}

.status--err .status__dot {
  background: var(--err);
  color: white;
}

.status--wait .status__dot {
  background: transparent;
  border: 2.5px solid var(--warn);
}

.actions {
  display: flex;
  gap: 0.3rem;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #5b6b82;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--navy);
  background: var(--paper);
}

.icon-btn--danger:hover {
  color: #b42318;
  background: #fef3f2;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
}

/* ---------- Nova audiência ---------- */

.form-grid {
  display: grid;
  gap: 1rem;
  max-width: 520px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
}

.field input[type="text"],
.field input[type="file"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.75rem;
  background: #fff;
}

.field input:focus {
  outline: 2px solid rgba(201, 166, 107, 0.25);
  border-color: var(--gold);
}

.form-hint {
  min-height: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: pre-wrap;
}

/* ---------- Progresso do pipeline ---------- */

.process-banner {
  margin: 0 0 1.15rem;
  padding: 1rem 1.1rem 0.95rem;
  border-radius: 10px;
  border: 1px solid #c9daf0;
  background: linear-gradient(180deg, #f3f7fc 0%, #eaf1f9 100%);
  color: var(--navy);
}

.process-banner--error {
  border-color: #e3b4b4;
  background: linear-gradient(180deg, #fff6f6 0%, #fdeeee 100%);
}

.process-banner__head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.process-banner__pulse {
  width: 12px;
  height: 12px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: #2f6fed;
  box-shadow: 0 0 0 0 rgba(47, 111, 237, 0.45);
  animation: process-pulse 1.4s ease-out infinite;
  flex-shrink: 0;
}

.process-banner--error .process-banner__pulse {
  background: #c0392b;
  animation: none;
  box-shadow: none;
}

@keyframes process-pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 111, 237, 0.45); }
  70% { box-shadow: 0 0 0 10px rgba(47, 111, 237, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 111, 237, 0); }
}

.process-banner__titles {
  min-width: 0;
}

.process-banner__title {
  display: block;
  font-size: 1rem;
  font-weight: 650;
}

.process-banner__subtitle {
  margin: 0.25rem 0 0;
  color: #4a5b73;
  font-size: 0.9rem;
  line-height: 1.45;
}

.process-steps {
  list-style: none;
  margin: 0.95rem 0 0.55rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.process-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #d7e2ef;
  color: #5b6b82;
  font-size: 0.82rem;
  font-weight: 550;
}

.process-step__mark {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  border: 2px solid #9aadc4;
  flex-shrink: 0;
}

.process-step.is-active {
  border-color: #2f6fed;
  color: var(--navy);
  background: #fff;
}

.process-step.is-active .process-step__mark {
  border-color: #2f6fed;
  background: #2f6fed;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.18);
}

.process-step.is-done {
  border-color: #9ec9a8;
  color: #1f6b3a;
}

.process-step.is-done .process-step__mark {
  border-color: #2f9e5b;
  background: #2f9e5b;
}

.process-step.is-error {
  border-color: #e3b4b4;
  color: #8a2f2f;
}

.process-banner__meta {
  margin: 0;
  font-size: 0.82rem;
  color: #5b6b82;
  line-height: 1.4;
}

.btn.is-disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 720px) {
  .process-steps {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Detalhe ---------- */

.detail-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1.15rem;
  align-items: stretch;
}

.video-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.video-frame {
  background: #0a1220;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  position: relative;
  width: 100%;
  min-height: 280px;
}

.video-frame__player {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover;
  object-position: center;
  background: #0a1220;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}

.video-frame__player.is-ready {
  opacity: 1;
  pointer-events: auto;
}

.video-frame__placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
  text-align: center;
  padding: 1rem;
  pointer-events: none;
}

.video-frame__placeholder[hidden] {
  display: none;
}

.video-frame__play {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(10, 22, 40, 0.45);
  display: grid;
  place-items: center;
  color: white;
  cursor: pointer;
  pointer-events: auto;
}

.video-frame__play[hidden] {
  display: none !important;
}

.video-frame__play svg {
  width: 22px !important;
  height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  margin-left: 3px;
}

.video-meta {
  margin: 0;
  font-size: 0.92rem;
  color: var(--navy);
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.video-meta__label,
.video-meta strong {
  font-weight: 600;
  display: block;
}

.video-meta__value {
  font-weight: 400;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}

.video-captions-status {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted, #5a6a7a);
}

.painel-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.5rem 0 1rem;
}

.painel-empty__text {
  margin: 0;
  color: var(--muted);
}

.detail-foot {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.detail-foot .btn--navy {
  min-width: 11rem;
  justify-content: center;
}

.btn--ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  border: 1px solid #c5ced9;
  background: transparent;
  color: var(--navy);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn--ghost:hover {
  border-color: var(--navy);
  background: var(--paper, #f5f7fa);
}

.block--wide {
  margin-top: 1rem;
}

.melhorias-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: min(52vh, 520px);
  overflow: auto;
}

.melhorias-list .muted {
  margin: 0;
  color: var(--muted, #5a6a7a);
  font-size: 0.9rem;
}

.melhoria-card {
  border: 1px solid rgba(10, 22, 40, 0.08);
  border-radius: 8px;
  background: #f7f8fb;
  padding: 0.75rem 0.9rem;
}

.melhoria-card__title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy, #0a1628);
}

.melhoria-card__body {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #1c2434;
}

.video-frame__player::cue {
  background: rgba(10, 22, 40, 0.72);
  color: #fff;
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.35;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.block {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem 0.9rem 0.85rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.stack > .block {
  flex: 1 1 0;
}

.block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  flex-shrink: 0;
}

.block__head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
}

.block__body {
  margin: 0;
  flex: 1 1 auto;
  overflow: auto;
  max-height: none;
  min-height: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #334155;
  white-space: pre-wrap;
  font-family: var(--font-ui);
  background: #fafbfd;
  border: 1px solid #eef2f6;
  border-radius: 4px;
  padding: 0.65rem 0.75rem;
}

.help-list {
  margin: 0 0 1.25rem;
  padding-left: 1.1rem;
  color: #334155;
  line-height: 1.65;
}

.help-lead {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.help-subtitle {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
}

.help-contact {
  margin: 0 0 0.75rem;
  color: #334155;
  line-height: 1.55;
}

.help-contact--action {
  margin-top: 0.35rem;
}

.help-mail {
  color: var(--navy);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.help-mail:hover {
  color: var(--gold-ink, #8a6a2f);
}

@media (max-width: 980px) {
  .app-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .nav-item {
    flex: 1 1 auto;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .stack {
    height: auto;
  }

  .stack > .block {
    flex: 1 1 auto;
  }

  .stack .block__body {
    min-height: 140px;
    max-height: 280px;
  }
}
