:root{
    --ink:#0B0F19; --indigo:#5B5FEF; --violet:#8B5CF6;
    --grad: linear-gradient(135deg,#5B5FEF 0%,#8B5CF6 100%);
    --bg:#F6F7FB; --card:#FFFFFF; --line:#E7E9F3; --text:#0F1424;
    --muted:#6B7180; --muted-2:#9498A6; --green:#16A34A; --green-bg:#EAF7EE;
    --amber:#D97706; --amber-bg:#FFF3E0; --red:#DC2626;
    --radius:14px; --shadow: 0 1px 2px rgba(15,20,36,0.04), 0 8px 24px -12px rgba(15,20,36,0.10);
  }
  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{font-family:'Inter',system-ui,sans-serif;background:var(--bg);color:var(--text);-webkit-font-smoothing:antialiased;}
  h1,h2,h3,h4,.brand{font-family:'Space Grotesk',system-ui,sans-serif;}
  button{font-family:inherit;cursor:pointer;}
  input,select{font-family:inherit;}
  a{text-decoration:none;color:inherit;cursor:pointer;}
  .hidden{display:none !important;}

  /* ---------- APP SHELL ---------- */
  #screen-app{display:flex; min-height:100vh;}
  .sidebar{width:236px; background:var(--ink); color:#fff; flex-shrink:0; display:flex; flex-direction:column; padding:20px 14px; position:sticky; top:0; height:100vh;}
  .brand{display:flex;align-items:center;gap:10px;font-weight:700;font-size:19px;}
  .brand .dot{width:9px;height:9px;border-radius:3px;background:var(--grad);transform:rotate(45deg);}
  .sidebar .brand{margin:6px 8px 26px;}
  .nav-group-label{font-size:10.5px; text-transform:uppercase; letter-spacing:.1em; color:#7C81A0; font-weight:700; margin:16px 12px 8px;}
  .nav-item{display:flex; align-items:center; gap:11px; padding:9px 12px; border-radius:9px; color:#C3C6DE; font-size:13.5px; font-weight:500; margin-bottom:2px; cursor:pointer; transition:background .12s ease, color .12s ease;}
  .nav-item svg{width:17px;height:17px;flex-shrink:0;opacity:0.85;}
  .nav-item:hover{background:rgba(255,255,255,0.06); color:#fff;}
  .nav-item.active{background:rgba(91,95,239,0.22); color:#fff;}
  .nav-item.active svg{opacity:1;}
  .sidebar-foot{margin-top:0; padding:12px; border:none; background:transparent; width:100%; display:flex; align-items:center; gap:10px; text-align:left; color:inherit; border-radius:10px; cursor:pointer;}
  .sidebar-foot:hover{background:rgba(255,255,255,0.06);}
  .sidebar-foot-wrap{margin-top:auto; position:relative; border-top:1px solid rgba(255,255,255,0.08); padding-top:8px;}
  .avatar{width:32px;height:32px;border-radius:50%; background:var(--grad); color:#fff; display:flex;align-items:center;justify-content:center; font-weight:700; font-size:13px; flex-shrink:0; background-size:cover; background-position:center;}
  .avatar.has-photo{background-color:transparent;}
  .sidebar-foot .who{font-size:12.5px; font-weight:600; color:#fff; line-height:1.3; min-width:0;}
  .sidebar-foot .who strong{display:block; font-weight:600; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:150px;}
  .sidebar-foot .who span{display:block; font-weight:400; color:#9498B6; font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:150px;}
  .user-menu{position:absolute; left:8px; right:8px; bottom:calc(100% + 6px); background:#151A2A; border:1px solid rgba(255,255,255,0.1); border-radius:10px; padding:6px; box-shadow:0 12px 28px rgba(0,0,0,0.35); z-index:6;}
  .user-menu-item{width:100%; border:none; background:transparent; color:#E8EAF4; text-align:left; padding:10px 12px; border-radius:8px; font-size:13px; font-weight:600; cursor:pointer;}
  .user-menu-item:hover{background:rgba(255,255,255,0.08);}

  .profile-layout{display:grid; grid-template-columns:1fr 1fr; gap:16px; align-items:start; max-width:960px;}
  .profile-photo-card{grid-column:1 / -1;}
  .profile-photo-row{display:flex; gap:20px; align-items:center; flex-wrap:wrap;}
  .profile-photo-preview{
    width:88px; height:88px; border-radius:50%;
    background:var(--grad); color:#fff;
    display:flex; align-items:center; justify-content:center;
    font-size:28px; font-weight:700; flex-shrink:0;
    background-size:cover; background-position:center;
    border:3px solid #EEF0FF;
  }
  .profile-photo-preview.has-photo{background-color:#EEF0FF; color:transparent;}
  @media (max-width:760px){
    .profile-layout{grid-template-columns:1fr;}
    .profile-photo-card{grid-column:auto;}
  }

  .main{flex:1; min-width:0;}
  .topbar{height:64px; border-bottom:1px solid var(--line); background:#fff; display:flex; align-items:center; justify-content:space-between; padding:0 28px; position:sticky; top:0; z-index:5; gap:12px;}
  .topbar-left{display:flex; align-items:center; gap:12px; min-width:0;}
  .topbar h1{font-size:17px; font-weight:600; margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .topbar-create{width:auto; padding:9px 16px; flex-shrink:0;}
  .nav-toggle{display:none; width:40px; height:40px; border:1px solid var(--line); border-radius:10px; background:#fff; padding:10px 9px; flex-direction:column; justify-content:center; gap:5px; flex-shrink:0;}
  .nav-toggle span{display:block; height:2px; border-radius:2px; background:var(--ink); width:100%;}
  .nav-backdrop{display:none;}
  .page-content{padding:28px;}
  .page-header{display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:22px; flex-wrap:wrap; gap:12px;}
  .page-header h2{font-size:22px; margin:0 0 4px; font-weight:600;}
  .page-header p{margin:0; color:var(--muted); font-size:13.5px;}
  .btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; border:none; border-radius:9px; font-weight:600; font-size:14px; padding:11px 18px; transition:transform .1s ease, opacity .15s ease, background .15s ease;}
  .btn:active{transform:scale(0.98);}
  .btn:disabled{opacity:.45; cursor:not-allowed;}
  .btn-primary{background:var(--grad); color:#fff; box-shadow:0 6px 16px -4px rgba(91,95,239,0.45);}
  .btn-primary:hover:not(:disabled){opacity:0.92;}
  .btn-ghost{background:#F1F2F8; color:var(--text);}
  .btn-ghost:hover{background:#E7E9F3;}
  .btn-outline{background:#fff;border:1px solid var(--line); color:var(--text);}
  .btn-outline:hover{border-color:#C9CBE0;}
  .btn-danger{background:#FEF2F2; color:var(--red); border:1px solid #FECACA;}
  .btn-danger:hover{background:#FEE2E2;}
  .btn-sm{padding:7px 12px; font-size:12.5px; border-radius:7px;}
  .card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px;}

  /* Overview */
  .stat-grid{display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:24px;}
  @media (max-width:1000px){.stat-grid{grid-template-columns:repeat(2,1fr);}}
  .stat-card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:18px 20px; box-shadow:var(--shadow);}
  .stat-card .label{font-size:12px; color:var(--muted); font-weight:600; margin-bottom:10px;}
  .stat-card .value{font-size:26px; font-weight:700; font-family:'Space Grotesk';}
  .stat-card .delta{font-size:12px; font-weight:600; margin-top:6px;}
  .delta.up{color:var(--green);}
  .grid-2{display:grid; grid-template-columns:1.4fr 1fr; gap:16px;}
  @media (max-width:1000px){.grid-2{grid-template-columns:1fr;}}
  .card-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:16px;}
  .card-head h3{font-size:14.5px; margin:0; font-weight:600;}
  .card-head a{font-size:12.5px; color:var(--indigo); font-weight:600;}
  .agent-row{display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid #F1F2F7; cursor:pointer;}
  .agent-row:last-child{border-bottom:none;}
  .agent-icon{width:34px;height:34px;border-radius:9px; background:var(--grad); display:flex;align-items:center;justify-content:center;color:#fff;font-size:14px;font-weight:700; flex-shrink:0;}
  .agent-row .name{font-size:13.5px; font-weight:600;}
  .agent-row .meta{font-size:11.5px; color:var(--muted);}
  .agent-row .stat{margin-left:auto; text-align:right;}
  .agent-row .stat b{font-size:13px; display:block;}
  .agent-row .stat span{font-size:11px; color:var(--green); font-weight:600;}
  .bar-row{display:flex; align-items:center; gap:10px; margin-bottom:12px; font-size:12.5px;}
  .bar-row .bar-label{width:82px; color:var(--muted); font-weight:500;}
  .bar-track{flex:1; height:8px; border-radius:6px; background:#EEEFF6; overflow:hidden;}
  .bar-fill{height:100%; border-radius:6px; background:var(--grad);}
  .bar-row .bar-pct{width:34px; text-align:right; font-weight:600;}
  .conv-row{display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid #F1F2F7;}
  .conv-row:last-child{border-bottom:none;}
  .ch-badge{width:30px;height:30px;border-radius:8px; display:flex;align-items:center;justify-content:center; font-size:14px; flex-shrink:0; background:#F1F2F8;}
  .conv-row .name{font-size:13px; font-weight:600;}
  .conv-row .msg{font-size:11.5px; color:var(--muted);}
  .conv-row .time{margin-left:auto; font-size:11px; color:var(--muted-2); text-align:right;}
  .tag{display:inline-block; margin-top:2px; font-size:10px; font-weight:700; padding:2px 7px; border-radius:5px; background:var(--green-bg); color:var(--green);}

  /* Agents grid */
  .agents-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:16px;}
  .agent-card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:18px; box-shadow:var(--shadow); cursor:pointer; transition:border-color .15s ease, transform .1s ease;}
  .agent-card:hover{border-color:#C9CBE0; transform:translateY(-2px);}
  .agent-card .top{display:flex; align-items:center; gap:12px; margin-bottom:14px;}
  .agent-card h4{margin:0; font-size:14.5px; font-weight:600;}
  .agent-card .role{font-size:11.5px; color:var(--muted);}
  .agent-card .status{margin-left:auto; font-size:10.5px; font-weight:700; padding:3px 8px; border-radius:6px; background:var(--green-bg); color:var(--green);}
  .agent-card .chips{display:flex; flex-wrap:wrap; gap:6px; margin:12px 0;}
  .chip{font-size:10.5px; font-weight:600; padding:3px 8px; border-radius:6px; background:#F1F2F8; color:var(--muted);}
  .agent-card .foot{display:flex; gap:8px; margin-top:14px;}
  .agent-card .foot .btn{flex:1;}
  .create-card{border:1.5px dashed #C9CBE0; border-radius:var(--radius); background:#FBFBFE; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:30px; cursor:pointer; color:var(--muted); transition:border-color .15s ease, background .15s ease; min-height:180px;}
  .create-card:hover{border-color:var(--indigo); background:#F7F7FF;}
  .create-card .plus{width:40px;height:40px;border-radius:50%;background:var(--grad); color:#fff; display:flex;align-items:center;justify-content:center; font-size:20px; margin-bottom:12px;}
  .create-card b{color:var(--text); font-size:13.5px;}

  .placeholder-card{border:1px dashed var(--line); border-radius:var(--radius); padding:50px 20px; text-align:center; color:var(--muted); background:#fff;}
  .placeholder-card b{display:block; color:var(--text); font-size:14px; margin-bottom:6px;}
  .soon-pill{display:inline-block; font-size:10px; font-weight:700; padding:2px 8px; border-radius:99px; background:var(--amber-bg); color:var(--amber); margin-left:8px; vertical-align:middle;}

  /* ---------- CREATE AGENT WIZARD ---------- */
  #wizard-overlay{position:fixed; inset:0; background:rgba(11,15,25,0.55); z-index:50; display:flex; align-items:center; justify-content:center; padding:20px;}
  #wizard-overlay.hidden{display:none;}
  .wizard{width:100%; max-width:980px; max-height:92vh; overflow:auto; background:#fff; border-radius:18px; box-shadow:0 30px 60px -20px rgba(0,0,0,0.35);}
  .wizard-head{display:flex; align-items:center; justify-content:space-between; padding:20px 26px; border-bottom:1px solid var(--line);}
  .wizard-head h3{margin:0; font-size:16px; font-weight:600;}
  .wizard-close{border:none;background:#F1F2F8; width:30px;height:30px;border-radius:8px; color:var(--muted); font-size:16px; display:flex;align-items:center;justify-content:center;}
  .steps{display:flex; gap:0; padding:18px 26px 0;}
  .step{flex:1; display:flex; align-items:center; gap:8px; font-size:12px; font-weight:600; color:var(--muted-2); position:relative;}
  .step .num{width:22px;height:22px;border-radius:50%; background:#EEEFF6; color:var(--muted-2); display:flex;align-items:center;justify-content:center; font-size:11px; flex-shrink:0;}
  .step.active .num, .step.done .num{background:var(--grad); color:#fff;}
  .step.active, .step.done{color:var(--text);}
  .step:not(:last-child)::after{content:""; flex:1; height:1px; background:var(--line); margin:0 6px;}
  .wizard-body{padding:26px; display:grid; grid-template-columns:1.35fr 1fr; gap:26px;}
  @media (max-width:760px){.wizard-body{grid-template-columns:1fr;}}
  .wiz-panel{display:none;}
  .wiz-panel.active{display:block;}
  .field{margin-bottom:16px;}
  .field label{display:block;font-size:12.5px;font-weight:600;color:var(--text);margin-bottom:6px;}
  .field input, .field select{width:100%; padding:11px 13px; border:1px solid var(--line); border-radius:9px; font-size:14px; background:#fff; color:var(--text); outline:none; transition:border-color .15s ease, box-shadow .15s ease;}
  .field input:focus, .field select:focus{border-color:var(--indigo); box-shadow:0 0 0 3px rgba(91,95,239,0.12);}
  .row-2{display:grid;grid-template-columns:1fr 1fr;gap:12px;}

  .role-grid{display:grid; grid-template-columns:repeat(2,1fr); gap:12px;}
  .role-opt{border:1.5px solid var(--line); border-radius:11px; padding:16px 12px; text-align:center; cursor:pointer; transition:all .12s ease;}
  .role-opt:hover{border-color:#C9CBE0;}
  .role-opt.selected{border-color:var(--indigo); background:#F7F7FF; box-shadow:0 0 0 3px rgba(91,95,239,0.10);}
  .role-opt .ic{font-size:22px; margin-bottom:8px;}
  .role-opt .t{font-size:12.5px; font-weight:600;}

  .dropzone{border:1.5px dashed #C9CBE0; border-radius:11px; padding:26px; text-align:center; color:var(--muted); cursor:pointer; background:#FBFBFE; font-size:12.5px;}
  .dropzone:hover{border-color:var(--indigo);}
  .dropzone b{display:block; color:var(--text); font-size:13px; margin-bottom:4px;}
  .source-list{margin-top:14px; display:flex; flex-direction:column; gap:8px;}
  .source-item{display:flex; align-items:center; gap:10px; border:1px solid var(--line); border-radius:9px; padding:10px 12px; font-size:12.5px;}
  .source-item.uploaded{border-color:var(--green); background:var(--green-bg);}
  .source-item .ic{width:28px;height:28px;border-radius:7px;background:#fff; display:flex;align-items:center;justify-content:center; font-size:13px; flex-shrink:0;}
  .source-item .name{font-weight:600;}
  .source-item .sub{color:var(--green); font-size:11px; font-weight:600;}
  .source-item .rm{margin-left:auto; border:none; background:transparent; color:var(--muted-2); font-size:15px;}
  .source-item.extracting{border-color:var(--amber); background:var(--amber-bg);}
  .source-item.extracting .sub{color:var(--amber);}
  .source-item.error{border-color:#FECACA; background:#FEF2F2;}
  .source-item.error .sub{color:var(--red);}
  .url-row{display:flex; gap:8px; align-items:stretch;}
  .url-row input{flex:1; padding:11px 13px; border:1px solid var(--line); border-radius:9px; font-size:14px; outline:none; min-width:0;}
  .url-row input:focus{border-color:var(--indigo); box-shadow:0 0 0 3px rgba(91,95,239,0.12);}
  .url-row .btn{flex-shrink:0; white-space:nowrap; padding:0 16px;}
  .hint-text{font-size:12px; color:var(--muted); margin:8px 0 0; line-height:1.45;}
  .kb-answer{margin-top:14px; border:1px solid var(--line); border-radius:11px; padding:14px; background:#F8F8FC; min-height:90px; font-size:13px; line-height:1.55;}
  .kb-answer-empty{color:var(--muted-2);}
  .kb-answer .cite{margin-top:10px; font-size:11.5px; color:var(--indigo); font-weight:600;}
  .kb-answer .title{font-weight:700; margin-bottom:6px; font-size:13.5px;}
  .source-item .preview-snip{display:block; margin-top:4px; font-size:11px; color:var(--muted); font-weight:400; line-height:1.4; max-height:2.8em; overflow:hidden;}

  /* Embed / Channels */
  .embed-code{width:100%; padding:12px 14px; border:1px solid var(--line); border-radius:9px; font-size:12.5px; font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; line-height:1.5; background:#F8F8FC; color:var(--text); resize:vertical; outline:none;}
  .embed-code:focus{border-color:var(--indigo); box-shadow:0 0 0 3px rgba(91,95,239,0.12);}
  .embed-actions{display:flex; flex-wrap:wrap; gap:8px; margin-top:12px;}
  .embed-meta{margin-top:14px; font-size:12.5px; color:var(--muted); line-height:1.5;}
  .embed-meta code{font-size:11.5px; background:#F1F2F8; padding:2px 6px; border-radius:5px;}
  .widget-preview-frame{position:relative; height:340px; border:1px solid var(--line); border-radius:13px; background:linear-gradient(180deg,#EEF0F8 0%,#F7F8FC 100%); overflow:hidden;}
  .wp-site{padding:22px 20px;}
  .wp-bar{height:12px; width:38%; border-radius:6px; background:#D8DBE8; margin-bottom:16px;}
  .wp-lines span{display:block; height:8px; border-radius:4px; background:#E4E6F0; margin-bottom:10px;}
  .wp-lines span:nth-child(1){width:92%;} .wp-lines span:nth-child(2){width:78%;} .wp-lines span:nth-child(3){width:64%;}
  .wp-bubble{position:absolute; right:18px; bottom:18px; width:56px; height:56px; border-radius:50%; border:none; background:var(--grad); color:#fff; font-size:22px; box-shadow:0 10px 24px -6px rgba(91,95,239,0.55); cursor:pointer; z-index:2;}
  .wp-chat{position:absolute; right:18px; bottom:86px; width:min(300px,calc(100% - 36px)); height:260px; background:#fff; border-radius:14px; border:1px solid var(--line); box-shadow:0 18px 40px -16px rgba(15,20,36,0.35); display:flex; flex-direction:column; overflow:hidden; z-index:3;}
  .wp-chat.hidden{display:none;}
  .wp-chat-head{background:var(--ink); color:#fff; padding:12px 14px; display:flex; align-items:center; justify-content:space-between;}
  .wp-chat-title{font-size:13px; font-weight:700;}
  .wp-chat-sub{font-size:11px; color:#AEB1C6;}
  .wp-chat-close{border:none; background:rgba(255,255,255,0.12); color:#fff; width:24px; height:24px; border-radius:6px; cursor:pointer;}
  .wp-chat-body{flex:1; padding:12px; background:#F8F8FC; overflow:auto; display:flex; flex-direction:column; gap:8px;}
  .wp-chat-foot{display:flex; gap:6px; padding:10px; border-top:1px solid var(--line); background:#fff; align-items:center;}
  .wp-chat-foot input{flex:1; border:1px solid var(--line); border-radius:8px; padding:8px 10px; font-size:12.5px; outline:none; min-width:0;}
  .wp-mic-btn{
    width:34px; height:34px; flex-shrink:0; border:1px solid var(--line); border-radius:8px;
    background:#F6F7FB; cursor:pointer; font-size:15px; line-height:1;
  }
  .wp-mic-btn:hover{background:#EEF0FF; border-color:#C9CBE0;}
  .wp-mic-btn.recording{background:#FEE2E2; border-color:#FECACA; animation:vnPulse 1s ease infinite;}
  .wp-voice-bubble{
    display:flex; align-items:center; gap:8px; font-size:12.5px;
  }
  .wp-voice-bubble audio{max-width:140px; height:28px;}
  .omni-voice-msg{display:flex; flex-direction:column; gap:8px; font-size:13px; line-height:1.4;}
  .omni-voice-audio{width:min(220px,100%); height:32px;}
  .omni-bubble.customer .omni-voice-audio{filter:none;}
  .omni-voice-title{font-weight:600; font-size:12.5px;}
  .omni-voice-tx{font-size:12.5px; opacity:.95;}
  .omni-voice-missing{font-size:11.5px; color:var(--muted);}
  .omni-bubble.agent .omni-voice-missing{color:rgba(255,255,255,.85);}
  .vn-thread-pill{
    display:inline-block; margin-left:6px; padding:1px 6px; border-radius:999px;
    font-size:10px; font-weight:700; vertical-align:middle;
    background:#EEF0FF; color:var(--indigo);
  }
  .omni-thread.voice-note .ch-badge{background:#EEF0FF;}
  .omni-chat-head .vn-thread-pill{font-size:10px;}

  .vn-settings{display:flex; flex-direction:column; gap:12px; margin-top:4px;}
  .vn-row{gap:10px;}
  .vn-row span{font-weight:500; color:var(--text);}
  .vn-max-field{margin:0; max-width:220px;}
  .vn-demo{
    margin-top:16px; padding-top:14px; border-top:1px solid var(--line);
  }
  .vn-demo.disabled{opacity:.55;}
  .vn-demo-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; font-size:12.5px; color:var(--muted);}
  .vn-timer{font-variant-numeric:tabular-nums; font-weight:600; color:var(--text);}
  #vn-rec-btn.recording{background:#DC2626; border-color:#DC2626;}
  @keyframes vnPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}

  /* Live preview panel (persistent, reused) */
  .preview-panel{position:sticky; top:0;}
  .preview-panel-label{font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom:10px;}
  .preview-chat{border:1px solid var(--line); border-radius:13px; overflow:hidden; background:#fff;}
  .preview-chat .ph{background:var(--ink); color:#fff; padding:11px 14px; font-size:12px; display:flex; align-items:center; gap:8px;}
  .preview-chat .ph .role-name{font-weight:700;}
  .preview-chat .pb{padding:14px; background:#F8F8FC; min-height:180px; display:flex; flex-direction:column; gap:8px;}
  .bubble{max-width:82%; padding:8px 12px; border-radius:10px; font-size:12.5px; line-height:1.45;}
  .bubble.user{align-self:flex-end; background:var(--grad); color:#fff; border-bottom-right-radius:3px;}
  .bubble.bot{align-self:flex-start; background:#fff; border:1px solid var(--line); border-bottom-left-radius:3px;}
  .preview-meta{display:flex; gap:8px; flex-wrap:wrap; margin-top:12px;}

  /* Wizard / edit: call agent live preview */
  .preview-call{border:1px solid #1a1f2e; border-radius:13px; overflow:hidden; background:var(--ink); color:#fff;}
  .preview-call.hidden{display:none !important;}
  .preview-chat.hidden{display:none !important;}
  .pv-call-inner{padding:28px 18px 22px; text-align:center;}
  .pv-call-pulse{width:64px;height:64px;border-radius:50%; background:var(--grad); margin:0 auto 14px; display:flex; align-items:center; justify-content:center; font-size:24px; box-shadow:0 0 0 0 rgba(91,95,239,0.5); animation:callPulse 1.6s infinite;}
  .pv-call-pulse::before{content:"📞";}
  .pv-call-dir{font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:#AEB1C6; margin-bottom:8px;}
  .pv-call-number{font-size:18px; font-weight:700; font-family:'Space Grotesk',system-ui,sans-serif; margin-bottom:6px;}
  .pv-call-agent{font-size:12px; color:#C3C6DE; margin-bottom:10px;}
  .pv-call-status{font-size:12.5px; font-weight:600; color:#9EA3FF; margin-bottom:14px;}
  .pv-call-transcript{font-size:12.5px; line-height:1.5; color:#C3C6DE; min-height:48px; text-align:left; background:rgba(255,255,255,0.06); border-radius:10px; padding:10px 12px; margin-bottom:14px;}
  .pv-call-actions{display:flex; gap:10px; justify-content:center;}
  .pv-call-pill{border-radius:99px; padding:8px 16px; font-weight:700; font-size:12px;}
  .pv-call-pill.decline{background:#DC2626; color:#fff;}
  .pv-call-pill.accept{background:#16A34A; color:#fff;}
  .pv-call-pill.hangup{background:#374151; color:#fff;}
  .demo-call-preview{background:var(--ink); color:#fff; border-radius:14px; padding:28px 20px 22px; text-align:center;}
  .demo-call-preview .pv-call-transcript{white-space:pre-wrap;}
  .preview-call.outbound .pv-call-actions .decline,
  .preview-call.outbound .pv-call-actions .accept{display:none;}
  .preview-call.inbound .pv-call-pill.hangup{display:none;}

  .wizard-foot{display:flex; align-items:center; justify-content:space-between; padding:18px 26px; border-top:1px solid var(--line);}
  .wizard-foot .right-btns{display:flex; gap:10px;}

  /* Try Demo modal */
  #demo-overlay{position:fixed; inset:0; background:rgba(11,15,25,0.6); z-index:70; display:flex; align-items:center; justify-content:center; padding:20px;}
  #demo-overlay.hidden{display:none;}
  .demo-modal{width:100%; max-width:420px; background:#fff; border-radius:18px; overflow:hidden; box-shadow:0 30px 60px -20px rgba(0,0,0,0.4);}
  .demo-modal .ph{background:var(--ink); color:#fff; padding:16px 20px; display:flex; align-items:center; justify-content:space-between;}
  .demo-modal .ph .t{font-size:13.5px; font-weight:700;}
  .demo-modal .ph .s{font-size:11px; color:#AEB1C6;}
  .demo-modal .close{background:rgba(255,255,255,0.12); border:none; color:#fff; width:26px;height:26px;border-radius:7px;}
  .demo-body{padding:18px 20px; min-height:220px; display:flex; flex-direction:column; gap:10px; background:#F8F8FC;}
  .demo-typing{align-self:flex-start; background:#fff; border:1px solid var(--line); border-radius:10px; padding:9px 13px; display:flex; gap:4px;}
  .demo-typing span{width:6px;height:6px;border-radius:50%; background:var(--muted-2); display:inline-block; animation:blink 1.2s infinite;}
  .demo-typing span:nth-child(2){animation-delay:.2s;} .demo-typing span:nth-child(3){animation-delay:.4s;}
  @keyframes blink{0%,80%,100%{opacity:.25;} 40%{opacity:1;}}
  .demo-foot{padding:14px 20px; border-top:1px solid var(--line); text-align:center;}

  /* ---------- AGENT DETAIL PAGE ---------- */
  .detail-header{display:flex; align-items:center; gap:16px; margin-bottom:22px; flex-wrap:wrap;}
  .back-link{display:flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; color:var(--muted); margin-bottom:14px;}
  .back-link:hover{color:var(--text);}
  .detail-avatar{width:52px;height:52px;border-radius:14px; background:var(--grad); color:#fff; display:flex;align-items:center;justify-content:center; font-size:20px; font-weight:700;}
  .detail-header h2{margin:0 0 3px; font-size:20px;}
  .detail-header .sub{font-size:12.5px; color:var(--muted);}
  .detail-tabs{display:flex; gap:6px; border-bottom:1px solid var(--line); margin-bottom:22px; flex-wrap:wrap;}
  .detail-tab{padding:10px 16px; font-size:13px; font-weight:600; color:var(--muted); border:none; background:transparent; border-bottom:2px solid transparent; margin-bottom:-1px;}
  .detail-tab.active{color:var(--indigo); border-bottom-color:var(--indigo);}
  .detail-tab-panel{display:none;}
  .detail-tab-panel.active{display:block;}

  .toast{position:fixed; bottom:24px; right:24px; background:var(--ink); color:#fff; padding:14px 18px; border-radius:11px; font-size:13px; font-weight:600; box-shadow:0 10px 30px rgba(0,0,0,0.25); display:flex; align-items:center; gap:10px; z-index:99; transform:translateY(140%); transition:transform .25s ease;}
  .toast.show{transform:translateY(0);}
  .toast .ic{width:20px;height:20px;border-radius:50%; background:var(--green); display:flex;align-items:center;justify-content:center; font-size:11px; flex-shrink:0;}

  /* Demo WhatsApp + Omni inbox */
  .demo-banner{background:#FFF8EB; border:1px solid #F3E0B8; color:#8A5A00; font-size:12.5px; font-weight:600; padding:10px 14px; border-radius:10px; margin-bottom:16px;}
  .wa-connect-card{border-color:#C8EBD8;}
  .wa-connect-top{display:flex; align-items:flex-start; gap:14px;}
  .wa-connect-top h3{margin:0; font-size:15px; font-weight:600;}
  .wa-logo{width:42px;height:42px;border-radius:12px; background:#25D366; color:#fff; display:flex;align-items:center;justify-content:center; font-weight:800; font-size:13px; flex-shrink:0;}
  .wa-status{margin-left:auto; font-size:11px; font-weight:700; padding:4px 10px; border-radius:99px; background:#F1F2F8; color:var(--muted); white-space:nowrap;}
  .wa-status.on{background:#E8F8EF; color:#128C7E;}

  .omni-shell{display:grid; grid-template-columns:320px 1fr; gap:0; border:1px solid var(--line); border-radius:var(--radius); background:#fff; box-shadow:var(--shadow); min-height:520px; overflow:hidden;}
  @media (max-width:900px){.omni-shell{grid-template-columns:1fr; min-height:auto;}}
  .omni-sidebar{border-right:1px solid var(--line); display:flex; flex-direction:column; background:#FAFBFE; min-height:520px;}
  .omni-filters{display:flex; flex-wrap:wrap; gap:6px; padding:12px; border-bottom:1px solid var(--line);}
  .omni-filter{border:1px solid var(--line); background:#fff; border-radius:99px; padding:5px 10px; font-size:11.5px; font-weight:600; color:var(--muted); cursor:pointer;}
  .omni-filter.active{background:#128C7E; border-color:#128C7E; color:#fff;}
  .omni-filter[data-filter="all"].active{background:var(--ink); border-color:var(--ink);}
  .omni-filter[data-filter="Web Chat"].active{background:var(--indigo); border-color:var(--indigo);}
  .omni-thread-list{flex:1; overflow:auto;}
  .omni-thread{display:flex; gap:10px; padding:12px 14px; border-bottom:1px solid #F1F2F7; cursor:pointer; transition:background .12s ease;}
  .omni-thread:hover,.omni-thread.active{background:#fff;}
  .omni-thread.active{box-shadow:inset 3px 0 0 var(--indigo);}
  .omni-thread.wa.active{box-shadow:inset 3px 0 0 #25D366;}
  .omni-thread .ch-badge{width:34px;height:34px;border-radius:10px;}
  .omni-thread .name{font-size:13px; font-weight:600;}
  .omni-thread .msg{font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:180px;}
  .omni-thread .meta-right{margin-left:auto; text-align:right; flex-shrink:0;}
  .omni-thread .time{font-size:10.5px; color:var(--muted-2);}
  .omni-thread .ch-tag{display:inline-block; margin-top:4px; font-size:9.5px; font-weight:700; padding:2px 6px; border-radius:4px; background:#F1F2F8; color:var(--muted);}
  .omni-thread .ch-tag.wa{background:#E8F8EF; color:#128C7E;}
  .omni-thread .ch-tag.web{background:#EEF0FF; color:var(--indigo);}
  .omni-chat{display:flex; flex-direction:column; min-height:520px; background:#fff;}
  .omni-empty{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:40px; color:var(--muted); gap:8px;}
  .omni-empty b{color:var(--text); font-size:14px;}
  .omni-empty span{font-size:12.5px; max-width:320px; line-height:1.5;}
  .omni-active{flex:1; display:flex; flex-direction:column; min-height:0;}
  .omni-active.hidden{display:none;}
  .omni-chat-head{padding:14px 18px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:12px;}
  .omni-chat-head .title{font-size:14px; font-weight:700;}
  .omni-chat-head .sub{font-size:11.5px; color:var(--muted);}
  .omni-back{display:none; border:1px solid var(--line); background:#fff; width:34px; height:34px; border-radius:9px; font-size:16px; font-weight:700; color:var(--text); flex-shrink:0; align-items:center; justify-content:center; padding:0;}
  .omni-chat-body{flex:1; overflow:auto; padding:18px; display:flex; flex-direction:column; gap:8px; background:#F8F8FC; min-height:280px;}
  .omni-chat-body.wa-theme{background:#E5DDD5; background-image:radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px); background-size:18px 18px;}
  .omni-bubble{max-width:75%; padding:9px 12px; border-radius:10px; font-size:13px; line-height:1.45; white-space:pre-wrap;}
  .omni-bubble.customer{align-self:flex-start; background:#fff; border:1px solid var(--line); border-bottom-left-radius:3px;}
  .omni-bubble.agent{align-self:flex-end; background:var(--grad); color:#fff; border-bottom-right-radius:3px;}
  .omni-chat-body.wa-theme .omni-bubble.customer{border:none; box-shadow:0 1px 1px rgba(0,0,0,0.06);}
  .omni-chat-body.wa-theme .omni-bubble.agent{background:#DCF8C6; color:#0F1424;}
  .omni-chat-foot{display:flex; gap:8px; padding:12px 14px; border-top:1px solid var(--line); background:#fff;}
  .omni-chat-foot input{flex:1; border:1px solid var(--line); border-radius:9px; padding:10px 12px; font-size:13.5px; outline:none; min-width:0;}
  .omni-chat-foot input:focus{border-color:var(--indigo); box-shadow:0 0 0 3px rgba(91,95,239,0.12);}
  .omni-agent-chip{font-size:10.5px; font-weight:700; padding:3px 8px; border-radius:6px; background:#F1F2F8; color:var(--muted); margin-left:auto;}
  .omni-filter[data-filter="Phone"].active{background:#0B0F19; border-color:#0B0F19;}
  .omni-thread .ch-tag.phone{background:#EEF0FF; color:var(--indigo);}
  .omni-thread.phone.active{box-shadow:inset 3px 0 0 #5B5FEF;}

  /* AI Voice First demo */
  .voice-enable-bar{display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;}
  .voice-enable-left{display:flex; align-items:flex-start; gap:14px;}
  .voice-enable-left h3{margin:0; font-size:15px; font-weight:600;}
  .voice-logo{width:42px;height:42px;border-radius:12px; background:var(--grad); color:#fff; display:flex;align-items:center;justify-content:center; font-size:18px; flex-shrink:0;}
  .voice-enable-actions{display:flex; align-items:center; gap:12px; flex-wrap:wrap;}
  .voice-toggle{display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; color:var(--text); cursor:pointer;}
  .voice-toggle input{width:15px;height:15px; accent-color:var(--indigo);}
  .voice-feature-list{margin:0; padding-left:18px; color:var(--text); font-size:13px; line-height:1.9;}
  .voice-feature-list li::marker{color:var(--indigo);}
  .campaign-grid{display:grid; grid-template-columns:repeat(5,1fr); gap:12px;}
  @media (max-width:1000px){.campaign-grid{grid-template-columns:repeat(2,1fr);}}
  .campaign-stat{background:#F8F8FC; border:1px solid var(--line); border-radius:11px; padding:12px 14px;}
  .campaign-stat .cl{display:block; font-size:11px; font-weight:600; color:var(--muted); margin-bottom:6px;}
  .campaign-stat b{font-size:14px; font-weight:700;}
  .campaign-stat .pct{font-size:12px; font-weight:600; color:var(--green);}

  #call-overlay{position:fixed; inset:0; background:rgba(11,15,25,0.72); z-index:80; display:flex; align-items:center; justify-content:center; padding:20px;}
  #call-overlay.hidden{display:none;}
  .call-modal{width:100%; max-width:360px; background:var(--ink); color:#fff; border-radius:22px; padding:36px 28px 28px; text-align:center; position:relative; overflow:hidden; box-shadow:0 30px 60px -20px rgba(0,0,0,0.5);}
  .call-pulse{width:78px;height:78px;border-radius:50%; background:var(--grad); margin:0 auto 18px; display:flex; align-items:center; justify-content:center; font-size:30px; box-shadow:0 0 0 0 rgba(91,95,239,0.5); animation:callPulse 1.6s infinite;}
  .call-pulse::before{content:"📞";}
  @keyframes callPulse{0%{box-shadow:0 0 0 0 rgba(91,95,239,0.45);} 70%{box-shadow:0 0 0 22px rgba(91,95,239,0);} 100%{box-shadow:0 0 0 0 rgba(91,95,239,0);}}
  .call-label{font-size:12px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:#AEB1C6; margin-bottom:8px;}
  .call-number{font-size:22px; font-weight:700; font-family:'Space Grotesk',system-ui,sans-serif; margin-bottom:6px;}
  .call-agent{font-size:13px; color:#C3C6DE; margin-bottom:22px;}
  .call-actions{display:flex; gap:12px; justify-content:center;}
  .call-btn{border:none; border-radius:99px; padding:12px 22px; font-weight:700; font-size:13.5px; cursor:pointer;}
  .call-btn.decline{background:#DC2626; color:#fff;}
  .call-btn.accept{background:#16A34A; color:#fff;}
  .call-live.hidden{display:none;}
  .call-timer{font-size:28px; font-weight:700; font-family:'Space Grotesk',system-ui,sans-serif; margin-bottom:12px;}
  .call-transcript{font-size:13px; line-height:1.5; color:#C3C6DE; min-height:54px; margin:0 0 16px;}

  /* AI Voice page (screenshot layout) */
  .voice-page-header{align-items:flex-end;}
  .voice-agent-field{margin:0; min-width:240px; max-width:280px;}
  .voice-create-card{margin-bottom:16px;}
  .voice-role-grid{grid-template-columns:repeat(2,minmax(0,280px)); max-width:580px;}
  .voice-page-title{display:flex; align-items:center; gap:12px; margin:0 0 4px;}
  .voice-step-badge{width:28px;height:28px;border-radius:8px; background:var(--grad); color:#fff; display:inline-flex; align-items:center; justify-content:center; font-size:14px; font-weight:700; flex-shrink:0;}

  .voice-first-layout{
    display:grid;
    grid-template-columns:minmax(0,1.15fr) 180px minmax(0,1.15fr) minmax(260px,320px);
    gap:24px 28px;
    align-items:center;
    margin-top:8px;
    max-width:1180px;
  }
  .voice-col{
    display:flex;
    flex-direction:column;
    min-width:0;
    align-self:stretch;
    padding-top:8px;
  }
  .voice-col-body{flex:1;}
  .voice-col h3,
  .voice-campaign-card h3{
    margin:0 0 18px;
    font-size:20px;
    font-weight:700;
    color:var(--text);
    letter-spacing:-0.01em;
  }
  .voice-check-list{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:12px;}
  .voice-check-list li{
    position:relative;
    padding-left:30px;
    font-size:14px;
    color:var(--text);
    line-height:1.45;
    font-weight:500;
  }
  .voice-check-list li::before{
    content:"";
    position:absolute;
    left:0;
    top:1px;
    width:18px;
    height:18px;
    border-radius:50%;
    background:#16A34A;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M2.5 6.2l2.3 2.3 4.7-4.8'/%3E%3C/svg%3E");
    background-repeat:no-repeat;
    background-position:center;
    background-size:10px;
  }
  .voice-col-btn{
    align-self:flex-start;
    margin-top:22px;
    padding:11px 18px;
    font-size:13.5px;
    border-radius:10px;
  }
  .voice-phone-wrap{
    display:flex;
    justify-content:center;
    align-items:center;
    align-self:center;
    min-height:200px;
    padding:44px 8px;
  }
  .voice-phone-orb{
    position:relative;
    width:88px;
    height:88px;
    display:flex;
    align-items:center;
    justify-content:center;
  }
  .voice-phone-orb .ring{
    position:absolute;
    border-radius:50%;
    border:1.5px solid rgba(91,95,239,0.18);
    pointer-events:none;
  }
  .voice-phone-orb .r1{inset:-16px;}
  .voice-phone-orb .r2{inset:-32px; opacity:.65;}
  .voice-phone-orb .r3{inset:-50px; opacity:.35;}
  .voice-phone-core{
    width:88px;
    height:88px;
    border-radius:50%;
    background:var(--grad);
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    box-shadow:0 16px 32px -12px rgba(91,95,239,0.55);
    position:relative;
    z-index:1;
  }
  .voice-campaign-card{
    background:#fff;
    border:1px solid var(--line);
    border-radius:18px;
    box-shadow:0 8px 28px -14px rgba(15,20,36,0.18);
    padding:24px 22px 22px;
    display:flex;
    flex-direction:column;
    align-self:stretch;
  }
  .voice-campaign-rows{display:flex; flex-direction:column; margin-bottom:4px;}
  .vcr{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    padding:13px 0;
    border-bottom:1px solid #EEF0F5;
    font-size:13.5px;
  }
  .vcr:first-child{padding-top:0;}
  .voice-campaign-rows .vcr:last-child{border-bottom:none;}
  .vcr span{color:var(--muted); font-weight:500;}
  .vcr b{color:var(--text); font-weight:700; text-align:right;}
  .voice-camp-type-field{margin:8px 0 0;}
  .voice-campaign-actions{display:flex; flex-direction:column; gap:8px; margin-top:16px;}
  .voice-campaign-btn{
    width:100%;
    margin-top:0;
    padding:14px 18px;
    border-radius:12px;
    font-size:14.5px;
    font-weight:700;
  }

  @media (max-width:1200px){
    .voice-first-layout{
      grid-template-columns:minmax(0,1fr) minmax(0,1fr);
      grid-template-areas:
        "inbound outbound"
        "phone phone"
        "campaign campaign";
      gap:28px;
      max-width:none;
      align-items:start;
    }
    .voice-col-inbound{grid-area:inbound;}
    .voice-col-outbound{grid-area:outbound;}
    .voice-phone-wrap{grid-area:phone; min-height:140px; padding:20px;}
    .voice-campaign-card{grid-area:campaign; max-width:480px;}
  }
  @media (max-width:760px){
    .voice-page-header{flex-direction:column; align-items:stretch;}
    .voice-agent-field{max-width:none; width:100%;}
    .voice-role-grid{grid-template-columns:1fr; max-width:none;}
    .voice-first-layout{
      grid-template-columns:1fr;
      grid-template-areas:
        "inbound"
        "phone"
        "outbound"
        "campaign";
      gap:24px;
    }
    .voice-campaign-card{max-width:none;}
    .voice-col-btn{width:100%; justify-content:center;}
  }

  /* ---------- MOBILE / TABLET SHELL ---------- */
  @media (max-width:900px){
    .nav-toggle{display:inline-flex;}
    .nav-backdrop{
      display:block;
      position:fixed; inset:0;
      background:rgba(11,15,25,0.45);
      z-index:40;
      opacity:0; pointer-events:none;
      transition:opacity .2s ease;
    }
    body.nav-open{overflow:hidden;}
    body.nav-open .nav-backdrop{opacity:1; pointer-events:auto;}
    .sidebar{
      position:fixed; left:0; top:0; bottom:0;
      z-index:45; height:100vh; height:100dvh;
      transform:translateX(-105%);
      transition:transform .22s ease;
      box-shadow:none;
      overflow-y:auto;
    }
    body.nav-open .sidebar{
      transform:translateX(0);
      box-shadow:12px 0 40px -12px rgba(0,0,0,0.45);
    }
    .topbar{padding:0 14px; height:58px;}
    .topbar-create{padding:8px 12px; font-size:13px;}
    .page-content{padding:16px 14px 28px;}
    .page-header h2{font-size:18px;}
    .stat-grid{grid-template-columns:1fr 1fr; gap:10px;}
    .stat-card{padding:14px;}
    .stat-card .value{font-size:22px;}
    .agents-grid{grid-template-columns:1fr;}
    .agent-card .foot{flex-wrap:wrap;}
    .detail-header{gap:12px;}
    .detail-header h2{font-size:17px;}
    .detail-tabs{gap:2px; overflow-x:auto; flex-wrap:nowrap; -webkit-overflow-scrolling:touch; scrollbar-width:none;}
    .detail-tabs::-webkit-scrollbar{display:none;}
    .detail-tab{padding:10px 12px; white-space:nowrap; flex-shrink:0;}
    .voice-enable-bar{flex-direction:column; align-items:flex-start;}
    .wa-connect-top{flex-wrap:wrap;}
    .omni-shell{min-height:min(70vh, 560px); position:relative;}
    .omni-sidebar{min-height:min(70vh, 560px); border-right:none;}
    .omni-chat{
      display:none;
      position:absolute; inset:0;
      min-height:0;
      background:#fff;
      z-index:2;
    }
    .omni-shell.thread-open .omni-chat{display:flex;}
    .omni-shell.thread-open .omni-sidebar{visibility:hidden;}
    .omni-back{display:inline-flex;}
    .omni-agent-chip{max-width:90px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
    .omni-thread .msg{max-width:120px;}
    .toast{left:14px; right:14px; bottom:14px;}
    #wizard-overlay{padding:10px; align-items:flex-start;}
    .wizard{max-height:96vh; border-radius:14px; margin-top:4px;}
    .wizard-head,.wizard-foot{padding:14px 16px;}
    .steps{padding:14px 16px 0; flex-wrap:wrap; gap:8px;}
    .step{flex:1 1 40%; font-size:11px;}
    .step:not(:last-child)::after{display:none;}
    .wizard-body{padding:16px; gap:16px;}
    .wizard-foot{flex-wrap:wrap; gap:10px;}
    .wizard-foot .right-btns{width:100%; justify-content:flex-end; flex-wrap:wrap;}
    .preview-panel{position:static;}
    .campaign-grid{grid-template-columns:1fr 1fr;}
  }

  @media (max-width:600px){
    .stat-grid{grid-template-columns:1fr;}
    .row-2{grid-template-columns:1fr;}
    .role-grid{grid-template-columns:1fr;}
    .campaign-grid{grid-template-columns:1fr;}
    .topbar-create{padding:8px 12px; font-size:0; gap:0;}
    .topbar-create::before{content:"+ Create"; font-size:12.5px; font-weight:700; line-height:1;}
    .page-header .btn{width:100%;}
    .url-row{flex-direction:column;}
    .url-row .btn{width:100%;}
    .agent-row .stat{display:none;}
    .bar-row .bar-label{width:64px; font-size:11px;}
    .embed-actions{flex-direction:column;}
    .embed-actions .btn,
    .embed-actions a.btn{width:100%; justify-content:center;}
    .voice-enable-actions{width:100%;}
    .call-modal{padding:28px 18px 22px;}
  }

  @media (max-width:400px){
    .topbar h1{font-size:15px;}
    .page-content{padding:12px 10px 24px;}
  }

  /* ---------- AUTH PAGES (glass) ---------- */
  .auth-body{
    position:relative;
    isolation:isolate;
    min-height:100vh;
    min-height:100dvh;
    overflow-x:hidden;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    background:
      radial-gradient(ellipse 90% 70% at 0% 0%, rgba(91,95,239,0.45), transparent 55%),
      radial-gradient(ellipse 70% 55% at 100% 10%, rgba(139,92,246,0.35), transparent 50%),
      radial-gradient(ellipse 60% 50% at 50% 100%, rgba(56,189,248,0.18), transparent 55%),
      linear-gradient(160deg, #070A14 0%, #0B0F19 45%, #12182A 100%);
    color:#E8EAF4;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:32px 18px;
    padding:
      max(24px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(28px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .auth-body::before,
  .auth-body::after{
    content:"";
    position:fixed;
    border-radius:50%;
    filter:blur(40px);
    pointer-events:none;
    z-index:0;
  }
  .auth-body::before{
    width:340px; height:340px;
    top:-80px; left:-60px;
    background:rgba(91,95,239,0.35);
    animation:authFloat 12s ease-in-out infinite;
  }
  .auth-body::after{
    width:280px; height:280px;
    bottom:-60px; right:-40px;
    background:rgba(139,92,246,0.28);
    animation:authFloat 14s ease-in-out infinite reverse;
  }
  @keyframes authFloat{
    0%,100%{ transform:translate(0,0) scale(1); }
    50%{ transform:translate(18px,-22px) scale(1.06); }
  }
  .auth-shell{
    position:relative;
    z-index:1;
    width:100%;
    max-width:960px;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:40px;
    align-items:center;
  }
  .auth-brand .brand{
    font-size:22px;
    margin-bottom:20px;
    color:#fff;
  }
  .auth-brand .brand .dot{
    box-shadow:0 0 18px rgba(91,95,239,0.7);
  }
  .auth-brand h1{
    margin:0 0 12px;
    font-size:clamp(28px, 4vw, 38px);
    font-weight:700;
    letter-spacing:-0.03em;
    line-height:1.12;
    color:#fff;
    text-shadow:0 10px 40px rgba(0,0,0,0.35);
  }
  .auth-brand p{
    margin:0;
    color:rgba(232,234,244,0.72);
    font-size:15px;
    line-height:1.6;
    max-width:360px;
  }
  .auth-card.card,
  .auth-card{
    position:relative;
    padding:32px 30px;
    border-radius:22px;
    background:linear-gradient(145deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.06) 100%);
    border:1px solid rgba(255,255,255,0.22);
    box-shadow:
      0 1px 0 rgba(255,255,255,0.2) inset,
      0 30px 60px -20px rgba(0,0,0,0.55),
      0 0 0 1px rgba(255,255,255,0.04);
    backdrop-filter:blur(22px) saturate(160%);
    -webkit-backdrop-filter:blur(22px) saturate(160%);
    overflow:hidden;
  }
  .auth-card::before{
    content:"";
    position:absolute;
    inset:0 0 auto 0;
    height:1px;
    background:linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
    pointer-events:none;
  }
  .auth-card h2{
    margin:0 0 6px;
    font-size:22px;
    font-weight:700;
    color:#fff;
    letter-spacing:-0.02em;
  }
  .auth-sub{
    margin:0 0 22px;
    color:rgba(232,234,244,0.65);
    font-size:13px;
    line-height:1.5;
  }
  .auth-card .field label{
    color:rgba(232,234,244,0.82);
  }
  .auth-card .field input,
  .auth-card .field select{
    background:rgba(8,12,24,0.35);
    border:1px solid rgba(255,255,255,0.16);
    color:#fff;
    border-radius:12px;
    padding:12px 14px;
    font-size:16px; /* prevents iOS zoom on focus */
    min-height:48px;
    transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;
  }
  .auth-card .field input::placeholder{
    color:rgba(232,234,244,0.38);
  }
  .auth-card .field input:focus,
  .auth-card .field select:focus{
    border-color:rgba(91,95,239,0.85);
    background:rgba(8,12,24,0.5);
    box-shadow:0 0 0 3px rgba(91,95,239,0.28);
  }
  .auth-submit{
    width:100%;
    margin-top:8px;
    padding:14px 18px;
    min-height:48px;
    border-radius:12px;
    font-size:15px;
    box-shadow:0 10px 28px -8px rgba(91,95,239,0.65);
  }
  .auth-submit:hover:not(:disabled){
    opacity:1;
    filter:brightness(1.05);
  }
  .auth-error{
    margin:0 0 12px;
    padding:10px 12px;
    border-radius:10px;
    background:rgba(220,38,38,0.18);
    border:1px solid rgba(252,165,165,0.35);
    color:#FECACA;
    font-size:12.5px;
    font-weight:600;
  }
  .auth-switch{
    margin:20px 0 0;
    text-align:center;
    font-size:13px;
    color:rgba(232,234,244,0.62);
  }
  .auth-switch a{
    color:#C4C7FF;
    font-weight:600;
  }
  .auth-switch a:hover{text-decoration:underline; color:#fff;}
  .field-label-row{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:6px;}
  .field-label-row label{margin-bottom:0;}
  .forgot-link{
    font-size:12px;
    font-weight:600;
    color:#C4C7FF;
    white-space:nowrap;
  }
  .forgot-link:hover{text-decoration:underline; color:#fff;}
  .password-wrap{position:relative; display:flex; align-items:center;}
  .password-wrap input{width:100%; padding-right:46px;}
  .auth-card .password-toggle{
    position:absolute; right:6px; top:50%; transform:translateY(-50%);
    width:34px; height:34px; padding:0;
    border:none; background:transparent; color:rgba(232,234,244,0.55);
    border-radius:8px; cursor:pointer;
    display:inline-flex; align-items:center; justify-content:center;
  }
  .password-toggle svg{display:block;}
  .auth-card .password-toggle:hover{
    background:rgba(255,255,255,0.1);
    color:#fff;
  }
  @media (max-width:900px){
    .auth-shell{
      grid-template-columns:1fr;
      gap:24px;
      max-width:460px;
    }
    .auth-brand{text-align:center;}
    .auth-brand p{max-width:none; margin:0 auto;}
    .auth-brand .brand{justify-content:center;}
  }

  @media (max-width:760px){
    .auth-body{
      align-items:flex-start;
      padding-top:max(20px, env(safe-area-inset-top));
    }
    .auth-shell{
      gap:18px;
      max-width:440px;
      width:100%;
      margin:0 auto;
    }
    .auth-brand h1{
      font-size:clamp(24px, 7vw, 30px);
      margin-bottom:8px;
    }
    .auth-brand p{
      font-size:13.5px;
      line-height:1.5;
    }
    .auth-brand .brand{
      font-size:19px;
      margin-bottom:12px;
    }
    .auth-card{
      padding:22px 18px;
      border-radius:18px;
      width:100%;
    }
    .auth-card h2{font-size:20px;}
    .auth-sub{font-size:12.5px; margin-bottom:18px;}
    .auth-card .field{margin-bottom:14px;}
    .field-label-row{
      flex-wrap:wrap;
      gap:4px 10px;
    }
    .forgot-link{
      font-size:12.5px;
      padding:4px 0;
    }
    .auth-card .password-toggle,
    .password-toggle{
      width:44px;
      height:44px;
      right:2px;
    }
    .password-wrap input{padding-right:50px;}
    .auth-body::before{
      width:220px; height:220px;
      top:-60px; left:-80px;
    }
    .auth-body::after{
      width:180px; height:180px;
      bottom:-40px; right:-60px;
    }
    .auth-switch{font-size:13px; line-height:1.5;}
  }

  @media (max-width:420px){
    .auth-body{
      padding-left:12px;
      padding-right:12px;
    }
    .auth-brand p{display:none;} /* keep brand + title; card carries the message */
    .auth-card{padding:20px 14px; border-radius:16px;}
    .auth-card h2{font-size:18px;}
    .auth-submit{font-size:14.5px;}
  }

  @media (max-height:700px) and (max-width:900px){
    .auth-body{align-items:flex-start;}
    .auth-brand h1{font-size:22px;}
    .auth-brand{margin-bottom:0;}
  }

  /* Password toggles on light pages (e.g. profile) */
  .password-toggle{
    position:absolute; right:6px; top:50%; transform:translateY(-50%);
    width:34px; height:34px; padding:0;
    border:none; background:transparent; color:var(--muted);
    border-radius:8px; cursor:pointer;
    display:inline-flex; align-items:center; justify-content:center;
  }
  .password-toggle:hover{background:#F1F2F8; color:var(--text);}

  @media (max-width:760px){
    .profile-layout{grid-template-columns:1fr;}
    .profile-photo-card{grid-column:auto;}
    .profile-photo-row{flex-direction:column; align-items:flex-start;}
    .page-profile .page-header,
    #page-profile .page-header{
      flex-direction:column;
      align-items:stretch;
    }
    #page-profile .page-header .btn{width:100%;}
  }

  /* ---------- WORKFLOWS ---------- */
  .wf-item{
    display:flex; align-items:flex-start; gap:10px;
    padding:12px 0; border-bottom:1px solid var(--line);
  }
  .wf-item:last-child{border-bottom:none;}
  .wf-item.off{opacity:.55;}
  .wf-main{flex:1; min-width:0;}
  .wf-title{font-size:13.5px; font-weight:600; color:var(--text);}
  .wf-meta{font-size:12px; color:var(--muted); margin-top:3px; line-height:1.4;}
  .wf-meta b{color:var(--text); font-weight:600;}
  .wf-switch{
    position:relative; width:36px; height:20px; flex-shrink:0; margin-top:2px; cursor:pointer;
  }
  .wf-switch input{opacity:0; width:0; height:0; position:absolute;}
  .wf-switch span{
    position:absolute; inset:0; background:#D5D8E6; border-radius:999px; transition:background .15s ease;
  }
  .wf-switch span::after{
    content:''; position:absolute; width:14px; height:14px; border-radius:50%;
    background:#fff; top:3px; left:3px; transition:transform .15s ease;
    box-shadow:0 1px 3px rgba(15,20,36,.2);
  }
  .wf-switch input:checked + span{background:var(--indigo);}
  .wf-switch input:checked + span::after{transform:translateX(16px);}
  .wf-log-row{padding:10px 0; border-bottom:1px solid var(--line);}
  .wf-log-row:last-child{border-bottom:none;}
  .wf-log-name{font-size:12.5px; font-weight:600;}
  .wf-log-msg{font-size:12px; color:var(--muted); margin-top:2px;}
  .wf-log-time{font-size:11px; color:var(--muted-2); margin-top:4px;}

  /* ---------- WORKFLOW CANVAS (n8n-style) ---------- */
  .wf-canvas-card{overflow:hidden;}
  .wf-canvas-toolbar{gap:12px; flex-wrap:wrap;}
  .wf-canvas-controls{display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
  .wf-canvas-controls .field select{min-width:200px; padding:9px 12px; border:1px solid var(--line); border-radius:9px; font-size:13px; background:#fff;}
  .wf-canvas-wrap{
    position:relative; margin-top:12px; height:min(420px, 58vh); min-height:300px;
    border-radius:12px; overflow:auto; border:1px solid #1a2035;
    background:
      radial-gradient(ellipse 60% 50% at 20% 40%, rgba(91,95,239,.18), transparent 55%),
      radial-gradient(ellipse 40% 40% at 80% 60%, rgba(139,92,246,.12), transparent 50%),
      linear-gradient(160deg, #0B0F19 0%, #12182a 50%, #0d1220 100%);
  }
  .wf-canvas-svg{display:block; min-width:100%; min-height:100%;}
  .wf-canvas-empty{
    position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
    color:#AEB1C6; font-size:13.5px; z-index:1; pointer-events:none; padding:24px; text-align:center;
  }
  .wf-canvas-empty.hidden{display:none;}
  .wf-legend{
    display:flex; flex-wrap:wrap; gap:14px 18px; margin-top:12px;
    font-size:12px; color:var(--muted); font-weight:500;
  }
  .wf-legend span{display:inline-flex; align-items:center; gap:6px;}
  .wf-dot{width:10px; height:10px; border-radius:3px; display:inline-block;}
  .wf-dot.trigger{background:#38BDF8;}
  .wf-dot.knowledge{background:#A78BFA;}
  .wf-dot.decide{background:#FBBF24;}
  .wf-dot.action{background:#34D399;}
  .wf-dot.output{background:#F472B6;}

  .wf-node-rect{fill:rgba(255,255,255,.04); stroke:rgba(255,255,255,.75); stroke-width:1.5;}
  .wf-node-rect.trigger{stroke:#38BDF8;}
  .wf-node-rect.knowledge{stroke:#A78BFA;}
  .wf-node-rect.decide{stroke:#FBBF24;}
  .wf-node-rect.action{stroke:#34D399;}
  .wf-node-rect.output{stroke:#F472B6; fill:rgba(244,114,182,.08);}
  .wf-node-rect.active{
    stroke:#5B5FEF; stroke-width:2.5; fill:rgba(91,95,239,.16);
    filter:drop-shadow(0 0 10px rgba(91,95,239,.65));
  }
  .wf-node-label{fill:#F4F5FB; font-size:12px; font-weight:600; font-family:'Inter',system-ui,sans-serif;}
  .wf-node-sub{fill:#AEB1C6; font-size:10px; font-family:'Inter',system-ui,sans-serif;}
  .wf-edge{fill:none; stroke:rgba(255,255,255,.55); stroke-width:1.4;}
  .wf-edge.active{stroke:#5B5FEF; stroke-width:2.2;}
  .wf-edge-label{fill:#9498B6; font-size:10px; font-family:'Inter',system-ui,sans-serif;}
  .wf-arrow{fill:rgba(255,255,255,.55);}
  .wf-arrow.active{fill:#5B5FEF;}

  @media (max-width:760px){
    .wf-canvas-wrap{height:280px; min-height:240px;}
    .wf-canvas-controls{width:100%;}
    .wf-canvas-controls .field{flex:1; min-width:0;}
    .wf-canvas-controls .field select{width:100%; min-width:0;}
  }
