/* ==========================================================================
   Nubar Gestión — interfaz (fase 1)
   Pensada primero para el iPhone del técnico; en PC se abre en dos columnas.
   Base: Bootstrap 5.3 (componentes) + estas reglas (layout e identidad).
   ========================================================================== */

/* ---------- Tipografía (Figtree, servida en local) ---------- */
@font-face { font-family: "Figtree"; font-weight: 400; font-display: swap; src: url("fonts/figtree-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 500; font-display: swap; src: url("fonts/figtree-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 600; font-display: swap; src: url("fonts/figtree-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 700; font-display: swap; src: url("fonts/figtree-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 800; font-display: swap; src: url("fonts/figtree-latin-800-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  --nb-ink: #18222d;          /* texto */
  --nb-ink-2: #5b6876;        /* texto secundario */
  --nb-ink-3: #8a96a3;        /* texto terciario */
  --nb-paper: #f2f4f6;        /* fondo de la app */
  --nb-surface: #ffffff;      /* grupos y paneles */
  --nb-line: #e3e7eb;         /* separadores */
  --nb-blue: #0067b0;         /* azul Nubar (logo) */
  --nb-blue-ink: #00518b;
  --nb-blue-tint: #e5f0f9;

  /* Estados de tarea */
  --st-iniciada: #7a8794;
  --st-en_marcha: #e89a00;
  --st-terminada: #2f9e6b;
  --st-retraso: #d64545;

  --nb-radius: 14px;
  --nb-radius-sm: 9px;
  --nb-side-w: 248px;
  --nb-top-h: 56px;
  --nb-tab-h: 64px;
  --nb-safe-b: env(safe-area-inset-bottom, 0px);

  /* Bootstrap */
  --bs-body-font-family: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: 0.97rem;
  --bs-body-color: var(--nb-ink);
  --bs-body-bg: var(--nb-paper);
  --bs-primary: var(--nb-blue);
  --bs-primary-rgb: 0, 103, 176;
  --bs-link-color: var(--nb-blue);
  --bs-link-color-rgb: 0, 103, 176;
  --bs-link-hover-color: var(--nb-blue-ink);
  --bs-border-color: var(--nb-line);
  --bs-border-radius: var(--nb-radius-sm);
  --bs-secondary-color: var(--nb-ink-2);
}

/* Botones primarios con el azul de la marca */
.btn-primary {
  --bs-btn-bg: var(--nb-blue); --bs-btn-border-color: var(--nb-blue);
  --bs-btn-hover-bg: var(--nb-blue-ink); --bs-btn-hover-border-color: var(--nb-blue-ink);
  --bs-btn-active-bg: var(--nb-blue-ink); --bs-btn-active-border-color: var(--nb-blue-ink);
  --bs-btn-disabled-bg: var(--nb-blue); --bs-btn-disabled-border-color: var(--nb-blue);
}
.btn-outline-primary {
  --bs-btn-color: var(--nb-blue); --bs-btn-border-color: var(--nb-blue);
  --bs-btn-hover-bg: var(--nb-blue); --bs-btn-hover-border-color: var(--nb-blue);
  --bs-btn-active-bg: var(--nb-blue-ink);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: #6aa9d8; box-shadow: 0 0 0 .2rem rgba(0, 103, 176, .18);
}
.form-check-input:checked { background-color: var(--nb-blue); border-color: var(--nb-blue); }
:focus-visible { outline: 2px solid var(--nb-blue); outline-offset: 2px; }

html { -webkit-text-size-adjust: 100%; }
body.nb { min-height: 100vh; font-feature-settings: "ss01" 0; }
.tnum { font-variant-numeric: tabular-nums; }

/* En iPhone los inputs <16px hacen zoom al enfocar */
@media (max-width: 991.98px) {
  .form-control, .form-select, .ts-control, .ts-control input { font-size: 16px !important; }
}

/* ---------- Barra superior ---------- */
.nb-top {
  position: sticky; top: 0; z-index: 1030;
  height: calc(var(--nb-top-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 12px 0 16px;
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--nb-line);
}
.nb-top .nb-brand img { height: 22px; display: block; }
.nb-top .nb-top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nb-icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center;
  color: var(--nb-ink-2); background: transparent; border: 0; text-decoration: none; font-size: 1.2rem;
}
.nb-icon-btn:hover { background: var(--nb-paper); color: var(--nb-ink); }
.nb-icon-btn .nb-dot {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--st-retraso); color: #fff;
  font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center;
}
.nb-avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--nb-blue-tint);
  display: inline-grid; place-items: center; font-weight: 700; color: var(--nb-blue); font-size: .85rem;
}
.nb-avatar-sm { width: 26px; height: 26px; font-size: .7rem; }
.nb-avatars { display: inline-flex; }
.nb-avatars > * { margin-left: -6px; border: 2px solid var(--nb-surface); }
.nb-avatars > *:first-child { margin-left: 0; }

/* ---------- Menú lateral (PC) ---------- */
.nb-side { display: none; }
@media (min-width: 992px) {
  .nb-top { margin-left: var(--nb-side-w); }
  .nb-top .nb-brand { display: none; }
  .nb-side {
    display: flex; flex-direction: column;
    position: fixed; inset: 0 auto 0 0; width: var(--nb-side-w); z-index: 1031;
    background: var(--nb-surface); border-right: 1px solid var(--nb-line);
    padding: 18px 12px 14px;
    overflow-y: auto;
  }
  .nb-side .nb-side-brand { padding: 4px 12px 22px; }
  .nb-side .nb-side-brand img { height: 26px; }
  .nb-side .nb-new { margin: 0 4px 18px; }
}
.nb-nav-group { margin-bottom: 18px; }
.nb-nav-group-title { padding: 0 12px 6px; font-size: .78rem; font-weight: 600; color: var(--nb-ink-3); }
.nb-nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--nb-ink); text-decoration: none; font-weight: 500;
}
.nb-nav-link i { font-size: 1.1rem; color: var(--nb-ink-2); width: 20px; text-align: center; }
.nb-nav-link:hover { background: var(--nb-paper); color: var(--nb-ink); }
.nb-nav-link.active { background: var(--nb-blue-tint); color: var(--nb-blue-ink); font-weight: 600; }
.nb-nav-link.active i { color: var(--nb-blue); }
.nb-side-foot { margin-top: auto; border-top: 1px solid var(--nb-line); padding-top: 12px; }

/* ---------- Barra de pestañas (móvil) ---------- */
.nb-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  height: calc(var(--nb-tab-h) + var(--nb-safe-b));
  padding-bottom: var(--nb-safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--nb-line);
}
.nb-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--nb-ink-3); text-decoration: none; font-size: .7rem; font-weight: 600;
  background: none; border: 0; padding: 6px 0;
}
.nb-tab i { font-size: 1.35rem; line-height: 1; }
.nb-tab.active { color: var(--nb-blue); }
.nb-tab-new {
  justify-self: center; width: 52px; height: 52px; border-radius: 16px; margin-top: -14px;
  display: grid; place-items: center; text-decoration: none;
  background: var(--nb-blue); color: #fff; font-size: 1.6rem;
  box-shadow: 0 6px 16px rgba(0, 103, 176, .35);
}
.nb-tab-new:hover { color: #fff; background: var(--nb-blue-ink); }
@media (min-width: 992px) { .nb-tabbar { display: none; } }

/* Hoja "Más" */
.nb-more.offcanvas-bottom { height: auto; max-height: 85vh; border-radius: 18px 18px 0 0; padding-bottom: var(--nb-safe-b); }
.nb-more .offcanvas-body { padding-top: 4px; }

/* ---------- Contenido ---------- */
.app-main {
  display: block;
  padding: 16px 16px calc(var(--nb-tab-h) + var(--nb-safe-b) + 24px);
}
@media (min-width: 992px) {
  .app-main { margin-left: var(--nb-side-w); padding: 28px 36px 48px; }
}
.app-main > .container-fluid { padding-left: 0; padding-right: 0; }
.nb-sin-tabbar .app-main { padding-bottom: calc(96px + var(--nb-safe-b)); }
.nb-sin-tabbar .nb-tabbar { display: none; }

.nb-page { max-width: 1080px; }
.nb-page-narrow { max-width: 760px; }
.nb-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.nb-page-head h1 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.nb-page-head .nb-sub { color: var(--nb-ink-2); margin-top: 2px; }
@media (min-width: 992px) { .nb-page-head h1 { font-size: 2rem; } }

/* Compatibilidad con páginas antiguas (AdminLTE) */
.app-content-header { padding: 0 0 12px; }
.app-content { padding: 0; }
.table-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.card { --bs-card-border-color: var(--nb-line); --bs-card-border-radius: var(--nb-radius); }

/* ---------- Grupos tipo lista (iOS) ---------- */
.nb-group {
  background: var(--nb-surface); border-radius: var(--nb-radius);
  border: 1px solid var(--nb-line); overflow: hidden; margin-bottom: 18px;
}
.nb-group-title {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: .95rem; font-weight: 700; margin: 22px 4px 8px;
}
.nb-group-title .nb-count { color: var(--nb-ink-3); font-weight: 600; font-size: .85rem; }
.nb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; color: inherit; text-decoration: none;
  border-top: 1px solid var(--nb-line);
}
.nb-row:first-child { border-top: 0; }
a.nb-row:hover { background: #f8fafb; color: inherit; }
.nb-row-main { flex: 1; min-width: 0; }
.nb-slot-body .nb-row-sub { white-space: normal; }
.nb-row-title { font-weight: 650; line-height: 1.25; }
.nb-row-sub { color: var(--nb-ink-2); font-size: .88rem; line-height: 1.3; }
.nb-row-sub, .nb-row-title { overflow: hidden; text-overflow: ellipsis; }
.nb-row .bi-chevron-right { color: var(--nb-ink-3); }
.nb-empty { padding: 22px 16px; color: var(--nb-ink-2); text-align: center; }

/* ---------- Estado de tarea ---------- */
.nb-estado {
  --c: var(--st-iniciada);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 700; white-space: nowrap;
  padding: 3px 9px 3px 8px; border-radius: 999px;
  color: color-mix(in srgb, var(--c) 78%, #000);
  background: color-mix(in srgb, var(--c) 14%, white);
}
.nb-estado::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.nb-estado.retraso { --c: var(--st-retraso); }

/* Bloque de fecha (listas) */
.nb-date {
  flex: 0 0 48px; text-align: center; line-height: 1;
  border-radius: 10px; padding: 7px 0 6px; background: var(--nb-paper);
}
.nb-date .d { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.nb-date .m { font-size: .7rem; font-weight: 600; color: var(--nb-ink-2); margin-top: 3px; text-transform: lowercase; }
.nb-date.hoy { background: var(--nb-blue); color: #fff; }
.nb-date.hoy .m { color: rgba(255,255,255,.85); }

/* ---------- Hoy: la línea del día ---------- */
.nb-day {
  position: relative; background: var(--nb-surface);
  border: 1px solid var(--nb-line); border-radius: var(--nb-radius);
  padding: 6px 0;
}
.nb-slot {
  position: relative; display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 0;
  color: inherit; text-decoration: none;
}
.nb-slot:hover { background: #f8fafb; color: inherit; }
.nb-slot-time {
  padding: 14px 0 0 14px; text-align: left;
  font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.nb-slot-time small { display: block; font-size: .78rem; font-weight: 600; color: var(--nb-ink-3); margin-top: 4px; letter-spacing: 0; }
.nb-slot-body {
  position: relative; padding: 12px 16px 14px 22px;
  border-left: 2px solid var(--nb-line);
}
.nb-slot-body::before {
  content: ""; position: absolute; left: -7px; top: 17px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--nb-surface); border: 3px solid var(--c, var(--st-iniciada));
}
.nb-slot.fase-en_curso .nb-slot-body::before { background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }
.nb-slot.fase-final .nb-slot-body::before { background: var(--c); }
.nb-slot.fase-final .nb-slot-time, .nb-slot.fase-final .nb-row-title { color: var(--nb-ink-3); }
.nb-slot.pasada.fase-pendiente .nb-slot-time { color: var(--st-retraso); }
.nb-slot + .nb-slot .nb-slot-body { border-top: 1px solid var(--nb-line); }
.nb-slot-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* Línea "ahora" */
.nb-now { position: relative; height: 0; margin: 0 0 0 82px; }
.nb-now::before { content: ""; position: absolute; left: -6px; right: 14px; top: -1px; height: 2px; background: var(--st-retraso); }
.nb-now::after  { content: ""; position: absolute; left: -10px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--st-retraso); }
.nb-now span {
  position: absolute; left: -70px; top: -9px; width: 56px; text-align: left;
  font-size: .72rem; font-weight: 800; color: var(--st-retraso); font-variant-numeric: tabular-nums;
}

/* Saludo */
.nb-hello h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.025em; margin: 0; }
.nb-hello .nb-sub::first-letter { text-transform: uppercase; }
@media (min-width: 992px) { .nb-hello h1 { font-size: 2.3rem; } }

/* Control segmentado */
.nb-seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: #e6eaee; border-radius: 10px;
}
.nb-seg a, .nb-seg button, .nb-seg label {
  border: 0; background: transparent; color: var(--nb-ink-2);
  padding: 6px 14px; border-radius: 8px; font-weight: 600; font-size: .88rem; text-decoration: none;
}
.nb-seg .active { background: var(--nb-surface); color: var(--nb-ink); box-shadow: 0 1px 2px rgba(24,34,45,.12); }

/* Chips de filtro */
.nb-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.nb-chips::-webkit-scrollbar { display: none; }
.nb-chip {
  flex: 0 0 auto; border: 1px solid var(--nb-line); background: var(--nb-surface);
  color: var(--nb-ink); border-radius: 999px; padding: 6px 13px; font-weight: 600; font-size: .85rem;
  text-decoration: none;
}
.nb-chip.active { background: var(--nb-ink); border-color: var(--nb-ink); color: #fff; }

/* Buscador */
.nb-search { position: relative; }
.nb-search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--nb-ink-3); }
.nb-search input { padding-left: 38px; border-radius: 11px; background: var(--nb-surface); }

/* ---------- Detalle de tarea ---------- */
.nb-hero-task { margin-bottom: 18px; }
.nb-hero-task .nb-kind { color: var(--nb-ink-2); font-weight: 600; }
.nb-hero-task h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 8px; }
.nb-when { font-size: 1.05rem; font-weight: 600; }
.nb-when .tnum { font-weight: 800; }
.nb-actions-main { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 16px 0 6px; }
.nb-actions-main .btn { padding: 13px 16px; font-weight: 700; border-radius: 12px; font-size: 1.02rem; }
.nb-btn-start { background: var(--st-en_marcha); border-color: var(--st-en_marcha); color: #1b1300; }
.nb-btn-start:hover { background: #d18a00; border-color: #d18a00; color: #1b1300; }
.nb-btn-done { background: var(--st-terminada); border-color: var(--st-terminada); color: #fff; }
.nb-btn-done:hover { background: #268457; border-color: #268457; color: #fff; }
.nb-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nb-quick a {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  background: var(--nb-surface); border: 1px solid var(--nb-line); border-radius: 12px;
  color: var(--nb-blue); text-decoration: none; font-weight: 600; font-size: .82rem;
}
.nb-quick a i { font-size: 1.25rem; }
.nb-quick a.disabled { color: var(--nb-ink-3); pointer-events: none; opacity: .6; }
.nb-kv { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; gap: 4px 12px; font-size: .92rem; }
.nb-kv dt { color: var(--nb-ink-2); font-weight: 500; }
.nb-kv dd { margin: 0; word-break: break-word; }
.nb-log { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.nb-log li { display: flex; gap: 10px; padding: 6px 0; color: var(--nb-ink-2); }
.nb-log li b { color: var(--nb-ink); font-weight: 600; }

@media (min-width: 992px) {
  .nb-task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
  .nb-actions-main { grid-template-columns: repeat(2, minmax(0, 220px)); }
}

/* ---------- Formulario por secciones ---------- */
.nb-form-section { background: var(--nb-surface); border: 1px solid var(--nb-line); border-radius: var(--nb-radius); padding: 16px; margin-bottom: 14px; }
.nb-form-section h2 { font-size: 1.02rem; font-weight: 750; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.nb-form-section h2 i { color: var(--nb-blue); }
.form-label { font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.nb-people { display: flex; flex-wrap: wrap; gap: 8px; }
.nb-person input { position: absolute; opacity: 0; pointer-events: none; }
.nb-person label {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--nb-line);
  background: var(--nb-surface); font-weight: 600; font-size: .9rem; user-select: none;
}
.nb-person input:checked + label { background: var(--nb-blue-tint); border-color: var(--nb-blue); color: var(--nb-blue-ink); }
.nb-person input:focus-visible + label { outline: 2px solid var(--nb-blue); outline-offset: 2px; }
.nb-savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1029;
  padding: 10px 16px calc(10px + var(--nb-safe-b));
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--nb-line);
  display: flex; gap: 10px; justify-content: flex-end;
}
.nb-savebar .btn { padding: 11px 20px; font-weight: 700; border-radius: 11px; }
.nb-savebar .btn-primary { flex: 1; max-width: 320px; }
@media (min-width: 992px) { .nb-savebar { left: var(--nb-side-w); padding-right: 36px; } }

/* Tom Select integrado */
.ts-wrapper.form-select .ts-control, .ts-wrapper .ts-control { border-radius: var(--nb-radius-sm); }
.ts-dropdown { font-size: .95rem; }

/* ---------- Calendario ---------- */
.nb-cal { background: var(--nb-surface); border: 1px solid var(--nb-line); border-radius: var(--nb-radius); padding: 12px; }
.fc { --fc-border-color: var(--nb-line); --fc-today-bg-color: var(--nb-blue-tint); --fc-event-bg-color: var(--nb-blue); --fc-event-border-color: var(--nb-blue); --fc-button-bg-color: var(--nb-surface); --fc-button-border-color: var(--nb-line); --fc-button-text-color: var(--nb-ink); --fc-button-hover-bg-color: var(--nb-paper); --fc-button-hover-border-color: var(--nb-line); --fc-button-active-bg-color: var(--nb-ink); --fc-button-active-border-color: var(--nb-ink); }
.fc .fc-button { font-weight: 600; font-size: .85rem; padding: .35rem .7rem; box-shadow: none !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: #fff; }
.fc .fc-toolbar-title { font-size: 1.15rem; font-weight: 800; text-transform: capitalize; }
.fc a { text-decoration: none; color: inherit; }
.fc .fc-col-header-cell-cushion { text-transform: capitalize; font-weight: 600; color: var(--nb-ink-2); }
.fc .fc-list-day-cushion { background: var(--nb-paper); text-transform: capitalize; }
@media (max-width: 767.98px) {
  .nb-cal { padding: 8px; border-radius: 12px; }
  .fc .fc-toolbar { flex-wrap: wrap; gap: 8px; }
  .fc .fc-toolbar-title { font-size: 1rem; }
  .fc .fc-toolbar-chunk:nth-child(2) { order: -1; width: 100%; text-align: center; }
}

/* ---------- Configuración ---------- */
.nb-config-nav .nb-row.active { background: var(--nb-blue-tint); }
.nb-config-nav .nb-row.active .nb-row-title { color: var(--nb-blue-ink); }
@media (max-width: 991.98px) {
  .nb-config.con-seccion .nb-config-nav { display: none; }
}
@media (min-width: 992px) {
  .nb-config { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
  .nb-config-nav { position: sticky; top: calc(var(--nb-top-h) + 16px); }
  .nb-config-nav .nb-row { padding: 10px 14px; }
}
.nb-estado-cfg { padding: 14px; }
.nb-acordeon { padding: 0; }
.nb-acordeon > summary { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 14px 16px; cursor: pointer; }
.nb-acordeon > summary::-webkit-details-marker { display: none; }
.nb-acordeon > summary::before { content: "\F285"; font-family: bootstrap-icons; color: var(--nb-ink-3); transition: transform .15s; margin-right: 4px; }
.nb-acordeon[open] > summary::before { transform: rotate(90deg); }
.nb-acordeon > div { padding: 0 16px 16px; }

/* ---------- Parte de trabajo ---------- */
.nb-chk-grupo { font-size: .8rem; font-weight: 700; color: var(--nb-ink-2); margin: 14px 0 6px; }
.nb-chk-grupo:first-of-type { margin-top: 0; }
.nb-chk { padding: 10px 0; border-top: 1px solid var(--nb-line); }
.nb-chk-texto { font-weight: 600; margin-bottom: 8px; }
.nb-chk-opciones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.nb-chk-opciones .btn { border: 1px solid var(--nb-line); background: var(--nb-surface); color: var(--nb-ink-2); font-weight: 600; padding: 8px 4px; border-radius: 10px; font-size: .9rem; }
.nb-chk-opciones .btn-check:checked + .nb-chk-ok { background: var(--st-terminada); border-color: var(--st-terminada); color: #fff; }
.nb-chk-opciones .btn-check:checked + .nb-chk-no { background: var(--st-retraso); border-color: var(--st-retraso); color: #fff; }
.nb-chk-opciones .btn-check:checked + .nb-chk-na { background: var(--nb-ink-2); border-color: var(--nb-ink-2); color: #fff; }
.nb-chk-opciones .btn-check:focus-visible + .btn { outline: 2px solid var(--nb-blue); outline-offset: 2px; }
@media (min-width: 768px) { .nb-chk-opciones { grid-template-columns: repeat(3, 140px); } }

.nb-fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 768px) { .nb-fotos { grid-template-columns: repeat(5, 1fr); } }
.nb-foto { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--nb-paper); }
.nb-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nb-foto-borrar { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }
.nb-foto-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; border: 2px dashed #c9d1d9; color: var(--nb-blue); font-weight: 600; font-size: .85rem; background: var(--nb-surface); }
.nb-foto-add i { font-size: 1.5rem; }

.nb-firma { position: relative; height: 240px; border: 2px solid var(--nb-line); border-radius: 14px; background: #fff; overflow: hidden; }
.nb-firma canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.nb-firma::after { content: ""; position: absolute; left: 24px; right: 24px; bottom: 54px; border-bottom: 1.5px dashed #c9d1d9; pointer-events: none; }
.nb-firma-guia { position: absolute; left: 24px; bottom: 26px; color: var(--nb-ink-3); font-size: .85rem; pointer-events: none; }
@media (min-width: 768px) { .nb-firma { height: 280px; } }

.nb-resumen-chk { list-style: none; padding: 0; margin: 0 0 6px; }
.nb-resumen-chk li { display: flex; gap: 8px; padding: 3px 0; font-size: .93rem; }
.nb-resumen-chk .r-ok i { color: var(--st-terminada); }
.nb-resumen-chk .r-no i { color: var(--st-retraso); }
.nb-resumen-chk .r-na i, .nb-resumen-chk li i { color: var(--nb-ink-3); }
.nb-resumen-chk li i { margin-top: 2px; }

.nb-firmado { display: flex; gap: 14px; align-items: center; margin: 4px 0 18px; }
.nb-firmado > i { font-size: 2.6rem; color: var(--st-terminada); }
.nb-firmado h1 { font-size: 1.6rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }

.nb-parte-card { display: flex; align-items: center; gap: 12px; }
.nb-parte-card > i { font-size: 1.6rem; }

/* ---------- Avisos ---------- */
.nb-flash { border-radius: 12px; border: 0; font-weight: 500; }

/* ---------- Login ---------- */
.nb-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--nb-blue); }
.nb-login-card { width: 100%; max-width: 380px; background: var(--nb-surface); border-radius: 20px; padding: 30px 26px 26px; box-shadow: 0 24px 60px rgba(0, 40, 80, .35); }
.nb-login-card img { height: 30px; margin-bottom: 22px; }
.nb-login-card h1 { font-size: 1.35rem; font-weight: 800; margin-bottom: 18px; }
.nb-login-card .btn { padding: 12px; font-weight: 700; border-radius: 11px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  .nb-top, .nb-side, .nb-tabbar, .nb-savebar { display: none !important; }
  .app-main { margin: 0 !important; padding: 0 !important; }
}

/* ---------- Listas de gestión (clientes, establecimientos…) ---------- */
.nb-lista .nb-row { position: relative; padding: 11px 8px 11px 14px; }
.nb-lista .nb-row:hover { background: #f8fafb; }
.nb-row-link { color: inherit; text-decoration: none; }
.nb-row-link::after { content: ""; position: absolute; inset: 0; }
.nb-row-ico {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; font-size: 1.15rem;
  background: var(--nb-blue-tint); color: var(--nb-blue);
}
.nb-row-ico img { width: 24px; height: 24px; object-fit: contain; }
.nb-row-ico.gris { background: var(--nb-paper); color: var(--nb-ink-3); }
.nb-row-acts { display: flex; gap: 2px; position: relative; z-index: 1; flex: 0 0 auto; }
.nb-row-acts .nb-icon-btn { width: 36px; height: 36px; font-size: 1.05rem; }
.nb-row-acts .nb-icon-btn.peligro:hover { color: var(--st-retraso); }
.nb-row.inactivo .nb-row-title { color: var(--nb-ink-3); }
.nb-tag { display: inline-block; font-size: .72rem; font-weight: 650; padding: 1px 7px; border-radius: 6px; background: var(--nb-paper); color: var(--nb-ink-2); vertical-align: 1px; }
.nb-lista-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.nb-lista-tools .nb-search { flex: 1 1 260px; }

/* ---------- Editor de plantillas de email ---------- */
.nb-seg label { cursor: pointer; margin: 0; }
.nb-plantilla[data-formato="texto"] .nb-solo-html,
.nb-plantilla[data-formato="html"] .nb-solo-texto { display: none !important; }
.nb-plantilla .CodeMirror {
  height: 380px; border: 1px solid var(--nb-line); border-radius: 10px;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.nb-plantilla .CodeMirror-gutters { background: var(--nb-paper); border-right: 1px solid var(--nb-line); }
.nb-plantilla .CodeMirror-activeline-background { background: #f3f8fc; }
.nb-plantilla .CodeMirror-matchingtag { background: rgba(0,103,176,.12); }
.nb-preview-marco { background: var(--nb-paper); border: 1px solid var(--nb-line); border-radius: 10px; padding: 10px; overflow-x: auto; }
.nb-preview-marco iframe { display: block; width: 100%; height: 420px; border: 0; margin: 0 auto; background: #fff; border-radius: 6px; transition: width .2s; }
.nb-preview-asunto { margin-bottom: 6px; }
.nb-avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; flex: 0 0 auto; }

/* ---------- Fichas (cliente, establecimiento, equipos) ---------- */
.nb-group.nb-visible { overflow: visible; }
.nb-row-sep { padding: 8px 14px 6px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--nb-ink-3); border-top: 1px solid var(--nb-line); background: #fafbfc; }
.nb-equipos-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--nb-line); background: #fafbfc; border-radius: var(--nb-radius) var(--nb-radius) 0 0; }
.nb-equipos-head b { font-size: .98rem; }
.nb-equipos .nb-row:nth-child(2) { border-top: 0; }
.nb-copy { border: 0; background: none; padding: 0; color: var(--nb-ink); text-align: left; font: inherit; word-break: break-all; cursor: copy; }
.nb-copy:hover { color: var(--nb-blue); }
.nb-copy-ico { color: var(--nb-ink-3); margin-left: 4px; }
.nb-secreto { display: inline-flex; align-items: center; gap: 6px; }
.nb-secreto .nb-copy { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; }
.nb-ver { border: 0; background: none; padding: 0 2px; color: var(--nb-ink-3); }
.nb-ver:hover { color: var(--nb-blue); }
.nb-copiado { margin-left: 6px; font-size: .75rem; font-weight: 700; color: var(--st-terminada, #2f9e6b); }
.nb-docs { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.nb-doc { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 8px; background: var(--nb-paper); color: var(--nb-ink); text-decoration: none; font-size: .86rem; max-width: 100%; }
.nb-doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-doc:hover { background: var(--nb-blue-tint); color: var(--nb-blue-ink); }
.nb-group-title a { font-weight: 600; }
.nb-chips-check { display: flex; flex-wrap: wrap; gap: 8px; }
.nb-chips-check .btn { border: 1px solid var(--nb-line); background: var(--nb-surface); border-radius: 99px; padding: 7px 14px; font-weight: 600; color: var(--nb-ink-2); }
.nb-chips-check .btn-check:checked + .btn { background: var(--nb-blue); border-color: var(--nb-blue); color: #fff; }
.nb-chips-check .btn-check:checked + .btn::before { content: "✓ "; }
.nb-campo-grid { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 8px; }
.nb-asa { cursor: grab; color: var(--nb-ink-3); font-size: 1.2rem; touch-action: none; padding: 4px 0; }
.nb-campo { align-items: flex-start; }
.nb-campo .sortable-ghost, .nb-campo.sortable-ghost { opacity: .4; }
@media (max-width: 575.98px) { .nb-campo-grid { grid-template-columns: minmax(0, 1fr) 104px; } }
.nb-tipos .btn::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tc); margin-right: 6px; vertical-align: 1px; }
.nb-chips-check.nb-tipos .btn-check:checked + .btn { background: var(--tc); border-color: var(--tc); }
.nb-chips-check.nb-tipos .btn-check:checked + .btn::before { content: ""; background: #fff; }
.nb-parte-equipo { padding: 10px 0; border-top: 1px solid var(--nb-line); } .nb-parte-equipo:first-of-type { border-top: 0; }
