/* Laicai compact reception layout; original phrase popover retained. */
.titlebar .windows-download,.titlebar .window-controls{display:none!important}
.app>.titlebar{display:none!important}
html .app{grid-template-rows:0 minmax(0,1fr)!important}
html .app>:not(.titlebar){grid-row:2}
html.compact-layout .app{grid-template-columns:60px 316px minmax(0,1fr);grid-template-rows:0 minmax(0,1fr)}
html.compact-layout .titlebar{padding-left:13px}
html.compact-layout .brand{gap:8px}
html.compact-layout .brand strong{font-size:16px}
html.compact-layout .brand svg{width:22px;height:22px}
html.compact-layout .rail{padding:8px 0}
html.compact-layout .rail nav{gap:2px}
html.compact-layout .rail button{height:54px;font-size:11px;gap:4px}
html.compact-layout .rail svg{width:21px;height:21px}
html.compact-layout .search-wrap{padding:8px 9px 3px}
html.compact-layout .search-wrap>div{height:31px;min-height:31px;padding:0 9px;gap:8px}
html.compact-layout .search-wrap input{font-size:12px;height:30px}
html.compact-layout .search-wrap svg{width:16px;height:16px}
html.compact-layout .group-line{min-height:34px;height:34px;padding:0 9px;gap:4px}
html.compact-layout .group-tabs{gap:16px}
html.compact-layout .group-tabs button{font-size:12px;padding:7px 2px 8px}
html.compact-layout .group-tabs button.selected:after{height:2px;bottom:2px}
html.compact-layout .customer-row,html.compact-layout .customer-select{height:46px;min-height:46px}
html.compact-layout .customer-select{padding:5px 10px;gap:9px}
html.compact-layout .customer-select .avatar{width:32px;height:32px;border-radius:6px;flex-shrink:0}
html.compact-layout .customer-line{gap:8px;margin-bottom:0;height:19px}
html.compact-layout .customer-line strong{font-size:13px;line-height:19px;font-weight:600;letter-spacing:0}
html.compact-layout .customer-line time{font-size:10px;line-height:16px}
html.compact-layout .customer-preview{font-size:11px;line-height:16px;height:16px;gap:6px}
html.compact-layout .customer-preview>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html.compact-layout .customer-row:after{left:51px}
html.compact-layout .pin-button{top:4px;right:68px;width:20px;height:20px}
html.compact-layout .pin-button svg{width:12px;height:12px}
html.compact-layout .customer-line .channel-badge{font-size:9px;margin:0 3px;padding:0 3px;line-height:15px}
html.compact-layout .chat-header{height:48px;min-height:48px;padding:7px 14px;gap:9px}
html.compact-layout .chat-header .avatar{height:30px;width:30px;border-radius:5px}
html.compact-layout .chat-header h1{font-size:16px}
html.compact-layout .chat-actions{gap:6px}
html.compact-layout .chat-actions .icon-button{height:29px;width:29px}
html.compact-layout .chat-actions svg{height:18px;width:18px}
html.compact-layout .profile-button{padding:4px 11px;height:28px;font-size:12px}
html.compact-layout .status-pill{font-size:10px;padding:2px 7px}
html.compact-layout .messages{padding:0 14px 8px}
html.compact-layout .date-divider{height:28px;font-size:11px;gap:12px}
html.compact-layout .message,html.compact-layout .message.outgoing{gap:7px;margin-top:0;margin-bottom:7px;min-height:30px}
html.compact-layout .message.continuation{margin-top:0;margin-bottom:7px}
html.compact-layout .message .avatar{width:28px;height:28px;border-radius:5px;flex-shrink:0}
html.compact-layout .message-body{max-width:min(76%,760px);min-width:0}
html.compact-layout .bubble,html.compact-layout .with-profile .bubble{padding:5px 9px;min-height:30px;font-size:14px;line-height:20px;border-radius:4px}
html.compact-layout .message.outgoing .message-body{min-width:0}
html.compact-layout .message.outgoing .message-body:not(:has(.message-media)){display:flex;flex-direction:row-reverse;align-items:center;gap:7px}
html.compact-layout .message.outgoing .bubble{width:fit-content;flex:none;max-width:100%}
html.compact-layout .message.outgoing .message-body:not(:has(.message-media)) .live-delivery{margin:0;font-size:9px;line-height:12px;white-space:nowrap;max-width:none}
html.compact-layout .message time{font-size:10px;line-height:14px;padding-bottom:2px;margin-left:0}
html.compact-layout .message-more{width:22px;height:22px;top:4px}
html.compact-layout .message-more svg{width:14px;height:14px}
html.compact-layout .message .delivery-status,html.compact-layout .message .live-delivery{font-size:9px;line-height:12px;margin-top:2px}
html.compact-layout .media-card{padding:5px;margin-top:4px;border-radius:5px}
html.compact-layout .media-thumbnail img,html.compact-layout .media-thumbnail video{max-height:150px;max-width:240px}
html.compact-layout .composer{padding:0 14px 7px;min-height:0;max-height:none}
html.compact-layout .composer-toolbar{min-height:32px;height:32px;gap:9px}
html.compact-layout .composer-toolbar .icon-button{width:25px;height:26px}
html.compact-layout .composer-toolbar svg{width:18px;height:18px}
html.compact-layout .composer>textarea{height:98px;min-height:98px;font-size:17px;line-height:26px;padding:13px 16px;resize:none;box-sizing:border-box;overflow-y:hidden}
html.compact-layout .composer-footer{min-height:30px;margin-top:5px}
html.compact-layout .draft-state{font-size:10px;gap:4px}
html.compact-layout .draft-state svg{width:13px;height:13px}
html.compact-layout .send-controls{gap:10px}
html.compact-layout .shortcut-label{font-size:11px}
html.compact-layout .send-button{height:29px;width:72px;font-size:12px;border-radius:4px}
html.compact-layout .profile-panel{width:250px;padding:12px;gap:10px}
html.compact-layout .profile-panel .profile-identity strong{font-size:15px}
@media(max-width:900px){html.compact-layout .app{grid-template-columns:52px 280px minmax(0,1fr)}
html.compact-layout .chat-header .status-pill{display:none}}
@media(max-width:760px){html.compact-layout .app{grid-template-columns:52px minmax(0,1fr);grid-template-rows:0 minmax(0,1fr)}
html.compact-layout .chat-area{grid-column:2}
html.compact-layout .mobile-chat .chat-area{grid-column:1/-1}
html.compact-layout .message-body{max-width:72%}
html.compact-layout .composer{padding:0 10px 6px}}
@media(max-width:1000px){html.compact-layout .message.outgoing .message-body:not(:has(.message-media)){display:block}
html.compact-layout .message.outgoing .message-body:not(:has(.message-media)) .live-delivery{white-space:normal;margin-top:2px}
html.compact-layout .message.outgoing .bubble{margin-left:auto}}
.laicai-brand-icon{display:inline-block;object-fit:contain;flex-shrink:0;vertical-align:middle}

/* Message actions are available through the existing context menu. */
html.compact-layout .message-more{display:none!important}

/* Append after compact CSS. Timestamp remains below each outgoing message;
   a send anomaly is marked adjacent to the actual bubble/attachment content. */
html.compact-layout .message.outgoing > .message-body,
html.compact-layout .message.outgoing > .message-body:not(:has(.message-media)) {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  width: max-content;
  min-width: 0;
}

html.compact-layout .message.outgoing > .message-body > .message-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: max-content;
  max-width: 100%;
  min-width: 0;
}

html.compact-layout .message.outgoing .message-content > .bubble,
html.compact-layout .message.outgoing .message-content > .message-media {
  align-self: flex-end;
  max-width: 100%;
}

html.compact-layout .message.outgoing .message-content > .message-send-error {
  position: absolute;
  right: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d64747;
  color: #fff;
  font: 700 12px/1 sans-serif;
  user-select: none;
}

html.compact-layout .message.outgoing > .message-body > .message-meta {
  display: flex;
  justify-content: flex-end;
  width: max-content;
  max-width: 100%;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 14px;
  text-align: right;
}

html.compact-layout .message.outgoing > .message-body > .message-meta > time {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 10px;
  line-height: 14px;
  white-space: nowrap;
}

/* Mirror outgoing metadata: incoming time sits below the content, on its side. */
html.compact-layout .message:not(.outgoing) > .message-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  width: max-content;
  min-width: 0;
}

html.compact-layout .message:not(.outgoing) > .message-body > .bubble,
html.compact-layout .message:not(.outgoing) > .message-body > .message-media {
  max-width: 100%;
}

html.compact-layout .message:not(.outgoing) > .message-body > .message-meta {
  display: flex;
  justify-content: flex-start;
  width: max-content;
  max-width: 100%;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 14px;
  text-align: left;
}

html.compact-layout .message:not(.outgoing) > .message-body > .message-meta > time {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 10px;
  line-height: 14px;
  white-space: nowrap;
}

/* Password settings entry opens a dedicated form; reuse the app dialog palette. */
.outline-button.laicai-password-trigger {
  margin: 0 0 22px;
  padding: 8px 16px;
}
.pages-dialog-overlay.laicai-password-overlay {
  z-index: 160;
}
.pages-confirm-dialog.laicai-password-dialog {
  width: 420px;
  padding: 26px;
}
.pages-confirm-dialog.laicai-password-dialog > h2 {
  margin: 0 32px 12px 0;
  font-size: 19px;
  line-height: 28px;
}
.pages-confirm-dialog.laicai-password-dialog .laicai-password-form {
  max-width: none;
}
.pages-confirm-dialog.laicai-password-dialog .laicai-password-help {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.laicai-password-dialog .laicai-password-form label {
  margin: 14px 0;
  gap: 7px;
}
.laicai-password-dialog .laicai-password-form input {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line);
}
.pages-confirm-dialog.laicai-password-dialog :is(button,input):focus-visible {
  outline: 2px solid var(--green,#19a857);
  outline-offset: 2px;
}
.pages-confirm-dialog.laicai-password-dialog .live-error {
  color: #b12d30;
}
.pages-confirm-dialog.laicai-password-dialog .pages-dialog-actions {
  margin-top: 22px;
  gap: 10px;
}
.pages-confirm-dialog.laicai-password-dialog button:disabled {
  opacity: .6;
  cursor: default;
}
@media(max-width:480px) {
  .pages-dialog-overlay.laicai-password-overlay { padding: 16px; }
  .pages-confirm-dialog.laicai-password-dialog { padding: 22px; }
}

/* Keep sign-out at the end of Settings, on every settings tab. */
.workspace-page.settings-page {
  display: flex;
  flex-direction: column;
}
.settings-page > * {
  flex-shrink: 0;
}
.settings-page > .settings-content {
  padding-bottom: 28px;
}
.settings-footer {
  width: 100%;
  max-width: 900px;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-start;
}
.settings-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: #c44a4a;
  font-size: 13px;
}
.settings-logout:hover {
  background: var(--hover);
}
.settings-logout:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
.dark .settings-logout {
  color: #f08c8c;
}

/* Settings only. Match 46px conversation density without fixed text heights.
   Keep selectors more specific than the lazy-loaded original AdminEntry CSS.
   No generic form/button/input rules: password dialogs and sign-out keep r4. */
html.compact-layout .workspace-page.settings-page {
  padding-left: 24px;
  padding-right: 24px;
}

html.compact-layout .settings-page > .page-heading {
  height: auto;
  min-height: 52px;
  padding: 6px 0;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
html.compact-layout .settings-page > .page-heading h1 {
  margin: 0;
  font-size: 18px;
  line-height: 24px;
}
html.compact-layout .settings-page > .page-heading p {
  font-size: 12px;
  line-height: 16px;
}
html.compact-layout .settings-page > .settings-tabs {
  gap: 24px;
  margin-top: 0;
}
html.compact-layout .settings-page > .settings-tabs > button {
  min-height: 36px;
  padding: 7px 2px;
  font-size: 13px;
  line-height: 20px;
}
html.compact-layout .settings-page > .settings-content {
  padding-top: 12px;
}
html.compact-layout .settings-page .settings-section-title {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 20px;
}
html.compact-layout .settings-page .settings-section-title.next {
  margin-top: 18px;
}
html.compact-layout .settings-page .settings-description {
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 17px;
}
html.compact-layout .settings-page > .settings-content > .page-notice {
  margin-bottom: 12px;
}

html.compact-layout .settings-page .setting-row {
  min-height: 46px;
  padding: 4px 0;
  gap: 16px;
}
html.compact-layout .settings-page .setting-row > div:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
html.compact-layout .settings-page .setting-row h3 {
  font-size: 13px;
  line-height: 18px;
}
html.compact-layout .settings-page .setting-row p {
  margin: 1px 0 0;
  font-size: 11px;
  line-height: 16px;
}
html.compact-layout .settings-page .setting-row > .setting-control {
  min-width: 120px;
  max-width: 48%;
  min-height: 32px;
}
html.compact-layout .settings-page .setting-control > select {
  min-height: 32px;
  padding: 5px 27px 5px 9px;
  font-size: 12px;
  line-height: 20px;
}
html.compact-layout .settings-page .setting-control > input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

html.compact-layout .settings-page .theme-options {
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 8px;
  margin-top: 8px;
}
html.compact-layout .settings-page .theme-choice {
  min-width: 0;
  min-height: 46px;
  padding: 9px 12px;
  gap: 9px;
}
html.compact-layout .settings-page .theme-choice > svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
html.compact-layout .settings-page .theme-choice > strong {
  margin: 0;
  font-size: 13px;
  line-height: 20px;
}

html.compact-layout .settings-page > .settings-content > .laicai-password-trigger {
  margin-bottom: 10px;
}
html.compact-layout .settings-page .device-title {
  min-height: 32px;
  margin: 8px 0 0;
  align-items: center;
  gap: 12px;
}
html.compact-layout .settings-page .device-title > .settings-section-title {
  margin: 0;
}
html.compact-layout .settings-page .device-title > .text-action {
  min-height: 30px;
  font-size: 12px;
  line-height: 18px;
}
html.compact-layout .settings-page .device-row {
  min-height: 46px;
  padding: 5px 0;
  gap: 10px;
  flex-wrap: nowrap;
}
html.compact-layout .settings-page .device-row > .device-icon {
  width: 24px;
  height: 24px;
}
html.compact-layout .settings-page .device-description {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1px 10px;
}
html.compact-layout .settings-page .device-description > h3 {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  gap: 6px;
  font-size: 13px;
  line-height: 18px;
  overflow-wrap: anywhere;
}
html.compact-layout .settings-page .device-description > p {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  font-size: 11px;
  line-height: 16px;
  overflow-wrap: anywhere;
}
html.compact-layout .settings-page .device-description > p:last-child {
  flex-basis: 100%;
}
html.compact-layout .settings-page .current-device {
  font-size: 10px;
  line-height: 18px;
  padding: 0 5px;
}
html.compact-layout .settings-page .device-row > .outline-button {
  flex-shrink: 0;
  min-height: 30px;
  margin: 0;
  padding: 5px 9px;
  font-size: 12px;
  line-height: 18px;
}
html.compact-layout .settings-page > .settings-content > .page-footnote {
  margin: 10px 0;
  font-size: 11px;
  line-height: 17px;
}

html.compact-layout .settings-page .about-content {
  margin: 0 auto;
}
html.compact-layout .settings-page .about-content > .about-brand {
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border-radius: 9px;
}
html.compact-layout .settings-page .about-brand > .laicai-brand-icon {
  width: 32px;
  height: 32px;
}
html.compact-layout .settings-page .about-content > h2 {
  margin-bottom: 4px;
  font-size: 19px;
  line-height: 26px;
}
html.compact-layout .settings-page .about-content > .about-version {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 17px;
}
html.compact-layout .settings-page .about-content > p:not(.about-version) {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 18px;
}
html.compact-layout .settings-page .about-content > .about-row {
  min-height: 46px;
  padding: 8px 0;
  gap: 12px;
  font-size: 12px;
  line-height: 18px;
}
html.compact-layout .settings-page .about-row > a {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
html.compact-layout .settings-page .about-content > .windows-download {
  margin: 10px 0;
}

@media(max-width:600px) {
  html.compact-layout .workspace-page.settings-page {
    padding-left: 12px;
    padding-right: 12px;
  }
  html.compact-layout .settings-page > .settings-tabs { gap: 16px; }
  html.compact-layout .settings-page .setting-row { gap: 10px; }
  html.compact-layout .settings-page .setting-row > .setting-control {
    min-width: 96px;
    max-width: 48%;
  }
  html.compact-layout .settings-page .setting-control > select {
    min-height: 34px;
    padding-left: 7px;
    padding-right: 20px;
  }
  html.compact-layout .settings-page .theme-options { grid-template-columns: 1fr; }
  html.compact-layout .settings-page .device-description { gap: 1px 6px; }
  html.compact-layout .settings-page .device-row > .outline-button {
    min-height: 34px;
    padding: 6px 7px;
  }
}
