/* =========================================================
   Sistema de diseño — Qonvoca
   Tokens de color con modo claro/oscuro, componentes y layout.
   ========================================================= */

/* Tipografía de marca: Quicksand, la misma familia redondeada de Qüid Lab
   (SIL Open Font License — ver /fonts/OFL-Quicksand.txt) */
@font-face {
  font-family: "Quicksand";
  src: url("/fonts/quicksand-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Quicksand";
  src: url("/fonts/quicksand-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Logotipo "qonvoca": minúsculas con el degradado azul→violeta de Qüid Lab.
   line-height y padding dejan espacio al rabo de la q (el degradado se recorta al texto). */
.wordmark, .grad-text {
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.wordmark { display: inline-block; font-family: "Quicksand", var(--font, sans-serif); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; padding-bottom: 1px; }

:root {
  --brand-grad: linear-gradient(90deg, #2b5ff5, #5140f5 55%, #844cf6);
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9ecf1;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --muted: #667085;
  --accent: #2b5ff5;
  --accent-hover: #1e4bd6;
  --accent-soft: #edf1ff;
  --accent-text: #2346c8;
  --success: #0f8a64;
  --success-soft: #e6f6ef;
  --warning: #b86e00;
  --warning-soft: #fff4de;
  --danger: #c9304a;
  --danger-soft: #fdecef;
  --info: #0369a1;
  --info-soft: #e0f2fe;
  --violet: #844cf6;
  --violet-soft: #f3edff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 48px rgba(16, 24, 40, 0.18);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-grad: linear-gradient(90deg, #6fc3ff, #8e9bff 55%, #b58cff);
    --bg: #0d1015;
    --surface: #151920;
    --surface-2: #1b2029;
    --surface-3: #232a35;
    --border: #272e39;
    --border-strong: #37404e;
    --text: #e9ecf1;
    --text-2: #b6bdc9;
    --muted: #8b94a4;
    --accent: #6f8cff;
    --accent-hover: #8ba2ff;
    --accent-soft: rgba(111, 140, 255, 0.14);
    --accent-text: #a9baff;
    --success: #3cc792;
    --success-soft: rgba(60, 199, 146, 0.14);
    --warning: #f0aa38;
    --warning-soft: rgba(240, 170, 56, 0.14);
    --danger: #ff6f84;
    --danger-soft: rgba(255, 111, 132, 0.14);
    --info: #52b6ea;
    --info-soft: rgba(82, 182, 234, 0.14);
    --violet: #b58cff;
    --violet-soft: rgba(181, 140, 255, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------- Botones ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 600 13px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm); text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, .input:focus-visible, .select:focus-visible, .chip:focus-visible, .nav-item:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-icon { width: 34px; padding: 0; }
.btn-block { width: 100%; }
.btn .icon { flex-shrink: 0; }

/* ---------------- Formularios ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text); }
.help { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--text-2); cursor: not-allowed; }
.input-sm, .select-sm { height: 32px; font-size: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.form-error {
  background: var(--danger-soft); color: var(--danger); border-radius: 8px;
  padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}

/* Chips seleccionables */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font: 500 13px var(--font); cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip:disabled { cursor: default; opacity: .8; }

/* Campo de etiquetas (palabras clave, especialidades) */
.tag-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px;
  padding: 5px 6px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
}
.tag-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag-input.disabled { background: var(--surface-2); }
.tag-input input { flex: 1; min-width: 140px; border: 0; outline: 0; background: transparent; color: var(--text); font: 14px var(--font); height: 28px; padding: 0 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px;
  background: var(--accent-soft); color: var(--accent-text); border-radius: 6px; font-size: 13px; font-weight: 500;
}
.tag button { border: 0; background: transparent; color: inherit; cursor: pointer; width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; padding: 0; }
.tag button:hover { background: rgba(0,0,0,.08); }
.tag-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-suggest button { border: 1px dashed var(--border-strong); background: transparent; color: var(--text-2); border-radius: 6px; height: 24px; padding: 0 8px; font: 12px var(--font); cursor: pointer; }
.tag-suggest button:hover { border-color: var(--accent); color: var(--accent-text); }

/* Interruptor (activar / desactivar) */
.switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .5; }

/* Resultado de la prueba de una fuente */
.test-result { margin-top: 14px; }
.test-result ul { margin: 8px 0 0; padding-left: 18px; }
.test-result li { margin: 2px 0; }
.ok-text { color: var(--success); }
.err-text { color: var(--danger); }

/* Control segmentado */
.segmented { display: inline-flex; max-width: 100%; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button { flex-shrink: 0; }
.segmented button {
  border: 0; background: transparent; color: var(--text-2); height: 28px; padding: 0 12px;
  border-radius: 6px; font: 600 12px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button:disabled { cursor: default; }

/* ---------------- Insignias ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); }

/* ---------------- Tarjetas y superficies ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; }
.card-body { padding: 16px 20px; }
.section { margin-bottom: 24px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

.callout {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius-lg);
  background: var(--accent-soft); border: 1px solid transparent; color: var(--text);
}
.callout .icon { color: var(--accent-text); margin-top: 2px; flex-shrink: 0; }
.callout-warning { background: var(--warning-soft); }
.callout-warning .icon { color: var(--warning); }
.callout h4 { font-size: 14px; margin-bottom: 2px; }

/* Indicadores */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 16px 18px; }
.stat .label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.clickable { cursor: pointer; transition: border-color .15s; }
.stat.clickable:hover { border-color: var(--accent); }

/* Avatar */
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  font-size: 11px; font-weight: 700; color: #fff; background: var(--accent); letter-spacing: .02em;
}
.avatar-sm { width: 22px; height: 22px; font-size: 9px; }
.avatar-lg { width: 36px; height: 36px; font-size: 13px; }
.avatar-empty { background: var(--surface-3); color: var(--muted); border: 1px dashed var(--border-strong); }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table .title-cell { max-width: 460px; }
.clamp-1, .clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }

/* Estado vacío */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .icon { color: var(--border-strong); margin-bottom: 10px; }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 16px; }

/* Carga */
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--surface-2), transparent); transform: translateX(-100%); animation: sk 1.2s infinite; }
@keyframes sk { 100% { transform: translateX(100%); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px; color: var(--muted); }

/* ---------------- Modales, panel lateral, avisos ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .18s ease-out; }
.modal-lg { max-width: 680px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; gap: 12px; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

.drawer-overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 50; animation: fade .15s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface);
  box-shadow: var(--shadow-lg); z-index: 51; display: flex; flex-direction: column; animation: slide .2s ease-out;
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px; }

.props { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; align-items: center; margin: 18px 0; }
.props > dt { font-size: 13px; color: var(--muted); font-weight: 500; }
.props > dd { margin: 0; min-width: 0; }
@media (max-width: 520px) { .props { grid-template-columns: 1fr; gap: 4px; } .props > dd { margin-bottom: 10px; } }

.suggestion { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.suggestion + .suggestion { margin-top: 6px; }
.suggestion .meta { flex: 1; min-width: 0; }
.suggestion .name { font-weight: 600; font-size: 13px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .comment { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.timeline .event { font-size: 13px; color: var(--text-2); }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: pop .2s ease-out; display: flex; align-items: center; gap: 8px; max-width: 90vw;
}
.toast.error { background: var(--danger); color: #fff; }

.menu { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; z-index: 70; }
.menu button, .menu a { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; color: var(--text); padding: 8px 10px; border-radius: 6px; font: 13px var(--font); cursor: pointer; text-align: left; }
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu .sep { height: 1px; background: var(--border); margin: 6px 0; }

.link-box { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 6px 6px 12px; }
.link-box code { background: none; padding: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

/* =========================================================
   Layout de la aplicación
   ========================================================= */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 6px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; display: block; }
.brand .wordmark { display: block; font-size: 23px; }
.brand small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

/* Sello "Un producto de Qüid Lab": el logo va sobre blanco, como fue diseñado */
.quid-badge { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.quid-badge a { display: inline-flex; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 5px 10px; }
.quid-badge a:hover { border-color: var(--accent); }
.quid-badge img { display: block; height: 30px; width: auto; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; font-size: 14px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item .count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.plan-pill { font-size: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.plan-pill b { color: var(--text); }
.user-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; font: 13px var(--font);
}
.user-btn:hover { background: var(--surface-2); }
.user-btn .who { flex: 1; min-width: 0; }
.user-btn .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-btn .who span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 64px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar { flex-wrap: wrap; }
.topbar-text { flex: 1 1 320px; min-width: 0; }
.topbar h1 { font-size: 20px; }
.topbar .subtitle { font-size: 13px; color: var(--muted); }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.menu-btn { display: none; }
.view { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }
.banner { padding: 10px 28px; font-size: 13px; background: var(--warning-soft); color: var(--warning); display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--border); }
.banner a { color: inherit; font-weight: 700; text-decoration: underline; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 55; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .view { padding: 16px 16px 40px; }
  .banner { padding: 10px 16px; }
}

/* Barra de herramientas */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; }
.toolbar .search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.toolbar .search .input { padding-left: 36px; }

/* Fuentes */
.sources { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.src {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 12px; color: var(--text-2);
}
.src .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.src.bad .dot { background: var(--danger); }
.src.off { opacity: .55; }
.src.off .dot { background: var(--muted); }
button.src { cursor: pointer; font-family: var(--font); }
button.src:hover { border-color: var(--accent); }
.src.hidden-src { opacity: .45; text-decoration: line-through; }
.src.hidden-src .dot { background: var(--muted); }

/* Tarjetas de convocatoria (búsqueda) */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.conv { display: flex; flex-direction: column; gap: 10px; padding: 16px; transition: border-color .15s, box-shadow .15s; }
.conv:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.conv.tracked { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.conv-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.conv .org { font-size: 12px; font-weight: 600; color: var(--muted); }
.conv h3 { font-size: 15px; font-weight: 650; }
.conv .desc { font-size: 13px; color: var(--text-2); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tags span { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); color: var(--muted); }
.tags span.match { background: var(--accent-soft); color: var(--accent-text); }
.tags-spaced { margin-top: 10px; }
.row-end { justify-content: flex-end; margin: 8px 0 6px; }
.conv-summary { padding: 12px 14px; background: var(--surface-2); border-radius: 10px; margin-bottom: 18px; }
.conv-summary-title { font-weight: 650; margin-top: 2px; }
.drawer-title { font-size: 19px; margin-top: 4px; }
.conv .meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.conv .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.score { font-size: 12px; font-weight: 700; height: 22px; padding: 0 8px; border-radius: 6px; display: inline-flex; align-items: center; white-space: nowrap; }
.score.hi { background: var(--success-soft); color: var(--success); }
.score.mid { background: var(--warning-soft); color: var(--warning); }
.score.lo { background: var(--surface-2); color: var(--muted); }

/* Tablero kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.column { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 220px); min-height: 160px; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 650; font-size: 13px; }
.column-head .n { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.column-body { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 60px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); transition: background .15s; }
.column.drop .column-body { background: var(--accent-soft); }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; box-shadow: var(--shadow-sm); border-left: 3px solid var(--border-strong); }
.kcard:hover { border-color: var(--border-strong); }
.kcard[draggable="true"] { cursor: grab; }
.kcard.dragging { opacity: .5; }
.kcard.p-alta { border-left-color: var(--danger); }
.kcard.p-media { border-left-color: var(--warning); }
.kcard.p-baja { border-left-color: var(--info); }
.kcard h4 { font-size: 13px; font-weight: 600; margin: 4px 0 8px; }
.kcard .org { font-size: 11px; color: var(--muted); font-weight: 600; }
.kcard .foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

.deadline-soon { color: var(--danger); font-weight: 600; }
.deadline-ok { color: var(--text-2); }

/* Listas de actividad y próximos cierres */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--surface-2); }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* Pantalla completa (suspensión, errores) */
.fullscreen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.fullscreen .card { max-width: 460px; text-align: center; padding: 32px; }
