/* ============================================================
   Póliza Jurídica — Hoja de estilos corporativa
   Paleta: Azul oscuro #1e3a5f | Gris #f4f6f9 | Blanco #fff
   ============================================================ */

:root {
  --primary:       #1e3a5f;
  --primary-mid:   #2d6a9f;
  --primary-light: #3d8bcd;
  --sidebar-bg:    #16304f;
  --sidebar-text:  #b8cce0;
  --sidebar-hover: #2d6a9f;
  --sidebar-active:#2d6a9f;
  --bg-page:       #f0f2f5;
  --bg-card:       #ffffff;
  --text-dark:     #1a2535;
  --text-muted:    #6b7a8d;
  --border:        #dde3ea;
  --success:       #1f7a4b;
  --warning:       #a06a00;
  --danger:        #b52a2a;
  --info:          #1a6a8a;
  --sidebar-width: 230px;
  --topbar-h:      52px;
  --font:          'Inter', 'Segoe UI', system-ui, sans-serif;
  --radius:        6px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.07);
  --shadow:        0 2px 8px rgba(0,0,0,.09);
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text-dark);
  background: var(--bg-page);
  margin: 0;
  overflow-x: hidden;
}
a { color: var(--primary-mid); text-decoration: none; }
a:hover { color: var(--primary-light); text-decoration: underline; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-width); right: 0;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.topbar-user .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-brand {
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-h);
}
.sidebar-brand img {
  height: 34px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: .92;
}
.sidebar-brand-text {
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .3px;
}
.sidebar-section {
  padding: 18px 0 4px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(184,204,224,.45);
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  color: var(--sidebar-text);
  font-size: 12.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sidebar nav a:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
  text-decoration: none;
}
.sidebar nav a.active {
  background: rgba(45,106,159,.35);
  color: #fff;
  border-left-color: var(--primary-light);
}
.sidebar nav a svg, .sidebar nav a .nav-icon {
  width: 15px; height: 15px;
  opacity: .75;
  flex-shrink: 0;
}
.sidebar nav a.active .nav-icon { opacity: 1; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-h);
  padding: 22px 24px;
  min-height: calc(100vh - var(--topbar-h));
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}
.page-breadcrumb {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 16px; }

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}
.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.stat-card.accent-success { border-top: 3px solid var(--success); }
.stat-card.accent-warning { border-top: 3px solid #d4880a; }
.stat-card.accent-danger  { border-top: 3px solid var(--danger); }
.stat-card.accent-info    { border-top: 3px solid var(--info); }
.stat-card.accent-primary { border-top: 3px solid var(--primary); }

/* ── Tables ───────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: var(--bg-card);
}
table.data-table thead th {
  background: #f5f7fa;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table tbody tr {
  border-bottom: 1px solid #edf0f4;
  transition: background .1s;
}
table.data-table tbody tr:last-child { border-bottom: none; }
table.data-table tbody tr:hover { background: #f7f9fc; }
table.data-table td {
  padding: 9px 12px;
  vertical-align: middle;
}
table.data-table tfoot td {
  padding: 9px 12px;
  font-weight: 600;
  background: #f5f7fa;
  border-top: 2px solid var(--border);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-mid);
  border-color: var(--primary-mid);
  color: #fff;
}
.btn-secondary {
  background: #fff;
  color: var(--text-dark);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: #f5f7fa;
  color: var(--text-dark);
}
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: #196040; color: #fff; }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #922020; color: #fff; }
.btn-warning {
  background: #a06a00;
  color: #fff;
  border-color: #a06a00;
}
.btn-warning:hover { background: #825600; color: #fff; }
.btn-sm {
  padding: 4px 10px;
  font-size: 11.5px;
}
.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
}
.btn-outline {
  background: transparent;
  color: var(--primary-mid);
  border-color: var(--primary-mid);
}
.btn-outline:hover {
  background: var(--primary-mid);
  color: #fff;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 5px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control, .form-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-dark);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--font);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  outline: none;
  box-shadow: 0 0 0 3px rgba(61,139,205,.15);
}
.form-control::placeholder { color: #aab5c2; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }
.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
  background: #fafbfc;
}
.form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--primary);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Badges & Status ──────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.badge-success { background: #d4edda; color: #1a5c35; }
.badge-danger  { background: #f8d7da; color: #7c1a1a; }
.badge-warning { background: #fff3cd; color: #7a4f00; }
.badge-info    { background: #d1ecf1; color: #0c4a5a; }
.badge-secondary { background: #e9ecef; color: #495057; }
.badge-primary { background: #cfe2ff; color: #0a367a; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12.5px;
  border: 1px solid transparent;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-success { background: #d4edda; border-color: #b8dfc4; color: #155724; }
.alert-danger  { background: #f8d7da; border-color: #f5c2c7; color: #721c24; }
.alert-warning { background: #fff3cd; border-color: #ffe69c; color: #664d03; }
.alert-info    { background: #d1ecf1; border-color: #b6d4da; color: #0c5460; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--primary-mid);
  background: #fff;
  text-decoration: none;
  transition: background .15s;
}
.pagination a:hover { background: #f0f4f8; }
.pagination .active span {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination .disabled span { color: #adb5bd; cursor: default; }

/* ── Search Bar ───────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.search-bar .form-control { max-width: 260px; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  gap: 0;
}
.tab-nav a {
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s;
}
.tab-nav a:hover { color: var(--primary); text-decoration: none; }
.tab-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Info List ────────────────────────────────────────────── */
.info-list { list-style: none; margin: 0; padding: 0; }
.info-list li {
  display: flex;
  padding: 7px 0;
  border-bottom: 1px solid #f0f2f5;
  font-size: 12.5px;
  gap: 10px;
}
.info-list li:last-child { border-bottom: none; }
.info-list .info-label {
  color: var(--text-muted);
  font-weight: 600;
  min-width: 160px;
  flex-shrink: 0;
  font-size: 11.5px;
}
.info-list .info-value { color: var(--text-dark); }

/* ── Utilities ────────────────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: #a06a00; }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 14px; }
.mb-3 { margin-bottom: 20px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 20px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.w-100 { width: 100%; }
.small { font-size: 11.5px; }
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state p { margin: 8px 0 0; font-size: 13px; }
.monospace { font-family: 'Courier New', monospace; }

/* ── Grid helpers ─────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ── Login Page ───────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #2a5f99 60%, #3d8bcd 100%);
  padding: 20px;
}
.login-box {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  padding: 36px 40px;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  text-align: center;
  margin-bottom: 8px;
}
.login-logo img { height: 56px; width: auto; }
.login-title {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin: 8px 0 4px;
}
.login-subtitle {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .form-row-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: 1fr; }
  .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
}
