:root {
  --rojo-mfm: #C8142F;
  --rojo-suave: #F8E1E4;
  --texto: #1d1d1f; /* Mac dark text */
  --texto-suave: #86868b; /* Mac gray text */
  --borde: #d2d2d7;
  --fondo: #f5f5f7; /* Mac light background */
  --blanco: #ffffff;
  --verde: #2E7D32;
  --naranja: #ED6C02;
  --rojo-error: #D32F2F;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--texto);
  background-color: var(--fondo);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 { margin-bottom: 1rem; }
a { color: var(--rojo-mfm); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout Main */
.layout-main { display: flex; flex-direction: column; height: 100vh; }
.layout-header {
  background-color: #fff;
  border-bottom: 1px solid var(--borde);
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  flex-shrink: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 1rem; font-weight: bold; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.layout-wrapper { display: flex; flex: 1; overflow: hidden; }

/* Sidebar */
.layout-sidebar {
  width: 240px;
  background-color: #fff;
  border-right: 1px solid var(--borde);
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-menu { list-style: none; padding: 1rem 0; }
.sidebar-menu li a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--texto);
  text-decoration: none;
}
.sidebar-menu li a:hover {
  background-color: var(--rojo-suave);
  color: var(--rojo-mfm);
}

/* Content */
.layout-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

/* Layout Auth */
.layout-auth { display: flex; align-items: center; justify-content: center; height: 100vh; }
.auth-container { width: 100%; max-width: 400px; padding: 1rem; }
.auth-card {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo img { margin-bottom: 1rem; }
.auth-logo h2 { margin-bottom: 0.5rem; color: var(--rojo-mfm); }
.auth-logo p { color: var(--texto-suave); font-size: 0.9rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; }
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--borde);
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
}
input:focus { outline: none; border-color: var(--rojo-mfm); box-shadow: 0 0 0 2px var(--rojo-suave); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  font-weight: 500;
  transition: background-color 0.2s;
}
.btn-block { display: block; width: 100%; }
.btn-primario { background-color: var(--rojo-mfm); color: #fff; }
.btn-primario:hover { background-color: #a81026; color: #fff; text-decoration: none;}
.btn-secundario { background-color: transparent; border: 1px solid var(--rojo-mfm); color: var(--rojo-mfm); }
.btn-secundario:hover { background-color: var(--rojo-suave); text-decoration: none;}

/* Alerts / Flash */
.alert { padding: 1rem; border-radius: 4px; margin-bottom: 1rem; }
.alert-error { background-color: #fdecea; color: var(--rojo-error); border: 1px solid #f5c2c7; }
.alert-success { background-color: #e8f5e9; color: var(--verde); border: 1px solid #c8e6c9; }
.alert-info { background-color: #e3f2fd; color: #0288d1; border: 1px solid #b3e5fc; }

/* Tables */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; background: #fff; }
th, td { padding: 0.75rem; border-bottom: 1px solid var(--borde); text-align: left; }
th { background-color: var(--rojo-suave); color: var(--rojo-mfm); font-weight: 600; }
tbody tr:nth-child(even) { background-color: var(--fondo); }

/* Footer */
.layout-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--texto-suave);
  border-top: 1px solid var(--borde);
  background: #fff;
}

/* Utilities */
.text-danger { color: var(--rojo-error); }
.text-success { color: var(--verde); }

/* Responsive */
@media (max-width: 768px) {
  .layout-sidebar { display: none; } /* En iteraciones futuras agregar menú hamburguesa */
  .layout-content { padding: 1rem; }
}

/* Componentes Iteracion 2 */
.tabla-listado { width: 100%; border-collapse: collapse; }
.tabla-listado th { background-color: var(--rojo-suave); color: var(--rojo-mfm); padding: 0.75rem; border-bottom: 2px solid var(--rojo-mfm); }
.tabla-listado td { padding: 0.75rem; border-bottom: 1px solid var(--borde); }

.pill { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 12px; font-size: 0.8rem; font-weight: bold; }
.pill-verde { background-color: #e8f5e9; color: var(--verde); border: 1px solid #c8e6c9; }
.pill-rojo { background-color: #fdecea; color: var(--rojo-error); border: 1px solid #f5c2c7; }
.pill-naranja { background-color: #fff3e0; color: var(--naranja); border: 1px solid #ffe0b2; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; padding: 2rem; border-radius: 8px; width: 100%; max-width: 500px; }

/* Bento Mac Style UI */
.bento-header {
  text-align: center;
  margin-bottom: 3rem;
  margin-top: 1rem;
}
.bento-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: #1d1d1f;
}
.bento-header p {
  font-size: 1.1rem;
  color: var(--texto-suave);
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.bento-card {
  background: var(--blanco);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 250px;
}
.bento-card:hover {
  transform: scale(1.01);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.bento-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--texto-suave);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.bento-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--texto);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}

.bento-content {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
}

.bento-btn {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f5f5f7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--texto-suave);
  font-weight: bold;
  font-size: 1.2rem;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.bento-card:hover .bento-btn {
  background: var(--rojo-suave);
  color: var(--rojo-mfm);
}
.bento-btn:hover { text-decoration: none; }

/* Existing card fallback */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
  margin-bottom: 1.5rem;
}
.kpi-card { text-align: center; padding: 1.5rem; }
