  :root, :root[data-theme="dark"] {
    --bg: #121212; --surface: #1a1a1a; --surface2: #222222; --surface3: #2a2a2a;
    --border: #2e2e2e; --border2: #3c3c3c;
    --accent: #96A9D7; --accent2: #243A9F; --accent-dim: rgba(150,169,215,0.12);
    --text: #D7D7D8; --text2: #a0a0a1; --text3: #808080;
    --green: #4ade80; --green-dim: rgba(74,222,128,0.12);
    --red: #f87171; --red-dim: rgba(248,113,113,0.12);
    --amber: #fbbf24; --amber-dim: rgba(251,191,36,0.12);
    --purple: #a78bfa; --purple-dim: rgba(167,139,250,0.12);
    --teal: #2dd4bf; --teal-dim: rgba(45,212,191,0.12);
    --pink: #f472b6; --pink-dim: rgba(244,114,182,0.12);
    --orange: #fb923c; --orange-dim: rgba(251,146,60,0.12);
    --cyan: #22d3ee; --cyan-dim: rgba(34,211,238,0.12);
    --rose: #fb7185; --rose-dim: rgba(251,113,133,0.12);
    --lime: #a3e635; --lime-dim: rgba(163,230,53,0.12);
    --indigo: #818cf8; --indigo-dim: rgba(129,140,248,0.12);
    --r: 8px; --r2: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.20);
    --shadow-md: 0 4px 12px -4px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.04) inset;
    --shadow-lg: 0 24px 48px -16px rgba(0,0,0,0.6), 0 8px 24px -8px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.04) inset;
    --ring-accent: 0 0 0 4px rgba(150,169,215,0.16);
    --ring-danger: 0 0 0 4px rgba(248,113,113,0.18);
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --t-fast: 0.15s ease;
    --t-base: 0.18s ease;
    --grad-primary: linear-gradient(180deg, #2d49b8 0%, #1e3592 100%);
    --grad-primary-hover: linear-gradient(180deg, #3654c8 0%, #2540a8 100%);
    --btn-primary-fg: #ffffff;
    --card-bg-glass: linear-gradient(180deg, rgba(30,30,36,0.82) 0%, rgba(22,22,28,0.82) 100%);
  }
  :root[data-theme="light"] {
    --bg: #f5f6f8; --surface: #ffffff; --surface2: #f0f2f5; --surface3: #e4e7eb;
    --border: #d8dce1; --border2: #b9c0c8;
    --accent: #2f4FA8; --accent2: #243A9F; --accent-dim: rgba(36,58,159,0.10);
    --text: #1a1f2b; --text2: #4a5160; --text3: #6e7686;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px -4px rgba(0,0,0,0.10);
    --shadow-lg: 0 24px 48px -16px rgba(0,0,0,0.18), 0 8px 24px -8px rgba(0,0,0,0.08);
    --ring-accent: 0 0 0 4px rgba(36,58,159,0.14);
    --ring-danger: 0 0 0 4px rgba(248,113,113,0.18);
    --grad-primary: linear-gradient(180deg, #3a59c8 0%, #243A9F 100%);
    --grad-primary-hover: linear-gradient(180deg, #4866d4 0%, #2f49b0 100%);
    --btn-primary-fg: #ffffff;
    --card-bg-glass: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(245,247,250,0.92) 100%);
    --green: #16a34a; --green-dim: rgba(22,163,74,0.12);
    --red: #dc2626; --red-dim: rgba(220,38,38,0.10);
    --amber: #d97706; --amber-dim: rgba(217,119,6,0.12);
    --purple: #7c3aed; --purple-dim: rgba(124,58,237,0.10);
    --teal: #0d9488; --teal-dim: rgba(13,148,136,0.12);
    --pink: #db2777; --pink-dim: rgba(219,39,119,0.10);
    --orange: #ea580c; --orange-dim: rgba(234,88,12,0.12);
    --cyan: #0891b2; --cyan-dim: rgba(8,145,178,0.12);
    --rose: #e11d48; --rose-dim: rgba(225,29,72,0.10);
    --lime: #65a30d; --lime-dim: rgba(101,163,13,0.12);
    --indigo: #4f46e5; --indigo-dim: rgba(79,70,229,0.10);
  }
  #version-footer {
    position: fixed; right: 10px; bottom: 6px; z-index: 50;
    font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--text3);
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
    padding: 3px 9px; opacity: 0.7; pointer-events: auto; user-select: none;
    transition: opacity 0.15s;
  }
  #version-footer:hover { opacity: 1; }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'Geist', sans-serif; background: var(--bg); color: var(--text); height: 100vh; display: flex; flex-direction: column; overflow: hidden; line-height: 1.5; letter-spacing: -0.01em; }

  /* ── Top Nav ── */
  #topnav {
    display: none; height: 48px; min-height: 48px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    align-items: center; padding: 0 20px; gap: 0; z-index: 50; position: relative;
    box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 1px 2px rgba(0,0,0,0.10);
  }
  .tn-brand { font-size: 13px; font-weight: 700; color: var(--text2); margin-right: auto; display: flex; align-items: center; gap: 8px; }
  .tn-btn {
    padding: 0 14px; height: 48px; font-family: inherit; font-size: 12px; font-weight: 600;
    color: var(--text3); background: none; border: none; border-bottom: 2px solid transparent;
    cursor: pointer; transition: color var(--t-base), background var(--t-base), border-color var(--t-base);
    display: flex; align-items: center; gap: 6px; white-space: nowrap; position: relative;
  }
  .tn-btn:hover { color: var(--text); background: rgba(255,255,255,0.025); }
  .tn-btn.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-dim); }
  .tn-btn:focus-visible { outline: none; box-shadow: var(--ring-accent); border-radius: var(--r); }
  .tn-sep { width: 1px; height: 20px; background: var(--border); margin: 0 8px; }
  .tn-user { font-size: 12px; color: var(--text3); display: flex; align-items: center; gap: 8px; padding: 0 8px; }
  .tn-logout {
    width: 36px; height: 36px; border-radius: var(--r); border: 1px solid var(--border);
    background: transparent; color: var(--text3); cursor: pointer; display: flex; align-items: center;
    justify-content: center;
    transition: border-color var(--t-base), color var(--t-base), background var(--t-base), box-shadow var(--t-base);
  }
  .tn-logout:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); box-shadow: 0 0 0 4px rgba(248,113,113,0.10); }
  .tn-logout:focus-visible { outline: none; box-shadow: var(--ring-danger); border-color: var(--red); }
  .tn-dropdown { position: relative; }
  .tn-dropdown-menu {
    display: none; position: absolute; top: calc(100% + 4px); left: 0;
    background: var(--card-bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border2); border-radius: var(--r2);
    min-width: 180px; z-index: 200; overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: modal-in 0.18s var(--ease);
  }
  .tn-dropdown.open .tn-dropdown-menu { display: block; }
  .tn-dropdown-item {
    display: flex; align-items: center; gap: 9px; padding: 10px 14px;
    font-family: inherit; font-size: 12px; font-weight: 600; color: var(--text2);
    background: none; border: none; width: 100%; cursor: pointer; transition: background 0.1s;
    text-align: left;
  }
  .tn-dropdown-item:hover { background: var(--surface2); color: var(--text); }
  .tn-dropdown-item.active { color: var(--accent); }
  .tn-dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }

  /* ── App body ── */
  #appbody {
    display: none; flex: 1; overflow: hidden;
    background:
      radial-gradient(ellipse 1200px 800px at 0% 0%, rgba(36, 58, 159, 0.06), transparent 55%),
      radial-gradient(ellipse 1000px 700px at 100% 100%, rgba(150, 169, 215, 0.035), transparent 55%),
      var(--bg);
  }

  /* ── Sidebar ── */
  #sidebar {
    width: 240px; min-width: 240px; background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; height: 100%;
    box-shadow: 1px 0 0 rgba(255,255,255,0.02) inset;
  }
  .sb-header { padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
  .sb-search {
    background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r);
    display: flex; align-items: center; gap: 8px; padding: 7px 10px;
    transition: border-color var(--t-base), box-shadow var(--t-base), background var(--t-base);
  }
  .sb-search:focus-within { border-color: var(--accent); box-shadow: var(--ring-accent); background: var(--surface); }
  .sb-search input { background: none; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 13px; width: 100%; }
  .sb-section-label { font-size: 10.5px; font-weight: 600; letter-spacing: 1.2px; color: var(--text3); padding: 14px 16px 6px; text-transform: uppercase; }
  .client-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
  .client-item {
    padding: 11px 12px; border-radius: var(--r); cursor: pointer;
    display: flex; align-items: center; gap: 12px; margin-bottom: 3px;
    position: relative;
    transition: background var(--t-base), color var(--t-base);
  }
  .client-item:hover { background: var(--surface2); }
  .client-item.active { background: var(--accent-dim); }
  .client-item.active::before {
    content: '';
    position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
  }
  .client-item.active .ci-name { color: var(--accent); }
  .ci-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; overflow: hidden; }
  .ci-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
  .ci-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ci-sub { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sb-footer { padding: 10px 8px; border-top: 1px solid var(--border); }
  .btn-new-client {
    width: 100%; padding: 10px;
    border-radius: var(--r);
    background: var(--grad-primary);
    border: 1px solid rgba(150,169,215,0.18);
    color: #fff;
    font-family: inherit; font-size: 13px; font-weight: 500; letter-spacing: -0.01em;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: filter var(--t-base), transform 0.08s ease, box-shadow var(--t-base);
    box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 4px 12px -4px rgba(36,58,159,0.45);
  }
  .btn-new-client:hover { filter: brightness(1.10); box-shadow: 0 1px 0 rgba(255,255,255,0.10) inset, 0 6px 16px -4px rgba(36,58,159,0.6); }
  .btn-new-client:active { transform: translateY(1px); filter: brightness(0.95); }
  .btn-new-client:focus-visible { outline: none; box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, var(--ring-accent); }

  /* ── Main content ── */
  #maincontent { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

  /* Welcome */
  #welcome {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--text3); gap: 14px; padding: 40px;
  }
  #welcome h2 { font-size: 22px; color: var(--text2); font-weight: 700; letter-spacing: -0.4px; }
  #welcome > svg, #welcome > img { opacity: 0.4; margin-bottom: 8px; }
  #welcome p { font-size: 13.5px; line-height: 1.6; max-width: 420px; text-align: center; }

  /* Client panel */
  #client-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
  .cp-header {
    padding: 20px 28px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: flex-start; gap: 16px; flex-shrink: 0;
    background: var(--surface);
  }
  .cp-avatar { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; flex-shrink: 0; overflow: hidden; cursor: pointer; position: relative; }
  .cp-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
  .cp-avatar-wrap { position: relative; flex-shrink: 0; margin-top: 3px; }
  .cp-avatar-wrap:hover .cp-avatar-overlay { opacity: 1; }
  .cp-avatar-overlay { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.15s; cursor: pointer; pointer-events: none; }
  .cp-avatar-overlay svg { color: #fff; }
  .cp-avatar-remove { position: absolute; top: -2px; right: -2px; width: 16px; height: 16px; border-radius: 50%; background: var(--danger,#e55); border: none; color: #fff; font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; }
  .cp-name { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.2; }
  .cp-meta { font-size: 12px; color: var(--text3); margin-top: 3px; }
  .cp-location { font-size: 11px; color: var(--text3); margin-top: 1px; }
  .cp-context-strip {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-top: 10px;
  }
  .cp-visitas-chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600; color: var(--text2);
    padding: 3px 9px;
    background: var(--bg);
    border: 1px solid var(--border); border-radius: 999px;
    cursor: pointer; text-decoration: none;
    transition: color .15s, border-color .15s, background .15s;
  }
  .cp-visitas-chip:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
  .cp-actions { margin-left: auto; display: flex; gap: 8px; }
  .btn-icon { width: 40px; height: 40px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); color: var(--text2); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
  .btn-icon:hover { border-color: var(--border2); color: var(--text); }
  .btn-icon.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }

  /* Tabs */
  .cp-tabs { padding: 0 28px; border-bottom: 1px solid var(--border); display: flex; gap: 2px; flex-shrink: 0; background: var(--bg); }
  .tab-btn {
    padding: 14px 16px; font-family: inherit; font-size: 12px; font-weight: 600;
    color: var(--text3); background: none; border: none; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color var(--t-base), background var(--t-base), border-color var(--t-base);
    display: flex; align-items: center; gap: 6px;
  }
  .tab-btn:hover { color: var(--text); background: rgba(255,255,255,0.025); }
  .tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
  .tab-btn:focus-visible { outline: none; box-shadow: var(--ring-accent); border-radius: var(--r) var(--r) 0 0; }
  .tab-dot { width: 6px; height: 6px; border-radius: 50%; }
  .tab-content { display: none; padding: 26px 32px; overflow-y: auto; flex: 1; }
  .tab-content.active { display: block; }

  /* Section */
  .section-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .section-title { font-size: 14px; font-weight: 600; }
  .btn-add {
    padding: 7px 13px; border-radius: var(--r);
    border: 1px solid var(--border2);
    background: var(--surface2);
    color: var(--text);
    font-family: inherit; font-size: 12px; font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: background var(--t-base), border-color var(--t-base), color var(--t-base), box-shadow var(--t-base);
  }
  .btn-add:hover { background: var(--surface3); border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow-sm); }
  .btn-add:active { transform: translateY(1px); }
  .btn-add:focus-visible { outline: none; box-shadow: var(--ring-accent); }

  /* Cards */
  .cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r2);
    padding: 16px 18px 14px;
    transition: border-color var(--t-base), box-shadow var(--t-base);
  }
  .card:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); }
  .card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
  .card-title { font-size: 14px; font-weight: 700; letter-spacing: -0.1px; }
  .card-badge { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 20px; margin-top: 4px; display: inline-block; }
  .card-actions { display: flex; gap: 3px; }
  .card-action { width: 26px; height: 26px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--text3); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
  .card-action:hover { background: var(--surface3); border-color: var(--border); color: var(--text); }
  .card-action.del:hover { background: var(--red-dim); border-color: var(--red); color: var(--red); }
  .card-row { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
  .card-row:last-child { border-bottom: none; }
  .card-header + .card-row { padding-top: 2px; }
  .card-header + .card-row .card-value { font-size: 13px; font-weight: 600; color: var(--text); }
  .card-label { font-size: 10.5px; color: var(--text3); font-family: 'Geist Mono', monospace; width: 88px; flex-shrink: 0; }
  .card-value { font-size: 12px; color: var(--text); flex: 1; text-align: right; word-break: break-all; }
  .card-value.mono { font-family: 'Geist Mono', monospace; }
  .card-value.blurred { filter: blur(5px); cursor: pointer; transition: filter 0.2s; }
  .card-value.blurred:hover { filter: none; }
  .secret-wrap { display: inline-flex; align-items: center; gap: 6px; }
  .secret-dots { letter-spacing: 2px; color: var(--text2); }
  .secret-revealed { font-family: 'Geist Mono', monospace; word-break: break-all; }
  .secret-reveal { background: none; border: 1px solid var(--border2); border-radius: 4px; color: var(--text3); padding: 2px 6px; cursor: pointer; display: inline-flex; align-items: center; transition: color 0.15s, border-color 0.15s; }
  .secret-reveal:hover { color: var(--accent); border-color: var(--accent); }
  .empty-state { text-align: center; padding: 40px 20px; color: var(--text3); font-size: 13px; grid-column: 1/-1; }

  /* Notes */
  .notes-area { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r2); color: var(--text); font-family: 'Geist', sans-serif; font-size: 14px; line-height: 1.7; padding: 14px; resize: vertical; min-height: 180px; outline: none; transition: border-color 0.15s; }
  .notes-area:focus { border-color: var(--accent); }
  .btn-save {
    margin-top: 10px; padding: 10px 22px;
    border-radius: var(--r);
    background: var(--grad-primary);
    border: 1px solid rgba(150,169,215,0.18);
    color: #fff;
    font-family: inherit; font-size: 13px; font-weight: 500; letter-spacing: -0.01em;
    cursor: pointer;
    transition: filter var(--t-base), transform 0.08s ease, box-shadow var(--t-base);
    box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 4px 12px -4px rgba(36,58,159,0.45);
  }
  .btn-save:hover { filter: brightness(1.10); box-shadow: 0 1px 0 rgba(255,255,255,0.10) inset, 0 6px 16px -4px rgba(36,58,159,0.6); }
  .btn-save:active { transform: translateY(1px); filter: brightness(0.95); }
  .btn-save:focus-visible { outline: none; box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, var(--ring-accent); }

  /* Invoices */
  .invoice-table { width: 100%; border-collapse: collapse; }
  .invoice-table th { font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
  .invoice-table td { font-size: 13px; padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
  .invoice-table tr:last-child td { border-bottom: none; }
  .invoice-table tr:hover td { background: var(--surface2); }
  .badge-paid { background: var(--green-dim); color: var(--green); font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
  .badge-pending { background: var(--amber-dim); color: var(--amber); font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
  .badge-overdue { background: var(--red-dim); color: var(--red); font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 20px; }

  /* ── Panels (Usuarios / Mi contraseña) ── */
  #panel-usuarios, #panel-mipass { display: none; flex: 1; overflow-y: auto; flex-direction: column; }
  .panel-header { padding: 24px 32px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
  .panel-title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
  .users-table { width: 100%; border-collapse: collapse; }
  .users-table th { font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); padding: 8px 16px; text-align: left; border-bottom: 1px solid var(--border); }
  .users-table td { font-size: 13px; padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
  .users-table tr:last-child td { border-bottom: none; }
  .users-table tr:hover td { background: var(--surface2); }
  .role-badge {
    font-size: 10px; font-weight: 600;
    padding: 3px 9px; border-radius: 20px;
    letter-spacing: 0.4px; text-transform: uppercase;
    border: 1px solid transparent;
    display: inline-flex; align-items: center;
    line-height: 1.4;
  }
  .role-admin       { background: var(--accent-dim);  color: var(--accent);  border-color: rgba(150,169,215,0.25); }
  .role-direccion   { background: var(--purple-dim);  color: var(--purple);  border-color: rgba(167,139,250,0.25); }
  .role-responsable { background: var(--teal-dim);    color: var(--teal);    border-color: rgba(45,212,191,0.25); }
  .role-tecnico     { background: var(--green-dim);   color: var(--green);   border-color: rgba(74,222,128,0.25); }
  /* Auditor Administrativo: mismo alcance que Técnico pero color propio —
     el punto del rol es distinguirlo de un vistazo en listados y comentarios. */
  .role-auditor_admin { background: var(--amber-dim); color: var(--amber);   border-color: rgba(251,191,36,0.25); }
  .role-operador    { background: var(--teal-dim);    color: var(--teal);    border-color: rgba(45,212,191,0.25); }
  .role-readonly    { background: var(--surface3);    color: var(--text3);   border-color: var(--border2); }
  .role-cliente     { background: var(--cyan-dim);    color: var(--cyan);    border-color: rgba(34,211,238,0.25); }
  .assign-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r); }
  .assign-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
  .assign-item:last-child { border-bottom: none; }
  .assign-item:hover { background: var(--surface2); }
  .assign-item input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
  .assign-item label { font-size: 13px; cursor: pointer; flex: 1; }

  /* ── Modal ── */
  .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.62); z-index: 100; align-items: center; justify-content: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: overlay-in 0.18s ease; }
  .modal-overlay.open { display: flex; }
  @keyframes overlay-in { 0% { opacity: 0; } 100% { opacity: 1; } }
  .modal {
    background: var(--card-bg-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border2);
    border-radius: var(--r2);
    width: 540px; max-width: 95vw; max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.32s var(--ease);
  }
  @keyframes modal-in { from { opacity:0; transform: translateY(10px) scale(0.97); } to { opacity:1; transform: none; } }
  .modal-header { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .modal-title { font-size: 15px; font-weight: 700; }
  .modal-close { background: none; border: none; color: var(--text3); cursor: pointer; padding: 4px; border-radius: 6px; transition: color 0.15s; }
  .modal-close:hover { color: var(--text); }
  .modal-body { padding: 22px 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .modal-body .full { grid-column: 1 / -1; }
  .field-label { font-size: 10.5px; font-weight: 600; color: var(--text3); margin-bottom: 7px; letter-spacing: 0.7px; text-transform: uppercase; display: block; }
  .field-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    font-family: inherit; font-size: 13px;
    padding: 10px 12px;
    outline: none;
    transition: border-color var(--t-base), box-shadow var(--t-base), background var(--t-base);
  }
  .field-input:hover:not(:focus):not(:disabled) { border-color: var(--border2); }
  .field-input:focus { border-color: var(--accent); box-shadow: var(--ring-accent); background: var(--surface); }
  .field-input:disabled { opacity: 0.6; cursor: not-allowed; }
  .field-input::placeholder { color: var(--text3); opacity: 0.55; }
  .modal-footer { padding: 16px 26px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
  .btn-cancel {
    padding: 9px 18px; border-radius: var(--r);
    border: 1px solid var(--border2);
    background: transparent;
    color: var(--text2);
    font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: background var(--t-base), color var(--t-base), border-color var(--t-base);
  }
  .btn-cancel:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
  .btn-cancel:focus-visible { outline: none; box-shadow: var(--ring-accent); }

  .btn-submit {
    padding: 10px 20px; border-radius: var(--r);
    border: 1px solid rgba(150,169,215,0.18);
    background: var(--grad-primary);
    color: #fff;
    font-family: inherit; font-size: 13px; font-weight: 500; letter-spacing: -0.01em;
    cursor: pointer;
    transition: filter var(--t-base), transform 0.08s ease, box-shadow var(--t-base);
    box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 4px 12px -4px rgba(36,58,159,0.45);
  }
  .btn-submit:hover { filter: brightness(1.10); box-shadow: 0 1px 0 rgba(255,255,255,0.10) inset, 0 6px 16px -4px rgba(36,58,159,0.6); }
  .btn-submit:active { transform: translateY(1px); filter: brightness(0.95); }
  .btn-submit:focus-visible { outline: none; box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, var(--ring-accent); }

  /* ── Password toggle ── */
  .pass-wrap { position: relative; }
  .pass-toggle {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text3); cursor: pointer;
    padding: 4px; display: flex; align-items: center; transition: color 0.15s;
  }
  .pass-toggle:hover { color: var(--text2); }

  /* ── Login premium ── */
  .login-split {
    position: fixed; inset: 0; z-index: 200;
    display: grid;
    place-items: center;
    padding: 48px 24px;
    overflow-y: auto;
    background:
      radial-gradient(ellipse 800px 600px at 12% -10%, rgba(36, 58, 159, 0.18), transparent 60%),
      radial-gradient(ellipse 700px 500px at 88% 110%, rgba(150, 169, 215, 0.10), transparent 60%),
      var(--bg);
  }
  .login-split::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
      linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, #000 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, #000 30%, transparent 80%);
  }

  .login-form-pane { width: 100%; display: flex; justify-content: center; position: relative; z-index: 1; }
  .login-form-inner {
    width: 100%; max-width: 440px;
    background: var(--card-bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border2);
    border-radius: 14px;
    padding: 44px 40px 36px;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.04) inset,
      0 24px 48px -16px rgba(0, 0, 0, 0.6),
      0 8px 24px -8px rgba(0, 0, 0, 0.4);
    animation: login-card-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes login-card-in {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
  }

  .login-logo-top { display: block; width: 180px; max-width: 70%; height: auto; margin: 0 auto 18px; }
  .login-tagline {
    text-align: center; font-size: 12.5px; color: var(--text3);
    line-height: 1.55; margin: 0 auto 32px; max-width: 320px;
    letter-spacing: 0.1px;
  }
  .login-greeting { margin-bottom: 26px; text-align: left; }
  .login-greeting h2 {
    font-size: 22px; font-weight: 700; color: var(--text);
    margin: 0 0 6px; letter-spacing: -0.4px; line-height: 1.2;
  }
  .login-hint { font-size: 13px; color: var(--text3); margin: 0; line-height: 1.55; }

  /* Labels minimal premium */
  .login-form-inner .field-label {
    font-size: 10.5px; font-weight: 600;
    letter-spacing: 0.7px; text-transform: uppercase;
    color: var(--text3); margin-bottom: 8px; display: block;
  }

  /* Inputs premium */
  .login-form-inner .field-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border2);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text);
    font-family: inherit; font-size: 14px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    outline: none;
  }
  .login-form-inner .field-input::placeholder { color: var(--text3); opacity: 0.6; }
  .login-form-inner .field-input:hover { border-color: #4a4a52; background: rgba(255,255,255,0.045); }
  .login-form-inner .field-input:focus {
    border-color: var(--accent);
    background: rgba(150, 169, 215, 0.04);
    box-shadow: 0 0 0 4px rgba(150, 169, 215, 0.12);
  }
  .login-form-inner .pass-wrap { position: relative; }
  .login-form-inner .pass-toggle { color: var(--text3); }
  .login-form-inner .pass-toggle:hover { color: var(--text); }

  .login-field { margin-bottom: 16px; }

  .login-error {
    background: var(--red-dim);
    border: 1px solid rgba(220, 80, 80, 0.4);
    color: var(--red);
    border-radius: 8px;
    padding: 10px 13px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
    line-height: 1.45;
  }

  .btn-login {
    width: 100%;
    padding: 13px 16px;
    border-radius: 8px;
    background: var(--grad-primary);
    border: 1px solid rgba(150, 169, 215, 0.18);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: filter 0.18s ease, transform 0.08s ease, box-shadow 0.18s ease;
    margin-top: 12px;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.08) inset,
      0 4px 12px -4px rgba(36, 58, 159, 0.5);
  }
  .btn-login:hover { filter: brightness(1.1); box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 6px 16px -4px rgba(36, 58, 159, 0.65); }
  .btn-login:active { transform: translateY(1px); filter: brightness(0.95); }
  .btn-login:focus-visible { outline: none; box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 0 0 4px rgba(150,169,215,0.18); }

  /* Links secundarios */
  .login-secondary { display: flex; justify-content: center; margin-top: 20px; }
  .login-link {
    background: none; border: none; color: var(--accent);
    font-family: inherit; font-size: 12.5px; font-weight: 500;
    cursor: pointer; padding: 4px 8px; border-radius: 4px;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease;
  }
  .login-link:hover { color: #b6c4e6; background: rgba(150, 169, 215, 0.06); }
  .login-link-muted { color: var(--text3); }
  .login-link-muted:hover { color: var(--text2); background: rgba(255,255,255,0.04); }

  /* Trust signal: separador + indicador de seguridad */
  .login-trust {
    margin-top: 28px; padding-top: 18px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text3);
    letter-spacing: 0.3px;
  }
  .login-trust svg { flex-shrink: 0; opacity: 0.7; }
  .login-trust-sep { color: var(--border2); }

  /* Footer versión bottom-right */
  .login-version-footer {
    position: fixed; right: 20px; bottom: 14px;
    font-family: 'Geist Mono', monospace;
    font-size: 10.5px; color: var(--text3);
    letter-spacing: 0.4px; pointer-events: none;
    opacity: 0.7;
  }

  /* Compat con .login-box legado por si quedó alguna referencia */
  .login-box { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r2); padding: 44px; width: 380px; max-width: 95vw; }
  .login-logo-img { display: block; margin: 0 auto 20px; width: 160px; background: #fff; border-radius: 12px; padding: 12px 16px; }
  .login-subtitle { font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 4px; }

  /* ── Planner ── */
  /* Filtro de estado multi-selección (checkboxes en dropdown, no <select>
     nativo: hace falta elegir 0..N estados a la vez, ej. "todo menos
     Completado"). Mismo look que .tn-dropdown-menu del topnav. */
  .pl-estsel { position:relative; }
  .pl-estsel-btn {
    display:flex; align-items:center; justify-content:space-between; gap:8px;
    padding:5px 10px; font-size:12px; width:auto; min-width:150px;
    font-family:inherit; text-align:left; cursor:pointer; color:var(--text);
  }
  .pl-estsel-menu {
    display:none; position:absolute; top:calc(100% + 4px); left:0;
    background:var(--card-bg-glass);
    backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
    border:1px solid var(--border2); border-radius:var(--r2);
    min-width:180px; z-index:200; padding:6px;
    box-shadow:var(--shadow-md); animation:modal-in 0.18s var(--ease);
  }
  .pl-estsel.open .pl-estsel-menu { display:block; }
  .pl-estsel-opt {
    display:flex; align-items:center; gap:8px; padding:7px 8px;
    font-size:12px; font-weight:600; color:var(--text2);
    border-radius:6px; cursor:pointer; transition:background 0.1s;
  }
  .pl-estsel-opt:hover { background:var(--surface2); color:var(--text); }
  .pl-estsel-opt input { cursor:pointer; }
  .pl-estsel-sep { height:1px; background:var(--border); margin:6px 2px; }
  .pl-estsel-clear {
    display:block; width:100%; padding:7px 8px; font-family:inherit;
    font-size:11.5px; font-weight:600; color:var(--text3);
    background:none; border:none; text-align:left; cursor:pointer; border-radius:6px;
    transition:background 0.1s, color 0.1s;
  }
  .pl-estsel-clear:hover { background:var(--surface2); color:var(--text); }

  /* KPIs por estado — compactos, no cards de dashboard: van sobre la tabla. */
  .pl-stats { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:18px; }
  .pl-stat {
    flex:1 1 0; min-width:110px;
    display:flex; flex-direction:column; align-items:flex-start; gap:2px;
    background:var(--surface); border:1px solid var(--border);
    border-left:3px solid var(--pl-stat-color); border-radius:var(--r2);
    padding:10px 14px; cursor:pointer; text-align:left;
    transition:border-color var(--t-base), background var(--t-base);
  }
  .pl-stat:hover { border-color:var(--border2); background:var(--bg2); }
  .pl-stat-on { border-color:var(--pl-stat-color); background:var(--bg2); }
  .pl-stat-num { font-size:20px; font-weight:700; color:var(--pl-stat-color); line-height:1.1; }
  .pl-stat-label { font-size:11px; font-weight:600; color:var(--text3); letter-spacing:0.2px; }
  .pl-table { width:100%; border-collapse:collapse; font-size:13px; }
  .pl-table thead tr { border-bottom:2px solid var(--border2); }
  .pl-table th { font-size:10px; font-weight:600; letter-spacing:1px; text-transform:uppercase; color:var(--text3); padding:8px 12px; text-align:left; white-space:nowrap; }
  .pl-table td { padding:11px 12px; border-bottom:1px solid var(--border); vertical-align:middle; color:var(--text); }
  .pl-row:hover td { background:var(--surface2); }
  .pl-row-open td { background:var(--surface); border-bottom:none; }
  .pl-cell-muted { color:var(--text2); }
  .pl-toggle { background:none; border:none; cursor:pointer; color:var(--text3); padding:2px 4px; border-radius:4px; display:flex; align-items:center; transition:color 0.15s; }
  .pl-toggle:hover { color:var(--accent); }
  .pl-chip { font-size:11px; font-weight:600; padding:3px 9px; border-radius:99px; white-space:nowrap; border: 1px solid transparent; display: inline-flex; align-items: center; line-height: 1.4; }
  .pl-chip-sm { font-size:10px; padding:2px 7px; }
  .pl-sector-tag { font-size:10px; font-weight:600; padding:2px 8px; border-radius:99px; background:var(--accent-dim); color:var(--accent); }
  /* v0.37.0 — asignación múltiple (N usuarios y/o N sectores): se elige desde
     el desplegable y el ítem queda como chip removible debajo. */
  .pl-tags { display:flex; flex-wrap:wrap; gap:5px; margin-top:7px; min-height:22px; align-items:center; }
  .pl-tag { display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:600; padding:3px 5px 3px 9px; border-radius:99px; background:var(--accent-dim); color:var(--accent); }
  .pl-tag-x { background:none; border:none; cursor:pointer; color:inherit; opacity:0.65; font-size:14px; line-height:1; padding:0 3px; border-radius:99px; }
  .pl-tag-x:hover { opacity:1; background:var(--red-dim); color:var(--red); }
  .pl-hint { font-size:11px; color:var(--text3); margin-top:5px; line-height:1.45; }
  /* v0.38.0 — adjuntos en proyectos y tareas */
  .pl-adj-box { border:1px solid var(--border2); border-radius:var(--r); background:var(--surface2); padding:10px 12px; margin-bottom:14px; }
  .pl-adj-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; }
  .pl-adj-title { font-size:11px; font-weight:700; letter-spacing:0.04em; text-transform:uppercase; color:var(--text3); }
  .pl-adj-list { display:flex; flex-wrap:wrap; gap:5px; align-items:center; }
  .pl-adj { display:inline-flex; align-items:center; gap:2px; background:var(--surface3); border-radius:99px; padding-right:2px; max-width:220px; }
  .pl-adj-link { display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:600; color:var(--text2); text-decoration:none; padding:3px 4px 3px 9px; min-width:0; }
  .pl-adj-link span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .pl-adj-link:hover { color:var(--accent); }
  .pl-adj-x { background:none; border:none; cursor:pointer; color:var(--text3); font-size:14px; line-height:1; padding:0 5px; border-radius:99px; }
  .pl-adj-x:hover { color:var(--red); background:var(--red-dim); }
  .pl-adj-add { display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:600; color:var(--accent); background:var(--accent-dim); border-radius:99px; padding:3px 10px; cursor:pointer; white-space:nowrap; }
  .pl-adj-add:hover { filter:brightness(1.15); }
  .pl-adj-input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
  .pl-asig { display:flex; flex-wrap:wrap; gap:4px; align-items:center; }
  .pl-asig-chip { font-size:10.5px; font-weight:600; padding:2px 8px; border-radius:99px; background:var(--surface3); color:var(--text2); white-space:nowrap; }
  .pl-asig-lider { background:var(--accent-dim); color:var(--accent); }
  .pl-bar { flex:1; height:6px; background:var(--surface3); border-radius:99px; overflow:hidden; min-width:60px; }
  .pl-bar-fill { height:100%; border-radius:99px; transition:width 0.3s; }
  .pl-act { background:none; border:1px solid transparent; cursor:pointer; color:var(--text3); padding:4px; border-radius:var(--r); display:flex; align-items:center; transition:all 0.15s; }
  .pl-act:hover { color:var(--accent); border-color:var(--accent); background:var(--accent-dim); }
  .pl-act-del:hover { color:var(--red); border-color:var(--red); background:var(--red-dim); }
  .pl-tasks-row td { padding:0; background:var(--bg) !important; border-bottom:2px solid var(--border2); }
  .pl-tasks-wrap { padding:14px 24px 16px 48px; }
  .pl-tasks-tbl { width:100%; border-collapse:collapse; font-size:12px; margin-bottom:4px; }
  .pl-tasks-tbl th { font-size:10px; font-weight:600; letter-spacing:0.8px; text-transform:uppercase; color:var(--text3); padding:5px 10px; text-align:left; border-bottom:1px solid var(--border); }
  .pl-tasks-tbl td { padding:8px 10px; border-bottom:1px solid var(--border); color:var(--text2); vertical-align:middle; }
  .pl-tasks-tbl tr:last-child td { border-bottom:none; }
  .pl-tasks-tbl tr:hover td { background:var(--surface2); }
  .pl-link { background:none; border:none; cursor:pointer; color:var(--accent); font-size:12px; font-family:inherit; font-weight:600; padding:0; display:inline-flex; align-items:center; gap:4px; transition:opacity 0.15s; }
  .pl-link:hover { opacity:0.75; }

  /* ── Toast ── */
  #toast {
    position: fixed; bottom: 22px; right: 22px;
    background: var(--card-bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    padding: 12px 18px;
    font-size: 13px; font-weight: 500;
    color: var(--text);
    transform: translateY(20px) scale(0.96);
    opacity: 0;
    transition: transform 0.32s var(--ease), opacity 0.25s ease;
    z-index: 300;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    max-width: 380px;
    line-height: 1.45;
  }
  #toast.show { transform: translateY(0) scale(1); opacity: 1; }

  /* Colors */
  .color-0 { background: var(--accent-dim); color: var(--accent); }
  .color-1 { background: var(--green-dim); color: var(--green); }
  .color-2 { background: var(--purple-dim); color: var(--purple); }
  .color-3 { background: var(--teal-dim); color: var(--teal); }
  .color-4 { background: var(--pink-dim); color: var(--pink); }
  .color-5 { background: var(--amber-dim); color: var(--amber); }

  ::-webkit-scrollbar { width: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  /* ── Visitas Técnicas ── */
  #vista-visitas { display: none; flex-direction: row; width: 100%; height: 100%; overflow: hidden; }
  .vt-sidebar {
    width: 280px; min-width: 280px; background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; height: 100%;
  }
  .vt-sidebar-header { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
  .vt-sidebar-title { font-size: 13px; font-weight: 700; color: var(--text); padding: 2px 0 4px; }
  .vt-sidebar-controls { display: flex; flex-direction: column; gap: 6px; }
  .vt-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
  .vt-item {
    padding: 10px 12px; border-radius: var(--r); cursor: pointer;
    display: flex; flex-direction: column; gap: 3px;
    transition: background var(--t-base), color var(--t-base);
    margin-bottom: 3px; border: 1px solid transparent;
    position: relative;
  }
  .vt-item:hover { background: var(--surface2); }
  .vt-item.active { background: var(--accent-dim); border-color: rgba(150,169,215,0.18); }
  .vt-item.active::before {
    content: ''; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px;
    background: var(--accent); border-radius: 0 2px 2px 0;
  }
  .vt-item.active .vt-item-code { color: var(--accent); }
  .vt-item-code { font-size: 12px; font-weight: 700; font-family: 'Geist Mono', monospace; color: var(--text); }
  .vt-item-client { font-size: 12px; font-weight: 600; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .vt-item-meta { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .vt-item-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
  .vt-badge {
    font-size: 10px; font-weight: 600;
    padding: 3px 9px; border-radius: 20px;
    display: inline-flex; align-items: center;
    border: 1px solid transparent;
    letter-spacing: 0.4px; text-transform: uppercase;
    line-height: 1.4;
  }
  .vt-badge.Pendiente  { background: var(--amber-dim);  color: var(--amber);  border-color: rgba(251,191,36,0.25); }
  .vt-badge.En-curso   { background: var(--accent-dim); color: var(--accent); border-color: rgba(150,169,215,0.25); }
  .vt-badge.Completada { background: var(--green-dim);  color: var(--green);  border-color: rgba(74,222,128,0.25); }
  .vt-badge.Cancelada  { background: var(--red-dim);    color: var(--red);    border-color: rgba(248,113,113,0.25); }
  .vt-sidebar-footer { padding: 10px 8px; border-top: 1px solid var(--border); }

  .vt-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
  .vt-welcome {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--text3); gap: 12px;
  }
  .vt-welcome h2 { font-size: 18px; color: var(--text2); }

  .vt-detail { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
  .vt-detail-header {
    padding: 18px 28px 14px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px; flex-shrink: 0; background: var(--bg);
  }
  .vt-detail-code { font-size: 18px; font-weight: 700; font-family: 'Geist Mono', monospace; }
  .vt-detail-actions { margin-left: auto; display: flex; gap: 6px; }
  .vt-tabs { padding: 0 24px; border-bottom: 1px solid var(--border); display: flex; gap: 2px; flex-shrink: 0; background: var(--bg); }
  .vt-tab-btn {
    padding: 12px 16px; font-family: inherit; font-size: 12px; font-weight: 600;
    color: var(--text3); background: none; border: none; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color var(--t-base), background var(--t-base), border-color var(--t-base);
  }
  .vt-tab-btn:hover { color: var(--text); background: rgba(255,255,255,0.025); }
  .vt-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
  .vt-tab-btn:focus-visible { outline: none; box-shadow: var(--ring-accent); border-radius: var(--r) var(--r) 0 0; }
  .vt-tab-content { display: none; padding: 22px 28px; overflow-y: auto; flex: 1; }
  .vt-tab-content.active { display: block; }

  .vt-info-row { display: flex; padding: 9px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
  .vt-info-row:last-child { border-bottom: none; }
  .vt-info-label { font-size: 11px; color: var(--text3); font-family: 'Geist Mono', monospace; width: 120px; flex-shrink: 0; padding-top: 2px; }
  .vt-info-value { font-size: 13px; color: var(--text); flex: 1; }

  .vt-tarea-item {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
    padding: 12px 14px; margin-bottom: 8px;
    display: flex; gap: 12px; align-items: flex-start;
    transition: border-color var(--t-base), box-shadow var(--t-base);
  }
  .vt-tarea-item:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); }
  .vt-tarea-body { flex: 1; }
  .vt-tarea-tipo {
    font-size: 10px; font-weight: 600;
    padding: 3px 9px; border-radius: 20px;
    background: var(--accent-dim); color: var(--accent);
    border: 1px solid rgba(150,169,215,0.25);
    display: inline-flex; align-items: center;
    margin-bottom: 6px;
    letter-spacing: 0.4px; text-transform: uppercase;
  }
  .vt-tarea-desc { font-size: 13px; color: var(--text2); }
  .vt-tarea-actions { display: flex; gap: 4px; flex-shrink: 0; }

  .vt-inline-form {
    background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r2);
    padding: 14px 16px; margin-top: 10px;
  }
  .vt-inline-form-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: flex-start; }

  .vt-foto-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
  .vt-foto-thumb {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
    overflow: hidden; position: relative;
    transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
  }
  .vt-foto-thumb:hover { border-color: var(--border2); box-shadow: var(--shadow-md); transform: translateY(-1px); }
  .vt-foto-thumb img { width: 100%; height: 110px; object-fit: cover; display: block; cursor: pointer; transition: opacity 0.15s, transform 0.3s var(--ease); }
  .vt-foto-thumb:hover img { transform: scale(1.04); }
  .vt-foto-thumb-footer { padding: 6px 8px; display: flex; align-items: center; justify-content: space-between; }
  .vt-foto-desc { font-size: 11px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

  .vt-upload-area {
    margin-top: 14px; border: 1.5px dashed var(--border2); border-radius: var(--r);
    padding: 18px 14px; text-align: center;
    background: rgba(255,255,255,0.015);
    transition: border-color var(--t-base), background var(--t-base);
  }
  .vt-upload-area:hover { border-color: var(--accent); background: rgba(150,169,215,0.04); }
  .vt-upload-label { font-size: 12px; color: var(--text3); cursor: pointer; transition: color var(--t-base); display: inline-flex; align-items: center; gap: 8px; }
  .vt-upload-area:hover .vt-upload-label { color: var(--accent); }

  .vt-section-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .vt-section-title { font-size: 13px; font-weight: 600; }

  /* Modal visita */
  #modal-visita,
  #modal-cita { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.62); z-index: 110; align-items: center; justify-content: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: overlay-in 0.18s ease; }
  #modal-visita.open,
  #modal-cita.open { display: flex; }

  /* Modales nuevos (tickets, portal, usuarios, invitaciones).
     Mismos overlay/posicionamiento que #modal-visita. El display lo
     manipula el JS con inline style (none ↔ flex), por eso acá NO
     definimos display — solo las props de overlay. */
  #modal-ticket,
  #modal-tk-categorias,
  #modal-tk-close,
  #modal-tk-reopen,
  #modal-tk-priochg,
  #modal-usr-new,
  #prtl-modal-new,
  #modal-prtl-reopen,
  #prtl-modal-account {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.62);
    z-index: 110;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: overlay-in 0.18s ease;
  }
  .vt-modal {
    background: var(--card-bg-glass);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border2); border-radius: var(--r2);
    width: 560px; max-width: 96vw; max-height: 92vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.32s var(--ease);
  }
  .vt-modal-body { padding: 20px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .vt-modal-body .full { grid-column: 1 / -1; }
  .vt-modal-time-row { display: flex; gap: 10px; grid-column: 1 / -1; }
  .vt-modal-time-row > div { flex: 1; }

  /* Selector multi-técnico del modal de visita (v0.44.0) */
  .vt-tecnicos-picker {
    border: 1px solid var(--border); border-radius: var(--r1);
    background: var(--bg); max-height: 148px; overflow-y: auto;
  }
  .vt-tecnicos-opt {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 11px; font-size: 13px; color: var(--text1); cursor: pointer;
    border-bottom: 1px solid var(--border);
  }
  .vt-tecnicos-opt:last-child { border-bottom: none; }
  .vt-tecnicos-opt:hover { background: var(--surface2); }
  .vt-tecnicos-opt input { cursor: pointer; accent-color: var(--accent2); }
  .vt-tecnicos-principal {
    margin-left: auto; font-size: 10px; font-weight: 600; letter-spacing: .03em;
    text-transform: uppercase; color: var(--accent);
    background: var(--accent-dim); border-radius: 999px; padding: 2px 7px;
  }
  .vt-tecnicos-hint { margin-top: 6px; font-size: 11px; color: var(--text3); }

  /* Chips de técnicos en el detalle y el listado */
  .vt-tecnico-chip {
    display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text2); margin: 0 4px 4px 0;
  }

  /* Botón volver mobile (oculto en desktop) */
  .vt-back-btn { display: none; }

  /* ── MOBILE ── */
  @media (max-width: 768px) {
    /* Top nav */
    #topnav { padding: 0 8px; gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tn-btn { padding: 0 9px; font-size: 11px; }
    .tn-sep { margin: 0 4px; }
    .tn-user { display: none; }

    /* App body: columnas → apilado */
    #appbody { flex-direction: column; overflow: auto; }

    /* Sidebar de clientes */
    #sidebar {
      width: 100%; min-width: unset; border-right: none;
      border-bottom: 1px solid var(--border);
      max-height: 45vh;
    }
    .client-list { min-height: 0; }
    #appbody.mobile-client #sidebar { display: none; }
    #appbody:not(.mobile-client) #maincontent { display: none; }

    /* Botón volver en panel de cliente */
    .cp-back-btn { display: flex !important; }

    /* Cliente detail */
    .cp-header { padding: 14px 16px 12px; gap: 12px; }
    .cp-name { font-size: 16px; }
    .tab-content { padding: 16px; }
    .cp-tabs { padding: 0 12px; overflow-x: auto; }
    .tab-btn { padding: 12px 10px; font-size: 11px; white-space: nowrap; }
    .cards-grid { grid-template-columns: 1fr; }

    /* Visitas: two-col → apilado con toggle */
    #vista-visitas { flex-direction: column; overflow: hidden; }
    .vt-sidebar {
      width: 100%; min-width: unset; border-right: none;
      max-height: 50vh;
    }
    .vt-list { min-height: 0; }
    .vt-main { width: 100%; flex: 1; min-height: 0; }

    #vista-visitas:not(.mobile-detail) .vt-main { display: none; }
    #vista-visitas.mobile-detail .vt-sidebar { display: none; }

    /* Botón volver en visita */
    .vt-back-btn {
      display: flex; align-items: center; gap: 6px;
      padding: 6px 10px; border-radius: var(--r);
      border: 1px solid var(--border); background: var(--surface);
      color: var(--text2); font-family: inherit; font-size: 12px;
      font-weight: 600; cursor: pointer; flex-shrink: 0;
    }

    /* Detail header más compacto */
    .vt-detail-header { padding: 12px 14px 10px; gap: 10px; flex-wrap: wrap; }
    .vt-detail-code { font-size: 15px; }
    .vt-detail-actions { gap: 4px; }
    .btn-icon { width: 36px; height: 36px; }

    /* Tabs */
    .vt-tabs { padding: 0 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0; }
    .vt-tab-btn { padding: 10px 11px; font-size: 11px; white-space: nowrap; }
    .vt-tab-content { padding: 14px; }

    /* Info rows */
    .vt-info-label { font-size: 11px; min-width: 90px; }
    .vt-info-value { font-size: 12px; }

    /* Fotos grid */
    .vt-foto-grid { grid-template-columns: 1fr 1fr; }

    /* Modal visita full-screen en mobile */
    .vt-modal { width: 100%; max-width: 100%; border-radius: var(--r2) var(--r2) 0 0; margin-top: auto; }
    #modal-visita,
    #modal-cita { align-items: flex-end; }
    #modal-firmas { padding: 10px; }

    /* Modal visita: grid 2col → 1col */
    .vt-modal-body { grid-template-columns: 1fr !important; padding: 16px; }
    .vt-modal-time-row { grid-column: 1; }

    /* Login: card a pantalla completa visual en mobile */
    .login-split { padding: 16px; }
    .login-form-inner { padding: 32px 22px 24px; border-radius: 12px; }
    .login-logo-top { width: 160px; margin-bottom: 16px; }
    .login-tagline { margin-bottom: 24px; font-size: 12px; }
    .login-greeting h2 { font-size: 20px; }
    .login-box { padding: 28px 18px; }

    /* Panel headers: permitir wrap en pantallas chicas */
    .panel-header { flex-wrap: wrap; gap: 10px; padding: 14px 16px 12px; }
    .panel-title { font-size: 15px; }

    /* Tablas: scroll horizontal */
    .users-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Logs: filtros en columna */
    #vista-logs .panel-header > div { flex-direction: column; width: 100%; }
    #vista-logs .panel-header > div .field-input { width: 100% !important; }

    /* Vistas de configuración: padding lateral reducido */
    #vista-smtp  { padding: 16px !important; }
    #vista-empresa { padding: 16px !important; }
    #vista-backups .panel-header { padding: 14px 16px; }
    #vista-backups > div > div[style*="padding:12px"] { padding: 10px 16px !important; font-size: 11px; }

    /* SMTP: grid 2col → 1col */
    .cfg-grid { grid-template-columns: 1fr !important; }

    /* Admin dropdown: fixed para escapar del overflow del topnav */
    .tn-dropdown-menu { position: fixed; top: 48px; right: 0; left: auto; min-width: 180px; z-index: 300; }

    /* Modales genéricos: más ancho en mobile */
    .modal-box { width: 96vw !important; max-width: 96vw !important; }

    /* Client tabs: scroll horizontal */
    .cp-tabs { flex-wrap: nowrap; }
    .tab-content { padding: 14px 12px; }

    /* Cards grid: 1 sola columna en mobile */
    .cards-grid { grid-template-columns: 1fr; }

    /* Section header: wrap si hace falta */
    .section-hdr { flex-wrap: wrap; gap: 8px; }

    /* Invoice table: scroll horizontal */
    .invoice-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Backups table */
    #backups-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Usuarios: padding reducido */
    #vista-usuarios > div { padding: 14px !important; }

    /* Búsqueda: dropdown full-width y fixed en mobile */
    .tn-search-input { width: 130px; padding-left: 26px; font-size: 11px; }
    .tn-search-input:focus { width: 150px; }
    .search-dropdown {
      position: fixed; top: 48px; left: 0; right: 0; width: 100%;
      border-radius: 0; max-height: 50vh; overflow-y: auto;
      border-left: none; border-right: none;
    }
    .notif-panel { position: fixed; top: 48px; right: 0; left: 0; width: 100%; border-radius: 0; }

    /* Inventario: sidebar colapsable en mobile */
    .inv-body { flex-direction: column; overflow: hidden; }
    .inv-sidebar {
      width: 100%; min-width: unset; border-right: none;
      border-bottom: 1px solid var(--border);
      max-height: 40vh;
    }
    .inv-list { min-height: 0; }
    .inv-main { flex: 1; min-height: 0; overflow-y: auto; }
  }

  /* Inventario: pantallas medianas (tablets/laptops chicos) */
  @media (max-width: 1024px) and (min-width: 769px) {
    .inv-sidebar { width: 220px; min-width: 220px; }
  }

  /* ── Inventario ── */
  #vista-inventario { display: none; flex-direction: column; width: 100%; height: 100%; overflow: hidden; }
  .inv-toolbar {
    display: flex; align-items: center; gap: 10px; padding: 10px 18px;
    border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0; flex-wrap: wrap;
  }
  .inv-tabs {
    display: flex; gap: 2px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--r); padding: 3px;
    box-shadow: 0 1px 0 rgba(255,255,255,0.025) inset;
  }
  .inv-tab {
    padding: 6px 14px; border-radius: 6px; border: none; background: transparent;
    font-family: inherit; font-size: 12px; font-weight: 600; color: var(--text3); cursor: pointer;
    transition: color var(--t-base), background var(--t-base), box-shadow var(--t-base);
  }
  .inv-tab:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.03); }
  .inv-tab.active {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,0.10) inset, 0 2px 6px -2px rgba(36,58,159,0.45);
  }
  .inv-body { display: flex; flex: 1; overflow: hidden; }
  .inv-sidebar {
    width: 280px; min-width: 280px; background: var(--surface);
    border-right: 1px solid var(--border); display: flex; flex-direction: column; height: 100%;
  }
  .inv-sidebar-header { padding: 12px 12px 8px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
  .inv-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
  .inv-item {
    padding: 10px 12px; border-radius: var(--r); cursor: pointer;
    display: flex; flex-direction: column; gap: 3px;
    transition: background var(--t-base);
    margin-bottom: 3px; border: 1px solid transparent;
    position: relative;
  }
  .inv-item:hover { background: var(--surface2); }
  .inv-item.active { background: var(--accent-dim); border-color: rgba(150,169,215,0.18); }
  .inv-item.active::before {
    content: ''; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px;
    background: var(--accent); border-radius: 0 2px 2px 0;
  }
  .inv-item-title { font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .inv-item.active .inv-item-title { color: var(--accent); }
  .inv-item-sub { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .inv-sidebar-footer { padding: 10px 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
  .inv-main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
  .inv-welcome {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; color: var(--text3);
  }
  .inv-detail { padding: 24px 28px; flex: 1; }
  .inv-detail-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 20px; gap: 12px;
  }
  .inv-detail-title { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.4px; }
  .inv-detail-subtitle { font-size: 12px; color: var(--text3); margin-top: 4px; }
  .inv-section { margin-bottom: 20px; }
  .inv-section-title {
    font-size: 10px; font-weight: 700; color: var(--text3); letter-spacing: 0.08em;
    text-transform: uppercase; margin-bottom: 10px; padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
  }
  .inv-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; }
  .inv-label { font-size: 11px; color: var(--text3); font-weight: 500; min-width: 130px; flex-shrink: 0; }
  .inv-value { font-size: 13px; color: var(--text); word-break: break-all; }
  .inv-pass-wrap { display: flex; align-items: center; gap: 6px; }
  .inv-pass-val { font-family: 'Geist Mono', monospace; font-size: 12px; color: var(--text); }
  .inv-eye {
    background: none; border: none; color: var(--text3); cursor: pointer; padding: 2px 4px;
    border-radius: 4px; transition: color 0.15s; line-height: 1;
  }
  .inv-eye:hover { color: var(--accent); }
  .inv-tipo-badge {
    display: inline-flex; align-items: center;
    font-size: 10px; font-weight: 700;
    padding: 3px 9px; border-radius: 20px;
    background: var(--accent-dim); color: var(--accent);
    border: 1px solid rgba(150,169,215,0.25);
    letter-spacing: 0.4px; text-transform: uppercase;
  }
  .inv-equipo-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600;
    color: var(--accent); cursor: pointer;
    padding: 5px 10px; border-radius: var(--r);
    background: var(--accent-dim);
    border: 1px solid rgba(150,169,215,0.18);
    font-family: inherit;
    transition: background var(--t-base), border-color var(--t-base), box-shadow var(--t-base);
  }
  .inv-equipo-link:hover { background: rgba(150,169,215,0.18); border-color: var(--accent); box-shadow: var(--shadow-sm); }
  .inv-filters { padding: 8px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 5px; }
  .inv-filter-group { display: flex; flex-wrap: wrap; gap: 4px; }
  .inv-fpill {
    padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border);
    background: var(--surface2); color: var(--text3); font-size: 11px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: border-color var(--t-base), color var(--t-base), background var(--t-base), box-shadow var(--t-base);
  }
  .inv-fpill:hover { border-color: var(--border2); color: var(--text); background: var(--surface3); }
  .inv-fpill.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px rgba(150,169,215,0.10); }
  .inv-fpill:focus-visible { outline: none; box-shadow: var(--ring-accent); }
  .inv-dash { padding: 20px 24px; width: 100%; box-sizing: border-box; }
  .inv-dash-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 12px; }
  .inv-dash-card {
    position: relative;
    background:
      radial-gradient(circle at 100% 0%, rgba(255,255,255,0.025), transparent 55%),
      var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r2);
    padding: 16px 18px;
    text-align: center;
    box-shadow: 0 1px 0 rgba(255,255,255,0.025) inset, var(--shadow-sm);
    transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
    overflow: hidden;
  }
  .inv-dash-card::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 100% 0%, rgba(150,169,215,0), transparent 60%);
    opacity: 0; transition: opacity var(--t-base); pointer-events: none;
  }
  .inv-dash-card:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, var(--shadow-md); }
  .inv-dash-card:hover::before { opacity: 1; background: radial-gradient(circle at 100% 0%, rgba(150,169,215,0.10), transparent 60%); }
  .inv-dash-num { font-size: 28px; font-weight: 800; color: var(--accent); line-height: 1; letter-spacing: -0.5px; position: relative; z-index: 1; }
  .inv-dash-label { font-size: 10px; color: var(--text3); font-weight: 600; margin-top: 6px; text-transform: uppercase; letter-spacing: 0.06em; position: relative; z-index: 1; }
  .inv-dash-estados { display: flex; flex-wrap: wrap; gap: 6px; }
  .inv-dash-badge {
    padding: 4px 10px; border-radius: 20px; background: var(--surface2);
    border: 1px solid var(--border); font-size: 11px; color: var(--text2);
    transition: border-color var(--t-base), background var(--t-base);
  }
  .inv-dash-badge:hover { border-color: var(--border2); background: var(--surface3); }
  .inv-dash-badge b { color: var(--text); }
  .btn-export {
    padding: 6px 12px; border-radius: var(--r); border: 1px solid var(--border);
    background: var(--surface2); color: var(--text2); font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 6px; transition: all 0.15s;
  }
  .btn-export:hover { border-color: var(--accent); color: var(--accent); }
  .inv-dash-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
  .inv-dash-chart-card {
    background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r);
    padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  }
  .inv-dash-chart-title { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; align-self: flex-start; }
  .inv-dash-chart-wrap { position: relative; width: 100%; max-width: 220px; }
  /* ── Dashboard general ── */
  .dash-view { padding: 28px 32px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 22px; }
  .dash-header { display: flex; align-items: flex-end; justify-content: space-between; padding: 4px 2px 0; margin-bottom: 4px; }
  .dash-greeting { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -0.6px; line-height: 1.15; }
  .dash-date { font-size: 12.5px; color: var(--text3); margin-top: 5px; text-transform: capitalize; letter-spacing: 0.1px; }
  .dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .dash-stat {
    position: relative;
    background:
      radial-gradient(circle at 100% 0%, rgba(255,255,255,0.03), transparent 55%),
      var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r2);
    padding: 22px 22px 20px;
    display: flex; align-items: center; gap: 16px;
    transition: border-color var(--t-base), transform var(--t-base), box-shadow var(--t-base);
    border-top: 2px solid var(--border2);
    border-left: 3px solid transparent;
    box-shadow: 0 1px 0 rgba(255,255,255,0.025) inset, var(--shadow-sm);
    overflow: hidden;
  }
  .dash-stat::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 100% 0%, rgba(150,169,215,0), transparent 60%);
    opacity: 0; transition: opacity var(--t-base);
    pointer-events: none;
  }
  .dash-stat.accent  { border-top-color: var(--accent); border-left-color: var(--accent); }
  .dash-stat.teal    { border-top-color: var(--teal);   border-left-color: var(--teal); }
  .dash-stat.amber   { border-top-color: var(--amber);  border-left-color: var(--amber); }
  .dash-stat.orange  { border-top-color: var(--orange); border-left-color: var(--orange); }
  .dash-stat.red     { border-top-color: var(--red);    border-left-color: var(--red); }
  .dash-stat.yellow  { border-top-color: #fbbf24;       border-left-color: #fbbf24; }
  .dash-stat.gray    { border-top-color: var(--border); border-left-color: var(--border); }
  .dash-stat:hover { border-color: var(--border2); box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, var(--shadow-md); }
  .dash-stat:hover::before { opacity: 1; background: radial-gradient(circle at 100% 0%, rgba(150,169,215,0.10), transparent 60%); }
  .dash-stat.accent:hover::before { background: radial-gradient(circle at 100% 0%, rgba(150,169,215,0.10), transparent 60%); }
  .dash-stat.teal:hover::before   { background: radial-gradient(circle at 100% 0%, rgba(45,212,191,0.10),  transparent 60%); }
  .dash-stat.amber:hover::before  { background: radial-gradient(circle at 100% 0%, rgba(251,191,36,0.10),  transparent 60%); }
  .dash-stat.orange:hover::before { background: radial-gradient(circle at 100% 0%, rgba(251,146,60,0.10),  transparent 60%); }
  .dash-stat.red:hover::before    { background: radial-gradient(circle at 100% 0%, rgba(248,113,113,0.10),  transparent 60%); }
  .dash-stat-link:hover { transform: translateY(-2px); }
  .dash-stat-link { transition: transform var(--t-base); }
  .dash-stat-text, .dash-stat-icon, .dash-stat-num, .dash-stat-label { position: relative; z-index: 1; }
  .dash-stat-icon {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-dim); color: var(--accent);
  }
  .dash-stat.teal   .dash-stat-icon { background: var(--teal-dim);   color: var(--teal); }
  .dash-stat.amber  .dash-stat-icon { background: var(--amber-dim);  color: var(--amber); }
  .dash-stat.orange .dash-stat-icon { background: var(--orange-dim); color: var(--orange); }
  .dash-stat-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .dash-stat-num { font-size: 34px; font-weight: 700; color: var(--text); line-height: 1; letter-spacing: -0.8px; }
  .dash-stat-label { font-size: 11px; color: var(--text3); font-weight: 500; text-transform: none; letter-spacing: 0; }
  /* Agrupación por módulo: encabezado + paneles del mismo módulo */
  .dash-section { display: flex; flex-direction: column; gap: 14px; }
  .dash-section-head {
    display: flex; align-items: center; gap: 8px;
    padding: 0 2px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 13px; font-weight: 700;
    letter-spacing: 0.3px; text-transform: uppercase;
    color: var(--text2);
  }
  .dash-section-head svg { color: var(--accent); }
  .dash-section-head .dash-panel-action {
    margin-left: auto;
    font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none;
    color: var(--accent); background: none; border: none; cursor: pointer;
    padding: 4px 8px; border-radius: 6px;
  }
  .dash-section-head .dash-panel-action:hover { background: var(--bg2); }
  .dash-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
  .dash-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r2);
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 1px 0 rgba(255,255,255,0.025) inset, var(--shadow-sm);
    transition: border-color var(--t-base), box-shadow var(--t-base);
  }
  .dash-panel:hover { border-color: var(--border2); box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, var(--shadow-md); }
  .dash-panel-head {
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12px; font-weight: 700;
    color: var(--text2);
    display: flex; align-items: center; gap: 8px;
    background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent);
  }
  .dash-panel-body { flex: 1; overflow-y: auto; max-height: 320px; }
  .dash-panel-head .dash-panel-action {
    margin-left: auto;
    font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none;
    color: var(--accent); background: none; border: none; cursor: pointer;
    padding: 4px 8px; border-radius: 6px;
  }
  .dash-panel-head .dash-panel-action:hover { background: var(--bg2); }
  #dash-panel-quality .dash-panel-body { max-height: none; }
  #dash-panel-tickets .dash-panel-body { max-height: none; }
  .dash-venc-item {
    display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 12px;
    padding: 10px 16px; border-bottom: 1px solid var(--border);
    font-size: 12px; transition: background 0.12s;
  }
  .dash-venc-item:hover { background: rgba(255,255,255,0.03); }
  .dash-venc-item:last-child { border-bottom: none; }
  .dash-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .dash-dot-red { background: #f87171; }
  .dash-dot-yellow { background: #facc15; }
  .dash-dot-green { background: #4ade80; }
  .dash-venc-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .dash-venc-cliente { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dash-venc-detalle { color: var(--text3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dash-venc-right { text-align: right; flex-shrink: 0; }
  .dash-venc-dias { font-size: 11px; font-weight: 700; }
  .dash-venc-fecha { font-size: 10px; color: var(--text3); }
  .dash-visita-item {
    padding: 10px 16px; border-bottom: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 3px; font-size: 12px; transition: background 0.12s;
  }
  .dash-visita-item:hover { background: rgba(255,255,255,0.03); }
  .dash-visita-item:last-child { border-bottom: none; }
  .dash-visita-title { font-weight: 700; color: var(--text); }
  .dash-visita-sub { color: var(--text3); font-size: 11px; }
  .dash-act-item {
    padding: 9px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: baseline; gap: 10px; font-size: 11px; transition: background 0.12s;
  }
  .dash-act-item:hover { background: rgba(255,255,255,0.03); }
  .dash-act-item:last-child { border-bottom: none; }
  .dash-act-user { font-weight: 700; color: var(--accent); flex-shrink: 0; }
  .dash-act-detail { color: var(--text2); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dash-act-time { color: var(--text3); flex-shrink: 0; }
  .dash-empty { padding: 24px; text-align: center; color: var(--text3); font-size: 12px; }

  /* ── Search Global ── */
  .tn-search-wrap { position: relative; display: flex; align-items: center; margin: 0 8px; }
  .tn-search-input {
    background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r);
    color: var(--text); font-family: inherit; font-size: 12px;
    padding: 6px 10px 6px 30px; width: 190px; outline: none;
    transition: width 0.2s ease, border-color var(--t-base), box-shadow var(--t-base), background var(--t-base);
  }
  .tn-search-input:focus {
    border-color: var(--accent);
    width: 280px;
    background: var(--surface);
    box-shadow: var(--ring-accent);
  }
  .tn-search-input::placeholder { color: var(--text3); }
  .tn-search-icon { position: absolute; left: 8px; color: var(--text3); pointer-events: none; flex-shrink: 0; }
  .search-dropdown {
    display: none; position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--card-bg-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border2);
    border-radius: var(--r2);
    width: 420px; z-index: 300; overflow: hidden;
    box-shadow: var(--shadow-lg);
  }
  @keyframes search-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
  .search-dropdown.open { display: block; animation: search-in 0.24s var(--ease); }
  .search-list { max-height: 60vh; overflow-y: auto; padding: 4px 0; }
  .search-section-label { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text3); padding: 10px 14px 4px; }
  .search-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 14px;
    cursor: pointer; transition: background 0.12s, transform 0.12s; border: none; background: none;
    width: 100%; text-align: left; font-family: inherit; color: inherit;
  }
  .search-item:hover { background: var(--surface2); }
  .search-item.active { background: var(--accent-dim); }
  .search-item.active .search-item-main { color: var(--accent); }
  .search-item-icon { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 700; }
  .search-item-content { flex: 1; min-width: 0; }
  .search-item-main { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .search-item-sub { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .search-item-pill {
    font-size: 9px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
    padding: 3px 8px; border-radius: 999px; flex-shrink: 0;
  }
  .search-item-pill.tipo-cliente  { background: var(--accent-dim); color: var(--accent); }
  .search-item-pill.tipo-contacto { background: var(--purple-dim); color: var(--purple); }
  .search-item-pill.tipo-visita   { background: var(--teal-dim);   color: var(--teal); }
  .search-item-pill.tipo-equipo   { background: var(--green-dim);  color: var(--green); }
  .search-item-pill.tipo-usuario  { background: var(--amber-dim);  color: var(--amber); }
  .search-divider { height: 1px; background: var(--border); margin: 4px 0; }
  .search-empty { padding: 24px 14px; text-align: center; color: var(--text3); font-size: 13px; }
  .search-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 14px; border-top: 1px solid var(--border);
    font-size: 10px; color: var(--text3); letter-spacing: 0.4px;
  }
  .search-footer kbd {
    font-family: 'Geist Mono', monospace; font-size: 10px; font-weight: 600;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 4px; padding: 1px 6px; color: var(--text2); margin: 0 2px;
  }

  /* ── Notificaciones ── */
  .tn-notif-wrap { position: relative; }
  .tn-notif-btn {
    width: 32px; height: 32px; border-radius: var(--r); border: 1px solid var(--border);
    background: transparent; color: var(--text3); cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: all 0.15s; position: relative; margin-right: 4px;
  }
  .tn-notif-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
  .notif-badge {
    position: absolute; top: -5px; right: -5px; background: var(--red);
    color: #fff; font-size: 9px; font-weight: 700; border-radius: 8px;
    min-width: 16px; height: 16px; align-items: center; justify-content: center;
    padding: 0 3px; display: none;
  }
  .notif-panel {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r2);
    width: 320px; z-index: 300;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    max-height: 420px; overflow: hidden; display: none; flex-direction: column;
    animation: modal-in 0.12s ease;
  }
  .notif-panel.open { display: flex; }
  .notif-panel-header { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
  .notif-panel-title { font-size: 13px; font-weight: 700; color: var(--text); }
  .notif-read-all { font-size: 11px; color: var(--accent); background: none; border: none; cursor: pointer; font-family: inherit; padding: 0; }
  .notif-read-all:hover { text-decoration: underline; }
  .notif-list { overflow-y: auto; flex: 1; }
  .notif-item {
    padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer;
    transition: background 0.1s; display: flex; gap: 10px; align-items: flex-start;
  }
  .notif-item:hover { background: var(--surface2); }
  .notif-item.unread { background: var(--accent-dim); }
  .notif-item.unread:hover { background: rgba(150,169,215,0.18); }
  .notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 5px; }
  .notif-dot.read { background: transparent; }
  .notif-text { flex: 1; min-width: 0; }
  .notif-titulo { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.4; }
  .notif-mensaje { font-size: 11px; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .notif-time { font-size: 10px; color: var(--text3); margin-top: 3px; }
  .notif-empty { padding: 24px 14px; text-align: center; color: var(--text3); font-size: 13px; }

  /* ── Calendario ── */
  #vista-calendario { display: none; }
  .cal-header {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
    background: var(--surface); flex-shrink: 0;
  }
  .cal-nav { display: flex; align-items: center; gap: 8px; }
  .cal-nav-btn {
    width: 32px; height: 32px; border-radius: var(--r);
    border: 1px solid var(--border);
    background: var(--surface2); color: var(--text2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color var(--t-base), color var(--t-base), background var(--t-base), box-shadow var(--t-base);
  }
  .cal-nav-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); box-shadow: var(--shadow-sm); }
  .cal-nav-btn:focus-visible { outline: none; box-shadow: var(--ring-accent); }
  .cal-title { font-size: 15px; font-weight: 700; color: var(--text); min-width: 150px; text-align: center; letter-spacing: -0.2px; }
  .cal-today-btn {
    padding: 6px 14px; border-radius: var(--r);
    border: 1px solid var(--border);
    background: var(--surface2); color: var(--text2);
    font-family: inherit; font-size: 12px; font-weight: 600;
    cursor: pointer;
    transition: border-color var(--t-base), color var(--t-base), background var(--t-base), box-shadow var(--t-base);
  }
  .cal-today-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); box-shadow: var(--shadow-sm); }
  .cal-today-btn:focus-visible { outline: none; box-shadow: var(--ring-accent); }
  .cal-view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    margin-left: auto;
    background: var(--surface2);
    box-shadow: 0 1px 0 rgba(255,255,255,0.025) inset;
  }
  .cal-view-btn {
    padding: 6px 14px; border: none; background: transparent; color: var(--text3);
    font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
    transition: color var(--t-base), background var(--t-base);
  }
  .cal-view-btn:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.03); }
  .cal-view-btn.active {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,0.10) inset, 0 2px 6px -2px rgba(36,58,159,0.45);
  }
  .cal-filter { display: flex; align-items: center; }
  .cal-body { flex: 1; overflow: auto; display: flex; flex-direction: column; }

  /* Vista mensual */
  .cal-month { display: flex; flex-direction: column; flex: 1; }
  .cal-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border); background: var(--surface);
  }
  .cal-weekday {
    padding: 8px 4px; text-align: center; font-size: 11px; font-weight: 600;
    color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px;
  }
  .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; }
  .cal-day {
    min-height: 90px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
    padding: 6px; display: flex; flex-direction: column; gap: 3px;
    background: var(--surface); transition: background var(--t-base);
  }
  .cal-day:hover:not(.other-month) { background: var(--surface2); }
  .cal-day:nth-child(7n) { border-right: none; }
  .cal-day.other-month { background: var(--bg); }
  .cal-day.today {
    background:
      radial-gradient(ellipse at top, rgba(150,169,215,0.10), transparent 60%),
      var(--accent-dim);
  }
  .cal-day-num {
    font-size: 12px; font-weight: 600; color: var(--text3);
    width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; flex-shrink: 0;
    transition: background var(--t-base), color var(--t-base);
  }
  .cal-day.today .cal-day-num {
    background: var(--grad-primary);
    color: var(--btn-primary-fg);
  }
  .cal-day.other-month .cal-day-num { color: var(--text3); opacity: 0.4; }
  .cal-chip {
    font-size: 11px; padding: 3px 7px; border-radius: 5px; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-weight: 600;
    transition: filter var(--t-base), transform 0.08s ease;
    line-height: 1.4;
    border: 1px solid transparent;
  }
  .cal-chip:hover { filter: brightness(1.15); transform: translateX(1px); }
  .cal-chip.Pendiente  { background: var(--amber-dim);  color: var(--amber);  border-color: rgba(251,191,36,0.25); }
  .cal-chip.En-curso   { background: var(--accent-dim); color: var(--accent); border-color: rgba(150,169,215,0.25); }
  .cal-chip.Completada { background: var(--green-dim);  color: var(--green);  border-color: rgba(74,222,128,0.25); }
  .cal-chip.Cancelada  { background: var(--red-dim);    color: var(--red);    border-color: rgba(248,113,113,0.25); }
  /* Vencimientos (v0.45.0): morado, fuera de la paleta de estados de visita,
     para que se lean como otra cosa y no como "una visita más". */
  .cal-chip.venc {
    background: var(--purple-dim); color: var(--purple);
    border-color: rgba(167,139,250,0.28);
  }
  /* Citas (v0.46.0): teal, otra familia más — ni estado de visita (ámbar /
     acento / verde / rojo) ni vencimiento (morado).
     v0.46.3: cada TIPO tiene su color, para que abrir el mes y distinguir una
     reunión de unas vacaciones no dependa de leer el título. Los tres siguen
     fuera de la paleta de estados de visita y de la del vencimiento. */
  /* Barra lateral en los tres tipos de cita. Reemplaza al ícono que tenían
     antes (📌): sin nada que los marque, un chip teal se puede confundir con
     una visita "Completada" (verde) al pasar la vista rápido. La barra los
     agrupa como familia —"esto es del calendario, no es una visita"— sin
     meter un emoji en cada fila de la grilla. */
  .cal-chip.cita, .cal-chip.reunion, .cal-chip.vacaciones {
    border-left-width: 3px;
  }
  .cal-chip.cita {
    background: var(--teal-dim); color: var(--teal);
    border-color: rgba(45,212,191,0.28); border-left-color: var(--teal);
  }
  .cal-chip.reunion {
    background: var(--indigo-dim); color: var(--indigo);
    border-color: rgba(129,140,248,0.28); border-left-color: var(--indigo);
  }
  .cal-chip.vacaciones {
    background: var(--lime-dim); color: var(--lime);
    border-color: rgba(163,230,53,0.30); border-left-color: var(--lime);
  }
  .cal-more { font-size: 10px; color: var(--text3); padding: 1px 4px; font-weight: 600; cursor: default; }

  /* Vista semanal */
  .cal-week { display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; }
  .cal-week-col { border-right: 1px solid var(--border); display: flex; flex-direction: column; }
  .cal-week-col:last-child { border-right: none; }
  .cal-week-head {
    padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: center;
    background: var(--surface); position: sticky; top: 0; z-index: 1;
  }
  .cal-week-head-day { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; }
  .cal-week-head-num {
    font-size: 18px; font-weight: 700; color: var(--text2);
    width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; margin: 4px auto 0;
  }
  .cal-week-head-num.today {
    background: var(--grad-primary);
    color: var(--btn-primary-fg);
  }
  .cal-week-body { flex: 1; padding: 8px 6px; display: flex; flex-direction: column; gap: 5px; background: var(--bg); }
  .cal-week-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
    padding: 7px 9px; cursor: pointer;
    transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
    border-left: 3px solid var(--border);
  }
  .cal-week-card:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); transform: translateX(2px); }
  .cal-week-card.Pendiente  { border-left-color: #ca8a04; }
  .cal-week-card.En-curso   { border-left-color: var(--accent2); }
  .cal-week-card.Completada { border-left-color: #4ade80; }
  .cal-week-card.Cancelada  { border-left-color: #f87171; }
  .cal-week-card.venc       { border-left-color: var(--purple); }
  .cal-week-card.venc .cal-week-card-hora { color: var(--purple); }
  .cal-week-card.venc .cal-week-card-code { color: var(--text2); }
  .cal-week-card.cita       { border-left-color: var(--teal); }
  .cal-week-card.cita .cal-week-card-hora { color: var(--teal); }
  .cal-week-card.cita .cal-week-card-code { color: var(--text2); }
  .cal-week-card.reunion    { border-left-color: var(--indigo); }
  .cal-week-card.reunion .cal-week-card-hora { color: var(--indigo); }
  .cal-week-card.reunion .cal-week-card-code { color: var(--text2); }
  .cal-week-card.vacaciones { border-left-color: var(--lime); }
  .cal-week-card.vacaciones .cal-week-card-hora { color: var(--lime); }
  .cal-week-card.vacaciones .cal-week-card-code { color: var(--text2); }
  .cal-week-card-hora  { font-size: 10px; color: var(--text3); font-weight: 600; margin-bottom: 2px; }
  .cal-week-card-code  { font-size: 10px; color: var(--accent); font-weight: 700; }
  .cal-week-card-client{ font-size: 12px; font-weight: 600; color: var(--text); margin: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-week-card-tec   { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 13px; }
  .cal-vencs-toggle {
    display: flex; align-items: center; gap: 6px; cursor: pointer;
    font-size: 12px; font-weight: 600; color: var(--text2); user-select: none;
  }
  .cal-vencs-toggle input { accent-color: var(--purple); cursor: pointer; margin: 0; }
  .cal-citas-toggle input { accent-color: var(--teal); }
  /* Botón "Nueva cita" del header del calendario. Más chico que .btn-new-client
     (que vive en un header de módulo, no en una barra de herramientas). */
  .cal-new-btn {
    display: inline-flex; align-items: center; gap: 5px; margin-left: auto;
    padding: 6px 12px; font-size: 12px; font-weight: 600;
    background: var(--grad-primary); color: var(--btn-primary-fg);
    border: none; border-radius: var(--r1); cursor: pointer;
    transition: filter var(--t-base), transform 0.08s ease;
  }
  .cal-new-btn:hover { filter: brightness(1.10); }
  .cal-new-btn:active { transform: translateY(1px); }
  .cal-new-btn:focus-visible { outline: none; box-shadow: var(--ring-accent); }

  /* ── Panel Personal ── */
  .pp-container { max-width: 860px; margin: 0 auto; padding: 28px 24px; display: flex; flex-direction: column; gap: 24px; }
  .pp-header { display: flex; align-items: center; justify-content: space-between; }
  .pp-greeting { font-size: 22px; font-weight: 700; color: var(--text); }
  .pp-date { font-size: 13px; color: var(--text3); margin-top: 4px; }

  .pp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .pp-stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r2); padding: 16px 18px;
    display: flex; flex-direction: column; gap: 6px;
  }
  .pp-stat-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; }
  .pp-stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
  .pp-stat-card.accent  { border-top: 3px solid var(--accent2); }
  .pp-stat-card.amber   { border-top: 3px solid #ca8a04; }
  .pp-stat-card.green   { border-top: 3px solid #4ade80; }
  .pp-stat-card.neutral { border-top: 3px solid var(--border2); }

  .pp-section { display: flex; flex-direction: column; gap: 10px; }
  .pp-section-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; color: var(--text2);
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
  }

  .pp-visit-list { display: flex; flex-direction: column; gap: 8px; }
  .pp-visit-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); padding: 12px 14px;
    display: flex; align-items: center; gap: 14px;
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
    border-left: 3px solid var(--border2);
  }
  .pp-visit-card:hover { border-color: var(--accent); background: var(--surface2); }
  .pp-visit-card.Pendiente  { border-left-color: #ca8a04; }
  .pp-visit-card.En-curso   { border-left-color: var(--accent2); }
  .pp-visit-card.Completada { border-left-color: #4ade80; }
  .pp-visit-card.Cancelada  { border-left-color: #f87171; }
  .pp-visit-date  { font-size: 11px; font-weight: 600; color: var(--text3); min-width: 72px; flex-shrink: 0; }
  .pp-visit-code  { font-size: 11px; font-weight: 700; color: var(--accent); flex-shrink: 0; min-width: 60px; }
  .pp-visit-client{ font-size: 13px; font-weight: 600; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pp-visit-tec   { font-size: 12px; color: var(--text3); flex-shrink: 0; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pp-visit-hora  { font-size: 11px; color: var(--text3); flex-shrink: 0; min-width: 80px; text-align: right; }
  .pp-empty { font-size: 13px; color: var(--text3); padding: 14px 0; }

  .pp-equipo-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r2); overflow: hidden; }
  .pp-equipo-table { width: 100%; border-collapse: collapse; }
  .pp-equipo-table th {
    text-align: left; font-size: 11px; font-weight: 600; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.6px;
    padding: 8px 14px; border-bottom: 1px solid var(--border);
    background: var(--bg);
  }
  .pp-equipo-table th:not(:first-child) { text-align: center; }
  .pp-equipo-table td {
    padding: 10px 14px; font-size: 13px; color: var(--text);
    border-bottom: 1px solid var(--border);
  }
  .pp-equipo-table td:not(:first-child) { text-align: center; font-weight: 600; }
  .pp-equipo-table tr:last-child td { border-bottom: none; }
  .pp-equipo-table tbody tr:hover td { background: var(--surface2); }

/* ═══════════════════════════════════════════════════════════════════════
   TICKETS (Fase 2)
   ═══════════════════════════════════════════════════════════════════════ */

/* Badge del contador en el botón del topnav */
.tn-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  font-size: 11px; font-weight: 700; line-height: 1;
  color: #fff; background: var(--red);
  border-radius: 999px; margin-left: 6px;
  letter-spacing: 0.2px;
}

/* Vista contenedora — usa flex como el resto de vistas split */
#vista-tickets { width: 100%; height: 100%; }

/* Sidebar */
.tk-sidebar { min-width: 340px; max-width: 380px; }
.tk-sidebar .vt-sidebar-controls { gap: 8px; }

/* Pills de filtros rápidos (Todos / Abiertos / Resueltos / Cerrados) */
.tk-quick-filters {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 2px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px;
}
.tk-quick-pill {
  flex: 1; min-width: 0;
  padding: 5px 10px; font-size: 11px; font-weight: 600;
  color: var(--text3); background: transparent;
  border: none; border-radius: 999px;
  cursor: pointer; transition: all .12s;
  white-space: nowrap;
}
.tk-quick-pill:hover { color: var(--text); background: var(--surface3); }
.tk-quick-pill.active {
  color: var(--accent); background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}

/* Toggle "Más filtros" — pliega panel granular */
.tk-more-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 8px; background: transparent; border: none;
  font-size: 12px; color: var(--text3); cursor: pointer;
  border-radius: var(--r); transition: color .12s;
  align-self: flex-start;
}
.tk-more-toggle:hover { color: var(--text); }
.tk-more-toggle svg {
  transition: transform .15s; flex-shrink: 0;
}
.tk-more-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.tk-more-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 5px; margin-left: 2px;
  font-size: 10px; font-weight: 700; line-height: 1;
  color: #fff; background: var(--accent);
  border-radius: 999px;
}

/* Panel colapsable de filtros granulares */
.tk-more-panel {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r);
}
.tk-more-field {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.8px;
  color: var(--text3); text-transform: uppercase;
}
.tk-more-field .field-input {
  padding: 6px 8px; font-size: 12px;
  text-transform: none; font-weight: 400; letter-spacing: normal;
  color: var(--text);
}
.tk-filter-reset {
  background: transparent; border: none; color: var(--text3);
  font-size: 12px; cursor: pointer; padding: 6px 2px 2px;
  text-align: left; transition: color .15s;
  align-self: flex-start;
}
.tk-filter-reset:hover { color: var(--accent); }

.tk-count-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 7px;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 11px; font-weight: 600; font-family: 'Geist Mono', monospace;
}

.tk-link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px dashed var(--border);
  color: var(--text2); font-size: 12px; padding: 7px 10px;
  border-radius: var(--r); cursor: pointer; transition: all .15s;
}
.tk-link-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

/* Lista de tickets en el sidebar */
.tk-list { padding: 8px 6px; }
.tk-item {
  padding: 10px 12px; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); cursor: pointer; transition: all .15s;
  position: relative; overflow: hidden;
}
.tk-item:hover {
  border-color: var(--border2); background: var(--surface2);
  transform: translateX(2px);
}
.tk-item-active {
  border-color: var(--accent) !important; background: var(--accent-dim) !important;
  box-shadow: inset 3px 0 0 var(--accent);
}
.tk-item-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.tk-item-code {
  font-family: 'Geist Mono', monospace; font-size: 11px;
  font-weight: 600; color: var(--accent); letter-spacing: 0.4px;
}
.tk-item-subject {
  font-size: 13px; font-weight: 600; color: var(--text);
  line-height: 1.35; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
.tk-item-meta {
  font-size: 11px; color: var(--text3); margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.tk-item-client { font-weight: 500; color: var(--text2); }
/* Chip de categoría: estilo "etiqueta con dot" tipo Linear. Fondo neutro,
   un círculo de color a la izquierda indica la categoría. No compite
   visualmente con los badges de estado (que son píldoras de color sólido). */
.tk-cat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  font-size: 10px; font-weight: 500;
  background: var(--surface3);
  color: var(--text2);
  border-radius: var(--r);
  letter-spacing: 0.1px;
  max-width: 160px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tk-cat-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
  /* el color del dot lo da la clase color-N que ya tiene background */
}
/* Hack: las clases color-N originales pintan también el color del texto,
   acá solo queremos el background del dot. Sobrescribimos color → none. */
.tk-cat-dot.color-0 { background: var(--accent); }
.tk-cat-dot.color-1 { background: var(--green); }
.tk-cat-dot.color-2 { background: var(--purple); }
.tk-cat-dot.color-3 { background: var(--teal); }
.tk-cat-dot.color-4 { background: var(--pink); }
.tk-cat-dot.color-5 { background: var(--amber); }
.tk-item-bottom {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; flex-wrap: wrap;
}
.tk-item-assign-wrap {
  display: inline-flex; flex-direction: column; align-items: flex-end;
  gap: 3px; min-width: 0; max-width: 60%;
}
.tk-item-assign-empty {
  font-size: 11px; color: var(--text3); font-style: italic;
}
.tk-item-avatars {
  display: inline-flex; align-items: center;
}
.tk-mini-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; letter-spacing: 0.2px;
  border: 2px solid var(--surface);
  margin-left: -6px;
}
.tk-mini-avatar:first-child { margin-left: 0; }
.tk-mini-avatar-more {
  background: var(--surface3); color: var(--text2);
  font-size: 9px;
}
.tk-item:hover .tk-mini-avatar { border-color: var(--surface2); }
.tk-item-active .tk-mini-avatar { border-color: var(--accent-dim); }

/* Chip con nombre del asignado en cards del listado.
   Reemplaza al avatar circular ambiguo cuando 2 personas comparten iniciales. */
.tk-item-assignee-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; max-width: 100%;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid rgba(150,169,215,0.25);
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
}
.tk-item-assignee-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
}
.tk-item-assignee-more {
  font-size: 10px; font-weight: 700;
  color: var(--text2);
  background: rgba(255,255,255,0.08);
  padding: 1px 5px; border-radius: 999px;
}
.tk-item-time {
  font-size: 10px; color: var(--text3);
  font-family: 'Geist Mono', monospace;
  white-space: nowrap;
}

/* Asignados en sidebar del detalle del ticket */
.tk-assignees-wrap { position: relative; }
.tk-assignee-chips {
  display: flex; flex-wrap: wrap; gap: 5px;
  align-items: center;
}
.tk-assignee-empty {
  font-size: 12px; color: var(--text3); font-style: italic;
  padding: 4px 0;
}
.tk-assignee-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 3px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; color: var(--text); cursor: pointer;
  transition: all .15s;
}
.tk-assignee-chip:hover {
  border-color: var(--red); color: var(--red); background: var(--red-dim);
}
.tk-assignee-chip:hover .tk-assignee-avatar { background: var(--red); }
.tk-assignee-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  flex-shrink: 0;
}
.tk-assignee-name { font-size: 12px; }
.tk-assignee-x { font-size: 14px; color: var(--text3); margin-left: 2px; }
.tk-assignee-chip:hover .tk-assignee-x { color: var(--red); }
.tk-assignee-add {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; background: transparent;
  border: 1px dashed var(--border2); border-radius: 999px;
  color: var(--text3); font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.tk-assignee-add:hover {
  color: var(--accent); border-color: var(--accent); background: var(--accent-dim);
}

/* Popover de selección */
.tk-assignee-picker {
  margin-top: 8px; padding: 8px;
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: var(--r); box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}
.tk-assignee-search { font-size: 12px; padding: 6px 10px; margin-bottom: 6px; }
.tk-assignee-options {
  max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.tk-assignee-option {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; background: transparent;
  border: none; border-radius: var(--r);
  cursor: pointer; text-align: left; transition: background .12s;
}
.tk-assignee-option:hover { background: var(--surface2); }
.tk-assignee-option.selected {
  background: var(--accent-dim);
}
.tk-assignee-option.selected .tk-assignee-opt-check { color: var(--accent); font-weight: 700; }
.tk-assignee-opt-name {
  flex: 1; font-size: 12px; color: var(--text); display: flex; flex-direction: column;
  align-items: flex-start; gap: 1px; min-width: 0;
}
.tk-assignee-opt-role {
  font-size: 10px; color: var(--text3); text-transform: capitalize;
}
.tk-assignee-opt-check { font-size: 14px; color: transparent; width: 14px; }
.tk-assignee-empty-opt {
  padding: 12px; text-align: center; color: var(--text3); font-size: 12px;
}

.tk-empty {
  padding: 32px 14px; text-align: center;
  color: var(--text3); font-size: 13px;
}

/* Detalle del ticket — layout profesional (Jira/Linear-style) */
.tk-detail {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.tk-detail-header {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 28px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}
.tk-detail-title-wrap { flex: 1; min-width: 0; }

/* Breadcrumb: Cliente › TK-XXXX (cliente clickeable, prominente arriba del subject) */
.tk-detail-breadcrumb {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.tk-detail-client-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700; color: var(--text);
  text-decoration: none; line-height: 1;
  padding: 3px 8px; border-radius: 6px;
  transition: all .15s; border: 1px solid transparent;
}
.tk-detail-client-link svg { color: var(--accent); flex-shrink: 0; }
.tk-detail-client-link:hover {
  color: var(--accent); background: var(--accent-dim);
  border-color: var(--accent);
}
.tk-detail-breadcrumb-sep {
  color: var(--text3); font-size: 14px; font-weight: 400;
}
.tk-detail-code {
  font-family: 'Geist Mono', monospace; font-size: 12px;
  font-weight: 600; color: var(--text3); letter-spacing: 0.4px;
}
.tk-detail-subject {
  font-size: 17px; font-weight: 600; color: var(--text);
  margin: 0 0 8px; line-height: 1.3;
}
.tk-detail-badges {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.tk-detail-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Layout 2 columnas: main + sidebar */
.tk-detail-layout {
  flex: 1; display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  overflow: hidden;
  background: var(--bg);
}
@media (max-width: 1100px) {
  .tk-detail-layout { grid-template-columns: 1fr; }
  .tk-detail-sidebar { border-left: none !important; border-top: 1px solid var(--border); }
}

.tk-detail-main {
  overflow-y: auto;
  padding: 22px 28px;
  display: flex; flex-direction: column; gap: 22px;
}
.tk-detail-sidebar {
  overflow-y: auto;
  padding: 22px 22px 28px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 16px;
}

/* Secciones del main */
.tk-section { display: flex; flex-direction: column; gap: 10px; }
.tk-section-head {
  display: flex; align-items: center; justify-content: space-between;
}
.tk-section-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  letter-spacing: 0.2px; margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
}
.tk-counter {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 7px;
  background: var(--surface3); color: var(--text2);
  border-radius: 999px;
  font-size: 11px; font-weight: 600; font-family: 'Geist Mono', monospace;
}

.tk-description {
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  font-size: 13px; color: var(--text); line-height: 1.6;
  min-height: 44px;
}
.tk-description-empty { font-style: italic; }
.tk-empty-inline {
  color: var(--text3); font-size: 12px; font-style: italic;
}

/* Hilo de comentarios */
.tk-thread {
  display: flex; flex-direction: column; gap: 10px;
}

/* Form de respuesta */
.tk-reply-form {
  margin-top: 6px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r);
}
.tk-reply-textarea {
  width: 100%; resize: vertical; font-size: 13px;
  min-height: 70px;
}
.tk-reply-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 10px; flex-wrap: wrap;
}
.tk-reply-buttons { display: flex; gap: 8px; align-items: center; }
.tk-reply-attach-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; font-size: 12px; font-weight: 500;
  color: var(--text2); background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer; transition: all .15s;
}
.tk-reply-attach-btn:hover {
  color: var(--accent); border-color: var(--accent); background: var(--accent-dim);
}

/* Sidebar — propiedades */
.tk-side-section { display: flex; flex-direction: column; gap: 6px; }
.tk-side-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1.2px;
  color: var(--text3); text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between;
}
.tk-side-input { font-size: 13px; padding: 7px 10px; }
.tk-side-value {
  font-size: 13px; color: var(--text); font-weight: 500;
  padding: 6px 0;
}
.tk-side-link {
  font-size: 13px; color: var(--accent); text-decoration: none;
  font-weight: 500; padding: 4px 0; display: inline-block;
}
.tk-side-link:hover { text-decoration: underline; }
.tk-side-divider {
  height: 1px; background: var(--border); margin: 2px 0;
}
.tk-side-meta {
  font-size: 11px; color: var(--text3); line-height: 1.8;
}
.tk-side-meta > div { padding: 1px 0; }
.tk-meta-label { color: var(--text2); font-weight: 600; }

/* SLA block en el sidebar del ticket */
.tk-sla-block { font-size: 12px; }
.tk-sla-block .tk-side-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.tk-sla-badge {
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  letter-spacing: 0.05em; text-transform: uppercase;
  border: 1px solid transparent;
}
.tk-sla-badge.sla-ok      { background: var(--green-dim); color: var(--green); border-color: var(--green); }
.tk-sla-badge.sla-warning { background: var(--amber-dim); color: var(--amber); border-color: var(--amber); }
.tk-sla-badge.sla-breach  { background: var(--red-dim);   color: var(--red);   border-color: var(--red); }
.tk-sla-badge.sla-na      { background: var(--surface3);  color: var(--text3); border-color: var(--border); }
.tk-sla-line { color: var(--text2); line-height: 1.5; padding: 1px 0; }
.tk-sla-sub  { font-size: 11px; color: var(--text3); }
.tk-sla-line-ok  { color: var(--green); font-weight: 500; }
.tk-sla-line-bad { color: var(--red); font-weight: 500; }

/* Mini-dot SLA en el card del listado — pegado al código del ticket */
.tk-sla-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-left: 6px; vertical-align: middle;
}
.tk-sla-dot-warning { background: var(--amber); box-shadow: 0 0 0 2px rgba(251,191,36,0.20); }
.tk-sla-dot-breach  { background: var(--red);   box-shadow: 0 0 0 2px rgba(248,113,113,0.20); }

/* Adjuntos compactos en el sidebar */
.tk-attach-mini-list {
  display: flex; flex-direction: column; gap: 4px;
}
.tk-attach-mini {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r);
  font-size: 12px; transition: all .15s;
}
.tk-attach-mini:hover { border-color: var(--accent); background: var(--accent-dim); }
.tk-attach-mini-name {
  flex: 1; display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none; padding: 0;
  color: var(--text); font-size: 12px; cursor: pointer;
  text-align: left; min-width: 0;
}
.tk-attach-mini-name span {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.tk-attach-mini-name:hover { color: var(--accent); }
.tk-attach-mini-name svg { flex-shrink: 0; color: var(--text3); }
.tk-attach-mini-name:hover svg { color: var(--accent); }
.tk-attach-mini-size {
  font-size: 10px; color: var(--text3); font-family: 'Geist Mono', monospace;
  flex-shrink: 0;
}
.tk-attach-mini-internal {
  font-size: 9px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; flex-shrink: 0;
  padding: 1px 5px; border-radius: 4px;
  color: var(--amber); background: var(--amber-dim);
  border: 1px solid var(--amber);
}
.tk-attach-mini-del {
  width: 22px; height: 22px; padding: 0; flex-shrink: 0;
  background: transparent; border: 1px solid transparent;
  border-radius: 4px; color: var(--text3); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.tk-attach-mini-del:hover {
  color: var(--red); border-color: var(--red); background: var(--red-dim);
}

/* Badges (estados / prioridades / tipos) */
.tk-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; font-size: 11px; font-weight: 600;
  border-radius: 999px; letter-spacing: 0.2px;
  border: 1px solid transparent; line-height: 1.4; white-space: nowrap;
}
.tk-badge-gray   { background: var(--surface3); color: var(--text2); border-color: var(--border2); }
.tk-badge-blue   { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.tk-badge-amber  { background: var(--amber-dim); color: var(--amber); border-color: var(--amber); }
.tk-badge-orange { background: var(--orange-dim); color: var(--orange); border-color: var(--orange); }
.tk-badge-red    { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.tk-badge-green  { background: var(--green-dim); color: var(--green); border-color: var(--green); }
.tk-badge-teal   { background: var(--teal-dim); color: var(--teal); border-color: var(--teal); }
.tk-badge-purple { background: var(--purple-dim); color: var(--purple); border-color: var(--purple); }
.tk-badge-pink   { background: var(--pink-dim); color: var(--pink); border-color: var(--pink); }

/* Tab Info: layout en dos columnas */
.tk-info-grid {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: 24px; padding: 6px 2px;
}
@media (max-width: 1100px) {
  .tk-info-grid { grid-template-columns: 1fr; }
}
.tk-info-col { display: flex; flex-direction: column; gap: 16px; }
.tk-info-section {}
.tk-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1.2px;
  color: var(--text3); text-transform: uppercase; margin-bottom: 6px;
}
.tk-info-static {
  font-size: 13px; color: var(--text); line-height: 1.5;
  padding: 8px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r1, 6px);
}
.tk-prewrap { white-space: pre-wrap; word-wrap: break-word; }
.tk-inline-edit { font-size: 13px; }
.tk-info-timestamps {
  font-size: 11px; color: var(--text3); line-height: 1.7;
  padding-top: 8px; border-top: 1px dashed var(--border);
}
.tk-info-timestamps > div { padding: 1px 0; }
.tk-ts-label { color: var(--text2); font-weight: 600; }

/* Tab Comentarios */
.tk-comments-thread { display: flex; flex-direction: column; gap: 10px; }
.tk-comment {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 14px;
}
.tk-comment-private-bg {
  background: var(--amber-dim);
  border-color: var(--amber);
  border-left: 3px solid var(--amber);
}
.tk-comment-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px; flex-wrap: wrap;
}
.tk-comment-author { font-size: 13px; font-weight: 600; color: var(--text); }
.tk-comment-role {
  font-size: 10px; font-weight: 600; letter-spacing: 0.8px;
  color: var(--text3); text-transform: uppercase;
  padding: 2px 6px; background: var(--surface3); border-radius: 999px;
  border: 1px solid transparent;
}
/* Override por rol — mismo paleta que los chips de Usuarios para coherencia.
   El cliente queda en cyan (distinto del resto del staff) para no confundir. */
.tk-comment-role.role-admin       { background: var(--accent-dim);  color: var(--accent);  border-color: rgba(150,169,215,0.35); }
.tk-comment-role.role-direccion   { background: var(--purple-dim);  color: var(--purple);  border-color: rgba(167,139,250,0.35); }
.tk-comment-role.role-responsable { background: var(--teal-dim);    color: var(--teal);    border-color: rgba(45,212,191,0.35); }
.tk-comment-role.role-tecnico     { background: var(--green-dim);   color: var(--green);   border-color: rgba(74,222,128,0.35); }
.tk-comment-role.role-auditor_admin { background: var(--amber-dim); color: var(--amber);   border-color: rgba(251,191,36,0.35); }
.tk-comment-role.role-operador    { background: var(--teal-dim);    color: var(--teal);    border-color: rgba(45,212,191,0.35); }
.tk-comment-role.role-readonly    { background: var(--surface3);    color: var(--text3);   border-color: var(--border2); }
.tk-comment-role.role-cliente     { background: var(--cyan-dim);    color: var(--cyan);    border-color: rgba(34,211,238,0.45); }
.tk-comment-private {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  color: var(--amber); padding: 2px 7px;
  background: var(--amber-dim); border: 1px solid var(--amber);
  border-radius: 999px; text-transform: uppercase;
}
.tk-comment-time {
  margin-left: auto; font-size: 11px;
  color: var(--text3); font-family: 'Geist Mono', monospace;
}
.tk-comment-body {
  font-size: 13px; color: var(--text); line-height: 1.55;
}
.tk-comment-form {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.tk-comment-form textarea { resize: vertical; font-size: 13px; }
.tk-comment-form-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 10px; flex-wrap: wrap;
}
.tk-priv-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text2); cursor: pointer;
}

/* Tab Adjuntos */
.tk-attach-list { display: flex; flex-direction: column; gap: 8px; }
.tk-attach-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  transition: all .15s;
}
.tk-attach-item:hover { border-color: var(--border2); background: var(--surface2); }
.tk-attach-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); background: var(--accent-dim);
  border-radius: var(--r);
}
.tk-attach-info { flex: 1; min-width: 0; }
.tk-attach-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tk-attach-meta {
  font-size: 11px; color: var(--text3);
  margin-top: 2px;
}
.tk-attach-dl {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px; font-size: 12px; font-weight: 500;
  color: var(--text2); background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer; transition: all .15s;
}
.tk-attach-dl:hover {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-dim);
}
.tk-attach-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text3); cursor: pointer;
  transition: all .15s;
}
.tk-attach-del:hover {
  color: var(--red); border-color: var(--red); background: var(--red-dim);
}
.tk-attach-upload {
  margin-top: 16px; padding: 24px;
  border: 2px dashed var(--border2); border-radius: var(--r2);
  text-align: center; transition: all .2s;
  background: var(--bg);
}
.tk-attach-upload.tk-drag-over {
  border-color: var(--accent); background: var(--accent-dim);
}
.tk-attach-upload-label {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text2); font-size: 13px; cursor: pointer;
}
.tk-attach-upload-label svg { color: var(--accent); margin-bottom: 4px; }
.tk-attach-hint { font-size: 11px; color: var(--text3); }

/* Modal de categorías */
.tk-cat-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr auto auto auto;
  gap: 8px; align-items: center;
  padding: 6px; border-radius: var(--r);
}
.tk-cat-row:hover { background: var(--surface2); }
.tk-cat-active {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text2); white-space: nowrap;
}
.tk-cat-save { padding: 6px 14px; font-size: 12px; }

/* Zona de "staged files" para adjuntos al crear ticket */
.tk-attach-stage {
  border: 1.5px dashed var(--border2);
  border-radius: var(--r);
  padding: 14px;
  text-align: center;
  background: var(--bg);
  transition: all .2s;
}
.tk-attach-stage.tk-drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.tk-attach-stage-label {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text2); font-size: 12px;
  cursor: pointer;
}
.tk-attach-stage-label svg { color: var(--accent); }
.tk-attach-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.tk-attach-staged-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 9px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 11px; color: var(--accent);
  max-width: 240px;
}
.tk-attach-staged-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 140px; font-weight: 500;
}
.tk-attach-staged-size {
  font-family: 'Geist Mono', monospace; font-size: 10px; opacity: .8;
}
.tk-attach-staged-x {
  width: 18px; height: 18px; padding: 0; line-height: 1;
  background: transparent; border: none;
  color: var(--accent); font-size: 16px;
  cursor: pointer; border-radius: 50%;
}
.tk-attach-staged-x:hover { background: var(--red); color: #fff; }

/* Modal "Cerrar ticket" — inputs de tiempo (horas + minutos) */
.tk-close-time-row {
  display: flex; gap: 10px; align-items: center;
}
.tk-close-time-input {
  flex: 1; position: relative; display: flex; align-items: center;
}
.tk-close-time-input .field-input {
  padding-right: 38px; text-align: right; font-size: 15px; font-weight: 600;
  font-family: 'Geist Mono', monospace;
}
.tk-close-time-unit {
  position: absolute; right: 12px;
  font-size: 12px; color: var(--text3); font-weight: 600;
  pointer-events: none;
}

/* Botones del form de respuesta (Responder + Cerrar) */
.tk-btn-close-ticket {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-size: 12px; font-weight: 600;
  color: var(--green); background: var(--green-dim);
  border: 1px solid var(--green); border-radius: var(--r);
  cursor: pointer; transition: all .15s;
}
.tk-btn-close-ticket:hover {
  background: var(--green); color: #fff;
}
.tk-btn-close-ticket svg { flex-shrink: 0; }

/* Mensaje cuando el ticket ya está resuelto (sin form) */
.tk-reply-closed-note {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: var(--green-dim); color: var(--green);
  border: 1px solid var(--green); border-radius: var(--r);
  font-size: 13px; font-weight: 500;
}
.tk-reply-closed-note svg { flex-shrink: 0; }

/* Botón de reapertura — staff (dentro del tk-reply-closed-note) */
.btn-reopen {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  color: var(--red); background: var(--red-dim);
  border: 1px solid var(--red); border-radius: var(--r);
  cursor: pointer; transition: all .15s; margin-left: auto;
}
.btn-reopen:hover { background: var(--red); color: #fff; }
.btn-reopen svg  { flex-shrink: 0; }

/* Nota cuando el ticket no puede reabrirse */
.tk-reopen-limit-note {
  font-size: 11px; color: var(--text3); margin-left: auto; font-style: italic;
}

/* Botón de reapertura — portal cliente */
.prtl-reopen-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  color: var(--red); background: var(--red-dim);
  border: 1px solid var(--red); border-radius: var(--r);
  cursor: pointer; transition: all .15s; margin-top: 12px;
}
.prtl-reopen-btn:hover { background: var(--red); color: #fff; }
.prtl-reopen-btn svg  { flex-shrink: 0; }

.prtl-reopen-note {
  font-size: 12px; color: var(--text3); padding: 10px 0;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════
   POPUP CENTRAL DE FEEDBACK (0.28.1)
   ═══════════════════════════════════════════════════════════════════════ */
/* Reemplaza los toasts esquineros chicos. Reglas:
   - Container singleton `#center-popup-host` (creado por delegation.js).
   - Card flotante centrada (no-bloqueante: el backdrop es semi-transparente
     y se puede clickear para descartar).
   - Animación de entrada (scale + fade) — 180ms.
   - Auto-cierre 3s por default; cierre manual con click en backdrop o ×.
   - Compartido por el shell staff (index.html), el portal (portal.html),
     mobile (mobile.html) y activate (activate.html) — el helper vive en
     delegation.js que cargan todas las SPAs. */
.cp-host {
  position: fixed; inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.cp-host.cp-show {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}
.cp-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.cp-card {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35), 0 0 0 1px var(--border);
  padding: 24px 28px 24px 24px;
  min-width: 320px; max-width: 520px;
  display: flex; align-items: center; gap: 16px;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cp-host.cp-show .cp-card {
  transform: translate(-50%, -50%) scale(1);
}
.cp-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.cp-icon svg {
  width: 24px; height: 24px;
}
.cp-card-success .cp-icon { background: var(--green-dim); color: var(--green); }
.cp-card-error   .cp-icon { background: var(--red-dim, rgba(248,113,113,0.15)); color: var(--red, #f87171); }
.cp-card-info    .cp-icon { background: var(--accent-dim); color: var(--accent); }
.cp-card-warning .cp-icon { background: var(--amber-dim); color: var(--amber); }
.cp-message {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 500; line-height: 1.5;
  color: var(--text);
}
.cp-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.cp-close:hover {
  background: var(--surface2);
  color: var(--text);
}
.cp-close svg {
  width: 16px; height: 16px;
}
/* Mobile: card más compacto en pantallas chicas. */
@media (max-width: 520px) {
  .cp-card {
    min-width: auto;
    width: calc(100vw - 32px);
    padding: 18px 20px 18px 18px;
    gap: 12px;
  }
  .cp-icon { width: 36px; height: 36px; }
  .cp-icon svg { width: 20px; height: 20px; }
  .cp-message { font-size: 14px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   PORTAL DEL CLIENTE (Fase 4 — SPA standalone /portal.html)
   ═══════════════════════════════════════════════════════════════════════ */

/* Topbar */
.prtl-topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.prtl-topbar-left   { display: flex; align-items: center; gap: 12px; }
.prtl-topbar-center { flex: 1; display: flex; justify-content: center; }
.prtl-topbar-right  { display: flex; align-items: center; gap: 8px; position: relative; }
.prtl-logo { height: 26px; background: #fff; border-radius: 6px; padding: 2px 6px; }
.prtl-divider { width: 1px; height: 22px; background: var(--border); }
.prtl-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  letter-spacing: 0.2px;
}

.prtl-client-selector {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px;
}
.prtl-client-label { font-size: 12px; color: var(--text3); font-weight: 500; }
.prtl-client-selector .field-input {
  padding: 4px 8px; font-size: 12px; min-width: 200px;
  background: transparent; border: none;
}

.prtl-icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text2); cursor: pointer;
  transition: all .15s;
}
.prtl-icon-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

.prtl-user-menu-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer; transition: all .15s;
  color: var(--text2);
}
.prtl-user-menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.prtl-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
}
.prtl-user-name { font-size: 13px; font-weight: 500; }
.prtl-user-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 180px; background: var(--surface);
  border: 1px solid var(--border2); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,0.20); z-index: 100;
  overflow: hidden;
}
.prtl-user-menu-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; font-size: 13px; color: var(--text2);
  background: transparent; border: none; cursor: pointer;
  text-align: left; transition: all .12s;
}
.prtl-user-menu-item:hover { background: var(--surface2); color: var(--text); }

/* Tabs principales */
.prtl-tabs {
  display: flex; gap: 4px;
  padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.prtl-tab-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px; font-size: 13px; font-weight: 500;
  color: var(--text3); background: transparent;
  border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: all .15s;
}
.prtl-tab-btn:hover { color: var(--text); }
.prtl-tab-btn.active {
  color: var(--accent); border-bottom-color: var(--accent);
}

/* Main scrollable */
.prtl-main {
  flex: 1; overflow-y: auto; background: var(--bg);
  padding: 28px 32px;
}
.prtl-view { max-width: 1200px; margin: 0 auto; }

.prtl-page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.prtl-page-header h1 {
  font-size: 22px; font-weight: 700; color: var(--text);
  margin: 0 0 4px;
}
.prtl-page-subtitle {
  font-size: 13px; color: var(--text3);
  margin: 0; line-height: 1.5;
}

.prtl-btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; font-size: 13px; font-weight: 600;
}
.prtl-btn-secondary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--text2); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer; transition: all .15s;
}
.prtl-btn-secondary:hover {
  color: var(--accent); border-color: var(--accent); background: var(--accent-dim);
}

.prtl-link {
  background: transparent; border: none;
  color: var(--accent); font-size: 12px; font-weight: 500;
  cursor: pointer; padding: 4px 8px; border-radius: var(--r);
  transition: all .12s;
}
.prtl-link:hover { background: var(--accent-dim); }

/* KPIs */
.prtl-kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 24px;
}
@media (max-width: 900px) {
  .prtl-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
.prtl-kpi-card {
  padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r2);
  position: relative; overflow: hidden;
  transition: all .2s;
}
.prtl-kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.10); }
.prtl-kpi-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.8px;
  color: var(--text3); text-transform: uppercase; margin-bottom: 8px;
}
.prtl-kpi-value {
  font-size: 32px; font-weight: 700; color: var(--text);
  line-height: 1; margin-bottom: 6px;
  font-family: 'Geist Mono', monospace;
}
.prtl-kpi-sub { font-size: 11px; color: var(--text3); }
.prtl-kpi-accent { border-top: 3px solid var(--accent); }
.prtl-kpi-orange { border-top: 3px solid var(--orange); }
.prtl-kpi-green  { border-top: 3px solid var(--green);  }
.prtl-kpi-yellow { border-top: 3px solid #fbbf24; }

/* Dashboard cards */
.prtl-dashboard-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .prtl-dashboard-grid { grid-template-columns: 1fr; }
}
.prtl-card-wide { grid-column: 1 / -1; }
.prtl-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 18px 20px;
}
.prtl-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.prtl-card-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  letter-spacing: 0.2px;
}

/* Barras de proporción */
.prtl-bar-list { display: flex; flex-direction: column; gap: 8px; }
.prtl-bar-row { display: flex; align-items: center; gap: 10px; }
.prtl-bar-label {
  font-size: 12px; color: var(--text2); flex-shrink: 0;
  width: 80px; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.prtl-bar-track {
  flex: 1; height: 8px; background: var(--bg);
  border-radius: 999px; overflow: hidden;
}
.prtl-bar-fill {
  height: 100%; border-radius: 999px; transition: width .3s;
  min-width: 4px;
}
.prtl-bar-value {
  font-size: 12px; font-weight: 600; color: var(--text);
  font-family: 'Geist Mono', monospace; min-width: 24px; text-align: right;
}
.prtl-bar-gray   { background: var(--text3); }
.prtl-bar-blue   { background: var(--accent); }
.prtl-bar-amber  { background: var(--amber); }
.prtl-bar-orange { background: var(--orange); }
.prtl-bar-red    { background: var(--red); }
.prtl-bar-green  { background: var(--green); }
.prtl-bar-teal   { background: var(--teal); }
.prtl-bar-purple { background: var(--purple); }

/* Recientes */
.prtl-recent-list { display: flex; flex-direction: column; gap: 6px; }
.prtl-recent-item {
  display: grid; grid-template-columns: 90px 1fr auto;
  gap: 14px; align-items: center;
  padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg); cursor: pointer; transition: all .15s;
}
.prtl-recent-item:hover {
  border-color: var(--accent); background: var(--accent-dim);
  transform: translateX(2px);
}
.prtl-recent-code {
  font-family: 'Geist Mono', monospace; font-size: 12px;
  font-weight: 600; color: var(--accent);
}
.prtl-recent-subject {
  font-size: 13px; color: var(--text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prtl-recent-meta {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.prtl-recent-time {
  font-size: 11px; color: var(--text3); margin-left: 6px;
}

/* Filtros */
.prtl-filters {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 18px; align-items: center;
}
.prtl-filter-select {
  padding: 8px 10px; font-size: 12px; min-width: 160px;
}

/* Listado de tickets */
.prtl-tickets-list { display: flex; flex-direction: column; gap: 8px; }
.prtl-ticket-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); cursor: pointer; transition: all .15s;
}
.prtl-ticket-row:hover {
  border-color: var(--accent); background: var(--accent-dim);
}
.prtl-ticket-left { flex: 1; min-width: 0; }
.prtl-ticket-code {
  font-family: 'Geist Mono', monospace; font-size: 11px;
  font-weight: 600; color: var(--accent); margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.prtl-ticket-subject {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 6px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden;
}
.prtl-ticket-meta {
  display: flex; gap: 6px; align-items: center;
  font-size: 11px; color: var(--text3); flex-wrap: wrap;
}
.prtl-ticket-right {
  display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap;
  align-items: center; justify-content: flex-end;
}
.prtl-cat-pill {
  display: inline-block; padding: 1px 8px;
  background: var(--accent-dim); color: var(--accent);
  border-radius: 999px; font-size: 10px; font-weight: 600;
}

.prtl-empty, .prtl-empty-large {
  padding: 18px; text-align: center;
  color: var(--text3); font-size: 13px;
  background: var(--bg); border: 1px dashed var(--border);
  border-radius: var(--r);
}
.prtl-empty-large { padding: 48px 16px; font-size: 14px; }

/* Detalle */
.prtl-detail-header {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.prtl-detail-title { flex: 1; min-width: 0; }
.prtl-detail-code {
  font-family: 'Geist Mono', monospace; font-size: 12px;
  font-weight: 600; color: var(--accent); margin-bottom: 4px;
  letter-spacing: 0.4px;
}
.prtl-detail-title h1 {
  font-size: 20px; font-weight: 700; color: var(--text);
  margin: 0 0 10px; line-height: 1.3;
}
.prtl-detail-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.prtl-detail-grid {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: 16px; margin-bottom: 16px;
}
@media (max-width: 900px) {
  .prtl-detail-grid { grid-template-columns: 1fr; }
}

.prtl-detail-info { display: flex; flex-direction: column; gap: 10px; }
.prtl-info-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; font-size: 13px;
  padding-bottom: 8px; border-bottom: 1px dashed var(--border);
}
.prtl-info-row:last-child { border-bottom: none; }
.prtl-info-label {
  font-size: 11px; color: var(--text3);
  font-weight: 600; letter-spacing: 0.4px;
  text-transform: uppercase; flex-shrink: 0;
  min-width: 120px;
}
.prtl-info-desc { flex-direction: column; align-items: stretch; }
.prtl-info-desc-body {
  margin-top: 6px; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); font-size: 13px;
  white-space: pre-wrap; word-wrap: break-word; line-height: 1.5;
}

/* Hilo de mensajes */
.prtl-thread { display: flex; flex-direction: column; gap: 14px; }
.prtl-message {
  padding: 12px 14px; border-radius: var(--r);
  max-width: 92%;
}
.prtl-msg-mine {
  align-self: flex-end;
  background: var(--accent-dim); border: 1px solid var(--accent);
}
.prtl-msg-staff {
  align-self: flex-start;
  background: var(--surface); border: 1px solid var(--border);
}
.prtl-msg-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px; flex-wrap: wrap;
}
.prtl-msg-author { font-size: 13px; font-weight: 600; color: var(--text); }
.prtl-msg-kind {
  font-size: 10px; font-weight: 600; letter-spacing: 0.6px;
  color: var(--text3); text-transform: uppercase;
  padding: 2px 7px; background: var(--surface3);
  border-radius: 999px;
}
.prtl-msg-time {
  margin-left: auto; font-size: 11px;
  color: var(--text3); font-family: 'Geist Mono', monospace;
}
.prtl-msg-body {
  font-size: 13px; color: var(--text); line-height: 1.55;
  white-space: pre-wrap; word-wrap: break-word;
}

.prtl-reply-form {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.prtl-reply-form textarea { resize: vertical; font-size: 13px; }
.prtl-reply-actions {
  display: flex; gap: 8px; align-items: center;
  justify-content: flex-end; margin-top: 10px;
}

/* Mi cuenta */
.prtl-account-info { display: flex; flex-direction: column; gap: 10px; }

/* Toast notifications (portal). Stack abajo-derecha con slide-in. */
.prtl-toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.prtl-toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,0.20);
  font-size: 13px; font-weight: 500;
  max-width: 380px;
  opacity: 0; transform: translateX(12px);
  transition: all .25s var(--ease, ease);
  pointer-events: auto;
}
.prtl-toast-show { opacity: 1; transform: translateX(0); }
.prtl-toast-success { border-left-color: var(--green); }
.prtl-toast-success svg { color: var(--green); flex-shrink: 0; }
.prtl-toast-error   { border-left-color: var(--red); }
.prtl-toast-error svg { color: var(--red); flex-shrink: 0; }
.prtl-toast-info    { border-left-color: var(--accent); }
.prtl-toast-info svg { color: var(--accent); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════════════
   CALIFICACIÓN DE TICKETS (Fase 4.1) — Portal + Staff
   ═══════════════════════════════════════════════════════════════════════ */
.rating-banner {
  background: linear-gradient(135deg, rgba(99,102,241,0.10) 0%, rgba(45,212,191,0.08) 100%);
  border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px;
  margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
[data-theme="dark"] .rating-banner {
  background: linear-gradient(135deg, rgba(99,102,241,0.16) 0%, rgba(45,212,191,0.10) 100%);
}
.rating-banner-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  margin-bottom: 14px;
}
.rating-banner-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 4px 0; }
.rating-banner-sub   { font-size: 12.5px; color: var(--text2); margin: 0; line-height: 1.4; }
.rating-banner-time  {
  font-size: 11px; color: var(--text3); font-weight: 600;
  padding: 4px 9px; background: var(--bg2); border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border);
}
.rating-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px;
}
@media (min-width: 640px) { .rating-grid { grid-template-columns: 1fr 1fr; } }
.rating-row {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
}
.rating-row-label {
  font-size: 12px; color: var(--text2); font-weight: 600; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.rating-stars { display: inline-flex; gap: 4px; }
.rating-star {
  background: none; border: none; cursor: pointer; padding: 2px;
  color: var(--border); transition: color .12s, transform .12s;
  display: inline-flex; align-items: center;
}
.rating-star:hover, .rating-star.is-hover { transform: scale(1.12); }
.rating-star.is-active { color: #fbbf24; }
.rating-star.is-readonly { cursor: default; }
.rating-star.is-readonly:hover { transform: none; }
.rating-comment {
  width: 100%; resize: vertical; min-height: 60px;
}
.rating-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.rating-submitted {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--green-dim, rgba(34,197,94,0.10));
  border: 1px solid var(--green, #22c55e); border-radius: 8px;
  color: var(--green, #22c55e); font-size: 12.5px; font-weight: 600;
}
.rating-submitted-auto {
  background: rgba(148,163,184,0.10);
  border-color: var(--border); color: var(--text2);
}
.rating-card-readonly {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
}
.rating-card-readonly .rating-row { background: transparent; border: none; padding: 0; }
.rating-card-readonly .rating-comment-display {
  font-size: 13px; color: var(--text); padding: 10px 12px; background: var(--bg);
  border-radius: 8px; border-left: 3px solid var(--accent); white-space: pre-wrap;
}
.rating-summary-inline {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text2); font-weight: 600;
}
.rating-summary-inline .rating-stars { gap: 2px; }
.rating-summary-inline .rating-star { padding: 0; }
.rating-overall-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(251,191,36,0.14); color: #d97706;
  font-size: 11.5px; font-weight: 700;
}
[data-theme="dark"] .rating-overall-pill { color: #fbbf24; }

/* Dashboard de calidad (staff admin/dirección) */
.quality-grid {
  display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 14px;
}
@media (min-width: 980px) { .quality-grid { grid-template-columns: 1fr 1fr; } }
.quality-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px;
}
.quality-card-wide { grid-column: 1 / -1; }
.quality-card-title { font-size: 13px; font-weight: 700; color: var(--text); margin: 0 0 12px 0; }
.quality-bignum {
  font-size: 36px; font-weight: 800; color: var(--text);
  line-height: 1; letter-spacing: -1px;
}
.quality-bignum small { font-size: 14px; font-weight: 600; color: var(--text3); margin-left: 4px; }
.quality-sub { font-size: 11.5px; color: var(--text3); margin-top: 4px; }
.quality-axes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.quality-axis { background: var(--bg2); border-radius: 8px; padding: 10px 12px; }
.quality-axis-label { font-size: 11px; color: var(--text2); margin-bottom: 4px; font-weight: 600; }
.quality-axis-val   { font-size: 20px; font-weight: 800; color: var(--text); }
.quality-axis-val small { font-size: 11.5px; color: var(--text3); margin-left: 2px; font-weight: 600; }
.quality-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.quality-table th {
  text-align: left; font-weight: 600; color: var(--text2);
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
}
.quality-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.quality-table tr:last-child td { border-bottom: none; }
.quality-table tr:hover td { background: var(--bg2); }
.quality-dist-row {
  display: grid; grid-template-columns: 60px 1fr 40px; align-items: center; gap: 8px;
  padding: 4px 0;
}
.quality-dist-label { font-size: 12px; color: var(--text2); font-weight: 600; }
.quality-dist-bar {
  height: 8px; background: var(--bg2); border-radius: 4px; overflow: hidden;
}
.quality-dist-fill {
  height: 100%; background: linear-gradient(90deg, #fbbf24, #f59e0b);
  border-radius: 4px; transition: width .25s ease;
}
.quality-dist-count { font-size: 12px; color: var(--text); font-weight: 700; text-align: right; }
.quality-filters {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px;
}
.quality-empty { padding: 24px; text-align: center; color: var(--text3); font-size: 12.5px; }
.quality-comment {
  padding: 10px 12px; background: var(--bg2); border-radius: 8px;
  border-left: 3px solid var(--red, #ef4444); margin-bottom: 8px;
}
.quality-comment-head {
  display: flex; justify-content: space-between; font-size: 11.5px;
  color: var(--text2); margin-bottom: 4px; gap: 8px;
}
.quality-comment-body { font-size: 13px; color: var(--text); white-space: pre-wrap; }

.usr-sector-chip {
  display: inline-block; font-size: 10.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(99,102,241,0.12); color: #6366f1;
  margin-left: 6px; vertical-align: middle;
}
[data-theme="dark"] .usr-sector-chip { background: rgba(129,140,248,0.18); color: #a5b4fc; }

/* Sidebar rating en ficha staff (Fase 4.1) */
.tk-side-rating-axis {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 12px;
}
.tk-side-rating-label { color: var(--text2); font-weight: 500; }
.tk-side-rating-stars {
  display: inline-flex; align-items: center; gap: 6px; color: #fbbf24;
}
.tk-side-rating-stars small {
  color: var(--text3); font-weight: 600; font-size: 11px;
}
.tk-side-stars { display: inline-flex; gap: 1px; color: var(--border); }
.tk-side-star.is-on { color: #fbbf24; }
.tk-side-rating-pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(251,191,36,0.18); color: #d97706;
}
[data-theme="dark"] .tk-side-rating-pill { color: #fbbf24; }
.tk-side-rating-comment {
  padding: 8px 10px; background: var(--bg2); border-left: 2px solid var(--accent);
  font-size: 12px; color: var(--text); margin-top: 8px; border-radius: 0 6px 6px 0;
  font-style: italic;
}
.tk-side-rating-foot {
  font-size: 11px; color: var(--text3); margin-top: 6px;
}
.tk-side-rating-by { color: var(--text3); }
.tk-side-rating-auto { color: var(--text3); font-style: italic; }
.tk-side-rating-pending {
  font-size: 11.5px; color: var(--text3); padding: 8px 10px;
  background: var(--bg2); border-radius: 6px; line-height: 1.4;
}


/* ═══════════════════════════════════════════════════════════════════════
   USUARIOS UNIFICADOS (Fase 5 — Internos + Externos + Pendientes)
   ═══════════════════════════════════════════════════════════════════════ */

/* Tabs */
.usr-tabs {
  display: flex; gap: 2px;
  padding: 0 28px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.usr-tab-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--text3); background: transparent;
  border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: all .15s;
}
.usr-tab-btn:hover { color: var(--text); }
.usr-tab-btn.active {
  color: var(--accent); border-bottom-color: var(--accent);
}
.usr-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 7px;
  background: var(--surface3); color: var(--text2);
  border-radius: 999px;
  font-size: 11px; font-weight: 600; font-family: 'Geist Mono', monospace;
}
.usr-tab-btn.active .usr-count {
  background: var(--accent-dim); color: var(--accent);
}

/* Toolbar */
.usr-toolbar {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; padding: 14px 28px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.usr-filter { padding: 7px 10px; font-size: 12px; min-width: 180px; }
.usr-link {
  background: transparent; border: none;
  color: var(--accent); font-size: 12px; cursor: pointer;
  padding: 4px 8px; border-radius: var(--r);
  transition: all .12s;
}
.usr-link:hover { background: var(--accent-dim); }

/* Tabla */
.usr-table-wrap { padding-top: 12px; }
.usr-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); overflow: hidden;
}
.usr-table thead th {
  font-size: 10px; font-weight: 600; letter-spacing: 0.6px;
  color: var(--text3); text-transform: uppercase;
  padding: 9px 14px; text-align: left;
  border-bottom: 1px solid var(--border); background: var(--surface2);
}
.usr-table tbody td {
  padding: 8px 14px; font-size: 13px; color: var(--text);
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
.usr-table tbody tr:last-child td { border-bottom: none; }
.usr-table tbody tr:hover td { background: var(--surface2); }

.usr-th-name { min-width: 220px; width: 28%; }
.usr-td-name {
  display: flex; align-items: center; gap: 10px;
}
.usr-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  letter-spacing: 0.3px;
}
.usr-avatar-ext { background: var(--orange); }
.usr-name-wrap { min-width: 0; }
.usr-name {
  font-weight: 600; color: var(--text); font-size: 13px;
  line-height: 1.2;
}
.usr-sub {
  font-size: 11px; color: var(--text3); margin-top: 3px;
  line-height: 1.4;
}

.usr-type-cell {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  line-height: 1;
}
.usr-type-badge {
  display: inline-block; padding: 2px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px;
  border-radius: 999px; line-height: 1.4;
  border: 1px solid transparent; flex-shrink: 0;
}
.usr-type-badge-internal { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.usr-type-badge-external { background: rgba(251,146,60,0.12); color: var(--orange); border-color: var(--orange); }
.usr-type-badge-pending  { background: var(--amber-dim);   color: var(--amber);  border-color: var(--amber); }
.usr-role-text { font-size: 13px; color: var(--text); font-weight: 500; text-transform: capitalize; }
.usr-role-sep { color: var(--text3); font-size: 12px; margin: 0 2px; }
.usr-level-inline { font-size: 11px; color: var(--text3); }

.usr-clients-cell { max-width: 260px; }
.usr-client-chip {
  display: inline-block; padding: 2px 9px; margin: 2px 2px 2px 0;
  background: var(--surface3); color: var(--text2);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 11px; font-weight: 500;
}
.usr-clients-na { color: var(--text3); font-size: 12px; font-style: italic; }

.usr-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
}
.usr-status-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}
.usr-status-active        { color: var(--text); }
.usr-status-active .usr-status-dot   { background: var(--green); }
.usr-status-inactive      { color: var(--text3); }
.usr-status-inactive .usr-status-dot { background: var(--text3); }
.usr-status-pending       { color: var(--amber); font-weight: 600; }
.usr-status-pending .usr-status-dot  { background: var(--amber); }

.usr-mfa-on {
  display: inline-block; padding: 2px 8px;
  background: var(--green-dim); color: var(--green);
  border: 1px solid var(--green); border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
}
.usr-mfa-off {
  color: var(--text3); font-size: 13px; font-weight: 600;
}
.usr-actions-cell {
  white-space: nowrap; text-align: right;
  width: 140px;
}
.usr-actions-cell .usr-actions-row {
  display: inline-flex; gap: 4px; align-items: center;
  justify-content: flex-end;
}
.usr-actions-cell .card-action { margin: 0; }
.usr-clients-cell { max-width: 240px; }
.usr-clients-cell .usr-client-chip + .usr-client-chip { margin-left: 0; }

.usr-row-pending { background: rgba(251,191,36,0.02); }
.usr-empty {
  padding: 32px 20px; text-align: center;
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--r); color: var(--text3); font-size: 13px;
  margin-top: 12px;
}

/* Modal unificado de tipo */
.usr-step { /* placeholder para que JS muestre/oculte */ }
.usr-step-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.8px;
  color: var(--text3); text-transform: uppercase;
  padding: 18px 24px 8px;
}
.usr-type-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; padding: 0 24px 24px;
}
@media (max-width: 640px) {
  .usr-type-grid { grid-template-columns: 1fr; }
}
.usr-type-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 16px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--r2);
  cursor: pointer; transition: all .2s;
  text-align: left; font-family: inherit;
}
.usr-type-card:hover {
  border-color: var(--accent); background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.usr-type-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.usr-type-icon-internal { background: var(--accent-dim); color: var(--accent); }
.usr-type-icon-external { background: rgba(251,146,60,0.12); color: var(--orange); }
.usr-type-title {
  font-size: 14px; font-weight: 700; color: var(--text);
}
.usr-type-desc {
  font-size: 12px; color: var(--text3); line-height: 1.55;
}

/* Link en el header del cliente al módulo Usuarios (reemplaza la ex-tab Portal) */
.cp-portal-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text2); text-decoration: none;
  padding: 3px 9px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px;
  transition: all .15s;
}
.cp-portal-link:hover {
  color: var(--accent); border-color: var(--accent); background: var(--accent-dim);
}
.cp-portal-link-empty {
  color: var(--text3); border-style: dashed;
}
.cp-portal-link svg { color: inherit; }
.cp-portal-pending { color: var(--amber); font-weight: 600; }
.cp-portal-arrow { font-size: 10px; opacity: .6; margin-left: 2px; }

/* Botones de acción en lista de backups. Antes el hover se hacía con
   onmouseover/onmouseout inline; migrado a :hover para que la CSP pueda
   prohibir 'unsafe-inline' en script-src-attr. */
.bk-action-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--border2);
  background: var(--surface2, var(--surface));
  cursor: pointer;
  transition: background 0.15s;
}
.bk-action-btn:hover { background: var(--border); }


/* ── Tipos de servicio (vista de configuración) ───────────────────────────
   Reemplaza los estilos inline que traía servicios.js. Cada servicio es una
   sección colapsable; los campos son chips que se prenden/apagan (no hay
   checkbox nativo: el control nativo no sigue el tema y quedaba desprolijo
   contra el fondo oscuro). Estado visible = aria-pressed="true" en el chip;
   es también lo que lee el lector de pantalla. */
.svc-cfg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r2); margin-bottom: 8px; overflow: hidden; transition: border-color var(--t-base); }
.svc-cfg:hover { border-color: var(--border2); }
.svc-cfg-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; user-select: none; transition: background var(--t-base); }
.svc-cfg-head:hover { background: var(--surface2); }
.svc-cfg.open .svc-cfg-head { border-bottom: 1px solid var(--border); }
.svc-cfg-toggle { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex-shrink: 0; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--text3); cursor: pointer; transition: color var(--t-base), background var(--t-base); }
.svc-cfg-toggle:hover { color: var(--text); background: var(--surface3); }
.svc-cfg-toggle:focus-visible { outline: none; box-shadow: var(--ring-accent); }
.svc-cfg-chevron { transition: transform var(--t-base); }
.svc-cfg.open .svc-cfg-chevron { transform: rotate(90deg); }
.svc-cfg-avatar { width: 26px; height: 26px; font-size: 9.5px; }
.svc-cfg-name { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-cfg-count { font-size: 11px; color: var(--text3); font-family: 'Geist Mono', monospace; white-space: nowrap; }
.svc-cfg-count b { color: var(--text2); font-weight: 600; }
.svc-cfg-count.all-hidden b { color: var(--amber); }
.svc-cfg-body { padding: 14px; }
.svc-cfg-body[hidden] { display: none; }
.svc-cfg-sub { font-size: 10px; font-weight: 600; letter-spacing: 1px; color: var(--text3); text-transform: uppercase; margin-bottom: 9px; }
.svc-cfg-sub + .svc-cfg-grid { margin-bottom: 2px; }
.svc-cfg-grid + .svc-cfg-sub { margin-top: 16px; }
.svc-cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 7px; }

/* Chip de campo. Prendido: borde acento + tilde llena. Apagado: atenuado. */
.svc-chip {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-width: 0;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text);
  font-family: inherit; font-size: 12px; font-weight: 500;
  text-align: left; cursor: pointer;
  transition: background var(--t-base), border-color var(--t-base), opacity var(--t-base);
}
.svc-chip:hover { background: var(--surface3); border-color: var(--border2); }
.svc-chip:focus-visible { outline: none; box-shadow: var(--ring-accent); }
.svc-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-dim); }
.svc-chip[aria-pressed="false"] { opacity: 0.5; }
.svc-chip-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-chip-check {
  width: 15px; height: 15px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border2); border-radius: 5px;
  color: transparent;
  transition: background var(--t-base), border-color var(--t-base), color var(--t-base);
}
.svc-chip[aria-pressed="true"] .svc-chip-check { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.svc-chip-lock { flex-shrink: 0; color: var(--text3); font-size: 10px; }

/* Campo personalizado: chip + botón de borrar pegados como una sola píldora. */
.svc-chip-wrap { display: flex; min-width: 0; }
.svc-chip-wrap .svc-chip { border-radius: 999px 0 0 999px; border-right: 0; }
.svc-chip-del {
  display: flex; align-items: center; justify-content: center;
  padding: 0 10px 0 7px;
  border: 1px solid var(--border); border-left: 0;
  border-radius: 0 999px 999px 0;
  background: var(--surface2);
  color: var(--text3);
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base), border-color var(--t-base);
}
.svc-chip-del:hover { background: var(--red-dim); border-color: var(--red); color: var(--red); }
.svc-chip-del:focus-visible { outline: none; box-shadow: var(--ring-danger); }
.svc-chip-wrap:has(.svc-chip[aria-pressed="true"]) .svc-chip-del { border-color: var(--accent); background: var(--accent-dim); }

/* Tabla de campos de un servicio personalizado. */
.svc-fields-table { width: 100%; border-collapse: collapse; }
.svc-fields-table th { font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); padding: 0 8px 6px; text-align: left; }
.svc-fields-table td { padding: 8px; font-size: 13px; }
.svc-fields-table tbody tr { border-top: 1px solid var(--border); }
.svc-fields-table td.shrink { width: 1%; white-space: nowrap; }
.svc-type-tag { background: var(--surface2); color: var(--text2); font-size: 10px; padding: 2px 8px; border-radius: 20px; font-family: 'Geist Mono', monospace; }
.svc-enc-yes { color: var(--green); font-size: 11px; }
.svc-enc-no { color: var(--text3); font-size: 11px; }
.svc-cfg-empty { font-size: 12px; color: var(--text3); padding: 2px; }

/* Encabezado de grupo (Predefinidos / Personalizados) + acciones globales. */
.svc-group-hdr { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.svc-group-hdr.spaced { margin-top: 24px; }
.svc-group-title { font-size: 11px; font-weight: 600; letter-spacing: 1.2px; color: var(--text3); text-transform: uppercase; }
.svc-group-hdr .svc-group-line { flex: 1; height: 1px; background: var(--border); }
.svc-group-hint { font-size: 12px; color: var(--text3); margin: -4px 0 14px; }
.svc-expand-btn { background: none; border: 0; color: var(--text3); font-family: inherit; font-size: 11px; cursor: pointer; padding: 2px 4px; border-radius: 5px; transition: color var(--t-base); }
.svc-expand-btn:hover { color: var(--accent); }
.svc-empty svg { opacity: 0.4; margin-bottom: 12px; }
.svc-empty-hint { font-size: 12px; margin-top: 4px; }

