:root{
    /* Paleta sobria alineada al logo dealbridge (azul / verde Carey) */
    --navy:#0f2438;
    --navy-2:#152d47;
    --brand-blue:#0a5a9c;
    --brand-blue-hover:#084a82;
    --brand-green:#2a7d4a;
    --brand-green-soft:#e6f4eb;
    --slate:#1e293b;
    --gold:#0a5a9c;
    --gold-light:#3d7eb8;
    --bg:#f4f6f8;
    --surface:#ffffff;
    --border:#e2e8f0;
    --border-strong:#cbd5e1;
    --text:#0f2438;
    --text-muted:#64748b;
    --text-light:#94a3b8;
    --success:#1f6f3e;
    --success-bg:#e6f4eb;
    --warning:#92400e;
    --warning-bg:#fef3c7;
    --danger:#991b1b;
    --danger-bg:#fee2e2;
    --info:#0a5a9c;
    --info-bg:#e8f1fa;
    --shadow-sm:0 1px 2px rgba(15,36,56,.05);
    --shadow:0 1px 3px rgba(15,36,56,.07), 0 1px 2px rgba(15,36,56,.04);
    --shadow-md:0 4px 12px rgba(15,36,56,.08);
    --shadow-lg:0 10px 25px rgba(15,36,56,.1);
  }
  *{margin:0;padding:0;box-sizing:border-box}
  html,body{height:100%}
  body{
    font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif;
    background:var(--bg);
    color:var(--text);
    font-size:14px;
    line-height:1.5;
    -webkit-font-smoothing:antialiased;
  }
  h1,h2,h3,h4{font-family:'Playfair Display',Georgia,serif;font-weight:600;color:var(--navy);letter-spacing:-.01em}
  h1{font-size:28px;line-height:1.2}
  h2{font-size:20px;line-height:1.3}
  h3{font-size:16px;line-height:1.4}
  a{color:var(--info);text-decoration:none}
  button{font-family:inherit;cursor:pointer;border:none;background:none}
  input,select,textarea{font-family:inherit}

  /* ============ LOGIN ============ */
  #screen-login{
    min-height:100vh;
    background:linear-gradient(148deg,#0b1828 0%,#102a45 45%,#0d2638 100%);
  }
  .login-left{
    flex:1;
    padding:60px;
    color:#fff;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    min-width:0;
    min-height:100vh;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
  }
  .login-brand{
    flex:0 0 auto;
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
    overflow:visible;
    width:100%;
    max-width:100%;
  }
  .login-brand-tagline{
    font-size:10px;
    font-weight:600;
    letter-spacing:.18em;
    text-transform:uppercase;
    color:rgba(255,255,255,.78);
    margin:0;
    padding-left:2px;
    max-width:min(340px,100%);
  }
  /* Contenedor acotado: ratio intrínseco del PNG (887×345); sin max-height */
  .login-brand-graphic{
    width:100%;
    max-width:min(340px,100%);
    line-height:0;
    padding:8px 0 4px;
    box-sizing:content-box;
  }
  .login-brand-logo{
    display:block;
    width:100%;
    height:auto;
    object-fit:contain;
    object-position:left top;
    background:transparent;
    filter:drop-shadow(0 2px 12px rgba(0,0,0,.25));
  }
  .login-hero{
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
  }
  .login-hero h1{color:#fff;font-size:42px;line-height:1.15;margin-bottom:16px;max-width:520px}
  .login-hero p{font-size:16px;color:rgba(255,255,255,.75);max-width:480px;line-height:1.6}
  .login-features{margin-top:32px;display:flex;flex-direction:column;gap:14px;max-width:480px}
  .login-feature{display:flex;gap:12px;align-items:flex-start;font-size:14px;color:rgba(255,255,255,.85)}
  .login-feature-bullet{
    width:24px;height:24px;flex-shrink:0;
    background:rgba(42,125,74,.22);
    color:#7fd4a8;
    border-radius:50%;
    display:flex;align-items:center;justify-content:center;
    font-size:12px;font-weight:700;
  }
  .login-footer-text{font-size:12px;color:rgba(255,255,255,.5)}
  .login-right{
    flex:0 0 480px;
    background:var(--surface);
    padding:60px;
    display:flex;
    flex-direction:column;
    justify-content:center;
  }
  .login-form-title{margin-bottom:8px}
  .login-form-sub{color:var(--text-muted);font-size:14px;margin-bottom:32px}

  /* ============ CONFIDENTIALITY BANNER ============ */
  .confidentiality-banner{
    position:sticky;
    top:0;
    z-index:200;
    background:linear-gradient(90deg,#7f1d1d 0%,#991b1b 50%,#7f1d1d 100%);
    color:#fff;
    text-align:center;
    padding:8px 20px;
    font-size:12px;
    font-weight:600;
    letter-spacing:.02em;
    box-shadow:0 2px 8px rgba(0,0,0,.15);
    line-height:1.4;
  }

  /* ============ APP SHELL ============ */
  #screen-app{min-height:100vh}
  .app-shell{display:grid;grid-template-columns:240px minmax(0,1fr);min-height:100vh}
  .app-shell > main{min-width:0}

  /* SIDEBAR */
  .sidebar{
    background:var(--navy);
    color:#fff;
    display:flex;
    flex-direction:column;
    position:sticky;
    top:0;
    height:100vh;
  }
  .sidebar-brand{
    padding:18px 24px 20px;
    border-bottom:1px solid rgba(255,255,255,.08);
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    justify-content:center;
    gap:6px;
  }
  .sidebar-brand-tagline{
    font-size:8px;
    font-weight:600;
    letter-spacing:.14em;
    text-transform:uppercase;
    color:rgba(255,255,255,.55);
    margin:0;
    text-align:left;
    line-height:1.3;
    max-width:100%;
  }
  .sidebar-brand-logo{
    display:block;
    width:auto;
    height:auto;
    max-width:100%;
    max-height:44px;
    object-fit:contain;
    object-position:left center;
    opacity:.98;
    background:transparent;
  }
  .sidebar-section{
    padding:12px 0;
    flex:1;
  }
  .sidebar-label{
    padding:8px 24px;
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:.08em;
    color:rgba(255,255,255,.4);
    font-weight:600;
  }
  .sidebar-item{
    padding:9px 24px;
    display:flex;align-items:center;gap:12px;
    color:rgba(255,255,255,.75);
    font-size:14px;
    cursor:pointer;
    transition:all .15s;
    border-left:3px solid transparent;
  }
  .sidebar-item:hover{background:rgba(255,255,255,.05);color:#fff}
  .sidebar-item.active{
    background:rgba(10,90,156,.12);
    color:#fff;
    border-left-color:var(--brand-green);
    font-weight:500;
  }
  .sidebar-icon{width:18px;text-align:center;font-size:14px}
  .sidebar-badge{
    margin-left:auto;
    background:var(--brand-green);
    color:#fff;
    font-size:11px;
    font-weight:700;
    padding:1px 6px;
    border-radius:10px;
    min-width:18px;
    text-align:center;
  }
  .sidebar-user{
    padding:14px 24px;
    border-top:1px solid rgba(255,255,255,.08);
    display:flex;
    align-items:center;
    gap:10px;
  }
  .sidebar-avatar{
    width:36px;height:36px;
    border-radius:50%;
    background:var(--brand-blue);
    color:#fff;
    display:flex;align-items:center;justify-content:center;
    font-weight:600;font-size:14px;
  }
  .sidebar-user-name{font-size:13px;font-weight:600;color:#fff}
  .sidebar-user-firm{font-size:12px;color:rgba(255,255,255,.55)}
  .sidebar-footer-note{
    padding:10px 24px 18px;
    font-size:11px;
    color:rgba(255,255,255,.45);
    border-top:1px solid rgba(255,255,255,.06);
  }
  .sidebar-mobile-toolbar{
    display:none;
    flex-shrink:0;
    justify-content:flex-end;
    padding:8px 10px 0;
  }
  .sidebar-drawer-close{
    display:none;
    align-items:center;
    justify-content:center;
    width:44px;
    height:44px;
    padding:0;
    border:none;
    border-radius:8px;
    background:rgba(255,255,255,.1);
    color:#fff;
    font-size:20px;
    line-height:1;
    cursor:pointer;
    transition:background .15s;
  }
  .sidebar-drawer-close:hover{background:rgba(255,255,255,.18)}
  .sidebar-drawer-close:focus-visible{outline:2px solid #7fd4a8;outline-offset:2px}

  /* TOPBAR */
  .topbar{
    background:var(--surface);
    border-bottom:1px solid var(--border);
    padding:12px 32px;
    display:flex;
    align-items:center;
    gap:16px;
    position:sticky;
    top:0;
    z-index:10;
  }
  .topbar-title{
    font-family:'Playfair Display',serif;font-size:22px;font-weight:600;color:var(--navy);
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
    flex-shrink:0;min-width:0;max-width:min(420px,36vw);
  }
  .topbar-search{
    flex:1;max-width:480px;
    margin-left:auto;
    position:relative;
  }
  .topbar-search input{
    width:100%;
    padding:9px 12px 9px 36px;
    border:1px solid var(--border-strong);
    border-radius:6px;
    font-size:13px;
    background:var(--bg);
    transition:all .15s;
  }
  .topbar-search input:focus{outline:none;border-color:var(--navy);background:#fff;box-shadow:0 0 0 3px rgba(15,30,61,.08)}
  .topbar-search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--text-muted);font-size:14px}

  .topbar-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}

  /* Menú móvil (drawer); visible solo ≤1024px en CSS responsive */
  .sidebar-menu-btn{
    display:none;
    align-items:center;
    justify-content:center;
    width:44px;
    min-width:44px;
    height:44px;
    padding:0;
    border-radius:8px;
    border:1px solid var(--border-strong);
    background:#fff;
    color:var(--navy);
    flex-shrink:0;
    cursor:pointer;
    transition:background .15s,border-color .15s;
  }
  .sidebar-menu-btn:hover{background:var(--bg);border-color:var(--navy)}
  .sidebar-menu-btn:focus-visible{outline:2px solid var(--brand-blue);outline-offset:2px}
  .sidebar-menu-bars{
    display:block;
    width:20px;
    height:2px;
    background:currentColor;
    border-radius:1px;
    box-shadow:0 -6px 0 currentColor,0 6px 0 currentColor;
  }
  .topbar-icon-btn{
    width:36px;height:36px;
    border-radius:6px;
    display:flex;align-items:center;justify-content:center;
    color:var(--text-muted);
    position:relative;
    transition:all .15s;
  }
  .topbar-icon-btn:hover{background:var(--bg);color:var(--navy)}
  .notif-dot{
    position:absolute;top:6px;right:6px;
    width:8px;height:8px;
    background:var(--danger);
    border-radius:50%;
    border:2px solid var(--surface);
  }

  /* CONTENT */
  .content{padding:32px;max-width:1400px}

  /* ============ COMPONENTS ============ */
  .card{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:8px;
    box-shadow:var(--shadow-sm);
  }
  .card-header{
    padding:16px 20px;
    border-bottom:1px solid var(--border);
    display:flex;
    align-items:center;
    justify-content:space-between;
  }
  .card-title{font-family:'Playfair Display',serif;font-size:16px;font-weight:600;color:var(--navy)}
  .card-sub{font-size:12px;color:var(--text-muted);margin-top:2px}
  .card-body{padding:20px}
  .card-footer{padding:12px 20px;border-top:1px solid var(--border);background:var(--bg);border-radius:0 0 8px 8px}

  /* BUTTONS */
  .btn{
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:8px 16px;
    border-radius:6px;
    font-size:13px;
    font-weight:500;
    transition:all .15s;
    border:1px solid transparent;
    cursor:pointer;
    white-space:nowrap;
  }
  .btn-primary{background:var(--brand-blue);color:#fff;border-color:transparent}
  .btn-primary:hover{background:var(--brand-blue-hover)}
  .btn-gold{background:var(--brand-green);color:#fff;font-weight:600;border-color:transparent}
  .btn-gold:hover{filter:brightness(1.06)}
  .btn-secondary{background:#fff;color:var(--navy);border-color:var(--border-strong)}
  .btn-secondary:hover{background:var(--bg);border-color:var(--navy)}
  .btn-ghost{color:var(--text-muted)}
  .btn-ghost:hover{background:var(--bg);color:var(--navy)}
  .btn-danger{background:#fff;color:var(--danger);border-color:var(--border-strong)}
  .btn-danger:hover{background:var(--danger-bg);border-color:var(--danger)}
  .btn-sm{padding:5px 10px;font-size:12px}
  .btn-block{width:100%;justify-content:center}

  /* TAGS */
  .tag{
    display:inline-flex;
    align-items:center;
    padding:2px 8px;
    border-radius:4px;
    font-size:11px;
    font-weight:600;
    letter-spacing:.02em;
    text-transform:uppercase;
  }
  .tag-buy{background:var(--success-bg);color:var(--success)}
  .tag-sell{background:var(--danger-bg);color:var(--danger)}
  .tag-rent{background:var(--warning-bg);color:var(--warning)}
  .tag-invest{background:var(--info-bg);color:var(--info)}
  .tag-fusion{background:#f3e8ff;color:#6b21a8}
  .tag-permuta{background:#fce7f3;color:#9d174d}
  .tag-neutral{background:var(--bg);color:var(--text-muted)}
  .tag-country{background:var(--bg);color:var(--text);border:1px solid var(--border)}
  .tag-status-active{background:var(--success-bg);color:var(--success)}
  .tag-status-pending{background:var(--warning-bg);color:var(--warning)}
  .tag-status-closed{background:var(--bg);color:var(--text-muted)}

  /* FORMS */
  .form-row{display:grid;grid-template-columns:1fr 1fr;gap:14px}
  .form-row-3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:14px}
  .form-group{margin-bottom:16px}
  .form-label{
    display:block;
    font-size:12px;
    font-weight:600;
    margin-bottom:6px;
    color:var(--navy);
    letter-spacing:.02em;
  }
  .form-label .req{color:var(--danger);margin-left:2px}
  .form-input,.form-select,.form-textarea{
    width:100%;
    padding:9px 12px;
    border:1px solid var(--border-strong);
    border-radius:6px;
    font-size:14px;
    background:#fff;
    transition:all .15s;
    color:var(--text);
  }
  .form-input:focus,.form-select:focus,.form-textarea:focus{
    outline:none;
    border-color:var(--navy);
    box-shadow:0 0 0 3px rgba(15,30,61,.08);
  }
  .form-textarea{resize:vertical;min-height:90px;font-family:inherit}
  .form-help{font-size:11px;color:var(--text-muted);margin-top:4px}

  /* TABLE */
  .table{width:100%;border-collapse:collapse;background:#fff}
  .table th{
    text-align:left;
    padding:10px 16px;
    font-size:11px;
    font-weight:600;
    color:var(--text-muted);
    text-transform:uppercase;
    letter-spacing:.05em;
    background:var(--bg);
    border-bottom:1px solid var(--border);
  }
  .table td{
    padding:14px 16px;
    border-bottom:1px solid var(--border);
    font-size:13px;
    vertical-align:middle;
  }
  .table tr:last-child td{border-bottom:none}
  .table tr.clickable{cursor:pointer;transition:background .12s}
  .table tr.clickable:hover{background:var(--bg)}
  .table tr.opp-missing-partner{background:var(--warning-bg)}
  .table tr.opp-missing-partner:hover{background:#fde68a}
  .table tr.opp-missing-partner td:first-child{box-shadow:inset 4px 0 0 var(--warning)}
  .opp-missing-partner-legend{
    display:flex;align-items:center;gap:10px;flex-wrap:wrap;
    padding:10px 14px;margin-bottom:12px;border-radius:8px;
    background:var(--warning-bg);color:var(--warning);font-size:13px;
    border:1px solid #fcd34d;
  }
  .opp-missing-partner-legend .legend-swatch{
    width:14px;height:14px;border-radius:3px;background:var(--warning-bg);
    box-shadow:inset 4px 0 0 var(--warning);border:1px solid #fcd34d;flex-shrink:0;
  }

  /* KPI */
  .kpi-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:24px}
  .kpi{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:8px;
    padding:18px 20px;
    box-shadow:var(--shadow-sm);
  }
  .kpi-label{font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em;font-weight:600;margin-bottom:8px}
  .kpi-value{font-family:'Playfair Display',serif;font-size:32px;font-weight:700;color:var(--navy);line-height:1}
  .kpi-change{font-size:12px;margin-top:6px;display:flex;align-items:center;gap:4px}
  .kpi-change.up{color:var(--success)}
  .kpi-change.down{color:var(--danger)}
  .kpi-icon{
    width:36px;height:36px;
    border-radius:6px;
    display:flex;align-items:center;justify-content:center;
    font-size:16px;
    margin-bottom:10px;
  }
  .kpi-icon.gold{background:rgba(42,125,74,.12);color:var(--brand-green)}
  .kpi-icon.navy{background:rgba(15,30,61,.08);color:var(--navy)}
  .kpi-icon.success{background:var(--success-bg);color:var(--success)}
  .kpi-icon.info{background:var(--info-bg);color:var(--info)}

  /* DASHBOARD GRID */
  .dash-grid{display:grid;grid-template-columns:2fr 1fr;gap:16px}

  /* AGENT STATUS */
  .agent-status{
    background:linear-gradient(135deg,var(--navy),var(--navy-2));
    color:#fff;
    border-radius:8px;
    padding:20px 24px;
    margin-bottom:24px;
    display:flex;
    align-items:center;
    gap:24px;
    box-shadow:var(--shadow-md);
  }
  .agent-status-icon{
    width:56px;height:56px;
    background:var(--gold);
    color:var(--navy);
    border-radius:8px;
    display:flex;align-items:center;justify-content:center;
    font-size:24px;
  }
  .agent-status-info{flex:1}
  .agent-status-title{font-family:'Playfair Display',serif;font-size:18px;font-weight:600;margin-bottom:2px}
  .agent-status-meta{font-size:13px;color:rgba(255,255,255,.7);display:flex;gap:14px;flex-wrap:wrap}
  .agent-status-meta span{display:flex;align-items:center;gap:5px}
  .agent-pulse{
    width:8px;height:8px;
    background:#10b981;
    border-radius:50%;
    box-shadow:0 0 0 0 rgba(16,185,129,.7);
    animation:pulse 2s infinite;
  }
  @keyframes pulse{
    0%{box-shadow:0 0 0 0 rgba(16,185,129,.7)}
    70%{box-shadow:0 0 0 8px rgba(16,185,129,0)}
    100%{box-shadow:0 0 0 0 rgba(16,185,129,0)}
  }

  /* OPPORTUNITY ROW */
  .opp-title-cell{display:flex;flex-direction:column;gap:2px}
  .opp-title-text{font-weight:600;color:var(--navy);font-size:13px}
  .opp-anon-text{font-size:11px;color:var(--text-muted)}

  /* MATCH CARD */
  .match-row{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:8px;
    margin-bottom:12px;
    overflow:hidden;
  }
  .match-row-top{
    display:flex;
    align-items:center;
    padding:14px 18px;
    border-bottom:1px solid var(--border);
    background:var(--bg);
  }
  .match-score-badge{
    background:var(--navy);
    color:#fff;
    padding:4px 10px;
    border-radius:4px;
    font-weight:700;
    font-size:13px;
    margin-right:12px;
    font-family:'Playfair Display',serif;
  }
  .match-score-badge.high{background:var(--success)}
  .match-score-badge.med{background:var(--warning)}
  .match-row-title{flex:1;font-weight:600;color:var(--navy);font-size:14px}
  .match-row-status{font-size:11px;text-transform:uppercase;font-weight:600;color:var(--text-muted)}
  .match-row-body{
    display:grid;
    grid-template-columns:1fr 40px 1fr;
    gap:14px;
    padding:14px 18px;
    align-items:center;
  }
  .match-vs{
    text-align:center;
    color:var(--gold);
    font-size:20px;
    font-weight:700;
  }
  .match-side{
    border:1px solid var(--border);
    border-radius:6px;
    padding:12px;
    background:#fff;
  }
  .match-side-tags{display:flex;gap:5px;margin-bottom:6px;flex-wrap:wrap}
  .match-side-title{font-weight:600;font-size:13px;color:var(--navy);margin-bottom:4px;line-height:1.3}
  .match-side-meta{font-size:11px;color:var(--text-muted)}
  .match-row-ai{
    background:rgba(10,90,156,.05);
    border-top:1px solid var(--border);
    padding:12px 18px;
    font-size:13px;
    color:var(--text);
    display:flex;
    gap:10px;
    align-items:flex-start;
  }
  .match-row-ai-icon{color:var(--brand-blue);font-size:14px;margin-top:1px}
  .match-ai-content{flex:1}
  .match-ai-text{white-space:pre-line}
  .match-ai-toggle{
    margin-top:8px;
    font-size:12px;
    color:var(--navy);
    background:transparent;
    border:none;
    padding:0;
    cursor:pointer;
    font-weight:600;
  }
  .match-ai-toggle:hover{text-decoration:underline}
  .match-row-actions{
    padding:10px 18px;
    border-top:1px solid var(--border);
    display:flex;
    gap:8px;
    justify-content:flex-end;
    background:#fff;
  }

  /* NOTIFICATION DROPDOWN */
  .dropdown{
    position:absolute;
    top:calc(100% + 8px);
    right:0;
    background:#fff;
    border:1px solid var(--border);
    border-radius:8px;
    box-shadow:var(--shadow-lg);
    width:380px;
    z-index:100;
    display:none;
    max-height:480px;
    overflow:hidden;
    flex-direction:column;
  }
  .dropdown.show{display:flex}
  .dropdown-header{padding:14px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
  .dropdown-title{font-family:'Playfair Display',serif;font-size:15px;font-weight:600;color:var(--navy)}
  .dropdown-list{flex:1;overflow-y:auto}
  .notif-item{
    padding:12px 16px;
    border-bottom:1px solid var(--border);
    display:flex;
    gap:10px;
    cursor:pointer;
    transition:background .12s;
  }
  .notif-item:hover{background:var(--bg)}
  .notif-item.unread{background:rgba(10,90,156,.06)}
  .dash-my-match-banner-wrap{margin-bottom:20px;display:none}
  .dash-my-match-banner{
    display:flex;align-items:center;gap:16px;flex-wrap:wrap;
    background:linear-gradient(135deg, rgba(10,90,156,.1) 0%, rgba(42,125,74,.08) 100%);
    border:2px solid var(--brand-blue);border-radius:12px;padding:16px 20px;
    box-shadow:0 4px 20px rgba(15,30,61,.08);
  }
  .dash-my-match-banner-icon{
    width:48px;height:48px;border-radius:12px;background:var(--navy);color:#7fd4a8;
    display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0;
  }
  .dash-my-match-banner-body{flex:1;min-width:200px}
  .dash-my-match-banner-title{font-family:'Playfair Display',serif;font-size:18px;font-weight:700;color:var(--navy);margin-bottom:4px}
  .dash-my-match-banner-text{font-size:13px;color:var(--text);line-height:1.45;max-width:720px}
  .notif-item.notif-item-my-match{border-left:3px solid var(--brand-green);background:rgba(42,125,74,.08)}
  .notif-item.notif-item-my-match.unread{background:rgba(42,125,74,.12)}

  .notif-item.unread::before{
    content:'';
    width:6px;height:6px;
    background:var(--gold);
    border-radius:50%;
    margin-top:7px;
    flex-shrink:0;
  }
  .notif-item:not(.unread)::before{
    content:'';width:6px;height:6px;flex-shrink:0;
  }
  .notif-content{flex:1;min-width:0}
  .notif-title{font-size:13px;font-weight:600;color:var(--navy);margin-bottom:2px}
  .notif-text{font-size:12px;color:var(--text-muted);line-height:1.4}
  .notif-time{font-size:11px;color:var(--text-light);margin-top:4px}
  #tab-notifications #notifFullList{
    min-height:120px;width:100%;max-width:100%;position:relative;z-index:2;box-sizing:border-box;
    max-height:min(70vh,calc(100vh - 220px));overflow-y:auto;-webkit-overflow-scrolling:touch;
  }
  #tab-notifications.tab-content.active .card{min-width:0}
  .dropdown-footer{padding:10px 16px;text-align:center;border-top:1px solid var(--border);background:var(--bg)}
  .dropdown-footer a{font-size:12px;font-weight:500;color:var(--navy)}

  /* MODAL */
  .modal-overlay{
    position:fixed;
    top:0;left:0;right:0;bottom:0;
    background:rgba(15,30,61,.5);
    backdrop-filter:blur(2px);
    display:none;
    align-items:center;justify-content:center;
    z-index:1000;
    padding:24px;
  }
  .modal-overlay.show{display:flex}
  .modal{
    background:#fff;
    border-radius:12px;
    width:100%;
    max-width:720px;
    max-height:90vh;
    overflow-y:auto;
    box-shadow:var(--shadow-lg);
  }
  .modal-section-head{
    font-size:11px;text-transform:uppercase;font-weight:600;color:var(--text-muted);
    margin:16px 0 8px;letter-spacing:.03em;padding-bottom:6px;border-bottom:1px solid var(--border);
  }
  .modal-section-head:first-child{margin-top:0}
  .modal-header{
    padding:20px 24px;
    border-bottom:1px solid var(--border);
    display:flex;
    align-items:center;
    justify-content:space-between;
  }
  .modal-body{padding:24px}
  .modal-footer{
    padding:16px 24px;
    border-top:1px solid var(--border);
    display:flex;
    justify-content:flex-end;
    gap:8px;
    background:var(--bg);
    border-radius:0 0 12px 12px;
  }
  .modal-close{font-size:20px;color:var(--text-muted);cursor:pointer;padding:4px}
  .form-opt-admin-section{margin-bottom:20px}
  .form-opt-admin-title{font-family:'Playfair Display',serif;font-size:15px;font-weight:600;color:var(--navy);margin-bottom:10px}
  .form-opt-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:1px solid var(--border);font-size:13px}
  .form-opt-row code{font-size:11px;color:var(--text-muted);background:var(--bg);padding:2px 6px;border-radius:4px}
  .form-opt-del{color:#c62828;background:none;border:none;cursor:pointer;font-size:18px;line-height:1;padding:4px 8px;font-weight:700}
  .form-opt-del:hover{opacity:.85}
  .form-opt-add-row{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end;margin-top:10px}
  .form-opt-add-row input{flex:1;min-width:120px}

  /* FILTERS BAR */
  .filters-bar{
    background:#fff;
    border:1px solid var(--border);
    border-radius:8px;
    padding:14px 16px;
    margin-bottom:16px;
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
  }
  .filter-group{display:flex;align-items:center;gap:6px}
  .filter-label{font-size:11px;font-weight:600;color:var(--text-muted);text-transform:uppercase}
  .filter-select{
    padding:6px 10px;
    border:1px solid var(--border-strong);
    border-radius:5px;
    font-size:12px;
    background:#fff;
    color:var(--text);
  }
  .filter-search{
    flex:1;
    min-width:200px;
    padding:7px 12px;
    border:1px solid var(--border-strong);
    border-radius:5px;
    font-size:13px;
  }

  /* TOAST */
  .toast{
    position:fixed;
    bottom:24px;right:24px;
    background:var(--navy);
    color:#fff;
    padding:12px 20px;
    border-radius:6px;
    font-size:13px;
    font-weight:500;
    box-shadow:var(--shadow-lg);
    transform:translateY(100px);
    opacity:0;
    transition:all .25s;
    z-index:2000;
    display:flex;align-items:center;gap:10px;
    max-width:400px;
  }
  .toast.show{transform:translateY(0);opacity:1}
  .toast.success{background:var(--success)}
  .toast.warning{background:var(--warning)}
  .toast.danger{background:var(--danger)}

  /* Simulación de vista (admin): fijo abajo a la derecha */
  .admin-view-as-bar{
    position:fixed;bottom:16px;right:16px;z-index:60;
    display:none;align-items:center;gap:10px;
    padding:10px 14px;border-radius:10px;
    background:var(--surface);border:1px solid var(--border);
    box-shadow:var(--shadow-lg);
    font-size:13px;
  }
  .admin-view-as-bar label{margin:0;color:var(--text-muted);font-size:12px;white-space:nowrap}
  .admin-view-as-bar select{
    min-width:150px;padding:6px 10px;border-radius:6px;
    border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:13px;
  }

  /* Carga inicial / post-login (logo + mensaje) */
  .app-loading-overlay{
    position:fixed;inset:0;z-index:99999;
    display:none;align-items:center;justify-content:center;
    background:rgba(11,24,40,.88);
    backdrop-filter:blur(6px);
    flex-direction:column;
    padding:32px;
  }
  .app-loading-overlay.show{display:flex}
  .app-loading-inner{
    text-align:center;
    max-width:min(480px,92vw);
    color:#e8eef5;
  }
  .app-loading-logo{
    display:block;
    width:auto;
    height:auto;
    max-width:min(280px,88vw);
    max-height:52px;
    margin:0 auto 20px;
    object-fit:contain;
    object-position:center center;
    background:transparent;
    filter:drop-shadow(0 4px 24px rgba(0,0,0,.35));
  }
  .app-loading-tagline{
    font-size:9px;
    font-weight:600;
    letter-spacing:.16em;
    text-transform:uppercase;
    color:rgba(232,238,245,.78);
    margin:-8px 0 14px;
  }
  .app-loading-text{
    font-size:17px;font-weight:500;letter-spacing:.01em;
    color:rgba(255,255,255,.92);margin-bottom:22px;line-height:1.45;
  }
  .app-loading-bridges{
    display:flex;align-items:center;justify-content:center;gap:10px;margin-bottom:20px;
  }
  .app-loading-bridge{
    width:36px;height:22px;border-radius:12px 12px 0 0;
    border:3px solid transparent;border-bottom:none;
    opacity:.85;animation:db-bridge-pulse 1.2s ease-in-out infinite;
  }
  .app-loading-bridge.b1{border-color:#3d8fd4;animation-delay:0s}
  .app-loading-bridge.b2{border-color:#4cb870;animation-delay:.2s}
  @keyframes db-bridge-pulse{
    0%,100%{opacity:.45;transform:translateY(0)}
    50%{opacity:1;transform:translateY(-3px)}
  }
  .app-loading-dots{display:flex;gap:8px;justify-content:center}
  .app-loading-dots span{
    width:8px;height:8px;border-radius:50%;
    background:linear-gradient(135deg,#3d8fd4,#4cb870);
    animation:db-dot 1.1s ease-in-out infinite;
  }
  .app-loading-dots span:nth-child(2){animation-delay:.15s}
  .app-loading-dots span:nth-child(3){animation-delay:.3s}
  @keyframes db-dot{
    0%,80%,100%{opacity:.25;transform:scale(.85)}
    40%{opacity:1;transform:scale(1)}
  }

  /* SCREEN/TAB */
  .tab-content{display:none}
  .tab-content.active{display:block}
  .screen{display:none}
  .screen.active{display:block}
  #screen-login.active{display:flex}
  #screen-app.active{display:block}

  /* PAGE HEADER */
  .page-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:24px;flex-wrap:wrap;gap:12px}
  .page-header-left h1{margin-bottom:4px}
  .page-header-sub{color:var(--text-muted);font-size:14px}
  .page-actions{display:flex;gap:8px}

  /* EMPTY STATE */
  .empty{padding:48px 20px;text-align:center;color:var(--text-muted)}
  .empty-icon{font-size:42px;margin-bottom:12px;opacity:.5}
  .empty-title{font-family:'Playfair Display',serif;font-size:18px;color:var(--navy);margin-bottom:6px}

  /* PIPELINE KANBAN (solo admin) */
  .pipeline-board{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;align-items:start}
  @media (max-width:1024px){ .pipeline-board{grid-template-columns:repeat(2,1fr)} }
  .kanban-col{background:var(--bg);border:1px solid var(--border,#e5e9f0);border-radius:10px;padding:10px;min-height:220px}
  .kanban-col.drag-over{outline:2px dashed var(--brand-blue);outline-offset:-4px}
  .kanban-col-title{font-size:13px;font-weight:700;color:var(--navy);margin:2px 4px 10px;display:flex;justify-content:space-between}
  .kanban-card{background:#fff;border:1px solid var(--border,#e5e9f0);border-radius:8px;padding:10px 12px;margin-bottom:8px;cursor:grab;box-shadow:0 1px 2px rgba(15,30,61,.06)}
  .kanban-card:active{cursor:grabbing}
  .kanban-card-title{font-size:13px;font-weight:600;color:var(--navy);margin-bottom:4px}
  .kanban-card-sub{font-size:11px;color:var(--text-muted)}

  /* SKELETON (carga inicial) */
  .skeleton-cell{height:12px;border-radius:6px;background:linear-gradient(90deg,#e8ecf1 25%,#f4f6f9 50%,#e8ecf1 75%);background-size:200% 100%;animation:skeletonShimmer 1.2s ease-in-out infinite}
  @keyframes skeletonShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
  @media (prefers-reduced-motion: reduce){ .skeleton-cell{animation:none} }

  /* MAPA DE RED (vis-network) */
  .opp-network-graph{
    height:calc(100vh - 280px);
    min-height:380px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:12px;
    overflow:hidden;
    box-shadow:var(--shadow-sm);
    isolation:isolate;
    contain:layout style;
  }
  .opp-network-graph .vis-network{outline:none}
  .opp-network-empty{margin-top:-8px}

  /* DETAIL */
  .detail-meta-grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:12px;
    margin:20px 0;
  }
  .detail-meta-item{
    background:var(--bg);
    border-radius:6px;
    padding:12px 14px;
  }
  .detail-meta-label{font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em;font-weight:600;margin-bottom:4px}
  .detail-meta-value{font-size:14px;font-weight:600;color:var(--navy)}
  .form-readonly{
    padding:10px 12px;
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:6px;
    font-size:14px;
    color:var(--navy);
    line-height:1.45;
  }
  .detail-section{margin-top:24px}
  .detail-section h3{margin-bottom:12px;font-size:15px}

  .pipeline-block{margin:8px 0 4px}
  .pipeline-track{display:flex;align-items:flex-start;width:100%;gap:0}
  .pipeline-step{
    flex:0 0 22%;
    max-width:22%;
    display:flex;
    flex-direction:column;
    align-items:center;
    text-align:center;
    z-index:1;
  }
  .pipeline-step[role="button"]{cursor:pointer}
  .pipeline-step[role="button"]:hover .pipeline-dot{transform:scale(1.12)}
  .pipeline-dot{
    width:14px;height:14px;border-radius:50%;
    background:#fff;border:3px solid var(--border);
    box-sizing:border-box;
    transition:transform .15s, border-color .2s, background .2s;
  }
  .pipeline-step.reached .pipeline-dot{border-color:var(--brand-blue);background:var(--brand-blue)}
  .pipeline-step.current .pipeline-dot{
    border-color:var(--gold,#b8860b);
    background:var(--gold,#b8860b);
    box-shadow:0 0 0 3px rgba(184,134,11,.25);
  }
  .pipeline-label{font-size:11px;color:var(--text-muted);margin-top:10px;line-height:1.35;padding:0 2px}
  .pipeline-step.reached .pipeline-label{color:var(--navy)}
  .pipeline-step.current .pipeline-label{font-weight:700;color:var(--navy)}
  .pipeline-connector{
    flex:1 1 auto;
    height:3px;
    background:var(--border);
    margin-top:6px;
    min-width:8px;
    transition:background .2s;
  }
  .pipeline-connector.reached{background:var(--brand-blue)}
  .pipeline-hint{font-size:12px;color:var(--text-muted);margin:10px 0 0}

  .alert{
    padding:12px 16px;
    border-radius:6px;
    font-size:13px;
    margin-bottom:16px;
    display:flex;
    align-items:flex-start;
    gap:10px;
  }
  .alert-info{background:var(--info-bg);color:var(--info)}
  .alert-warn{background:var(--warning-bg);color:var(--warning)}
  .alert-success{background:var(--success-bg);color:var(--success)}

  /* AGENT PAGE */
  .agent-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px}
  .freq-option{
    border:2px solid var(--border);
    border-radius:8px;
    padding:14px 16px;
    cursor:pointer;
    transition:all .15s;
    text-align:left;
    background:#fff;
  }
  .freq-option:hover{border-color:var(--brand-blue)}
  .freq-option.selected{border-color:var(--brand-blue);background:rgba(10,90,156,.06)}
  .freq-option-title{font-weight:600;color:var(--navy);font-size:14px;margin-bottom:2px}
  .freq-option-desc{font-size:12px;color:var(--text-muted)}

  .agent-compat-filter{width:100%;max-width:420px;padding:8px 12px;border:1px solid var(--border);border-radius:8px;font-size:13px;margin-bottom:14px;box-sizing:border-box}
  .agent-compat-split{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-top:8px}
  @media (max-width:900px){ .agent-compat-split{ grid-template-columns:1fr } }
  .agent-compat-h4{font-size:13px;font-weight:600;color:var(--navy);margin:0 0 8px}
  .agent-compat-help{font-size:12px;color:var(--text-muted);line-height:1.45;margin-bottom:10px}
  .agent-compat-table{width:100%;font-size:12px;border-collapse:collapse;margin-bottom:8px}
  .agent-compat-table th,.agent-compat-table td{padding:6px 4px;border-bottom:1px solid var(--border);text-align:left;vertical-align:middle}
  .agent-compat-table th{color:var(--text-muted);font-weight:600;font-size:11px;text-transform:uppercase}
  .agent-compat-table input{width:100%;box-sizing:border-box;padding:6px 8px;border:1px solid var(--border);border-radius:6px;font:inherit}
  .agent-compat-table tr.compat-row-hidden{display:none}
  .agent-compat-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px;align-items:center}

  .run-history{font-size:13px;min-height:120px;width:100%;max-width:100%;position:relative;z-index:2;box-sizing:border-box;max-height:min(55vh,calc(100vh - 320px));overflow-y:auto;-webkit-overflow-scrolling:touch}
  #tab-agent.tab-content.active .card{min-width:0}
  .run-item{padding:12px 0;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:12px}
  .run-item:last-child{border-bottom:none}
  .run-status-icon{
    width:28px;height:28px;
    border-radius:50%;
    display:flex;align-items:center;justify-content:center;
    font-size:13px;flex-shrink:0;
  }
  .run-status-icon.success{background:var(--success-bg);color:var(--success)}
  .run-status-icon.running{background:var(--warning-bg);color:var(--warning)}
  .run-status-icon.failed,.run-status-icon.cancelled{background:var(--danger-bg, #fdecea);color:var(--danger, #c0392b)}
  .run-info{flex:1}
  .run-time{font-weight:600;color:var(--navy);font-size:13px}
  .run-detail{font-size:12px;color:var(--text-muted)}

  /* HIGHLIGHT */
  mark{background:rgba(10,90,156,.18);color:var(--navy);padding:0 2px;border-radius:2px}

  /* RESPONSIVE */
  @media (max-width: 1024px){
    .app-shell{
      grid-template-columns:minmax(0,1fr);
      position:relative;
    }
    .sidebar-backdrop{
      position:fixed;
      inset:0;
      z-index:1400;
      background:rgba(15,36,56,.48);
      opacity:0;
      visibility:hidden;
      transition:opacity .22s ease,visibility .22s ease;
      pointer-events:none;
    }
    #screen-app.sidebar-drawer-open .sidebar-backdrop{
      opacity:1;
      visibility:visible;
      pointer-events:auto;
    }
    .sidebar{
      display:flex !important;
      position:fixed;
      left:0;
      top:0;
      bottom:0;
      width:min(288px,88vw);
      max-width:320px;
      z-index:1410;
      height:100vh;
      height:100dvh;
      transform:translate3d(-105%,0,0);
      transition:transform .28s cubic-bezier(.4,0,.2,1);
      box-shadow:none;
      overflow-y:auto;
      -webkit-overflow-scrolling:touch;
      overscroll-behavior:contain;
    }
    #screen-app.sidebar-drawer-open .sidebar{
      transform:translate3d(0,0,0);
      box-shadow:8px 0 36px rgba(0,0,0,.28);
    }
    .sidebar-mobile-toolbar{display:flex}
    .sidebar-drawer-close{display:inline-flex}
    .sidebar-menu-btn{display:inline-flex}

    .topbar{
      padding:10px 14px;
      flex-wrap:wrap;
      gap:10px;
    }
    .topbar-title{
      flex:1;
      min-width:0;
      max-width:none;
      font-size:clamp(17px,4.5vw,22px);
    }
    .topbar-search{
      order:3;
      flex:1 0 100%;
      max-width:none;
      margin-left:0;
    }
    .topbar-actions{
      margin-left:auto;
    }
    .content{padding:16px 14px}

    .kpi-grid{grid-template-columns:repeat(2,1fr)}
    .dash-grid{grid-template-columns:1fr}
    .login-left{display:none}
    .login-right{flex:1;padding:36px 22px}
  }
  @media (max-width: 640px){
    .kpi-grid{grid-template-columns:1fr}
    .topbar .btn-gold.btn-sm{
      font-size:11px;
      padding:6px 10px;
      white-space:normal;
      max-width:46vw;
      text-align:center;
      line-height:1.25;
    }
  }

  body.dealbridge-sidebar-open{
    overflow:hidden;
  }

  /* ========== DEBUG logo login (?logoDebug=1) ========== */
  html.dealbridge-logo-debug .login-brand{
    outline:3px solid #fbbf24;
    outline-offset:2px;
  }
  html.dealbridge-logo-debug .login-brand-graphic{
    outline:3px solid #38bdf8;
    outline-offset:2px;
    background:rgba(56,189,248,.1);
  }
  html.dealbridge-logo-debug .login-brand-logo{
    outline:2px dashed #f472b6;
    outline-offset:2px;
    background:rgba(244,114,182,.15) !important;
  }
  #dealbridgeLogoDebugHud{
    position:fixed;
    z-index:100000;
    bottom:10px;
    left:10px;
    right:auto;
    width:min(520px,calc(100vw - 20px));
    max-height:min(420px,46vh);
    overflow:auto;
    background:rgba(15,23,42,.96);
    color:#e2e8f0;
    font:11px/1.45 ui-monospace,Consolas,monospace;
    padding:10px 12px 12px;
    border-radius:10px;
    border:1px solid rgba(148,163,184,.45);
    box-shadow:0 12px 40px rgba(0,0,0,.45);
  }
  #dealbridgeLogoDebugHud .dealbridge-logo-debug-hud-title{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:8px;
    margin-bottom:8px;
    font-weight:700;
    color:#94a3b8;
    font-size:12px;
  }
  #dealbridgeLogoDebugHud .dealbridge-logo-debug-hud-title button{
    font:inherit;
    cursor:pointer;
    padding:4px 10px;
    border-radius:6px;
    background:#334155;
    color:#e2e8f0;
    border:1px solid #475569;
  }
  #dealbridgeLogoDebugHud pre{
    margin:0;
    white-space:pre-wrap;
    word-break:break-word;
  }
