/* ==========================================================================
   Painel Agricultura de Precisão - Design System
   Autocontido (sem CDN) para garantir o layout mesmo offline/bloqueado.
   ========================================================================== */

:root {
  --brand-950: #071f14;
  --brand-900: #0b2e1d;
  --brand-800: #11412a;
  --brand-700: #15803d;
  --brand-600: #16a34a;
  --brand-500: #22c55e;
  --brand-100: #dcfce7;
  --brand-50: #f0fdf4;
  --accent: #a3e635;

  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --bg: #f4f7f5;
  --surface: #ffffff;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-line: #fecaca;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --warning-line: #fde68a;
  --info: #0369a1;
  --info-bg: #f0f9ff;
  --info-line: #bae6fd;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 25px -12px rgba(15, 23, 42, .25);
  --shadow-lg: 0 30px 60px -20px rgba(15, 23, 42, .35);
  --ring: 0 0 0 3px rgba(22, 163, 74, .18);

  --sidebar-w: 264px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }
p { margin: 0; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
svg { display: block; }

::selection { background: var(--brand-100); color: var(--brand-900); }

/* ------------------------------- Layout ---------------------------------- */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  color: #e7f3ea;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(163, 230, 53, .16), transparent 60%),
    linear-gradient(180deg, var(--brand-950), var(--brand-900) 55%, #0a2517);
  border-right: 1px solid rgba(255, 255, 255, .06);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; color: #fff; padding: 6px 8px; }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 11px; }
.brand strong { display: block; font-size: 15px; line-height: 1.15; letter-spacing: -0.01em; }
.brand span { display: block; font-size: 11.5px; color: rgba(226, 240, 230, .62); letter-spacing: .02em; }

.nav-group { display: flex; flex-direction: column; gap: 6px; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em;
  color: rgba(226, 240, 230, .45); padding: 0 12px 6px; font-weight: 700;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px;
  color: rgba(233, 245, 237, .82); font-weight: 550; font-size: 14px;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-link svg { width: 19px; height: 19px; opacity: .85; }
.nav-link.active { background: linear-gradient(90deg, rgba(34, 197, 94, .28), rgba(34, 197, 94, .1)); color: #fff; box-shadow: inset 0 0 0 1px rgba(163, 230, 53, .22); }
.nav-link.active svg { opacity: 1; color: var(--accent); }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.user-chip {
  display: flex; align-items: center; gap: 11px;
  padding: 10px; border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .07);
  min-width: 0;
}
.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
  color: var(--brand-900);
  background: linear-gradient(135deg, var(--accent), var(--brand-500));
}
.user-chip-meta { min-width: 0; }
.user-chip-meta strong { display: block; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-meta span { display: block; font-size: 11.5px; color: rgba(226, 240, 230, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-overlay { display: none; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  min-height: 68px; padding: 14px 32px;
  background: rgba(244, 247, 245, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 19px; }
.topbar-title p { font-size: 12.5px; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  display: none; /* apenas mobile */
  width: 40px; height: 40px; border-radius: 10px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: #fff; }

.content { padding: 28px 32px 48px; width: 100%; max-width: 1280px; }
.content-narrow { max-width: 760px; }

/* ------------------------------- Buttons --------------------------------- */
.btn {
  --btn-bg: var(--brand-700);
  --btn-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px;
  border: 1px solid transparent;
  background: var(--btn-bg); color: var(--btn-fg);
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1;
  cursor: pointer; white-space: nowrap;
  transition: filter .15s ease, box-shadow .15s ease, transform .06s ease, background .15s ease;
  box-shadow: var(--shadow-xs);
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { --btn-bg: linear-gradient(180deg, var(--brand-600), var(--brand-700)); }
.btn-secondary { --btn-bg: #fff; --btn-fg: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: #f8fafc; }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--brand-700); box-shadow: none; }
.btn-ghost:hover { background: var(--brand-50); }
.btn-danger { --btn-bg: var(--danger); }
.btn-danger-soft { --btn-bg: var(--danger-bg); --btn-fg: var(--danger); border-color: var(--danger-line); box-shadow: none; }
.btn-warning-soft { --btn-bg: var(--warning-bg); --btn-fg: var(--warning); border-color: var(--warning-line); box-shadow: none; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }
.btn-icon svg { width: 16px; height: 16px; }
.btn-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* -------------------------------- Cards ---------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; border-bottom: 1px solid var(--line);
}
.card-header h2 { font-size: 16px; }
.card-header p { font-size: 12.5px; color: var(--muted); }
.card-header .btn-row { margin-left: auto; }
.card-body { padding: 22px; }
.card-footer { padding: 16px 22px; border-top: 1px solid var(--line); background: #fbfdfc; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: var(--stat-tint, var(--brand-50));
  opacity: .9;
}
.stat-icon {
  position: relative; z-index: 1;
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; margin-bottom: 14px;
  color: var(--stat-color, var(--brand-700));
  background: var(--stat-tint, var(--brand-50));
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-label { position: relative; z-index: 1; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { position: relative; z-index: 1; font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-top: 2px; }
.stat-hint { position: relative; z-index: 1; font-size: 11.5px; color: var(--muted-2); margin-top: 4px; }
.stat.green { --stat-color: var(--brand-700); --stat-tint: var(--brand-50); }
.stat.blue { --stat-color: var(--info); --stat-tint: var(--info-bg); }
.stat.amber { --stat-color: var(--warning); --stat-tint: var(--warning-bg); }
.stat.red { --stat-color: var(--danger); --stat-tint: var(--danger-bg); }

.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--brand-600); }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }

/* -------------------------------- Badges --------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; line-height: 1.4;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-100); }
.badge-red { color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-line); }
.badge-amber { color: var(--warning); background: var(--warning-bg); border: 1px solid var(--warning-line); }
.badge-blue { color: var(--info); background: var(--info-bg); border: 1px solid var(--info-line); }
.badge-gray { color: var(--ink-2); background: #f1f5f9; border: 1px solid var(--line); }

/* -------------------------------- Forms ---------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: 1 / -1; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--muted-2); }
.field .error { font-size: 12px; color: var(--danger); display: none; }
.field.invalid .error { display: block; }
.field.invalid input, .field.invalid select { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }

.input, .select, textarea.input {
  width: 100%; padding: 11px 12px;
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-2); border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
  appearance: none;
}
.input::placeholder { color: var(--muted-2); }
.input:focus, .select:focus {
  outline: none; border-color: var(--brand-600); box-shadow: var(--ring);
}
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 38px;
}
.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 44px; }
.input-addon {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted);
  border-radius: 8px; cursor: pointer; display: grid; place-items: center;
}
.input-addon:hover { background: #f1f5f9; color: var(--ink-2); }
.input-addon svg { width: 17px; height: 17px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative; width: 42px; height: 24px; border-radius: 999px;
  background: var(--line-2); transition: background .18s ease;
  flex: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-xs);
  transition: transform .18s ease;
}
.switch input:checked + .track { background: var(--brand-600); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch .switch-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }

.check { display: inline-flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--brand-600); }

.radio-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.radio-card {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 12px; border: 1px solid var(--line-2); border-radius: 10px;
  cursor: pointer; background: #fff; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.radio-card input { position: absolute; opacity: 0; }
.radio-card .rc-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.radio-card .rc-desc { font-size: 11px; color: var(--muted); line-height: 1.35; }
.radio-card:hover { border-color: var(--brand-500); }
.radio-card:has(input:checked) { border-color: var(--brand-600); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(22, 163, 74, .1); }

.fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.fieldset legend { padding: 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* -------------------------------- Table ---------------------------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th {
  text-align: left; padding: 12px 18px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); background: #f8faf9; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #fafdfb; }
.table .cell-user { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.table .cell-user .avatar { width: 36px; height: 36px; font-size: 12px; }
.cell-user strong { display: block; font-size: 14px; color: var(--ink); font-weight: 600; }
.cell-user span { display: block; font-size: 12.5px; color: var(--muted); }
.cell-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.cell-actions .btn-icon { color: var(--muted); background: transparent; border: 1px solid transparent; box-shadow: none; }
.cell-actions .btn-icon:hover { background: #f1f5f9; color: var(--ink); }
.cell-actions .btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); }
.cell-actions .btn-icon.warning:hover { background: var(--warning-bg); color: var(--warning); }

/* ------------------------------- Toolbar --------------------------------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar .search { position: relative; flex: 1 1 260px; max-width: 380px; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted-2); }
.toolbar .search .input { padding-left: 38px; }
.toolbar .select { max-width: 180px; }
.toolbar .spacer { flex: 1; }

/* -------------------------------- Modal ---------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px;
  background: rgba(7, 31, 20, .5);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  opacity: 0; visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}
.modal.open { opacity: 1; visibility: visible; }
.modal-dialog {
  width: 100%; max-width: 560px; margin: auto;
  background: var(--surface); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(.99);
  transition: transform .18s ease;
  overflow: hidden;
}
.modal.open .modal-dialog { transform: translateY(0) scale(1); }
.modal-dialog.wide { max-width: 680px; }
.modal-dialog.small { max-width: 430px; }
.modal-header { display: flex; align-items: flex-start; gap: 14px; padding: 22px 24px 0; }
.modal-header h3 { font-size: 17px; }
.modal-header p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.modal-close {
  margin-left: auto; flex: none;
  width: 34px; height: 34px; border-radius: 9px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.modal-close:hover { background: #f1f5f9; color: var(--ink); }
.modal-body { padding: 20px 24px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); background: #fbfdfc; }
.modal-footer .left { margin-right: auto; }

/* ------------------------------- Toasts ---------------------------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 15px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line);
  box-shadow: var(--shadow-md); font-size: 13.5px; color: var(--ink-2);
  animation: toast-in .22s ease both;
}
.toast .t-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; }
.toast.success { border-color: var(--brand-100); }
.toast.success .t-icon { background: var(--brand-600); }
.toast.error { border-color: var(--danger-line); }
.toast.error .t-icon { background: var(--danger); }
.toast.warning { border-color: var(--warning-line); }
.toast.warning .t-icon { background: var(--warning); }
.toast.info { border-color: var(--info-line); }
.toast.info .t-icon { background: var(--info); }
.toast .t-close { margin-left: auto; border: 0; background: transparent; color: var(--muted-2); cursor: pointer; padding: 0 2px; }
.toast.leaving { animation: toast-out .18s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ------------------------------ Password box ----------------------------- */
.secret-box {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 12px;
  background: var(--brand-50); border: 1px dashed var(--brand-500);
}
.secret-box code {
  flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px; font-weight: 700; letter-spacing: .06em; color: var(--brand-900);
  word-break: break-all; user-select: all;
}
.note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px; font-size: 12.5px; line-height: 1.45;
}
.note svg { flex: none; width: 17px; height: 17px; margin-top: 1px; }
.note.warning { background: var(--warning-bg); border: 1px solid var(--warning-line); color: #92400e; }
.note.info { background: var(--info-bg); border: 1px solid var(--info-line); color: #0c4a6e; }
.note.success { background: var(--brand-50); border: 1px solid var(--brand-100); color: #166534; }

/* ------------------------------ Empty state ------------------------------ */
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty svg { width: 42px; height: 42px; margin: 0 auto 12px; color: var(--muted-2); }
.empty h3 { font-size: 15px; color: var(--ink-2); margin-bottom: 4px; }
.empty p { font-size: 13px; }

.skeleton { border-radius: 8px; background: linear-gradient(90deg, #eef2f0 25%, #f6f9f7 50%, #eef2f0 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; height: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ------------------------------- Utilities ------------------------------- */
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ------------------------------- Login ----------------------------------- */
.auth {
  min-height: 100vh;
  display: grid; grid-template-columns: 1.05fr .95fr;
  background: var(--brand-950);
}
.auth-art {
  position: relative; overflow: hidden;
  padding: 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #effbf2;
  background:
    radial-gradient(700px 500px at 85% 15%, rgba(163, 230, 53, .22), transparent 60%),
    radial-gradient(600px 500px at 10% 90%, rgba(34, 197, 94, .22), transparent 60%),
    linear-gradient(160deg, var(--brand-950), var(--brand-900));
}
.auth-art::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 60% 40%, #000, transparent 78%);
  pointer-events: none;
}
.auth-art .brand { position: relative; padding: 0; }
.auth-art h2 { position: relative; margin-top: auto; font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; color: #fff; max-width: 15ch; }
.auth-art p { position: relative; margin-top: 16px; max-width: 44ch; color: rgba(226, 240, 230, .68); font-size: 14.5px; }
.auth-art .art-foot { position: relative; margin-top: 40px; display: flex; gap: 28px; }
.auth-art .art-foot div strong { display: block; font-size: 22px; font-weight: 800; color: var(--accent); }
.auth-art .art-foot div span { font-size: 12px; color: rgba(226, 240, 230, .6); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card { padding: 30px; }
.auth-logo { width: 56px; height: 56px; border-radius: 15px; margin-bottom: 18px; }
.auth-card h1 { font-size: 23px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; margin-bottom: 22px; }
.auth-links { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* ------------------------------- Responsive ------------------------------ */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .sidebar { transform: none; }
  .sidebar-overlay {
    display: block; position: fixed; inset: 0; z-index: 35;
    background: rgba(7, 31, 20, .45);
    opacity: 0; visibility: hidden; transition: opacity .2s ease;
  }
  body.sidebar-open .sidebar-overlay { opacity: 1; visibility: visible; }
  .app-main { margin-left: 0; }
  .icon-btn { display: inline-flex; }
  .topbar { padding: 12px 18px; }
  .content { padding: 20px 18px 40px; }
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .radio-cards { grid-template-columns: 1fr; }
  .toolbar .search { max-width: none; }
  .toolbar .select { max-width: none; flex: 1; }
  .card-header { flex-wrap: wrap; }
  .card-header .btn-row { margin-left: 0; width: 100%; }
  .toasts { left: 14px; right: 14px; bottom: 14px; max-width: none; }
  .modal { padding: 12px; }
}

/* Ajustes complementares */
.sidebar .btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.sidebar .btn-ghost { box-shadow: none; }

@media (max-width: 1080px) {
  .dash-grid { grid-template-columns: 1fr !important; }
}
