:root {
  --ns-navy: #1b2a4a;
  --ns-navy-dark: #121d34;
  --ns-accent: #2f6fed;
  --ns-bg: #f4f6f9;
  --ns-border: #dbe1ea;
  --ns-text: #1f2937;
  --ns-text-muted: #6b7280;
  --ns-green: #1a8f4c;
  --ns-red: #c62828;
}

body {
  background: var(--ns-bg);
  color: var(--ns-text);
  font-size: 0.9rem;
}

/* ---- Navbar ---- */
.ns-navbar {
  background: var(--ns-navy);
  color: #fff;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.ns-navbar-brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
  margin-right: 1.5rem;
  white-space: nowrap;
}

.ns-navbar-modules {
  list-style: none;
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  flex: 1;
}

.ns-navbar-modules > li {
  position: relative;
}

.ns-navbar-modules > li > a {
  display: block;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 0.75rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 2px solid transparent;
}

.ns-navbar-modules > li:hover > a,
.ns-navbar-modules > li.active > a {
  color: #fff;
  border-bottom-color: var(--ns-accent);
}

.ns-navbar-modules .dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  color: var(--ns-text);
  min-width: 220px;
  border: 1px solid var(--ns-border);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  padding: 0.35rem 0;
}

.ns-navbar-modules > li:hover .dropdown-panel {
  display: block;
}

.ns-navbar-modules .dropdown-panel a {
  display: block;
  padding: 0.45rem 1rem;
  color: var(--ns-text);
  text-decoration: none;
  font-size: 0.85rem;
}

.ns-navbar-modules .dropdown-panel a:hover {
  background: var(--ns-bg);
}

.ns-navbar-user {
  color: #fff;
  font-size: 0.85rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ns-navbar-user a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}

.ns-navbar-user a:hover {
  color: #fff;
}

/* ---- Layout ---- */
.ns-shell {
  display: flex;
  min-height: calc(100vh - 52px);
}

.ns-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--ns-border);
  padding: 1rem 0.75rem;
}

.ns-sidebar h6 {
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ns-text-muted);
  letter-spacing: 0.04em;
  margin: 1rem 0.25rem 0.35rem;
}

.ns-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ns-sidebar a {
  display: block;
  padding: 0.35rem 0.5rem;
  color: var(--ns-accent);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 3px;
}

.ns-sidebar a:hover {
  background: var(--ns-bg);
  text-decoration: underline;
}

.ns-sidebar a.active {
  background: #eaf0ff;
  color: var(--ns-navy);
  font-weight: 600;
  text-decoration: none;
}

/* ---- Sidebar accordion ---- */
.ns-sidebar-accordion {
  margin-top: 0.25rem;
}

.ns-sidebar-group + .ns-sidebar-group {
  border-top: 1px solid var(--ns-border);
}

.ns-sidebar-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: none;
  border: none;
  text-align: left;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ns-text-muted);
  letter-spacing: 0.04em;
  padding: 0.65rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
}

.ns-sidebar-group-toggle:hover {
  background: var(--ns-bg);
  color: var(--ns-text);
}

.ns-sidebar-group.open .ns-sidebar-group-toggle {
  color: var(--ns-text);
}

.ns-sidebar-chevron {
  flex-shrink: 0;
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.ns-sidebar-group.open .ns-sidebar-chevron {
  transform: rotate(90deg);
}

.ns-sidebar-group-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.ns-sidebar-group.open .ns-sidebar-group-body {
  grid-template-rows: 1fr;
}

.ns-sidebar-group-body-inner {
  overflow: hidden;
}

.ns-sidebar-group-body ul {
  padding-bottom: 0.35rem;
}

.ns-main {
  flex: 1;
  padding: 1.25rem 1.5rem;
  min-width: 0;
}

.ns-page-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--ns-text);
}

/* ---- Cards / panels ---- */
.ns-panel {
  background: #fff;
  border: 1px solid var(--ns-border);
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.ns-panel-header {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--ns-border);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ns-panel-body {
  padding: 1rem;
}

/* ---- KPI tiles ---- */
.ns-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ns-kpi {
  background: #fff;
  border: 1px solid var(--ns-border);
  border-left: 4px solid var(--ns-accent);
  border-radius: 4px;
  padding: 0.85rem 1rem;
}

.ns-kpi .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--ns-text-muted);
  letter-spacing: 0.03em;
}

.ns-kpi .value {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.ns-kpi.warn { border-left-color: #e8a33d; }
.ns-kpi.danger { border-left-color: var(--ns-red); }
.ns-kpi.ok { border-left-color: var(--ns-green); }

/* ---- Tables ---- */
.ns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.ns-table th {
  background: #eef1f6;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--ns-border);
  font-weight: 600;
  white-space: nowrap;
}

.ns-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--ns-border);
}

.ns-table tbody tr:hover {
  background: #f7f9fc;
}

.ns-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
}

.ns-badge.activo { background: #e3f5ea; color: var(--ns-green); }
.ns-badge.cerrado { background: #f1f2f4; color: var(--ns-text-muted); }
.ns-badge.warn { background: #fdf1de; color: #a05a00; margin-left: 0.35rem; }

.ns-badge.recria { background: #eaf0ff; color: #2f4fed; margin-left: 0.35rem; }
.ns-badge.encaste { background: #fdf1de; color: #a05a00; margin-left: 0.35rem; }
.ns-badge.postura { background: #e3f5ea; color: var(--ns-green); margin-left: 0.35rem; }
.ns-badge.finalizado { background: #f1f2f4; color: var(--ns-text-muted); margin-left: 0.35rem; }

/* ---- Login ---- */
.ns-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--ns-navy) 0%, var(--ns-navy) 35%, var(--ns-bg) 35%);
}

.ns-login-card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 360px;
  padding: 2rem;
}

.ns-tabs {
  display: flex;
  border-bottom: 1px solid var(--ns-border);
  margin-bottom: 1rem;
}

.ns-tabs a {
  padding: 0.5rem 1rem;
  color: var(--ns-text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  border-bottom: 2px solid transparent;
}

.ns-tabs a.active {
  color: var(--ns-accent);
  border-bottom-color: var(--ns-accent);
  font-weight: 600;
}
