:root {
  --orange: #f97316;
  --orange-soft: #fff1e7;
  --blue: #1378bd;
  --cyan: #08a8df;
  --ink: #1f2937;
  --muted: #64748b;
  --line: #d7dee8;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ok: #14804a;
  --warn: #9a5b00;
  --danger: #b42318;
  --shadow: 0 14px 38px rgba(30, 41, 59, 0.11);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(340px, 450px) 1fr;
  background: linear-gradient(120deg, #ffffff 0%, #ffffff 42%, #eef7fc 42%, #eef7fc 100%);
}

.login-panel {
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.login-art {
  padding: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand {
  max-width: 360px;
  width: 100%;
  height: auto;
}

.login-card,
.panel,
.modal-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card {
  padding: 24px;
}

.eyebrow {
  color: var(--blue);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 17px;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.author-credit {
  color: var(--blue);
  font-weight: 700;
  margin-top: 14px;
}

.login-notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 4px solid var(--blue);
  background: #eef7fc;
  color: #334155;
  font-size: 14px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  font-weight: 650;
  color: #334155;
  font-size: 13px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input[readonly],
.field input:disabled {
  background: #f1f5f9;
  color: #475569;
  cursor: not-allowed;
  user-select: none;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 48px;
}

.icon-btn {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  cursor: pointer;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover,
.password-toggle.is-visible {
  background: #e9eef5;
  color: var(--blue);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.btn {
  min-height: 40px;
  border-radius: 6px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  background: #e9eef5;
  color: #1e293b;
}

.btn.primary {
  background: var(--blue);
  color: #fff;
}

.btn.orange {
  background: var(--orange);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  color: var(--blue);
}

.btn.danger {
  background: #fee4e2;
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.btn.loading {
  background: #0f5f9f;
  color: #fff;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 262px 1fr;
}

.mobile-menu-button,
.mobile-nav-close,
.sidebar-backdrop {
  display: none;
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #f1f5f9;
}

.sidebar::-webkit-scrollbar {
  width: 9px;
}

.sidebar::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border: 2px solid #f1f5f9;
  border-radius: 6px;
}

.sidebar .brand {
  max-width: 210px;
}

.user-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.user-chip strong {
  display: block;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  text-align: left;
  background: transparent;
  color: #334155;
  border-radius: 6px;
  padding: 10px 12px;
  font-weight: 700;
}

.nav button.active {
  background: var(--orange-soft);
  color: #9a4b00;
}

.content {
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.topbar,
.panel-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel {
  padding: 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.stat b {
  display: block;
  font-size: 28px;
  color: var(--blue);
}

.filters {
  display: grid;
  grid-template-columns: minmax(210px, 1.3fr) repeat(6, minmax(130px, 0.7fr));
  gap: 10px;
  margin-top: 14px;
}

.condom-report-filters,
.tracked-filters {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.gam-attendance-report-filters {
  grid-template-columns: repeat(2, minmax(210px, 1fr));
  max-width: 720px;
}

.tracked-summary-report-filters {
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  max-width: 920px;
}

.monitoring-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: 10px;
}

.monitoring-filters select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.monitoring-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 28px;
}

.monitoring-bars {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.monitoring-bar-row {
  display: grid;
  grid-template-columns: 90px minmax(120px, 1fr) 42px minmax(150px, auto);
  align-items: center;
  gap: 10px;
}

.monitoring-bar-row small,
.monitoring-table small {
  color: var(--muted);
}

.monitoring-bar-track {
  height: 18px;
  overflow: hidden;
  border-radius: 4px;
  background: #e8eef5;
}

.monitoring-bar-track span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--blue);
}

.modality-legend {
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

.presencial-dot,
.virtual-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 5px 0 10px;
  border-radius: 50%;
  background: var(--orange);
}

.virtual-dot {
  background: var(--cyan);
}

.modality-columns {
  min-height: 190px;
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  align-items: end;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 0 4px 8px;
}

.modality-columns div {
  min-height: 54px;
  display: grid;
  align-content: end;
  gap: 3px;
  text-align: center;
}

.modality-columns b,
.modality-columns span {
  display: block;
  padding: 5px 2px;
  color: #fff;
  background: var(--orange);
  font-size: 13px;
}

.modality-columns span {
  background: var(--cyan);
}

.modality-columns small {
  color: var(--muted);
  font-weight: 700;
}

.monitoring-table th,
.monitoring-table td {
  min-width: 150px;
}

.monitoring-table th:first-child,
.monitoring-table td:first-child {
  min-width: 210px;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #334155;
  background: #f8fafc;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  background: #dcfae6;
  color: var(--ok);
}

.badge.warn {
  background: #fff1cc;
  color: var(--warn);
}

.badge.danger {
  background: #fee4e2;
  color: var(--danger);
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tabs button {
  border-radius: 6px;
  padding: 9px 12px;
  font-weight: 800;
  background: #e9eef5;
  color: #334155;
}

.tabs button.active {
  background: var(--blue);
  color: #fff;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 9px;
  margin: 8px 0 16px;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.notice {
  background: #edf7fd;
  border-left: 4px solid var(--cyan);
  padding: 12px 14px;
  border-radius: 6px;
  color: #0f5177;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: none;
  align-items: start;
  justify-content: center;
  padding: 24px;
  overflow: auto;
}

.modal.open {
  display: flex;
}

.modal-box {
  width: min(980px, 100%);
  padding: 18px;
}

.help {
  font-size: 13px;
  color: var(--muted);
}

.empty {
  text-align: center;
  padding: 28px;
  color: var(--muted);
}

@media (max-width: 920px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-art {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    padding: 24px 18px;
    justify-content: flex-start;
  }

  .login-panel .brand {
    max-width: 260px;
    margin: 0 auto;
  }

  .login-card {
    padding: 18px;
  }

  .app-shell {
    display: block;
  }

  .mobile-menu-button {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 12px;
    z-index: 70;
    width: 46px;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.16);
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 5px;
  }

  .mobile-menu-button span {
    width: 22px;
    height: 2px;
    background: #334155;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 58;
    background: rgba(15, 23, 42, 0.48);
  }

  .sidebar-backdrop.visible {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(84vw, 320px);
    height: 100dvh;
    padding: 18px;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.22);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar .brand {
    max-width: 190px;
    padding-right: 34px;
  }

  .mobile-nav-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: block;
    border-radius: 6px;
    background: #eef2f7;
    color: #334155;
  }

  .mobile-nav-close::before,
  .mobile-nav-close::after {
    content: "";
    position: absolute;
    top: 19px;
    left: 10px;
    width: 20px;
    height: 2px;
    background: currentColor;
  }

  .mobile-nav-close::before {
    transform: rotate(45deg);
  }

  .mobile-nav-close::after {
    transform: rotate(-45deg);
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open .mobile-menu-button,
  body.modal-open .mobile-menu-button {
    opacity: 0;
    pointer-events: none;
  }

  .nav button,
  .sidebar > .btn {
    min-height: 46px;
  }

  .content {
    padding: 72px 14px 24px;
    gap: 14px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
  }

  .topbar > .actions,
  .panel-head > .actions,
  .bulk-actions {
    width: 100%;
  }

  .topbar > .actions .btn,
  .bulk-actions .btn {
    flex: 1 1 180px;
  }

  .panel {
    padding: 14px;
    overflow: hidden;
  }

  .modal {
    padding: 8px;
  }

  .modal-box {
    width: 100%;
    padding: 14px;
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
  }

  .modal-box > .panel-head {
    position: sticky;
    top: -14px;
    z-index: 4;
    margin: -14px -14px 10px;
    padding: 14px;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }

  .modal .form-grid > .actions {
    position: sticky;
    bottom: -14px;
    z-index: 3;
    margin: 4px -14px -14px;
    padding: 12px 14px max(12px, env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--line);
  }

  .modal .form-grid > .actions .btn {
    flex: 1 1 160px;
    min-height: 46px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  input[type="file"] {
    max-width: 100%;
    overflow: hidden;
  }

  .table-wrap {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
  }

  .table-wrap table {
    min-width: 760px;
    margin-top: 0;
  }

  .stats,
  .filters,
  .monitoring-filters,
  .monitoring-grid,
  .row,
  .row.three,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .monitoring-bar-row {
    grid-template-columns: 76px minmax(90px, 1fr) 32px;
  }

  .monitoring-bar-row small {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 21px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .stat {
    min-width: 0;
    padding: 12px;
  }

  .stat b {
    font-size: 24px;
  }

  .stat span {
    display: block;
    font-size: 13px;
    overflow-wrap: anywhere;
  }

  .topbar > .actions,
  .bulk-actions,
  .modal .form-grid > .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar > .actions .btn,
  .bulk-actions .btn,
  .modal .form-grid > .actions .btn {
    width: 100%;
  }

  .monitoring-bar-row {
    grid-template-columns: 72px minmax(70px, 1fr) 28px;
    gap: 7px;
  }

  .modality-columns {
    gap: 5px;
  }

  .notice {
    padding: 10px;
    overflow-wrap: anywhere;
  }
}
