/* Painel admin Plinkster — estilos autocontidos (design system adaptado de
   apps/web/src/styles/tokens.css, sem depender do arquivo original). */
:root {
  --brand-ink: #2f3030;
  --brand-coral: #ee8d84;
  --brand-lilac: #7b61ff;
  --success: #19b86a;
  --green-light: #e9f9f1;
  --blue-light: #f0ecff;
  --gray-50: #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --red: #e53e3e;
  --red-light: #fdecec;
  --orange: #f59e0b;
  --orange-light: #fef3e2;
  --surface: #ffffff;
  --sidebar-w: 248px;
  --header-h: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 3px rgba(47, 48, 48, 0.06), 0 1px 2px rgba(47, 48, 48, 0.08);
  --shadow-modal: 0 12px 32px rgba(47, 48, 48, 0.18);
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--brand-ink);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; }

/* Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--brand-ink);
  color: #fff; display: flex; flex-direction: column; padding: 20px 14px; gap: 4px;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px 22px;
  font-weight: 700; font-size: 18px; letter-spacing: 0.02em;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-coral), var(--brand-lilac));
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff;
}
.sidebar-tag { font-size: 11px; color: rgba(255,255,255,0.45); font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: rgba(255, 255, 255, 0.72);
  font-size: 14px; font-weight: 500; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link.active { background: rgba(238, 141, 132, 0.16); color: var(--brand-coral); }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 12px; color: rgba(255,255,255,0.5); }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--header-h); flex-shrink: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--gray-200);
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--gray-600); }
.content { flex: 1; padding: 28px; overflow-y: auto; }

.page-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.page-subtitle { color: var(--gray-500); font-size: 14px; margin-bottom: 24px; }

/* Cards / KPI */
.card { background: #fff; border-radius: var(--radius-md); border: 1px solid var(--gray-200); box-shadow: var(--shadow-card); padding: 20px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .kpi-grid, .kpi-grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
.kpi-card { background: #fff; border-radius: var(--radius-md); border: 1px solid var(--gray-200); box-shadow: var(--shadow-card); padding: 18px 20px; }
.kpi-label { font-size: 13px; color: var(--gray-500); font-weight: 600; margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.kpi-sub { font-size: 12px; color: var(--gray-500); margin-top: 6px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2-wide { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .grid-2, .grid-2-wide { grid-template-columns: 1fr; } }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; border: 1px solid transparent; cursor: pointer;
  transition: filter 0.15s, background 0.15s, border-color 0.15s; white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand-coral), var(--brand-lilac)); color: #fff; box-shadow: 0 4px 12px rgba(123, 97, 255, 0.25); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-secondary { background: var(--gray-100); color: var(--brand-ink); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }
.btn-outline { background: transparent; border-color: var(--gray-300); color: var(--brand-ink); }
.btn-outline:hover:not(:disabled) { border-color: var(--brand-lilac); color: var(--brand-lilac); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-green { background: var(--green-light); color: var(--success); }
.badge-blue { background: var(--blue-light); color: var(--brand-lilac); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--success); }
.dot.off { background: var(--gray-300); }
.flag-row { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 3px 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; background: var(--gray-50); color: var(--gray-500); font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 14px; border-bottom: 1px solid var(--gray-200);
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--gray-50); }
.table-wrap { overflow-x: auto; }
.cell-strong { font-weight: 700; }
.cell-muted { color: var(--gray-500); font-size: 13px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--gray-700); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: #fff; color: var(--brand-ink);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--brand-lilac); box-shadow: 0 0 0 3px rgba(123, 97, 255, 0.12);
}
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; } }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .form-input { flex: 1; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(47, 48, 48, 0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 24px; }
.modal.modal-sm { max-width: 420px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--gray-400); cursor: pointer; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--gray-200); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200); margin-bottom: 18px; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--gray-500); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; }
.tab.active { color: var(--brand-lilac); border-color: var(--brand-lilac); }

/* Login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brand-ink), #44403c); padding: 20px; }
.login-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); width: 100%; max-width: 400px; padding: 36px 32px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; font-weight: 800; font-size: 20px; }
.login-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.login-card .subtitle { color: var(--gray-500); font-size: 14px; margin-bottom: 26px; }
.login-error { background: var(--red-light); color: var(--red); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; margin-bottom: 16px; }

/* Toast */
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 2000; }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: #fff; box-shadow: var(--shadow-modal); min-width: 240px; animation: toast-in 0.2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast.success { background: linear-gradient(135deg, var(--success), #0e8a4f); }
.toast.error { background: linear-gradient(135deg, var(--red), #b83333); }
.toast.info { background: linear-gradient(135deg, var(--brand-lilac), #5a45c9); }

/* Misc */
.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-500); }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.font-bold { font-weight: 700; }
.back-link { color: var(--gray-500); font-size: 13px; font-weight: 600; cursor: pointer; margin-bottom: 12px; display: inline-flex; gap: 6px; }
.back-link:hover { color: var(--brand-lilac); }
.def-list { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; font-size: 14px; }
.def-list dt { color: var(--gray-500); font-weight: 600; }
.def-list dd { margin: 0; font-weight: 500; }
.temp-pass { font-family: "Courier New", monospace; font-size: 22px; font-weight: 800; letter-spacing: 1px; background: var(--gray-100); border: 1px dashed var(--gray-300); border-radius: var(--radius-sm); padding: 14px; text-align: center; margin: 10px 0; user-select: all; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--gray-300); border-top-color: var(--brand-lilac); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: flex; align-items: center; justify-content: center; padding: 60px; }
.plan-card { border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: 20px; background: #fff; box-shadow: var(--shadow-card); }
.plan-price { font-size: 28px; font-weight: 800; }
.plan-price small { font-size: 13px; font-weight: 600; color: var(--gray-500); }
.plan-features { list-style: none; padding: 0; margin: 14px 0; font-size: 13px; color: var(--gray-600); }
.plan-features li { padding: 4px 0; display: flex; gap: 8px; }
.plan-features li::before { content: "✓"; color: var(--success); font-weight: 800; }
