/* SisPet — Liquid Glass theme (iOS-inspired) */
:root {
  --verde: #15803d;
  --verde-dark: #14532d;
  --verde-light: #dcfce7;
  --azul: #1e40af;
  --vermelho: #b91c1c;
  --amarelo: #b45309;
  --txt: #0f172a;
  --txt-light: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px -8px rgba(15,23,42,0.08);
  --blur: 22px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--txt);
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  background: #eef5ee;
  position: relative;
  overflow-x: hidden;
}

/* Mesh gradient de fundo — blobs coloridos suaves criando o "ambiente" pro glass refletir */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 12% 18%, rgba(34, 197, 94, 0.35), transparent 42%),
    radial-gradient(circle at 88% 22%, rgba(20, 184, 166, 0.32), transparent 45%),
    radial-gradient(circle at 22% 86%, rgba(99, 102, 241, 0.22), transparent 48%),
    radial-gradient(circle at 78% 80%, rgba(245, 158, 11, 0.20), transparent 45%),
    linear-gradient(135deg, #e8f5e9 0%, #e0f2fe 50%, #f0fdf4 100%);
  background-attachment: fixed;
  animation: meshShift 30s ease-in-out infinite alternate;
}
@keyframes meshShift {
  0%   { filter: hue-rotate(0deg) saturate(1); }
  50%  { filter: hue-rotate(8deg) saturate(1.05); }
  100% { filter: hue-rotate(-6deg) saturate(0.95); }
}

a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ TOPBAR (glass) ============ */
header.topbar {
  background: rgba(20, 83, 45, 0.65);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
          backdrop-filter: blur(var(--blur)) saturate(180%);
  color: #fff;
  padding: 12px 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 8px 24px -12px rgba(0,0,0,0.2);
  position: sticky; top: 0; z-index: 50;
}
header.topbar .logo {
  font-weight: 700; font-size: 17px; flex-shrink: 0;
  letter-spacing: -0.2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
header.topbar .nav { display: flex; gap: 6px; align-items: center; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
header.topbar .nav a {
  color: #fff; opacity: 0.92; padding: 7px 12px; border-radius: 10px; white-space: nowrap;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  transition: background 0.15s ease, transform 0.15s ease;
}
header.topbar .nav a:hover { background: rgba(255,255,255,0.16); text-decoration: none; }
header.topbar .nav a.ativo { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.3); }
header.topbar .nav .role-pill {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 4px 12px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
}
header.topbar .hamb {
  display: none; background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; font-size: 22px; padding: 6px 14px; border-radius: 10px; cursor: pointer;
  font-family: inherit; line-height: 1;
}
header.topbar .nome-curto { font-size: 12.5px; opacity: 0.9; }

/* ============ DRAWER (mobile) ============ */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 998; opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 86vw; max-width: 320px;
  background: linear-gradient(160deg, #1ea14c, #14532d);
  color: #fff;
  z-index: 999;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column;
  box-shadow: -20px 0 50px rgba(0,0,0,0.4);
  padding: 20px 18px 28px;
  overflow-y: auto;
}
.drawer-close {
  position: absolute; top: 12px; right: 12px;
  background: rgba(255,255,255,0.15); border: 0; color: #fff;
  width: 38px; height: 38px; border-radius: 50%; font-size: 18px; cursor: pointer;
}
.drawer-header { padding: 0 0 16px; border-bottom: 1px solid rgba(255,255,255,0.18); margin-bottom: 14px; }
.drawer-titulo { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.drawer-sub { font-size: 13px; opacity: 0.9; margin-top: 4px; }
.drawer-nav { display: flex; flex-direction: column; gap: 4px; }
.drawer-nav a {
  color: #fff; padding: 13px 14px; border-radius: 12px;
  text-decoration: none; font-size: 15px; font-weight: 500;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08);
}
.drawer-nav a:hover, .drawer-nav a.ativo {
  background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.25);
}
.drawer-nav .drawer-senha { margin-top: 14px; background: rgba(59, 130, 246, 0.16); border-color: rgba(59, 130, 246, 0.3); }
.drawer-nav .drawer-sair { margin-top: 6px; background: rgba(220, 38, 38, 0.18); border-color: rgba(220, 38, 38, 0.3); }
body.drawer-open .drawer { transform: translateX(0); }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
body.drawer-open { overflow: hidden; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 18px 40px; }

/* ============ CARDS (glass) ============ */
.card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
          backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.7);
  margin-bottom: 16px;
  position: relative;
}
.card h2 {
  margin: 0 0 14px; color: var(--verde-dark); font-size: 17px; font-weight: 700;
  letter-spacing: -0.2px;
}
.card h3 {
  margin: 14px 0 6px; font-size: 11.5px; color: var(--txt-light);
  text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700;
}

label { display: block; font-size: 12.5px; color: var(--txt-light); font-weight: 600; margin-bottom: 5px; margin-top: 12px; letter-spacing: 0.1px; }

/* ============ INPUTS (glass) ============ */
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=url], select, textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid rgba(15,23,42,0.1);
  border-radius: 12px;
  font-size: 16px; font-family: inherit;
  background: rgba(255,255,255,0.65);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  color: var(--txt);
}
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2364748b' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
  background-color: rgba(255,255,255,0.65);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--verde);
  background: rgba(255,255,255,0.9);
  box-shadow: 0 0 0 4px rgba(34,197,94,0.18);
}
input::placeholder, textarea::placeholder { color: rgba(15,23,42,0.4); }

/* ============ BUTTONS (glass) ============ */
button, .btn {
  background: linear-gradient(180deg, #1ea14c 0%, #15803d 100%);
  color: #fff; border: 1px solid rgba(255,255,255,0.25);
  padding: 11px 20px; border-radius: 12px;
  font-weight: 600; font-size: 14.5px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; min-height: 42px;
  touch-action: manipulation;
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 6px 16px -6px rgba(21,128,61,0.4);
  transition: transform 0.1s ease, box-shadow 0.15s ease, filter 0.15s ease;
  letter-spacing: 0.1px;
}
button:hover, .btn:hover { filter: brightness(1.05); box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 8px 20px -6px rgba(21,128,61,0.5); }
button:active, .btn:active { transform: scale(0.98); }
button.outline, .btn.outline {
  background: rgba(255,255,255,0.6);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--verde-dark);
  border: 1px solid rgba(21,128,61,0.3);
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 4px 12px -4px rgba(15,23,42,0.1);
}
button.outline:hover, .btn.outline:hover { background: rgba(255,255,255,0.85); }
button.danger {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 6px 16px -6px rgba(185,28,28,0.4);
}
button.muted {
  background: rgba(148, 163, 184, 0.25);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: #334155;
  border: 1px solid rgba(148,163,184,0.4);
  box-shadow: none;
}
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }

/* ============ TABLES (glass) ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid rgba(15,23,42,0.06); font-size: 13.5px; vertical-align: top; }
table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--txt-light); white-space: nowrap; font-weight: 700; }
table tr { transition: background 0.1s ease; }
table tr:hover td { background: rgba(255,255,255,0.5); }

/* ============ PILLS (glass) ============ */
.pill {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid transparent;
}
.pill-nova { background: rgba(59,130,246,0.18); color: #1e40af; border-color: rgba(59,130,246,0.3); }
.pill-em_triagem { background: rgba(245,158,11,0.18); color: #92400e; border-color: rgba(245,158,11,0.3); }
.pill-agendada { background: rgba(139,92,246,0.18); color: #5b21b6; border-color: rgba(139,92,246,0.3); }
.pill-em_campo { background: rgba(6,182,212,0.20); color: #155e75; border-color: rgba(6,182,212,0.3); }
.pill-concluida { background: rgba(34,197,94,0.20); color: #166534; border-color: rgba(34,197,94,0.3); }
.pill-cancelada { background: rgba(239,68,68,0.18); color: #991b1b; border-color: rgba(239,68,68,0.3); }
.pill-imediato { background: rgba(239,68,68,0.20); color: #991b1b; border-color: rgba(239,68,68,0.35); }
.pill-urgente { background: rgba(249,115,22,0.20); color: #9a3412; border-color: rgba(249,115,22,0.3); }
.pill-agendavel { background: rgba(245,158,11,0.18); color: #92400e; border-color: rgba(245,158,11,0.3); }
.pill-conscientizacao { background: rgba(59,130,246,0.18); color: #1e40af; border-color: rgba(59,130,246,0.3); }

.empty { padding: 44px; text-align: center; color: var(--txt-light); font-style: italic; font-size: 14px; }
.error {
  background: rgba(254, 226, 226, 0.7); color: #991b1b;
  padding: 12px 16px; border-radius: 12px; font-size: 13px;
  border: 1px solid rgba(239,68,68,0.2);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ok {
  background: rgba(220, 252, 231, 0.7); color: #166534;
  padding: 12px 16px; border-radius: 12px; font-size: 13px;
  border: 1px solid rgba(34,197,94,0.25);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ============ CHIPS (glass) ============ */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid rgba(15,23,42,0.12);
  background: rgba(255,255,255,0.6);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--txt-light); font-size: 12.5px; font-weight: 600;
  cursor: pointer; user-select: none;
  transition: all 0.15s ease;
}
.chip:hover { background: rgba(255,255,255,0.85); transform: translateY(-1px); }
.chip.on {
  background: linear-gradient(135deg, #22c55e, #15803d); color: #fff;
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 4px 12px -4px rgba(34,197,94,0.5), 0 1px 0 rgba(255,255,255,0.4) inset;
}

/* ============ RESPONSIVO ============ */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  main { padding: 16px 12px 32px; }
  .card { padding: 16px; border-radius: 16px; }
  .card h2 { font-size: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 12px; }

  header.topbar { padding: 11px 14px; }
  header.topbar .logo { font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  header.topbar .hamb { display: inline-flex; align-items: center; justify-content: center; }
  /* Esconde a nav inline em mobile — usa o drawer */
  header.topbar .nav-desktop { display: none; }

  table { display: block; }
  table thead { display: none; }
  table tbody { display: block; }
  table tr {
    display: block; margin-bottom: 10px; padding: 8px 6px;
    background: rgba(255,255,255,0.55);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 14px;
    box-shadow: 0 4px 12px -6px rgba(15,23,42,0.1);
  }
  table tr:hover td { background: transparent; }
  table td { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 12px; border: none; font-size: 13.5px; min-height: 32px; }
  table td::before { content: attr(data-label); font-size: 10.5px; color: var(--txt-light); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; flex-shrink: 0; }
  table td:first-child { padding-top: 10px; }
  table td:last-child { padding-bottom: 10px; }
}
@media (max-width: 420px) {
  .chip { font-size: 11.5px; padding: 6px 10px; }
}

/* Safari/iOS — garantir backdrop-filter renderize sem flicker */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, header.topbar { background: rgba(255,255,255,0.95); }
  header.topbar { background: var(--verde-dark); }
}
