:root {
  color-scheme: dark;
  --bg: #08090c;
  --panel: #11141a;
  --panel-2: #171b22;
  --line: #2a303a;
  --text: #f3f5f7;
  --muted: #a6afbd;
  --accent: #4995e1;
  --accent-2: #68a4ff;
  --warn: #f4c257;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(73, 149, 225, 0.16), transparent 32rem), var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, system-ui, sans-serif;
}

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #05100d;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 20, 26, 0.9);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

h1,
h2,
p {
  margin-top: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0d11;
  color: var(--text);
  padding: 12px;
  outline: none;
}

textarea {
  min-height: 58px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(73, 149, 225, 0.14);
}

input:disabled,
select:disabled,
textarea:disabled {
  color: #c2cad6;
  opacity: 0.78;
  cursor: not-allowed;
}

.error {
  min-height: 20px;
  color: var(--danger);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(8, 9, 12, 0.88);
}

.sidebar nav {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.sidebar .filter-nav {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 0;
}

.session-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.session-box .meta {
  margin-bottom: 0;
}

.small-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.view-switcher {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.nav-btn,
.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.nav-btn {
  text-align: left;
  padding-inline: 14px;
  font-weight: 700;
}

.filter-nav .nav-btn {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.date-filter {
  grid-column: 1 / -1;
  gap: 5px;
  font-size: 0.74rem;
}

.date-filter input {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 0.82rem;
}

.nav-btn.active {
  border-color: var(--accent);
  background: rgba(73, 149, 225, 0.13);
}

.workspace {
  padding: 28px;
}

.topbar,
.editor-head,
.save-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.mail-row {
  display: flex;
  justify-content: flex-end;
}

.report-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.report-actions button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 0.74rem;
  line-height: 1;
  white-space: nowrap;
}

.topbar h1,
.editor h2 {
  margin-bottom: 0;
}

.actions {
  display: flex;
  gap: 12px;
  width: min(620px, 100%);
}

.actions input {
  flex: 1 1 auto;
  min-width: 0;
}

#sortDateSelect {
  flex: 0 0 190px;
}

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

.stat {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 1.25rem;
  line-height: 1.1;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 0;
  align-items: start;
}

.mail-layout {
  min-height: calc(100vh - 220px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 20, 26, 0.74);
  overflow: hidden;
}

.event-pane {
  min-width: 0;
  min-height: calc(100vh - 220px);
  border-right: 1px solid var(--line);
  background: #0b0d11;
}

.dashboard-grid,
.admin-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.admin-grid {
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 0.8fr);
  align-items: start;
}

.wide-stats {
  margin: 0;
}

.metric-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-panel h2 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.metric-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(42, 48, 58, 0.75);
  overflow: hidden;
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-row span,
.metric-row strong {
  position: relative;
  z-index: 1;
}

.metric-row i {
  position: absolute;
  inset: auto auto 0 0;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.table-list {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0d11;
  color: var(--text);
  text-align: left;
}

.table-row.active {
  border-color: var(--accent-2);
  background: #151b25;
}

.table-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 10px;
}

.large-textarea {
  min-height: 190px;
}

.event-list {
  display: grid;
  gap: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: rgba(11, 13, 17, 0.96);
}

.pagination .ghost {
  min-height: 36px;
  padding: 0 12px;
}

.pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.event-card {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid rgba(42, 48, 58, 0.86);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.event-card:hover {
  background: rgba(73, 149, 225, 0.08);
}

.event-card.active {
  border-left: 3px solid var(--accent);
  background: rgba(73, 149, 225, 0.14);
  padding-left: 11px;
}

.event-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 850;
}

.event-title > span:first-child,
.event-meta-line,
.event-assignees {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
}

.pill.proximamente {
  color: var(--warn);
}

.pill.realizado {
  color: var(--accent);
}

.pill.en-revision {
  color: var(--accent-2);
}

.editor {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 20, 26, 0.92);
}

.report-pane {
  position: static;
  min-width: 0;
  gap: 10px;
  min-height: calc(100vh - 220px);
  max-height: none;
  overflow: visible;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: rgba(17, 20, 26, 0.96);
}

.report-pane .editor-head {
  position: static;
  z-index: 2;
  margin: -14px -14px 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 20, 26, 0.98);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.report-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.report-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 13, 17, 0.72);
}

.report-box-title {
  margin: 0;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.report-fields label {
  gap: 5px;
  font-size: 0.78rem;
}

.report-fields textarea {
  min-height: 44px;
  padding: 7px 9px;
}

.incident-details {
  display: grid;
  gap: 8px;
}

.incident-list {
  display: grid;
  gap: 8px;
}

.incident-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.45fr) minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.incident-row label {
  gap: 5px;
  font-size: 0.78rem;
}

.incident-row textarea {
  min-height: 44px;
  padding: 7px 9px;
}

.incident-remove,
.incident-add {
  min-height: 34px;
  padding: 7px 10px;
}

.danger {
  border: 1px solid rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.12);
  color: #ffd8d8;
}

#saveMessage {
  color: var(--accent);
  min-height: 20px;
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  max-width: min(340px, calc(100vw - 36px));
  padding: 12px 16px;
  border: 1px solid rgba(73, 149, 225, 0.55);
  border-radius: 8px;
  background: rgba(17, 20, 26, 0.96);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  font-size: 0.9rem;
  font-weight: 800;
  transform: translateY(0);
  opacity: 1;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.saving {
  color: var(--accent-2);
}

.toast.saved {
  border-color: rgba(104, 164, 255, 0.6);
  color: #dcecff;
}

.toast.error-toast {
  border-color: rgba(255, 107, 107, 0.62);
  color: #ffd8d8;
}

.toast.hidden {
  display: block !important;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
}

@media (max-width: 1180px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .event-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .report-pane {
    position: static;
    max-height: none;
  }

  .report-pane .editor-head {
    position: static;
    margin: -14px -14px 0;
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 18px;
  }

  .sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0;
  }

  .content-grid,
  .admin-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .editor {
    position: static;
  }

  .mail-layout,
  .event-pane {
    min-height: auto;
  }

  .mail-layout {
    overflow: visible;
  }

  .event-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .report-pane {
    max-height: none;
  }

  .report-pane .editor-head {
    position: static;
    margin: 0;
    padding: 0 0 12px;
  }
}

@media (max-width: 680px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .actions,
  .editor-head,
  .report-actions,
  .save-row,
  .mail-row {
    align-items: stretch;
    flex-direction: column;
  }


  .form-grid,
  .report-fields,
  .incident-row {
    grid-template-columns: 1fr;
  }
}
