/* ============ Corre AI — Painel Admin ============ */
:root {
  --primary: #1E88E5;
  --primary-dark: #1565C0;
  --accent: #FFC107;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --success: #16a34a;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
h1 { font-size: 1.5rem; margin-bottom: 1rem; }
h2 { font-size: 1.05rem; margin-bottom: .75rem; }
.hint { color: var(--muted); font-size: .85rem; margin-bottom: 1rem; }
.error { color: var(--danger); font-size: .85rem; margin-top: .5rem; min-height: 1em; }

/* ---------- Auth ---------- */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.auth-card { background: var(--card); padding: 2.5rem; border-radius: 16px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center; }
.auth-logo, .brand-logo { width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.2rem; margin: 0 auto .5rem; }
.auth-card h1 { font-size: 1.4rem; margin: 0; }
.auth-sub { color: var(--muted); font-size: .85rem; margin: .25rem 0 1.5rem; }
.auth-card form { text-align: left; }
.auth-card h2 { text-align: center; }

/* ---------- Forms ---------- */
label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .75rem; color: var(--text); }
input, select, textarea { width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; margin-top: .25rem; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.btn-primary { background: var(--primary); color: #fff; border: none; padding: .65rem 1.25rem; border-radius: 8px; font-size: .9rem; font-weight: 600; cursor: pointer; width: 100%; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border: 1px solid var(--border); padding: .5rem 1rem; border-radius: 8px; cursor: pointer; font-size: .85rem; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); }
.btn-small { padding: .3rem .6rem; font-size: .75rem; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; margin-left: .25rem; }
.btn-small:hover { background: var(--bg); }
.btn-small.danger { color: var(--danger); border-color: #fecaca; }

/* ---------- Layout ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--card); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 1.25rem; border-bottom: 1px solid var(--border); }
.sidebar-brand .brand-logo { width: 36px; height: 36px; font-size: .9rem; margin: 0; }
.sidebar-brand small { display: block; color: var(--muted); font-size: .7rem; }
.sidebar nav { flex: 1; padding: .75rem; display: flex; flex-direction: column; gap: .25rem; }
.sidebar nav a { padding: .6rem .8rem; border-radius: 8px; text-decoration: none; color: var(--text); font-size: .9rem; }
.sidebar nav a:hover { background: var(--bg); }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); }
.sidebar-footer #user-info { font-size: .8rem; margin-bottom: .5rem; color: var(--muted); }
.sidebar-footer .btn-ghost { width: 100%; }
.content { flex: 1; padding: 1.75rem; max-width: 1100px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.page-head .btn-primary { width: auto; }

/* ---------- Cards / stats / tables ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.stat-card small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.stat-card .value { font-size: 1.8rem; font-weight: bold; margin-top: .25rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.card h2 { font-size: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { text-align: left; color: var(--muted); font-size: .72rem; text-transform: uppercase; padding: .6rem .5rem; border-bottom: 1px solid var(--border); }
td { padding: .7rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.badge { padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.badge.pending { background: #fef9c3; color: #854d0e; }
.badge.active { background: #dcfce7; color: #166534; }
.badge.suspended { background: #fee2e2; color: #991b1b; }
.badge.cancelled { background: #e5e7eb; color: #374151; }
.badge.hot { background: #fee2e2; color: #991b1b; }
.badge.mild { background: #dbeafe; color: #1e40af; }
.list-item { display: flex; justify-content: space-between; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.list-item:last-child { border-bottom: none; }
.list-item small { color: var(--muted); display: block; }

/* ---------- Filters / plans ---------- */
.filters { display: flex; gap: .75rem; margin-bottom: 1rem; }
.filters input { max-width: 340px; }
.filters select { width: 180px; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.plan-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.plan-price { font-size: 1.6rem; font-weight: bold; }
.plan-price small { font-size: .8rem; font-weight: normal; color: var(--muted); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal { background: #fff; border-radius: 14px; padding: 1.75rem; width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1rem; }
.modal-actions .btn-primary { width: auto; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: .75rem 1.25rem; border-radius: 10px; font-size: .85rem; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: 90vw; word-break: break-all; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ---------- Switch ---------- */
.switch { position: relative; width: 40px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch .slider:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(18px); }

@media (max-width: 800px) {
  #app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar nav { flex-direction: row; }
  .sidebar-footer { display: none; }
  .two-col { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
