/* ===== צבעים: כל הצבעים מוגדרים כאן כמשתנים, עם גרסה כהה (אוטומטית לפי המכשיר,
   או ידנית דרך "ערכת צבעים" בהגדרות, ששומרת data-theme על תגית ה-html) ===== */
:root{
  --bg:#ECE5DD;
  --surface:#FFFFFF;
  --surface-2:#F7F8FA;
  --surface-hover:#F2F3F4;
  --border:#E9E4DC;
  --text:#111B21;
  --text-dim:#54656F;
  --text-faint:#8696A0;
  --accent:#00A884;
  --accent-dark:#008069;
  --link:#008069;
  --accent-soft:#E4F7F1;
  --accent-softer:#F0FBF8;
  --accent-border:#BFE9DE;
  --mine-bg:#D9FDD3;
  --mine-bg-hover:#CFF0C4;
  --danger:#DC2626;
  --danger-soft:#FFF5F5;
  --header:#008069;
  --header-text:#FFFFFF;
  --primary:#008069;
  --primary-hover:#006B58;
  --wf-bar:#D1D7DB;
  --played:#53BDEB;
  --tooltip-bg:#20272B;
  --tooltip-dim:#C3CBD1;
  --overlay:rgba(15,17,25,.55);
  --warn-bg:#FFF8EC;
  --warn-border:#F5DFAE;
  --warn-text:#8A6100;
  --warn-icon:#B8860B;
  --disabled-bg:#EDEEF0;
  --day-sep-bg:rgba(255,255,255,.92);
  --toast-bg:#111B21;
  --toast-text:#FFFFFF;
  --shadow:rgba(0,0,0,.08);
  --skeleton:#E3E7EA;
  --radius:8px;
  --pattern:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='none' stroke='%23000000' stroke-opacity='0.05' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M40 28h34a9 9 0 0 1 9 9v10a9 9 0 0 1-9 9H57l-9 8v-8h-8a9 9 0 0 1-9-9V37a9 9 0 0 1 9-9z'/%3E%3Cpath d='M132 50a26 26 0 0 1 36 0'/%3E%3Cpath d='M139 58a15 15 0 0 1 22 0'/%3E%3Cpath d='M258 24a15 15 0 0 1 15 15v14a15 15 0 0 1-30 0V39a15 15 0 0 1 15-15z'/%3E%3Cpath d='M246 55a12 12 0 0 0 24 0'/%3E%3Cpath d='M258 67v10M252 77h12'/%3E%3Cpath d='M362 38l5 12 12 5-12 5-5 12-5-12-12-5 12-5z'/%3E%3Cpath d='M30 140c5 8 5 16 0 24M42 130c9 12 9 28 0 40M54 120c13 16 13 36 0 52'/%3E%3Cpath d='M136 144a12 12 0 0 1 24 0c0 8-12 16-12 16s-12-8-12-16z'/%3E%3Cpath d='M248 138v26h-9v-26z'/%3E%3Cpath d='M248 142l9-13a5 5 0 0 1 9 4l-2.5 9h11a6 6 0 0 1 5.8 7.4l-4 15a6 6 0 0 1-5.8 4.6H248'/%3E%3Cpath d='M336 118l46 17-17 46-9-24-27-9z'/%3E%3Cpath d='M354 128l-11 27'/%3E%3Cpath d='M55 236l4 10 10 4-10 4-4 10-4-10-10-4 10-4z'/%3E%3Cpath d='M144 262a9 9 0 0 0 9-9v-32l16-4v29a9 9 0 1 1-6-8.5'/%3E%3Cpath d='M235 232h40M235 240h30M235 248h35'/%3E%3Crect x='335' y='241' width='40' height='28' rx='5'/%3E%3Ccircle cx='355' cy='255' r='8'/%3E%3Crect x='349' y='233' width='12' height='8' rx='2'/%3E%3Crect x='28' y='336' width='42' height='28' rx='3'/%3E%3Cpath d='M28 338l21 17 21-17'/%3E%3Cpath d='M150 336c-13 0-22 10-22 22 0 15 22 32 22 32s22-17 22-32c0-12-9-22-22-22z'/%3E%3Ccircle cx='150' cy='358' r='6'/%3E%3Cpath d='M235 330h42a9 9 0 0 1 9 9v14a9 9 0 0 1-9 9h-22l-9 8v-8h-11a9 9 0 0 1-9-9v-14a9 9 0 0 1 9-9z'/%3E%3Ccircle cx='355' cy='352' r='15'/%3E%3Cpath d='M355 342v11l8 6'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0B141A;
    --surface:#202C33;
    --surface-2:#2A3942;
    --surface-hover:#26343C;
    --border:#2F3B43;
    --text:#E9EDEF;
    --text-dim:#AEBAC1;
    --text-faint:#8696A0;
    --link:#21C063;
    --accent-soft:#103529;
    --accent-softer:#0F2A22;
    --accent-border:#1F5A47;
    --mine-bg:#005C4B;
    --mine-bg-hover:#0A6B58;
    --danger:#F15C6D;
    --danger-soft:#3A1F24;
    --header:#202C33;
    --header-text:#E9EDEF;
    --primary:#00A884;
    --primary-hover:#06CF9C;
    --wf-bar:#4B5A63;
    --tooltip-bg:#111B21;
    --tooltip-dim:#AEBAC1;
    --overlay:rgba(0,0,0,.6);
    --warn-bg:#3A2F12;
    --warn-border:#6B5420;
    --warn-text:#F3D27A;
    --warn-icon:#E5B93C;
    --disabled-bg:#1B262D;
    --day-sep-bg:#182229;
    --toast-bg:#E9EDEF;
    --toast-text:#111B21;
    --shadow:rgba(0,0,0,.3);
    --skeleton:#26343C;
    --pattern:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='none' stroke='%23FFFFFF' stroke-opacity='0.035' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M40 28h34a9 9 0 0 1 9 9v10a9 9 0 0 1-9 9H57l-9 8v-8h-8a9 9 0 0 1-9-9V37a9 9 0 0 1 9-9z'/%3E%3Cpath d='M132 50a26 26 0 0 1 36 0'/%3E%3Cpath d='M139 58a15 15 0 0 1 22 0'/%3E%3Cpath d='M258 24a15 15 0 0 1 15 15v14a15 15 0 0 1-30 0V39a15 15 0 0 1 15-15z'/%3E%3Cpath d='M246 55a12 12 0 0 0 24 0'/%3E%3Cpath d='M258 67v10M252 77h12'/%3E%3Cpath d='M362 38l5 12 12 5-12 5-5 12-5-12-12-5 12-5z'/%3E%3Cpath d='M30 140c5 8 5 16 0 24M42 130c9 12 9 28 0 40M54 120c13 16 13 36 0 52'/%3E%3Cpath d='M136 144a12 12 0 0 1 24 0c0 8-12 16-12 16s-12-8-12-16z'/%3E%3Cpath d='M336 118l46 17-17 46-9-24-27-9z'/%3E%3Cpath d='M55 236l4 10 10 4-10 4-4 10-4-10-10-4 10-4z'/%3E%3Cpath d='M144 262a9 9 0 0 0 9-9v-32l16-4v29a9 9 0 1 1-6-8.5'/%3E%3Crect x='335' y='241' width='40' height='28' rx='5'/%3E%3Ccircle cx='355' cy='255' r='8'/%3E%3Crect x='28' y='336' width='42' height='28' rx='3'/%3E%3Cpath d='M28 338l21 17 21-17'/%3E%3Cpath d='M235 330h42a9 9 0 0 1 9 9v14a9 9 0 0 1-9 9h-22l-9 8v-8h-11a9 9 0 0 1-9-9v-14a9 9 0 0 1 9-9z'/%3E%3Ccircle cx='355' cy='352' r='15'/%3E%3Cpath d='M355 342v11l8 6'/%3E%3C/g%3E%3C/svg%3E");
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#0B141A;
  --surface:#202C33;
  --surface-2:#2A3942;
  --surface-hover:#26343C;
  --border:#2F3B43;
  --text:#E9EDEF;
  --text-dim:#AEBAC1;
  --text-faint:#8696A0;
  --link:#21C063;
  --accent-soft:#103529;
  --accent-softer:#0F2A22;
  --accent-border:#1F5A47;
  --mine-bg:#005C4B;
  --mine-bg-hover:#0A6B58;
  --danger:#F15C6D;
  --danger-soft:#3A1F24;
  --header:#202C33;
  --header-text:#E9EDEF;
  --primary:#00A884;
  --primary-hover:#06CF9C;
  --wf-bar:#4B5A63;
  --tooltip-bg:#111B21;
  --tooltip-dim:#AEBAC1;
  --overlay:rgba(0,0,0,.6);
  --warn-bg:#3A2F12;
  --warn-border:#6B5420;
  --warn-text:#F3D27A;
  --warn-icon:#E5B93C;
  --disabled-bg:#1B262D;
  --day-sep-bg:#182229;
  --toast-bg:#E9EDEF;
  --toast-text:#111B21;
  --shadow:rgba(0,0,0,.3);
  --skeleton:#26343C;
  --pattern:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='none' stroke='%23FFFFFF' stroke-opacity='0.035' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M40 28h34a9 9 0 0 1 9 9v10a9 9 0 0 1-9 9H57l-9 8v-8h-8a9 9 0 0 1-9-9V37a9 9 0 0 1 9-9z'/%3E%3Cpath d='M132 50a26 26 0 0 1 36 0'/%3E%3Cpath d='M139 58a15 15 0 0 1 22 0'/%3E%3Cpath d='M258 24a15 15 0 0 1 15 15v14a15 15 0 0 1-30 0V39a15 15 0 0 1 15-15z'/%3E%3Cpath d='M246 55a12 12 0 0 0 24 0'/%3E%3Cpath d='M258 67v10M252 77h12'/%3E%3Cpath d='M362 38l5 12 12 5-12 5-5 12-5-12-12-5 12-5z'/%3E%3Cpath d='M30 140c5 8 5 16 0 24M42 130c9 12 9 28 0 40M54 120c13 16 13 36 0 52'/%3E%3Cpath d='M136 144a12 12 0 0 1 24 0c0 8-12 16-12 16s-12-8-12-16z'/%3E%3Cpath d='M336 118l46 17-17 46-9-24-27-9z'/%3E%3Cpath d='M55 236l4 10 10 4-10 4-4 10-4-10-10-4 10-4z'/%3E%3Cpath d='M144 262a9 9 0 0 0 9-9v-32l16-4v29a9 9 0 1 1-6-8.5'/%3E%3Crect x='335' y='241' width='40' height='28' rx='5'/%3E%3Ccircle cx='355' cy='255' r='8'/%3E%3Crect x='28' y='336' width='42' height='28' rx='3'/%3E%3Cpath d='M28 338l21 17 21-17'/%3E%3Cpath d='M235 330h42a9 9 0 0 1 9 9v14a9 9 0 0 1-9 9h-22l-9 8v-8h-11a9 9 0 0 1-9-9v-14a9 9 0 0 1 9-9z'/%3E%3Ccircle cx='355' cy='352' r='15'/%3E%3Cpath d='M355 342v11l8 6'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme:dark;
}

*{box-sizing:border-box;}
html,body{height:100%;margin:0;}
body{
  font-family:'Assistant',sans-serif;
  color:var(--text);
  display:flex;
  justify-content:center;
  -webkit-font-smoothing:antialiased;
  background-color:var(--bg);
  background-image:var(--pattern);
  background-repeat:repeat;
  background-size:400px 400px;
}
button{font-family:inherit;}
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, .waveform:focus-visible, .sys-row:focus-visible{
  outline:2px solid var(--accent);outline-offset:2px;
}
svg{display:block;}
[hidden]{display:none !important;}

/* ===== פריסה: בטלפון מוצג מסך אחד בכל פעם (רשימת מערכות או שיחה), במחשב שניהם זה לצד זה ===== */
#app{
  width:100%;
  max-width:640px;
  height:100vh;
  height:100dvh;
  display:flex;
  box-shadow:0 0 40px var(--shadow);
  position:relative;
}
#sidebar{
  display:none;flex-direction:column;min-width:0;width:100%;
  background:var(--surface);
}
#chat{
  display:flex;flex-direction:column;min-width:0;flex:1;
  background-color:var(--bg);
}
#app.home-mode #sidebar{display:flex;}
#app.home-mode #chat{display:none;}

@media (min-width:900px){
  #app{max-width:1400px;}
  #sidebar{display:flex;width:340px;flex-shrink:0;border-inline-end:1px solid var(--border);}
  #chat{display:flex !important;}
  #app.home-mode #chat{display:flex;}
  #backHomeBtn{display:none !important;}
}

header.bar{
  background:var(--header);
  color:var(--header-text);
  /* גובה קבוע, כדי שהכותרת של רשימת המערכות (עם שורת משנה) ושל השיחה (בלי) יהיו בדיוק באותו גובה */
  height:calc(62px + env(safe-area-inset-top));
  padding:0 16px;
  padding-top:env(safe-area-inset-top);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  flex-shrink:0;
}
header .title{display:flex;flex-direction:column;gap:2px;min-width:0;}
header .title-row{display:flex;align-items:center;gap:8px;min-width:0;}
header .app-logo{display:flex;flex-shrink:0;line-height:0;}
header .title b{font-size:1.05rem;font-weight:600;letter-spacing:.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
header .title span{font-size:.76rem;opacity:.75;font-weight:400;}
#extLabel:empty{display:none;}
header .actions{display:flex;gap:6px;flex-shrink:0;}
header button.icon{
  width:38px;height:38px;flex-shrink:0;
  background:rgba(255,255,255,.08);border:none;color:inherit;cursor:pointer;
  border-radius:50%;display:flex;align-items:center;justify-content:center;
  transition:background .15s;
}
header button.icon:hover{background:rgba(255,255,255,.18);}
header button.icon svg{width:18px;height:18px;}
@media (max-width:360px){
  header.bar{padding-left:10px;padding-right:10px;}
  header .actions{gap:3px;}
  header button.icon{width:34px;height:34px;}
  header button.icon svg{width:16px;height:16px;}
  header .title b{font-size:.96rem;}
}

/* ===== חיפוש ===== */
#searchBar{
  display:flex;align-items:center;gap:8px;
  padding:8px 12px;background:var(--surface);border-bottom:1px solid var(--border);flex-shrink:0;
}
#searchBar > svg{width:17px;height:17px;color:var(--text-faint);flex-shrink:0;}
#searchInput{
  flex:1;min-width:0;border:none;background:transparent;color:var(--text);
  font-family:inherit;font-size:.92rem;padding:6px 2px;outline:none;
}
#searchInput::-webkit-search-cancel-button{display:none;}
.search-close{
  width:32px;height:32px;border:none;background:none;color:var(--text-faint);cursor:pointer;
  border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.search-close:hover{background:var(--surface-hover);color:var(--text);}
.search-close svg{width:17px;height:17px;}
.search-hidden{display:none !important;}
.search-empty{text-align:center;color:var(--text-dim);font-size:.88rem;padding:30px 16px;}

#list{
  flex:1;
  min-height:0;
  overflow-y:auto;
  padding:14px 12px 10px;
  display:flex;
  flex-direction:column;
  gap:6px;
  background-image:var(--pattern);
  background-size:400px 400px;
}

/* ===== רשימת המערכות ===== */
#homeListEl{flex:1;overflow-y:auto;padding:6px 8px;}
.sys-row{
  display:flex;align-items:center;gap:12px;padding:10px 8px;border-radius:10px;
  cursor:pointer;background:transparent;transition:background .12s;
}
.sys-row:hover{background:var(--surface-hover);}
.sys-row.active{background:var(--surface-2);}
.sys-avatar{
  width:48px;height:48px;border-radius:50%;overflow:hidden;flex-shrink:0;
  background:var(--surface-2);display:flex;align-items:center;justify-content:center;color:var(--text-faint);
}
.sys-avatar img{width:100%;height:100%;object-fit:cover;}
.sys-avatar svg{width:22px;height:22px;}
.sys-avatar .initials-avatar{font-size:1rem;}
.sys-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px;}
.sys-toprow, .sys-bottomrow{display:flex;align-items:center;justify-content:space-between;gap:8px;}
.sys-label{font-weight:600;font-size:.98rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sys-time{font-size:.72rem;color:var(--text-faint);flex-shrink:0;}
.sys-row.has-unread .sys-time{color:var(--accent);font-weight:600;}
.sys-preview{
  font-size:.82rem;color:var(--text-dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  display:flex;align-items:center;gap:4px;min-width:0;
}
.sys-preview span{overflow:hidden;text-overflow:ellipsis;}
.sys-preview svg{width:14px;height:14px;flex-shrink:0;color:var(--text-faint);}
.sys-unread{
  min-width:20px;height:20px;padding:0 6px;border-radius:10px;flex-shrink:0;
  background:var(--accent);color:#fff;font-size:.72rem;font-weight:700;
  display:flex;align-items:center;justify-content:center;
}
.home-empty{padding:50px 24px;text-align:center;color:var(--text-dim);line-height:1.6;}

/* ===== שלד טעינה ===== */
.skel-row{display:flex;align-self:flex-start;}
.skel-row.mine{align-self:flex-end;}
.skel-bubble{
  width:300px;max-width:85vw;height:50px;border-radius:22px;background:var(--surface);
  display:flex;align-items:center;gap:10px;padding:6px 12px 6px 6px;box-shadow:0 1px 1px var(--shadow);
}
.skel-circle{width:38px;height:38px;border-radius:50%;background:var(--skeleton);flex-shrink:0;}
.skel-line{flex:1;height:10px;border-radius:5px;background:var(--skeleton);}
.skel-circle, .skel-line{animation:skel 1.2s ease-in-out infinite;}
@keyframes skel{0%,100%{opacity:1;}50%{opacity:.45;}}

/* ===== מפריד תאריך ===== */
.day-sep{
  align-self:center;margin:8px 0 4px;padding:5px 12px;border-radius:8px;
  background:var(--day-sep-bg);color:var(--text-dim);font-size:.74rem;font-weight:600;
  box-shadow:0 1px 1px var(--shadow);
}

/* קופסת סטטוס להעלאה בתהליך/שגיאה */
.rec-item{
  background:var(--surface);
  border-radius:var(--radius);
  padding:10px 14px;
  display:flex;
  align-items:center;
  gap:8px;
  box-shadow:0 1px 1px var(--shadow);
}
.rec-item.pending{box-shadow:0 0 0 2px var(--accent) inset;}
.rec-item.error-item{background:var(--danger-soft);flex-wrap:wrap;}
.upload-actions{display:flex;gap:12px;margin-inline-start:auto;}

/* ===== הודעה קולית ===== */
.rec-row{display:flex;align-items:flex-start;gap:5px;max-width:94%;align-self:flex-start;}
.rec-row.rec-mine{align-self:flex-end;}
.rec-col{display:flex;flex-direction:column;min-width:0;}

.rec-bubble{
  position:relative;
  width:330px;
  max-width:100%;
  background:var(--surface);
  border-radius:22px;
  padding:6px 12px 6px 6px;
  display:flex;
  align-items:center;
  gap:8px;
  box-shadow:0 1px 1px var(--shadow);
  transition:background .12s;
}
.rec-bubble:hover{background:var(--surface-hover);}
.rec-row.rec-mine .rec-bubble{background:var(--mine-bg);padding:6px 6px 6px 12px;flex-direction:row-reverse;}
.rec-row.rec-mine .rec-bubble:hover{background:var(--mine-bg-hover);}

.play-btn{
  width:38px;height:38px;flex-shrink:0;border-radius:50%;
  background:var(--accent);border:none;color:#fff;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:transform .1s, background .15s;
}
.play-btn:hover{background:var(--accent-dark);}
.play-btn:active{transform:scale(.92);}
.play-btn svg{width:14px;height:14px;}

.rec-wave-col{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px;padding-top:8px;}
.rec-wave-row{display:flex;align-items:center;gap:6px;min-width:0;}
.waveform{
  position:relative;
  flex:1;height:24px;display:flex;align-items:center;justify-content:space-between;gap:1px;cursor:pointer;
  min-width:0;border-radius:4px;
}
.wf-bar{flex:0 1 2.5px;width:2.5px;min-width:1.5px;border-radius:2px;background:var(--wf-bar);}
.wf-bar.played{background:var(--accent);}
.wf-thumb{
  position:absolute;
  top:50%;
  right:0;
  width:11px;height:11px;border-radius:50%;
  background:var(--accent);
  box-shadow:0 1px 2px rgba(0,0,0,.25);
  transform:translate(50%,-50%);
  pointer-events:none;
  transition:right .05s linear;
}
.rec-meta{display:flex;align-items:center;justify-content:space-between;gap:6px;min-height:15px;}
.rec-time{font-size:.7rem;color:var(--text-faint);flex-shrink:0;min-width:28px;}
.rec-clock{font-size:.68rem;color:var(--text-faint);flex-shrink:0;}
.speed-chip{
  display:none;border:none;cursor:pointer;flex-shrink:0;
  background:var(--text-faint);color:var(--surface);
  font-family:inherit;font-size:.68rem;font-weight:700;line-height:1;
  padding:3px 7px;border-radius:10px;
}
.rec-row.active .speed-chip{display:inline-block;}

/* ===== תמלול ===== */
.transcript-wrap{width:330px;max-width:100%;margin-top:2px;}
.rec-row.rec-mine .transcript-wrap{align-self:flex-end;}
.transcript-btn{
  background:none;border:none;cursor:pointer;padding:2px 6px;
  font-size:.76rem;color:var(--link);display:flex;align-items:center;gap:4px;
}
.transcript-btn:hover{text-decoration:underline;}
.transcript-btn svg{width:13px;height:13px;flex-shrink:0;}
.transcript-btn[disabled]{opacity:.6;cursor:default;text-decoration:none;}
.transcript-box{
  background:var(--surface);border-radius:10px;padding:7px 10px;
  box-shadow:0 1px 1px var(--shadow);
}
.rec-row.rec-mine .transcript-box{background:var(--mine-bg);}
.transcript-text{font-size:.82rem;line-height:1.5;color:var(--text-dim);white-space:pre-wrap;margin:0;}
.transcript-text.collapsed{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
.transcript-toggle{
  background:none;border:none;cursor:pointer;padding:0;margin-top:2px;
  font-size:.76rem;color:var(--link);font-weight:600;
}
.transcript-toggle:hover{text-decoration:underline;}
.transcript-text.error{color:var(--danger);}

/* ===== תמונת השולח בתוך הבועה + תג מיקרופון (כחול = נשמעה, ירוק = עוד לא) ===== */
.voice-avatar-wrap{position:relative;flex-shrink:0;}
.voice-avatar{
  position:relative;width:40px;height:40px;border-radius:50%;flex-shrink:0;
  background:var(--surface-2);color:var(--text-faint);cursor:pointer;
}
.voice-avatar-img{
  width:100%;height:100%;border-radius:50%;overflow:hidden;
  display:flex;align-items:center;justify-content:center;
}
.voice-avatar-img img{width:100%;height:100%;object-fit:cover;display:block;}
.voice-avatar-img svg{width:16px;height:16px;}
.initials-avatar{
  width:100%;height:100%;display:flex;align-items:center;justify-content:center;
  color:#fff;font-weight:600;font-size:.85rem;
}
.voice-avatar-badge{
  position:absolute;bottom:-2px;left:-2px;
  width:17px;height:17px;border-radius:50%;
  background:var(--played);
  display:flex;align-items:center;justify-content:center;
  border:2px solid var(--surface);
}
.rec-row.unplayed .voice-avatar-badge{background:var(--accent);}
.rec-row.rec-mine .voice-avatar-badge{
  left:auto;right:-2px;
  border-color:var(--mine-bg);
  background:var(--accent-dark);
}
.voice-avatar-badge svg{width:8px;height:8px;color:#fff;}

/* חלונית פרטים: ריחוף בעכבר, או הקשה על התמונה בטלפון */
.voice-tooltip{
  position:fixed;left:0;bottom:0;
  background:var(--tooltip-bg);color:#fff;
  border-radius:10px;padding:9px 11px;
  font-size:.72rem;line-height:1.65;white-space:nowrap;
  box-shadow:0 6px 20px rgba(0,0,0,.28);
  opacity:0;visibility:hidden;pointer-events:none;
  transition:opacity .15s ease, transform .15s ease;
  transform:translateY(4px);
  z-index:1000;text-align:right;
}
.voice-tooltip::after{
  content:'';position:absolute;top:100%;left:var(--arrow-x, 50%);
  transform:translateX(-50%);
  border:5px solid transparent;border-top-color:var(--tooltip-bg);
}
.voice-tooltip.show{opacity:1;visibility:visible;transform:translateY(0);pointer-events:auto;}
.voice-tooltip b{display:block;font-size:.78rem;margin-bottom:3px;font-weight:600;}
.voice-tooltip .tt-row{color:var(--tooltip-dim);}
.voice-tooltip .tt-dur{color:#fff;}
.voice-tooltip .tt-add{
  display:flex;align-items:center;gap:4px;margin-top:6px;
  background:none;border:none;color:#21C063;
  font-family:inherit;font-size:.72rem;font-weight:600;cursor:pointer;padding:0;
}
.voice-tooltip .tt-add svg{width:11px;height:11px;}

/* תפריט קליק ימני / לחיצה ארוכה למחיקת הקלטה */
.ctx-menu{
  position:fixed;z-index:80;display:none;
  background:var(--surface);border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.25);
  padding:6px;min-width:180px;
}
.ctx-menu.open{display:block;}
.ctx-item{
  width:100%;display:flex;align-items:center;gap:8px;
  padding:10px 12px;border:none;background:none;border-radius:7px;
  font-family:inherit;font-size:.85rem;cursor:pointer;text-align:right;color:var(--text);
}
.ctx-item:hover{background:var(--surface-hover);}
.ctx-item.danger{color:var(--danger);}
.ctx-item svg{width:15px;height:15px;flex-shrink:0;}

.status-text{font-size:.82rem;color:var(--text-dim);}
.status-text.error{color:var(--danger);}

.empty-state, .status-line{
  text-align:center;color:var(--text-dim);font-size:.9rem;
  padding:40px 16px;line-height:1.6;white-space:pre-line;
}
.status-line.error{color:var(--danger);}
.status-detail{display:block;margin-top:6px;font-size:.74rem;color:var(--text-faint);direction:ltr;}
.status-action{
  margin-top:14px;padding:9px 18px;border-radius:20px;border:none;cursor:pointer;
  background:var(--primary);color:#fff;font-weight:600;font-size:.86rem;
}
.status-action:hover{background:var(--primary-hover);}

/* ===== שורת הקלטה תחתונה ===== */
#bottombar{
  flex-shrink:0;
  background:var(--surface);
  padding:10px 14px;
  padding-bottom:calc(10px + env(safe-area-inset-bottom));
  display:flex;
  align-items:center;
  gap:10px;
  border-top:1px solid var(--border);
}
#bottombar button.attach{
  width:40px;height:40px;border-radius:50%;border:none;background:none;color:var(--text-dim);cursor:pointer;
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
  transition:background .15s,color .15s;
}
#bottombar button.attach:hover{background:var(--surface-hover);color:var(--text);}
#bottombar button.attach svg{width:20px;height:20px;}
#recTimer{flex:1;font-size:.86rem;color:var(--text-dim);display:none;align-items:center;gap:8px;}
#recTimer .dot{width:8px;height:8px;border-radius:50%;background:var(--danger);animation:pulse 1s infinite;}
#recHoldHint{display:none;color:var(--text-faint);font-size:.78rem;}
#recTimer.hold #recHoldHint{display:inline;}
@keyframes pulse{0%,100%{opacity:1;}50%{opacity:.25;}}
#placeholderText{flex:1;color:var(--text-faint);font-size:.84rem;line-height:1.35;}
#micBtn{
  width:48px;height:48px;border-radius:50%;border:none;
  background:var(--primary);color:#fff;
  cursor:pointer;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  transition:transform .12s, background .15s;
  touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;
}
#micBtn svg{width:18px;height:18px;}
#micBtn.recording{background:var(--danger);}
#micBtn.holding{transform:scale(1.18);}
#micBtn:active{transform:scale(.92);}
#micBtn.holding:active{transform:scale(1.18);}
#fileInput{display:none;}

/* ===== חלונות ===== */
.ov{
  position:fixed;inset:0;background:var(--overlay);
  display:none;align-items:center;justify-content:center;z-index:50;
  padding:16px;
}
.ov.open{display:flex;}
.dialog-ov{z-index:70;}
.ov-box{
  background:var(--surface);color:var(--text);border-radius:16px;padding:24px;width:100%;max-width:440px;
  max-height:90vh;max-height:90dvh;overflow-y:auto;
  box-shadow:0 12px 40px rgba(0,0,0,.25);
}
.ov-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:4px;}
.ov-head h2{margin:0 !important;}
.ov-x{
  background:none;border:none;color:var(--text-faint);cursor:pointer;
  padding:6px;border-radius:50%;display:flex;flex-shrink:0;
}
.ov-x:hover{background:var(--surface-hover);color:var(--text);}
.ov-x svg{width:19px;height:19px;}
.ov-box h2{margin:0 0 4px;font-size:1.1rem;font-weight:700;}
.ov-box .sub{font-size:.8rem;color:var(--text-dim);margin-bottom:12px;line-height:1.5;}
.ov-box label{display:block;font-size:.8rem;font-weight:600;margin:14px 0 5px;}
.ov-box input[type="text"], .ov-box select{
  width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:8px;font-size:.92rem;
  font-family:inherit;background:var(--surface-2);color:var(--text);
}
.ov-box input[type="text"]:focus, .ov-box select:focus{border-color:var(--accent);background:var(--surface);outline:none;}
.ov-box select:disabled{background:var(--disabled-bg);color:var(--text-faint);cursor:not-allowed;}
.ov-box .hint{font-size:.73rem;color:var(--text-faint);margin-top:5px;line-height:1.5;}
.ov-box .warn{
  display:flex;gap:8px;
  background:var(--warn-bg);border:1px solid var(--warn-border);border-radius:8px;
  padding:10px 12px;font-size:.74rem;color:var(--warn-text);margin-top:16px;line-height:1.55;
}
.ov-box .warn svg{width:15px;height:15px;flex-shrink:0;margin-top:2px;color:var(--warn-icon);}
.ov-box input[type="text"][readonly].masked-field{
  background:var(--disabled-bg);color:var(--text-faint);cursor:not-allowed;letter-spacing:2px;
}
.ov-box .btnrow{display:flex;gap:10px;margin-top:20px;}
.ov-box .btnrow button{
  flex:1;padding:11px;border-radius:8px;border:none;font-size:.9rem;font-weight:600;cursor:pointer;font-family:inherit;
}
.ov-box .btnrow button.primary{background:var(--primary);color:#fff;}
.ov-box .btnrow button.primary:hover{background:var(--primary-hover);}
.ov-box .btnrow button.primary.danger-fill{background:var(--danger);}
.ov-box .btnrow button.primary:disabled{opacity:.6;cursor:default;}
.ov-box .btnrow button.secondary{background:var(--surface-2);color:var(--text);}
.ov-box .btnrow button.secondary:hover{background:var(--surface-hover);}
.ov-box .btnrow button.danger-text{color:var(--danger);}
.ov-box .btnrow.linkrow{justify-content:space-between;margin-top:12px;}
.ov-box .btnrow.linkrow button{flex:0 0 auto;padding:4px;}

.help-link{
  display:inline-flex;align-items:center;gap:6px;border:none;background:none;cursor:pointer;
  color:var(--link);font-weight:600;font-size:.8rem;padding:2px 0;margin-bottom:6px;
}
.help-link:hover{text-decoration:underline;}
.help-link svg{width:15px;height:15px;}

.conn-status{margin-top:10px;font-size:.8rem;line-height:1.5;padding:8px 10px;border-radius:8px;background:var(--surface-2);color:var(--text-dim);}
.conn-status.ok{background:var(--accent-softer);color:var(--link);}
.conn-status.error{background:var(--danger-soft);color:var(--danger);}

details.adv{margin-top:16px;border:1px solid var(--border);border-radius:10px;padding:0 12px;}
details.adv summary{
  cursor:pointer;list-style:none;padding:12px 0;font-size:.85rem;font-weight:600;color:var(--text);
  display:flex;align-items:center;justify-content:space-between;gap:8px;
}
details.adv summary::-webkit-details-marker{display:none;}
details.adv summary::after{
  content:'';width:8px;height:8px;border-left:2px solid var(--text-faint);border-bottom:2px solid var(--text-faint);
  transform:rotate(-45deg);transition:transform .15s;margin-top:-4px;flex-shrink:0;
}
details.adv[open] summary::after{transform:rotate(135deg);margin-top:4px;}
details.adv[open]{padding-bottom:14px;}
details.adv > label:first-of-type{margin-top:2px;}

.settings-group-title{font-size:.8rem;font-weight:700;color:var(--text-dim);margin-top:20px;}
.check-row{
  display:flex !important;align-items:center;gap:8px;margin-top:12px !important;cursor:pointer;
  font-size:.82rem !important;color:var(--text-dim);font-weight:500 !important;
}
.check-row input{width:17px;height:17px;accent-color:var(--accent);cursor:pointer;flex-shrink:0;}
.check-row span{flex:1;}

.settings-systems-title{font-size:.8rem;font-weight:600;color:var(--text-dim);margin:8px 0;}
#settingsSystemsList{
  display:flex;flex-direction:column;gap:6px;
  max-height:220px;overflow-y:auto;
  margin-bottom:6px;padding-bottom:12px;
  border-bottom:1px solid var(--border);
}
.settings-sys-row{
  display:flex;align-items:center;gap:10px;
  padding:8px 10px;border-radius:8px;
  background:var(--surface-2);cursor:pointer;
  transition:background .15s;
}
.settings-sys-row:hover{background:var(--accent-softer);}
.settings-sys-row.active{background:var(--accent-soft);}
.settings-sys-row .settings-sys-avatar{
  width:34px;height:34px;border-radius:50%;flex-shrink:0;overflow:hidden;
  background:var(--accent);color:#fff;
  display:flex;align-items:center;justify-content:center;
}
.settings-sys-row .settings-sys-avatar svg{width:17px;height:17px;}
.settings-sys-row .settings-sys-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px;}
.settings-sys-row .settings-sys-info b{font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600;}
.settings-sys-row .settings-sys-info span{font-size:.72rem;color:var(--text-faint);}
.settings-sys-row .settings-sys-del{
  flex-shrink:0;width:30px;height:30px;border-radius:50%;
  border:none;background:transparent;color:var(--text-faint);
  display:flex;align-items:center;justify-content:center;cursor:pointer;
}
.settings-sys-row .settings-sys-del:hover{background:var(--danger-soft);color:var(--danger);}
.settings-sys-row .settings-sys-del svg{width:15px;height:15px;}

.wizard-entry-btn{
  display:flex;align-items:center;gap:10px;width:100%;
  background:var(--accent-softer);border:1px solid var(--accent-border);border-radius:10px;
  padding:10px 12px;margin-top:16px;cursor:pointer;text-align:right;transition:background .15s;color:var(--text);
}
.wizard-entry-btn:hover{background:var(--accent-soft);}
.wizard-entry-icon{
  width:32px;height:32px;flex-shrink:0;border-radius:50%;background:var(--accent);color:#fff;
  display:flex;align-items:center;justify-content:center;
}
.wizard-entry-icon svg{width:17px;height:17px;}
.wizard-entry-text{display:flex;flex-direction:column;gap:1px;min-width:0;}
.wizard-entry-text b{font-size:.86rem;color:var(--text);}
.wizard-entry-text span{font-size:.74rem;color:var(--text-dim);}

.wizard-text{font-size:.85rem;color:var(--text-dim);line-height:1.65;margin:0 0 10px;}
.wizard-steplist{margin:0 0 12px;padding-inline-start:20px;font-size:.83rem;color:var(--text-dim);line-height:1.75;}
.wizard-link{
  display:inline-flex;align-items:center;gap:6px;
  color:var(--link);font-weight:600;font-size:.82rem;text-decoration:none;margin-bottom:14px;
}
.wizard-link:hover{text-decoration:underline;}
.wizard-link svg{width:14px;height:14px;flex-shrink:0;}

/* ===== מסך הדרכות ===== */
.guides-box{
  max-width:760px;width:100%;height:min(640px,88vh);
  display:flex;flex-direction:column;padding:0;overflow:hidden;
}
.guides-header{display:flex;align-items:center;justify-content:space-between;padding:22px 24px 0;}
.guides-header h2{margin:0;}
.guides-body{flex:1;min-height:0;display:flex;gap:20px;padding:16px 24px 22px;}
.guides-nav{
  flex-shrink:0;width:196px;display:flex;flex-direction:column;gap:3px;
  border-left:1px solid var(--border);padding-left:16px;overflow-y:auto;
}
.guides-nav-item{
  display:flex;align-items:center;gap:10px;width:100%;
  background:none;border:none;text-align:right;cursor:pointer;
  padding:10px 9px;border-radius:9px;font-family:inherit;
  font-size:.83rem;color:var(--text-dim);font-weight:600;transition:background .12s;
}
.guides-nav-item:hover{background:var(--surface-hover);}
.guides-nav-item.active{background:var(--accent-softer);color:var(--text);}
.guides-nav-num{
  width:23px;height:23px;border-radius:50%;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  background:var(--surface-2);color:var(--text-dim);font-size:.73rem;font-weight:700;transition:background .12s,color .12s;
}
.guides-nav-item.active .guides-nav-num{background:var(--accent);color:#fff;}
.guides-content{flex:1;min-width:0;overflow-y:auto;}
.guide-panel{display:none;}
.guide-panel.active{display:block;}
.guide-panel h3{margin:0 0 10px;font-size:1.05rem;font-weight:700;display:flex;align-items:center;gap:9px;}
.guide-req{font-size:.68rem;font-weight:700;color:var(--link);background:var(--accent-soft);padding:2px 8px;border-radius:20px;}
.guide-req.optional{color:var(--text-dim);background:var(--surface-2);}
@media (max-width:600px){
  .guides-box{height:92vh;height:92dvh;}
  .guides-body{flex-direction:column;padding:12px 16px 16px;gap:10px;}
  .guides-nav{
    width:100%;flex-direction:row;overflow-x:auto;overflow-y:visible;
    border-left:none;border-bottom:1px solid var(--border);padding-left:0;padding-bottom:10px;
  }
  .guides-nav-item{flex-shrink:0;white-space:nowrap;}
}

/* ===== בדיקה לפני שליחה - בתוך שורת ההקלטה התחתונה (class="previewing" על #bottombar) ===== */
/* !important כי "#bottombar button.attach" (display:flex) חזק יותר ואחרת הכפתורים מוצגים תמיד */
#bottombar:not(.previewing) .pv{display:none !important;}
#bottombar.previewing .pv{display:flex;}
#bottombar.previewing .cmp{display:none !important;}
#bottombar button.attach.danger{color:var(--danger);}
#bottombar button.attach.danger:hover{background:var(--danger-soft);color:var(--danger);}
.preview-player{
  flex:1;min-width:0;align-items:center;gap:10px;
  background:var(--surface-2);border-radius:24px;padding:4px 12px 4px 4px;height:44px;
}
.preview-player .play-btn{flex-shrink:0;width:36px;height:36px;}
.preview-progress{flex:1;min-width:0;height:6px;border-radius:3px;background:var(--wf-bar);cursor:pointer;position:relative;}
.preview-progress-fill{position:absolute;top:0;right:0;height:100%;width:0%;border-radius:3px;background:var(--accent);}
#previewTimeLabel{min-width:30px;text-align:left;}
#previewSendBtn{
  width:48px;height:48px;border-radius:50%;border:none;flex-shrink:0;
  background:var(--primary);color:#fff;cursor:pointer;
  align-items:center;justify-content:center;transition:transform .12s, background .15s;
}
#previewSendBtn:hover{background:var(--primary-hover);}
#previewSendBtn:active{transform:scale(.92);}
/* חץ השליחה מצביע שמאלה, כמו בוואטסאפ בעברית */
#previewSendBtn svg{width:19px;height:19px;transform:scaleX(-1);}
@media (max-width:360px){
  #bottombar{gap:6px;padding-left:10px;padding-right:10px;}
  #bottombar.previewing button.attach{width:36px;height:36px;}
}

/* ===== אנשי קשר ===== */
#contactsList{display:flex;flex-direction:column;gap:6px;margin-top:6px;max-height:50vh;overflow-y:auto;}
.contact-row{
  display:flex;align-items:center;gap:10px;padding:8px;border-radius:10px;cursor:pointer;
  border:1px solid var(--border);background:var(--surface-2);transition:background .15s;color:var(--text);
}
.contact-row:hover{background:var(--surface-hover);}
.contact-row .c-avatar{
  width:38px;height:38px;border-radius:50%;flex-shrink:0;overflow:hidden;
  background:var(--border);color:var(--text-faint);display:flex;align-items:center;justify-content:center;
}
.contact-row .c-avatar img{width:100%;height:100%;object-fit:cover;}
.contact-row .c-avatar svg{width:18px;height:18px;}
.contact-row .c-info{flex:1;min-width:0;}
.contact-row .c-name{font-weight:600;font-size:.88rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.contact-row .c-phone{font-size:.72rem;color:var(--text-faint);direction:ltr;text-align:right;}
.contact-row .delete-btn{border:none;background:none;color:var(--text-faint);cursor:pointer;padding:6px;border-radius:50%;}
.contact-row .delete-btn svg{width:15px;height:15px;}
.empty-contacts{text-align:center;color:var(--text-dim);font-size:.85rem;padding:20px 8px;}

.avatar-picker-row{display:flex;justify-content:center;margin-top:4px;}
.avatar-pick{
  width:92px;height:92px;border-radius:50%;border:none;background:var(--surface-2);color:var(--text-faint);
  cursor:pointer;display:flex;align-items:center;justify-content:center;overflow:hidden;padding:0;
}
.avatar-pick img{width:100%;height:100%;object-fit:cover;}
.avatar-pick svg{width:34px;height:34px;}
.avatar-actions{display:flex;justify-content:center;gap:14px;margin-top:8px;}
.linklike{background:none;border:none;color:var(--link);font-size:.8rem;font-weight:600;cursor:pointer;padding:4px;font-family:inherit;}
.linklike:hover{text-decoration:underline;}
.linklike.danger{color:var(--danger);}

/* ===== חלון הודעה/אישור ===== */
.dialog-box{max-width:380px;}
.dialog-msg{font-size:.9rem;color:var(--text-dim);line-height:1.6;white-space:pre-line;margin-top:6px;}
#dialogCopy{margin-top:12px;font-size:.8rem !important;}

/* ===== טוסט ===== */
.toast{
  position:fixed;left:50%;bottom:calc(84px + env(safe-area-inset-bottom));transform:translateX(-50%) translateY(20px);
  background:var(--toast-bg);color:var(--toast-text);padding:11px 18px;border-radius:10px;
  font-size:.85rem;font-weight:600;box-shadow:0 4px 18px rgba(0,0,0,.25);
  opacity:0;pointer-events:none;transition:opacity .2s, transform .2s;z-index:2000;
  max-width:90vw;text-align:center;
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0);}

/* ===== חיתוך תמונה ===== */
#cropStage{
  position:relative;width:260px;height:260px;max-width:100%;margin:12px auto 4px;
  border-radius:50%;overflow:hidden;background:#111;touch-action:none;cursor:grab;
  box-shadow:0 0 0 3px var(--border);
}
#cropStage.dragging{cursor:grabbing;}
#cropImg{position:absolute;top:0;left:0;user-select:none;pointer-events:none;}
#cropZoom{width:100%;margin-top:10px;accent-color:var(--accent);}

/* תג "פותח ע״י Xnet" (xnet-badge.js) יושב כברירת מחדל בפינה השמאלית התחתונה - בדיוק על
   כפתור המיקרופון. בטלפון מרימים אותו מעל שורת ההקלטה, ובמחשב מעבירים לתחתית רשימת המערכות. */
.xnet-badge{bottom:calc(84px + env(safe-area-inset-bottom)) !important;left:12px !important;}
@media (min-width:900px){
  .xnet-badge{bottom:18px !important;left:auto !important;right:18px !important;}
}
body:has(.ov.open) .xnet-badge{display:none !important;}

@media (prefers-reduced-motion: reduce){
  *{transition:none !important;animation:none !important;}
}

/* במחשב הבועות קצת רחבות יותר (חייב להופיע אחרי ההגדרה הרגילה של הבועה) */
@media (min-width:900px){
  .rec-bubble, .transcript-wrap{width:380px;}
}
