/* Desktop retains the side-by-side workspace. Calls have a separate action row on phones. */
.group-call-content {
 display:contents;
}

.group-call-progress {
 display:flex;
 flex-wrap:wrap;
 align-items:center;
 justify-content:center;
 gap:8px;
}

:root[data-theme] body #group-call-panel .group-call-progress #group-call-state {
 margin:0;
}

#group-call-panel.is-minimized .group-call-content {
 display:none;
}

@media (min-width:701px) and (min-height:581px) {
 #group-call-panel .group-controls {order:1}
 #group-call-panel :is(.call-more,.group-script,#group-received-script,#group-feedback) {order:2}
}

@media (max-width:960px) {
 :root[data-theme] body:not(.admin-portal) {
  --phone-canvas:#f4f6fb;
  --phone-surface:#fff;
  --phone-field:#edf1f8;
  --phone-rule:#dce3ef;
  --phone-ink:#171f32;
  --phone-muted:#526077;
  --phone-accent:#2455d9;
  --phone-on-accent:#fff;
  --phone-selection:#e5edff;
  --phone-dock-height:64px;
  --phone-gutter:clamp(12px,3.8vw,22px);
  color:var(--phone-ink);
  background:var(--phone-canvas);
 }

 :root[data-theme="dark"] body:not(.admin-portal) {
  --phone-canvas:#101421;
  --phone-surface:#171d2c;
  --phone-field:#222b3e;
  --phone-rule:#34415a;
  --phone-ink:#f3f6ff;
  --phone-muted:#b0bcd2;
  --phone-accent:#8eaaff;
  --phone-on-accent:#10214d;
  --phone-selection:#24365e;
 }

 :root[data-theme] body:not(.admin-portal)>header {
  color:var(--phone-ink);
  background:var(--phone-surface);
  border-color:var(--phone-rule);
  box-shadow:none;
 }

 :root[data-theme] body.workspace-open:not(.admin-portal)>main {
  width:min(100%,640px);
  max-width:none;
  padding:14px max(var(--phone-gutter),env(safe-area-inset-right))
   calc(var(--phone-dock-height) + env(safe-area-inset-bottom) + 22px)
   max(var(--phone-gutter),env(safe-area-inset-left));
 }

 :root[data-theme] body.workspace-open #section-tabs {
  position:fixed;
  z-index:50;
  inset:auto 0 0;
  display:flex;
  justify-content:space-evenly;
  align-items:stretch;
  gap:4px;
  width:min(100%,640px);
  height:calc(var(--phone-dock-height) + env(safe-area-inset-bottom));
  max-height:none;
  min-height:0;
  margin:0 auto;
  padding:5px max(8px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
  border:1px solid var(--phone-rule);
  border-bottom:0;
  border-radius:18px 18px 0 0;
  background:var(--phone-surface);
  box-shadow:0 -4px 20px #14224613;
 }

 :root[data-theme] body.workspace-open #section-tabs button {
  flex:1 1 0;
  min-width:0;
  min-height:44px;
  padding:5px 2px;
  gap:3px;
  border-radius:12px;
  color:var(--phone-muted);
  font-size:clamp(9px,2.65vw,12px);
  line-height:1.15;
 }

 :root[data-theme] body.workspace-open #section-tabs button span {font-size:inherit}

 :root[data-theme] body.workspace-open #section-tabs button[aria-selected="true"] {
  color:var(--phone-accent);
  background:var(--phone-selection);
  box-shadow:none;
 }

 :root[data-theme] body.workspace-open .workspace-heading {
  margin:4px 0 14px;
  min-height:0;
 }

 :root[data-theme] body.workspace-open .workspace-heading :is(.eyebrow,.workspace-label) {display:none}

 :root[data-theme] body.workspace-open .workspace-heading h1 {
  margin:0;
  color:var(--phone-ink);
  font-size:clamp(25px,6.8vw,35px);
  line-height:1.16;
 }

 :root[data-theme] body.workspace-open .phone-panel:not(#panel-messages) .card {
  background:var(--phone-surface);
  color:var(--phone-ink);
  border:1px solid var(--phone-rule);
  border-radius:18px;
  box-shadow:none;
 }

 :root[data-theme] body.workspace-open .phone-panel:not(#panel-messages) :is(.hint,label,summary) {
  color:var(--phone-muted);
 }

 :root[data-theme] body.workspace-open .phone-panel:not(#panel-messages) :is(input,select,textarea):not([type="checkbox"],[type="radio"]) {
  min-height:44px;
  font-size:16px;
 }

 :root[data-theme] body.workspace-open .phone-panel:not(#panel-messages) button:not([hidden]) {min-height:44px}
}

@media (max-width:700px) {
 :root[data-theme] body:not(.admin-portal)>main :is(footer,.footer-quote) {display:none}

 :root[data-theme] body.workspace-open #panel-keypad .dialer-card {
  padding:16px;
 }

 :root[data-theme] body.workspace-open #panel-keypad #dialer-number {
  padding:12px 8px;
  border:1px solid var(--phone-rule);
  border-radius:14px;
  background:var(--phone-field);
  color:var(--phone-ink);
  font-size:clamp(18px,5vw,24px);
  letter-spacing:.02em;
 }

 :root[data-theme] body.workspace-open #panel-keypad .dial-pad {
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
 }

 :root[data-theme] body.workspace-open #panel-keypad .dial-pad button {
  width:100%;
  height:56px;
  border-radius:13px;
  background:var(--phone-field);
  border:1px solid transparent;
  color:var(--phone-ink);
  font-size:25px;
 }

 :root[data-theme] body.workspace-open #panel-keypad .dial-pad button:is(:hover,:active) {
  border-color:var(--phone-accent);
  background:var(--phone-selection);
 }

 :root[data-theme] body.workspace-open:has(#panel-messages:not([hidden])) {
  background:var(--phone-canvas);
 }

 :root[data-theme] body #panel-messages {
  --chat-blue:var(--phone-accent);
  --chat-blue-soft:var(--phone-selection);
  --chat-received:var(--phone-field);
  --chat-glass:var(--phone-surface);
  --chat-canvas:var(--phone-canvas);
  --chat-compose:var(--phone-surface);
  --ui-text:var(--phone-ink);
  --ui-muted:var(--phone-muted);
  --ui-border:var(--phone-rule);
  --ui-surface:var(--phone-surface);
  --ui-surface-alt:var(--phone-field);
  color:var(--phone-ink);
 }

 :root[data-theme] body #panel-messages:not(.chat-open) .messages-card {
  min-height:0;
  background:transparent;
 }

 :root[data-theme] body #panel-messages:not(.chat-open) .message-inbox {
  height:auto;
  min-height:0;
  padding:0;
  background:transparent;
 }

 :root[data-theme] body #panel-messages .message-inbox-heading {margin:4px 0 12px}

 :root[data-theme] body #panel-messages .message-inbox-heading h2 {
  margin:0;
  font-size:clamp(26px,7vw,34px);
  letter-spacing:-.035em;
 }

 :root[data-theme] body #panel-messages #message-refresh {
  width:44px;
  height:44px;
  min-height:44px;
  background:var(--phone-surface);
  color:var(--phone-accent);
  border:1px solid var(--phone-rule);
  border-radius:14px;
 }

 :root[data-theme] body #panel-messages .inbox-search {
  position:relative;
  margin:0 0 12px;
 }

 /* Search lens is decorative; the input owns the accessible label. */
 :root[data-theme] body #panel-messages .inbox-search::before {
  content:"";
  position:absolute;
  top:16px;
  left:14px;
  width:12px;
  height:12px;
  border:2px solid var(--phone-muted);
  border-radius:50%;
  pointer-events:none;
 }

 :root[data-theme] body #panel-messages .inbox-search::after {
  content:"";
  position:absolute;
  top:29px;
  left:26px;
  width:7px;
  height:2px;
  border-radius:2px;
  background:var(--phone-muted);
  transform:rotate(45deg);
  pointer-events:none;
 }

 :root[data-theme] body #panel-messages #message-search {
  display:block;
  width:100%;
  min-height:46px;
  margin:0;
  padding:9px 14px 9px 42px;
  border:1px solid var(--phone-rule);
  border-radius:14px;
  background:var(--phone-surface);
  color:var(--phone-ink);
  font-size:16px;
 }

 :root[data-theme] body #panel-messages #message-search::placeholder {color:var(--phone-muted)}

 :root[data-theme] body #panel-messages:not(.chat-open) #message-conversations {
  max-height:none;
  overflow:visible;
  scrollbar-gutter:auto;
  border:1px solid var(--phone-rule);
  border-radius:18px;
  background:var(--phone-surface);
 }

 :root[data-theme] body #panel-messages #message-conversations>.empty {
  margin:0;
  padding:26px 18px;
  color:var(--phone-muted);
  text-align:left;
 }

 :root[data-theme] body #panel-messages .conversation-row {
  width:100%;
  min-height:68px;
  padding:10px 12px;
  margin:0;
  gap:12px;
  border:0;
  border-radius:0;
  color:var(--phone-ink);
  background:transparent;
  text-align:left;
  scroll-margin-bottom:calc(var(--phone-dock-height) + env(safe-area-inset-bottom) + 12px);
 }

 :root[data-theme] body #panel-messages .conversation-row+.conversation-row {border-top:1px solid var(--phone-rule)}
 :root[data-theme] body #panel-messages .conversation-row:first-child {border-radius:17px 17px 0 0}
 :root[data-theme] body #panel-messages .conversation-row:last-child {border-radius:0 0 17px 17px}
 :root[data-theme] body #panel-messages .conversation-row:only-child {border-radius:17px}
 :root[data-theme] body #panel-messages .conversation-row:is(.selected,:active) {background:var(--phone-selection)}

 :root[data-theme] body #panel-messages .conversation-row .conversation-avatar {
  order:0;
  flex:none;
  width:44px;
  height:44px;
  border:0;
  border-radius:15px;
  background:var(--phone-selection);
  color:var(--phone-accent);
 }

 :root[data-theme] body #panel-messages .conversation-content {order:1;min-width:0}
 :root[data-theme] body #panel-messages .conversation-chevron {display:none}

 :root[data-theme] body #panel-messages .conversation-heading strong {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:15px;
 }

 :root[data-theme] body #panel-messages .conversation-heading time {
  color:var(--phone-muted);
  flex-shrink:0;
  font-size:11px;
 }

 :root[data-theme] body #panel-messages .conversation-preview {
  margin-top:3px;
  color:var(--phone-muted);
  font-size:13px;
 }

 :root[data-theme] body #panel-messages .conversation-row .unread-count {
  position:static;
  order:2;
  flex:none;
  min-width:20px;
  min-height:20px;
  padding:2px 5px;
  background:var(--phone-accent);
  color:var(--phone-on-accent);
  font-size:10px;
 }

 :root[data-theme] body #panel-messages.chat-open:not([hidden]) {
  height:100%;
  height:100dvh;
  background:var(--phone-canvas);
 }

 :root[data-theme] body #panel-messages.chat-open .message-chat {
  padding:env(safe-area-inset-top) max(12px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  color:var(--phone-ink);
 }

 :root[data-theme] body #panel-messages .message-chat-heading {
  box-sizing:border-box;
  min-height:66px;
  gap:6px;
  margin:0 -12px;
  padding:9px 12px;
 }

 :root[data-theme] body #panel-messages .chat-profile {gap:2px 8px}

 :root[data-theme] body #panel-messages .chat-profile .conversation-avatar {
  background:var(--phone-selection);
  color:var(--phone-accent);
  border:0;
  border-radius:13px;
 }

 :root[data-theme] body #panel-messages .message-chat-heading h2 {color:var(--phone-ink);font-size:15px}
 :root[data-theme] body #panel-messages .message-chat-heading .hint {color:var(--phone-muted)}
 :root[data-theme] body #panel-messages #message-thread {gap:8px;padding:16px 0}

 :root[data-theme] body #panel-messages .message-bubble.mine {
  background:var(--phone-accent);
  color:var(--phone-on-accent);
 }

 :root[data-theme] body #panel-messages #message-form {border-radius:20px}

 :root[data-theme] body #panel-messages #message-send {
  background:var(--phone-accent);
  color:var(--phone-on-accent);
 }

 :root[data-theme] body #panel-messages :is(button,input,textarea):focus-visible {
  outline:2px solid var(--phone-accent);
  outline-offset:2px;
 }
}

@media (max-width:700px), (max-height:580px) {
 :root[data-theme] body #group-call-panel:not(.is-minimized) {
  box-sizing:border-box;
  inset:0 0 auto;
  width:100%;
  height:100%;
  height:100dvh;
  max-height:100dvh;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  justify-content:flex-start;
  gap:0;
  padding:0;
  overflow:hidden;
  background:radial-gradient(ellipse at 52% 20%,#252e55 0%,#151b2e 49%,#0e1320 84%);
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) .group-call-content {
  box-sizing:border-box;
  display:flex;
  flex:1 1 auto;
  min-height:0;
  flex-direction:column;
  align-items:center;
  gap:12px;
  overflow:auto;
  overscroll-behavior:contain;
  padding:max(14px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) 12px max(14px,env(safe-area-inset-left));
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) #group-minimize {
  right:max(12px,env(safe-area-inset-right));
  top:max(8px,env(safe-area-inset-top));
  min-height:44px;
  z-index:2;
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) .group-heading {
  flex:none;
  padding-top:40px;
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) .group-heading h2 {
  margin:0 0 8px;
  font-size:clamp(28px,7.8vw,40px);
  line-height:1.08;
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) #group-call-clock {
  font-size:15px;
  color:#e9edfd;
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) .group-videos {flex:none}

 :root[data-theme] body #group-call-panel:not(.is-minimized) .group-videos[data-video="false"] .group-tile {
  min-height:132px;
  padding:12px;
  border-radius:18px;
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) .group-videos[data-video="false"][data-people="2"] .remote-preview {
  min-height:146px;
  padding:12px;
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) .group-videos[data-video="false"][data-people="2"] .remote-preview::before {
  width:clamp(74px,23vw,108px);
  height:clamp(74px,23vw,108px);
  background:radial-gradient(circle at 50% 36%,#e4eaff 0 16%,transparent 17%),radial-gradient(ellipse at 50% 95%,#e4eaff 0 33%,transparent 34%),linear-gradient(145deg,#5a73bf,#354573);
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) .group-videos[data-video="true"] {
  min-height:128px;
  height:clamp(128px,44vh,440px);
  height:clamp(128px,44dvh,440px);
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) .group-controls {
  position:relative;
  z-index:3;
  flex:none;
  align-self:center;
  flex-wrap:wrap;
  width:calc(100% - 20px);
  max-width:570px;
  margin:0 max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
  padding:6px;
  gap:5px;
  border-color:#505a78;
  border-radius:18px;
  background:#20283f;
  box-shadow:0 -4px 22px #05091350;
 }

 :root[data-theme] body #group-call-panel:not(.is-minimized) .group-controls button {
  flex:1 1 44px;
  min-width:44px;
  min-height:52px;
  min-height:clamp(48px,9dvh,58px);
  padding:5px 2px;
  border-radius:12px;
  font-size:10px;
 }

 :root[data-theme] body #peer-call-panel:not([hidden]) {
  box-sizing:border-box;
  height:100%;
  height:100dvh;
  padding-bottom:max(16px,env(safe-area-inset-bottom));
  overflow:auto;
 }
}
