* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: #1e293b;
  background: #f7f6f4;
}

/* ── Layout ── */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 210px;
  background: #090909;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.logo-area {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-area img {
  width: 140px;
  opacity: 0.95;
}

.sidebar nav {
  flex: 1;
  padding: 8px 10px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.01em;
  transition: all 0.15s;
}

.sidebar nav a:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.75);
}

.sidebar nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.sidebar nav a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.user-area {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-email {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 8px;
  word-break: break-all;
}

.btn-signout {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.45);
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
}

.btn-signout:hover {
  border-color: rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.7);
}

/* ── Main content ── */
.main {
  flex: 1;
  overflow-y: auto;
  background: #f7f6f4;
}

.page {
  padding: 28px 32px;
  max-width: 1100px;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header-left h1 {
  font-size: 18px;
  font-weight: 500;
  color: #0f172a;
}

.page-header-left p {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #090909;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.btn-primary:hover {
  background: #2a2a2a;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #f9fafb;
}

.btn-danger {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
}

.btn-danger:hover { text-decoration: underline; }

.btn-edit {
  background: none;
  border: none;
  color: #585858;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
}

.btn-edit:hover { text-decoration: underline; }

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e8e6e1;
  border-radius: 10px;
  padding: 16px 18px;
}

.stat-label {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 24px;
  font-weight: 500;
  color: #0f172a;
}

.stat-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

/* ── Card / Table ── */
.card {
  background: #fff;
  border: 1px solid #e8e6e1;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f0ed;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

thead th {
  padding: 10px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  background: #faf9f8;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 1px solid #f1f0ed;
}

tbody td {
  padding: 11px 20px;
  font-size: 13px;
  color: #374151;
  border-bottom: 1px solid #f7f6f4;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #faf9f8; }

/* ── Search ── */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-bar input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 13px;
  outline: none;
  background: #fff;
}

.search-bar input:focus {
  border-color: #090909;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}

.modal h2 {
  font-size: 16px;
  font-weight: 500;
  color: #0f172a;
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .full { grid-column: 1 / -1; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}

.field input,
.field select,
.field textarea {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  background: #fff;
  color: #1e293b;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #090909;
}

.field textarea { resize: vertical; min-height: 72px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* ── Finance specific ── */
.valor-positivo { color: #16a34a; font-weight: 500; }
.valor-negativo { color: #dc2626; font-weight: 500; }

/* ── Agenda specific ── */
.agenda-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.evento-card {
  background: #fff;
  border: 1px solid #e8e6e1;
  border-radius: 10px;
  padding: 14px 16px;
}

.evento-data {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 5px;
}

.evento-titulo {
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  margin-bottom: 4px;
}

.evento-detalhe {
  font-size: 11px;
  color: #94a3b8;
}

/* ── Login ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f6f4;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  border: 1px solid #e8e6e1;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img {
  width: 200px;
  margin-bottom: 10px;
}

.login-logo p {
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-btn {
  width: 100%;
  padding: 11px;
  background: #090909;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.login-btn:hover { background: #2a2a2a; }

.login-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #585858;
  font-size: 13px;
  cursor: pointer;
  margin-top: 12px;
  text-align: center;
  text-decoration: underline;
}

.error-msg {
  color: #dc2626;
  font-size: 12px;
  text-align: center;
  margin-bottom: 10px;
}

.success-msg {
  color: #16a34a;
  font-size: 13px;
  text-align: center;
  padding: 12px 0;
}

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-size: 13px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #090909;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}
