
:root {
  color-scheme: dark;
  --bg: #08101f;
  --panel: rgba(14, 23, 41, 0.92);
  --panel-2: #101b31;
  --line: #22314d;
  --line-2: #2f4467;
  --text: #edf2ff;
  --muted: #97a5bd;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 18px;
  --shadow: 0 10px 28px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: radial-gradient(circle at top, #14254b 0%, #08101f 40%, #04070f 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; }
button {
  border: 0;
  border-radius: 14px;
  padding: 11px 14px;
  color: #fff;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease, background-color .12s ease, border-color .12s ease;
}
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: default; transform: none; }
input, textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 19, 33, .96);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
textarea { resize: vertical; min-height: 86px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; }

.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); }
.secondary { background: #1d4ed8; }
.success { background: var(--success); }
.danger { background: var(--danger); }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.dangerText { color: #ffb0b0; border-color: rgba(220,38,38,.35); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.wideBtn, .compactWideBtn { width: 100%; }
.compactBtn { padding: 10px 12px; }
.iconCircle, .iconSquare {
  width: 42px;
  min-width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 10px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.pill.offline { border-color: rgba(220,38,38,.45); color: #ffc1c1; }

.appShell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
}
.appHeaderPlain {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 0;
}
.appHeaderActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.appTitleBlock {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.appTitleRow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.headerNotifBtn {
  white-space: nowrap;
  flex: 0 0 auto;
}
.appTitle {
  font-size: clamp(22px, 5vw, 28px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.03em;
}
.appSubtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.surface {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}
.surfaceHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.surfaceHead h2, .surfaceHead h3 {
  margin: 0;
  font-size: 16px;
}
.compactHead { margin-bottom: 8px; }
.compactStack { display: grid; gap: 10px; }
.authTabs, .modeSwitchRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tabs .tab, .modeBtn {
  background: rgba(18,28,49,.9);
  border: 1px solid var(--line);
}
.tabs .active, .modeBtn.active { background: rgba(37,99,235,.22); border-color: rgba(59,130,246,.55); }
.tabPane { display: none; margin-top: 10px; }
.tabPane.active { display: grid; }
.authHead { margin-bottom: 8px; }

.iosInstallGuide {
  display: grid;
  gap: 10px;
  border-color: rgba(59,130,246,.35);
  background: linear-gradient(180deg, rgba(21,34,61,.96), rgba(12,19,33,.96));
}
.iosInstallGuideHead {
  align-items: flex-start;
}
.iosInstallSteps {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 8px;
  color: var(--text);
}
.iosInstallSteps li::marker {
  color: #9fc2ff;
  font-weight: 700;
}
.iosInstallSteps strong {
  color: #fff;
}

.profileCard { padding: 10px 12px; }
.profileRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.profileInfoCompact { min-width: 0; }
.profileName {
  font-size: 18px;
  line-height: 1.15;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profileNumberLine {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profileMenuCompact {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}
.profileMenuBtn {
  font-size: 22px;
  line-height: 1;
}
.techHidden { display: none !important; }

.mainPanel { display: grid; gap: 10px; }
.interactionCard { display: grid; gap: 10px; }
.contactsRail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  min-height: 88px;
}
.contactsRail::-webkit-scrollbar { height: 8px; }
.contactsRail::-webkit-scrollbar-thumb { background: rgba(151,165,189,.25); border-radius: 999px; }
.contactCard {
  position: relative;
  flex: 0 0 160px;
  min-width: 160px;
}
.contactItem {
  width: 100%;
  min-height: 88px;
  padding: 11px 42px 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(12, 19, 33, .94);
  text-align: left;
  display: grid;
  gap: 5px;
}
.contactItem.active { border-color: rgba(59,130,246,.75); background: rgba(29,78,216,.18); }
.contactGear {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(151,165,189,.18);
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.contactTitleRow, .contactName, .contactNumber, .contactMeta {
  min-width: 0;
}
.contactName {
  display: block;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contactNumber, .contactMeta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contactMeta { font-size: 12px; }

.workspaceCard { display: grid; gap: 10px; overflow: visible; }
.incomingBanner {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  width: min(calc(100vw - 20px), 980px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(29,78,216,.34), rgba(8,16,31,.97));
  border: 1px solid rgba(59,130,246,.48);
  box-shadow: 0 18px 36px rgba(0,0,0,.38);
}
.incomingCopy { min-width: 0; }
.incomingTitle { font-weight: 700; margin-bottom: 4px; }
.incomingActions { display: flex; gap: 8px; flex-wrap: wrap; }
.modeSection { display: grid; gap: 8px; }
.emptyState {
  padding: 18px 14px;
  border: 1px dashed rgba(151,165,189,.28);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  background: rgba(7, 13, 25, .45);
}
.chatPanelSection {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(59,130,246,.18);
  background: linear-gradient(180deg, rgba(6, 12, 24, .92), rgba(12, 21, 38, .96));
}
.messages {
  display: grid;
  gap: 8px;
  max-height: min(42vh, 440px);
  overflow-y: auto;
  overscroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 2px 0;
}
.messageItem {
  display: grid;
  gap: 4px;
  justify-items: start;
}
.messageItem.out { justify-items: end; }
.messageBubble {
  max-width: min(100%, 560px);
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(12,19,33,.95);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
}
.messageItem.out .messageBubble {
  background: rgba(37,99,235,.22);
  border-color: rgba(59,130,246,.42);
}
.messageMeta { font-size: 12px; color: var(--muted); }
.composer { display: grid; gap: 8px; }
.composerActions { display: flex; justify-content: flex-end; }

.callHead {
  align-items: flex-start;
}
.callHeadActions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.compactInfo { font-size: 13px; }
.videoGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.videoBox {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(5,10,20,.88);
  overflow: hidden;
  min-height: 176px;
  position: relative;
}
.videoLabel {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(7,13,25,.78);
  color: var(--muted);
  font-size: 11px;
}
video {
  width: 100%;
  height: 100%;
  min-height: 176px;
  object-fit: cover;
  background: #02050b;
}
.callPrimaryBar {
  display: grid;
  gap: 8px;
}
.callControls { display: grid; gap: 8px; }
.callActions, .toggleGrid { display: grid; gap: 8px; }
.callActions { grid-template-columns: 1fr; }
.toggleGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.logBox {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 12px;
  color: #c7d3ea;
}
.logBoxModal {
  max-height: min(60vh, 520px);
  padding: 12px;
  border-radius: 16px;
  background: rgba(7, 13, 25, .92);
  border: 1px solid var(--line);
}

.modalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 15, .7);
  backdrop-filter: blur(3px);
  z-index: 40;
}
.modalSheet {
  position: fixed;
  inset: auto 0 0;
  padding: 12px;
  z-index: 50;
}
.modalCard {
  width: min(100%, 480px);
  margin: 0 auto;
  background: rgba(14, 23, 41, .98);
  border: 1px solid var(--line);
  border-radius: 22px 22px 18px 18px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  gap: 12px;
}
.modalCardWide {
  width: min(100%, 760px);
}
.menuTitle {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menuTitleGroup {
  display: grid;
  gap: 4px;
}
.modalActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.modalActions.stacked { grid-template-columns: 1fr; }

@media (min-width: 560px) {
  .appShell { padding-inline: 14px; }
  .surface { padding: 14px; }
  .contactCard { flex-basis: 188px; min-width: 188px; }
  .callPrimaryBar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .callActions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .videoGrid { grid-template-columns: 1.35fr .9fr; }
}

@media (min-width: 820px) {
  .appShell { gap: 12px; padding-inline: 18px; }
  .appHeaderPlain { padding-inline: 6px; }
  .mainPanel { gap: 12px; }
  .interactionCard { gap: 12px; }
  .workspaceCard { gap: 12px; }
  .messages { max-height: 48vh; }
  .videoBox, video { min-height: 220px; }
}
