/* =========================================================
   CONTABILIDAD DOMINICANA
   Glassmorphism Premium – Nivel Dios
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-1: #070b14;
  --bg-2: #0f172a;
  --bg-3: #1e293b;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-border-hover: rgba(255, 255, 255, 0.22);
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
  --accent-2: #818cf8;
  --success: #34d399;
  --danger: #f87171;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  --shadow-soft: 0 10px 30px -8px rgba(0, 0, 0, 0.4);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 15.5px;
  color-scheme: dark;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-1);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(56, 189, 248, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 110%, rgba(129, 140, 248, 0.10), transparent),
    linear-gradient(160deg, #070b14 0%, #0f172a 50%, #070b14 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Glass base ---------- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.glass:hover {
  background: var(--glass-strong);
  border-color: var(--glass-border-hover);
}

/* =========================================================
   LOGIN
   ========================================================= */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 48px 44px;
  position: relative;
  z-index: 2;
}

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

.login-logo .brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo .tagline {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.form-control {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: #fff;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  box-shadow: 0 10px 25px -6px rgba(14, 165, 233, 0.45);
  margin-top: 8px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -6px rgba(14, 165, 233, 0.55);
  filter: brightness(1.08);
}

.btn-primary:active {
  transform: translateY(0);
}

.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 22px;
  display: none;
}

.alert-danger {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: #fca5a5;
}

.alert.show {
  display: block;
}

/* =========================================================
   DASHBOARD LAYOUT
   ========================================================= */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: rgba(7, 11, 20, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--glass-border);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  padding: 4px 12px 32px;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  list-style: none;
  flex: 1;
}

.sidebar-nav li {
  margin-bottom: 3px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.sidebar-nav a:hover {
  background: rgba(56, 189, 248, 0.08);
  color: var(--accent);
}

.sidebar-nav a.active {
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.2);
}

.sidebar-nav a .icon {
  width: 22px;
  text-align: center;
  font-size: 1.15rem;
  opacity: 0.9;
}

.sidebar-footer {
  padding: 16px 12px 4px;
  border-top: 1px solid var(--glass-border);
  margin-top: 16px;
}

.sidebar-footer .user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar-footer .user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 28px 32px 40px;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 20px;
  flex-wrap: wrap;
}

.topbar-left h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.topbar-left .welcome {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.clock-box {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 195px;
  text-align: center;
  letter-spacing: 0.2px;
}

.empresa-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  min-width: 190px;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.empresa-select:hover,
.empresa-select:focus {
  border-color: var(--accent);
  background-color: rgba(255, 255, 255, 0.08);
}

.empresa-select option {
  background: #0f172a;
  color: #f8fafc;
}

/* Desplegables de todo el sistema: fondo oscuro, texto legible */
select,
select.form-control,
.field select,
table.grilla select,
.empresa-select {
  color-scheme: dark;
  background-color: #0f172a;
  color: #f8fafc;
}

select option,
.field select option,
table.grilla select option,
.empresa-select option {
  background-color: #0f172a;
  color: #f8fafc;
}

select option:checked,
select option:hover,
select option:focus {
  background-color: #1e3a5f;
  color: #ffffff;
}

.btn-logout {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
}

.btn-logout:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.4);
  transform: translateY(-1px);
}

/* ---------- Stats Cards ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 36px;
}

.stat-card {
  padding: 24px 22px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: var(--transition);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text);
  line-height: 1.1;
}

.stat-card .stat-icon {
  position: absolute;
  right: 18px;
  top: 20px;
  font-size: 1.7rem;
  opacity: 0.18;
  transition: var(--transition);
}

.stat-card:hover .stat-icon {
  opacity: 0.32;
  transform: scale(1.08);
}

/* ---------- Section title ---------- */
.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 18px;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--glass-border), transparent);
}

/* ---------- Quick Actions ---------- */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 26px 14px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  text-align: center;
  transition: var(--transition);
  letter-spacing: 0.2px;
}

.action-btn .icon {
  font-size: 1.55rem;
  transition: var(--transition);
  line-height: 1;
}

.action-btn:hover {
  transform: translateY(-4px);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 16px 32px -10px rgba(56, 189, 248, 0.2);
}

.action-btn:hover .icon {
  transform: scale(1.12);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1200px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .actions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 74px;
    padding: 24px 10px;
  }
  .sidebar-brand,
  .sidebar-nav a span:not(.icon),
  .sidebar-footer {
    display: none;
  }
  .sidebar-nav a {
    justify-content: center;
    padding: 14px;
  }
  .main-content {
    margin-left: 74px;
    padding: 22px 18px;
  }
}

@media (max-width: 640px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
    padding: 18px 14px;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar-right {
    width: 100%;
  }
  .login-card {
    padding: 36px 28px;
  }
}
