/* assets/css/app.css */
:root {
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --brand-color: #1a56db;
  --brand-dark: #1e429f;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: rgba(255,255,255,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
}

/* ── Sidebar ──────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand i { font-size: 1.4rem; color: #60a5fa; }

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  border-radius: 0;
  transition: background .15s, color .15s;
}

.sidebar-nav .nav-link:hover {
  color: var(--sidebar-active);
  background: var(--sidebar-active-bg);
}

.sidebar-nav .nav-link.active {
  color: var(--sidebar-active-text, var(--sidebar-active));
  background: var(--sidebar-active-bg, rgba(255,255,255,0.1));
  border-left: 3px solid var(--sidebar-active-bg, #60a5fa);
}

.sidebar-nav .nav-link i { font-size: 1rem; min-width: 20px; }

.sidebar-section {
  padding: 16px 20px 4px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #475569;
}

/* ── Main content ────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  z-index: 100;
}

.topbar-title {
  font-size: .95rem;
  font-weight: 600;
  color: #1e293b;
}

.page-body {
  padding: 24px;
  flex: 1;
}

/* ── Cards ───────────────────────────────── */
.card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid #f1f5f9;
  padding: 16px 20px;
  font-weight: 600;
  font-size: .95rem;
}

/* ── Stat cards ──────────────────────────── */
.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-label { font-size: .8rem; color: #64748b; margin: 0 0 2px; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin: 0; line-height: 1.2; }

/* ── Tablas ──────────────────────────────── */
.table-responsive { border-radius: 10px; overflow: hidden; }

.table { margin: 0; }

.table thead th {
  background: #f8fafc;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 16px;
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-size: .88rem;
}

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

/* ── Formularios ─────────────────────────── */
.form-label { font-weight: 500; font-size: .875rem; color: #374151; }

.form-control, .form-select {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: .875rem;
  padding: .5rem .75rem;
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand-color);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

/* ── Botones ─────────────────────────────── */
.btn-primary { background: var(--brand-color); border-color: var(--brand-color); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

/* ── Badges de estado ────────────────────── */
.badge { font-size: .72rem; font-weight: 500; padding: .3em .6em; border-radius: 6px; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* ── Login page ──────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

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

.login-logo i { font-size: 2.5rem; color: var(--brand-color); }
.login-logo h1 { font-size: 1.4rem; font-weight: 700; margin: 8px 0 4px; }
.login-logo p  { color: #64748b; font-size: .85rem; margin: 0; }

/* ── Firma canvas ────────────────────────── */
#firma-canvas {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
  width: 100%;
  max-width: 500px;
  display: block;
}
