.dept-card-name {
  margin-top: 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--admin-text);
  line-height: 1.2;
  word-break: break-word;
}

.dept-people {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dept-person {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--admin-text);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.dept-person-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dept-person-time {
  flex-shrink: 0;
  color: var(--admin-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.dept-person-empty {
  color: var(--admin-muted);
  font-weight: 500;
  font-style: italic;
}

.dept-stats {
  margin-top: 0.75rem;
}

.dept-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

.dept-stat:hover {
  border-bottom-color: var(--admin-primary);
  color: inherit;
}

.dept-stat:hover .dept-stat-label,
.dept-stat:hover .dept-stat-value {
  color: var(--admin-primary);
}

.clock-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.clock-date {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--admin-text);
}

.clock-time {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--admin-primary);
  font-variant-numeric: tabular-nums;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 48px;
  padding: 0.78rem 0.9rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--admin-sidebar-text);
  font-weight: 700;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}

.nav-group-toggle:hover,
.nav-group-toggle:focus {
  background: var(--admin-sidebar-soft);
  color: var(--admin-sidebar-text-strong);
  transform: translateX(2px);
}

.nav-group-toggle.active,
.nav-group-toggle[aria-expanded="true"] {
  background: var(--admin-sidebar-soft);
  color: var(--admin-sidebar-text-strong);
}

.nav-chevron {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--admin-sidebar-muted);
  transition: transform 0.2s ease;
}

.nav-group-toggle[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

.nav-group-menu {
  display: grid;
  gap: 0.35rem;
  padding-left: 0.9rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.nav-group-menu.expanded {
  max-height: 260px;
  opacity: 1;
}

.nav-group-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 38px;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  color: var(--admin-sidebar-text);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}

.nav-group-link:hover,
.nav-group-link:focus {
  background: var(--admin-sidebar-soft);
  color: var(--admin-sidebar-text-strong);
}

.nav-group-link.active {
  background: var(--admin-sidebar-soft);
  color: var(--admin-sidebar-text-strong);
  box-shadow: inset 3px 0 0 var(--admin-primary);
}

body.sidebar-mini .nav-group-toggle {
  justify-content: center;
  padding-inline: 0.65rem;
}

body.sidebar-mini .nav-group-menu {
  max-height: 0;
  opacity: 0;
}

body.sidebar-mini .nav-chevron {
  width: 0;
  opacity: 0;
  overflow: hidden;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 3rem 1.5rem;
  border: 2px dashed rgba(128, 128, 128, 0.45);
  border-radius: 12px;
  background: rgba(128, 128, 128, 0.04);
  text-align: center;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
  outline: 0;
}

.dropzone:hover,
.dropzone:focus {
  background: rgba(128, 128, 128, 0.09);
  border-color: var(--admin-primary);
}

.dropzone.dropzone-active {
  background: rgba(128, 128, 128, 0.12);
  border-color: var(--admin-primary);
}

.dropzone-icon {
  font-size: 2.2rem;
  line-height: 1;
  color: var(--admin-primary);
}

.dropzone-title {
  margin: 0;
  font-weight: 700;
  color: var(--admin-text);
}

.conoc-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.9rem 0.25rem 0.25rem;
}

.conoc-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 96px;
  padding: 7px 4px 6px;
  border-radius: 9px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease;
}

.conoc-item:hover {
  background: rgba(128, 128, 128, 0.12);
}

.conoc-preview {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 7px;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.conoc-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.conoc-icon {
  font-size: 2rem;
  line-height: 1;
  color: var(--admin-muted);
}

.conoc-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--admin-text);
  word-break: break-word;
  max-width: 100%;
}

.conoc-ext {
  position: absolute;
  right: -2px;
  bottom: -2px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.conoc-empty {
  border: 1px dashed rgba(128, 128, 128, 0.35);
  border-radius: 10px;
  padding: 2rem 1rem;
  width: 100%;
}

.conoc-trash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border: 2px dashed rgba(128, 128, 128, 0.45);
  border-radius: 12px;
  color: var(--admin-muted);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.conoc-trash:hover {
  border-color: #dc3545;
  color: #dc3545;
  background: rgba(220, 53, 69, 0.08);
}

.conoc-trash.active {
  border-color: #dc3545;
  color: #fff;
  background: #dc3545;
  transform: scale(1.08);
}

.conoc-item[draggable="true"]:active {
  cursor: grabbing;
}

.task-editor {
  display: flex;
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
}

.task-editor-gutter {
  flex-shrink: 0;
  width: 3rem;
  padding: 0.5rem 0.4rem;
  text-align: right;
  color: var(--admin-muted);
  background: rgba(128, 128, 128, 0.08);
  border-right: 1px solid rgba(128, 128, 128, 0.2);
  overflow: hidden;
  user-select: none;
}

.task-editor-input {
  flex: 1;
  min-height: 460px;
  padding: 0.5rem 0.75rem;
  border: 0;
  outline: 0;
  resize: vertical;
  background: transparent;
  color: var(--admin-text);
  white-space: pre;
  overflow: auto;
}

.task-editor-clasif {
  display: block;
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  padding: 0;
}

.clasif-editor {
  display: flex;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
}

.clasif-editor-gutter {
  flex-shrink: 0;
  width: 3rem;
  padding: 0.5rem 0.4rem;
  text-align: right;
  color: var(--admin-muted);
  background: rgba(128, 128, 128, 0.08);
  border-right: 1px solid rgba(128, 128, 128, 0.2);
  overflow: hidden;
  user-select: none;
}

.clasif-editor-input {
  flex: 1;
  min-height: 360px;
  padding: 0.5rem 0.75rem;
  border: 0;
  outline: 0;
  resize: vertical;
  background: transparent;
  color: var(--admin-text);
  white-space: pre;
  overflow: auto;
}

.nav-link-clasif-vacio {
  color: var(--admin-muted) !important;
  font-style: italic;
}

.dept-stat-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--admin-muted);
}

.dept-stat-value {
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--admin-text);
}

.task-line {
  border: 0;
  border-top: 2px solid rgba(128, 128, 128, 0.65);
  margin: 0.75rem 0;
}

.task-title-row {
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--admin-text);
  background: rgba(128, 128, 128, 0.12);
  border-radius: 8px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  background: rgba(128, 128, 128, 0.04);
}

.task-item-clickable {
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.task-item-clickable:hover {
  background: rgba(128, 128, 128, 0.1);
  border-color: rgba(128, 128, 128, 0.4);
}

.task-time {
  flex-shrink: 0;
  width: 3.4rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.task-time-important {
  background: #dc3545;
  color: #ffffff;
  border-radius: 6px;
  padding: 2px 6px;
  width: auto;
  text-align: center;
}

.task-item-important .task-desc {
  color: #dc3545;
}

.task-done-late .task-checkmark,
.task-done-late .task-done-time {
  color: #dc3545;
}

.task-late-diff {
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  background: #dc3545;
  border-radius: 6px;
  padding: 1px 6px;
}

.task-done-by {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--admin-muted);
  white-space: nowrap;
}

.task-desc {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--admin-text);
  overflow-wrap: break-word;
}

.task-done {
  flex-shrink: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--admin-muted);
  white-space: nowrap;
}

.task-checkmark {
  color: #198754;
  font-size: 1.05rem;
}

.task-ev {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--admin-muted);
  font-weight: 600;
}

.task-ev-cell {
  color: var(--admin-primary);
}

.last-incident {
  display: block;
  padding-top: 0.25rem;
  text-decoration: none;
  color: inherit;
}

.last-incident-disabled {
  cursor: default;
}

.last-incident-label {
  display: block;
  color: var(--admin-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.last-incident-text {
  margin: 0;
  color: var(--admin-text);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.last-incident-icon {
  color: var(--admin-primary);
  margin-right: 0.4rem;
}

.inc-desc {
  display: block;
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inc-row {
  cursor: pointer;
}

.inc-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.inc-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: var(--admin-muted);
  font-size: 1.1rem;
}

.inc-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.inc-media-grid img,
.inc-media-grid video {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
  background: #000;
}

.inc-media-photo {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.lightbox-toolbar {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding-bottom: 0.75rem;
}

.lightbox-toolbar .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  font-size: 1.15rem;
  background: rgba(15, 23, 42, 0.65) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: none;
}

.lightbox-toolbar .icon-button:hover {
  background: rgba(15, 23, 42, 0.9) !important;
  color: #fff !important;
  border-color: #fff;
}

.lightbox-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  touch-action: none;
}

.lightbox-stage:active {
  cursor: grabbing;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  will-change: transform;
}

/* Chat directo con el LLM (Conocimiento > Consulta) */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 290px);
  min-height: 360px;
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-msg {
  max-width: min(780px, 86%);
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.chat-msg-user {
  align-self: flex-end;
  background: var(--admin-primary, #2563eb);
  color: #fff;
}

.chat-msg-assistant {
  align-self: flex-start;
  background: rgba(128, 128, 128, 0.1);
  color: var(--admin-text, #0f172a);
}

.chat-msg-assistant p:last-child {
  margin-bottom: 0;
}

.chat-msg-assistant pre {
  background: rgba(0, 0, 0, 0.7);
  color: #e2e8f0;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.82rem;
}

.chat-msg-assistant code {
  background: rgba(0, 0, 0, 0.12);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.86em;
}

.chat-msg-assistant pre code {
  background: transparent;
  padding: 0;
}

.chat-msg-assistant table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0;
}

.chat-msg-assistant th,
.chat-msg-assistant td {
  border: 1px solid rgba(128, 128, 128, 0.4);
  padding: 0.35rem 0.6rem;
  font-size: 0.88rem;
}

.chat-msg-assistant ul,
.chat-msg-assistant ol {
  margin: 0.35rem 0;
  padding-left: 1.4rem;
}

.chat-typing {
  color: var(--admin-muted, #64748b);
  font-style: italic;
}

.chat-composer {
  flex-shrink: 0;
  border-top: 1px solid rgba(128, 128, 128, 0.2);
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-composer textarea {
  flex: 1;
  resize: vertical;
  min-height: 46px;
  max-height: 160px;
}

/* Configuración de modelos (Conocimiento > Configuración) */
.llm-mask {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--admin-text, #0f172a);
}

.llm-url {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--admin-muted, #64748b);
}

.llm-table th {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--admin-muted, #64748b);
}

.llm-table td {
  font-size: 0.9rem;
}
