:root {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #06b6d4;
  --background: #f4f7fb;
  --content-bg: #f9fbff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --border: #e2e8f0;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  color: var(--text);
}

.brand-accent {
  color: #22c55e;
}

.logo-light .brand-accent {
  color: #34d399;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 45%),
    radial-gradient(circle at bottom right, rgba(6, 182, 212, 0.15), transparent 40%),
    var(--background);
}

.sidebar {
  width: 250px;
  min-height: 100vh;
  background: linear-gradient(180deg, #1f2a44 0%, #18294a 70%, #12213b 100%);
  color: #e2e8f0;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.25);
  position: sticky;
  top: 0;
}

.sidebar .logo {
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
  color: #e2e8f0;
}

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

.sidebar nav a {
  color: rgba(226, 232, 240, 0.9);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 500;
  transition: background 0.2s, transform 0.2s;
}

.sidebar nav a:hover,
.sidebar nav a:focus-visible {
  background: rgba(148, 163, 184, 0.15);
  transform: translateX(4px);
}

.content-area {
  flex: 1;
  min-height: 100vh;
  padding: 48px 56px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(248,250,255,0.9));
  border-top-left-radius: 32px;
  border-bottom-left-radius: 32px;
  box-shadow: -20px 0 60px rgba(15, 23, 42, 0.15);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
  padding: 24px 28px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.7);
  box-shadow: 0 25px 55px rgba(15, 23, 42, 0.08);
}

.page-header h1 {
  font-size: 1.8rem;
  margin: 0 0 6px;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.btn,
.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}

.primary-btn,
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 12px 20px rgba(37, 99, 235, 0.25);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: #e2e8f0;
  transition: background 0.2s, border 0.2s, color 0.2s;
}

.btn-outline:hover {
  background: rgba(148, 163, 184, 0.12);
  border-color: var(--primary);
  color: #fff;
}

.sidebar .btn-outline {
  color: rgba(226, 232, 240, 0.98) !important;
  border-color: rgba(226, 232, 240, 0.45);
  background: rgba(255, 255, 255, 0.04);
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
}

.sidebar .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.75);
  color: #fff !important;
}

.sidebar form button {
  color: rgba(226, 232, 240, 0.98) !important;
  border-color: rgba(226, 232, 240, 0.45) !important;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-ghost-dark {
  color: #111827 !important;
  border-color: rgba(148, 163, 184, 0.6);
  background: rgba(255, 255, 255, 0.9);
}

.btn-ghost-dark:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary) !important;
  border-color: var(--primary);
}

/* Botões em tabelas: texto escuro sobre fundo claro */
.table-wrapper .btn-outline,
.table-wrapper .btn {
  color: #111827;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.table-wrapper .btn-outline:hover,
.table-wrapper .btn:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  border-color: var(--primary);
}

/* Preserve estilo dos botões de ação destrutiva */
.table-wrapper .btn-danger,
.table-wrapper .btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn:hover,
.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.15);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.09);
  border: 1px solid rgba(226, 232, 240, 0.7);
}

.card h3 {
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 10px;
}

.card p {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.table-wrapper {
  background: var(--card);
  border-radius: 24px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 35px 70px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: rgba(37, 99, 235, 0.08);
}

th, td {
  padding: 16px 18px;
  text-align: left;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

tr:not(:last-child) td {
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.actions {
  display: flex;
  gap: 8px;
}

.actions form {
  margin: 0;
  display: inline-flex;
}

form.card,
.form-card {
  background: var(--card);
  border-radius: 28px;
  padding: 36px;
  box-shadow: 0 35px 65px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 22px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 1rem;
  transition: border 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.badge {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge.pending {
  background: rgba(217, 119, 6, 0.15);
  color: var(--warning);
}

.badge.paid {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.badge.cancelled {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

/* Recorrências */
.badge.status-active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.badge.status-inactive {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

.badge.status-cancelled {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.badge.status-default {
  background: rgba(148, 163, 184, 0.18);
  color: var(--muted);
}

.test-card {
  border: 1px dashed rgba(148, 163, 184, 0.6);
  background: rgba(248, 250, 255, 0.8);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.test-card label {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.test-card input[type="checkbox"] {
  accent-color: var(--primary);
}

.test-card-header h3 {
  margin: 4px 0 0;
  font-size: 1.05rem;
  color: var(--text);
}

.test-card-header .overline {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.test-option {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background 0.2s, border 0.2s;
}

.test-option:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--primary);
}

.test-option label {
  cursor: pointer;
  margin: 0 !important;
  font-size: 0.95rem;
  font-weight: 500;
  user-select: none;
}

.test-option input[type="checkbox"] {
  margin: 0;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

.test-phone input {
  background: #fff;
}

.muted {
  color: var(--muted);
}

.card ul {
  list-style: none;
  padding-left: 0;
}

.card li {
  margin-bottom: 8px;
  color: var(--text);
}

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

.summary-pill {
  border-radius: 26px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(248,250,255,0.85));
  border: 1px solid rgba(226,232,240,0.6);
  box-shadow: 0 25px 45px rgba(15, 23, 42, 0.12);
}

.summary-pill span {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.summary-pill strong {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 960px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
  }

  .content-area {
    padding: 24px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    flex-direction: column;
  }
}
