:root {
  --bg: #08111f;
  --panel: #0f172a;
  --panel-2: #111c31;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e5eefc;
  --muted: #9bb0d3;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 22px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, #08111f 0%, #0b1324 100%);
  color: var(--text);
  min-height: 100%;
}
body { min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
a { color: inherit; text-decoration: none; }

.app-shell {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 14px 34px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: rgba(8, 17, 31, 0.82);
  backdrop-filter: blur(18px);
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand h1 { margin: 0; font-size: 1.1rem; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.brand-logo { width: 52px; height: 52px; border-radius: 16px; box-shadow: var(--shadow); }
.app-main { padding-top: 8px; }
.screen { display: grid; gap: 16px; }
.card {
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.96) 0%, rgba(15, 23, 42, 0.96) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero { padding: 26px; display: grid; gap: 18px; }
.hero h2 { margin: 0; font-size: clamp(1.7rem, 2vw, 2.3rem); line-height: 1.1; }
.hero p, .subtle, .muted { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.action-card {
  padding: 18px;
  min-height: 145px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.action-card:hover { transform: translateY(-2px); border-color: rgba(96, 165, 250, 0.35); }
.action-card h3, .panel h3 { margin: 0; }
.action-icon {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.16);
  font-size: 1.3rem;
}
.primary-button,
.secondary-button,
.outline-button,
.ghost-button {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.primary-button:hover,
.secondary-button:hover,
.outline-button:hover,
.ghost-button:hover { transform: translateY(-1px); }
.primary-button { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); color: white; font-weight: 700; }
.secondary-button { background: rgba(255,255,255,0.08); color: var(--text); }
.outline-button { background: transparent; color: var(--text); border: 1px solid var(--line); }
.ghost-button { background: transparent; color: var(--text); width: 44px; padding: 0; }
.hidden { display: none !important; }
.panel { padding: 10px; display: grid; gap: 6px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.stack { display: grid; gap: 10px; }
.input, .textarea {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 0 14px;
  outline: none;
}
.textarea { min-height: 120px; padding: 14px; resize: vertical; }
.input:focus, .textarea:focus { border-color: rgba(96, 165, 250, 0.55); }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.meta-item {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.meta-label { color: var(--muted); font-size: 0.82rem; margin-bottom: 6px; }
.meta-value { font-size: 1rem; font-weight: 600; word-break: break-word; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
}
.status-ok { background: rgba(34, 197, 94, 0.14); color: #90f0b1; }
.status-warning { background: rgba(245, 158, 11, 0.14); color: #ffd383; }
.status-danger { background: rgba(239, 68, 68, 0.14); color: #ff9b9b; }
.status-neutral { background: rgba(255,255,255,0.08); color: var(--text); }
.detail-header { padding: 22px; display: grid; gap: 10px; }
.detail-title { margin: 0; font-size: clamp(1.5rem, 2vw, 2rem); }
.detail-subtitle { color: var(--muted); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.notice {
  border: 1px dashed rgba(96, 165, 250, 0.35);
  background: rgba(59, 130, 246, 0.08);
  color: #d7e7ff;
  border-radius: 18px;
  padding: 14px;
}
.notice.warning { border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.08); }
.notice.error { border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.08); }
.reader {
  width: 100%;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: black;
}
.list { display: grid; gap: 10px; }
.list-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.list-item button { text-align: left; background: transparent; color: inherit; padding: 0; }
.footer-note { text-align: center; color: var(--muted); font-size: 0.86rem; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 0.88rem;
}
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.kpi {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.kpi strong { display: block; font-size: 1.15rem; }
.loader {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.18);
  border-top-color: var(--accent-2);
  animation: spin 0.8s linear infinite;
}
.center-row { display: flex; align-items: center; gap: 10px; }
.code-block {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;

  padding: 12px;
  border-radius: 14px;

  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);

  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* linhas internas (label | valor) */
.code-block div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 6px;
}

/* label */
.code-block strong {
  color: var(--accent-2);
  font-weight: 600;
}

/* valor */
.code-block span {
  text-align: right;
  color: var(--text);
}

/* MOBILE */
@media (max-width: 780px) {
  .code-block {
    max-width: 100%;
    padding: 10px;
  }

  .code-block div {
    font-size: 13px;
  }
}

/* ===== FOTO PREMIUM ===== */

.detail-photo-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 18px;
  min-height: 210px;
  background: rgba(255,255,255,0.03);
}

.photo-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(20px) brightness(0.5);
  transform: scale(1.2);
  z-index: 0;
}

.detail-photo {
  position: relative;
  z-index: 1;
  max-width: 180px;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.detail-photo:hover {
  transform: scale(1.05);
}

/* ===== MODAL ===== */

.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.image-modal-content img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 780px) {
  .grid-2, .grid-3, .meta-grid { grid-template-columns: 1fr; }
  .search-row { grid-template-columns: 1fr; }
  .app-shell { padding: 12px 10px 24px; }
  .hero, .panel, .detail-header { padding: 16px; }
  .brand h1 { font-size: 1rem; }
  .brand p { font-size: 0.82rem; }
  .brand-logo { width: 46px; height: 46px; }

  .detail-photo-wrap {
    min-height: 180px;
  }

  .detail-photo {
    max-width: 180px;
  }
}
/* ===== AJUSTE FINO DE ESPAÇOS (VIEWER V3) ===== */

/* reduz espaço entre blocos */
.screen {
  gap: 10px !important;
  align-content: start !important;
}

/* reduz altura do topo */
.hero {
  padding: 14px !important;
  gap: 8px !important;
}

/* reduz espaço interno dos cards */
.panel {
  padding: 10px !important;
  gap: 6px !important;
}

/* evita crescimento vertical inútil */
.card {
  height: auto !important;
}

/* input mais compacto */
.input {
  min-height: 40px !important;
}

/* botão mais próximo */
.primary-button {
  min-height: 40px !important;
  margin-top: 4px;
}

/* remove espaço morto da busca */
.search-row {
  gap: 6px !important;
}

/* reduz padding geral da tela */
.app-shell {
  padding: 10px 10px 20px !important;
}