:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-subtle: #fafbfd;
  --chip-bg: #f1f2f6;
  --chip-bg-hover: #e2e5ee;
  --accent-subtle: #eef2ff;
  --accent-subtle-hover: #e0e7ff;
  --border: #e2e6f0;
  --text: #1f2430;
  --text-muted: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --ok: #059669;
  --ok-bg: #d1fae5;
  --pending: #d97706;
  --pending-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-bg-hover: #fecaca;
  --radius: 10px;
  --scrim: rgba(15, 18, 30, 0.35);
  --scrim-strong: rgba(15, 18, 30, 0.45);
  --shadow: rgba(15, 18, 30, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161f;
    --surface: #1c1f2b;
    --surface-subtle: #20232f;
    --chip-bg: #2a2e3d;
    --chip-bg-hover: #333748;
    --accent-subtle: #262b45;
    --accent-subtle-hover: #2e3455;
    --border: #333748;
    --text: #e5e7f0;
    --text-muted: #98a0b3;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --ok: #34d399;
    --ok-bg: #0f3d2e;
    --pending: #fbbf24;
    --pending-bg: #4a3411;
    --danger: #f87171;
    --danger-bg: #4c1d1d;
    --danger-bg-hover: #5c2424;
    --scrim: rgba(0, 0, 0, 0.55);
    --scrim-strong: rgba(0, 0, 0, 0.65);
    --shadow: rgba(0, 0, 0, 0.35);
  }
}

/* Elección explícita de tema (botones Claro/Oscuro/Sistema) — gana siempre
   sobre la preferencia del sistema operativo definida arriba, por mayor
   especificidad del selector. "Sistema" no fija data-theme, así que cae en
   el bloque @media de arriba. */
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-subtle: #fafbfd;
  --chip-bg: #f1f2f6;
  --chip-bg-hover: #e2e5ee;
  --accent-subtle: #eef2ff;
  --accent-subtle-hover: #e0e7ff;
  --border: #e2e6f0;
  --text: #1f2430;
  --text-muted: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --ok: #059669;
  --ok-bg: #d1fae5;
  --pending: #d97706;
  --pending-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-bg-hover: #fecaca;
  --scrim: rgba(15, 18, 30, 0.35);
  --scrim-strong: rgba(15, 18, 30, 0.45);
  --shadow: rgba(15, 18, 30, 0.12);
}
:root[data-theme="dark"] {
  --bg: #14161f;
  --surface: #1c1f2b;
  --surface-subtle: #20232f;
  --chip-bg: #2a2e3d;
  --chip-bg-hover: #333748;
  --accent-subtle: #262b45;
  --accent-subtle-hover: #2e3455;
  --border: #333748;
  --text: #e5e7f0;
  --text-muted: #98a0b3;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --ok: #34d399;
  --ok-bg: #0f3d2e;
  --pending: #fbbf24;
  --pending-bg: #4a3411;
  --danger: #f87171;
  --danger-bg: #4c1d1d;
  --danger-bg-hover: #5c2424;
  --scrim: rgba(0, 0, 0, 0.55);
  --scrim-strong: rgba(0, 0, 0, 0.65);
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.navbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.navbar-brand a { font-weight: 700; font-size: 18px; color: var(--text); }
.navbar-links { display: flex; gap: 18px; flex: 1; }
.navbar-links a { color: var(--text-muted); font-weight: 500; }
.navbar-user { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 14px; }
.theme-switcher {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.theme-switch-btn {
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  padding: 5px 9px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}
.theme-switch-btn:hover { background: var(--chip-bg); }
.theme-switch-btn + .theme-switch-btn { border-left: 1px solid var(--border); }
.theme-switch-btn.active { background: var(--accent-subtle); }
.role-tag {
  display: inline-block;
  background: var(--accent-subtle);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 4px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 24px; }
.page-head-actions { display: flex; align-items: center; gap: 12px; }

.view-switcher {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.view-switch-btn {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
}
.view-switch-btn:hover { background: var(--bg); text-decoration: none; }
.view-switch-btn + .view-switch-btn { border-left: 1px solid var(--border); }
.view-switch-btn.active { background: var(--primary); color: #fff; }
.view-switch-btn.active:hover { background: var(--primary); }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-number { font-size: 28px; font-weight: 700; }
.stat-label { color: var(--text-muted); font-size: 13px; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.table th {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.table tr:last-child td { border-bottom: none; }
.empty-row { text-align: center; color: var(--text-muted); padding: 24px; }

.row-priority-baja { background: color-mix(in srgb, #0369a1 12%, var(--surface)); }
.row-priority-baja td:first-child { border-left: 3px solid #0369a1; }
.row-priority-media { background: var(--accent-subtle); }
.row-priority-media td:first-child { border-left: 3px solid var(--primary); }
.row-priority-alta { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.row-priority-alta td:first-child { border-left: 3px solid var(--danger); }
.row-priority-critica { background: color-mix(in srgb, #831843 18%, var(--surface)); }
.row-priority-critica td:first-child { border-left: 3px solid #831843; }

.row-status-pendiente { background: var(--pending-bg); }
.row-status-pendiente td:first-child { border-left: 3px solid var(--pending); }
.row-status-en_desarrollo { background: color-mix(in srgb, #2563eb 14%, var(--surface)); }
.row-status-en_desarrollo td:first-child { border-left: 3px solid #2563eb; }
.row-status-resuelto { background: var(--ok-bg); }
.row-status-resuelto td:first-child { border-left: 3px solid var(--ok); }
.row-status-cerrado { background: var(--chip-bg); }
.row-status-cerrado td:first-child { border-left: 3px solid var(--text-muted); }

.category-group { margin-bottom: 16px; }
.category-group-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--accent-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
}
.category-group-header:hover { background: var(--accent-subtle-hover); }
.category-group[open] .category-group-header { border-radius: 8px 8px 0 0; margin-bottom: 0; }
.category-group[open] .table { border-top-left-radius: 0; border-top-right-radius: 0; }

.ticket-desc { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-pending { background: var(--pending-bg); color: var(--pending); }
.badge-empty { background: var(--chip-bg); color: var(--text-muted); }
.badge-priority-baja { background: color-mix(in srgb, #0369a1 20%, var(--surface)); color: #0369a1; }
.badge-priority-media { background: var(--accent-subtle); color: var(--primary-hover); }
.badge-priority-alta { background: var(--danger-bg); color: var(--danger); }
.badge-priority-critica { background: #831843; color: #fce7f3; }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--pending-bg); color: var(--pending); }
.badge-progress { background: color-mix(in srgb, #2563eb 20%, var(--surface)); color: #2563eb; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--chip-bg); color: var(--text); }
.btn-secondary:hover { background: var(--chip-bg-hover); }
.btn-small { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg-hover); }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-reset-form { display: flex; gap: 6px; }
.inline-reset-form input {
  width: 130px;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.link-button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}
.link-button:hover { text-decoration: underline; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.form label[hidden] { display: none; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
}
input:not([type="checkbox"]):not([type="radio"]):focus, textarea:focus, select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.auth-card {
  max-width: 380px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.auth-card h1 { margin-top: 0; font-size: 22px; }
.auth-alt { margin-top: 16px; font-size: 13px; color: var(--text-muted); text-align: center; }

.alert {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-success { background: var(--ok-bg); color: var(--ok); }

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card h3 { margin-top: 0; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 120px; }

.monday-fieldset {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.monday-fieldset legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.checkbox-row { display: flex; gap: 14px; flex-wrap: wrap; }
.member-search-input { margin-bottom: -2px; }
.member-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
}
.checkbox-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  text-transform: none;
  color: var(--text);
}
.checkbox-label input { width: auto; padding: 0; }

.code-block {
  background: #101423;
  color: #e6e8f0;
  padding: 14px;
  border-radius: 8px;
  font-size: 12.5px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.ticket-meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ticket-description { white-space: pre-wrap; margin-bottom: 16px; }
.attachment-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.attachment-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9em;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  width: fit-content;
}
.attachment-link:hover { text-decoration: underline; }
.ticket-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  font-size: 14px;
}

.comment-thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.comment {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface-subtle);
}
.comment-cliente { background: var(--accent-subtle); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.comment-borrador { background: var(--pending-bg); border-color: color-mix(in srgb, var(--pending) 45%, var(--border)); }
.approval-actions { display: flex; gap: 10px; align-items: flex-end; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.approval-actions textarea { width: 100%; font-size: 13px; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.comment p { margin: 0; white-space: pre-wrap; font-size: 14px; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.side-panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 50;
}
.side-panel-backdrop.open { display: block; }
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 480px;
  max-width: 92vw;
  background: var(--surface);
  box-shadow: -8px 0 24px var(--shadow);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease;
}
.side-panel-backdrop.open .side-panel { transform: translateX(0); }
.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.side-panel-header h3 { margin: 0; font-size: 16px; }
.side-panel-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
}
.side-panel-close:hover { color: var(--text); }
.side-panel-body { flex: 1; overflow-y: auto; padding: 20px; }

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--scrim-strong);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  /* Si el formulario es más alto que la ventana, el modal hace scroll interno
     (antes se desbordaba y los botones quedaban fuera de alcance). */
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
/* Solo DENTRO del modal: barra de acciones pegada abajo, siempre visible aunque
   se scrollee. (Fuera del modal, .modal-actions queda como estaba.) */
.modal .modal-actions {
  position: sticky;
  bottom: -28px;
  background: var(--surface);
  padding: 12px 0;
  margin-top: 16px;
}

.dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-subtle);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dropzone-over {
  border-color: var(--primary);
  background: var(--accent-subtle);
}
.dropzone-input { display: none; }
.dropzone-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.dropzone-icon { font-size: 18px; }
.dropzone-browse { color: var(--primary); text-decoration: underline; }
.dropzone-filelist {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  text-align: left;
}
.dropzone-filelist li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px 4px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dropzone-remove {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.dropzone-remove:hover { background: var(--chip-bg); color: var(--danger); }

a.stat-card {
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
a.stat-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: 0 6px 14px var(--shadow);
}
.stat-card-color { border: none; color: #fff; }
.stat-card-color .stat-label { color: rgba(255, 255, 255, 0.85); }
.stat-card-blue { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.stat-card-red { background: linear-gradient(135deg, #f87171, #dc2626); }
.stat-card-yellow { background: linear-gradient(135deg, #fbbf24, #d97706); }
.stat-card-green { background: linear-gradient(135deg, #34d399, #059669); }
.stat-card-purple { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.stat-card-teal { background: linear-gradient(135deg, #2dd4bf, #0d9488); }

.board {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
}
.board-column {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 280px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
}
.board-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}
.board-col-pendiente { background: linear-gradient(135deg, #fbbf24, #d97706); }
.board-col-desarrollo { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.board-col-resuelto { background: linear-gradient(135deg, #34d399, #059669); }
.board-col-cerrado { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.board-column-count {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
}
.board-column-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
}
.board-column-empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 12px 0; }
.board-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 2px var(--shadow);
}
.board-card-title { font-weight: 600; font-size: 14px; color: var(--text); }
.board-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.board-card-category, .board-card-assignee { font-size: 12px; color: var(--text-muted); }
.board-card-actions { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.board-card-actions form { display: inline; }
.board-card[draggable="true"] { cursor: grab; }
.board-card.dragging { opacity: 0.4; }
.board-card.board-card-moving { opacity: 0.5; pointer-events: none; }
.board-column-body-over { background: var(--accent-subtle); outline: 2px dashed var(--primary); outline-offset: -2px; }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.cal-nav-label { margin: 0; font-size: 17px; text-transform: capitalize; }

.cal-month-grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  table-layout: fixed;
}
.cal-month-grid th {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.cal-day-cell {
  height: 84px;
  vertical-align: top;
  border: 1px solid var(--border);
  padding: 0;
}
.cal-day-empty { background: var(--surface-subtle); }
.cal-day-today { background: var(--accent-subtle); }
.cal-day-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 8px;
  color: var(--text);
}
.cal-day-link:hover { background: var(--bg); text-decoration: none; }
.cal-day-number { font-weight: 600; font-size: 13px; }
.cal-day-badge { align-self: flex-start; }

.cal-week-scroll { overflow-x: auto; margin-bottom: 20px; }
.cal-week-grid {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.cal-week-grid th {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.cal-time-col { width: 60px; font-size: 12px; color: var(--text-muted); text-align: center; white-space: nowrap; }
.cal-slot-cell {
  border: 1px solid var(--border);
  padding: 4px 6px;
  height: 30px;
  font-size: 12px;
  vertical-align: top;
}
.cal-slot-free { text-align: center; }
.cal-slot-free a {
  display: block;
  color: var(--text-muted);
  opacity: 0;
}
.cal-slot-free:hover { background: var(--bg); }
.cal-slot-free:hover a { opacity: 1; }
.cal-slot-booked { background: var(--accent-subtle); }
.cal-slot-continuation { border-top: none; }
.cal-booking-title { font-weight: 600; font-size: 12px; }
.cal-booking-user { color: var(--text-muted); font-size: 11px; }
.cal-cancel-btn { font-size: 11px; }

@media (max-width: 640px) {
  .navbar { flex-wrap: wrap; gap: 10px; }
  .container { padding: 20px 12px 40px; }
  .table { display: block; overflow-x: auto; }
}

/* ===== Shell unificado SolucionIT (barra superior + sidebar por módulo) ===== */
.topbar { display: flex; align-items: center; gap: 20px; padding: 10px 20px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; flex-wrap: wrap; }
.topbar-brand { font-weight: 700; font-size: 16px; white-space: nowrap; color: var(--text); }
.topbar-sys { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar-sys a { padding: 7px 14px; border-radius: 8px; color: var(--text-muted); font-weight: 600; text-decoration: none; }
.topbar-sys a:hover { background: var(--chip-bg); }
.topbar-sys a.active { background: var(--primary); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 14px; }
.topbar-link { color: var(--text-muted); font-weight: 600; text-decoration: none; }
.topbar-user { white-space: nowrap; }

.shell { display: flex; align-items: flex-start; }
.sidebar { flex: 0 0 210px; width: 210px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px 10px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 57px;
  align-self: stretch; min-height: calc(100vh - 57px); }
.sidebar a { padding: 9px 12px; border-radius: 8px; color: var(--text); font-weight: 500; text-decoration: none; }
.sidebar a:hover { background: var(--chip-bg); }
.sidebar-group { margin: 12px 12px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); }
/* Dentro del shell, el main deja de centrarse: ocupa el espacio junto al sidebar. */
.shell > .container { flex: 1; min-width: 0; margin: 0; max-width: none; }

@media (max-width: 768px) {
  .topbar { gap: 10px; padding: 8px 12px; }
  .topbar-user { display: none; }
  .shell { flex-direction: column; }
  .sidebar { position: static; width: auto; flex: none; min-height: 0; flex-flow: row wrap;
    border-right: none; border-bottom: 1px solid var(--border); padding: 8px 12px; gap: 6px; }
  .sidebar a { white-space: nowrap; }
  .sidebar-group { flex-basis: 100%; width: 100%; margin: 8px 4px 0; }
}
