/* ==========================================================================
   AVIÁRIO PRO 2026  ·  Folha de estilos
   Design: teal/esmeralda (plumagem) + âmbar (canários) · dark + light
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600;700&display=swap');

/* ---------------------------------------------------------------- Tokens */
:root {
  --bg:        #0B1014;
  --bg-2:      #0F171E;
  --surface:   #141E27;
  --surface-2: #1A2832;
  --surface-3: #213240;
  --border:    rgba(255,255,255,.08);
  --border-2:  rgba(255,255,255,.14);
  --text:      #E7EFF5;
  --text-dim:  #8597A6;
  --text-mute: #5E707F;

  --primary:        #14B8A6;
  --primary-strong: #0D9488;
  --primary-soft:   rgba(20,184,166,.14);
  --primary-glow:   rgba(20,184,166,.40);
  --accent:         #F5A524;
  --accent-soft:    rgba(245,165,36,.14);

  --ok:    #2DD4A7;
  --ok-bg: rgba(45,212,167,.14);
  --warn:    #F5A524;
  --warn-bg: rgba(245,165,36,.14);
  --danger:    #F87171;
  --danger-bg: rgba(248,113,113,.14);
  --info:    #56C2F0;
  --info-bg: rgba(86,194,240,.14);
  --violet:    #A78BFA;
  --violet-bg: rgba(167,139,250,.14);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 6px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.5);

  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --side-w: 264px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);

  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg:        #EEF3F6;
  --bg-2:      #E4EBF0;
  --surface:   #FFFFFF;
  --surface-2: #F5F8FA;
  --surface-3: #ECF1F5;
  --border:    rgba(15,30,42,.10);
  --border-2:  rgba(15,30,42,.16);
  --text:      #13212B;
  --text-dim:  #56697A;
  --text-mute: #8194A2;

  --primary:        #0E9E8E;
  --primary-strong: #0B7E72;
  --primary-soft:   rgba(14,158,142,.12);
  --primary-glow:   rgba(14,158,142,.28);
  --accent:         #C9760A;
  --accent-soft:    rgba(201,118,10,.12);

  --ok:#0E9E72; --ok-bg:rgba(14,158,114,.12);
  --warn:#C9760A; --warn-bg:rgba(201,118,10,.12);
  --danger:#DC4B4B; --danger-bg:rgba(220,75,75,.10);
  --info:#1B92C9; --info-bg:rgba(27,146,201,.10);
  --violet:#7C5CE6; --violet-bg:rgba(124,92,230,.10);

  --shadow-sm: 0 1px 2px rgba(15,30,42,.06);
  --shadow:    0 8px 30px rgba(15,30,42,.10);
  --shadow-lg: 0 24px 60px rgba(15,30,42,.16);
}

/* ---------------------------------------------------------------- Reset */
*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; }
html,body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .4s var(--ease), color .4s var(--ease);
  overflow-x: hidden;
}
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input,select,textarea { font-family: inherit; font-size: 1rem; }
a { color: var(--primary); text-decoration: none; }
::selection { background: var(--primary-glow); }

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-mute); background-clip: content-box; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth::before, .auth::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .5;
  z-index: 0;
  animation: drift 16s ease-in-out infinite alternate;
}
.auth::before { width: 460px; height: 460px; background: radial-gradient(circle, var(--primary), transparent 70%); top: -120px; left: -80px; }
.auth::after  { width: 420px; height: 420px; background: radial-gradient(circle, var(--accent), transparent 70%); bottom: -140px; right: -60px; animation-delay: -8s; }
@keyframes drift { to { transform: translate(40px,30px) scale(1.15); } }

.auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: 40px 34px;
  box-shadow: var(--shadow-lg);
  animation: pop .6s var(--ease-out);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-brand .logo { width: 52px; height: 52px; }
.auth-brand h1 { font-size: 1.45rem; }
.auth-brand p { color: var(--text-dim); font-size: .82rem; margin-top: 2px; }
.auth h2 { font-size: 1.15rem; margin-bottom: 4px; }
.auth .sub { color: var(--text-dim); font-size: .9rem; margin-bottom: 22px; }
.auth .field { margin-bottom: 16px; }
.auth-switch { text-align: center; margin-top: 20px; color: var(--text-dim); font-size: .9rem; }
.auth-switch button { color: var(--primary); font-weight: 600; }
.auth-error {
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--r-sm); padding: 10px 14px; font-size: .88rem; margin-bottom: 16px;
  display: none;
}
.auth-error.show { display: block; animation: shake .4s; }

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100dvh; }

/* ---- Sidebar ---- */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
  z-index: 40;
}
.sidebar-head { padding: 22px 22px 14px; display: flex; align-items: center; gap: 11px; }
.sidebar-head .logo { width: 50px; height: 50px; flex-shrink: 0; }
.sidebar-head .name { font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; }
.sidebar-head .name span { color: var(--primary); }
.nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.nav-group-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-mute); padding: 16px 12px 8px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px; border-radius: 12px;
  color: var(--text-dim); font-weight: 600; font-size: .92rem;
  position: relative; transition: all .2s var(--ease);
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; background: var(--primary); border-radius: 0 4px 4px 0;
}
.nav-item .count {
  margin-left: auto; font-size: .72rem; font-weight: 700;
  background: var(--surface-3); color: var(--text-dim);
  padding: 1px 8px; border-radius: 20px; min-width: 22px; text-align: center;
}
.nav-item.active .count { background: var(--primary); color: #fff; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 12px; }
.avatar {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-family: var(--font-display);
}
.user-chip .meta { overflow: hidden; }
.user-chip .meta b { font-size: .88rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .meta small { color: var(--text-mute); font-size: .76rem; }

/* ---- Main ---- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 10px; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px;
  margin: 10px max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.tb-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-brand .tb-name {
  font-family: var(--font-display); font-weight: 800; font-size: 1.14rem;
  letter-spacing: -.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .sub { color: var(--text-dim); font-size: .82rem; }
.topbar .spacer { flex: 1; }
.hamburger { display: none; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; color: var(--text-dim);
  border: 1px solid var(--border); background: var(--surface);
  transition: all .2s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; }

.content { padding: 28px; flex: 1; max-width: 1240px; width: 100%; }
.view { animation: viewIn .45s var(--ease-out); }

/* ==========================================================================
   COMPONENTS
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: .92rem;
  transition: all .2s var(--ease); position: relative; overflow: hidden; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 16px var(--primary-glow); }
.btn-primary:hover { background: var(--primary-strong); transform: translateY(-2px); box-shadow: 0 8px 24px var(--primary-glow); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-2); background: var(--surface-2); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid color-mix(in srgb,var(--danger) 28%,transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .82rem; border-radius: 10px; }
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.5); transform: scale(0); animation: ripple .6s var(--ease-out); pointer-events: none; }

/* Form fields */
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.field label .req { color: var(--danger); }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  transition: all .2s var(--ease); outline: none;
}
.field textarea { resize: vertical; min-height: 84px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); background: var(--surface);
}
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238597A6' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px; box-shadow: var(--shadow-sm);
}

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; position: relative; overflow: hidden;
  transition: transform .3s var(--ease), border-color .3s var(--ease);
}
.stat:hover { transform: translateY(-4px); border-color: var(--border-2); }
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle, var(--ic, var(--primary-glow)), transparent 70%);
  opacity: .35;
}
.stat .ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 14px; }
.stat .ico svg { width: 22px; height: 22px; }
.stat .num { font-family: var(--font-display); font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.stat .lbl { color: var(--text-dim); font-size: .86rem; margin-top: 6px; font-weight: 500; }

/* Section header (list views) */
.sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.sec-head .titles h3 { font-size: 1.25rem; }
.sec-head .titles p { color: var(--text-dim); font-size: .84rem; margin-top: 2px; }
.sec-head .spacer { flex: 1; }
.search {
  position: relative; min-width: 200px;
}
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-mute); }
.search input { width: 100%; padding-left: 38px; }

/* Record list */
.records { display: grid; gap: 12px; }
.rec {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 18px;
  display: flex; align-items: center; gap: 16px;
  transition: all .25s var(--ease); position: relative;
  animation: recIn .4s var(--ease-out) backwards;
}
.rec:hover { border-color: var(--border-2); transform: translateX(3px); box-shadow: var(--shadow-sm); }
.rec .rec-ic {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary);
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
}
.rec .rec-ic svg { width: 22px; height: 22px; }
.rec .rec-body { flex: 1; min-width: 0; }
.rec .rec-title { font-weight: 700; font-size: .98rem; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.rec .rec-meta { color: var(--text-dim); font-size: .82rem; margin-top: 3px; display: flex; gap: 14px; flex-wrap: wrap; }
.rec .rec-meta b { color: var(--text); font-weight: 600; }
.rec .rec-actions { display: flex; gap: 6px; flex-shrink: 0; }
.rec .rec-actions button { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--text-mute); transition: all .2s var(--ease); }
.rec .rec-actions button svg { width: 17px; height: 17px; }
.rec .rec-actions .edit:hover { background: var(--primary-soft); color: var(--primary); }
.rec .rec-actions .del:hover { background: var(--danger-bg); color: var(--danger); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700;
  text-transform: capitalize; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }
.badge.mute { background: var(--surface-3); color: var(--text-dim); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* Pill icons for sex */
.sx { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: .76rem; }
.sx.m { color: var(--info); } .sx.f { color: #F472B6; } .sx.i { color: var(--text-mute); }

/* Empty state */
.empty { text-align: center; padding: 64px 24px; }
.empty .e-ic { width: 80px; height: 80px; border-radius: 24px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 20px; color: var(--text-mute); }
.empty .e-ic svg { width: 38px; height: 38px; }
.empty h3 { font-size: 1.15rem; margin-bottom: 6px; }
.empty p { color: var(--text-dim); margin-bottom: 22px; max-width: 360px; margin-inline: auto; }

/* Skeleton */
.skel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); height: 78px; position: relative; overflow: hidden; }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb,var(--surface-3) 60%, transparent), transparent); animation: shimmer 1.5s infinite; }

/* Dashboard grid */
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; }
.panel h4 { font-size: 1rem; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.panel h4 svg { width: 18px; height: 18px; color: var(--primary); }
.chart-wrap { position: relative; height: 220px; }

/* Bars */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  min-height: 4px; transition: height 1s var(--ease-out); position: relative;
}
.bar-col .bv { font-size: .8rem; font-weight: 700; }
.bar-col .bl { font-size: .72rem; color: var(--text-mute); }

/* Donut legend */
.legend { display: grid; gap: 10px; margin-top: 4px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: .86rem; }
.legend-row .dot { width: 11px; height: 11px; border-radius: 4px; }
.legend-row .lv { margin-left: auto; font-weight: 700; }

/* Task list (dashboard) */
.tasklist { display: grid; gap: 10px; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--border); }
.task-row .tdot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.task-row .tt { font-size: .9rem; font-weight: 600; flex: 1; }
.task-row .td { font-size: .76rem; color: var(--text-mute); }

/* ==========================================================================
   MODAL
   ========================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(3,8,12,.62); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease);
}
.overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 560px; max-height: 90dvh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(.97); transition: transform .35s var(--ease-out);
}
.overlay.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; border-radius: var(--r-xl) var(--r-xl) 0 0; }
.modal-head .m-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.modal-head .m-ic svg { width: 20px; height: 20px; }
.modal-head h3 { font-size: 1.12rem; flex: 1; }
.modal-head .close { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--text-dim); }
.modal-head .close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 22px 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 18px 24px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal-foot.split { justify-content: space-between; flex-wrap: wrap; row-gap: 8px; }
.modal-foot.split .mf-right { display: flex; gap: 10px; margin-left: auto; }

/* Confirm */
.confirm-box { max-width: 400px; text-align: center; padding: 30px 26px; }
.confirm-box .c-ic { width: 64px; height: 64px; border-radius: 20px; background: var(--danger-bg); color: var(--danger); display: grid; place-items: center; margin: 0 auto 18px; }
.confirm-box .c-ic svg { width: 30px; height: 30px; }
.confirm-box h3 { margin-bottom: 8px; }
.confirm-box p { color: var(--text-dim); margin-bottom: 24px; }

/* ==========================================================================
   TOASTS
   ========================================================================== */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: grid; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 14px; padding: 13px 18px; box-shadow: var(--shadow-lg);
  min-width: 260px; max-width: 360px;
  animation: toastIn .4s var(--ease-out);
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .t-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.toast .t-ic svg { width: 17px; height: 17px; }
.toast.ok .t-ic { background: var(--ok-bg); color: var(--ok); }
.toast.err .t-ic { background: var(--danger-bg); color: var(--danger); }
.toast.info .t-ic { background: var(--info-bg); color: var(--info); }
.toast span { font-size: .9rem; font-weight: 500; }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes pop { from { opacity:0; transform: translateY(16px) scale(.98); } to { opacity:1; transform:none; } }
@keyframes viewIn { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform:none; } }
@keyframes recIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform:none; } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes ripple { to { transform: scale(3); opacity: 0; } }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-7px)} 40%,80%{transform:translateX(7px)} }
@keyframes toastIn { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform:none; } }
@keyframes toastOut { to { opacity:0; transform: translateX(40px); } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
.backdrop { display: none; }

@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 280px;
    transform: translateX(-100%); transition: transform .35s var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .backdrop.show { opacity: 1; pointer-events: auto; }
  .hamburger { display: grid; }
  .content { padding: 20px 16px; }
  .topbar { padding: 14px 16px; }
  .dash-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .stat .num { font-size: 1.7rem; }
  .tb-brand .tb-name { font-size: 1.05rem; }
  .rec { padding: 14px; gap: 12px; }
  .rec .rec-actions { flex-direction: column; }
  .sec-head .search { width: 100%; min-width: 0; order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Focus visible */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ==========================================================================
   ASSINATURA & COMPONENTES ADICIONAIS
   ========================================================================== */

/* Fonte mono para dados/anilhas */
:root { --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace; }

/* ---- Anilha (anel de pata) — elemento-assinatura ---- */
.anilha {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  padding: 2px 9px; border-radius: 20px; color: var(--text);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 16%, var(--surface-2)), var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--border));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 1px 2px rgba(0,0,0,.2);
  white-space: nowrap;
}
.anilha::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px;
  background: radial-gradient(circle at 35% 30%, #fff, var(--primary));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 50%, transparent);
}

/* ---- Anel de contagem decrescente para eclosão — assinatura ---- */
.hatch-ring {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--rc, var(--primary)) var(--deg, 0deg), var(--surface-3) 0);
  transition: background .8s var(--ease-out);
}
.hatch-ring::before {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--surface);
}
.hatch-ring .hr-in {
  position: relative; z-index: 1;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 700; color: var(--rc, var(--primary));
}

/* ---- Campo de palavra-passe com "olho" ---- */
.pw-field { position: relative; display: flex; }
.pw-field input { flex: 1; padding-right: 44px; }
.pw-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; color: var(--text-mute);
  transition: color .2s var(--ease), background .2s var(--ease);
}
.pw-eye svg { width: 18px; height: 18px; }
.pw-eye:hover { color: var(--primary); background: var(--primary-soft); }

/* ---- Segmented control (login/registo) ---- */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 4px; margin-bottom: 22px;
}
.seg button {
  padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: .9rem;
  color: var(--text-dim); transition: all .25s var(--ease);
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button:not(.on):hover { color: var(--text); }

/* ---- Dica de modo demonstração ---- */
.demo-hint {
  display: flex; align-items: center; gap: 9px;
  margin-top: 20px; padding: 11px 14px; border-radius: 12px;
  background: var(--info-bg); color: var(--info); font-size: .82rem; line-height: 1.4;
}
.demo-hint svg { width: 18px; height: 18px; flex-shrink: 0; }
.demo-hint b { color: var(--info); }

/* ---- Switch (checkbox) ---- */
.switch { display: flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; padding-top: 4px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 44px; height: 25px; border-radius: 20px; background: var(--surface-3);
  position: relative; transition: background .25s var(--ease); flex-shrink: 0;
  border: 1px solid var(--border);
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px;
  border-radius: 50%; background: #fff; transition: transform .25s var(--ease-out);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .track { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .track::after { transform: translateX(19px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--primary-soft); }
.switch .sw-label { font-size: .9rem; font-weight: 600; color: var(--text-dim); }

/* ---- Estrela de favorito ---- */
.fav { display: inline-grid; place-items: center; }
.fav svg { width: 15px; height: 15px; fill: none; }
.fav.on svg { fill: var(--accent); color: var(--accent); }

/* ---- Vazio em linha (dashboard) ---- */
.inline-empty {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px; border-radius: 12px;
  background: var(--surface-2); border: 1px dashed var(--border-2);
  color: var(--text-dim); font-size: .88rem;
}
.inline-empty svg { width: 18px; height: 18px; color: var(--ok); flex-shrink: 0; }

/* ---- Validação de campo ---- */
.field input.invalid, .field select.invalid, .field textarea.invalid {
  border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg);
}

/* JetBrains Mono carregada junto às fontes principais (fallback de sistema garante leitura) */

/* ==========================================================================
   MÓDULOS v2 — Casais · Filhos · Hospital · Compras · Notas
   (componentes adicionais: fotos, paginação, pesquisa, listas)
   ========================================================================== */

/* Cabeçalho de secção */
.sec-head .sh-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.sec-head .sh-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.sec-head .sh-ic svg { width: 19px; height: 19px; }
.sec-head h2 { font-size: 1.3rem; letter-spacing: -.01em; }
.sec-head .count-pill { font-size: .74rem; font-weight: 700; color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 9px; border-radius: 20px; }
.sec-head > button { margin-left: auto; }

/* Barra de ferramentas da lista (pesquisa + filtros) */
.list-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.list-tools .search { flex: 1; min-width: 220px; }
.list-tools .search .s-ic { display: contents; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 8px 14px; border-radius: 11px; font-size: .82rem; font-weight: 600; color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); transition: all .2s var(--ease); }
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip.on { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }

/* Corpo da lista */
.list-body { display: grid; gap: 12px; }

/* Paginação */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; }
.pager .btn { min-width: 42px; }
.pager-info { font-size: .84rem; color: var(--text-dim); font-weight: 600; }

/* Variantes de registo */
.rec .rec-sub { color: var(--text-mute); font-weight: 500; font-size: .85em; }
.rec-note { color: var(--text-mute); font-size: .8rem; margin-top: 5px; line-height: 1.45; }
.rec-note.long { font-size: .82rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-trail { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-shrink: 0; }
.rec-amount { font-family: var(--font-mono); font-weight: 700; font-size: .98rem; color: var(--text); }
.rec.mini { padding: 12px 14px; gap: 12px; animation: none; }
.rec.mini .rec-ic { width: 38px; height: 38px; }
.rec .rec-ic.media { padding: 0; overflow: hidden; background: var(--surface-2); }
.rec .rec-ic.media img { width: 100%; height: 100%; object-fit: cover; }
.rec .rec-ic.accent-ic { background: var(--accent-soft); color: var(--accent); }

/* Botões de ação (estilo leve dentro de .rec-actions) */
.rec-actions .icon-btn { width: 36px; height: 36px; border: 0; background: transparent; color: var(--text-mute); border-radius: 10px; }
.rec-actions .icon-btn:hover { background: var(--primary-soft); color: var(--primary); transform: none; }
.rec-actions .icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* Fotos do casal (fêmea ♀ / macho ♂) */
.casal-rec { flex-direction: column; align-items: stretch; gap: 14px; }
.casal-top { display: flex; align-items: center; gap: 14px; }
.casal-photos { display: flex; gap: 8px; flex-shrink: 0; }
.cphoto { position: relative; width: 54px; height: 54px; border-radius: 13px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; }
.cphoto img { width: 100%; height: 100%; object-fit: cover; }
.cphoto .cphoto-ph svg { width: 22px; height: 22px; color: var(--text-mute); }
.cphoto .cbadge { position: absolute; left: 3px; bottom: 3px; font-size: .62rem; font-weight: 800; line-height: 1; padding: 2px 5px; border-radius: 7px; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.cphoto.f { border-color: color-mix(in srgb, #F472B6 45%, var(--border)); }
.cphoto.f .cbadge { color: #F472B6; }
.cphoto.f .cphoto-ph svg { color: #F472B6; }
.cphoto.m { border-color: color-mix(in srgb, var(--info) 45%, var(--border)); }
.cphoto.m .cbadge { color: var(--info); }
.cphoto.m .cphoto-ph svg { color: var(--info); }

/* Barra de ações "em rodapé", com etiquetas — usada nos cartões de casal */
.casal-rec .rec-actions.labeled {
  display: flex; flex-direction: row; gap: 6px; padding-top: 12px; margin-top: 0; border-top: 1px solid var(--border);
}
.casal-rec .rec-actions.labeled .icon-btn {
  flex: 1; width: auto !important; height: auto !important; flex-direction: column; gap: 5px;
  padding: 9px 4px; border-radius: 12px; font-size: .66rem; font-weight: 700; color: var(--text-mute);
}
.casal-rec .rec-actions.labeled .icon-btn svg { width: 18px; height: 18px; }
.casal-rec .rec-actions.labeled .icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.casal-rec .rec-actions.labeled .icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.act-l { line-height: 1.1; white-space: nowrap; }

/* Campo de foto (formulário) */
.photo-field label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.photo-up { display: flex; align-items: center; gap: 14px; }
.photo-thumb { width: 76px; height: 76px; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 1px dashed var(--border-2); display: grid; place-items: center; flex-shrink: 0; }
.photo-thumb svg { width: 26px; height: 26px; color: var(--text-mute); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-up.has .photo-thumb { border-style: solid; border-color: var(--border); }
.photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.photo-actions .btn { padding: 6px 11px; }
.photo-status { font-size: .78rem; color: var(--primary); font-weight: 600; }
.danger-txt { color: var(--danger) !important; }

/* Hospital — destaque por estado + seletor inline */
.hosp-rec { border-left: 3px solid var(--border-2); }
.hosp-rec.st-doente { border-left-color: var(--danger); }
.hosp-rec.st-curado { border-left-color: var(--ok); }
.hosp-rec.st-morto { border-left-color: var(--text-mute); }
.hosp-actions { align-items: center; }
.estado-sel { appearance: none; padding: 7px 28px 7px 11px; border-radius: 10px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font-size: .8rem; font-weight: 600; text-transform: capitalize; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238597A6' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.estado-sel:focus { border-color: var(--primary); outline: none; }

/* Formulário */
.form-grid .span2 { grid-column: 1 / -1; }
.fhelp { display: block; margin-top: 6px; font-size: .76rem; color: var(--text-mute); }
.confirm-box .c-ic { width: 56px; height: 56px; border-radius: 17px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--warn); }
.confirm-box .c-ic svg { width: 26px; height: 26px; }
.children-list { display: grid; gap: 10px; }

/* Esqueletos de linha */
.skel-rec { animation: none; }
.skel-rec .sk-ic { width: 46px; height: 46px; border-radius: 13px; }
.sk-line { height: 12px; border-radius: 6px; margin: 7px 0; }
.sk-line.short { width: 55%; }

/* Ajustes responsivos */
@media (max-width: 560px) {
  .casal-photos { gap: 6px; }
  .cphoto { width: 46px; height: 46px; }
  .rec-trail { gap: 8px; }
  .photo-up { gap: 10px; }
}

/* ==========================================================================
   PALETA "NATUREZA" — folhagem, penas, céu e vida (dark + light)
   Redefinição de tokens (vence por ordem de cascata) + fundos orgânicos.
   ========================================================================== */
:root {
  /* Paleta "cinza escuro + dourado" — sóbria e profissional */
  --bg:        #17181B;
  --bg-2:      #1D1F23;
  --surface:   #232529;
  --surface-2: #2B2E33;
  --surface-3: #383B41;
  --border:    rgba(255,255,255,.08);
  --border-2:  rgba(255,255,255,.14);
  --text:      #F1EFE9;
  --text-dim:  #A9ABB2;
  --text-mute: #75787F;

  --primary:        #D9AF56;   /* dourado */
  --primary-strong: #BE9440;
  --primary-soft:   rgba(217,175,86,.16);
  --primary-glow:   rgba(217,175,86,.45);
  --accent:         #C99A45;   /* bronze dourado */
  --accent-soft:    rgba(201,154,69,.16);

  --ok:    #3BC15A; --ok-bg: rgba(59,193,90,.16);
  --warn:  #E2883D; --warn-bg: rgba(226,136,61,.16);
  --danger:#EF5A44; --danger-bg: rgba(239,90,68,.16);
  --info:  #4C97E6; --info-bg: rgba(76,151,230,.16);
  --violet:#CE86E8; --violet-bg: rgba(206,134,232,.16);

  /* Uma cor por secção (nav inferior, cabeçalhos, FAB) */
  --c-painel:   #D9AF56;
  --c-casais:   #EA7D96;
  --c-filhos:   #3BC15A;
  --c-criados:  #B8834A;
  --c-hospital: #EF5A44;
  --c-compras:  #4C97E6;
  --c-notas:    #CE86E8;
  --c-lembretes:#F5B83D;
  --acc: var(--primary);
}

[data-theme="light"] {
  --bg:        #EDF2F5;
  --bg-2:      #E1E9EE;
  --surface:   #FFFFFF;
  --surface-2: #F2F6F9;
  --surface-3: #E7EEF3;
  --border:    rgba(22,52,70,.10);
  --border-2:  rgba(22,52,70,.16);
  --text:      #12262F;
  --text-dim:  #4E6675;
  --text-mute: #7C93A2;

  --primary:        #12938C;
  --primary-strong: #0E7B75;
  --primary-soft:   rgba(18,147,140,.12);
  --primary-glow:   rgba(18,147,140,.28);
  --accent:         #D97A45;
  --accent-soft:    rgba(217,122,69,.14);

  --ok:    #2C9E43; --ok-bg: rgba(44,158,67,.12);
  --warn:  #C88A16; --warn-bg: rgba(200,138,22,.14);
  --danger:#D8452F; --danger-bg: rgba(216,69,47,.12);
  --info:  #2C82D6; --info-bg: rgba(44,130,214,.12);
  --violet:#B268D4; --violet-bg: rgba(178,104,212,.12);

  --c-painel:   #12938C;
  --c-casais:   #D96A85;
  --c-filhos:   #2C9E43;
  --c-criados:  #9C6B33;
  --c-hospital: #D8452F;
  --c-compras:  #2C82D6;
  --c-notas:    #B268D4;
  --c-lembretes:#C88A16;

  --shadow-sm: 0 1px 2px rgba(22,52,70,.06);
  --shadow:    0 8px 30px rgba(22,52,70,.10);
  --shadow-lg: 0 24px 60px rgba(22,52,70,.16);
}

/* Fundo orgânico — luz difusa entre folhas (subtil, adapta-se ao tema) */
body {
  background:
    radial-gradient(1100px 720px at 10% -10%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 60%),
    radial-gradient(900px 620px at 110% 112%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}
[data-theme="light"] body {
  background:
    radial-gradient(1000px 680px at 8% -12%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 58%),
    radial-gradient(820px 560px at 112% 114%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 52%),
    var(--bg);
  background-attachment: fixed;
}

/* Barra lateral com leve gradiente natural */
.sidebar { background: linear-gradient(180deg, var(--bg-2), color-mix(in srgb, var(--primary) 5%, var(--bg-2))); }

/* Ecrã de entrada — folhagem suave */
.auth {
  background:
    radial-gradient(680px 480px at 50% -8%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 62%),
    radial-gradient(520px 420px at 88% 108%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 58%),
    var(--bg);
}
.auth-card { box-shadow: var(--shadow-lg); }

/* Acento superior no cartão de entrada (faixa viva) */
.auth-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.auth-card { position: relative; overflow: hidden; }

/* ==========================================================================
   VIVO 2026 — camada de vida: gradientes, profundidade, vidro e movimento
   (assinatura no ecrã de entrada; polimento disciplinado no interior)
   ========================================================================== */

/* Logótipo escala sempre ao contentor (corrige SVG sem width/height) */
.logo svg { width: 100%; height: 100%; display: block; }

/* ---------------------------------------------------------- ASSINATURA: LOGIN */
.auth::before {   /* aurora — nuvens de luz que derivam devagar */
  width: 720px; height: 720px; top: -230px; left: 50%; margin-left: -360px;
  background:
    radial-gradient(circle at 32% 30%, color-mix(in srgb, var(--primary) 55%, transparent), transparent 60%),
    radial-gradient(circle at 70% 55%, color-mix(in srgb, var(--accent) 48%, transparent), transparent 62%),
    radial-gradient(circle at 55% 82%, color-mix(in srgb, var(--info) 42%, transparent), transparent 60%);
  filter: blur(72px); opacity: .62;
  animation: aurora 20s ease-in-out infinite alternate;
}
.auth::after {   /* pena/folha a flutuar */
  width: 116px; height: 116px; right: 11%; top: 15%; bottom: auto;
  background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27%2523D9AF56%27%20stroke-width%3D%271.4%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M20.5%203.5C11%204.5%204.5%2011%203.5%2020.5c9.5-1%2016-7.5%2017-17Z%27%2F%3E%3Cpath%20d%3D%27M6%2018%2018%206%27%2F%3E%3Cpath%20d%3D%27M8.4%2015.6%2012.6%2015%27%2F%3E%3Cpath%20d%3D%27M9%2013.2%2015%2012.5%27%2F%3E%3Cpath%20d%3D%27M10.8%2011.2%2016%2010.2%27%2F%3E%3Cpath%20d%3D%27M12.8%209.2%2016.6%208.4%27%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.28)); opacity: .5;
  animation: floaty 9s ease-in-out infinite;
}
@keyframes aurora { 0% { transform: translate(-24px,-12px) scale(1) rotate(0deg); } 100% { transform: translate(30px,22px) scale(1.16) rotate(9deg); } }
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(-7deg); } 50% { transform: translateY(-22px) rotate(7deg); } }

.auth-card {
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  backdrop-filter: blur(26px) saturate(1.3);
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  border-color: color-mix(in srgb, var(--primary) 16%, var(--border-2));
}
.auth-brand { position: relative; }
.auth-brand .logo { width: 72px; height: 72px; position: relative; z-index: 0; }
.auth-brand .logo svg { position: relative; z-index: 1; }
.auth-brand .logo::before {   /* halo a respirar atrás do logótipo */
  content: ""; position: absolute; inset: -10px; z-index: 0; border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
  animation: breathe 4.5s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { transform: scale(1); opacity: .5; } 50% { transform: scale(1.18); opacity: .85; } }

/* --------------------------------------------------------------- BOTÕES vivos */
.btn-primary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 90%, #fff), var(--primary-strong));
  box-shadow: 0 6px 20px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,.28);
}
.btn-primary::after {   /* brilho que atravessa no hover */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 22%, rgba(255,255,255,.38) 46%, transparent 62%);
  transform: translateX(-130%); transition: transform .6s var(--ease-out);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,.32); }
.btn-primary:hover::after { transform: translateX(130%); }
.btn-primary:active { transform: translateY(0) scale(.98); }

/* ------------------------------------------------------------- NAV com energia */
.nav-item.active {
  background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--accent) 10%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent);
}
.nav-item.active::before {
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  box-shadow: 0 0 12px var(--primary-glow);
}
.nav-item:hover { transform: translateX(2px); }
.nav-item:active { transform: translateX(2px) scale(.99); }

/* ------------------------------------------------------- LADRILHOS de ícone */
.sec-head .sh-ic, .modal-head .m-ic {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 24%, var(--surface)), color-mix(in srgb, var(--primary) 10%, var(--surface)));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}

/* -------------------------------------------------------- CARTÕES com profundidade */
.rec { box-shadow: 0 1px 2px rgba(0,0,0,.16); }
.rec:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  box-shadow: 0 12px 28px -10px color-mix(in srgb, var(--primary) 32%, transparent);
}
.stat:hover { box-shadow: 0 16px 32px -12px color-mix(in srgb, var(--primary) 28%, transparent); }
.panel { transition: border-color .3s var(--ease), box-shadow .3s var(--ease); }
.panel:hover { border-color: var(--border-2); box-shadow: 0 10px 26px -14px rgba(0,0,0,.4); }
.task-row { transition: transform .2s var(--ease), border-color .2s var(--ease); }
.task-row:hover { transform: translateX(3px); border-color: var(--border-2); }

/* Ícones de topo reagem em cor */
.icon-btn:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 34%, var(--border)); background: var(--primary-soft); }

/* ------------------------------------------------------------- FOTOS com vida */
.cphoto img, .rec-ic.media img, .nota-rec .rec-ic.media img { transition: transform .45s var(--ease-out); }
.rec:hover .cphoto img, .rec:hover .rec-ic.media img { transform: scale(1.07); }
.cphoto { box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.photo-thumb img { transition: transform .4s var(--ease-out); }
.photo-up:hover .photo-thumb img { transform: scale(1.05); }

/* ----------------------------------------------------------- CHIPS e BADGES */
.chip.on { background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--accent) 12%, transparent)); }
.badge.accent { background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent) 20%, transparent)); }

/* ------------------------------------------------------ GRÁFICOS que crescem */
@keyframes growUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bars .bar {
  transform-origin: bottom; animation: growUp .85s var(--ease-out) backwards;
  box-shadow: 0 0 16px -3px color-mix(in srgb, var(--primary) 42%, transparent);
}
.bars .bar-col:nth-child(1) .bar { animation-delay: .03s; }
.bars .bar-col:nth-child(2) .bar { animation-delay: .09s; }
.bars .bar-col:nth-child(3) .bar { animation-delay: .15s; }
.bars .bar-col:nth-child(4) .bar { animation-delay: .21s; }
.bars .bar-col:nth-child(5) .bar { animation-delay: .27s; }
.bars .bar-col:nth-child(6) .bar { animation-delay: .33s; }
.bars .bar-col:nth-child(7) .bar { animation-delay: .39s; }
.bars .bar-col:nth-child(8) .bar { animation-delay: .45s; }
.bars .bar-col:nth-child(9) .bar { animation-delay: .51s; }
.bars .bar-col:nth-child(n+10) .bar { animation-delay: .57s; }

/* --------------------------------------------- ENTRADA orquestrada (cascata) */
.stats .stat { animation: pop .5s var(--ease-out) backwards; }
.stats .stat:nth-child(2) { animation-delay: .06s; }
.stats .stat:nth-child(3) { animation-delay: .12s; }
.stats .stat:nth-child(4) { animation-delay: .18s; }
.dash-grid .panel { animation: viewIn .55s var(--ease-out) backwards; }
.dash-grid .panel:nth-child(2) { animation-delay: .06s; }
.dash-grid .panel:nth-child(3) { animation-delay: .12s; }
.dash-grid .panel:nth-child(4) { animation-delay: .18s; }
.dash-grid .panel:nth-child(5) { animation-delay: .24s; }
.dash-grid .panel:nth-child(n+6) { animation-delay: .30s; }

.list-body .rec:nth-child(1) { animation-delay: .02s; }
.list-body .rec:nth-child(2) { animation-delay: .05s; }
.list-body .rec:nth-child(3) { animation-delay: .08s; }
.list-body .rec:nth-child(4) { animation-delay: .11s; }
.list-body .rec:nth-child(5) { animation-delay: .14s; }
.list-body .rec:nth-child(6) { animation-delay: .17s; }
.list-body .rec:nth-child(7) { animation-delay: .20s; }
.list-body .rec:nth-child(n+8) { animation-delay: .23s; }

/* --------------------------------------------------------- Vidro nos overlays */
.overlay { background: color-mix(in srgb, var(--bg) 55%, rgba(0,0,0,.55)); backdrop-filter: blur(7px); }
.modal { box-shadow: 0 30px 80px -20px rgba(0,0,0,.6), 0 0 0 1px var(--border); }
.toast { backdrop-filter: blur(10px); background: color-mix(in srgb, var(--surface) 88%, transparent); }
.empty .e-ic { background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--accent) 8%, transparent)); color: var(--primary); }

/* Realce de foco mais suave e visível */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; box-shadow: 0 0 0 5px var(--primary-soft); }

/* ==========================================================================
   MOBILE NATIVE — navegação inferior, FAB, folhas deslizantes, cor por secção
   Prioridade ao telemóvel (estilo aplicação Android). Vence por cascata.
   ========================================================================== */

/* Cor da secção ativa aplicada a destaques (definida em navigate) */
.sec-head .sh-ic, .modal-head .m-ic {
  background: linear-gradient(135deg, color-mix(in srgb, var(--acc) 26%, var(--surface)), color-mix(in srgb, var(--acc) 12%, var(--surface)));
  color: var(--acc);
}
.list-tools .search input:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--acc) 18%, transparent);
}
.chip.on {
  background: color-mix(in srgb, var(--acc) 16%, transparent);
  color: var(--acc);
  border-color: color-mix(in srgb, var(--acc) 40%, transparent);
}

/* Nav lateral (desktop) colorida por secção */
.nav-item.active {
  background: color-mix(in srgb, var(--ci) 15%, transparent);
  color: var(--ci);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ci) 22%, transparent);
}
.nav-item.active::before { background: var(--ci); box-shadow: 0 0 12px color-mix(in srgb, var(--ci) 55%, transparent); }
.nav-item.active .count { background: var(--ci); }

/* Barra de topo: leve realce da cor da secção ativa na base */
.topbar { border-bottom-color: color-mix(in srgb, var(--acc) 22%, var(--border)); }
.tb-logo { display: grid; width: 48px; height: 48px; flex-shrink: 0; }
.tb-logo svg { width: 100%; height: 100%; display: block; }
.tb-logout { display: none; }

/* Ícones dentro de badges */
.badge svg { width: 13px; height: 13px; }
.badge.i::before { display: none; }
.badge.i { gap: 4px; }

/* Herói do painel (saudação) */
.hero {
  display: flex; align-items: center; gap: 16px; margin-bottom: 22px;
  padding: 20px 22px; border-radius: var(--r-lg); position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--acc) 92%, #000), color-mix(in srgb, var(--acc) 58%, #000));
  color: #fff; box-shadow: 0 14px 32px -14px color-mix(in srgb, var(--acc) 70%, transparent);
  animation: pop .5s var(--ease-out);
}
.hero-hi { font-size: .8rem; font-weight: 700; opacity: .92; letter-spacing: .02em; }
.hero h2 { font-size: 1.32rem; margin-top: 3px; color: #fff; }
.hero-ic { width: 74px; height: 74px; margin-left: auto; opacity: .95; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(0,0,0,.28)); }
.hero-ic svg { width: 100%; height: 100%; }
.hero::after { content: ""; position: absolute; right: -34px; top: -34px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.12); }

/* Navegação inferior (oculta em desktop) */
.bottomnav { display: none; }
.fab {
  display: grid; place-items: center; position: fixed; right: 26px; bottom: 26px; z-index: 44;
  width: 58px; height: 58px; border-radius: 19px; color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--acc) 86%, #fff), var(--acc));
  box-shadow: 0 12px 26px -6px color-mix(in srgb, var(--acc) 70%, transparent), 0 4px 12px rgba(0,0,0,.22);
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease);
}
.fab svg { width: 26px; height: 26px; }
.fab:hover { transform: translateY(-2px); }
.fab:active { transform: scale(.9); }

/* ---------------------------------------------------- TELEMÓVEL / TABLET ---- */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .tb-logo { display: grid; }
  .tb-logout { display: grid; }
  .content { padding: 16px 14px calc(112px + env(safe-area-inset-bottom)); max-width: 720px; margin-inline: auto; }

  /* Barra de navegação inferior — flutuante, com cantos arredondados */
  .bottomnav {
    display: flex; position: fixed;
    left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 45;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 7px 4px;
    box-shadow: 0 12px 30px -10px rgba(0,0,0,.35);
  }
  .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 4px 2px; color: var(--text-mute); border-radius: 14px; min-width: 0;
    transition: color .2s var(--ease);
  }
  .bn-ic {
    width: 44px; height: 28px; display: grid; place-items: center; border-radius: 20px;
    transition: background .25s var(--ease), transform .2s var(--ease-out);
  }
  .bn-ic svg { width: 22px; height: 22px; }
  .bn-l { font-size: .63rem; font-weight: 700; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .bn-item.active { color: var(--ci); }
  .bn-item.active .bn-ic { background: color-mix(in srgb, var(--ci) 22%, transparent); }
  .bn-item:active .bn-ic { transform: scale(.88); }

  /* Botão de ação flutuante — acima da barra inferior */
  .fab { right: max(18px, env(safe-area-inset-right)); bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* --------------------------------------------------------- ECRÃS PEQUENOS ---- */
@media (max-width: 560px) {
  .topbar { padding: 12px 16px; gap: 12px; }
  .tb-brand .tb-name { font-size: 1.02rem; }
  .content { padding-left: 13px; padding-right: 13px; }
  .hero { padding: 18px 18px; }
  .hero h2 { font-size: 1.2rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 16px; }
  .list-tools .search { min-width: 150px; }

  /* Alvos de toque maiores */
  .field input, .field select, .field textarea, .input { padding: 13px 15px; border-radius: 13px; }
  .search input { padding-top: 13px; padding-bottom: 13px; border-radius: 14px; }
  .btn { padding: 13px 18px; }

  /* Cartões: ações passam para baixo, em linha cheia (mais fáceis de tocar) */
  .rec { flex-wrap: wrap; padding: 14px; border-radius: 16px; }
  .rec .rec-actions {
    flex-direction: row; width: 100%; justify-content: flex-end; gap: 4px;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
  }
  .rec .rec-actions .icon-btn { width: 40px; height: 40px; }
  .estado-sel { flex: 1; }
  .rec-trail {
    width: 100%; justify-content: space-between; margin-top: 8px;
    padding-top: 8px; border-top: 1px solid var(--border);
  }
  /* A .rec-trail já é a barra de rodapé — as ações lá dentro ficam compactas, não voltam a ocupar 100% */
  .rec-trail .rec-actions {
    width: auto; margin-top: 0; padding-top: 0; border-top: 0; justify-content: flex-end;
  }

  /* Formulário em FOLHA DESLIZANTE (bottom sheet) */
  .overlay { place-items: end center; padding: 0; }
  .modal {
    max-width: 100%; width: 100%; max-height: 92dvh;
    border-radius: 22px 22px 0 0; transform: translateY(100%);
  }
  .overlay.show .modal { transform: none; }
  .modal-head { border-radius: 22px 22px 0 0; padding-top: 24px; }
  .modal-head::before {
    content: ""; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
    width: 42px; height: 4px; border-radius: 3px; background: var(--border-2);
  }
  .modal-foot { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .confirm-box { border-radius: 22px 22px 0 0; max-width: 100%; }
  .toasts { bottom: calc(90px + env(safe-area-inset-bottom)); right: 12px; left: 12px; }
  .toast { min-width: 0; width: 100%; }
}

/* --------------------------------------------------- ECRÃS MUITO PEQUENOS ---- */
@media (max-width: 380px) {
  .tb-brand .tb-name { font-size: .92rem; max-width: 34vw; }
  .tb-logo { width: 42px; height: 42px; }
  .topbar .icon-btn { width: 32px; height: 32px; }
  .tb-icons { gap: 5px; }
  .hero { gap: 10px; padding: 16px; }
  .hero-ic { width: 54px; height: 54px; }
  .hero h2 { font-size: 1.06rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 12px; }
  .stat .num { font-size: 1.45rem; }
  .casal-photos { gap: 5px; }
  .cphoto { width: 42px; height: 42px; border-radius: 11px; }
  .more-list { grid-template-columns: 1fr; }
  .bn-l { font-size: .58rem; }
  .fab { width: 52px; height: 52px; }
}

/* Barra de estado (status bar) do telemóvel acompanha o fundo */
@supports (padding: max(0px)) {
  .topbar { margin-top: max(10px, env(safe-area-inset-top)); }
}

/* ==========================================================================
   TOPBAR — ícones mais pequenos + sino de notificações + definições
   ========================================================================== */
.tb-icons { display: flex; align-items: center; gap: 8px; position: relative; }
.topbar .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
.topbar .icon-btn svg { width: 17px; height: 17px; }

.bell-wrap { position: relative; }
.tb-icons [data-bell] { position: relative; }
.bell-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .64rem; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg); line-height: 1;
}

.notif-panel {
  position: fixed; width: 320px; max-width: calc(100vw - 24px);
  max-height: min(70vh, 480px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 14px; z-index: 90; animation: pop .22s var(--ease-out);
}
.notif-head { font-weight: 700; font-size: .92rem; margin-bottom: 10px; }
.notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.notif-item:first-of-type { border-top: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: .87rem; font-weight: 600; }
.notif-date { font-size: .76rem; color: var(--text-mute); margin-top: 2px; }
.notif-date.late { color: var(--danger); font-weight: 600; }

/* ==========================================================================
   MENU "MAIS" (modal com os módulos secundários)
   ========================================================================== */
.more-menu { max-width: 380px; }
.more-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 20px 22px; }
.more-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 10px; border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: .86rem;
  transition: all .2s var(--ease);
}
.more-ic {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--ci, var(--primary)) 18%, transparent); color: var(--ci, var(--primary));
}
.more-ic svg { width: 20px; height: 20px; }
.more-item:hover { border-color: color-mix(in srgb, var(--ci, var(--primary)) 40%, var(--border)); transform: translateY(-2px); }

/* ==========================================================================
   LEMBRETES E TAREFAS
   ========================================================================== */
input.lembrete-check { width: 21px; height: 21px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; margin-top: 2px; }
.lembrete-rec.done .rec-title { text-decoration: line-through; color: var(--text-mute); }
.check-inline { display: flex; align-items: center; gap: 9px; font-size: .9rem; cursor: pointer; padding-top: 6px; }
.check-inline input { width: 19px; height: 19px; accent-color: var(--primary); cursor: pointer; }

/* ==========================================================================
   DEFINIÇÕES
   ========================================================================== */
.settings-panel { margin-bottom: 18px; max-width: 560px; }
.settings-panel .form-grid { margin-bottom: 4px; }
.settings-panel p.fhelp { margin: -6px 0 4px; }

/* ==========================================================================
   INSTALAR APLICAÇÃO
   ========================================================================== */
.install-btn { margin-top: 18px; }
.install-btn:disabled { opacity: .5; cursor: default; transform: none; }

