/* ============================================
   Admin SaaS - tema verde e branco
   ============================================ */
:root {
  --verde-950: #052e16;
  --verde-900: #14532d;
  --verde-800: #166534;
  --verde-700: #15803d;
  --verde-600: #16a34a;
  --verde-500: #22c55e;
  --verde-400: #4ade80;
  --verde-100: #dcfce7;
  --verde-50: #f0fdf4;

  --bg: #f5f8f5;
  --surface: #ffffff;
  --border: #e5ece7;
  --border-strong: #d3ddd6;

  --text: #16241b;
  --text-2: #5b6b60;
  --text-3: #8a9990;

  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --info: #2563eb;
  --info-bg: #dbeafe;

  --shadow-sm: 0 1px 2px rgba(16, 45, 28, .06);
  --shadow-md: 0 4px 14px rgba(16, 45, 28, .08);
  --shadow-lg: 0 18px 40px rgba(16, 45, 28, .16);

  --radius: 14px;
  --radius-sm: 9px;

  --sidebar-w: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
.hidden { display: none !important; }

/* ================= LOGIN ================= */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(34, 197, 94, .25), transparent 60%),
    radial-gradient(1000px 500px at 110% 110%, rgba(22, 163, 74, .2), transparent 60%),
    linear-gradient(160deg, #06301c, #0b4426 55%, #0e5a32);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--verde-100); font-size: 28px; margin-bottom: 12px;
}
.login-logo h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.login-logo p { color: var(--text-2); font-size: .9rem; margin-top: 4px; }
.form-erro { color: var(--danger); font-size: .85rem; margin-top: 12px; text-align: center; min-height: 18px; }

/* ================= LAYOUT ================= */
.btn-menu {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--verde-700); color: #fff; border: none;
  font-size: 1.4rem; cursor: pointer; display: none;
  align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
}
@media (max-width: 860px) {
  .btn-menu { display: flex; }
}

.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0b3d22, #0a3420);
  color: #cfe8d6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

/* Overlay escuro por trás do menu lateral */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 98;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.sidebar-overlay.visivel { opacity: 1; pointer-events: auto; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 260px;
    z-index: 99;
    transition: left .25s ease;
    height: 100vh;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .25);
  }
  .sidebar.aberta { left: 0; }
  .main-content { padding-top: 60px; }
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo-icon { font-size: 24px; }
.sidebar-logo-text { font-weight: 800; color: #fff; font-size: 1.05rem; letter-spacing: -.01em; }
.sidebar-logo-text small { display: block; font-weight: 500; font-size: .68rem; color: #8fc9a2; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: transparent; border: none; cursor: pointer;
  color: #b7d8c2; font: inherit; font-size: .92rem; font-weight: 500;
  padding: 11px 12px; border-radius: 10px;
  transition: background .15s, color .15s;
}
a.nav-btn { text-decoration: none; }
.nav-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-btn.ativo {
  background: rgba(74, 222, 128, .14);
  color: #fff; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(74,222,128,.25);
}
.nav-icon { font-size: 1.05rem; width: 22px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.btn-logout {
  width: 100%; background: rgba(255,255,255,.06); color: #d7efe0;
  border: 1px solid rgba(255,255,255,.12); padding: 10px; border-radius: 10px;
  cursor: pointer; font: inherit; font-size: .9rem;
}
.btn-logout:hover { background: rgba(255,255,255,.12); }

.main-content { flex: 1; padding: 30px 36px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* ================= PAGE HEADER ================= */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.page-subtitle { color: var(--text-2); font-size: .9rem; margin-top: 2px; }

/* ================= STATS ================= */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--accent, var(--verde-600));
}
.stat-card .stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.stat-card .stat-sub { font-size: .8rem; color: var(--text-2); margin-top: 4px; }

.cards-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 16px; }
.big-number { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 2px; }
.text-muted { color: var(--text-3); font-size: .82rem; }

/* ================= CARDS ================= */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 10px; }
.config-card { max-width: 760px; }

/* ================= TABLE ================= */
.table-wrapper {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}
.data-table th, .data-table td {
  text-align: left; padding: 13px 16px; font-size: .88rem;
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
.data-table th:last-child,
.data-table td:last-child {
  white-space: nowrap;
}
.data-table th {
  background: var(--verde-50); color: var(--verde-800);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f7faf7; }
.data-table small { color: var(--text-3); }
.data-table a { color: var(--verde-700); text-decoration: none; font-weight: 500; }
.data-table a:hover { text-decoration: underline; }

/* ================= BADGES ================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600;
  white-space: nowrap;
}
.badge.green { background: var(--verde-100); color: var(--verde-800); }
.badge.red { background: var(--danger-bg); color: #991b1b; }
.badge.yellow { background: var(--warn-bg); color: #92400e; }
.badge.blue { background: var(--info-bg); color: #1e40af; }
.badge.gray { background: #eef1ee; color: var(--text-2); }

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; border-radius: 10px; padding: 10px 16px;
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: filter .12s, transform .05s;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--verde-600); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface); color: var(--verde-800); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--verde-50); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ================= FORMS ================= */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: .8rem; font-weight: 600; color: var(--text-2);
  margin-bottom: 6px;
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  font: inherit; font-size: .92rem; background: var(--surface); color: var(--text);
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--verde-600);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .14);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 0 18px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

/* ================= PLANOS ================= */
.planos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; margin-top: 8px; }
.plano-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; background: var(--verde-50);
}
.plano-card h4 { color: var(--verde-800); margin-bottom: 10px; font-size: .95rem; }

/* ================= TOGGLE (recursos) ================= */
.recurso-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px; border-bottom: 1px solid var(--border);
}
.recurso-row:last-child { border-bottom: none; }
.recurso-info strong { display: block; font-size: .92rem; }
.recurso-info small { color: var(--text-3); font-size: .8rem; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5cd; border-radius: 999px; transition: .2s;
}
.switch .slider::before {
  content: ''; position: absolute; height: 20px; width: 20px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--verde-600); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ================= MODAL ================= */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 30, 18, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px; backdrop-filter: blur(2px);
}
.modal-content {
  background: var(--surface); border-radius: 18px; width: 100%;
  max-width: 560px; max-height: 88vh; overflow-y: auto;
  padding: 26px; position: relative; box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; font-size: 1.6rem; cursor: pointer;
  color: var(--text-3); line-height: 1;
}
.modal-content h3 { margin-bottom: 16px; font-size: 1.1rem; }

/* ================= TOAST ================= */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--verde-900); color: #fff; padding: 13px 22px;
  border-radius: 999px; font-size: .9rem; font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 200;
  animation: rise .2s ease;
}
#toast.erro { background: var(--danger); }
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ================= RESPONSIVE ================= */
@media (max-width: 860px) {
  .main-content { padding: 76px 16px 20px; }

  .page-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-left: 44px;
    padding-right: 44px;
    gap: 10px;
  }

  .page-header h1 { width: 100%; }
  .page-subtitle { margin-top: 4px; }
  .page-header .btn { margin-top: 2px; }
}
