/* ============================================================
   DrugReminder PWA - estilo HUD inspirado no Jarvis (Iron Man)
   ============================================================ */

/* Variaveis de tema. Mude aqui se quiser ajustar a paleta. */
:root {
  --bg-deep: #050a14;
  --bg-panel: #0a1628;
  --bg-card: rgba(15, 30, 55, 0.6);

  --cyan: #00d4ff;
  --cyan-dim: #4fc3f7;
  --cyan-glow: rgba(0, 212, 255, 0.4);

  --green: #00ff95;
  --amber: #ffaa00;
  --red: #ff4757;

  --text-bright: #e0f4ff;
  --text-muted: #6b8aa8;

  --border: rgba(0, 212, 255, 0.25);
  --border-active: rgba(0, 212, 255, 0.7);

  --view-scale: 1;
}

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

html, body {
  height: 100%;
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg-deep);
  color: var(--text-bright);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* Brilho de fundo sutil */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at top, rgba(0, 212, 255, 0.08), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(0, 212, 255, 0.05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.hud {
  position: relative;
  min-height: 100dvh;
  width: min(100%, 920px);
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 20px 120px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 1;
}

body.pairing-mode .reminders,
body.pairing-mode .app-footer {
  display: none;
}

/* ============================================================
   Cabecalho
   ============================================================ */
.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.hud-top-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  min-width: 0;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
}

.brand-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
  min-width: 0;
}

.brand-name {
  color: var(--text-bright);
  min-width: 0;
  overflow-wrap: anywhere;
}
.brand-accent { color: var(--cyan); text-shadow: 0 0 10px var(--cyan-glow); }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse-dot 2s infinite;
}
.status-dot.offline {
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hud-clock {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan-glow);
  white-space: nowrap;
}

.audio-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 212, 255, 0.05);
  cursor: pointer;
  user-select: none;
  min-width: 0;
}

.audio-toggle input {
  display: none;
}

.audio-toggle-label,
.audio-toggle-state {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 1.5px;
}

.audio-toggle-state {
  min-width: 26px;
  color: var(--red);
}

.audio-toggle-track {
  width: 44px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 71, 87, 0.18);
  border: 1px solid rgba(255, 71, 87, 0.35);
  position: relative;
  transition: all 160ms ease;
}

.audio-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px rgba(255, 71, 87, 0.4);
  transition: transform 160ms ease, background 160ms ease;
}

.audio-toggle input:checked + .audio-toggle-track {
  background: rgba(0, 255, 149, 0.18);
  border-color: rgba(0, 255, 149, 0.35);
}

.audio-toggle input:checked + .audio-toggle-track .audio-toggle-thumb {
  transform: translateX(22px);
  background: var(--green);
  box-shadow: 0 0 10px rgba(0, 255, 149, 0.4);
}

.patient-label {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--text-muted);
  font-weight: 600;
}

.patient-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  color: var(--cyan);
  letter-spacing: 1px;
}

.patient-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}

.pairing-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.16);
}

.pairing-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pairing-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--cyan);
}

.pairing-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--text-bright);
}

.pairing-copy {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.45;
}

.pairing-form {
  display: grid;
  gap: 12px;
}

.pairing-label {
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 1px;
}

.pairing-input {
  width: 100%;
  border: 1px solid var(--border-active);
  border-radius: 10px;
  background: rgba(0, 212, 255, 0.06);
  color: var(--text-bright);
  padding: 16px 18px;
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  letter-spacing: 3px;
  text-align: center;
  outline: none;
}

.pairing-input:focus {
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.22);
}

.pairing-submit {
  margin-top: 4px;
}

#audioUnlockCard {
  border-color: rgba(255, 170, 0, 0.45);
  box-shadow: 0 0 24px rgba(255, 170, 0, 0.12);
}

/* ============================================================
   Lista de lembretes
   ============================================================ */
.section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 20px;
  font-weight: 500;
}

.title-bracket {
  color: var(--cyan);
  margin: 0 8px;
}

.pending-audio-hint {
  margin: -10px 0 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 1px;
}

.update-banner {
  margin: -4px 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid rgba(255, 170, 0, 0.35);
  border-radius: 12px;
  background: rgba(255, 170, 0, 0.08);
  color: #ffd37a;
  font-size: 15px;
}

.update-reload-button {
  width: auto;
  min-width: 220px;
  margin: 0;
  padding-inline: 18px;
}

.reminders-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.loading, .empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 16px;
  letter-spacing: 1px;
}

/* ============================================================
   Card de cada lembrete
   ============================================================ */
.reminder {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Estado: aguardando o paciente confirmar (status=sent) */
.reminder.active {
  border-color: var(--border-active);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2),
              inset 0 0 20px rgba(0, 212, 255, 0.05);
}

/* Estado: atrasado (status=retrying ou ja passou da hora) */
.reminder.overdue {
  border-color: #ff4d5f;
  box-shadow: 0 0 22px rgba(255, 77, 95, 0.34);
  animation: pulse-overdue 2s infinite;
}

@keyframes pulse-overdue {
  0%, 100% { box-shadow: 0 0 22px rgba(255, 77, 95, 0.34); }
  50%      { box-shadow: 0 0 34px rgba(255, 77, 95, 0.62); }
}

/* Estado: ja tomado */
.reminder.taken {
  border-color: rgba(0, 255, 149, 0.4);
  opacity: 0.7;
}

/* Estado: tocando audio agora */
.reminder.is-playing-audio {
  border-color: #5faf7a !important;
  box-shadow: 0 0 30px rgba(95, 175, 122, 0.4), inset 0 0 15px rgba(95, 175, 122, 0.1) !important;
  animation: pulse-audio-card 1.5s ease-in-out infinite !important;
  z-index: 5;
}

.reminder.is-playing-audio::after {
  content: '🔊';
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 20px;
  animation: speaker-bounce 0.6s ease-in-out infinite alternate;
}

@keyframes pulse-audio-card {
  0%, 100% { transform: scale(1); border-color: #5faf7a; }
  50% { transform: scale(1.02); border-color: #4caf6d; }
}

@keyframes speaker-bounce {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-4px) scale(1.2); }
}

.reminder-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.reminder-body {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.reminder-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.reminder-image {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border-active);
  background: rgba(0, 212, 255, 0.08);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.14);
}

.reminder-image.placeholder {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  padding: 6px;
}

.reminder-content {
  min-width: 0;
}

.reminder-patient,
.reminder-medication,
.reminder-dosage,
.reminder-instructions {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.reminder-status {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(0, 212, 255, 0.15);
  color: var(--cyan);
}

.reminder.overdue .reminder-status {
  background: rgba(255, 77, 95, 0.18);
  color: #ff6b7a;
}

.reminder.taken .reminder-status {
  background: rgba(0, 255, 149, 0.15);
  color: var(--green);
}

.reminder-time {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  color: var(--cyan);
  font-weight: 700;
  text-shadow: 0 0 8px var(--cyan-glow);
}

.reminder-medication {
  font-family: 'Orbitron', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.reminder-patient {
  display: inline-flex;
  align-items: center;
  margin-bottom: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 212, 255, 0.14);
  border: 1px solid rgba(0, 212, 255, 0.34);
  color: var(--cyan);
  font-family: 'Orbitron', sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  box-shadow: inset 0 0 18px rgba(0, 212, 255, 0.08), 0 0 18px rgba(0, 212, 255, 0.08);
}

.reminder-dosage {
  font-size: 18px;
  color: var(--cyan-dim);
  margin-bottom: 12px;
}

.reminder-instructions {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* ============================================================
   Botao "Ja tomei"
   ============================================================ */
.btn-taken {
  width: 100%;
  padding: 16px;
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--cyan);
  background: rgba(0, 212, 255, 0.08);
  border: 2px solid var(--cyan);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.btn-taken:hover:not(:disabled) {
  background: var(--cyan);
  color: var(--bg-deep);
  box-shadow: 0 0 30px var(--cyan-glow);
}

.btn-taken:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-taken:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   Rodape com botao do microfone
   ============================================================ */
.hud-footer {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.agent-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 2px solid var(--cyan);
  color: var(--cyan);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 0 30px var(--cyan-glow),
              inset 0 0 20px rgba(0, 212, 255, 0.1);
  transition: all 0.2s ease;
}

.agent-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px var(--cyan-glow),
              inset 0 0 30px rgba(0, 212, 255, 0.2);
}

.agent-button:active {
  transform: scale(0.95);
}


/* ============================================================
   Toasts (mensagens temporarias)
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  background: var(--bg-panel);
  border: 1px solid var(--cyan);
  border-radius: 6px;
  padding: 12px 20px;
  color: var(--text-bright);
  font-size: 15px;
  letter-spacing: 1px;
  box-shadow: 0 4px 20px var(--cyan-glow);
  animation: toast-in 0.3s ease;
}

.toast.success {
  border-color: var(--green);
  box-shadow: 0 4px 20px rgba(0, 255, 149, 0.3);
}

.toast.error {
  border-color: var(--red);
  box-shadow: 0 4px 20px rgba(255, 71, 87, 0.3);
}

.hidden {
  display: none !important;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0);     }
}

/* ============================================================
   Modos explicitos de layout
   ============================================================ */
body[data-layout='tablet'] .hud {
  width: 100%;
  max-width: 100%;
  padding: 20px 16px 112px;
  gap: 20px;
}

body[data-layout='tablet'] .hud-brand {
  font-size: 16px;
  letter-spacing: 1.4px;
}

body[data-layout='tablet'] .hud-clock {
  font-size: 19px;
}

body[data-layout='tablet'] .audio-toggle {
  padding: 7px 9px;
  gap: 6px;
}

body[data-layout='tablet'] .audio-toggle-label,
body[data-layout='tablet'] .audio-toggle-state {
  font-size: 10px;
  letter-spacing: 1.1px;
}

body[data-layout='tablet'] .audio-toggle-track {
  width: 40px;
  height: 20px;
}

body[data-layout='tablet'] .audio-toggle-thumb {
  width: 14px;
  height: 14px;
}

body[data-layout='tablet'] .audio-toggle input:checked + .audio-toggle-track .audio-toggle-thumb {
  transform: translateX(20px);
}

body[data-layout='tablet'] .reminder-medication {
  font-size: 23px;
}

body[data-layout='tablet'] .reminder-patient {
  font-size: 17px;
  letter-spacing: 1.2px;
}

body[data-layout='tablet'] .reminder-time {
  font-size: 21px;
}

body[data-layout='phone'] .hud {
  padding: 14px 12px 104px;
  gap: 18px;
}

body[data-layout='phone'] .hud-header {
  align-items: stretch;
  flex-direction: column;
  gap: 12px;
}

body[data-layout='phone'] .hud-brand {
  width: 100%;
  font-size: 14px;
  gap: 10px;
  letter-spacing: 1px;
}

body[data-layout='phone'] .hud-top-controls {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

body[data-layout='phone'] .hud-clock {
  font-size: 16px;
  text-align: right;
}

body[data-layout='phone'] .audio-toggle {
  width: 100%;
  padding: 6px 8px;
  gap: 6px;
}

body[data-layout='phone'] .audio-toggle-label,
body[data-layout='phone'] .audio-toggle-state {
  font-size: 9px;
  letter-spacing: 0.9px;
}

body[data-layout='phone'] .audio-toggle-track {
  width: 36px;
  height: 18px;
}

body[data-layout='phone'] .audio-toggle-thumb {
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
}

body[data-layout='phone'] .audio-toggle input:checked + .audio-toggle-track .audio-toggle-thumb {
  transform: translateX(18px);
}

body[data-layout='phone'] .pairing-card {
  padding: 16px;
}

body[data-layout='phone'] .pairing-title {
  font-size: 18px;
}

body[data-layout='phone'] .pairing-copy {
  font-size: 15px;
}

body[data-layout='phone'] .pairing-input {
  font-size: 22px;
  letter-spacing: 2px;
  padding: 14px 12px;
}

body[data-layout='phone'] .section-title {
  font-size: 12px;
  letter-spacing: 2.8px;
  margin-bottom: 14px;
}

body[data-layout='phone'] .pending-audio-hint {
  margin: -6px 0 14px;
  font-size: 13px;
}

body[data-layout='phone'] .update-banner {
  margin: -2px 0 14px;
  padding: 10px 12px;
  font-size: 13px;
}

body[data-layout='phone'] .update-reload-button {
  min-width: 0;
  width: 100%;
  padding-inline: 12px;
}

body[data-layout='phone'] .reminders-list {
  gap: 12px;
}

body[data-layout='phone'] .reminder {
  padding: 16px;
}

body[data-layout='phone'] .reminder-header {
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

body[data-layout='phone'] .reminder-status {
  font-size: 10px;
  letter-spacing: 1.4px;
  padding: 4px 8px;
}

body[data-layout='phone'] .reminder-time {
  font-size: 18px;
}

body[data-layout='phone'] .reminder-body {
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
}

body[data-layout='phone'] .reminder-image,
body[data-layout='phone'] .reminder-image.placeholder {
  width: 56px;
  height: 56px;
  border-radius: 10px;
}

body[data-layout='phone'] .reminder-image.placeholder {
  font-size: 9px;
  padding: 4px;
}

body[data-layout='phone'] .reminder-patient {
  display: flex;
  width: 100%;
  min-width: 0;
  margin-bottom: 10px;
  padding: 7px 10px;
  font-size: 14px;
  letter-spacing: 0.8px;
  line-height: 1.25;
}

body[data-layout='phone'] .reminder-medication {
  font-size: 18px;
  letter-spacing: 0.6px;
  line-height: 1.15;
  word-break: break-word;
}

body[data-layout='phone'] .reminder-dosage {
  font-size: 15px;
  margin-bottom: 10px;
}

body[data-layout='phone'] .reminder-instructions {
  font-size: 13px;
  margin-bottom: 12px;
  padding-top: 10px;
}

body[data-layout='phone'] .btn-taken {
  padding: 14px 12px;
  font-size: 13px;
  letter-spacing: 2px;
}

body[data-layout='phone'] .hud-footer {
  bottom: 16px;
}

body[data-layout='phone'] .agent-button {
  width: 72px;
  height: 72px;
}

/* ============================================================
   Responsivo tablet
   ============================================================ */
@media (max-width: 820px) {
  .hud {
    width: 100%;
    max-width: 100%;
    padding: 20px 16px 112px;
    gap: 20px;
  }

  .hud-brand {
    font-size: 16px;
    letter-spacing: 1.4px;
  }

  .hud-clock {
    font-size: 19px;
  }

  .audio-toggle {
    padding: 7px 9px;
    gap: 6px;
  }

  .audio-toggle-label,
  .audio-toggle-state {
    font-size: 10px;
    letter-spacing: 1.1px;
  }

  .audio-toggle-track {
    width: 40px;
    height: 20px;
  }

  .audio-toggle-thumb {
    width: 14px;
    height: 14px;
  }

  .audio-toggle input:checked + .audio-toggle-track .audio-toggle-thumb {
    transform: translateX(20px);
  }

  .reminder-medication {
    font-size: 23px;
  }

  .reminder-patient {
    font-size: 17px;
    letter-spacing: 1.2px;
  }

  .reminder-time {
    font-size: 21px;
  }
}

/* ============================================================
   Responsivo celular
   ============================================================ */
@media (max-width: 560px) {
  .hud {
    padding: 14px 12px 104px;
    gap: 18px;
  }

  .hud-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .hud-brand {
    width: 100%;
    font-size: 14px;
    gap: 10px;
    letter-spacing: 1px;
  }

  .hud-top-controls {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .hud-clock {
    font-size: 17px;
  }

  .audio-toggle {
    padding: 6px 8px;
    gap: 6px;
  }

  .audio-toggle-label,
  .audio-toggle-state {
    font-size: 9px;
    letter-spacing: 0.9px;
  }

  .audio-toggle-track {
    width: 36px;
    height: 18px;
  }

  .audio-toggle-thumb {
    top: 1px;
    left: 1px;
    width: 14px;
    height: 14px;
  }

  .audio-toggle input:checked + .audio-toggle-track .audio-toggle-thumb {
    transform: translateX(18px);
  }

  .pairing-card {
    padding: 16px;
  }

  .pairing-title {
    font-size: 18px;
  }

  .pairing-copy {
    font-size: 15px;
  }

  .pairing-input {
    font-size: 22px;
    letter-spacing: 2px;
    padding: 14px 12px;
  }

  .section-title {
    font-size: 12px;
    letter-spacing: 2.8px;
    margin-bottom: 14px;
  }

  .pending-audio-hint {
    margin: -6px 0 14px;
    font-size: 13px;
  }

  .update-banner {
    margin: -2px 0 14px;
    padding: 10px 12px;
    font-size: 13px;
  }

  .update-reload-button {
    min-width: 0;
    width: 100%;
    padding-inline: 12px;
  }

  .reminders-list {
    gap: 12px;
  }

  .reminder {
    padding: 16px;
  }

  .reminder-header {
    align-items: center;
    margin-bottom: 10px;
  }

  .reminder-status {
    font-size: 10px;
    letter-spacing: 1.4px;
    padding: 4px 8px;
  }

  .reminder-time {
    font-size: 18px;
  }

  .reminder-body {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
  }

  .reminder-image,
  .reminder-image.placeholder {
    width: 56px;
    height: 56px;
    border-radius: 10px;
  }

  .reminder-image.placeholder {
    font-size: 9px;
    padding: 4px;
  }

  .reminder-patient {
    display: flex;
    width: 100%;
    min-width: 0;
    margin-bottom: 10px;
    padding: 7px 10px;
    font-size: 14px;
    letter-spacing: 0.8px;
    line-height: 1.25;
  }

  .reminder-medication {
    font-size: 18px;
    letter-spacing: 0.6px;
    line-height: 1.15;
    word-break: break-word;
  }

  .reminder-dosage {
    font-size: 15px;
    margin-bottom: 10px;
  }

  .reminder-instructions {
    font-size: 13px;
    margin-bottom: 12px;
    padding-top: 10px;
  }

  .btn-taken {
    padding: 14px 12px;
    font-size: 13px;
    letter-spacing: 2px;
  }

  .hud-footer {
    bottom: 16px;
  }

  .agent-button {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 380px) {
  .hud-top-controls {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .hud-clock {
    width: 100%;
    text-align: right;
  }
}

/* ============================================================
   Sali-IA visual refresh
   ============================================================ */
body.sali-theme {
  background:
    radial-gradient(circle at top left, rgba(168, 213, 186, 0.55), transparent 28%),
    linear-gradient(180deg, #fbf7f0 0%, #f6f2ea 100%);
  font-family: 'Inter', sans-serif;
  color: #4a4a4a;
}

body.sali-theme::before {
  background:
    radial-gradient(circle at top left, rgba(168, 213, 186, 0.55), transparent 26%),
    radial-gradient(circle at right bottom, rgba(235, 228, 214, 0.85), transparent 30%);
}

body.sali-theme .hud {
  width: min(100%, 1180px);
  max-width: 1180px;
  min-height: 100dvh;
  padding: 18px 20px 20px;
  gap: 14px;
}

body.sali-theme .hud-header {
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

body.sali-theme .brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

body.sali-theme .brand-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.sali-theme .brand-logo {
  width: 120px;
  height: 84px;
  object-fit: contain;
}

body.sali-theme .hud-top-controls {
  gap: 12px;
}

body.sali-theme .connection-pill,
body.sali-theme .audio-toggle,
body.sali-theme .hud-clock {
  min-height: 48px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 25px rgba(94, 133, 105, 0.12);
}

body.sali-theme .connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: #2e6f4e;
  font-size: 15px;
  font-weight: 600;
}

body.sali-theme .connection-text {
  white-space: nowrap;
}

body.sali-theme .status-dot {
  width: 10px;
  height: 10px;
  box-shadow: none;
  background: #4caf6d;
}

body.sali-theme .status-dot.offline {
  background: #c65f5f;
  box-shadow: none;
}

body.sali-theme .audio-toggle {
  gap: 8px;
  padding: 0 14px;
  border: 0;
  color: #2e6f4e;
}

body.sali-theme .audio-toggle-label,
body.sali-theme .audio-toggle-state {
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
}

body.sali-theme .audio-toggle-state {
  color: #2e6f4e;
}

body.sali-theme .audio-toggle-track {
  background: rgba(198, 95, 95, 0.14);
  border: 1px solid rgba(198, 95, 95, 0.18);
}

body.sali-theme .audio-toggle-thumb {
  background: #c65f5f;
  box-shadow: none;
}

body.sali-theme .audio-toggle input:checked + .audio-toggle-track {
  background: rgba(95, 175, 122, 0.2);
  border-color: rgba(95, 175, 122, 0.24);
}

body.sali-theme .audio-toggle input:checked + .audio-toggle-track .audio-toggle-thumb {
  background: #4caf6d;
  box-shadow: none;
}

body.sali-theme .hud-clock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font-family: 'Nunito', sans-serif;
  font-size: 26px;
  color: #2e6f4e;
  text-shadow: none;
}

body.sali-theme .pairing-card {
  background: rgba(255, 255, 255, 0.94);
  border: 0;
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(63, 100, 77, 0.12);
}

body.sali-theme .pairing-title,
body.sali-theme .section-title,
body.sali-theme .reminder-medication,
body.sali-theme .time-pill,
body.sali-theme .btn-taken {
  font-family: 'Nunito', sans-serif;
}

body.sali-theme .pairing-title {
  color: #31513f;
}

body.sali-theme .pairing-copy,
body.sali-theme .pairing-label {
  color: #4a4a4a;
}

body.sali-theme .pairing-input {
  background: #f7fbf8;
  color: #31513f;
  border-color: rgba(95, 175, 122, 0.24);
}

body.sali-theme .reminders {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.sali-theme .app-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding-top: 6px;
  color: #7a877f;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

body.sali-theme .app-footer > span:first-child {
  flex: 1;
  min-width: 0;
}

body.sali-theme .reminders-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

body.sali-theme .section-title {
  margin: 0;
  text-align: left;
  color: #2e6f4e;
  font-size: 24px;
  letter-spacing: 0;
  font-weight: 800;
}

body.sali-theme .title-bracket {
  display: none;
}

body.sali-theme .pending-audio-hint {
  margin: 0;
  margin-left: auto;
  text-align: right;
  font-size: 11px;
  color: #7a877f;
  flex-shrink: 0;
  white-space: nowrap;
}

body.pairing-mode .reminders-col-header {
  display: none;
}

body.sali-theme .reminders-col-header {
  display: grid;
  grid-template-columns: 130px 52px minmax(180px, 1fr) minmax(180px, 1fr) 90px 140px;
  gap: 0;
  padding: 0 20px 6px;
  flex-shrink: 0;
}

body.sali-theme .col-label {
  font-size: 10px;
  font-weight: 700;
  color: #9aaf9f;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 8px;
}

body.sali-theme .update-banner {
  margin: 0 0 12px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  color: #8c6d39;
  box-shadow: 0 12px 28px rgba(87, 116, 92, 0.12);
}

body.sali-theme .reminders-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-content: start;
  overflow: auto;
  padding: 0 4px 16px;
}

body.sali-theme .loading,
body.sali-theme .empty-state {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(87, 116, 92, 0.12);
  color: #5c6c61;
}

body.sali-theme .reminder-group {
  border-radius: 16px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 4px;
}

body.sali-theme .reminder-group.g-overdue { background: rgba(198, 95, 95, 0.07); }
body.sali-theme .reminder-group.g-active  { background: rgba(95, 175, 122, 0.08); }
body.sali-theme .reminder-group.g-soon    { background: rgba(255, 255, 255, 0.55); }
body.sali-theme .reminder-group.g-later   { background: rgba(240, 239, 233, 0.55); }

body.sali-theme .group-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 4px;
}

body.sali-theme .group-sep-line {
  flex: 1;
  height: 1px;
}

body.sali-theme .g-overdue .group-sep-line { background: rgba(198, 95, 95, 0.22); }
body.sali-theme .g-active  .group-sep-line { background: rgba(95, 175, 122, 0.28); }
body.sali-theme .g-soon    .group-sep-line { background: rgba(95, 175, 122, 0.14); }
body.sali-theme .g-later   .group-sep-line { background: rgba(0, 0, 0, 0.08); }

body.sali-theme .group-sep-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

body.sali-theme .g-overdue .group-sep-label { color: #c65f5f; }
body.sali-theme .g-active  .group-sep-label { color: #2e6f4e; }
body.sali-theme .g-soon    .group-sep-label { color: #7a9f84; }
body.sali-theme .g-later   .group-sep-label { color: #9aaf9f; }

body.sali-theme .reminder {
  display: grid;
  grid-template-columns: 130px 52px minmax(180px, 1fr) minmax(180px, 1fr) 90px 140px;
  align-items: center;
  gap: 0;
  min-height: 58px;
  padding: 0 6px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(87, 116, 92, 0.08);
  cursor: pointer;
}

body.sali-theme .g-overdue .reminder { background: rgba(255, 255, 255, 0.82); }
body.sali-theme .g-active  .reminder { background: rgba(255, 255, 255, 0.82); }
body.sali-theme .g-soon    .reminder { background: rgba(255, 255, 255, 0.75); }
body.sali-theme .g-later   .reminder { background: rgba(255, 255, 255, 0.60); }

body.sali-theme .reminder.active {
  border-color: rgba(95, 175, 122, 0.2);
  background: linear-gradient(90deg, rgba(244, 250, 246, 0.98), rgba(255, 255, 255, 0.96));
  outline: 0;
}

body.sali-theme .reminder.overdue {
  border-color: rgba(198, 95, 95, 0.22);
  background: linear-gradient(90deg, rgba(255, 247, 244, 0.98), rgba(255, 255, 255, 0.96));
  box-shadow: 0 3px 12px rgba(87, 116, 92, 0.08);
  animation: none;
}

body.sali-theme .reminder.taken {
  opacity: 0.6;
  border-color: transparent;
}

body.sali-theme .reminder:hover {
  box-shadow: 0 6px 20px rgba(87, 116, 92, 0.13);
  transform: translateX(1px);
}

body.sali-theme .reminder-cell {
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
}

body.sali-theme .reminder-header {
  display: none;
}

body.sali-theme .reminder-status {
  justify-content: center;
  flex-shrink: 0;
  border-radius: 999px;
  background: #f0efe9;
  color: #7d7d72;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 0 12px;
  min-height: 40px;
  line-height: 1;
}

body.sali-theme .reminder.overdue .reminder-status {
  background: rgba(198, 95, 95, 0.14);
  color: #c65f5f;
  font-weight: 800;
}

body.sali-theme .reminder.active .reminder-status {
  background: rgba(95, 175, 122, 0.18);
  color: #2e6f4e;
}

body.sali-theme .reminder-time {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 34px;
  min-width: auto;
  padding: 0 10px;
  border-radius: 999px;
  background: #f6f2ea;
  color: #2e6f4e;
  font-size: 16px;
  text-shadow: none;
  line-height: 1;
}

body.sali-theme .reminder-body {
  display: contents;
}

body.sali-theme .reminder-image-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
}

body.sali-theme .reminder-image-wrap.is-clickable {
  cursor: zoom-in;
}

body.sali-theme .reminder-image,
body.sali-theme .reminder-image.placeholder {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

body.sali-theme .reminder-image {
  border: 0;
  background: #f6f2ea;
  box-shadow: inset 0 0 0 1px rgba(95, 175, 122, 0.1);
}

body.sali-theme .reminder-image.placeholder {
  border: 0;
  background: #f6f2ea;
  color: #7a877f;
  font-size: 8px;
  text-align: center;
  padding: 4px;
}

/* ── Modal de detalhe do lembrete ── */
body.sali-theme .rdm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

body.sali-theme .rdm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 36, 28, 0.78);
  backdrop-filter: blur(5px);
}

body.sali-theme .rdm-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 780px);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 64px rgba(30, 60, 44, 0.32);
  padding: 28px 24px 24px;
}

body.sali-theme .rdm-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(46, 111, 78, 0.1);
  color: #2e6f4e;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.sali-theme .rdm-close:hover { background: rgba(46, 111, 78, 0.18); }

body.sali-theme .rdm-body {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-top: 12px;
}

body.sali-theme .rdm-image-col {
  flex: 0 0 auto;
  width: min(44%, 280px);
  display: flex;
  align-items: center;
  justify-content: center;
}

body.sali-theme .rdm-img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 16px;
  background: #f6f2ea;
}

body.sali-theme .rdm-img-placeholder {
  width: 100%;
  aspect-ratio: 1;
  max-height: 260px;
  border-radius: 16px;
  background: #f0ece2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9da89e;
  font-size: 0.85rem;
}

body.sali-theme .rdm-info-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

body.sali-theme .rdm-patient {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  background: #5faf7a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body.sali-theme .rdm-medication {
  font-family: 'Nunito', sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  color: #1f4a30;
  margin: 0;
  line-height: 1.2;
}

body.sali-theme .rdm-dosage {
  font-size: 1.05rem;
  font-weight: 600;
  color: #2e6f4e;
  margin: 0;
}

body.sali-theme .rdm-instructions {
  font-size: 0.96rem;
  color: #4a4a4a;
  margin: 0;
  line-height: 1.5;
}

body.sali-theme .rdm-time {
  font-family: 'Nunito', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: #1f4a30;
  margin: 4px 0 0;
}

body.sali-theme .rdm-btn-taken {
  margin-top: 12px;
  width: 100%;
  height: 54px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 16px;
  line-height: 1;
}

/* linha da lista clicável */
body.sali-theme article.reminder {
  cursor: pointer;
}
body.sali-theme article.reminder:hover {
  filter: brightness(1.04);
}

/* telas pequenas: empilhar imagem + info */
@media (max-width: 520px) {
  body.sali-theme .rdm-body {
    flex-direction: column;
    align-items: stretch;
  }
  body.sali-theme .rdm-image-col {
    width: 100%;
  }
  body.sali-theme .rdm-img,
  body.sali-theme .rdm-img-placeholder {
    max-height: 200px;
  }
}

body.sali-theme .reminder-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

body.sali-theme .reminder-patient {
  width: auto;
  max-width: 120px;
  margin-bottom: 0;
  padding: 0 11px;
  min-height: 28px;
  border-radius: 999px;
  border: 0;
  box-shadow: none;
  font-size: 11px;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.sali-theme .reminder-medication {
  margin-bottom: 0;
  color: #31513f;
  font-size: 17px;
  letter-spacing: 0;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.sali-theme .reminder-dosage {
  margin-bottom: 0;
  font-size: 12px;
  font-weight: 700;
  color: #2e6f4e;
  margin-top: 2px;
}

body.sali-theme .reminder-instructions {
  margin-bottom: 0;
  padding-top: 0;
  border-top: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #4a4a4a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 768px) {
  body.sali-theme .reminders-col-header {
    display: none;
  }

  body.sali-theme .reminder {
    grid-template-columns: 110px 44px minmax(0, 1fr) 96px;
    min-height: auto;
    padding: 10px 8px;
  }

  body.sali-theme .reminder-cell {
    padding: 0 6px;
  }

  body.sali-theme .reminder-image-wrap,
  body.sali-theme .reminder-image,
  body.sali-theme .reminder-image.placeholder {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  body.sali-theme .reminder-patient {
    max-width: 98px;
    min-height: 24px;
    font-size: 10px;
    padding: 0 9px;
  }

  body.sali-theme .reminder-medication {
    font-size: 14px;
  }

  body.sali-theme .reminder-dosage {
    font-size: 11px;
  }

  body.sali-theme .reminder-instructions {
    display: none;
  }

  body.sali-theme .reminder-time {
    font-size: 14px;
    padding: 0 8px;
    min-height: 30px;
  }

  body.sali-theme .btn-taken {
    font-size: 12px;
    height: 34px;
    min-height: 34px;
    padding: 0 10px;
  }
}

body.sali-theme .btn-taken {
  width: 100%;
  min-height: 40px;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #4caf6d;
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 16px rgba(95, 175, 122, 0.28);
  white-space: nowrap;
}

body.sali-theme .btn-taken:hover:not(:disabled) {
  background: #3d9e5f;
  color: #fff;
  box-shadow: 0 8px 20px rgba(95, 175, 122, 0.34);
}

body.sali-theme .btn-taken:disabled {
  background: rgba(95, 175, 122, 0.12);
  color: #5faf7a;
  box-shadow: none;
  cursor: default;
  font-size: 13px;
}

body.sali-theme .hud-footer {
  display: none;
}

.agent-entry-glyph {
  width: 78px;
  height: 78px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 4px 12px rgba(45, 106, 79, 0.45));
  animation: agent-logo-pulse 2.8s ease-in-out infinite;
  transform-origin: center;
  pointer-events: none;
  object-fit: contain;
}

@keyframes agent-logo-pulse {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 4px 12px rgba(45, 106, 79, 0.40)); }
  50%       { transform: scale(1.08); filter: drop-shadow(0 6px 20px rgba(45, 106, 79, 0.65)); }
}

.agent-entry-glyph path,
.agent-entry-glyph circle {
  vector-effect: non-scaling-stroke;
}

body.sali-theme .toast {
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(87, 116, 92, 0.18);
  color: #31513f;
}

body.sali-theme .toast.success {
  box-shadow: 0 12px 28px rgba(95, 175, 122, 0.18);
}

body.sali-theme .toast.error {
  box-shadow: 0 12px 28px rgba(198, 95, 95, 0.18);
}

body.sali-theme[data-layout='tablet'] .hud,
body.sali-theme[data-layout='phone'] .hud {
  width: 100%;
  max-width: 100%;
}

body.sali-theme[data-layout='phone'] .hud {
  padding: 14px 12px 18px;
}

body.sali-theme[data-layout='phone'] .hud-header {
  flex-direction: column;
  align-items: stretch;
}

body.sali-theme[data-layout='phone'] .brand-block {
  justify-content: space-between;
}

body.sali-theme[data-layout='phone'] .brand-logo {
  width: 98px;
  height: 72px;
}

body.sali-theme[data-layout='phone'] .agent-entry-glyph {
  width: 30px;
  height: 30px;
}

body.sali-theme[data-layout='phone'] .hud-top-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body.sali-theme[data-layout='phone'] .hud-clock {
  grid-column: span 2;
}

body.sali-theme[data-layout='phone'] .section-title {
  font-size: 20px;
}

body.sali-theme[data-layout='phone'] .app-footer {
  font-size: 10px;
  padding-top: 4px;
}

body.sali-theme[data-layout='phone'] .reminders-list {
  grid-template-columns: 1fr;
  gap: 12px;
}

body.sali-theme[data-layout='phone'] .reminder {
  min-height: 0;
  padding: 14px 14px 16px;
}

body.sali-theme[data-layout='phone'] .reminder-medication {
  font-size: clamp(1.35rem, 6.2vw, 1.7rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
}

body.sali-theme[data-layout='phone'] .reminder-header {
  gap: 10px;
}

body.sali-theme[data-layout='phone'] .reminder-status {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

body.sali-theme[data-layout='phone'] .reminder-time {
  min-height: 34px;
  min-width: 66px;
  padding: 0 10px;
  font-size: clamp(1.1rem, 5vw, 1.35rem);
}

body.sali-theme[data-layout='phone'] .reminder-body {
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

body.sali-theme[data-layout='phone'] .reminder-image,
body.sali-theme[data-layout='phone'] .reminder-image.placeholder {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

body.sali-theme[data-layout='phone'] .reminder-patient {
  margin-bottom: 8px;
  min-height: 28px;
  padding: 0 10px;
  font-size: clamp(0.76rem, 3.2vw, 0.9rem);
  letter-spacing: 0.03em;
}

body.sali-theme[data-layout='phone'] .reminder-dosage {
  margin-bottom: 6px;
  font-size: clamp(0.95rem, 4vw, 1.05rem);
}

body.sali-theme[data-layout='phone'] .reminder-instructions {
  font-size: clamp(0.88rem, 3.8vw, 0.98rem);
  line-height: 1.3;
}

body.sali-theme[data-layout='phone'] .btn-taken {
  min-height: 38px;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
}

@media (max-width: 380px) {
  body.sali-theme[data-layout='phone'] .hud {
    padding: 12px 10px 16px;
  }

  body.sali-theme[data-layout='phone'] .brand-logo {
    width: 84px;
    height: 62px;
  }

  body.sali-theme[data-layout='phone'] .section-title {
    font-size: 18px;
  }

  body.sali-theme[data-layout='phone'] .pending-audio-hint {
    font-size: 0.9rem;
  }

  body.sali-theme[data-layout='phone'] .reminder {
    padding: 12px 12px 14px;
  }

  body.sali-theme[data-layout='phone'] .reminder-medication {
    font-size: clamp(1.15rem, 5.8vw, 1.45rem);
  }

  body.sali-theme[data-layout='phone'] .reminder-patient {
    font-size: 0.73rem;
  }

  body.sali-theme[data-layout='phone'] .reminder-time {
    min-width: 60px;
    font-size: 1rem;
  }

  body.sali-theme[data-layout='phone'] .btn-taken {
    min-height: 36px;
    font-size: 0.92rem;
  }
}


/* ============================================================
   Slider de tamanho de visualizacao (Pequeno / Grande)
   ============================================================ */
.view-size-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(95, 175, 122, 0.4);
  border-radius: 999px;
  background: rgba(95, 175, 122, 0.08);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.view-size-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.view-size-label {
  font-family: 'Nunito', 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #5faf7a;
  line-height: 1;
  transition: color 160ms ease, opacity 160ms ease;
}

.view-size-toggle input:not(:checked) ~ .view-size-label:last-of-type {
  opacity: 0.45;
}

.view-size-toggle input:checked ~ .view-size-label:last-of-type {
  color: #2e6f4e;
  opacity: 1;
}

.view-size-toggle input:checked ~ .view-size-label:first-of-type {
  opacity: 0.45;
}

.view-size-track {
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: #d6e7dc;
  border: 1px solid rgba(95, 175, 122, 0.45);
  position: relative;
  transition: background 160ms ease, border-color 160ms ease;
  flex-shrink: 0;
}

.view-size-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 180ms ease, background 180ms ease;
}

.view-size-toggle input:checked + .view-size-track {
  background: #5faf7a;
  border-color: #4caf6d;
}

.view-size-toggle input:checked + .view-size-track .view-size-thumb {
  transform: translateX(20px);
  background: #ffffff;
}

/* ============================================================
   Modo grande: Layout de Cards em Grade (3 por linha)
   ============================================================ */
body.sali-theme[data-view-size='large'] {
  --view-scale: 1.35;
}

/* Esconde o cabeçalho de tabela no modo card */
body.sali-theme[data-view-size='large'] .reminders-col-header {
  display: none !important;
}

/* Transforma a lista/grupo em uma grade de 3 colunas */
body.sali-theme[data-view-size='large'] .reminder-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 16px;
  background: transparent;
}

/* Garante que o separador de grupo ocupe as 3 colunas */
body.sali-theme[data-view-size='large'] .group-sep {
  grid-column: 1 / -1;
  margin-bottom: 8px;
}

body.sali-theme[data-view-size='large'] .group-sep-label {
  font-size: 22px;
  letter-spacing: 0.1em;
}

/* Transforma a linha em um CARD vertical compactado */
body.sali-theme[data-view-size='large'] .reminder {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px;
  gap: 8px;
  min-height: 250px; /* Altura reduzida em ~50% */
  height: 100%;
  justify-content: space-between;
  border-radius: 20px;
  background: #ffffff;
  border-width: 2px;
}

/* Ajusta as células internas para se comportarem como blocos no card */
body.sali-theme[data-view-size='large'] .reminder-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0;
}

/* Ordem e destaque dos elementos no Card */
body.sali-theme[data-view-size='large'] .reminder-image-wrap,
body.sali-theme[data-view-size='large'] .reminder-image,
body.sali-theme[data-view-size='large'] .reminder-image.placeholder {
  width: 80px;
  height: 80px;
  border-radius: 16px;
}

body.sali-theme[data-view-size='large'] .reminder-patient {
  font-size: 16px;
  min-height: 32px;
  max-width: 100%;
  padding: 4px 14px;
  order: -1;
}

body.sali-theme[data-view-size='large'] .reminder-content {
  gap: 2px;
}

body.sali-theme[data-view-size='large'] .reminder-medication {
  font-size: 22px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.1;
  width: 100%;
  min-height: 2.2em;
}

body.sali-theme[data-view-size='large'] .reminder-dosage {
  font-size: 20px;
  margin-top: 0;
  min-height: 1.2em;
}

body.sali-theme[data-view-size='large'] .reminder-instructions {
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Apenas 2 linhas */
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 18px;
  color: #5c6c61;
  margin: 4px 0;
  min-height: auto;
}

body.sali-theme[data-view-size='large'] .reminder-time {
  font-size: 26px;
  min-height: auto;
  padding: 4px 16px;
  background: #f0f7f2;
  border-radius: 12px;
  margin: 4px 0;
}

body.sali-theme[data-view-size='large'] .btn-taken {
  font-size: 18px;
  height: 48px;
  min-height: 48px;
  margin-top: 4px;
  width: 100%;
  border-radius: 14px;
}

/* Ajustes responsivos para o modo grande (se a tela for estreita demais) */
@media (max-width: 1100px) {
  body.sali-theme[data-view-size='large'] .reminder-group {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  body.sali-theme[data-view-size='large'] .reminder-group {
    grid-template-columns: 1fr;
  }
}

/* Escalonamento do Cabeçalho */
body.sali-theme[data-view-size='large'] .hud-header {
  flex-wrap: wrap;
}

body.sali-theme[data-view-size='large'] .hud-top-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

body.sali-theme[data-view-size='large'] .hud-clock {
  font-size: calc(26px * var(--view-scale));
  padding: 0 24px;
}

body.sali-theme[data-view-size='large'] .connection-pill,
body.sali-theme[data-view-size='large'] .audio-toggle,
body.sali-theme[data-view-size='large'] .hud-clock {
  min-height: calc(48px * var(--view-scale));
}

body.sali-theme[data-view-size='large'] .brand-logo {
  width: calc(120px * var(--view-scale));
}

/* Escalonamento do Modal de Detalhes */
body.sali-theme[data-view-size='large'] .rdm-medication {
  font-size: calc(1.45rem * var(--view-scale));
}

body.sali-theme[data-view-size='large'] .rdm-dosage {
  font-size: calc(1.05rem * var(--view-scale));
}

body.sali-theme[data-view-size='large'] .rdm-instructions {
  font-size: calc(0.96rem * var(--view-scale));
}

body.sali-theme[data-view-size='large'] .rdm-time {
  font-size: calc(1.6rem * var(--view-scale));
}

body.sali-theme[data-view-size='large'] .rdm-btn-taken {
  font-size: calc(1.1rem * var(--view-scale));
  padding: 0 calc(16px * var(--view-scale));
  height: calc(54px * var(--view-scale));
}

/* ============================================================
   Custom Confirmation Modal
   ============================================================ */
.confirm-panel {
  position: relative;
  z-index: 1;
  width: min(90vw, 420px);
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  padding: 32px 24px 24px;
  text-align: center;
  animation: modal-pop 0.25s cubic-bezier(0.17, 0.89, 0.32, 1.28);
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1);   }
}

.confirm-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.confirm-icon {
  width: 64px;
  height: 64px;
  background: rgba(95, 175, 122, 0.1);
  color: #4caf6d;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-icon svg {
  width: 32px;
  height: 32px;
}

.confirm-panel h2 {
  font-family: 'Nunito', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #1f4a30;
  margin: 0;
}

.confirm-panel p {
  font-size: 16px;
  color: #5c6c61;
  line-height: 1.5;
  margin: 0;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-confirm-primary, .btn-confirm-secondary {
  height: 54px;
  border-radius: 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-confirm-primary {
  background: #4caf6d;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(95, 175, 122, 0.25);
}

.btn-confirm-primary:hover {
  background: #3d9e5f;
  transform: translateY(-2px);
}

.btn-confirm-secondary {
  background: #f0f4f1;
  color: #5c6c61;
}

.btn-confirm-secondary:hover {
  background: #e4ebe6;
}

/* Escalonamento para Modo Grande */
body.sali-theme[data-view-size='large'] .confirm-panel {
  width: min(90vw, 520px);
}

body.sali-theme[data-view-size='large'] .confirm-panel h2 {
  font-size: calc(22px * var(--view-scale));
}

body.sali-theme[data-view-size='large'] .confirm-panel p {
  font-size: calc(16px * var(--view-scale));
}

body.sali-theme[data-view-size='large'] .btn-confirm-primary,
body.sali-theme[data-view-size='large'] .btn-confirm-secondary {
  height: calc(54px * var(--view-scale));
  font-size: calc(16px * var(--view-scale));
}

