:root {
  font-family:
    Inter,
    system-ui,
    -apple-system,
    sans-serif;
  color: #17201b;
  background: #f4f7f4;
  --green: #166534;
  --mint: #dcfce7;
  --line: #dfe7e1;
  --red: #b91c1c;
  --nav-background: #123d26;
  --action-background: #123d26;
  --action-text: #ffffff;
  --nav-text: #dcebe1;
  --menu-background: #123d26;
  --menu-text: #dcebe1;
  --menu-hover: #245c3b;
  --menu-dropdown-background: #ffffff;
  --title-color: #17201b;
  --page-background: #f4f7f4;
}

/* Componentes incorporados en 6.2: menú tematizable, seguridad y analítica. */
.header .nav > button,
.header .menu-root > summary {
  background: var(--menu-background);
  color: var(--menu-text);
  border: 1px solid #ffffff20;
}
.header .nav > button:hover,
.header .nav > button.active,
.header .menu-root > summary:hover {
  background: var(--menu-hover);
}
.mega-menu {
  background: var(--menu-dropdown-background);
}
.icon-action {
  min-width: 42px;
  min-height: 42px;
  padding: 8px;
  display: inline-grid;
  place-items: center;
}
.file-icon,
.excel-icon {
  font-size: 0.7rem;
  font-weight: 900;
}
.excel-icon {
  background: #e7f6ec;
  color: #166534;
}
.notification-preview {
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.chart {
  width: 100%;
  overflow: hidden;
}
.chart svg {
  display: block;
  width: 100%;
  min-width: 0;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.chart-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.chart-legend i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.live-clock {
  font-size: 1.05rem;
  text-transform: capitalize;
  color: #526258;
  margin-top: 8px;
}
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.pager select {
  width: auto;
}
.audit-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.audit-compare pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f4f7f4;
  padding: 12px;
  border-radius: 10px;
  max-height: 55vh;
  overflow: auto;
}
.qr-code {
  width: min(240px, 100%);
  display: block;
  margin: 12px auto;
}
.file-action-button {
  width: 64px;
  min-width: 64px;
  min-height: 46px;
  padding: 4px 7px;
  background: #f1f5f3;
  border: 1px solid #dbe5df;
}
.file-action-button:hover {
  background: #e5ede8;
  transform: translateY(-1px);
}
.file-action-svg {
  display: block;
  width: 48px;
  height: 34px;
  margin: auto;
}
.audit-detail-table table {
  min-width: 0;
}
.audit-detail-table th:first-child {
  width: 30%;
  text-align: left;
}
.audit-detail-table .audit-changed > * {
  background: #fff7d6;
  border-color: #f1c84b;
  font-weight: 700;
}
.change-key {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  border: 1px solid #f1c84b;
  border-radius: 3px;
  background: #fff7d6;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--page-background);
}
button,
input,
select,
textarea {
  font: inherit;
}
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.hero {
  background: var(--nav-background);
  color: var(--nav-text);
  padding: 8vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero h1 {
  font-size: clamp(2.7rem, 6vw, 5.7rem);
  letter-spacing: -0.06em;
  margin: 0;
}
.hero p {
  font-size: 1.25rem;
  max-width: 560px;
  color: #d5f5df;
}
.loginbox {
  display: grid;
  place-items: center;
  padding: 30px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 30px #1232;
}
.login .card {
  max-width: 440px;
  width: 100%;
}
label {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  margin: 14px 0 6px;
}
input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #ccd7cf;
  border-radius: 10px;
  background: #fff;
}
button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 750;
}
.primary {
  background: var(--action-background);
  color: var(--action-text);
}
.secondary {
  background: #eef3ef;
  color: #1d3526;
}
.danger {
  background: #fee2e2;
  color: #991b1b;
}
.full {
  width: 100%;
  margin-top: 16px;
}
.demo {
  font-size: 0.82rem;
  color: #637069;
  background: #f3f6f4;
  padding: 12px;
  border-radius: 10px;
  margin-top: 18px;
}
.shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}
.side {
  background: var(--nav-background);
  color: var(--nav-text);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  min-height: 100vh;
  height: auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.brand {
  font-size: 1.4rem;
  font-weight: 850;
  margin: 4px 10px 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
}
.login-logo {
  display: block;
  width: min(100%, 420px);
  height: auto;
  max-height: 160px;
  margin-bottom: 24px;
  object-fit: contain;
  object-position: left center;
}
.nav button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--nav-text);
  margin: 4px 0;
}
.nav button.active,
.nav button:hover {
  background: #ffffff1b;
}
.nav-label {
  margin: 18px 10px 6px;
  color: var(--nav-text);
  opacity: 0.72;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.user {
  margin: auto 4px 0;
  padding-top: 24px;
  font-size: 0.83rem;
  color: var(--nav-text);
}
.actions-bar {
  justify-content: flex-start;
}
form.card > .actions-bar {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.custom-ui-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}
.appearance-options {
  margin: 20px 0;
}
.icon-settings {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.icon-settings summary {
  cursor: pointer;
  font-weight: 800;
}
.icon-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.icon-upload {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.icon-upload > b,
.icon-upload > input,
.icon-upload > button {
  grid-column: 1 / -1;
}
.icon-upload-preview {
  grid-column: 1 / -1;
  min-height: 42px;
  display: grid;
  place-items: center;
  color: #66736b;
}
.icon-upload-preview img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.message-settings,
.processing-settings {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.message-settings summary,
.processing-settings summary {
  cursor: pointer;
  font-weight: 800;
}
.message-config-grid,
.processing-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}
.message-config-grid textarea {
  min-height: 105px;
}
.processing-config-grid section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.processing-colors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.list-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 18px;
  flex-wrap: wrap;
}
.pagination-settings {
  min-width: 44px;
}
.pagination-summary {
  color: #526258;
  font-size: 0.9rem;
}
.pagination-navigation {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.pagination-navigation button {
  min-width: 42px;
}
[hidden] {
  display: none !important;
}
.main {
  padding: 34px;
  max-width: 1400px;
  width: 100%;
  margin: auto;
}
.top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 26px;
}
.top h1 {
  margin: 0;
  font-size: 2rem;
  color: var(--title-color);
}
h2,
h3 {
  color: var(--title-color);
}
.style-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  align-items: start;
}
.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
.color-grid input[type="color"] {
  min-height: 46px;
  padding: 4px;
}
.style-preview {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 30px #1232;
}
.logo-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.logo-config-grid section {
  display: grid;
  gap: 9px;
  align-content: start;
  padding: 14px;
  border: 1px solid #dce5df;
  border-radius: 12px;
}
.logo-config-grid small {
  min-height: 32px;
  color: #64748b;
}
.logo-preview {
  display: grid;
  place-items: center;
  min-height: 105px;
  padding: 10px;
  overflow: hidden;
  border: 1px dashed #b9c8bf;
  border-radius: 10px;
  background: #f8faf9;
}
.logo-preview img {
  max-width: 100%;
  max-height: 90px;
  object-fit: contain;
}
.logo-preview.compact img {
  max-height: 42px;
}
.logo-preview.wide img {
  width: 100%;
  max-height: 58px;
}
@media (max-width: 900px) {
  .logo-config-grid {
    grid-template-columns: 1fr;
  }
}
.preview-nav {
  min-height: 90px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.preview-nav img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
.preview-nav span {
  font-size: 0.85rem;
}
.preview-content {
  padding: 24px;
}
.muted {
  color: #69766e;
}
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}
.stat strong {
  display: block;
  font-size: 2rem;
  margin-top: 8px;
}
.section {
  margin-top: 24px;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}
.toolbar > * {
  min-width: 150px;
  flex: 1;
}
.toolbar button {
  flex: 0 0 auto;
}
.tablewrap {
  overflow: auto;
  margin-top: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
}
th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1ee;
  text-align: left;
}
th {
  font-size: 0.78rem;
  color: #67746c;
  text-transform: uppercase;
  background: #f8faf8;
}
.badge {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 800;
}
.PRESENT {
  background: #dcfce7;
  color: #166534;
}
.ABSENT {
  background: #fee2e2;
  color: #991b1b;
}
.LATE {
  background: #fef3c7;
  color: #92400e;
}
.EXCUSED {
  background: #dbeafe;
  color: #1e40af;
}
.UNMARKED {
  background: #eee;
  color: #555;
}
.OPEN {
  background: #dcfce7;
  color: #166534;
}
.UPCOMING {
  background: #dbeafe;
  color: #1e40af;
}
.CLOSED {
  background: #eee;
  color: #555;
}
.notice {
  padding: 10px 12px;
  border-radius: 10px;
  background: #ecfdf5;
  color: #166534;
}
.modal {
  position: fixed;
  inset: 0;
  background: #07130ba8;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
}
.modal .card {
  width: min(620px, 100%);
  max-height: 90vh;
  overflow: auto;
}
.modal .card > .top:first-child {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 4px 0 12px;
  background: inherit;
}
.modal .tablewrap {
  overflow-x: hidden;
}
.modal .tablewrap table {
  min-width: 0;
}
.import-progress-modal .card {
  width: min(520px, calc(100vw - 32px));
}
.import-progress-modal progress {
  width: 100%;
  height: 18px;
  margin: 20px 0 12px;
  accent-color: var(--button-bg, #176b72);
}
.import-progress-modal [data-progress-label],
.import-progress-modal [data-progress-count] {
  display: block;
  margin-top: 6px;
}
.error-text {
  color: #b42318;
}
.relation-action {
  min-width: 190px;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.attendance {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.wide-modal .card {
  width: min(1050px, 96vw);
}
.attendance-detail {
  grid-template-columns: minmax(160px, 1fr) 170px minmax(180px, 1fr) minmax(
      180px,
      1fr
    );
}
.student-card-header {
  display: none;
}
.student-card-identity {
  display: grid;
  gap: 3px;
}
.student-card-identity small {
  color: #66736b;
}
.student-selected-status,
.gesture-feedback {
  display: none;
}
.attachment-field {
  margin: 0;
  font-size: 0.78rem;
  display: grid;
  grid-template-columns: auto auto minmax(110px, 1fr);
  gap: 8px;
  align-items: center;
}
.attachment-action {
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  font-size: 1.15rem;
}
.attachment-action img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.attachment-field small {
  overflow-wrap: anywhere;
}
.mobile-camera-action,
.mobile-gesture-map,
.status-flash {
  display: none;
}
.attendance-note-field {
  margin: 0;
  font-size: 0.78rem;
}
.attendance-note-field input {
  margin-top: 4px;
}
.mobile-status-actions,
.mobile-swipe-guide,
.mobile-attendance-navigation {
  display: none;
}

/* Cabecera multinivel: permanece disponible aunque el contenido sea extenso. */
.shell {
  display: block;
  min-height: 100vh;
}
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 74px;
  padding: 10px 22px;
  background: var(--nav-background);
  color: var(--nav-text);
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 3px 18px #0003;
}
.header .brand {
  margin: 0;
  flex: 0 0 auto;
}
.header .nav {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}
.header .nav > button,
.header summary {
  background: transparent;
  color: var(--nav-text);
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 750;
  list-style: none;
  white-space: nowrap;
}
.header summary::-webkit-details-marker {
  display: none;
}
.header details {
  position: relative;
}
.header .menu-root > summary::after,
.header .mega-menu details > summary::after {
  content: " ▾";
  font-size: 0.7em;
}
.header .mega-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(860px, 92vw);
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  color: #17201b;
  box-shadow: 0 15px 45px #0004;
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 8px;
}
.header .mega-menu details {
  border: 1px solid var(--line);
  border-radius: 10px;
}
.header .mega-menu summary {
  color: #17201b;
  padding: 12px;
}
.header .mega-menu details > div {
  padding: 0 8px 8px;
}
.header .mega-menu button {
  display: block;
  width: 100%;
  text-align: left;
  margin: 2px 0;
  background: #f2f6f3;
  color: #193525;
}
.header .nav button:hover,
.header .nav button.active,
.header summary:hover {
  background: #ffffff1c;
}
.header .user {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--nav-text);
  white-space: nowrap;
}
.header .user small {
  display: block;
  opacity: 0.8;
}
.menu-toggle {
  display: none;
  background: transparent;
  color: var(--nav-text);
  font-size: 1.5rem;
}
.wysiwyg-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid #ccd7cf;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: #f4f7f4;
}
.wysiwyg-toolbar button {
  padding: 7px 11px;
}
.wysiwyg {
  min-height: 220px;
  padding: 14px;
  border: 1px solid #ccd7cf;
  border-radius: 0 0 10px 10px;
  background: #fff;
  overflow: auto;
}
.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
}
.row-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 92px;
}
.wysiwyg-toolbar select {
  width: auto;
  min-width: 110px;
  padding: 7px;
}
.wysiwyg-toolbar input[type="color"] {
  width: 42px;
  height: 38px;
  padding: 3px;
}
.wysiwyg table {
  max-width: 100%;
}
.wysiwyg img {
  max-width: 100%;
  height: auto;
}
.master-detail .detail-row > td {
  padding: 0;
  background: #f7faf8;
}
.master-detail .detail-content {
  padding: 18px;
}
#toast {
  position: fixed;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--toast-desktop-background, #17201b);
  color: var(--toast-desktop-text, #fff);
  padding: 12px 18px;
  border-radius: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow-wrap: anywhere;
  transition:
    opacity 0.2s,
    transform 0.2s,
    visibility 0.2s;
  z-index: 1200;
}
#toast.show {
  opacity: 1;
  visibility: visible;
}
.toast-line {
  display: block;
  line-height: 1.4;
}
.toast-line + .toast-line {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid currentColor;
  border-top-color: color-mix(in srgb, currentColor 24%, transparent);
}
#toast.toast-top-left {
  top: 18px;
  left: 18px;
  transform: translateY(-16px);
}
#toast.toast-top-center {
  top: 18px;
  left: 50%;
  transform: translate(-50%, -16px);
}
#toast.toast-top-right {
  top: 18px;
  right: 18px;
  transform: translateY(-16px);
}
#toast.toast-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
}
#toast.toast-bottom-left {
  bottom: 18px;
  left: 18px;
  transform: translateY(16px);
}
#toast.toast-bottom-center {
  bottom: 18px;
  left: 50%;
  transform: translate(-50%, 16px);
}
#toast.toast-bottom-right {
  right: 18px;
  bottom: 18px;
  transform: translateY(16px);
}
#toast.show.toast-top-left,
#toast.show.toast-top-right,
#toast.show.toast-bottom-left,
#toast.show.toast-bottom-right {
  transform: translateY(0);
}
#toast.show.toast-top-center,
#toast.show.toast-bottom-center {
  transform: translateX(-50%);
}
#toast.show.toast-center {
  transform: translate(-50%, -50%) scale(1);
}
.processing-modal {
  z-index: 2000;
  cursor: wait;
  background: color-mix(
    in srgb,
    var(--processing-overlay, #0a1612) 82%,
    transparent
  );
}
.processing-modal .card {
  width: min(380px, calc(100vw - 32px));
  text-align: center;
  overflow: hidden;
  background: var(--processing-card, #fff);
  color: var(--processing-text, #17201b);
}
.processing-modal progress {
  width: 100%;
  height: 16px;
  margin: 18px 0 10px;
  accent-color: var(--processing-accent, var(--nav-background));
}
.processing-message,
.processing-hint {
  display: grid;
  gap: 6px;
}
.processing-line,
.processing-hint-line {
  display: block;
  line-height: 1.4;
}
.processing-line {
  font-weight: 800;
}
.processing-hint {
  margin-top: 12px;
  opacity: 0.76;
}
.toast-settings {
  margin-top: 18px;
}
.toast-config-grid,
.toast-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.toast-config-grid section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
@media (max-width: 800px) {
  .login {
    grid-template-columns: 1fr;
  }
  .hero {
    min-height: 30vh;
    padding: 40px 25px;
  }
  .hero h1 {
    font-size: 3rem;
  }
  .login-logo {
    width: min(100%, 320px);
    max-height: 120px;
    margin-bottom: 16px;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .side {
    height: auto;
    position: static;
    padding: 14px;
  }
  .brand {
    margin: 2px 8px 10px;
  }
  .nav {
    display: flex;
    overflow: auto;
  }
  .nav button {
    white-space: nowrap;
  }
  .user {
    display: none;
  }
  .main {
    padding: 20px;
  }
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  .top {
    align-items: flex-start;
  }
  .row {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 440px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .attendance {
    grid-template-columns: 1fr;
  }
  .top h1 {
    font-size: 1.55rem;
  }
}
