/* ═══════════════════════════════════════════════════════════
   AMMO PACS — Folha de estilos global
   Compartilhado por todas as páginas do sistema
   Ordem: Base → Componentes compartilhados → Páginas específicas
═══════════════════════════════════════════════════════════ */


/* ══════════════════════════════════════════════════════════
   BASE
══════════════════════════════════════════════════════════ */

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

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(42, 191, 191, 0.25); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(42, 191, 191, 0.45); }

/* ── Body ──────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #111118 0%, #1A1A2E 50%, #22223A 100%);
  color: #e2e8f0;
  min-height: 100vh;
}

/* Página inicial: layout centralizado */
body.page-index {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Página share: viewer full-height */
html.page-share,
html.page-share body {
  height: 100%;
  overflow: hidden;
}
body.page-share {
  background: #0d0d14;
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: unset;
}


/* ══════════════════════════════════════════════════════════
   TOPBAR  (explorer, upload, machines, dashboard)
══════════════════════════════════════════════════════════ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: rgba(17, 17, 24, 0.92);
  border-bottom: 1px solid rgba(42, 191, 191, 0.12);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left    { display: flex; align-items: center; gap: 14px; }
.topbar-logo    { height: 32px; width: auto; filter: drop-shadow(0 0 8px rgba(42, 191, 191, 0.25)); }
.topbar-divider { width: 1px; height: 22px; background: rgba(148, 163, 184, 0.2); }
.topbar-title   { font-size: 14px; font-weight: 600; color: #2ABFBF; letter-spacing: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-nav     { display: flex; gap: 6px; }

.topbar-nav a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.2s;
}
.topbar-nav a:hover,
.topbar-nav a.active {
  color: #2ABFBF;
  background: rgba(42, 191, 191, 0.08);
}


/* ══════════════════════════════════════════════════════════
   QR BUTTON & MODAL  (index, explorer, upload, machines)
══════════════════════════════════════════════════════════ */

.qr-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-btn:hover { color: #2ABFBF; background: rgba(42, 191, 191, 0.08); }

/* Versão com fundo visível (index – sino flutuante) */
body.page-index .qr-btn {
  background: rgba(17, 17, 24, 0.85);
  border: 1px solid rgba(42, 191, 191, 0.2);
  padding: 8px 10px;
  border-radius: 10px;
}
body.page-index .qr-btn:hover {
  border-color: rgba(42, 191, 191, 0.45);
  background: rgba(42, 191, 191, 0.08);
}

.qr-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.qr-modal-overlay.open { opacity: 1; pointer-events: all; }

.qr-modal {
  background: #1A1A2E;
  border: 1px solid rgba(42, 191, 191, 0.2);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  max-width: 300px;
  width: 90%;
}
.qr-modal-title  { font-size: 15px; font-weight: 700; color: #e2e8f0; margin-bottom: 4px; }
.qr-modal-sub    { font-size: 11px; color: #64748b; margin-bottom: 18px; word-break: break-all; }
.qr-canvas-wrap  { background: #fff; border-radius: 10px; padding: 12px; display: inline-block; margin-bottom: 18px; line-height: 0; }
.qr-modal-actions { display: flex; gap: 8px; justify-content: center; }

.qr-action-btn {
  background: rgba(42, 191, 191, 0.1);
  border: 1px solid rgba(42, 191, 191, 0.25);
  color: #2ABFBF;
  font-size: 12px; font-weight: 600;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.qr-action-btn:hover { background: rgba(42, 191, 191, 0.22); border-color: rgba(42, 191, 191, 0.5); }
.qr-action-btn.close-btn { color: #64748b; border-color: rgba(100, 116, 139, 0.25); background: rgba(100, 116, 139, 0.06); }
.qr-action-btn.close-btn:hover { background: rgba(100, 116, 139, 0.14); }


/* ══════════════════════════════════════════════════════════
   NOTIFICATION BELL  (todas as páginas com topbar)
══════════════════════════════════════════════════════════ */

.notif-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Index: sino fixo no canto */
body.page-index .notif-wrapper {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 6px;
}

.notif-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-btn:hover { color: #2ABFBF; background: rgba(42, 191, 191, 0.08); }

/* Versão com fundo visível (index & dashboard) */
body.page-index .notif-btn,
body.page-dashboard .notif-btn {
  background: rgba(17, 17, 24, 0.85);
  border: 1px solid rgba(42, 191, 191, 0.2);
  padding: 8px 10px;
  border-radius: 10px;
  backdrop-filter: blur(10px);
}
body.page-index .notif-btn:hover,
body.page-dashboard .notif-btn:hover {
  border-color: rgba(42, 191, 191, 0.4);
  background: rgba(42, 191, 191, 0.08);
}

.notif-badge {
  position: absolute;
  top: 1px; right: 1px;
  background: #ef4444;
  color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 50%;
  min-width: 15px; height: 15px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1;
  pointer-events: none;
}

/* Badge no sino flutuante do index/dashboard fica no canto externo */
body.page-index .notif-badge,
body.page-dashboard .notif-badge {
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: #1A1A2E;
  border: 1px solid rgba(42, 191, 191, 0.2);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  z-index: 1001;
  display: none;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(42, 191, 191, 0.1);
}
.notif-header-title {
  font-size: 13px; font-weight: 600; color: #e2e8f0;
  display: flex; align-items: center; gap: 6px;
}
/* Dashboard usa nome de classe diferente para o header interno */
.notif-header-drop {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(42, 191, 191, 0.1);
}

.notif-sound-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 3px 5px; border-radius: 6px;
  transition: background 0.15s; line-height: 1; opacity: 0.65;
}
.notif-sound-btn:hover { background: rgba(42, 191, 191, 0.1); opacity: 1; }

.notif-header-close {
  background: none; border: none; color: #64748b; cursor: pointer;
  font-size: 16px; padding: 2px 6px; border-radius: 6px;
  transition: all 0.2s; line-height: 1;
}
.notif-header-close:hover { color: #e2e8f0; background: rgba(255, 255, 255, 0.06); }

.notif-header-actions { display: flex; align-items: center; gap: 4px; }

.notif-clear-btn {
  background: none; border: none; color: #64748b; cursor: pointer;
  padding: 2px 6px; border-radius: 6px; transition: all 0.2s;
  line-height: 0; align-items: center;
}
.notif-clear-btn:hover { color: #ef4444; background: rgba(239, 68, 68, 0.12); }

.notif-confirm-ok {
  background: none; border: none; color: #22c55e; cursor: pointer;
  font-size: 18px; padding: 2px 5px; border-radius: 6px;
  transition: all 0.2s; line-height: 1; font-weight: bold;
}
.notif-confirm-ok:hover { background: rgba(34, 197, 94, 0.12); }

.notif-confirm-cancel {
  background: none; border: none; color: #ef4444; cursor: pointer;
  font-size: 15px; padding: 2px 6px; border-radius: 6px;
  transition: all 0.2s; line-height: 1;
}
.notif-confirm-cancel:hover { background: rgba(239, 68, 68, 0.12); }

.notif-list { max-height: 380px; overflow-y: auto; }
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-track { background: transparent; }
.notif-list::-webkit-scrollbar-thumb { background: rgba(42, 191, 191, 0.25); border-radius: 2px; }

/* Dashboard usa notif-list com altura menor */
body.page-dashboard .notif-list { max-height: 340px; }

.notif-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s;
}
.notif-card:last-child { border-bottom: none; }
.notif-card:hover { background: rgba(255, 255, 255, 0.03); }
.notif-card.clickable { cursor: pointer; }
.notif-card.clickable:hover { background: rgba(42, 191, 191, 0.07); }
.notif-card.unread { background: rgba(42, 191, 191, 0.05); border-left: 2px solid rgba(42, 191, 191, 0.4); }

.notif-card-icon    { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.notif-card-body    { flex: 1; min-width: 0; }
.notif-card-patient { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-card-machine { font-size: 11px; color: #2ABFBF; margin-top: 3px; }
.notif-card-time    { font-size: 11px; color: #475569; margin-top: 2px; }

.notif-card-del {
  background: none; border: none; color: #334155; cursor: pointer;
  padding: 4px 6px; border-radius: 6px; transition: all 0.2s;
  font-size: 13px; flex-shrink: 0; line-height: 1;
}
.notif-card-del:hover { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

.notif-card-print {
  background: none; border: none; color: #334155; cursor: pointer;
  padding: 4px 6px; border-radius: 6px; transition: all 0.2s;
  font-size: 13px; flex-shrink: 0; line-height: 1;
}
.notif-card-print:hover { color: #2ABFBF; background: rgba(42, 191, 191, 0.1); }

.notif-add-machine-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(42, 191, 191, 0.1);
  border: 1px solid rgba(42, 191, 191, 0.25);
  color: #2ABFBF; padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  text-decoration: none; margin-top: 5px; transition: all 0.2s;
}
.notif-add-machine-btn:hover { background: rgba(42, 191, 191, 0.2); border-color: rgba(42, 191, 191, 0.45); }

.notif-group          { border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.notif-group-header   { display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; transition: background 0.15s; }
.notif-group-header:hover  { background: rgba(42, 191, 191, 0.07); }
.notif-group-header.unread { background: rgba(42, 191, 191, 0.05); border-left: 2px solid rgba(42, 191, 191, 0.4); }
.notif-group-count    { background: rgba(42, 191, 191, 0.12); border: 1px solid rgba(42, 191, 191, 0.25); color: #2ABFBF; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.notif-group-chevron  { font-size: 10px; color: #475569; flex-shrink: 0; transition: transform 0.2s; margin-left: 2px; }
.notif-group-chevron.open { transform: rotate(180deg); }
.notif-group-items    { background: rgba(0, 0, 0, 0.12); }
.notif-group-item     { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px 10px 32px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); transition: background 0.15s; }
.notif-group-item:last-child  { border-bottom: none; }
.notif-group-item.clickable   { cursor: pointer; }
.notif-group-item.clickable:hover { background: rgba(42, 191, 191, 0.07); }

.notif-empty      { padding: 36px 20px; text-align: center; color: #475569; font-size: 13px; }
.notif-empty-icon { display: block; font-size: 28px; margin-bottom: 8px; }

/* Dashboard: item simples no dropdown */
.notif-item        { padding: 11px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.notif-item.unread { border-left: 2px solid #2ABFBF; }
.notif-patient     { font-size: 13px; color: #e2e8f0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-meta        { font-size: 11px; color: #64748b; margin-top: 3px; }
.notif-footer      { padding: 10px 18px; border-top: 1px solid rgba(42, 191, 191, 0.08); text-align: center; }
.notif-footer a    { font-size: 12px; color: #2ABFBF; text-decoration: none; opacity: 0.8; }
.notif-footer a:hover { opacity: 1; }

@media (max-width: 400px) {
  .notif-dropdown { width: 290px; right: -4px; }
}


/* ══════════════════════════════════════════════════════════
   BOTÕES  (compartilhados)
══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(42, 191, 191, 0.12);
  border: 1px solid rgba(42, 191, 191, 0.3);
  color: #2ABFBF;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: rgba(42, 191, 191, 0.2); border-color: rgba(42, 191, 191, 0.5); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-gold {
  background: rgba(197, 150, 58, 0.12);
  border-color: rgba(197, 150, 58, 0.3);
  color: #C5963A;
}
.btn-gold:hover { background: rgba(197, 150, 58, 0.2); border-color: rgba(197, 150, 58, 0.5); }

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 6px;
  background: rgba(42, 191, 191, 0.08);
  border: 1px solid rgba(42, 191, 191, 0.2);
  color: #2ABFBF;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-sm:hover { background: rgba(42, 191, 191, 0.18); }
.btn-sm.danger { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.2); color: #ef4444; }
.btn-sm.danger:hover { background: rgba(239, 68, 68, 0.18); }
.btn-sm.share  { color: #a78bfa; border-color: rgba(167, 139, 250, 0.3); }
.btn-sm.share:hover  { background: rgba(167, 139, 250, 0.12); border-color: rgba(167, 139, 250, 0.5); }
.btn-sm.laudo  { color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
.btn-sm.laudo:hover  { background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.5); }
.btn-sm.laudo:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm.laudo.active { color: #ef4444; border-color: rgba(239, 68, 68, 0.35); }
.btn-sm.laudo.active:hover { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.55); }


/* ══════════════════════════════════════════════════════════
   SPINNER / LOADING  (compartilhado)
══════════════════════════════════════════════════════════ */

.spinner {
  display: inline-block;
  width: 28px; height: 28px;
  border: 3px solid rgba(42, 191, 191, 0.15);
  border-top-color: #2ABFBF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Variante menor usada no dashboard */
body.page-dashboard .spinner {
  width: 20px; height: 20px;
  border-width: 2px;
  display: block;
}

/* Variante da página share */
body.page-share .spinner {
  width: 36px; height: 36px;
  border-width: 3px;
  margin: 0 auto 16px;
  display: block;
}

/* TOAST (machines) */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1A1A2E; border: 1px solid rgba(42, 191, 191, 0.3);
  border-radius: 12px; padding: 14px 20px;
  font-size: 13px; color: #e2e8f0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 999; display: none;
  align-items: center; gap: 10px;
  animation: slideIn 0.3s ease;
}
.toast.show  { display: flex; }
.toast.error { border-color: rgba(239, 68, 68, 0.4); }

@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Main layout base */
.main { margin: 0 auto; padding: 28px; }
body.page-explorer  .main { max-width: 1200px; }
body.page-upload    .main { max-width: 900px; padding: 40px 28px; }
body.page-machines  .main { max-width: 960px; padding: 32px 28px; }
body.page-dashboard .main { max-width: 1400px; }


/* ══════════════════════════════════════════════════════════
   PÁGINA: INDEX
══════════════════════════════════════════════════════════ */

.container    { text-align: center; padding: 40px; max-width: 1100px; width: 100%; }
.logo-container { margin-bottom: 30px; }
.logo-img {
  max-width: 280px; height: auto;
  margin: 0 auto 10px; display: block;
  filter: drop-shadow(0 0 40px rgba(42, 191, 191, 0.25));
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { filter: drop-shadow(0 0 40px rgba(42, 191, 191, 0.25)); }
  50%       { filter: drop-shadow(0 0 60px rgba(42, 191, 191, 0.4)); }
}

h1 { font-size: 0; margin: 0; height: 0; overflow: hidden; }

.subtitle {
  font-size: 14px; color: #94a3b8;
  letter-spacing: 4px; text-transform: uppercase;
  margin-bottom: 50px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 50px;
}

.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(42, 191, 191, 0.15);
  border-radius: 16px;
  padding: 28px 20px;
  text-decoration: none;
  color: #e2e8f0;
  transition: all 0.3s ease;
  cursor: pointer;
}
.card:hover {
  background: rgba(42, 191, 191, 0.08);
  border-color: rgba(42, 191, 191, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(42, 191, 191, 0.12), 0 4px 20px rgba(197, 150, 58, 0.08);
}
.card-icon  { font-size: 36px; margin-bottom: 16px; display: block; }
.card h3    { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: #2ABFBF; }
.card p     { font-size: 13px; color: #94a3b8; line-height: 1.5; }

.status {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 100px;
  padding: 8px 20px;
  font-size: 13px; color: #10b981;
}
.status-dot {
  width: 8px; height: 8px;
  background: #10b981; border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

footer     { margin-top: 40px; font-size: 12px; color: #475569; }
footer a   { color: #64748b; text-decoration: none; }

@media (max-width: 768px) {
  .cards     { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .cards     { grid-template-columns: 1fr; }
  .container { padding: 20px; }
}


/* ══════════════════════════════════════════════════════════
   PÁGINA: EXPLORER
══════════════════════════════════════════════════════════ */

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(42, 191, 191, 0.1);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: center;
}
.stat-value { font-size: 28px; font-weight: 700; color: #2ABFBF; line-height: 1; }
.stat-label { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 1.5px; margin-top: 6px; }

/* Search & date filter */
.search-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.search-bar input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(42, 191, 191, 0.15);
  border-radius: 10px;
  padding: 12px 18px;
  color: #e2e8f0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.search-bar input::placeholder { color: #475569; }
.search-bar input:focus { border-color: rgba(42, 191, 191, 0.5); }

.date-filter { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.date-filter label { font-size: 12px; color: #64748b; white-space: nowrap; }
.date-filter input[type="date"] {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(42, 191, 191, 0.15);
  border-radius: 10px;
  padding: 10px 12px;
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  width: 140px;
  color-scheme: dark;
}
.date-filter input[type="date"]:focus { border-color: rgba(42, 191, 191, 0.5); }

/* Badge NOVO */
.badge-novo {
  display: inline-flex; align-items: center;
  background: rgba(42, 191, 191, 0.12);
  border: 1px solid rgba(42, 191, 191, 0.35);
  color: #2ABFBF;
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px;
  letter-spacing: 0.5px; margin-left: 6px;
  vertical-align: middle;
  animation: badge-glow 2s ease-in-out infinite;
}
@keyframes badge-glow {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Table */
.table-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(42, 191, 191, 0.08);
  border-radius: 14px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead { background: rgba(42, 191, 191, 0.06); }
th {
  padding: 14px 18px;
  text-align: left;
  font-size: 11px; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid rgba(42, 191, 191, 0.08);
}
td { padding: 14px 18px; font-size: 13px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
tr { cursor: pointer; transition: background 0.15s; }
tr:hover td { background: rgba(42, 191, 191, 0.04); }

.patient-name { color: #e2e8f0; font-weight: 500; }
.study-desc   { color: #94a3b8; }
.study-date   { color: #94a3b8; font-variant-numeric: tabular-nums; }
.modality-badge {
  display: inline-block;
  background: rgba(42, 191, 191, 0.1); color: #2ABFBF;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 6px; letter-spacing: 0.5px;
}
.actions-cell { display: flex; gap: 6px; }

/* Empty & Loading */
.empty      { text-align: center; padding: 60px 20px; color: #475569; }
.empty-icon { font-size: 48px; margin-bottom: 16px; display: block; }
.empty h3   { color: #64748b; font-size: 16px; margin-bottom: 6px; }
.empty p    { font-size: 13px; }
.loading    { text-align: center; padding: 48px; color: #64748b; }
.spinner    { display: inline-block; margin-bottom: 12px; }

/* Detail panel */
.detail-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(42, 191, 191, 0.1);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 20px 24px 24px;
}
.detail-row > td { padding: 0 !important; border-bottom: 2px solid rgba(42, 191, 191, 0.15); }
tr.active-row > td { background: rgba(42, 191, 191, 0.05) !important; }
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.detail-header h3 { color: #2ABFBF; font-size: 16px; }

.series-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.series-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(42, 191, 191, 0.08);
  border-radius: 10px; padding: 16px;
  transition: all 0.2s; cursor: pointer;
}
.series-card:hover { border-color: rgba(42, 191, 191, 0.3); background: rgba(42, 191, 191, 0.04); }
.series-info strong { color: #e2e8f0; font-size: 13px; }
.series-info span   { color: #64748b; font-size: 12px; display: block; margin-top: 4px; }

/* Tabs */
.tabs-bar {
  display: flex; gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tab-btn {
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: #64748b;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  padding: 10px 22px;
  cursor: pointer; transition: all 0.2s;
  text-transform: uppercase; margin-bottom: -1px;
}
.tab-btn:hover { color: #94a3b8; }
.tab-btn.active { color: #2ABFBF; border-bottom-color: #2ABFBF; }

/* Pacientes */
.patient-count-badge {
  background: rgba(42, 191, 191, 0.12); color: #2ABFBF;
  border-radius: 999px; padding: 2px 10px;
  font-size: 11px; font-weight: 700; display: inline-block;
}
.patient-studies-row > td { padding: 0 !important; border-bottom: 2px solid rgba(42, 191, 191, 0.15); }
.patient-studies-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(42, 191, 191, 0.1);
  border-top: none; border-radius: 0 0 12px 12px;
  padding: 14px 20px 18px;
}
tr.active-patient-row > td { background: rgba(42, 191, 191, 0.05) !important; }

.study-entry {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 8px; border-radius: 8px;
  cursor: pointer; transition: background 0.15s; margin-bottom: 2px;
}
.study-entry:hover { background: rgba(42, 191, 191, 0.05); }
.study-entry.active-study-entry { background: rgba(42, 191, 191, 0.07); }

.study-date-tag {
  background: rgba(197, 150, 58, 0.12); color: #C5963A;
  border-radius: 8px; padding: 6px 10px;
  font-size: 11px; font-weight: 700;
  min-width: 76px; text-align: center; flex-shrink: 0;
}
.study-entry-info { flex: 1; min-width: 0; }
.study-entry-desc { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.study-entry-meta { font-size: 11px; color: #64748b; margin-top: 2px; }
.study-entry-actions { display: flex; gap: 6px; flex-shrink: 0; }
.study-series-block { margin: 2px 0 8px 100px; border-left: 2px solid rgba(42, 191, 191, 0.2); padding-left: 16px; }

/* Share modal (explorer) */
.share-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.share-modal-overlay.open { opacity: 1; pointer-events: all; }
.share-modal {
  background: #1A1A2E; border: 1px solid rgba(42, 191, 191, 0.2);
  border-radius: 16px; padding: 28px 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6); width: 90%; max-width: 380px;
}
.share-modal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.share-modal-title  { font-size: 15px; font-weight: 700; color: #e2e8f0; }
.share-modal-sub    { font-size: 12px; color: #64748b; margin-bottom: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-duration-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.share-duration-btn {
  flex: 1 1 calc(33.33% - 6px); min-width: 0; padding: 9px 4px;
  border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1px solid rgba(42, 191, 191, 0.25);
  background: rgba(42, 191, 191, 0.06); color: #94a3b8; transition: all 0.15s;
}
.share-duration-btn:hover  { border-color: rgba(42, 191, 191, 0.5); color: #2ABFBF; background: rgba(42, 191, 191, 0.12); }
.share-duration-btn.active { background: rgba(42, 191, 191, 0.18); border-color: #2ABFBF; color: #2ABFBF; }
.share-link-wrap { margin-bottom: 16px; }
.share-link-box {
  display: flex; gap: 8px; align-items: center;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(42, 191, 191, 0.2);
  border-radius: 10px; padding: 10px 12px;
}
.share-link-input { flex: 1; background: none; border: none; outline: none; color: #cbd5e1; font-size: 12px; font-family: monospace; min-width: 0; }
.share-copy-btn {
  background: rgba(42, 191, 191, 0.12); border: 1px solid rgba(42, 191, 191, 0.3);
  color: #2ABFBF; font-size: 12px; font-weight: 600; padding: 5px 12px;
  border-radius: 6px; cursor: pointer; transition: all 0.15s; white-space: nowrap; flex-shrink: 0;
}
.share-copy-btn:hover  { background: rgba(42, 191, 191, 0.25); }
.share-copy-btn.copied { background: rgba(34, 197, 94, 0.15); border-color: rgba(34, 197, 94, 0.4); color: #22c55e; }
.share-expiry      { font-size: 11px; color: #475569; margin-top: 6px; }
.share-modal-footer { display: flex; justify-content: flex-end; }
.share-close-btn {
  background: rgba(100, 116, 139, 0.06); border: 1px solid rgba(100, 116, 139, 0.25);
  color: #64748b; font-size: 12px; font-weight: 600; padding: 7px 18px;
  border-radius: 8px; cursor: pointer; transition: all 0.15s;
}
.share-close-btn:hover { background: rgba(100, 116, 139, 0.14); }

/* Exportação */
.export-th { display: none; width: 36px; padding: 14px 4px 14px 16px !important; }
.export-td { display: none; width: 36px; padding: 0 4px 0 16px !important; }
.export-mode .export-th,
.export-mode .export-td { display: table-cell; }
.export-cb {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; min-width: 16px;
  border: 1.5px solid rgba(42, 191, 191, 0.25);
  border-radius: 4px; background: rgba(255, 255, 255, 0.04);
  cursor: pointer; position: relative; transition: all 0.15s; display: block;
}
.export-cb:hover   { border-color: rgba(42, 191, 191, 0.7); background: rgba(42, 191, 191, 0.08); }
.export-cb:checked { background: #2ABFBF; border-color: #2ABFBF; }
.export-cb:checked::after {
  content: ''; position: absolute;
  left: 3px; top: 1px; width: 7px; height: 4px;
  border-left: 2px solid #111118; border-bottom: 2px solid #111118;
  transform: rotate(-45deg);
}
.export-cb:indeterminate { background: rgba(42, 191, 191, 0.2); border-color: #2ABFBF; }
.export-cb:indeterminate::after {
  content: ''; position: absolute;
  left: 3px; top: 6px; width: 8px; height: 2px;
  background: #2ABFBF; border-radius: 1px;
}
.study-entry-cb-wrap { display: none; align-items: center; flex-shrink: 0; margin-right: 4px; }
.export-mode .study-entry-cb-wrap { display: flex; }
.btn-export-cancel { background: rgba(239, 68, 68, 0.1) !important; border-color: rgba(239, 68, 68, 0.3) !important; color: #ef4444 !important; }
.btn-export-cancel:hover { background: rgba(239, 68, 68, 0.2) !important; border-color: rgba(239, 68, 68, 0.5) !important; }
.btn-download-zip {
  background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e; padding: 10px 22px; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  align-items: center; gap: 6px; transition: all 0.2s; white-space: nowrap;
}
.btn-download-zip:hover:not(:disabled) { background: rgba(34, 197, 94, 0.2); border-color: rgba(34, 197, 94, 0.5); }
.btn-download-zip:disabled { opacity: 0.35; cursor: not-allowed; }

/* Explorer responsive */
@media (max-width: 768px) {
  body.page-explorer .topbar { padding: 10px 14px; }
  body.page-explorer .topbar-nav { display: none; }
  body.page-explorer .main { padding: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
  .stat-card { padding: 14px 12px; }
  .stat-value { font-size: 22px; }
  .search-bar { flex-direction: column; gap: 8px; }
  .search-bar > * { width: 100%; }
  .search-bar > input { box-sizing: border-box; }
  .date-filter { width: 100%; gap: 6px; }
  .date-filter input[type=date] { flex: 1; width: auto; min-width: 100px; }
  .search-bar > .btn, .search-bar > a.btn { justify-content: center; }
  .search-bar > div:not(.date-filter) { display: flex; gap: 8px; flex-wrap: wrap; }
  .search-bar > div:not(.date-filter) .btn,
  .search-bar > div:not(.date-filter) .btn-download-zip { flex: 1; justify-content: center; }
  th { padding: 10px; }
  td { padding: 11px 10px; font-size: 12px; }
  #tab-pacientes th:nth-child(4), #tab-pacientes th:nth-child(5),
  #tab-pacientes td:nth-child(4), #tab-pacientes td:nth-child(5) { display: none; }
  #tab-recentes th:nth-child(4), #tab-recentes th:nth-child(5), #tab-recentes th:nth-child(6),
  #tab-recentes td:nth-child(4), #tab-recentes td:nth-child(5), #tab-recentes td:nth-child(6) { display: none; }
  #tab-recentes .actions-cell .btn-sm:not(.share) { display: none; }
  .series-grid { grid-template-columns: 1fr; gap: 10px; }
  .detail-panel { padding: 14px 12px; }
  .detail-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .patient-studies-panel { padding: 10px 12px 14px; }
  .study-series-block { margin-left: 16px; }
  .study-entry-actions { flex-wrap: wrap; }
  .study-date-tag { min-width: 64px; font-size: 10px; padding: 5px 8px; }
  .tab-btn { padding: 10px 14px; }
  .notif-dropdown { width: min(340px, 92vw); right: -10px; }
}
@media (max-width: 480px) {
  body.page-explorer .topbar-title   { font-size: 12px; letter-spacing: 0.5px; }
  body.page-explorer .topbar-divider { display: none; }
  body.page-explorer .topbar-left    { gap: 10px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 10px; }
  .tab-btn { padding: 8px 12px; font-size: 11px; letter-spacing: 0; }
  .date-filter { flex-wrap: wrap; }
  .date-filter input[type=date] { width: calc(50% - 24px); }
  .study-entry { flex-wrap: wrap; }
  .study-entry-info { min-width: calc(100% - 80px); }
  td:first-child, th:first-child { padding-left: 12px; }
  td:last-child,  th:last-child  { padding-right: 12px; }
}


/* ══════════════════════════════════════════════════════════
   PÁGINA: UPLOAD
══════════════════════════════════════════════════════════ */

.drop-zone {
  border: 2px dashed rgba(42, 191, 191, 0.25);
  border-radius: 20px; padding: 60px 40px;
  text-align: center; transition: all 0.3s; cursor: pointer;
  background: rgba(42, 191, 191, 0.02); margin-bottom: 30px;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: rgba(42, 191, 191, 0.6);
  background: rgba(42, 191, 191, 0.06);
  box-shadow: 0 0 60px rgba(42, 191, 191, 0.08);
}
.drop-zone.uploading { border-color: rgba(197, 150, 58, 0.5); background: rgba(197, 150, 58, 0.04); pointer-events: none; }
.drop-zone.success   { border-color: rgba(16, 185, 129, 0.5); background: rgba(16, 185, 129, 0.04); }
.drop-icon           { font-size: 56px; display: block; margin-bottom: 16px; }
.drop-zone h2        { color: #e2e8f0; font-size: 20px; margin-bottom: 8px; font-weight: 600; }
.drop-zone p         { color: #64748b; font-size: 14px; margin-bottom: 20px; }
.drop-zone .btn-browse {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(42, 191, 191, 0.12); border: 1px solid rgba(42, 191, 191, 0.3);
  color: #2ABFBF; padding: 12px 28px; border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.drop-zone .btn-browse:hover { background: rgba(42, 191, 191, 0.2); border-color: rgba(42, 191, 191, 0.5); }
input[type="file"] { display: none; }

.progress-area        { display: none; margin-bottom: 30px; }
.progress-area.active { display: block; }
.progress-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.progress-header span   { font-size: 13px; color: #94a3b8; }
.progress-header strong { color: #2ABFBF; font-size: 14px; }
.progress-bar-bg { width: 100%; height: 8px; background: rgba(255, 255, 255, 0.06); border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #2ABFBF, #1A9E9E); border-radius: 10px; transition: width 0.3s; width: 0%; }
.progress-bar.complete { background: linear-gradient(90deg, #10b981, #059669); }
.progress-bar.error    { background: linear-gradient(90deg, #ef4444, #dc2626); }

.file-list    { margin-bottom: 30px; }
.file-list h3 { color: #94a3b8; font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px; }
.file-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px; margin-bottom: 4px; font-size: 13px;
}
.file-item .name { color: #e2e8f0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 12px; }
.file-item .size { color: #64748b; font-size: 12px; white-space: nowrap; }
.file-item .status-icon { margin-left: 10px; font-size: 14px; }

.results        { display: none; background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(42, 191, 191, 0.1); border-radius: 14px; padding: 24px; text-align: center; }
.results.active { display: block; }
.results-icon   { font-size: 48px; display: block; margin-bottom: 12px; }
.results h3     { color: #2ABFBF; font-size: 18px; margin-bottom: 6px; }
.results p      { color: #94a3b8; font-size: 14px; margin-bottom: 20px; }
.results .btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn-cancel-upload {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444; padding: 5px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.btn-cancel-upload:hover { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.5); }

.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 30px; }
.tip  { background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.04); border-radius: 12px; padding: 18px; }
.tip h4   { color: #94a3b8; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.tip p    { color: #64748b; font-size: 12px; line-height: 1.6; }
.tip code { background: rgba(42, 191, 191, 0.1); color: #2ABFBF; padding: 2px 6px; border-radius: 4px; font-size: 11px; }

@media (max-width: 768px) {
  body.page-upload .topbar { padding: 10px 16px; }
  body.page-upload .topbar-nav { display: none; }
  body.page-upload .main { padding: 20px 16px; }
  .drop-zone { padding: 40px 20px; }
  .notif-dropdown { width: 300px; right: -8px; }
}


/* ══════════════════════════════════════════════════════════
   PÁGINA: MACHINES
══════════════════════════════════════════════════════════ */

.page-title    { font-size: 22px; font-weight: 700; color: #e2e8f0; margin-bottom: 6px; }
.page-subtitle { font-size: 13px; color: #64748b; margin-bottom: 28px; }

.form-card { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(42, 191, 191, 0.15); border-radius: 16px; padding: 24px 28px; margin-bottom: 32px; }
.form-card-title { font-size: 15px; font-weight: 600; color: #2ABFBF; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.8px; }
.form-hint  { font-size: 11px; color: #475569; margin-top: -2px; }
.form-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(42, 191, 191, 0.15);
  border-radius: 10px; padding: 10px 14px;
  color: #e2e8f0; font-size: 14px; outline: none;
  transition: border-color 0.2s; font-family: inherit;
}
.form-input::placeholder { color: #475569; }
.form-input:focus { border-color: rgba(42, 191, 191, 0.5); }
.form-actions { display: flex; justify-content: flex-end; margin-top: 20px; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
body.page-machines .section-title { font-size: 15px; font-weight: 600; color: #e2e8f0; }
.machine-count { font-size: 12px; color: #64748b; background: rgba(255, 255, 255, 0.04); padding: 3px 10px; border-radius: 100px; }

.machines-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.machine-card { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(42, 191, 191, 0.1); border-radius: 14px; padding: 20px; transition: all 0.2s; }
.machine-card:hover { border-color: rgba(42, 191, 191, 0.25); background: rgba(42, 191, 191, 0.04); }
.machine-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.machine-icon { width: 40px; height: 40px; background: rgba(42, 191, 191, 0.1); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.machine-del-btn  { background: none; border: none; color: #475569; cursor: pointer; padding: 4px 6px; border-radius: 6px; transition: all 0.2s; font-size: 14px; line-height: 1; }
.machine-del-btn:hover  { color: #ef4444; background: rgba(239, 68, 68, 0.1); }
.machine-edit-btn { background: none; border: none; color: #475569; cursor: pointer; padding: 4px 6px; border-radius: 6px; transition: all 0.2s; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.machine-edit-btn:hover { color: #2ABFBF; background: rgba(42, 191, 191, 0.1); }
.machine-name  { font-size: 15px; font-weight: 600; color: #e2e8f0; margin-bottom: 4px; }
.machine-brand { font-size: 12px; color: #C5963A; margin-bottom: 12px; font-weight: 500; }

.ping-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; transition: background 0.4s; }
.ping-dot.testing { background: #2ABFBF; animation: ping-pulse 1.2s ease-in-out infinite; }
.ping-dot.online  { background: #22c55e; }
.ping-dot.offline { background: #ef4444; }
@keyframes ping-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

.machine-meta     { display: flex; flex-direction: column; gap: 6px; }
.machine-meta-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.meta-label  { color: #475569; min-width: 36px; font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; }
.meta-value  { color: #94a3b8; font-family: 'Consolas', 'Courier New', monospace; background: rgba(255, 255, 255, 0.04); padding: 2px 8px; border-radius: 5px; }
.meta-aet    { color: #2ABFBF; }

.empty-state      { text-align: center; padding: 60px 20px; color: #475569; }
.empty-state-icon { font-size: 48px; display: block; margin-bottom: 16px; }
.empty-state h3   { color: #64748b; font-size: 16px; margin-bottom: 6px; }
.empty-state p    { font-size: 13px; }

@media (max-width: 768px) {
  body.page-machines .topbar { padding: 10px 16px; }
  body.page-machines .topbar-nav { display: none; }
  body.page-machines .main { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .notif-dropdown { width: 300px; right: -8px; }
}


/* ══════════════════════════════════════════════════════════
   PÁGINA: DASHBOARD
══════════════════════════════════════════════════════════ */

body.page-dashboard .section-header { margin-bottom: 20px; }
body.page-dashboard .section-title  { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 2px; color: #64748b; }

.header-right  { display: flex; align-items: center; gap: 12px; }
.last-updated  { font-size: 11px; color: #475569; }
.refresh-btn {
  background: rgba(42, 191, 191, 0.08); border: 1px solid rgba(42, 191, 191, 0.2);
  color: #2ABFBF; font-size: 12px; font-weight: 600; padding: 7px 16px;
  border-radius: 8px; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
}
.refresh-btn:hover    { background: rgba(42, 191, 191, 0.15); border-color: rgba(42, 191, 191, 0.4); }
.refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(42, 191, 191, 0.1);
  border-radius: 14px; padding: 20px 22px; position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, rgba(42,191,191,0.4)), transparent);
}
.kpi-card.teal   { --accent: rgba(42,191,191,0.5); }
.kpi-card.gold   { --accent: rgba(197,150,58,0.5); }
.kpi-card.purple { --accent: rgba(167,139,250,0.5); }
.kpi-card.green  { --accent: rgba(16,185,129,0.5); }
.kpi-card.blue   { --accent: rgba(96,165,250,0.5); }
.kpi-icon  { font-size: 22px; margin-bottom: 12px; display: block; }
.kpi-value { font-size: 26px; font-weight: 700; color: #e2e8f0; letter-spacing: -0.5px; line-height: 1; margin-bottom: 5px; }
.kpi-card.teal   .kpi-value { color: #2ABFBF; }
.kpi-card.gold   .kpi-value { color: #C5963A; }
.kpi-card.purple .kpi-value { color: #a78bfa; }
.kpi-card.green  .kpi-value { color: #10b981; }
.kpi-card.blue   .kpi-value { color: #60a5fa; }
.kpi-label { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 1px; }

/* Charts */
.charts-row-main   { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; margin-bottom: 20px; }
.charts-row-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card    { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(42, 191, 191, 0.1); border-radius: 14px; padding: 22px; }
.chart-title   { font-size: 13px; font-weight: 600; color: #e2e8f0; margin-bottom: 3px; }
.chart-subtitle { font-size: 11px; color: #64748b; margin-bottom: 20px; }
.chart-wrap    { position: relative; width: 100%; }

/* Summary */
.summary-grid { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.summary-row  { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 10px; border: 1px solid; }
.summary-row.teal   { background: rgba(42,191,191,0.05);  border-color: rgba(42,191,191,0.15); }
.summary-row.gold   { background: rgba(197,150,58,0.05);  border-color: rgba(197,150,58,0.15); }
.summary-row.purple { background: rgba(167,139,250,0.05); border-color: rgba(167,139,250,0.15); }
.summary-row.green  { background: rgba(16,185,129,0.05);  border-color: rgba(16,185,129,0.15); }
.summary-label { font-size: 13px; color: #94a3b8; }
.summary-value { font-size: 20px; font-weight: 700; }
.summary-row.teal   .summary-value { color: #2ABFBF; }
.summary-row.gold   .summary-value { color: #C5963A; }
.summary-row.purple .summary-value { color: #a78bfa; }
.summary-row.green  .summary-value { color: #10b981; }
.summary-sub { font-size: 12px; font-weight: 400; color: #64748b; }

/* Loading box */
.loading-box { display: flex; align-items: center; justify-content: center; height: 200px; gap: 10px; color: #64748b; font-size: 13px; }

/* Share tokens table */
.shares-section    { margin-top: 24px; }
.shares-table-wrap { background: rgba(255,255,255,0.03); border: 1px solid rgba(42,191,191,0.1); border-radius: 14px; overflow: hidden; }
.shares-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.shares-table thead th {
  text-align: left; padding: 12px 18px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px; color: #64748b;
  border-bottom: 1px solid rgba(42,191,191,0.08); background: rgba(0,0,0,0.15);
}
.shares-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.04); transition: background 0.15s; }
.shares-table tbody tr:last-child { border-bottom: none; }
.shares-table tbody tr:hover { background: rgba(42,191,191,0.04); }
.shares-table td { padding: 14px 18px; vertical-align: middle; }
.share-patient  { font-weight: 600; color: #e2e8f0; margin-bottom: 2px; }
.share-studies  { font-size: 11px; color: #64748b; }

.share-countdown { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.share-countdown.ok     { background: rgba(16,185,129,0.12); color: #10b981; border: 1px solid rgba(16,185,129,0.25); }
.share-countdown.warn   { background: rgba(250,204,21,0.12);  color: #fbbf24; border: 1px solid rgba(250,204,21,0.25); }
.share-countdown.urgent { background: rgba(251,113,133,0.12); color: #fb7185; border: 1px solid rgba(251,113,133,0.25); animation: urgentPulse 1.5s ease-in-out infinite; }
.share-countdown.noexp  { background: rgba(42,191,191,0.1);   color: #2ABFBF; border: 1px solid rgba(42,191,191,0.2); }
@keyframes urgentPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.dot-indicator { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: currentColor; }

.share-manage-btn {
  background: rgba(42,191,191,0.08); border: 1px solid rgba(42,191,191,0.2);
  color: #2ABFBF; font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 8px; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.share-manage-btn:hover { background: rgba(42,191,191,0.18); border-color: rgba(42,191,191,0.45); }
.shares-empty     { padding: 40px; text-align: center; color: #475569; font-size: 13px; }
.shares-empty svg { display: block; margin: 0 auto 12px; opacity: 0.3; }

/* Share manage modal (dashboard) */
.share-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72); z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.share-modal-overlay.open { opacity: 1; pointer-events: all; }
.share-modal {
  background: #1A1A2E; border: 1px solid rgba(42,191,191,0.2);
  border-radius: 18px; padding: 28px; width: 420px; max-width: 94vw;
  box-shadow: 0 32px 80px rgba(0,0,0,0.65);
}
.share-modal-head  { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 6px; }
.share-modal-title { font-size: 16px; font-weight: 700; color: #e2e8f0; }
.share-modal-sub   { font-size: 12px; color: #64748b; margin-bottom: 22px; }
.share-modal-close { background: none; border: none; color: #64748b; cursor: pointer; font-size: 20px; line-height: 1; padding: 0; transition: color 0.15s; }
.share-modal-close:hover { color: #e2e8f0; }
.share-modal-expiry { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.03); border: 1px solid rgba(42,191,191,0.1); border-radius: 10px; padding: 12px 16px; margin-bottom: 20px; font-size: 13px; }
.share-modal-expiry-label { color: #64748b; margin-right: auto; }
.share-modal-expiry-val   { font-weight: 600; }
.share-link-row   { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; }
.share-link-input {
  flex: 1; background: rgba(0,0,0,0.2); border: 1px solid rgba(42,191,191,0.15);
  border-radius: 8px; padding: 9px 12px; font-size: 12px; color: #94a3b8;
  font-family: 'Consolas', 'Courier New', monospace;
  outline: none; cursor: text; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.share-link-input:focus { border-color: rgba(42,191,191,0.4); }
.share-copy-btn {
  flex-shrink: 0; background: rgba(42,191,191,0.08); border: 1px solid rgba(42,191,191,0.2);
  color: #2ABFBF; font-size: 12px; font-weight: 600;
  padding: 9px 14px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.share-copy-btn:hover  { background: rgba(42,191,191,0.2); border-color: rgba(42,191,191,0.5); }
.share-copy-btn.copied { color: #10b981; border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.1); }
.share-extend-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: #64748b; margin-bottom: 10px; }
.share-extend-btns  { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.share-ext-btn { background: rgba(42,191,191,0.08); border: 1px solid rgba(42,191,191,0.2); color: #2ABFBF; font-size: 12px; font-weight: 600; padding: 7px 14px; border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.share-ext-btn:hover { background: rgba(42,191,191,0.2); border-color: rgba(42,191,191,0.5); }
.share-ext-btn.noexp-btn { color: #94a3b8; border-color: rgba(148,163,184,0.2); background: rgba(148,163,184,0.06); }
.share-ext-btn.noexp-btn:hover { background: rgba(148,163,184,0.14); border-color: rgba(148,163,184,0.4); }
.share-revoke-area { border-top: 1px solid rgba(255,255,255,0.06); padding-top: 18px; }
.share-revoke-btn { width: 100%; background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); color: #ef4444; font-size: 13px; font-weight: 600; padding: 10px; border-radius: 10px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.share-revoke-btn:hover { background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.45); }
.share-revoke-confirm { display: none; gap: 8px; justify-content: center; }
.share-revoke-confirm.show { display: flex; }
.share-revoke-confirm-yes { flex: 1; background: #ef4444; border: none; color: #fff; font-size: 13px; font-weight: 700; padding: 10px; border-radius: 10px; cursor: pointer; transition: background 0.2s; }
.share-revoke-confirm-yes:hover { background: #dc2626; }
.share-revoke-confirm-no  { flex: 1; background: rgba(148,163,184,0.08); border: 1px solid rgba(148,163,184,0.2); color: #94a3b8; font-size: 13px; padding: 10px; border-radius: 10px; cursor: pointer; transition: all 0.2s; }
.share-revoke-confirm-no:hover { background: rgba(148,163,184,0.15); }

/* Dashboard responsive */
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
  .charts-row-main, .charts-row-bottom { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  body.page-dashboard .topbar-nav { display: none; }
  body.page-dashboard .main { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ══════════════════════════════════════════════════════════
   PÁGINA: SHARE (viewer de imagens)
══════════════════════════════════════════════════════════ */

#screenInit { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; }
.init-card { background: #1A1A2E; border: 1px solid rgba(42,191,191,0.2); border-radius: 20px; padding: 40px 32px; max-width: 420px; width: 90%; box-shadow: 0 24px 80px rgba(0,0,0,0.6); text-align: center; }
.init-logo        { margin-bottom: 24px; }
.init-logo img    { height: 34px; }
.init-icon        { font-size: 44px; margin-bottom: 12px; display: block; }
.init-title       { font-size: 17px; font-weight: 700; color: #e2e8f0; margin-bottom: 6px; }
.init-sub         { font-size: 13px; color: #64748b; line-height: 1.5; }

#screenViewer { flex: 1; display: none; flex-direction: column; min-height: 0; overflow: hidden; }

.v-header { background: #13131f; border-bottom: 1px solid rgba(42,191,191,0.12); padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-shrink: 0; flex-wrap: wrap; gap: 8px; }
.v-logo img       { height: 26px; }
.v-patient        { flex: 1; min-width: 0; }
.v-patient-name   { font-size: 14px; font-weight: 700; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-patient-meta   { font-size: 11px; color: #475569; margin-top: 1px; }
.v-expiry         { font-size: 11px; color: #334155; white-space: nowrap; flex-shrink: 0; }

.v-body   { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.v-series { width: 90px; background: #13131f; border-right: 1px solid rgba(255,255,255,0.06); overflow-y: auto; flex-shrink: 0; scrollbar-width: thin; scrollbar-color: #1A9E9E transparent; }
.v-series-title  { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: #334155; padding: 8px 8px 4px; font-weight: 700; }
.v-series-item   { padding: 6px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.04); transition: background 0.15s; }
.v-series-item:hover  { background: rgba(42,191,191,0.06); }
.v-series-item.active { background: rgba(42,191,191,0.12); border-left: 2px solid #2ABFBF; }
.v-series-thumb  { width: 100%; aspect-ratio: 1; object-fit: contain; background: #000; border-radius: 4px; display: block; }
.v-series-label  { font-size: 9px; color: #64748b; text-align: center; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.v-main        { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.v-canvas-wrap { flex: 1; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; cursor: zoom-in; }
.v-canvas-wrap.zoomed { cursor: zoom-out; }
#mainImg { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.2s; transform-origin: center center; user-select: none; -webkit-user-drag: none; }
.v-overlay-info  { position: absolute; top: 8px; left: 8px; font-size: 10px; color: rgba(255,255,255,0.5); pointer-events: none; line-height: 1.6; }
.v-overlay-frame { position: absolute; bottom: 8px; right: 10px; font-size: 11px; color: rgba(255,255,255,0.4); pointer-events: none; }

.v-controls { background: #13131f; border-top: 1px solid rgba(255,255,255,0.06); padding: 8px 12px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.v-btn { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); color: #94a3b8; font-size: 14px; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; flex-shrink: 0; }
.v-btn:hover:not(:disabled) { background: rgba(42,191,191,0.12); color: #2ABFBF; border-color: rgba(42,191,191,0.3); }
.v-btn:disabled { opacity: 0.3; cursor: default; }

.v-strip-wrap { flex: 1; overflow-x: auto; display: flex; align-items: center; gap: 6px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: #1A9E9E transparent; }
.v-frame-thumb { width: 44px; height: 44px; object-fit: contain; background: #0d0d14; border-radius: 5px; border: 2px solid transparent; cursor: pointer; flex-shrink: 0; transition: border-color 0.15s; }
.v-frame-thumb.active { border-color: #2ABFBF; }
.v-frame-thumb:hover  { border-color: rgba(42,191,191,0.5); }
.v-study-info  { font-size: 10px; color: #334155; flex-shrink: 0; text-align: right; white-space: nowrap; }

.v-study-tabs { display: flex; gap: 6px; padding: 8px 12px 0; background: #13131f; flex-shrink: 0; border-bottom: 1px solid rgba(255,255,255,0.04); flex-wrap: wrap; }
.v-study-tab  { padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04); color: #64748b; transition: all 0.15s; }
.v-study-tab.active { background: rgba(42,191,191,0.14); border-color: rgba(42,191,191,0.4); color: #2ABFBF; }

/* Share viewer responsive */
@media (max-width: 640px) {
  .v-header { padding: 8px 10px; gap: 8px; }
  .v-logo img { height: 22px; }
  .v-patient-name { font-size: 13px; }
  .v-expiry { display: none; }
  .print-label { display: none; }
  #btnPrint { width: 36px; padding: 0; justify-content: center; }
  .v-body { flex-direction: column; }
  .v-series { width: 100%; height: 76px; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); overflow-x: auto; overflow-y: hidden; display: flex; flex-direction: row; align-items: stretch; flex-shrink: 0; }
  .v-series-title { display: none; }
  .v-series-item  { width: 68px; min-width: 68px; flex-shrink: 0; border-bottom: none; border-right: 1px solid rgba(255,255,255,0.04); border-left: none !important; padding: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .v-series-item.active { border-bottom: 2px solid #2ABFBF; background: rgba(42,191,191,0.1); }
  .v-series-thumb { width: 46px; height: 46px; aspect-ratio: unset; }
  .v-controls { padding: 6px 8px; gap: 6px; }
  .v-btn { width: 44px; height: 44px; font-size: 18px; border-radius: 10px; }
  .v-frame-thumb { width: 50px; height: 50px; border-radius: 6px; }
  .v-study-info { display: none; }
  .v-overlay-info { font-size: 9px; }
  .v-study-tabs { padding: 6px 8px 0; gap: 4px; }
  .v-study-tab  { padding: 4px 10px; font-size: 10px; }
}
