.app, .sidebar { transition:padding-left .2s ease,width .2s ease; }
.sidebar { overflow:hidden; }
.sidebar-head { position:relative; display:grid; flex:0 0 auto; border-bottom:1px solid #29316d; }
.sidebar-head .logo { min-width:0; border-bottom:0; padding-bottom:12px; overflow:hidden; white-space:nowrap; }
.sidebar-collapse { position:static; width:calc(100% - 16px); height:29px; margin:0 8px 9px; border:1px solid #38437c; border-radius:8px; background:#121b62; color:#aeb8d5; display:grid; place-items:center; }
.sidebar-collapse svg { width:17px; height:17px; }
.sidebar-collapse:hover { background:#26337d; border-color:#6876ba; }
.sidebar nav { flex:1 1 auto; min-height:0; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:#46518a transparent; padding:0 5px 12px 0; margin:10px -5px 0 0; gap:2px; }
.nav-item { height:40px; }
.nav-item i { border:0; color:#9da8c8; }
.nav-item i .nav-svg { width:19px; height:19px; display:block; }
.nav-item.active i { color:#ff8172; }
.sidebar nav::-webkit-scrollbar { width:6px; }
.sidebar nav::-webkit-scrollbar-thumb { background:#46518a; border-radius:8px; }
.side-user { flex:0 0 auto; background:var(--nav); }
.app.sidebar-collapsed { padding-left:76px; }
.sidebar-collapsed .sidebar { width:76px; padding-left:10px; padding-right:10px; }
.sidebar-collapsed .sidebar-head .logo { padding-left:4px; padding-right:0; }
.sidebar-collapsed .sidebar-head .logo > span:last-child { display:none; }
.sidebar-collapsed .sidebar-collapse { width:38px; margin:0 auto 9px; }
.sidebar-collapsed .sidebar nav { padding-right:0; margin-right:0; }
.sidebar-collapsed .nav-item { grid-template-columns:1fr; padding:0; }
.sidebar-collapsed .nav-item i { margin:auto; }
.sidebar-collapsed .nav-item b { display:none; }
.sidebar-collapsed .side-user { grid-template-columns:1fr; padding-left:0; padding-right:0; }
.sidebar-collapsed .side-user > span { margin:auto; }
.sidebar-collapsed .side-user div { display:none; }
.sidebar-collapsed .side-user button { padding:7px 0; text-align:center; font-size:0; }
.sidebar-collapsed .side-user button:after { content:"↪"; font-size:17px; color:#9fa9c7; }
.tenant-switch { display:flex; align-items:center; gap:8px; color:#687183; font-size:10px; }
.tenant-switch select { height:34px; max-width:260px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink); padding:0 28px 0 10px; font-weight:700; }
.check { display:flex; gap:8px; align-items:center; color:#596274; font-size:11px; }
.check input { width:16px; height:16px; }
.object > span:last-child { display:flex; align-items:center; gap:4px; }
.object > span:last-child button:first-child { color:#3258b6; }
.chat-layout { display:grid; grid-template-columns:minmax(260px,340px) 1fr; gap:15px; min-height:620px; }
.chat-list { overflow:hidden; }
.chat-thread { width:100%; border:0; border-bottom:1px solid var(--line); background:#fff; padding:13px 18px; text-align:left; display:grid; gap:5px; color:var(--ink); }
.chat-thread b { font-size:11px; }
.chat-thread small { font-size:9px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-thread.active { background:#eef1ff; box-shadow:inset 3px 0 var(--brand); }
.chat-panel { display:flex; flex-direction:column; min-width:0; }
.chat-messages { flex:1; min-height:430px; max-height:65vh; overflow:auto; padding:20px; display:flex; flex-direction:column; gap:10px; background:#f9fafc; }
.chat-message { align-self:flex-start; max-width:min(75%,620px); background:#fff; border:1px solid var(--line); border-radius:4px 13px 13px 13px; padding:10px 12px; box-shadow:var(--shadow); }
.chat-message.mine { align-self:flex-end; background:#182463; color:#fff; border-color:#182463; border-radius:13px 4px 13px 13px; }
.chat-message b, .chat-message small { font-size:9px; }
.chat-message p { font-size:12px; line-height:1.45; margin:5px 0; white-space:pre-wrap; overflow-wrap:anywhere; }
.chat-message small { opacity:.7; }
.chat-compose { display:grid; grid-template-columns:1fr auto; gap:10px; padding:14px; border-top:1px solid var(--line); }
.chat-compose textarea { min-height:48px; max-height:140px; resize:vertical; border:1px solid var(--line); border-radius:9px; padding:10px; }
.chat-placeholder { margin:auto; }
.login-form #tenant-code-field { opacity:.8; }
.presence-number.available { color:var(--green); }
.presence-number.busy { color:var(--red); }
.presence-number.ringing { color:var(--amber); }
.presence-toolbar { gap:18px; align-items:end; }
.presence-filters { display:flex; gap:8px; margin-left:auto; }
.presence-filters input, .presence-filters select { height:38px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink); padding:0 11px; font-size:10px; }
.presence-filters input { width:min(300px,32vw); }
.presence-badge { display:inline-flex; align-items:center; gap:6px; border-radius:16px; padding:5px 8px; font-size:9px; font-weight:800; white-space:nowrap; background:#f0f2f5; color:#677180; }
.presence-badge i { width:7px; height:7px; border-radius:50%; background:#9ba3af; }
.presence-badge.available { background:#e7f7f1; color:#087c58; }
.presence-badge.available i { background:var(--green); box-shadow:0 0 0 3px #d3f1e6; }
.presence-badge.ringing { background:#fff5df; color:#9a6510; }
.presence-badge.ringing i { background:var(--amber); animation:pulse 1s infinite; }
.presence-badge.busy { background:#fff0f1; color:#b62f40; }
.presence-badge.busy i { background:var(--red); }
.presence-badge.dnd { background:#eeeefe; color:#4a4ca8; }
.presence-badge.dnd i { background:#6568cf; }
.presence-table td { vertical-align:middle; }
.presence-table .contact-uri { display:block; max-width:240px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); }
.presence-foot { display:flex; align-items:center; justify-content:space-between; border-top:1px solid var(--line); color:var(--muted); font-size:10px; }
.presence-foot span { display:flex; align-items:center; gap:8px; }
.outbound-layout { grid-template-columns:minmax(520px,1.35fr) minmax(320px,.65fr); }
.route-row { display:grid; grid-template-columns:68px minmax(180px,1.4fr) 110px minmax(120px,.8fr) minmax(130px,.8fr); gap:8px; align-items:end; border:1px solid var(--line); border-radius:10px; padding:10px; background:#f9fafc; }
.route-row > b { align-self:center; font-size:10px; color:var(--ink); }
.field.compact input { min-width:0; }
.inline-search { display:flex; gap:8px; align-items:center; }
.inline-search input { height:38px; min-width:260px; border:1px solid var(--line); border-radius:8px; padding:0 11px; }
.call-filters { display:grid; grid-template-columns:minmax(210px,1.5fr) repeat(4,minmax(130px,.75fr)) auto; gap:10px; align-items:end; padding:12px 18px; border-bottom:1px solid var(--line); }
.call-filters label { display:grid; gap:5px; color:var(--muted); font-size:9px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.call-filters input, .call-filters select { width:100%; height:38px; min-width:0; border:1px solid var(--line); border-radius:8px; padding:0 10px; background:#fff; color:var(--ink); }
.call-filter-actions { display:flex; gap:7px; }
.call-direction.inbound { background:#e8f7f1; color:#087c58; }
.call-direction.outbound { background:#edf2ff; color:#3155a7; }
.call-direction.internal { background:#fff2e8; color:#a84f19; }
.modal-wide { width:min(900px,94vw); max-height:90vh; overflow:auto; }
.modal-wide form { padding-top:12px; }
.ai-platform { margin-top:15px; border-top:3px solid var(--brand); }
.ai-webhook { display:grid; gap:6px; padding:12px; border:1px solid var(--line); border-radius:10px; background:#f7f8fb; }
.ai-webhook code { display:block; padding:9px; border-radius:7px; background:#182463; color:#fff; overflow-wrap:anywhere; font-size:10px; user-select:all; }
.ai-webhook small { color:var(--muted); }
.ai-calls-table { min-width:1050px; }
.ai-call-summary { min-width:260px; max-width:420px; white-space:normal; line-height:1.4; }
.table-actions { display:flex; flex-wrap:wrap; gap:5px; min-width:210px; }
.ai-call-detail { padding:18px; }
.ai-call-detail h3 { margin:18px 0 7px; }
.ai-call-detail p { white-space:pre-wrap; line-height:1.55; }
.transcript { max-height:360px; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; padding:14px; border:1px solid var(--line); border-radius:9px; background:#f7f8fb; font:11px/1.6 ui-monospace,Consolas,monospace; }
.ai-transcript-dialog { display:flex; flex-direction:column; gap:10px; max-height:440px; overflow:auto; padding:14px; border:1px solid var(--line); border-radius:11px; background:#f7f8fb; }
.ai-transcript-turn { width:min(82%,680px); padding:10px 13px; border:1px solid var(--line); box-shadow:0 3px 12px rgba(18,30,65,.06); }
.ai-transcript-turn.assistant { align-self:flex-start; border-left:4px solid #e66742; border-radius:4px 13px 13px 13px; background:#fff3ee; }
.ai-transcript-turn.caller { align-self:flex-end; border-right:4px solid #182463; border-radius:13px 4px 13px 13px; background:#eef1ff; }
.ai-transcript-turn > div { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.ai-transcript-turn b { color:#182463; font-size:10px; }
.ai-transcript-turn.assistant b { color:#c74f2d; }
.ai-transcript-turn time { color:var(--muted); font-size:9px; }
.ai-transcript-turn p { margin:5px 0 0; font-size:12px; overflow-wrap:anywhere; }
.transcript-legacy > small { display:block; margin:0 0 6px; color:var(--muted); }
.security-callout { display:flex; align-items:flex-start; gap:12px; padding:12px 14px; border:1px solid #f1c7b8; border-radius:10px; background:#fff6f1; color:#6d4336; font-size:10px; line-height:1.5; }
.security-callout[hidden], #admin-tenants-field[hidden] { display:none !important; }
.security-callout b { color:#c74f2d; white-space:nowrap; }
.warning-check { padding:10px; border:1px solid #f0d29b; border-radius:9px; background:#fff9ec; color:#77551a; }
.destination-policy > .panel-body { display:grid; gap:14px; }
.destination-actions { justify-content:flex-start; }
.destination-groups { display:grid; gap:9px; }
.destination-groups details { border:1px solid var(--line); border-radius:10px; overflow:hidden; background:#fff; }
.destination-groups summary { display:flex; justify-content:space-between; align-items:center; cursor:pointer; padding:13px 15px; background:#f7f8fb; color:var(--ink); font-size:11px; }
.destination-groups summary span { color:var(--muted); font-size:9px; }
.destination-group-actions { display:flex; gap:6px; padding:10px 12px 0; }
.destination-group-actions button { color:#3258b6; }
.destination-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; padding:12px; }
.destination-item { display:flex; gap:8px; align-items:flex-start; min-width:0; padding:9px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.destination-item input { margin-top:2px; }
.destination-item span { min-width:0; display:grid; gap:3px; }
.destination-item b { font-size:10px; line-height:1.25; }
.destination-item small { color:var(--muted); font-size:9px; }
.topbar-actions { display:flex; align-items:center; gap:12px; color:var(--muted); font-size:10px; }
.theme-toggle { width:34px; height:34px; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--ink); font-size:17px; display:grid; place-items:center; }
.team-summary { display:flex; align-items:center; gap:11px; margin:-6px 0 15px; overflow:auto; }
.team-summary > span { display:inline-flex; align-items:center; gap:7px; min-width:max-content; padding:8px 11px; border:1px solid var(--line); border-radius:20px; background:#fff; color:var(--muted); font-size:10px; }
.team-summary b { color:var(--ink); }
.team-panel { overflow:hidden; }
.team-toolbar { padding:13px 15px; border-bottom:1px solid var(--line); display:grid; grid-template-columns:minmax(260px,1fr) auto auto auto auto; gap:8px; align-items:center; }
.team-toolbar select, .team-search { height:39px; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--ink); font-size:10px; }
.team-toolbar select { padding:0 30px 0 10px; }
.team-search { display:flex; align-items:center; gap:8px; padding:0 11px; }
.team-search > span { color:var(--muted); font-size:17px; }
.team-search input { width:100%; height:100%; border:0; outline:0; background:transparent; color:var(--ink); }
.team-favorites { display:flex; align-items:center; gap:6px; white-space:nowrap; color:var(--muted); font-size:10px; }
.view-switch { display:flex; gap:3px; padding:3px; border:1px solid var(--line); border-radius:9px; background:#f3f5f8; }
.view-switch button { width:31px; height:31px; border:0; border-radius:6px; background:transparent; color:var(--muted); }
.view-switch button.active { background:#fff; color:var(--brand); box-shadow:0 2px 8px rgba(15,25,70,.1); }
.team-directory { padding:16px; }
.team-directory.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(225px,1fr)); gap:12px; }
.team-person { position:relative; min-width:0; border:1px solid var(--line); border-radius:12px; background:#fff; padding:18px 13px 13px; display:flex; flex-direction:column; align-items:center; text-align:center; gap:10px; transition:transform .15s ease,box-shadow .15s ease,border-color .15s ease; }
.team-person:hover { transform:translateY(-2px); border-color:#bfc7d7; box-shadow:0 10px 25px rgba(19,29,67,.09); }
.favorite-button { position:absolute; top:8px; right:9px; width:29px; height:29px; border:0; background:transparent; color:#9da5b1; font-size:20px; }
.favorite-button.active { color:#efa923; }
.team-avatar { position:relative; display:grid; place-items:center; flex:0 0 auto; border-radius:50%; background:linear-gradient(145deg,#dce2ed,#b7c1d3); color:#fff; font-weight:850; overflow:visible; }
.team-avatar.large { width:68px; height:68px; font-size:18px; }
.team-avatar.small { width:38px; height:38px; font-size:11px; }
.team-avatar > img { position:absolute; inset:0; width:100%; height:100%; border-radius:50%; object-fit:cover; z-index:1; }
.presence-dot { width:9px; height:9px; border-radius:50%; background:#99a1ad; display:inline-block; flex:0 0 auto; }
.team-avatar .presence-dot { position:absolute; right:0; bottom:3px; z-index:2; width:11px; height:11px; border:2px solid #fff; }
.presence-dot.available { background:var(--green); }.presence-dot.busy { background:var(--red); }.presence-dot.ringing { background:var(--amber); }.presence-dot.dnd { background:#6568cf; }.presence-dot.offline { background:#9ba3af; }
.team-identity { min-width:0; display:grid; justify-items:center; gap:4px; }
.team-identity b { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.team-identity strong { color:var(--brand); font-size:11px; }
.team-identity small { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:9px; }
.team-actions { width:100%; display:flex; justify-content:center; gap:5px; margin-top:auto; padding-top:4px; }
.team-actions button { min-width:37px; height:34px; border:1px solid var(--line); border-radius:8px; background:#fff; color:#536078; display:inline-flex; align-items:center; justify-content:center; gap:5px; font-size:13px; }
.team-actions button:hover { border-color:#7685dc; color:#314ca2; background:#f1f3ff; }
.team-actions span { display:none; font-size:9px; font-weight:750; }
.team-directory.list { display:grid; gap:0; padding:0; }
.team-directory.list .team-person { min-height:70px; border-width:0 0 1px; border-radius:0; padding:9px 14px; display:grid; grid-template-columns:46px minmax(230px,1fr) auto; text-align:left; transform:none; }
.team-directory.list .team-avatar.large { width:44px; height:44px; font-size:12px; }
.team-directory.list .team-identity { grid-template-columns:auto auto; justify-items:start; align-items:center; gap:3px 8px; }
.team-directory.list .team-identity b { font-size:11px; }.team-directory.list .team-identity strong { font-size:10px; }
.team-directory.list .team-identity small { grid-column:1/2; }.team-directory.list .team-identity .presence-badge { grid-column:2/3; grid-row:2; }
.team-directory.list .team-actions { width:auto; margin:0; padding:0 35px 0 0; }
.team-directory.list .team-actions span { display:inline; }
.team-directory.list .favorite-button { top:20px; }
.team-empty-filter { padding:30px; text-align:center; color:var(--muted); font-size:11px; }
.extensions-layout { grid-template-columns:minmax(0,1fr) 330px; align-items:start; }
.extensions-layout > * { min-width:0; }
.extensions-layout .table-wrap { overflow-x:auto; }
.extensions-table { min-width:1000px; }
.call-destination { display:grid; gap:2px; }
.call-destination small { color:var(--muted); font-size:9px; white-space:nowrap; }
.extension-user { display:flex; align-items:center; gap:9px; min-width:180px; }
.extension-user > span:last-child { display:grid; gap:3px; }
.extension-user small { color:var(--muted); font-size:9px; }
.profile-avatar-editor { display:flex; align-items:center; gap:14px; padding:12px; margin-bottom:15px; border:1px solid var(--line); border-radius:11px; background:#f7f8fb; }
.profile-avatar-editor > div { display:grid; gap:5px; }.profile-avatar-editor small { color:var(--muted); font-size:9px; }.profile-avatar-editor div > span { display:flex; gap:7px; margin-top:4px; }

html[data-theme="dark"] { --paper:#17191d; --ink:#f2f4f8; --muted:#a7adb8; --line:#363a42; --shadow:0 8px 30px rgba(0,0,0,.22); color-scheme:dark; background:var(--paper); }
html[data-theme="dark"] body, html[data-theme="dark"] .app { background:var(--paper); }
html[data-theme="dark"] .topbar { background:rgba(31,34,39,.94); }
html[data-theme="dark"] .tenant-switch select { background:#23262b; color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] .btn, html[data-theme="dark"] .modal { background:#272a30; color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] .btn.primary { background:var(--brand); color:#fff; border-color:#e43d2a; }
html[data-theme="dark"] .secret { background:#1c1f24; }
html[data-theme="dark"] .card, html[data-theme="dark"] .panel, html[data-theme="dark"] .tabs, html[data-theme="dark"] .object, html[data-theme="dark"] .team-person, html[data-theme="dark"] .team-summary > span, html[data-theme="dark"] .team-toolbar select, html[data-theme="dark"] .team-search, html[data-theme="dark"] .theme-toggle, html[data-theme="dark"] .team-actions button, html[data-theme="dark"] .field input, html[data-theme="dark"] .field select, html[data-theme="dark"] .field textarea, html[data-theme="dark"] .presence-filters input, html[data-theme="dark"] .presence-filters select, html[data-theme="dark"] .inline-search input, html[data-theme="dark"] .call-filters input, html[data-theme="dark"] .call-filters select, html[data-theme="dark"] .chat-thread, html[data-theme="dark"] .destination-groups details, html[data-theme="dark"] .destination-item { background:#23262b; color:var(--ink); }
html[data-theme="dark"] .table th, html[data-theme="dark"] .destination-groups summary, html[data-theme="dark"] .ai-webhook, html[data-theme="dark"] .transcript, html[data-theme="dark"] .ai-transcript-dialog, html[data-theme="dark"] .route-row, html[data-theme="dark"] .profile-avatar-editor { background:#1d2025; color:var(--ink); }
html[data-theme="dark"] .table td, html[data-theme="dark"] .panel-head, html[data-theme="dark"] .chat-thread { border-color:var(--line); }
html[data-theme="dark"] .view-switch { background:#1c1f23; } html[data-theme="dark"] .view-switch button.active { background:#343840; }
html[data-theme="dark"] .team-actions button:hover { background:#30364b; color:#b9c6ff; }
html[data-theme="dark"] .team-avatar .presence-dot { border-color:#23262b; }
html[data-theme="dark"] .presence-badge { background:#343840; color:#d8dce4; }
html[data-theme="dark"] .chat-messages { background:#1d2025; }
html[data-theme="dark"] .chat-message { background:#292d33; }
html[data-theme="dark"] .chat-message.mine { background:#253279; }
html[data-theme="dark"] .ai-transcript-turn.assistant { background:#3a2924; } html[data-theme="dark"] .ai-transcript-turn.caller { background:#252c49; }
html[data-theme="dark"] .login-page, html[data-theme="dark"] .login-panel { background:#202328; }
html[data-theme="dark"] .health-orb { background:#2a2e34; border-color:#202328; }
html[data-theme="dark"] .security-callout { background:#3a2924; color:#f1c8b9; } html[data-theme="dark"] .warning-check { background:#3b321f; color:#f0d49b; }
@keyframes pulse { 50% { transform:scale(1.35); opacity:.55; } }

@media (max-width:1400px) {
  .extensions-layout { grid-template-columns:1fr; }
}

@media (max-width:900px) {
  .chat-layout { grid-template-columns:1fr; }
  .chat-list { max-height:none; }
  .tenant-switch span { display:none; }
  .tenant-switch select { max-width:150px; }
  .presence-toolbar { align-items:start; flex-direction:column; }
  .presence-filters { width:100%; margin:0; }
  .presence-filters input { width:100%; }
  .outbound-layout { grid-template-columns:1fr; }
  .route-row { grid-template-columns:1fr 1fr; }
  .route-row > b { grid-column:1/-1; }
  .destination-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .team-toolbar { grid-template-columns:1fr 1fr; }
  .team-search { grid-column:1/-1; }
}

@media (max-width:720px) {
  .sidebar-collapse { display:none; }
  .app.sidebar-collapsed { padding-left:0; }
  .sidebar-collapsed .sidebar { width:232px; padding:23px 15px; }
  .sidebar-collapsed .sidebar-head .logo { padding:0 8px 22px; }
  .sidebar-collapsed .sidebar-head .logo > span:last-child { display:inline; }
  .sidebar-collapsed .sidebar nav { padding:0 5px 12px 0; margin-right:-5px; }
  .sidebar-collapsed .nav-item { grid-template-columns:30px 1fr; padding:0 10px; }
  .sidebar-collapsed .nav-item i { margin:0; }
  .sidebar-collapsed .nav-item b { display:block; }
  .sidebar-collapsed .side-user { grid-template-columns:34px 1fr; padding:18px 8px 0; }
  .sidebar-collapsed .side-user > span { margin:0; }
  .sidebar-collapsed .side-user div { display:grid; }
  .sidebar-collapsed .side-user button { padding:7px 0; text-align:left; font-size:10px; }
  .sidebar-collapsed .side-user button:after { content:none; }
  .topbar-actions > span { display:none; }
  .team-directory.grid { grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); }
  .team-directory.list .team-person { grid-template-columns:46px minmax(0,1fr); }
  .team-directory.list .team-actions { grid-column:1/-1; justify-content:flex-start; padding:0; }
}

@media (max-width:560px) {
  .topbar > span:last-child { display:none; }
  .tenant-switch select { max-width:125px; }
  .chat-message { max-width:90%; }
  .presence-filters { flex-direction:column; }
  .inline-search { width:100%; flex-direction:column; align-items:stretch; }
  .inline-search input { min-width:0; width:100%; }
  .call-filters { grid-template-columns:1fr; }
  .call-filter-actions .btn { flex:1; }
  .route-row { grid-template-columns:1fr; }
  .destination-grid { grid-template-columns:1fr; }
  .destination-actions { flex-direction:column; align-items:stretch; }
  .team-toolbar { grid-template-columns:1fr; }
  .team-search { grid-column:auto; }
  .team-directory.grid { grid-template-columns:1fr; }
  .team-actions span { display:inline; }
  .team-directory.list .team-identity { grid-template-columns:1fr; }
  .team-directory.list .team-identity .presence-badge { grid-column:1; grid-row:auto; }
}
[hidden] { display:none !important; }

/* Portale personale e chat 6.2 */
.modern-chat { grid-template-columns:minmax(300px,360px) minmax(0,1fr); min-height:calc(100vh - 190px); }
.modern-chat .chat-list { display:flex; flex-direction:column; min-height:0; }
.chat-list-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 18px 10px; }
.chat-list-head h2 { margin:4px 0 0; font-size:16px; }
.chat-new-button { width:36px; height:36px; display:grid; place-items:center; border:0; border-radius:11px; background:var(--brand); color:#fff; font-size:23px; }
.chat-search { height:40px; display:flex; align-items:center; gap:8px; margin:0 14px 12px; padding:0 11px; border:1px solid var(--line); border-radius:11px; background:#f7f8fb; }
.chat-search > span { color:var(--muted); font-size:17px; }
.chat-search input { min-width:0; width:100%; border:0; outline:0; background:transparent; color:var(--ink); font-size:10px; }
.chat-new-form { margin:0 14px 12px; padding:12px; border:1px solid var(--line); border-radius:12px; background:#f7f8fb; }
.chat-thread-list { flex:1; min-height:0; overflow:auto; border-top:1px solid var(--line); }
.modern-chat .chat-thread { grid-template-columns:42px minmax(0,1fr) auto; align-items:center; gap:10px; min-height:68px; padding:10px 13px; }
.modern-chat .chat-thread > span:nth-child(2) { min-width:0; display:grid; gap:5px; }
.modern-chat .chat-thread b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
.modern-chat .chat-thread small { font-size:9px; }
.modern-chat .chat-thread time { align-self:start; padding-top:5px; color:var(--muted); font-size:8px; }
.modern-chat .chat-thread.active { background:#eef1ff; box-shadow:inset 4px 0 var(--brand); }
.chat-conversation-head { min-height:68px; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 16px; border-bottom:1px solid var(--line); }
.chat-peer { min-width:0; display:flex; align-items:center; gap:11px; }
.chat-peer > span:last-child { min-width:0; display:grid; gap:3px; }
.chat-peer b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.chat-peer small { color:var(--muted); font-size:9px; }
.chat-header-actions { display:flex; align-items:center; gap:6px; }
.chat-header-actions button { width:34px; height:34px; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--ink); }
.modern-chat .chat-messages { min-height:420px; max-height:calc(100vh - 365px); padding:24px; gap:12px; background:linear-gradient(145deg,#f8f9fc,#f2f4f9); }
.modern-chat .chat-message { min-width:120px; padding:10px 13px; border-radius:5px 16px 16px 16px; box-shadow:0 5px 18px rgba(19,29,67,.07); }
.modern-chat .chat-message.mine { border-radius:16px 5px 16px 16px; background:linear-gradient(145deg,#24358b,#182463); }
.modern-chat .chat-message p { margin:4px 0 7px; }
.modern-chat .chat-compose { padding:12px 14px; background:#fff; }
.modern-chat .chat-compose textarea { min-height:44px; border-radius:14px; background:#f7f8fb; line-height:22px; }
.modern-chat .chat-compose .btn { min-width:80px; border-radius:12px; }
.chat-placeholder { display:grid; justify-items:center; gap:8px; color:var(--muted); }
.chat-placeholder > span { width:68px; height:68px; display:grid; place-items:center; border-radius:50%; background:#eef1ff; color:var(--brand); font-size:28px; }
.chat-placeholder h3,.chat-placeholder p { margin:0; }

.table-subtitle { display:block; margin-top:3px; color:var(--muted); font-size:9px; }
.portal-hero { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:24px; border-top:3px solid var(--brand); }
.portal-profile { display:flex; align-items:center; gap:17px; }
.portal-profile h2 { margin:5px 0 4px; font-size:22px; }
.portal-profile p { margin:0 0 8px; color:var(--muted); font-size:10px; }
.portal-hero-actions { display:flex; gap:8px; }
.portal-stats { margin-top:15px; }
.portal-quick { margin-top:15px; }
.portal-quick-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; padding:16px; }
.portal-quick-grid button { min-height:110px; display:grid; justify-items:start; align-content:center; gap:6px; padding:16px; border:1px solid var(--line); border-radius:13px; background:#fff; color:var(--ink); text-align:left; transition:transform .15s ease,border-color .15s ease; }
.portal-quick-grid button:hover { transform:translateY(-2px); border-color:#7585dc; }
.portal-quick-grid i { width:36px; height:36px; display:grid; place-items:center; border-radius:10px; background:#eef1ff; color:var(--brand); font-size:17px; font-style:normal; }
.portal-quick-grid b { font-size:11px; }.portal-quick-grid small { color:var(--muted); font-size:9px; }
.contact-search { width:min(330px,45vw); margin:0; }
.contact-directory { display:grid; grid-template-columns:repeat(auto-fill,minmax(290px,1fr)); gap:10px; padding:16px; }
.contact-card { min-width:0; display:grid; grid-template-columns:46px minmax(0,1fr) auto; align-items:center; gap:12px; padding:14px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.contact-initials { width:46px; height:46px; display:grid; place-items:center; border-radius:50%; background:linear-gradient(145deg,#e9edf6,#c9d1e1); color:#53617a; font-weight:850; }
.contact-card > div { min-width:0; display:grid; gap:3px; }
.contact-card b,.contact-card small,.contact-card p { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.contact-card b { font-size:11px; }.contact-card small,.contact-card p { margin:0; color:var(--muted); font-size:9px; line-height:1.45; }
.contact-actions { display:flex; gap:5px; }
.contact-actions button,.contact-actions a { width:34px; height:34px; display:grid; place-items:center; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--brand); text-decoration:none; }
.voicemail-list { display:grid; }
.voicemail-item { display:grid; grid-template-columns:44px minmax(0,1fr) auto; align-items:center; gap:12px; padding:13px 17px; border-bottom:1px solid var(--line); }
.voicemail-item:last-child { border-bottom:0; }
.voicemail-icon { width:40px; height:40px; display:grid; place-items:center; border-radius:50%; background:#eef1ff; color:var(--brand); font-size:13px; }
.voicemail-item > div { display:grid; gap:4px; }.voicemail-item b { font-size:11px; }.voicemail-item small { color:var(--muted); font-size:9px; }
.meeting-card { max-width:780px; min-height:430px; margin:0 auto; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; padding:42px; text-align:center; }
.meeting-card > p { max-width:520px; color:var(--muted); }.meeting-card > strong { font-size:48px; letter-spacing:5px; color:var(--brand); }
.meeting-card > small { max-width:560px; color:var(--muted); line-height:1.5; }
.meeting-orb { width:82px; height:82px; display:grid; place-items:center; border-radius:50%; background:linear-gradient(145deg,#fff0ea,#ffd3c4); color:#d94b2f; font-size:34px; }
.meeting-note { max-width:780px; margin:15px auto 0; }
.portal-options { align-items:start; }
.portal-option-stack { display:grid; gap:15px; }
.personal-dnd { margin:18px 0; padding:12px; border:1px solid var(--line); border-radius:10px; }
.theme-choice { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:16px; }
.theme-choice button { display:grid; justify-items:center; gap:6px; padding:18px; border:2px solid var(--line); border-radius:12px; background:#fff; color:var(--ink); }
.theme-choice button.active { border-color:var(--brand); background:#fff5f1; }
.theme-choice span { font-size:24px; }.theme-choice b { font-size:10px; }
.sip-profile { display:grid; gap:0; }
.sip-profile > span { display:grid; gap:3px; padding:10px 0; border-bottom:1px solid var(--line); }
.sip-profile small { color:var(--muted); font-size:9px; }.sip-profile b { overflow-wrap:anywhere; font-size:10px; }
.sip-profile p { margin:14px 0 0; color:var(--muted); font-size:9px; line-height:1.5; }

html[data-theme="dark"] .chat-search,html[data-theme="dark"] .chat-new-form,html[data-theme="dark"] .modern-chat .chat-compose,html[data-theme="dark"] .modern-chat .chat-compose textarea,html[data-theme="dark"] .portal-quick-grid button,html[data-theme="dark"] .contact-card,html[data-theme="dark"] .contact-actions button,html[data-theme="dark"] .contact-actions a,html[data-theme="dark"] .theme-choice button,html[data-theme="dark"] .chat-header-actions button { background:#23262b; color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] .modern-chat .chat-thread.active { background:#292e49; }
html[data-theme="dark"] .modern-chat .chat-messages { background:linear-gradient(145deg,#1d2025,#202329); }
html[data-theme="dark"] .modern-chat .chat-compose textarea { color:var(--ink); }
html[data-theme="dark"] .portal-quick-grid i,html[data-theme="dark"] .voicemail-icon,html[data-theme="dark"] .chat-placeholder > span { background:#292e49; color:#bdc7ff; }
html[data-theme="dark"] .theme-choice button.active { background:#3a2924; border-color:var(--brand); }
html[data-theme="dark"] .contact-initials { background:linear-gradient(145deg,#3d424b,#30343b); color:#d9dee8; }
html[data-theme="dark"] .meeting-orb { background:linear-gradient(145deg,#3a2924,#4a3027); }

@media (max-width:900px) {
  .modern-chat { grid-template-columns:1fr; min-height:auto; }
  .modern-chat .chat-list { max-height:390px; }
  .modern-chat .chat-messages { max-height:55vh; }
  .portal-quick-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .portal-hero { align-items:flex-start; flex-direction:column; }
}
@media (max-width:560px) {
  .portal-quick-grid { grid-template-columns:1fr; }
  .portal-hero-actions,.meeting-card .form-actions { width:100%; flex-direction:column; }
  .portal-hero-actions .btn,.meeting-card .btn { width:100%; }
  .contact-search { width:100%; }
  .contact-directory { grid-template-columns:1fr; padding:10px; }
  .contact-card { grid-template-columns:42px minmax(0,1fr); }
  .contact-actions { grid-column:1/-1; }
  .voicemail-item { grid-template-columns:40px minmax(0,1fr); }
  .voicemail-item .table-actions { grid-column:1/-1; }
  .meeting-card { min-height:360px; padding:25px 18px; }.meeting-card > strong { font-size:36px; }
  .chat-header-actions .pill { display:none; }
}
