html {
  height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

@media (max-width: 720px) {
  .auth-shell,
  .status-shell {
    display: block;
    min-height: 100dvh;
    padding: 0;
    background: var(--bg);
  }

  .auth-panel,
  .status-panel {
    width: 100%;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 26px 22px calc(28px + env(safe-area-inset-bottom));
  }

  .auth-panel {
    display: flex;
    flex-direction: column;
  }

  .auth-panel > .brand {
    padding-top: max(4px, env(safe-area-inset-top));
  }

  .auth-panel > .brand img {
    width: 46px;
    height: 46px;
  }

  .auth-copy {
    margin: 30px 0 20px;
  }

  .auth-copy h1,
  .status-panel h1 {
    font-size: 26px;
    line-height: 1.15;
  }

  .auth-copy p,
  .status-panel p {
    font-size: 14px;
    line-height: 1.5;
  }

  .segmented {
    margin-bottom: 22px;
    background: #0b0e0f;
  }

  .segment {
    height: 42px;
  }

  .form-stack {
    gap: 16px;
  }

  .form-stack label {
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
  }

  .form-stack input,
  .workspace-picker select {
    height: 50px;
    padding: 0 14px;
    font-size: 16px;
  }

  .command {
    height: 50px;
  }

  .secure-note {
    margin-top: 20px;
    padding: 0 2px;
  }

  .status-panel {
    display: flex;
    min-height: 100dvh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-right: 28px;
    padding-left: 28px;
  }

  .status-panel .command {
    max-width: 360px;
  }

  .topbar {
    height: calc(62px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 14px 0;
    background: rgba(17, 20, 21, 0.97);
    backdrop-filter: blur(14px);
  }

  .brand.compact {
    min-width: 0;
    gap: 9px;
  }

  .brand.compact img {
    width: 34px;
    height: 34px;
  }

  .brand.compact div {
    min-width: 0;
  }

  .brand.compact strong {
    display: block;
    max-width: 128px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    flex-shrink: 0;
  }

  .presence-button,
  .icon-button {
    height: 40px;
  }

  .icon-button {
    width: 40px;
  }

  .app-layout {
    min-height: calc(100dvh - 62px - env(safe-area-inset-top));
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .side-nav {
    height: calc(68px + env(safe-area-inset-bottom));
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
    background: rgba(17, 20, 21, 0.98);
    backdrop-filter: blur(16px);
  }

  .nav-button {
    min-width: 0;
    min-height: 53px;
    padding: 3px 2px;
    overflow: hidden;
  }

  .nav-button span {
    font-size: 10px;
    white-space: nowrap;
  }

  .content-area {
    padding: 22px 17px 26px;
  }

  .view-heading {
    margin-bottom: 22px;
  }

  .dialer-layout,
  .active-call {
    margin-top: 24px;
  }

  .number-control {
    height: 50px;
  }

  .number-control input {
    font-size: 20px;
  }

  .dial-key {
    min-height: 54px;
  }

  .call-button {
    width: 64px;
    height: 64px;
  }

  .list-row {
    min-height: 70px;
    padding: 12px 3px;
  }

  .picker-dialog,
  .call-dialog {
    margin: auto;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  }

  .toast {
    bottom: calc(80px + env(safe-area-inset-bottom));
    max-width: calc(100% - 28px);
    text-align: center;
  }
}

.notification-setting {
  max-width: 620px;
  margin-top: 26px;
  padding: 17px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.notification-setting > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.notification-setting strong { font-size: 14px; }
.notification-setting span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.notification-setting .command { min-width: 126px; padding: 0 14px; }

.nav-button { position: relative; }
.nav-count { position: absolute; top: 3px; right: 12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; color: #07120d; background: var(--accent); font-size: 9px; font-weight: 850; }
.callback-toolbar { max-width: 720px; margin-bottom: 14px; display: flex; gap: 7px; }
.callback-filter { min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: transparent; font-weight: 700; }
.callback-filter.active { border-color: #315743; color: var(--text); background: #13221a; }
.callback-list { max-width: 720px; display: grid; gap: 10px; }
.callback-card { padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.callback-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.callback-card-head > div { min-width: 0; }
.callback-card-head strong, .callback-card-head span { display: block; }
.callback-card-head strong { overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.callback-card-head > div > span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.callback-status { flex: 0 0 auto; padding: 5px 8px; border-radius: 5px; color: #aeb7c2; background: #23282d; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.callback-status.new { color: #f4d48b; background: #352c18; }
.callback-status.calling, .callback-status.claimed { color: #a9c3ff; background: #172744; }
.callback-status.completed { color: #80e8b0; background: #10291e; }
.callback-meta { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 7px 16px; color: var(--muted); font-size: 11px; }
.callback-card-actions { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 8px; }
.callback-card-actions .command { min-height: 38px; padding: 0 13px; }
.callback-card-actions .quiet { border: 0; color: var(--muted); background: transparent; }
.callback-wait { color: var(--muted); font-size: 12px; font-weight: 650; }

@media (max-width: 520px) {
  .notification-setting { align-items: stretch; flex-direction: column; }
  .notification-setting .command { width: 100%; }
  .callback-card-actions .command { flex: 1; }
  .nav-count { top: 1px; right: 7px; }
}

@media (max-width: 390px) {
  .auth-panel {
    padding-right: 18px;
    padding-left: 18px;
  }

  .brand.compact img {
    display: none;
  }

  .brand.compact strong {
    max-width: 102px;
  }

  .presence-button {
    padding: 0 8px;
  }

  .content-area {
    padding-right: 14px;
    padding-left: 14px;
  }
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  body {
    height: 100dvh;
    overflow: hidden;
  }

  .auth-shell,
  .status-shell,
  .app-shell {
    height: 100dvh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell {
    padding-bottom: 0;
  }
}
