/* ===== Tokens ===== */
:root {
  --brand: #0f766e;
  --brand-600: #0d6b64;
  --brand-700: #115e59;
  --brand-50: #e6f4f2;
  --sidebar-bg: #0f3d3e;
  --sidebar-w: 264px;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #e3e8ee;
  --text: #1f2933;
  --muted: #667085;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);

  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: #0f766e;
  --bs-link-color-rgb: 15, 118, 110;
  --bs-link-hover-color: #115e59;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-border-radius: 8px;
  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html { font-size: 15px; }
body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }

.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700);
  --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: 15, 118, 110;
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
  --bs-btn-focus-shadow-rgb: 15, 118, 110;
}
.btn { font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .18);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .3rem; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.icon { flex-shrink: 0; vertical-align: -3px; }

/* ===== App shell ===== */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 1.25rem 1rem 2.5rem; width: 100%; max-width: 1400px; margin: 0 auto; }
.content-narrow { max-width: 720px; }
@media (min-width: 992px) { .content { padding: 2rem 2.25rem 3rem; } }

/* ===== Sidebar ===== */
.sidebar {
  --bs-offcanvas-width: 284px;
  --bs-offcanvas-bg: var(--sidebar-bg);
  --bs-offcanvas-color: #cfe3e1;
  background: var(--sidebar-bg) !important; color: #cfe3e1;
  display: flex; flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.1rem .6rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: .2px; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 12px; }
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: .4rem .75rem 1rem; }
.nav-group { text-transform: uppercase; font-size: .68rem; letter-spacing: .09em; color: #7fa7a4; padding: 1rem .65rem .35rem; font-weight: 600; }
.nav-item-link {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; margin-bottom: 2px;
  color: #cfe3e1; border-radius: 9px; font-weight: 500; font-size: .94rem; position: relative;
}
.nav-item-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item-link.active { background: rgba(20, 184, 166, .18); color: #fff; }
.nav-item-link.active::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #2dd4bf; }
.nav-badge { margin-left: auto; background: #f59e0b; color: #1f2933; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .08rem .5rem; }
.sidebar-user { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border-top: 1px solid rgba(255, 255, 255, .1); }
.sidebar-user form { margin: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #14b8a6; color: #06302e; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.who { min-width: 0; flex: 1; }
.who .name { color: #fff; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .role { font-size: .75rem; color: #86b3af; }
.icon-btn { background: transparent; border: 0; color: inherit; padding: .4rem; border-radius: 8px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(255, 255, 255, .1); }
.sidebar .icon-btn { color: #cfe3e1; }

@media (min-width: 992px) {
  .sidebar { flex: 0 0 var(--sidebar-w); width: var(--sidebar-w); position: sticky; top: 0; height: 100vh; height: 100dvh; }
}

/* ===== Topbar (mobile) ===== */
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem; height: 56px; padding: 0 .75rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .icon-btn { color: var(--text); }
.topbar .icon-btn:hover { background: var(--bg); }
.topbar-title { font-weight: 700; color: var(--text); }
.topbar-title:hover { text-decoration: none; }

/* ===== Page header / cards ===== */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-header .sub { color: var(--muted); font-size: .9rem; margin: .15rem 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-weight: 600; padding: .85rem 1.1rem; }
.card-body { padding: 1.1rem; }
.form-card { max-width: 720px; }

.stat { display: flex; align-items: center; gap: .9rem; }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex-shrink: 0; }
.stat .ico.amber { background: #fef3c7; color: #b45309; }
.stat .ico.red { background: #fee2e2; color: #b91c1c; }
.stat .ico.blue { background: #e0ecff; color: #1d4ed8; }
.stat .label { color: var(--muted); font-size: .8rem; }
.stat .value { font-size: 1.5rem; font-weight: 700; line-height: 1.15; }

/* ===== Tables ===== */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #f9fafb; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table > tbody td { vertical-align: middle; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f7fafa; }
.card > .table-responsive > .table > :last-child > tr:last-child > * { border-bottom: 0; }
.card > .table-responsive { border-radius: var(--radius); }
.empty { text-align: center; color: var(--muted); padding: 2.25rem 1rem; }
.empty .icon { opacity: .5; margin-bottom: .5rem; }

/* ===== Badges de status ===== */
.badge-status { display: inline-block; font-size: .74rem; font-weight: 600; padding: .22rem .6rem; border-radius: 999px; background: #eef2f6; color: #475467; white-space: nowrap; }
.s-agendado { background: #e0ecff; color: #1d4ed8; }
.s-confirmado { background: #d1fae5; color: #047857; }
.s-realizado { background: #e5e7eb; color: #374151; }
.s-faltou { background: #fee2e2; color: #b91c1c; }
.s-cancelado { background: #f3f4f6; color: #6b7280; text-decoration: line-through; }
.p-pendente { background: #fef3c7; color: #b45309; }
.p-pago { background: #d1fae5; color: #047857; }
.p-isento { background: #e5e7eb; color: #374151; }

/* ===== Calendário ===== */
.fc { --fc-border-color: var(--border); --fc-button-bg-color: var(--brand); --fc-button-border-color: var(--brand);
  --fc-button-hover-bg-color: var(--brand-700); --fc-button-hover-border-color: var(--brand-700);
  --fc-button-active-bg-color: var(--brand-700); --fc-button-active-border-color: var(--brand-700);
  --fc-today-bg-color: #ecf8f6; --fc-event-border-color: transparent; }
.fc .fc-toolbar-title { font-size: 1.15rem; }
@media (max-width: 575.98px) {
  .fc .fc-toolbar { flex-direction: column; gap: .5rem; }
  .fc .fc-toolbar-title { font-size: 1rem; }
}

/* ===== Chat (WhatsApp) ===== */
.chat { max-height: 62vh; max-height: 62dvh; overflow-y: auto; padding: 1rem; background: #efeae2; border-radius: var(--radius); }
.bubble-row { display: flex; margin-bottom: .5rem; }
.bubble-row.out { justify-content: flex-end; }
.bubble { max-width: min(78%, 560px); padding: .5rem .75rem; border-radius: 12px; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); background: #fff; }
.bubble.out { background: #d9fdd3; }
.bubble .time { font-size: .7rem; color: var(--muted); text-align: right; margin-top: .15rem; }

/* ===== Login ===== */
.auth-body { background: linear-gradient(160deg, #0f3d3e 0%, #0f766e 55%, #14b8a6 100%); min-height: 100vh; min-height: 100dvh; }
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 2rem 1.75rem; box-shadow: 0 20px 45px rgba(0, 0, 0, .25); }
.auth-brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.4rem; margin-bottom: 1.4rem; }
.auth-foot { color: rgba(255, 255, 255, .75); font-size: .8rem; margin-top: 1.25rem; }

/* ===== Ajustes mobile ===== */
@media (max-width: 575.98px) {
  html { font-size: 14.5px; }
  .page-header h1 { font-size: 1.3rem; }
  .page-actions, .page-actions .btn { width: 100%; }
  .btn-stack-sm > .btn { width: 100%; }
}
.text-nowrap-cell { white-space: nowrap; }

@media (max-width: 575.98px) {
  .stat { gap: .65rem; }
  .stat .ico { width: 38px; height: 38px; border-radius: 10px; }
  .stat .value { font-size: 1.2rem; }
  .card-body { padding: .9rem; }
}
