@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/inter-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url('/fonts/manrope-latin-800.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --color-bg: #FAFAF9;
  --color-surface: #FFFFFF;
  --color-subtle-bg: #F5F5F4;
  --color-border: #E7E5E4;
  --color-text: #1C1917;
  --color-muted: #78716C;
  --color-muted-2: #A8A29E;
  --color-primary: #B91C1C;
  --color-primary-hover: #9F1717;
  --color-primary-soft-bg: #FEE2E2;
  --color-danger-bg: #FEE2E2;
  --color-danger-fg: #DC2626;
  --color-success-bg: #DCFCE7;
  --color-success-fg: #16803B;
  --color-success-icon: #16A34A;
  --color-warning-bg: #FEF3C7;
  --color-warning-fg: #B45309;
  --color-neutral-bg: #F5F5F4;
  --color-neutral-fg: #78716C;
  --color-info-bg: #EFF6FF;
  --color-info-fg: #1D4ED8;
  --font-heading: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;
  --shadow-card: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-modal: 0 24px 48px rgba(28, 25, 23, 0.18);
  --shadow-fab: 0 8px 24px rgba(185, 28, 28, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); text-decoration: underline; }
::selection { background: var(--color-danger-bg); color: #7C2323; }

h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; margin: 0; color: var(--color-text); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }

/* ---------- App shell / sidebar ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 272px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  box-sizing: border-box;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 28px 10px;
}

.sidebar-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-mark-inner {
  width: 12px;
  height: 12px;
  background: var(--color-bg);
  transform: rotate(45deg);
  border-radius: 2px;
}

.sidebar-brand-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.sidebar-brand-sub {
  font-size: 11.5px;
  color: var(--color-muted);
}

.sidebar-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.sidebar-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-muted-2);
  text-transform: uppercase;
  padding: 0 12px 8px 12px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--color-muted);
  font-weight: 500;
  text-decoration: none;
}

.sidebar-nav a svg { flex-shrink: 0; }
.sidebar-nav a:hover { background: var(--color-subtle-bg); color: var(--color-text); text-decoration: none; }

.sidebar-nav a.active {
  background: var(--color-primary-soft-bg);
  color: var(--color-primary);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.sidebar-profile {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 10px;
  margin-top: 0;
  height: auto;
  border-radius: 10px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 400;
  text-align: left;
}

.sidebar-profile:hover { background: var(--color-subtle-bg); }

.sidebar-profile-text { flex: 1; min-width: 0; }
.sidebar-profile-name { font-size: 13px; font-weight: 600; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile-role { font-size: 11.5px; color: var(--color-muted); }

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px 64px 48px;
  box-sizing: border-box;
  min-width: 0;
  position: relative;
}

.main-content h1 { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; }

.page-subtitle { color: var(--color-muted); font-size: 15px; margin-top: 6px; }

/* ---------- Avatars ---------- */

.avatar {
  border-radius: 50%;
  background: var(--color-subtle-bg);
  color: #57534E;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 36px; height: 36px; font-size: 12.5px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

/* ---------- Auth page ---------- */

.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--color-bg);
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-card);
}

.auth-card h1 { font-size: 22px; }
.auth-subtitle { color: var(--color-muted); margin-top: 8px; font-size: 13px; }

/* ---------- Forms ---------- */

form label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
}

form input, form select, form textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  font-size: 14.5px;
  font-family: inherit;
}

form textarea { height: auto; padding: 10px 14px; resize: vertical; }

form input[type="checkbox"], form input[type="radio"] {
  width: auto;
  height: auto;
  accent-color: var(--color-primary);
}

form input::placeholder, form textarea::placeholder { color: var(--color-muted-2); }

form button, .btn {
  margin-top: 16px;
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

form button:hover, .btn:hover { background: var(--color-primary-hover); }

form button:disabled {
  background: var(--color-border);
  color: var(--color-muted-2);
  cursor: not-allowed;
}

fieldset {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  margin-bottom: 16px;
  padding: 20px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

fieldset legend { padding: 0 8px; font-weight: 700; font-family: var(--font-heading); }
fieldset legend small { font-weight: 400; color: var(--color-muted); font-family: var(--font-body); }

.idade-preview { font-weight: 400; color: var(--color-muted); font-size: 12px; }

/* ---------- Alerts ---------- */

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error { background: var(--color-danger-bg); color: var(--color-danger-fg); }
.alert-success { background: var(--color-success-bg); color: var(--color-success-fg); }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.alert ul { margin: 0; padding-left: 18px; }

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  font-size: 14.5px;
  box-shadow: var(--shadow-card);
}

th, td {
  text-align: left;
  padding: 15px 24px;
  border-bottom: 1px solid var(--color-subtle-bg);
}

th {
  font-size: 12px;
  color: var(--color-muted-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}

tbody tr:hover { background: var(--color-bg); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Badges (mensalidade status) ---------- */

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pago { background: var(--color-success-bg); color: var(--color-success-fg); }
.badge-faturado { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.badge-em_atraso { background: var(--color-danger-bg); color: var(--color-danger-fg); }
.badge-isento { background: var(--color-neutral-bg); color: var(--color-neutral-fg); }

/* ---------- Belt (faixa) badges ---------- */

.faixa-branca { background: #F5F5F4; color: #57534E; }
.faixa-amarela { background: #FEF9C3; color: #854D0E; }
.faixa-laranja { background: #FFEDD5; color: #9A3412; }
.faixa-verde { background: #DCFCE7; color: #166534; }
.faixa-roxa { background: #F3E8FF; color: #6B21A8; }
.faixa-castanha { background: #FDE8D7; color: #7C3E13; }
.faixa-preta { background: #1C1917; color: #FAFAF9; }

/* ---------- Layout helpers ---------- */

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

.actions { display: flex; gap: 10px; align-items: center; }

.filters-form {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filters-form input, .filters-form select { width: auto; margin: 0; }

.inline-form { display: inline; }

.inline-fields-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.inline-fields-form label { margin-top: 0; }
.inline-fields-form input, .inline-fields-form select { width: auto; }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover { background: var(--color-subtle-bg); }

.btn-link {
  background: none;
  border: none;
  color: var(--color-danger-fg);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  font-family: inherit;
  text-decoration: underline;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.card h2 { font-size: 18px; margin-bottom: 16px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.detail-grid dt { font-size: 12px; color: var(--color-muted-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.detail-grid dd { margin: 6px 0 0; font-size: 14.5px; }

.muted { color: var(--color-muted); font-size: 13px; }

.grid-scroll { overflow-x: auto; }
.grid-scroll table { min-width: 900px; }

.badge-select {
  width: auto;
  height: auto;
  border: none;
  border-radius: 20px;
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin: 0;
}

.badge-select.badge-pago { background: var(--color-success-bg); color: var(--color-success-fg); }
.badge-select.badge-faturado { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.badge-select.badge-em_atraso { background: var(--color-danger-bg); color: var(--color-danger-fg); }
.badge-select.badge-isento { background: var(--color-neutral-bg); color: var(--color-neutral-fg); }

/* ---------- Chip filters ---------- */

.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.chips-divider { width: 1px; align-self: stretch; background: var(--color-border); margin: 0 4px; }

.chip {
  padding: 9px 16px;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: #57534E;
  text-decoration: none;
  display: inline-block;
  transition: all 150ms;
}

.chip:hover { text-decoration: none; border-color: var(--color-muted-2); }

.chip.active {
  border-color: var(--color-primary);
  background: var(--color-danger-bg);
  color: var(--color-primary);
}

/* ---------- Search input with icon ---------- */

.search-wrap { position: relative; flex: 1; }
.search-wrap svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--color-muted-2); }
.search-wrap input { padding-left: 46px; }

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  right: 48px;
  bottom: 40px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-fab);
  transition: transform 200ms, background 200ms;
  border: none;
}

.fab:hover { transform: scale(1.06); background: var(--color-primary-hover); }

/* ---------- Segmented tabs ---------- */

.segmented {
  display: inline-flex;
  gap: 4px;
  background: var(--color-subtle-bg);
  padding: 4px;
  border-radius: 11px;
  margin-bottom: 20px;
}

.segmented a, .segmented button {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-muted);
  background: transparent;
  border: none;
  font-family: inherit;
  text-decoration: none;
}

.segmented a:hover, .segmented button:hover { text-decoration: none; }

.segmented a.active, .segmented button.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.08);
}

/* ---------- Modals ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 180ms ease;
}

.modal {
  background: var(--color-surface);
  border-radius: 16px;
  padding: 32px;
  width: 420px;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-modal);
  animation: scaleIn 180ms ease;
}

.modal h2 { font-size: 19px; margin-bottom: 20px; }

/* ---------- Empty state ---------- */

.empty-state {
  padding: 64px 24px;
  text-align: center;
}

.empty-state-title { font-family: var(--font-heading); font-size: 16px; font-weight: 700; }
.empty-state-sub { font-size: 14px; color: var(--color-muted); margin-top: 6px; }

/* ---------- Back link ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 20px;
  text-decoration: none;
}

.back-link:hover { text-decoration: none; color: var(--color-text); }

/* ---------- Calendar ---------- */

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.calendar-day {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px;
  min-height: 128px;
  box-shadow: var(--shadow-card);
}

.calendar-day h3 { font-size: 12px; color: var(--color-muted-2); margin: 0 0 10px; font-family: var(--font-body); font-weight: 600; }

.calendar-slot {
  background: var(--color-info-bg);
  color: var(--color-info-fg);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 6px;
  font-size: 12.5px;
}

.calendar-slot strong { color: inherit; }

.muted { color: var(--color-muted); font-size: 0.85rem; }

/* ---------- Dashboard stats ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 32px 0 24px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.stat-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-neutral { background: var(--color-subtle-bg); }
.stat-icon-danger { background: var(--color-danger-bg); }
.stat-icon-success { background: var(--color-success-bg); }

.stat-value { font-family: var(--font-heading); font-size: 32px; font-weight: 800; margin-top: 16px; }
.stat-value.danger { color: var(--color-danger-fg); }
.stat-label { color: var(--color-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-label a { color: inherit; }

/* ---------- Error pages ---------- */

.error-page { text-align: center; padding: 60px 20px; }
