#local-auth {
  position: fixed;
  z-index: 5;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  color: #303133;
}

body:has(dialog[open], #schedule-popup:not([hidden])) #local-auth { visibility: hidden; }
body:has(#local-auth:not([hidden])) .workspace {
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}

.sms-auth-toggle,
#sms-auth-panel {
  border: 1px solid var(--rule);
  background: #fff;
  box-shadow: 0 4px 16px rgb(31 48 82 / 12%);
}

.sms-auth-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: #303133;
  border-radius: 22px;
  cursor: pointer;
}

.sms-auth-toggle::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-top: 4px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(225deg);
}

.sms-auth-toggle[aria-expanded="true"]::after {
  margin-top: -3px;
  transform: rotate(45deg);
}

#sms-auth-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(244px, calc(100vw - 40px));
  max-height: calc(100vh - 86px);
  max-height: calc(100dvh - 86px - env(safe-area-inset-bottom));
  overflow: auto;
  border-radius: 10px;
  padding: 6px;
}

.sms-auth-status {
  display: block;
  padding: 9px 10px 10px;
  color: #565d69;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sms-auth-actions { display: grid; }

.sms-auth-button {
  min-height: 40px;
  padding: 8px 10px;
  border-color: transparent;
  background: transparent;
  color: #2058cf;
  text-align: left;
  line-height: 1.25;
  cursor: pointer;
}

#sms-logout { color: #303133; }
.sms-auth-toggle:hover { border-color: var(--blue); }
.sms-auth-button:hover:enabled { background: var(--light); }
.sms-auth-button:disabled { color: #606266; cursor: wait; }
.sms-auth-toggle:focus-visible,
.sms-auth-button:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

@media (max-width: 560px) {
  #local-auth {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
  }
}
