/* VetApp — design system "Rayssa OncoVet" (aprovado no protótipo ux-prototipo.html) */
@font-face {
  font-family: 'Fraunces';
  src: url('/static/vendor/fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Outfit';
  src: url('/static/vendor/fonts/outfit-latin.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --ink: #17122b;
  --ink-soft: #4c4566;
  --muted: #8d86a8;
  --bg: #f4f2fb;
  --surface: #ffffff;
  --line: #e9e6f5;
  --violet: #6d5ef0;
  --violet-deep: #4636c7;
  --peri: #a195ff;
  --lav: #efecff;
  --rose: #e85d8a;
  --mint: #2fb98a;
  --warn: #a3700a;
  --warn-bg: #fdf4dd;
  --danger: #e85d8a;
  --danger-bg: #fde8ef;
  --ok: #2fb98a;
  --ok-bg: #e7f8f1;
  --side-grad: linear-gradient(168deg, #241b4d 0%, #181233 55%, #120d26 100%);
  --hero-grad: linear-gradient(120deg, #4636c7 0%, #6d5ef0 45%, #9a7bf5 100%);
  --shadow-soft: 0 6px 30px rgba(53, 38, 134, .08);
  --shadow-pop: 0 18px 50px rgba(53, 38, 134, .18);
  font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Outfit', -apple-system, sans-serif; background: var(--bg); color: var(--ink); }
button { font-family: inherit; }
h2 { font-family: 'Fraunces', serif; font-weight: 560; letter-spacing: -.01em; }
.serif { font-family: 'Fraunces', serif; font-weight: 560; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--side-grad); }
.login-card { background: var(--surface); padding: 2.4rem; border-radius: 22px; width: 350px; box-shadow: 0 24px 70px rgba(15, 8, 50, .55); }
.login-card h1 { margin: 0 0 .3rem; font-family: 'Fraunces', serif; font-weight: 560; font-size: 1.5rem; background: var(--hero-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card p { margin: 0 0 1.3rem; color: var(--muted); font-size: .9rem; }

/* ---------- layout: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; }
aside.side {
  width: 235px; flex: none; background: var(--side-grad); color: #cdc6ec; padding: 1.5rem .9rem 1rem;
  display: flex; flex-direction: column; gap: .2rem; position: sticky; top: 0; height: 100vh;
}
.side .logo { display: flex; align-items: center; gap: .65rem; padding: 0 .55rem 1.4rem; }
.side .logo .paw {
  width: 40px; height: 40px; border-radius: 14px; background: var(--hero-grad); flex: none;
  display: grid; place-items: center; font-size: 1.1rem; box-shadow: 0 6px 18px rgba(109, 94, 240, .45);
}
.side .logo b { font-family: 'Fraunces', serif; font-weight: 560; font-size: 1.12rem; color: #fff; }
.side .logo small { display: block; font-size: .64rem; color: #8f86bd; letter-spacing: .14em; text-transform: uppercase; }
.side nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.side nav button {
  display: flex; align-items: center; gap: .7rem; padding: .64rem .8rem; border-radius: 12px; border: none;
  background: transparent; color: #b4abdd; font-size: .92rem; font-weight: 500; text-align: left;
  cursor: pointer; transition: all .18s ease; position: relative; width: 100%;
}
.side nav button:hover { color: #fff; background: rgba(255,255,255,.06); transform: translateX(2px); }
.side nav button.active { color: #fff; background: rgba(255,255,255,.10); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.side nav button.active::before {
  content: ''; position: absolute; left: -.9rem; top: 22%; bottom: 22%; width: 3.5px;
  background: linear-gradient(180deg, var(--peri), var(--violet)); border-radius: 0 4px 4px 0;
}
.side nav button .ic { width: 20px; text-align: center; }
.side .pill {
  margin-left: auto; background: var(--rose); color: #fff; font-size: .66rem; font-weight: 700;
  border-radius: 999px; padding: .12rem .45rem; box-shadow: 0 3px 10px rgba(232, 93, 138, .5);
}
.side .foot { padding: .9rem .6rem 0; border-top: 1px solid rgba(255,255,255,.08); font-size: .78rem; color: #8f86bd; display: flex; align-items: center; gap: .5rem; }
.side .foot b { color: #d9d3f2; display: block; font-weight: 600; }
.side .foot .logout { margin-left: auto; background: transparent; border: 1px solid rgba(255,255,255,.25); color: #cdc6ec; border-radius: 9px; padding: .3rem .6rem; cursor: pointer; font-size: .76rem; }
.side .foot .logout:hover { color: #fff; border-color: rgba(255,255,255,.5); }

main.content { flex: 1; padding: 1.9rem 2.3rem 4.5rem; max-width: 1220px; min-width: 0; }
.topline { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.topline h2 { font-family: 'Fraunces', serif; font-weight: 560; font-size: 1.7rem; margin: 0; letter-spacing: -.01em; }
.topline .date { color: var(--muted); font-size: .86rem; }

/* ---------- hero ---------- */
.hero {
  background: var(--hero-grad); border-radius: 24px; color: #fff; padding: 1.6rem 2rem;
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; position: relative; overflow: hidden;
  box-shadow: var(--shadow-pop); margin-bottom: 1.3rem; animation: rise .5s ease both;
}
.hero::after { content: '🐾'; position: absolute; right: -18px; bottom: -34px; font-size: 9rem; opacity: .10; transform: rotate(-12deg); }
.hero .greet small { text-transform: uppercase; letter-spacing: .16em; font-size: .66rem; opacity: .75; font-weight: 600; }
.hero .greet h3 { font-family: 'Fraunces', serif; font-weight: 560; font-size: 1.55rem; margin: .2rem 0 0; }
.hero .kpis { margin-left: auto; display: flex; gap: 2.2rem; flex-wrap: wrap; }
.hero .kpis small { font-size: .68rem; opacity: .75; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.hero .kpis b { display: block; font-family: 'Fraunces', serif; font-weight: 560; font-size: 1.6rem; margin-top: .12rem; }
.hero .kpis .up { color: #b8ffdf; font-size: .76rem; font-weight: 600; }
.hero .kpis .down { color: #ffd2e1; font-size: .76rem; font-weight: 600; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: .95rem; margin-bottom: 1.3rem; }
.card {
  background: var(--surface); border-radius: 20px; padding: 1.05rem 1.2rem; border: 1px solid var(--line);
  box-shadow: var(--shadow-soft); transition: transform .2s ease, box-shadow .2s ease; animation: rise .5s ease both;
}
.card:nth-child(2) { animation-delay: .05s } .card:nth-child(3) { animation-delay: .1s }
.card:nth-child(4) { animation-delay: .15s } .card:nth-child(5) { animation-delay: .2s }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.card.clickable { cursor: pointer; }
.card.clickable:active { transform: translateY(-1px); }
tr.row-click { cursor: pointer; }
tr.row-click:hover td { background: #f3f0ff; }
.card .label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.card .value { font-family: 'Fraunces', serif; font-weight: 560; font-size: 1.55rem; margin-top: .25rem; color: var(--ink); }
.card .value.pos { color: var(--mint); }
.card .value.neg { color: var(--rose); }
.card svg.spark { width: 100%; height: 32px; margin-top: .5rem; }

/* ---------- panels ---------- */
.panel {
  background: var(--surface); border-radius: 22px; border: 1px solid var(--line);
  box-shadow: var(--shadow-soft); padding: 1.3rem 1.4rem; margin-bottom: 1.3rem; animation: rise .55s ease both;
}
.panel h3 { margin: 0 0 .85rem; font-family: 'Fraunces', serif; font-weight: 560; font-size: 1.08rem; color: var(--ink); }
.panel .sub { color: var(--muted); font-size: .8rem; margin: -.6rem 0 .9rem; }
.row-flex { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--muted); font-size: .85rem; }
code { background: var(--lav); color: var(--violet-deep); padding: .08rem .35rem; border-radius: 6px; font-size: .85em; }

/* ---------- alertas ---------- */
.alert-groups { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.3rem; }
.alert-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; margin-bottom: 1.3rem; }
.alert-card {
  border-radius: 18px; padding: .8rem .95rem; display: flex; gap: .8rem; align-items: center;
  border: 1px solid; background: var(--surface); animation: rise .5s ease both;
}
.alert-card.warn { background: var(--warn-bg); border-color: #f0e0b4; }
.alert-card.danger { background: var(--danger-bg); border-color: #f6c4d5; }
.alert-card .big {
  font-family: 'Fraunces', serif; font-weight: 560; font-size: 1.15rem; line-height: 1.05; min-width: 56px;
  text-align: center; border-radius: 12px; padding: .42rem .3rem; background: #fff; flex: none;
}
.alert-card.warn .big { color: var(--warn); border: 1px solid #f0e0b4; }
.alert-card.danger .big { color: var(--rose); border: 1px solid #f6c4d5; }
.alert-card .big small { display: block; font-family: 'Outfit'; font-size: .58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.alert-card .info b { display: block; font-size: .9rem; }
.alert-card .info span { font-size: .76rem; color: var(--muted); }

/* ---------- a receber / atividade ---------- */
.act { display: flex; gap: .8rem; padding: .6rem .15rem; border-bottom: 1px dashed var(--line); align-items: center; }
.act:last-child { border-bottom: none; }
.act .av { width: 38px; height: 38px; border-radius: 13px; flex: none; display: grid; place-items: center; font-size: 1rem; background: var(--lav); }
.act b { font-size: .88rem; }
.act small { display: block; color: var(--muted); font-size: .74rem; }
.act .amt { margin-left: auto; font-family: 'Fraunces', serif; font-weight: 560; font-size: .95rem; white-space: nowrap; }
.act .src { font-size: .6rem; font-weight: 700; letter-spacing: .08em; color: var(--peri); background: #f3f0ff; border-radius: 6px; padding: .12rem .4rem; margin-left: .5rem; flex: none; }

/* ---------- forms ---------- */
input, select, textarea {
  font-family: inherit; font-size: .92rem; padding: .5rem .7rem; border: 1.5px solid var(--line);
  border-radius: 11px; background: #fff; color: var(--ink); width: 100%; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--peri); box-shadow: 0 0 0 3px rgba(161, 149, 255, .18); }
input:disabled { background: var(--lav); color: var(--violet-deep); }
label { display: block; font-size: .74rem; color: var(--muted); margin-bottom: .25rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.field { margin-bottom: .75rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem .8rem; }
.btn {
  background: var(--hero-grad); color: #fff; border: none; border-radius: 12px; padding: .55rem 1.1rem;
  cursor: pointer; font-size: .9rem; font-weight: 700; box-shadow: 0 6px 18px rgba(109, 94, 240, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 9px 24px rgba(109, 94, 240, .45); }
.btn.secondary { background: #fff; color: var(--violet-deep); border: 1.5px solid var(--line); box-shadow: none; }
.btn.secondary:hover { border-color: var(--peri); }
.btn.danger { background: var(--rose); box-shadow: 0 6px 18px rgba(232, 93, 138, .35); }
.btn.small { padding: .28rem .7rem; font-size: .78rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th {
  text-align: left; padding: .55rem .65rem; background: var(--lav); color: var(--violet-deep);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; font-weight: 700;
}
th:first-child { border-radius: 11px 0 0 11px; } th:last-child { border-radius: 0 11px 11px 0; }
td { padding: .52rem .65rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:hover td { background: #faf9ff; }
td.num, th.num { text-align: right; }
tr.group-row td { background: #f3f0ff; font-weight: 700; color: var(--violet-deep); cursor: pointer; user-select: none; }
tr.group-row td:hover { background: #ebe6ff; }
.chev { display: inline-block; width: 1.1em; transition: transform .15s; }
.tag { display: inline-block; border-radius: 8px; padding: .14rem .5rem; font-size: .7rem; font-weight: 700; }
.tag.low { background: var(--danger-bg); color: var(--rose); }
.tag.exp { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--ok-bg); color: var(--mint); }
.tag.origem { background: #f3f0ff; color: var(--peri); letter-spacing: .06em; text-transform: uppercase; font-size: .62rem; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: .95rem; padding: .18rem .32rem; border-radius: 8px; }
.icon-btn:hover { background: var(--lav); }

/* ---------- modal / toast / chart ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(23, 14, 60, .55); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 3rem 1rem; overflow-y: auto;
}
.modal { background: #fff; border-radius: 20px; padding: 1.55rem; width: 100%; max-width: 680px; box-shadow: 0 28px 90px rgba(15, 8, 50, .45); animation: rise .25s ease both; }
.modal h3 { margin: 0 0 1rem; font-family: 'Fraunces', serif; font-weight: 560; font-size: 1.15rem; }
.modal .actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.1rem; }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: .65rem 1.3rem; border-radius: 999px; font-size: .9rem; z-index: 200; box-shadow: var(--shadow-pop);
}
.toast.error { background: var(--rose); }
.chart-box { position: relative; height: 300px; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (max-width: 920px) {
  .shell { flex-direction: column; }
  aside.side { width: 100%; height: auto; position: static; padding: .7rem .8rem; flex-direction: row; align-items: center; gap: .6rem; }
  .side .logo { padding: 0 .4rem; }
  .side .logo small { display: none; }
  .side nav { flex-direction: row; overflow-x: auto; }
  .side nav button { white-space: nowrap; padding: .5rem .7rem; }
  .side nav button.active::before { display: none; }
  .side .foot { display: none; }
  main.content { padding: 1rem .8rem 3.5rem; }
  .hero { padding: 1.2rem 1.3rem; gap: 1rem; }
  .hero .kpis { gap: 1.2rem; margin-left: 0; }
}
