/* HPVet · Tema iOS 26 / Liquid Glass */
:root {
  --green-1: #16a34a;
  --green-2: #064e3b;
  --green-3: #22c55e;
  --text: #0f172a;
  --text-soft: #475569;
  --text-faint: #94a3b8;
  --danger: #dc2626;
  --danger-deep: #7f1d1d;
  --warn: #b45309;
  --info: #1d4ed8;
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-bg-strong: rgba(255, 255, 255, 0.78);
  --glass-bg-soft: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 8px 30px -8px rgba(15, 23, 42, 0.18);
  --pill-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  --radius-card: 22px;
  --radius-pill: 999px;
  --radius-input: 14px;
  --radius-button: 16px;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', sans-serif;
  color: var(--text);
}

body {
  background:
    radial-gradient(1200px 600px at 8% -10%, rgba(22, 163, 74, 0.20), transparent 60%),
    radial-gradient(1000px 700px at 92% 0%, rgba(56, 189, 248, 0.18), transparent 60%),
    radial-gradient(900px 800px at 50% 110%, rgba(168, 85, 247, 0.15), transparent 60%),
    linear-gradient(135deg, #f0fdf4 0%, #eff6ff 50%, #fdf2f8 100%);
  background-attachment: fixed;
}

/* ===== Glass surfaces ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--glass-shadow);
}
.glass-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: 0 18px 40px -10px rgba(15, 23, 42, 0.2);
}

/* ===== Headings ===== */
h1, h2, h3 { letter-spacing: -0.02em; }
h1 { font-weight: 700; }
h2 { font-weight: 700; }
h3 { font-weight: 700; }

/* ===== Auto-uppercase em campos texto (exceto login, senha, email, com data-keep-case) ===== */
input[type="text"]:not([data-keep-case]):not([type="email"]):not(.recep-codigo),
input:not([type]):not([data-keep-case]),
textarea:not([data-keep-case]) {
  text-transform: uppercase;
}

/* ===== Inputs / textareas / selects ===== */
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="tel"], input[type="email"],
select, textarea {
  width: 100%; max-width: 100%; min-width: 0;
  padding: 11px 14px; font-size: 14px; font-family: inherit;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-input);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green-1);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15);
}

/* ===== Buttons ===== */
button.primary, .btn-primary {
  background: linear-gradient(180deg, var(--green-3), var(--green-1));
  color: #fff; font-weight: 700; font-size: 14px;
  padding: 12px 18px; border: none; border-radius: var(--radius-button); cursor: pointer;
  box-shadow: 0 8px 18px -6px rgba(22, 163, 74, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  letter-spacing: 0.01em;
  transition: transform 0.06s, box-shadow 0.15s;
}
button.primary:hover, .btn-primary:hover { box-shadow: 0 10px 24px -6px rgba(22, 163, 74, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.3); }
button.primary:active, .btn-primary:active { transform: scale(0.98); }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

button.ghost, .btn-ghost {
  background: rgba(15, 23, 42, 0.05);
  color: var(--text); font-weight: 600; font-size: 14px;
  padding: 12px 18px; border: 1px solid rgba(15, 23, 42, 0.08); border-radius: var(--radius-button); cursor: pointer;
  backdrop-filter: blur(10px);
  transition: background 0.15s;
}
button.ghost:hover, .btn-ghost:hover { background: rgba(15, 23, 42, 0.08); }

button.danger, .btn-danger {
  background: linear-gradient(180deg, #ef4444, var(--danger));
  color: #fff; font-weight: 700; font-size: 14px;
  padding: 12px 18px; border: none; border-radius: var(--radius-button); cursor: pointer;
  box-shadow: 0 8px 18px -6px rgba(220, 38, 38, 0.45);
}
button.danger:hover, .btn-danger:hover { box-shadow: 0 10px 22px -6px rgba(220, 38, 38, 0.55); }

button.zap-green {
  background: linear-gradient(180deg, #22c55e, #15803d);
  color: #fff; font-weight: 700; font-size: 14px;
  padding: 12px 18px; border: none; border-radius: var(--radius-button); cursor: pointer;
  box-shadow: 0 8px 18px -6px rgba(34, 197, 94, 0.5);
}

/* ===== Pills ===== */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: var(--pill-shadow);
}
.pill.ativa, .pill.ok { background: rgba(34, 197, 94, 0.18); color: #15803d; }
.pill.usada { background: rgba(59, 130, 246, 0.18); color: #1d4ed8; }
.pill.expirada { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.pill.cancelada, .pill.bad { background: rgba(239, 68, 68, 0.18); color: #b91c1c; }
.pill.master { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.pill.gabinete { background: rgba(59, 130, 246, 0.18); color: #1d4ed8; }
.pill.recepcao { background: rgba(34, 197, 94, 0.18); color: #15803d; }
.pill.inativo { background: rgba(239, 68, 68, 0.18); color: #b91c1c; }

/* ===== Header (glass topbar) — afeta também tag <header> direta ===== */
.glass-header,
body > header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-bottom: 0.5px solid rgba(15, 23, 42, 0.08);
  color: var(--text) !important;
  padding: calc(14px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) 14px calc(20px + env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
body > header h1 { color: var(--text) !important; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
body > header .actions a { color: var(--text) !important; opacity: 1 !important; padding: 6px 12px; border-radius: var(--radius-pill); background: rgba(15, 23, 42, 0.05); font-weight: 600; }
body > header .actions a:hover { background: rgba(15, 23, 42, 0.1); }
.glass-header h1 { color: var(--text); font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.glass-header h1 .ic {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--green-1), var(--green-2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.35);
}
.glass-header .actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.glass-header .actions a {
  color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.05);
  transition: background 0.15s;
}
.glass-header .actions a:hover { background: rgba(15, 23, 42, 0.1); }
.glass-header .actions .me-info { font-size: 12px; color: var(--text-soft); }
@media (max-width: 600px) {
  body > header { padding: calc(10px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 10px calc(12px + env(safe-area-inset-left)) !important; }
  body > header h1 { font-size: 14px !important; }
  .glass-header { padding: 10px 12px; }
  .glass-header h1 { font-size: 14px; }
  .glass-header h1 .ic { width: 28px; height: 28px; font-size: 14px; }
  .glass-header .actions { gap: 6px; }
  .glass-header .actions a { padding: 5px 10px; font-size: 12px; }
  .glass-header .actions .me-info { display: none; }
}

/* ===== Panel / card ===== */
.panel {
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--glass-shadow);
  padding: 22px;
  min-width: 0;
}
.panel h2 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin: 0 0 14px;
}
@media (max-width: 600px) { .panel { padding: 16px; border-radius: 18px; } }

/* ===== Segmented control ===== */
.seg {
  display: flex; gap: 4px;
  background: rgba(15, 23, 42, 0.05);
  padding: 4px;
  border-radius: 14px;
  margin: 8px 0;
}
.seg button {
  flex: 1;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg button.active {
  background: rgba(255, 255, 255, 0.95);
  color: var(--green-2);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

/* ===== Labels & small ===== */
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin: 12px 0 6px; }

/* ===== Modal customizado (substitui confirm/alert) ===== */
.x-modal-bg {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: x-fade 0.18s ease-out;
}
.x-modal-bg.show { display: flex; }
.x-modal {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.4);
  max-width: 380px; width: 100%;
  padding: 24px 22px 18px;
  animation: x-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.x-modal .ic-wrap {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: 14px;
}
.x-modal.confirm-type .ic-wrap { background: linear-gradient(135deg, rgba(22, 163, 74, 0.18), rgba(34, 197, 94, 0.18)); }
.x-modal.danger-type .ic-wrap { background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(220, 38, 38, 0.18)); }
.x-modal.alert-type .ic-wrap { background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.18)); }
.x-modal.success-type .ic-wrap { background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(22, 163, 74, 0.18)); }
.x-modal h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; color: var(--text); }
.x-modal p { font-size: 14px; line-height: 1.45; color: var(--text-soft); white-space: pre-wrap; }
.x-modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.x-modal .actions button { flex: 1; padding: 12px; border: none; border-radius: 14px; font-weight: 700; font-size: 14px; cursor: pointer; }
.x-modal .actions .ok { background: linear-gradient(180deg, var(--green-3), var(--green-1)); color: #fff; box-shadow: 0 6px 14px -4px rgba(22, 163, 74, 0.45); }
.x-modal .actions .ok-danger { background: linear-gradient(180deg, #ef4444, var(--danger)); color: #fff; box-shadow: 0 6px 14px -4px rgba(220, 38, 38, 0.45); }
.x-modal .actions .cancel { background: rgba(15, 23, 42, 0.06); color: var(--text); }

@keyframes x-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes x-pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ===== Cabeçalho compartilhado (gerado por header.js) ===== */
body > header.hpv-header { all: unset; display: block; position: sticky; top: 0; z-index: 50; padding-top: env(safe-area-inset-top); }
.hpv-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin: 12px; background: rgba(255,255,255,0.7); backdrop-filter: blur(28px) saturate(180%); -webkit-backdrop-filter: blur(28px) saturate(180%); border: 1px solid rgba(255,255,255,0.85); border-radius: 22px; box-shadow: 0 6px 20px -8px rgba(15,23,42,0.18); }
.hpv-menu-btn { width: 38px; height: 38px; border: none; background: rgba(15,23,42,0.06); border-radius: 12px; font-size: 18px; cursor: pointer; color: var(--text); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hpv-menu-btn:hover { background: rgba(15,23,42,0.1); }
.hpv-title { flex: 1; min-width: 0; }
.hpv-greeting { font-size: 12px; color: var(--text-soft); font-weight: 500; }
.hpv-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.hpv-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--green-1), var(--green-2)); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(22,163,74,0.35); border: 2px solid rgba(255,255,255,0.9); cursor: pointer; flex-shrink: 0; }
.hpv-avatar.lg { width: 54px; height: 54px; font-size: 18px; }
.hpv-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 12px 6px; }
@media (max-width: 600px) { .hpv-stats { grid-template-columns: repeat(2, 1fr); } }
.hpv-stat { background: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.85); border-radius: 14px; padding: 10px 12px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.hpv-stat .n { font-size: 20px; font-weight: 800; color: var(--green-2); letter-spacing: -0.03em; }
.hpv-stat .l { font-size: 10px; color: var(--text-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.hpv-drawer-bg { position: fixed; inset: 0; background: rgba(15,23,42,0.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 999; display: none; }
.hpv-drawer-bg.show { display: block; animation: hpv-fade 0.2s ease-out; }
.hpv-drawer { position: fixed; top: 0; left: 0; bottom: 0; width: min(82vw, 320px); background: rgba(255,255,255,0.95); backdrop-filter: blur(30px) saturate(190%); -webkit-backdrop-filter: blur(30px) saturate(190%); border-right: 1px solid rgba(255,255,255,0.9); box-shadow: 8px 0 30px -8px rgba(15,23,42,0.3); padding: calc(20px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom)); transform: translateX(-100%); transition: transform 0.25s cubic-bezier(0.34, 1.2, 0.64, 1); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.hpv-drawer-bg.show .hpv-drawer { transform: translateX(0); }
.hpv-drawer-head { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 0.5px solid rgba(15,23,42,0.08); margin-bottom: 12px; }
.hpv-drawer-head .t1 { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.hpv-drawer-head .t2 { font-size: 12px; color: var(--text-soft); margin-top: 2px; text-transform: capitalize; }
.hpv-close { margin-left: auto; width: 32px; height: 32px; border: none; background: rgba(15,23,42,0.06); border-radius: 10px; font-size: 22px; cursor: pointer; color: var(--text-soft); display: flex; align-items: center; justify-content: center; align-self: flex-start; }
.hpv-drawer-nav { display: flex; flex-direction: column; gap: 4px; }
.hpv-drawer-nav a { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; text-decoration: none; color: var(--text); font-size: 15px; font-weight: 600; background: transparent !important; }
.hpv-drawer-nav a:hover { background: rgba(15,23,42,0.05) !important; }
.hpv-drawer-nav a .ic { font-size: 18px; width: 28px; text-align: center; }
.hpv-drawer-nav a .arr { margin-left: auto; color: var(--text-faint); font-size: 18px; }
.hpv-drawer-nav a.logout { color: var(--danger); margin-top: 12px; border-top: 0.5px solid rgba(15,23,42,0.08); padding-top: 16px; border-radius: 0; }
@keyframes hpv-fade { from { opacity: 0; } to { opacity: 1; } }

/* ===== Modais existentes (gabinete/admin/auditoria) — upgrade pra glass ===== */
.modal-bg { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); background: rgba(15, 23, 42, 0.45) !important; }
.modal {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px !important;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.4) !important;
}
.modal h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--green-2) !important; }
.modal .codebox {
  background: rgba(34, 197, 94, 0.12) !important;
  border: 1.5px solid rgba(22, 163, 74, 0.5) !important;
  border-radius: 16px !important;
}

/* ===== Field row em modais (mais arejado) ===== */
.field-row { padding: 7px 0 !important; border-bottom: 0.5px solid rgba(15, 23, 42, 0.06) !important; }
.field-row .lbl { color: var(--text-soft) !important; font-weight: 500 !important; }

/* ===== Empty state ===== */
.empty { color: var(--text-faint); padding: 40px 20px; text-align: center; }

/* ===== Tabs (continued) — refresh existing tabs to glass ===== */
.tabs {
  display: flex; flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.04);
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 18px;
  border-bottom: none !important;
}
.tabs .tab {
  flex: 1; min-width: max-content;
  padding: 9px 14px;
  text-align: center;
  cursor: pointer;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 13px;
  border-radius: 10px;
  border-bottom: none !important;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active {
  background: rgba(255, 255, 255, 0.95);
  color: var(--green-2);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
  border-bottom: none !important;
}
.tabs .tab .count {
  display: inline-block;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
}
.tabs .tab.active .count { background: rgba(22, 163, 74, 0.18); color: #15803d; }

/* ===== List item / row ===== */
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 0.5px solid rgba(15, 23, 42, 0.06);
}
.item:hover { background: rgba(15, 23, 42, 0.03); }
.item:last-child { border-bottom: none; }
.item .code {
  font-family: 'SF Mono', 'Courier New', monospace;
  font-weight: 700; font-size: 13px;
  color: var(--green-2);
  background: rgba(34, 197, 94, 0.15);
  padding: 5px 10px;
  border-radius: 8px;
  flex-shrink: 0;
  min-width: 100px;
  text-align: center;
}
.item .info { flex: 1; min-width: 0; }
.item .info .t1 { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .info .t2 { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
@media (max-width: 600px) { .item { flex-wrap: wrap; padding: 10px; } .item .code { font-size: 12px; min-width: 90px; } }

/* === DESKTOP layout — telas largas ganham mais aproveitamento do espaço === */
@media (min-width: 1024px) {
  .panel { padding: 24px 28px; }
  /* Listas e tabelas mais respiradas */
  .item { padding: 14px 18px; gap: 18px; }
  .item .info .t1 { font-size: 15px; }
  .item .info .t2 { font-size: 13px; }
  .item .code { font-size: 14px; min-width: 130px; padding: 7px 12px; }
}
@media (min-width: 1280px) {
  /* Em telas muito largas, deixa containers com max-width amplo */
  body main:not(.full) { max-width: 1280px; margin: 0 auto; }
}
