[hidden] { display: none !important; }
:root {
  --bg: #020617;
  --panel: #071125;
  --field: #050b1d;
  --text: #f8fbff;
  --muted: #b8c4da;
  --line: rgba(148, 163, 184, .22);
  --accent: #38bdf8;
  --accent-dark: #2563eb;
  --violet: #8b5cf6;
  --ok: #0f8a5f;
  --warn: #ffbf5b;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
body:has(#exam:not([hidden])) { overflow-y: auto; }

/* ================= LOGIN PREMIUM RESPONSIVO ================= */
.login-page {
  position: relative;
  min-height: 100svh;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vh, 46px) clamp(18px, 5vw, 84px);
}
.login-bg,
.login-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.login-bg {
  z-index: -3;
  background-image: url('/assets/bg-medical-agipacs.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(1.06) contrast(1.05);
  transform: scale(1.005);
}
.login-overlay {
  z-index: -2;
  background:
    radial-gradient(circle at 75% 49%, rgba(56,189,248,.18) 0%, rgba(56,189,248,.07) 18%, transparent 38%),
    radial-gradient(circle at 92% 20%, rgba(139,92,246,.26) 0%, transparent 34%),
    radial-gradient(circle at 6% 80%, rgba(37,99,235,.22) 0%, transparent 40%),
    linear-gradient(90deg, rgba(2,6,23,.14) 0%, rgba(2,6,23,.30) 47%, rgba(2,6,23,.48) 100%),
    linear-gradient(180deg, rgba(2,6,23,.12) 0%, rgba(2,6,23,.36) 100%);
}
.login-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1370px);
  display: grid;
  grid-template-columns: minmax(390px, .92fr) minmax(390px, 520px);
  align-items: center;
  justify-content: space-between;
  gap: clamp(42px, 7vw, 112px);
}
.hero-copy {
  width: min(100%, 530px);
  transform: translateY(-4px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: clamp(14px, 1.5vw, 22px);
}
.brand-hero { margin-bottom: clamp(32px, 5vh, 56px); }
.brand-mark {
  width: clamp(78px, 7vw, 104px);
  height: auto;
  filter: drop-shadow(0 0 16px rgba(56,189,248,.38));
  flex: 0 0 auto;
}
.brand-name {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(48px, 4.6vw, 70px);
  line-height: .95;
  font-weight: 800;
  letter-spacing: -3px;
  color: #fff;
  text-shadow: 0 10px 34px rgba(0,0,0,.45);
}
.hero-line,
.card-line {
  width: 54px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #8b5cf6);
  box-shadow: 0 0 16px rgba(56,189,248,.85);
}
.hero-line { margin: 0 0 clamp(28px, 4vh, 42px); }
.hero-title {
  margin: 0;
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: clamp(46px, 4.8vw, 76px);
  line-height: .98;
  font-weight: 800;
  letter-spacing: -3.4px;
  color: #fff;
  text-shadow: 0 18px 44px rgba(0,0,0,.5);
}
.hero-title span,
.login-card h2 span {
  background: linear-gradient(90deg, #0ea5ff 0%, #38bdf8 42%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  margin: clamp(22px, 3vh, 32px) 0 0;
  max-width: 440px;
  color: rgba(226,232,240,.88);
  font-size: clamp(20px, 1.75vw, 29px);
  line-height: 1.42;
  font-weight: 500;
}
.login-card {
  position: relative;
  min-height: clamp(510px, 68vh, 660px);
  padding: clamp(42px, 5.5vh, 68px) clamp(34px, 4vw, 64px);
  border-radius: clamp(28px, 3vw, 48px);
  background: linear-gradient(145deg, rgba(3,10,27,.76), rgba(9,16,40,.64));
  border: 1px solid rgba(125, 171, 255, .55);
  box-shadow:
    0 0 0 1px rgba(56,189,248,.10) inset,
    0 0 26px rgba(56,189,248,.28),
    0 0 62px rgba(139,92,246,.22),
    0 26px 80px rgba(0,0,0,.58);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(56,189,248,.95), rgba(100,116,255,.34) 42%, rgba(192,132,252,.95));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.login-card::after {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -3px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #38bdf8, #a855f7, transparent);
  box-shadow: 0 0 22px rgba(139,92,246,.95);
  opacity: .9;
}
.login-icon {
  width: clamp(76px, 7vw, 112px);
  height: clamp(76px, 7vw, 112px);
  margin: 0 auto clamp(26px, 3vh, 40px);
  display: grid;
  place-items: center;
  color: #38bdf8;
  border: 2px solid rgba(56,189,248,.75);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(56,189,248,.22), inset 0 0 24px rgba(59,130,246,.10);
}
.login-icon svg { width: 58%; height: 58%; filter: drop-shadow(0 0 12px rgba(139,92,246,.38)); }
.login-card h2 {
  margin: 0;
  text-align: center;
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: clamp(34px, 3.2vw, 54px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -2px;
}
.card-line { margin: clamp(18px, 2.2vh, 26px) auto clamp(34px, 4.5vh, 54px); }
#login-form { width: 100%; }
.login-card label {
  display: block;
  margin: 0 0 12px;
  color: #f8fafc;
  font-size: clamp(15px, 1vw, 18px);
  font-weight: 700;
}
.field-wrap {
  position: relative;
  margin-bottom: clamp(22px, 3vh, 34px);
}
.field-wrap input {
  width: 100%;
  height: clamp(58px, 7vh, 76px);
  padding: 0 clamp(50px, 4vw, 70px);
  border-radius: 14px;
  border: 1px solid rgba(148,163,255,.50);
  background: rgba(2, 8, 23, .54);
  color: #f8fafc;
  outline: none;
  font-size: clamp(17px, 1.25vw, 22px);
  font-weight: 500;
  box-shadow: inset 0 0 18px rgba(0,0,0,.35);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.field-wrap input::placeholder { color: rgba(203,213,225,.70); }
.field-wrap input:focus {
  border-color: rgba(56,189,248,.96);
  box-shadow: 0 0 0 3px rgba(56,189,248,.14), inset 0 0 18px rgba(0,0,0,.35);
}
.field-icon,
.password-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(226,232,240,.76);
}
.field-icon {
  left: clamp(18px, 1.6vw, 28px);
  width: clamp(24px, 1.8vw, 32px);
  height: clamp(24px, 1.8vw, 32px);
}
.password-toggle {
  right: clamp(16px, 1.5vw, 24px);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.password-toggle svg { width: 28px; height: 28px; }
.login-button {
  width: 100%;
  height: clamp(64px, 8vh, 84px);
  margin-top: clamp(14px, 1.6vh, 24px);
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2394ff 0%, #38bdf8 45%, #ba4eea 100%);
  color: #fff;
  font-size: clamp(24px, 2vw, 33px);
  font-weight: 800;
  letter-spacing: -.6px;
  cursor: pointer;
  box-shadow: 0 14px 38px rgba(37,99,235,.32), 0 0 28px rgba(168,85,247,.18);
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}
.login-button span { margin-left: 22px; font-weight: 500; }
.login-button:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 18px 42px rgba(37,99,235,.44), 0 0 34px rgba(168,85,247,.26); }
.error {
  padding: 12px 14px;
  margin: 0 0 18px;
  border: 1px solid rgba(248,113,113,.45);
  border-radius: 12px;
  background: rgba(127,29,29,.24);
  color: #fecaca;
  font-weight: 600;
}

/* ================= MOBILE LOGIN ================= */
@media (max-width: 980px) {
  .login-page {
    min-height: 100svh;
    padding: 22px 16px 30px;
    display: block;
    overflow-y: auto;
  }
  .login-bg {
    background-size: auto 100%;
    background-position: 34% center;
    opacity: .78;
  }
  .login-overlay {
    background:
      linear-gradient(180deg, rgba(2,6,23,.52) 0%, rgba(2,6,23,.78) 44%, rgba(2,6,23,.92) 100%),
      radial-gradient(circle at 50% 15%, rgba(56,189,248,.18), transparent 46%);
  }
  .login-shell {
    min-height: calc(100svh - 52px);
    width: min(100%, 520px);
    margin: 0 auto;
    grid-template-columns: 1fr;
    gap: 22px;
    align-content: center;
  }
  .hero-copy {
    width: 100%;
    text-align: center;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .brand-hero { margin-bottom: 16px; }
  .brand-mark { width: 62px; }
  .brand-name { font-size: 40px; letter-spacing: -2px; }
  .hero-line { margin-bottom: 16px; width: 42px; }
  .hero-title {
    max-width: 360px;
    font-size: clamp(34px, 9vw, 44px);
    line-height: 1.03;
    letter-spacing: -1.8px;
  }
  .hero-subtitle {
    max-width: 320px;
    margin-top: 14px;
    font-size: 17px;
    line-height: 1.35;
  }
  .login-card {
    min-height: auto;
    border-radius: 26px;
    padding: 28px 20px 24px;
  }
  .login-icon { width: 64px; height: 64px; margin-bottom: 18px; }
  .login-card h2 { font-size: 31px; }
  .card-line { margin: 14px auto 24px; }
  .login-card label { font-size: 14px; margin-bottom: 8px; }
  .field-wrap { margin-bottom: 17px; }
  .field-wrap input { height: 54px; font-size: 16px; border-radius: 12px; padding-left: 48px; padding-right: 48px; }
  .field-icon { left: 16px; width: 22px; height: 22px; }
  .password-toggle { right: 10px; }
  .password-toggle svg { width: 24px; height: 24px; }
  .login-button { height: 58px; font-size: 22px; margin-top: 8px; }
}

@media (max-width: 520px) {
  .login-page { padding: 16px 12px 24px; }
  .login-shell { min-height: calc(100svh - 40px); gap: 18px; }
  .brand-mark { width: 54px; }
  .brand-name { font-size: 34px; }
  .hero-title { font-size: clamp(29px, 8.6vw, 36px); max-width: 310px; }
  .hero-subtitle { font-size: 15.5px; }
  .login-card { padding: 24px 16px 18px; }
  .login-icon { display: none; }
  .login-card h2 { font-size: 28px; }
  .card-line { margin-bottom: 20px; }
}

@media (max-width: 380px) {
  .hero-title { font-size: 28px; }
  .brand-name { font-size: 31px; }
  .login-card h2 { font-size: 25px; }
  .field-wrap input { height: 50px; font-size: 15px; }
  .login-button { height: 54px; font-size: 20px; }
}

/* ================= ÁREA LOGADA ORIGINAL ================= */
.topbar { background: transparent; color: #fff; }
.app-header {
  min-height: 118px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 34px 30px 0;
}
.app-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.app-logo-mark { width: 96px; height: 72px; }
.app-logo span { color: #168dff; font-size: 30px; line-height: 1; font-weight: 800; }
.app-actions { display: flex; gap: 12px; margin-top: 28px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px; }
.client-wrap { max-width: 1280px; margin: 0 auto; padding: 24px 24px 80px; }
h1, h2 { margin: 0 0 12px; }
p { color: var(--muted); }
button, .pill-button {
  font-family: inherit;
}
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 112px;
  height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #65d3ff, #2f7cff);
  color: #07101d;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.pill-button:disabled { cursor: not-allowed; filter: grayscale(0.5) brightness(0.72); opacity: 0.72; }
.media-button { flex: 0 0 auto; width: auto; }
.media-section { text-align: center; margin-bottom: 64px; }
.media-section h1 { font-size: 31px; font-weight: 500; margin-bottom: 36px; }
.client-video { display: block; width: min(1028px, calc(100vw - 64px)); aspect-ratio: 16 / 9; margin: 0 auto; background: #000; border-radius: 0; }
.media-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 18px auto 0; width: min(1028px, calc(100vw - 64px)); }
.video-actions { width: min(520px, calc(100vw - 64px)); }
.media-buttons .pill-button { min-width: 112px; height: 42px; font-size: 16px; }
.exam-viewer { position: relative; width: min(1140px, calc(100vw - 64px)); margin: 0 auto; background: #000; min-height: 520px; overflow: hidden; }
.exam-count { position: absolute; top: 16px; left: 22px; color: #c7c7c7; font-size: 16px; z-index: 2; }
.viewer-icons { position: absolute; top: 16px; right: 18px; color: #b9c5e4; font-size: 25px; letter-spacing: 14px; z-index: 2; }
.exam-image { display: block; max-width: 100%; max-height: 742px; min-height: 520px; margin: 0 auto; object-fit: contain; }
.image-actions { width: min(1140px, calc(100vw - 64px)); }
.image-toolbar { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: center; gap: 14px 28px; width: min(1140px, calc(100vw - 64px)); margin: 18px auto 0; }
.image-nav, .image-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.image-nav { padding-right: 28px; border-right: 1px solid var(--line); }
.missing-image { display: grid; place-items: center; min-height: 520px; color: var(--muted); }
.grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr); gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.spaced { margin-top: 18px; }
.meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.meta div { border-bottom: 1px solid var(--line); padding: 8px 0; }
.meta span { display: block; color: var(--muted); font-size: 13px; }
.video-box { width: 100%; background: #000; border-radius: 8px; }
.ok { color: var(--ok); font-weight: 700; }
.warn { color: var(--warn); font-weight: 700; }
.images { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.image-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.image-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #eef2f7; }
.image-card small { display: block; padding: 8px; color: var(--muted); }
#print-sheet { display: none; }

@media (max-width: 820px) {
  .grid, .meta { grid-template-columns: 1fr; }
  .wrap { padding: 16px; }
  .app-header { min-height: 82px; padding: 16px 16px 0; align-items: flex-start; }
  .app-logo-mark { width: 62px; height: 46px; }
  .app-logo span { font-size: 21px; }
  .app-actions { margin-top: 10px; gap: 8px; }
  .app-actions .pill-button { min-width: 84px; height: 38px; font-size: 14px; padding: 0 12px; }
  .client-wrap { max-width: 100%; padding: 18px 12px 56px; }
  .media-section { margin-bottom: 44px; }
  .media-section h1 { font-size: 27px; margin-bottom: 22px; }
  .client-video, .exam-viewer { width: calc(100vw - 24px); }
  .exam-viewer, .exam-image, .missing-image { min-height: 300px; }
  .media-buttons { width: calc(100vw - 24px); gap: 8px; }
  .video-actions { width: calc(100vw - 24px); }
  .image-toolbar { grid-template-columns: 1fr; width: calc(100vw - 24px); gap: 12px; }
  .image-nav { padding-right: 0; padding-bottom: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .image-nav, .image-tools { width: 100%; }
  .media-buttons .pill-button { min-width: 94px; height: 38px; font-size: 14px; padding: 0 12px; }
  .image-toolbar .pill-button { min-width: calc(50% - 6px); height: 40px; font-size: 14px; }
  .image-tools .pill-button { min-width: calc(33.333% - 8px); }
}
@media (max-width: 480px) {
  .app-header { padding-inline: 12px; }
  .client-video { width: calc(100vw - 20px); }
  .exam-viewer { width: calc(100vw - 20px); min-height: 260px; }
  .exam-image, .missing-image { min-height: 260px; max-height: 72vh; }
  .image-toolbar, .media-buttons, .video-actions { width: calc(100vw - 20px); }
  .image-tools .pill-button { min-width: 100%; }
}

@media print {
  @page { size: A4 portrait; margin: 8mm; }
  body.printing-exam > *:not(#print-sheet) { display: none !important; }
  body.printing-exam { background: #fff; color: #000; }
  body.printing-exam #print-sheet { display: block; }
  .print-page { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(3, 1fr); gap: 5mm; height: calc(297mm - 16mm); page-break-after: always; }
  .print-page:last-child { page-break-after: auto; }
  .print-item { display: flex; flex-direction: column; justify-content: center; margin: 0; border: 1px solid #ccc; break-inside: avoid; overflow: hidden; }
  .print-item img { width: 100%; height: calc(100% - 14px); object-fit: contain; background: #000; }
  .print-item figcaption { height: 14px; font: 10px Arial, sans-serif; text-align: center; color: #000; }
}



/* Mobile background override - ultrasound focus */
@media (max-width: 768px){
  body,
  .hero,
  .hero-section,
  .main-bg,
  .background-exames,
  .hero-bg{
    background-position: center top !important;
  }

  .background-exames,
  .hero-bg{
    background-image:
      linear-gradient(rgba(2,6,23,.78), rgba(2,6,23,.88)),
      url('./assets/bg-ultrassom-mobile.png') !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
  }
}
