:root{font-family:system-ui,sans-serif;color:#111e33;background:#f5f2ed;--line:#ded7cd;--accent:#283d60;--muted:#4c586a}*{box-sizing:border-box}[hidden]{display:none!important}body{margin:0}header{display:flex;justify-content:space-between;align-items:center;background:#061126;color:#fff;padding:15px clamp(16px,4vw,54px)}.brand{display:flex;align-items:center;gap:12px;font-weight:700}.mark{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:#efd09b;color:#061126}.brand small{display:block;color:#d4dce9;font-weight:400}main{max-width:1500px;margin:auto;padding:24px}button,input,textarea,select{font:inherit}button,.attach{cursor:pointer}button{background:white;color:inherit;border:1px solid var(--line);border-radius:9px;padding:8px 12px}button:hover{border-color:var(--accent)}.primary{color:white;background:var(--accent);border-color:var(--accent);font-weight:650}input:not([type=file]),textarea,select{width:100%;color:inherit;background:white;border:1px solid #9ca6b7;border-radius:8px;padding:8px 10px}textarea{resize:vertical}input[type=file]{max-width:100%}label{display:block;font-size:.88rem;font-weight:600}label input,label select{display:block;margin-top:5px}form{display:grid;gap:12px}small,.sub{font-size:.82rem;color:var(--muted)}h1,h2,h3,p{margin:0 0 10px}h1{font-size:1.65rem}h2{font-size:1.15rem}h3{font-size:1rem}.card,.workspace>aside,.workspace>section{background:#fff;border:1px solid var(--line);border-radius:16px;min-width:0}.card{max-width:440px;margin:44px auto;padding:24px}.switch{margin-top:14px}.workspace{display:grid;grid-template-columns:minmax(170px,250px) minmax(270px,1fr) minmax(195px,260px);gap:12px;align-items:start}.workspace>aside,#chatHead,#composer{padding:16px}.row,.actions,.identity{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.actions{justify-content:space-between}.identity{gap:12px}.avatar{width:43px;height:43px;object-fit:cover;border-radius:50%;display:grid;place-items:center;background:#ebdfc9;font-weight:700}.person{display:block;width:100%;text-align:left;margin:8px 0}.person.selected{background:#f0e4cc;border-color:#957345}.tag{display:inline-block;padding:3px 8px;border-radius:20px;background:#e9edf5;font-size:.78rem;margin:3px 4px 3px 0}.tag[data-value=Approved],.tag[data-value=Done],.tag[data-value=Paid]{background:#dce9df}.tag[data-value=Blocked],.tag[data-value=Denied]{background:#ffe5df}.request{border-top:1px solid var(--line);padding:12px 0}.request:first-child{margin-top:12px}#chatHead{border-bottom:1px solid var(--line)}#messages{display:flex;flex-direction:column;gap:12px;height:clamp(220px,52vh,620px);padding:16px;overflow:auto;background:#f7f5f1}#composer{border-top:1px solid var(--line)}.bubble{max-width:86%;min-width:0;align-self:flex-start;background:#ebeff6;padding:10px 12px;border-radius:12px;overflow-wrap:anywhere;white-space:pre-wrap}.bubble.mine{align-self:flex-end;background:#eadbc1}.bubble small,.bubble a{display:block}.bubble a{color:#294671}.attach{max-width:75%}#notice{margin:12px auto;padding:10px 16px;background:#fff1d5;max-width:800px;border-radius:8px}button:disabled{opacity:.55;cursor:default}@media(max-width:900px){.workspace{grid-template-columns:200px minmax(0,1fr)}#tracking{grid-column:2}}@media(max-width:620px){main{padding:10px}.workspace{grid-template-columns:1fr}#tracking{grid-column:auto}#sidebar .people{max-height:170px;overflow:auto}.card{margin-top:22px}}

/* The white button sits in a header with white text. Give it its own text color. */
#logout {
  color: #061126;
  font-weight: 650;
  flex-shrink: 0;
}
#logout:focus-visible {
  outline: 2px solid #efd09b;
  outline-offset: 3px;
}

.owner-settings {
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.owner-settings summary { cursor: pointer; font-weight: 650; }
.owner-settings > div { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 16px; }
.owner-settings section { flex: 1 1 260px; min-width: 0; }
.owner-settings .row { margin-bottom: 8px; }
.owner-settings textarea { display: block; margin-top: 6px; }
.work-notice { margin: 8px 0; color: #344d75; font-weight: 650; }

.attachment-preview {
  display: block;
  width: 104px;
  height: 80px;
  max-width: 100%;
  margin: 6px 0;
  border-radius: 8px;
  object-fit: contain;
  background: #f6f2e9;
}

.payment-image-form { margin-top: 16px; }
.payment-details, .daily-payment { margin: 8px 0; }
.daily-payment { max-width: 360px; }
.payment-picture {
  display: block;
  max-width: min(100%, 320px);
  height: auto;
  margin: 8px 0;
}

.payment-instructions { white-space: pre-wrap; overflow-wrap: anywhere; }
.payment-reminder {
  width: min(420px, calc(100% - 32px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #111e33;
  overflow-wrap: anywhere;
}
.payment-reminder::backdrop { background: rgb(6 17 38 / 58%); }
.payment-reminder .row { justify-content: flex-end; }

.attachment-download {
  display: block;
  max-width: 100%;
  margin: 5px 0;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.brand .mark {
  flex-shrink: 0;
  display: block;
  box-sizing: border-box;
  object-fit: contain;
  border: 1px solid #8d7757;
  background: #061126;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
#install-app {
  color: #061126;
  background: #efd09b;
  border-color: #efd09b;
  font-weight: 650;
}
#install-help {
  width: min(420px, calc(100% - 32px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: #111e33;
}
:root[data-theme="dark"] #install-help {
  background: #111f36;
  color: #f1eade;
}
#install-help::backdrop { background: rgb(6 17 38 / 58%); }
#install-help form { justify-items: end; }

#theme-toggle, #notifications { color: #061126; }
#activity-notice {
  position: fixed;
  z-index: 20;
  inset-block-start: 5rem;
  inset-inline-end: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: min(360px, calc(100% - 24px));
  box-shadow: 0 6px 20px #0003;
  padding: 10px 16px;
  border: 1px solid #b08650;
  border-radius: 8px;
  background: #f3e4c9;
  color: #111e33;
}
#activity-notice button { flex-shrink: 0; }
.notification-dialog {
  width: min(420px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.notification-dialog::backdrop { background: rgb(6 17 38 / 58%); }
.notification-dialog button { margin-inline-end: 6px; }
:root[data-theme="dark"] {
  color-scheme: dark;
  color: #f1eade;
  background: #081326;
  --line: #344561;
  --accent: #e4bd80;
  --muted: #b7c5d9;
}
[data-theme="dark"] :is(.card,.workspace>aside,.workspace>section,.owner-settings,dialog) {
  background: #111f36;
  color: #f1eade;
}
[data-theme="dark"] :is(button,input:not([type=file]),textarea,select) {
  color: #f1eade;
  background: #1a2b48;
}
[data-theme="dark"] :is(.primary,#install-app) { color: #101928; background: #efd09b; }
[data-theme="dark"] :is(#theme-toggle,#notifications,#logout,#activity-notice button) { color: #f1eade; }
[data-theme="dark"] #messages { background: #0b172b; }
[data-theme="dark"] .bubble { background: #1c2e4a; }
[data-theme="dark"] .bubble.mine, [data-theme="dark"] .person.selected { background: #493b32; }
[data-theme="dark"] :is(.avatar,.tag) { background: #283a55; }
[data-theme="dark"] :is(.tag[data-value=Approved],.tag[data-value=Done],.tag[data-value=Paid]) { background: #284735; }
[data-theme="dark"] :is(.tag[data-value=Blocked],.tag[data-value=Denied]) { background: #613b41; }
[data-theme="dark"] :is(.bubble a,.work-notice) { color: #efd09b; }
[data-theme="dark"] .attachment-preview { background: #17253c; }
[data-theme="dark"] #notice { color: #231a10; }
@media (max-width: 480px) {
  header { gap: 8px; padding: 10px; }
  .brand { gap: 6px; }
  .header-actions button { padding: 6px 8px; font-size: .78rem; }
}

.file-viewer {
  width: min(900px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.file-viewer::backdrop { background: rgb(6 17 38 / 58%); }
.file-viewer .row { justify-content: space-between; margin-bottom: 10px; }
.file-viewer img { display: block; max-width: 100%; max-height: 72dvh; margin: 0 auto; }
.file-viewer iframe { display: block; width: 100%; height: 72dvh; border: 1px solid var(--line); }
.file-viewer pre { white-space: pre-wrap; overflow-wrap: anywhere; }

#chatHead .danger {
  border-color: #bd635e;
  color: #9e2525;
}
[data-theme="dark"] #chatHead .danger { color: #ffb4ad; }

.bubble .delete-message {
  display: block;
  margin-top: 6px;
  padding: 3px 6px;
  font-size: .75rem;
  color: #9e2525;
}
[data-theme="dark"] .bubble .delete-message { color: #ffb4ad; }

.tag[data-value="Unread"] { background: #f4ce74; color: #241909; font-weight: 700; }
[data-theme="dark"] .tag[data-value="Unread"] { background: #f4ce74; color: #241909; }

#personalize-panel { color: #061126; }
[data-theme="dark"] #personalize-panel { color: #f1eade; }
body { isolation: isolate; }
#panel-background {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: -1;
}
.has-background :is(.card,.workspace>aside,.workspace>section,.owner-settings) {
  background: rgb(255 255 255 / 89%);
}
.has-background #messages { background: rgb(247 245 241 / 40%); }
[data-theme="dark"].has-background :is(.card,.workspace>aside,.workspace>section,.owner-settings) {
  background: rgb(17 31 54 / 89%);
}
[data-theme="dark"].has-background #messages { background: rgb(11 23 43 / 40%); }
.notification-dialog input[type="range"] { padding: 0; accent-color: var(--accent); }

header { position: relative; z-index: 2; }
#header-menu { position: relative; }
#header-menu > summary {
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid #607291;
  border-radius: 9px;
  color: #fff;
}
#header-menu .header-actions {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  width: max-content;
  max-width: calc(100vw - 24px);
  display: grid;
  justify-content: stretch;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 26px rgb(6 17 38 / 25%);
}
#header-menu .header-actions button { text-align: start; }
[data-theme="dark"] #header-menu .header-actions { background: #111f36; }
.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

#notifications {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 40px;
  min-height: 38px;
  padding: 4px 7px;
  background: transparent;
  border: 1px solid #607291;
  color: #fff;
}

#notification-count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 4px;
  border-radius: 20px;
  background: #efd09b;
  color: #061126;
  text-align: center;
  font-size: .8rem;
}

.mobile-chat-controls,
.back-to-clients {
  display: none;
}

@media (max-width: 620px) {
  .staff-workspace:not(.thread-open) > :is(#chat, #tracking),
  .staff-workspace.thread-open > #sidebar {
    display: none;
  }

  .staff-workspace #sidebar .people {
    max-height: none;
    overflow: visible;
  }

  .staff-workspace.thread-open .back-to-clients {
    display: block;
    margin: 12px 16px 0;
    min-height: 44px;
  }
}

.action-disclosure {
  margin-top: 4px;
  white-space: normal;
}

.action-disclosure > summary {
  display: list-item;
  width: fit-content;
  padding: 4px 0;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
}

.action-disclosure[open] > .row {
  margin-top: 4px;
}

.action-disclosure .delete-message {
  margin-top: 0;
}

.main-list-title {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.client-header {
  justify-content: space-between;
}

.call-client {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.call-client:hover {
  border-color: var(--accent);
}

.reaction-picker button[aria-pressed="true"] {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  font-weight: 700;
}

.bubble { position: relative; }

.bubble.has-reactions {
  min-width: min(160px, 100%);
  margin-bottom: 24px;
}

.reaction-trigger,
[data-theme="dark"] .reaction-trigger {
  position: absolute;
  z-index: 1;
  right: 6px;
  bottom: 0;
  transform: translateY(50%);
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 2px 5px;
  border: 0;
  background: transparent;
}

.reaction-emoji {
  display: inline-flex;
  align-items: end;
  font-size: 2.25rem;
  line-height: 1.05;
}

.reaction-count {
  font: 700 .7rem system-ui, sans-serif;
}

.reaction-trigger-empty:not(:focus-visible) {
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  padding: 0;
  pointer-events: none;
}

.reaction-trigger-empty:focus-visible::after { content: "React"; }

.reaction-picker {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 5px;
  width: min(240px, calc(100vw - 16px));
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: Canvas;
  color: CanvasText;
  box-shadow: 0 4px 18px #0004;
  white-space: normal;
  transform: translateY(-50%);
}

.reaction-picker:popover-open {
  display: flex;
  gap: 4px;
}

.reaction-picker button {
  flex: 1;
  padding: 6px 3px;
  min-height: 44px;
  font-size: .82rem;
}

.reaction-picker-emoji {
  display: block;
  font-size: 2.25rem;
  line-height: 1.05;
}

@media (prefers-reduced-motion: no-preference) {
  .reaction-picker:popover-open { animation: reaction-bounce .25s ease-out; }
  .reaction-added { animation: reaction-bounce .38s ease-out; }
}

@keyframes reaction-bounce {
  0% { scale: .65; }
  65% { scale: 1.12; }
  100% { scale: 1; }
}

.team-member {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tag[data-value="Online"] {
  background: #ccebd9;
  color: #123e2b;
}

.reply-draft,
.message-quote {
  border-inline-start: 3px solid currentColor;
  padding: 6px 10px;
  overflow-wrap: anywhere;
}

.reply-draft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.message-quote {
  display: block;
  max-width: 100%;
  margin-block: 5px;
  text-align: start;
}

.reply-highlight {
  outline: 2px solid #b88228;
  outline-offset: 2px;
}

.composer-emoji-picker {
  min-width: 0;
}

.composer-emoji-picker summary {
  cursor: pointer;
  padding: 8px 4px;
}

.composer-emoji-picker[open] {
  flex-basis: 100%;
}

.composer-emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 4px;
  max-width: 360px;
  max-height: 188px;
  overflow: auto;
  padding: 4px;
}

.composer-emoji-grid button {
  min-height: 44px;
  padding: 4px;
  font-size: 1.4rem;
}

/* Keep the staff workspace inside the viewport. */
body:has(.staff-workspace) {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

body:has(.staff-workspace) > :is(header, #notice) {
  flex: 0 0 auto;
}

#app:has(.staff-workspace) {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

#app:has(.staff-workspace) > .owner-settings {
  flex: 0 1 auto;
  max-height: 35%;
  overflow: auto;
  overscroll-behavior: contain;
}

.staff-workspace {
  flex: 1 1 0;
  min-height: 0;
  align-items: stretch;
  grid-template-rows: minmax(0, 1fr);
}

.staff-workspace:has(> #tracking[hidden]) {
  grid-template-columns: minmax(170px, 250px) minmax(0, 1fr);
}

.staff-workspace > :is(#sidebar, #tracking),
.staff-workspace #messages {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.staff-workspace > #chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.staff-workspace :is(#chatHead, #composer) {
  flex: 0 1 auto;
  max-height: 40%;
  overflow: auto;
  overscroll-behavior: contain;
}

.staff-workspace #messages {
  flex: 1 1 0;
  height: auto;
}

.staff-workspace #messages > * {
  flex-shrink: 0;
}

@media (min-width: 621px) and (max-width: 900px) {
  .staff-workspace {
    grid-template-rows: minmax(0, 1fr) minmax(0, 27%);
  }

  .staff-workspace > #sidebar { grid-row: 1 / -1; }
  .staff-workspace:has(> #tracking[hidden]) { grid-template-rows: minmax(0, 1fr); }
}

@media (max-width: 620px) {
  .staff-workspace:has(> #tracking[hidden]) {
    grid-template-columns: minmax(0, 1fr);
  }

  #app:has(.staff-workspace.thread-open) {
    padding: 4px;
  }

  #app:has(.staff-workspace.thread-open) > .owner-settings,
  .staff-workspace:not(.mobile-requests-open) > #tracking {
    display: none;
  }

  .staff-workspace.thread-open.mobile-requests-open:has(> #tracking:not([hidden])) {
    grid-template-rows: minmax(0, 1fr) minmax(0, 32%);
  }

  .staff-workspace.thread-open .mobile-chat-controls {
    display: flex;
    flex: 0 0 auto;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 8px;
  }

  .staff-workspace.thread-open .back-to-clients {
    margin: 0;
  }

  .staff-workspace #chatHead {
    padding: 6px 10px;
    max-height: 26%;
  }

  .staff-workspace #messages {
    padding: 10px;
    font-size: 1rem;
    line-height: 1.45;
  }

  .staff-workspace #messages .bubble {
    max-width: 92%;
  }

  .staff-workspace #composer {
    padding: 8px 10px;
    gap: 6px;
    max-height: 50%;
  }

  .staff-workspace #composer textarea {
    min-height: 66px;
    font-size: 16px;
    line-height: 1.4;
  }

  .staff-workspace #composer .actions > button {
    min-height: 44px;
  }
}

.file-zoom-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.file-zoom-controls button[aria-disabled="true"] {
  opacity: .55;
}

.file-preview-stage {
  container-type: inline-size;
  max-height: 68dvh;
  overflow: auto;
  overscroll-behavior: contain;
}

.file-preview-content {
  width: 100cqw;
}

.file-viewer iframe {
  height: 62dvh;
}

@media (hover: hover) and (pointer: fine) {
  .file-viewer .file-zoom-controls {
    display: none;
  }

  .file-preview-stage {
    scrollbar-width: none;
  }

  .file-preview-stage::-webkit-scrollbar {
    display: none;
  }

  .mouse-preview {
    cursor: grab;
    user-select: none;
  }

  .mouse-preview.is-dragging {
    cursor: grabbing;
  }
}

#messages .bubble { touch-action: manipulation; }

/* Client chat keeps account controls in the profile screen. */
body:has(.client-workspace) > header,
.client-workspace > #sidebar {
  display: none;
}

.client-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
}

.client-workspace > #tracking { grid-column: 2; }

.client-chat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.client-avatar-button,
.client-call-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
}

.client-avatar-button .avatar {
  width: 44px;
  height: 44px;
}

.client-call-button {
  color: inherit;
  border: 1px solid var(--line);
  text-decoration: none;
  font-size: 1.4rem;
}

.client-profile {
  width: min(100% - 24px, 460px);
  max-height: calc(100dvh - 24px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: inherit;
  text-align: center;
}

.client-profile::backdrop { background: #061126aa; }
.client-profile > button:first-child { display: block; }

.client-profile-avatar .avatar {
  width: 104px;
  height: 104px;
  margin: 12px auto;
  font-size: 2rem;
}

.client-profile-settings {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.client-profile-settings button { min-height: 44px; }
.client-profile-settings [role="switch"]::after { content: " · Off"; }
.client-profile-settings [aria-checked="true"]::after { content: " · On"; }

.client-message-time {
  align-self: center;
  color: var(--muted);
  margin: 6px 0;
  font-size: .8rem;
  font-weight: 600;
}

.client-workspace .client-file-bubble { padding: 5px; }

.client-file-preview {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
}

.client-file-preview img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(260px, 100%);
}

.file-page-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-block: 8px;
}

@media (max-width: 620px) {
  .client-workspace { grid-template-columns: minmax(0, 1fr); }
  .client-workspace > #tracking { grid-column: 1; }
}

html:has(.client-workspace),
body:has(.client-workspace) {
  overflow: hidden;
  overscroll-behavior: none;
}

#app:has(.client-workspace) {
  position: fixed;
  inset-inline: 0;
  top: var(--client-viewport-top, 0px);
  height: var(--client-viewport-height, 100dvh);
  display: flex;
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

.client-workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
}

.client-workspace #chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 0;
}

.client-workspace #chatHead {
  flex: 0 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
}

.client-workspace #messages {
  overscroll-behavior-y: none;
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  overflow-y: auto;
}

.client-workspace #messages > * { flex-shrink: 0; }

.client-chat-bar {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 8px;
}

.client-chat-bar .client-call-button { grid-column: 3; grid-row: 1; }

.client-request-status {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: .85rem;
  font-weight: 650;
}

.client-workspace #composer {
  border-top: 0;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 6px;
  padding: 4px 10px max(6px, env(safe-area-inset-bottom));
}

.client-workspace .client-message-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.client-workspace #composer .actions { display: contents; }

.client-composer-tools {
  grid-column: 1;
  grid-row: 3;
  display: flex;
  gap: 2px;
}

.client-workspace #composer textarea {
  grid-column: 2;
  grid-row: 3;
  border-radius: 20px;
  height: 44px;
  line-height: 22px;
  padding: 10px;
  resize: none;
  font-size: 16px;
}

.client-workspace #composer .actions > button {
  grid-column: 3;
  grid-row: 3;
}

.client-composer-tools button,
.client-workspace #composer .actions > button {
  min-width: 38px;
  min-height: 44px;
  padding: 4px 6px;
  font-size: 1.2rem;
}

.client-attachment-summary,
.client-workspace .reply-draft {
  grid-column: 1 / -1;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  overflow-wrap: anywhere;
  min-width: 0;
}

.client-workspace .reply-draft { grid-row: 1; }
.client-workspace .client-attachment-summary { grid-row: 2; }

.client-composer-tools button img,
.client-workspace #composer .actions > button img {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.client-composer-tools button,
[data-theme="dark"] .client-composer-tools button,
.client-workspace #composer .actions > button,
[data-theme="dark"] .client-workspace #composer .actions > button {
  display: grid;
  place-items: center;
  background: #14233d;
  border-color: #607291;
}

.client-profile .payment-details {
  text-align: start;
  margin-top: 16px;
}

.client-message-menu:popover-open {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.client-message-menu .delete-message { color: #ab3732; }
[data-theme="dark"] .client-message-menu .delete-message { color: #ffb4ad; }

.client-workspace #messages .client-reply {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0;
  background: transparent;
}

.client-workspace #messages .client-reply.mine { align-items: flex-end; }
.client-reply-caption { padding: 0 6px; }

.client-reply .message-quote {
  margin: 4px 0 -9px;
  padding: 9px 12px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eeebe6;
  color: var(--muted);
  white-space: pre-wrap;
}

[data-theme="dark"] .client-reply .message-quote { background: #17243a; }

.client-reply > :is(.message-body, .client-file-preview) {
  position: relative;
  border-radius: 14px;
}

.client-reply > .message-body {
  padding: 9px 12px;
  background: #dfe8f6;
}

[data-theme="dark"] .client-reply > .message-body { background: #2b456b; }
.client-reply.mine > .message-body {
  background: #efd09b;
  color: #14233d;
}

@media (pointer: coarse) {
  .client-workspace #messages .bubble {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
}

.client-profile { touch-action: pan-y pinch-zoom; }
.client-profile .payment-details { margin-top: 0; }
.client-workspace #messages .client-file-bubble {
  padding: 0;
  background: transparent;
}
.client-workspace #messages .client-file-preview {
  background: transparent;
  border: 0;
}

body:has(.client-workspace) > #notice {
  position: fixed;
  z-index: 21;
  inset: max(12px, env(safe-area-inset-top)) 12px auto auto;
  width: max-content;
  max-width: min(360px, calc(100% - 24px));
  margin: 0;
  box-shadow: 0 6px 20px #0003;
  overflow-wrap: anywhere;
  pointer-events: none;
}

body:has(.client-workspace) > #activity-notice { inset-block-start: max(12px, env(safe-area-inset-top)); }

.client-workspace #composer :is(.client-composer-tools button, .actions > button),
.client-message-menu button {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.client-message-menu { width: min(192px, calc(100vw - 16px)); }
.client-message-menu button { padding: 4px 2px; }
.client-message-menu .reaction-picker-emoji { font-size: 1.45rem; }
.client-message-menu button[aria-pressed="true"]:not(:focus-visible) { outline: none; }
.client-message-menu button[aria-pressed="true"] > span:last-child { text-decoration: underline; }

.client-workspace #composer button:focus-visible,
.client-message-menu button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.login-layout {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: max(0px, calc(100dvh - 120px));
  gap: 16px;
  justify-items: center;
}

.login-layout .card {
  width: 100%;
  margin: 16px auto 0;
}

.login-phone-question {
  align-self: center;
  min-height: 44px;
  border: 0;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
}

[data-theme="dark"] .login-phone-question { background: transparent; }

.login-install {
  width: min(100%, 440px);
  min-height: 44px;
  margin-bottom: env(safe-area-inset-bottom);
}

.install-platforms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.install-platforms button { min-height: 44px; }

/* Admin chat refresh: client-style conversation, desktop-first; admin controls remain intact. */
.staff-workspace { grid-template-columns:minmax(210px,270px) minmax(0,1fr) minmax(210px,280px); gap:12px; }
.staff-workspace > #chat { overflow:hidden; border-radius:18px; box-shadow:0 3px 16px #101d3010; }
.staff-workspace #chatHead { flex:0 0 auto; max-height:38%; padding:12px 16px; overflow-y:auto; background:var(--surface, #fff); }
.staff-workspace #chatHead .client-header { justify-content:space-between; gap:12px; }
.staff-workspace #messages { background:var(--chat-bg,#f7f5f1); padding:18px clamp(12px,2vw,28px); gap:10px; }
.staff-workspace #messages .bubble { max-width:min(78%,640px); border-radius:18px; padding:10px 14px; box-shadow:0 1px 3px #0000000b; }
.staff-workspace #messages .bubble.mine { border-bottom-right-radius:5px; }
.staff-workspace #messages .bubble:not(.mine) { border-bottom-left-radius:5px; }
.staff-workspace #messages .client-message-time { margin:8px 0 2px; }
.staff-workspace #composer { flex:0 0 auto; max-height:42%; overflow-y:auto; border-top:1px solid var(--line); padding:10px 14px 12px; gap:6px; display:grid; grid-template-columns:minmax(0,1fr); background:var(--surface,#fff); }
.staff-workspace #composer[hidden] { display:none; }
.staff-workspace #composer > label[for=message] { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.staff-workspace #composer .actions { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:8px; flex-wrap:nowrap; }
.staff-workspace #composer .client-composer-tools { display:flex; grid-column:1; grid-row:1; gap:3px; }
.staff-workspace #composer textarea { grid-row:1; width:100%; min-height:46px; max-height:130px; height:46px; padding:11px 14px; border-radius:24px; resize:vertical; font-size:16px; line-height:23px; }
.staff-workspace #composer .actions > button[type=submit] { grid-column:3; grid-row:1; min-height:44px; min-width:44px; padding:5px; }
.staff-workspace #composer .actions > button[type=submit] img { width:24px; height:24px; object-fit:contain; }
.staff-workspace #composer .composer-emoji-picker { justify-self:end; }
.staff-workspace #composer .composer-emoji-picker summary { padding:4px 8px; }
.staff-workspace #composer .client-attachment-summary { display:flex; margin:0; }
.staff-workspace #composer .client-attachment-summary[hidden] { display:none; }
.staff-workspace #composer > small { font-size:.72rem; }
.staff-workspace #composer .reply-draft { min-width:0; }
.staff-workspace #composer .client-composer-tools button { min-height:44px; min-width:40px; }
@media (min-width:621px) and (max-width:1050px) { .staff-workspace { grid-template-columns:minmax(175px,220px) minmax(0,1fr); } .staff-workspace > #tracking { grid-column:2; } }
@media (max-width:620px) {
 .staff-workspace, .staff-workspace:has(> #tracking[hidden]) { grid-template-columns:minmax(0,1fr); }
 .staff-workspace #chatHead { padding:8px 10px; max-height:30%; }
 .staff-workspace #messages { padding:10px; }
 .staff-workspace #messages .bubble { max-width:90%; }
 .staff-workspace #composer { padding:7px 8px max(8px,env(safe-area-inset-bottom)); max-height:45%; gap:4px; }
 .staff-workspace #composer .actions { gap:4px; }
 .staff-workspace #composer .client-composer-tools { gap:0; }
 .staff-workspace #composer .client-composer-tools button { min-width:34px; padding:3px; }
 .staff-workspace #composer .client-composer-tools button img { width:21px; height:21px; }
 .staff-workspace #composer textarea { min-height:44px; height:44px; padding:10px; }
 .staff-workspace #composer > small { display:none; }
}

/* Admin chat alignment and theme correction (2026-11-21). */
.staff-workspace #chatHead { max-height:35%; background:#fff; color:#111e33; border-bottom:1px solid var(--line); }
:root[data-theme="dark"] .staff-workspace #chatHead { background:#111f36; color:#f1eade; }
:root[data-theme="dark"] .staff-workspace #chatHead :is(h2,h3,p,strong,summary,label,span) { color:inherit; }
:root[data-theme="dark"] .staff-workspace #chatHead :is(small,.sub) { color:#b7c5d9; }
:root[data-theme="dark"] .staff-workspace #chatHead button:not(.primary):not(.danger) { background:#1a2b48; color:#f1eade; border-color:#344561; }
.staff-workspace #composer { display:grid; grid-template-columns:minmax(0,1fr); gap:6px; padding:10px 12px; background:#fff; max-height:40%; }
:root[data-theme="dark"] .staff-workspace #composer { background:#111f36; color:#f1eade; border-top-color:#344561; }
.staff-workspace #composer .actions { display:contents; }
.staff-workspace #composer .client-composer-tools { grid-column:1; grid-row:3; display:flex; align-items:center; gap:4px; min-width:0; }
.staff-workspace #composer textarea { grid-column:2; grid-row:3; min-width:0; width:100%; height:44px; min-height:44px; max-height:100px; padding:10px 13px; line-height:22px; resize:none; border-radius:14px; }
.staff-workspace #composer { grid-template-columns:auto minmax(0,1fr) 44px; align-items:center; }
.staff-workspace #composer .actions > button[type=submit] { grid-column:3; grid-row:3; display:grid; place-items:center; width:44px; height:44px; min-width:44px; min-height:44px; padding:5px; border-radius:11px; background:#14233d; border:1px solid #607291; color:#fff; }
.staff-workspace #composer .client-composer-tools button { display:grid; place-items:center; width:44px; height:44px; min-width:44px; min-height:44px; padding:5px; border-radius:11px; background:#14233d; border:1px solid #607291; }
.staff-workspace #composer :is(.client-composer-tools button,.actions > button[type=submit]) img { width:24px; height:24px; object-fit:contain; }
.staff-workspace #composer :is(.client-attachment-summary,.reply-draft) { grid-column:1/-1; }
.staff-workspace #composer > small { grid-column:1/-1; }
:root[data-theme="dark"] .staff-workspace #composer textarea { background:#1a2b48; color:#f1eade; border-color:#607291; }
:root[data-theme="dark"] .staff-workspace #composer textarea::placeholder { color:#aebdd2; }
:root[data-theme="dark"] .staff-workspace #composer :is(.client-composer-tools button,.actions > button[type=submit]) { background:#1a2b48; border-color:#607291; color:#f1eade; }
.staff-workspace #composer :is(.client-composer-tools button,.actions > button[type=submit]):focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
@media(max-width:620px) {
 .staff-workspace #composer { grid-template-columns:auto minmax(0,1fr) 40px; padding:8px; gap:4px; }
 .staff-workspace #composer .client-composer-tools { gap:2px; }
 .staff-workspace #composer .client-composer-tools button { width:36px; min-width:36px; height:40px; min-height:40px; padding:3px; }
 .staff-workspace #composer .actions > button[type=submit] { width:40px; min-width:40px; height:40px; min-height:40px; }
 .staff-workspace #composer textarea { height:40px; min-height:40px; padding:8px 10px; }
 .staff-workspace #composer :is(.client-composer-tools button,.actions > button[type=submit]) img { width:22px; height:22px; }
}

/* Minimal, borderless admin composer controls. */
.staff-workspace #composer { border-top:0 !important; box-shadow:none; }
.staff-workspace #composer .client-composer-tools button,
.staff-workspace #composer .actions > button[type=submit],
:root[data-theme="dark"] .staff-workspace #composer .client-composer-tools button,
:root[data-theme="dark"] .staff-workspace #composer .actions > button[type=submit] {
  border:0 !important; box-shadow:none !important; background:transparent !important;
}
.staff-workspace #composer .client-composer-tools button:hover,
.staff-workspace #composer .actions > button[type=submit]:hover { background:rgba(125,145,175,.12) !important; }

/* Minimal admin chat header: all management actions are inside avatar dialog. */
.staff-workspace #chatHead { max-height:none; overflow:visible; padding:12px 16px; }
.staff-workspace #chatHead .admin-minimal-header { justify-content:flex-start; align-items:center; gap:12px; min-height:48px; }
.admin-avatar-trigger { display:grid; place-items:center; flex:none; padding:0; margin:0; border:0; background:transparent; border-radius:50%; cursor:pointer; }
.admin-avatar-trigger .avatar { width:44px; height:44px; border-radius:50%; object-fit:cover; }
.admin-avatar-trigger:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.admin-client-summary { display:flex; flex-direction:column; align-items:flex-start; gap:3px; min-width:0; }
.admin-client-summary strong { overflow-wrap:anywhere; }
.admin-client-summary .sub { margin:0; }
.admin-presence-dot { width:9px; height:9px; border-radius:50%; display:inline-block; background:#9299a5; }
.admin-presence-dot.is-online { background:#38c778; }
.admin-client-dialog { width:min(480px,calc(100vw - 28px)); max-height:min(80vh,700px); overflow:auto; border:1px solid var(--line); border-radius:18px; padding:20px; color:var(--text); background:var(--surface); box-shadow:0 18px 60px #0006; }
.admin-client-dialog::backdrop { background:#0009; }
.admin-client-dialog-heading { display:flex; align-items:center; gap:12px; margin-bottom:18px; }
.admin-client-dialog-heading .avatar { width:52px; height:52px; border-radius:50%; object-fit:cover; flex:none; }
.admin-client-dialog-heading h2 { margin:0 0 4px; font-size:1.1rem; overflow-wrap:anywhere; }
.admin-client-dialog-heading .sub { margin:0; }
.admin-client-close { margin-left:auto; border:0; background:transparent; color:inherit; font-size:20px; }
.admin-client-dialog > .row { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:12px 0; }
.admin-client-dialog > .call-client { display:inline-flex; margin-bottom:8px; }
.admin-client-dialog > details { margin-top:12px; }
@media(max-width:600px) { .admin-client-dialog { padding:16px; } .staff-workspace #chatHead { padding:10px 12px; } }

/* Presence indicator anchored to bottom-right of clickable client avatar. */
.admin-avatar-trigger { position:relative; overflow:visible; }
.admin-avatar-trigger > .admin-presence-dot { position:absolute; right:0; bottom:0; width:11px; height:11px; border:2px solid #112039; border-radius:50%; pointer-events:none; box-sizing:border-box; }

/* Avatar presence indicator: overlap lower-right rim like the provided reference. */
.staff-workspace .admin-avatar-trigger { position:relative; width:44px; height:44px; overflow:visible; isolation:isolate; }
.staff-workspace .admin-avatar-trigger > .admin-presence-dot { position:absolute; right:-2px; bottom:-2px; width:13px; height:13px; border:2px solid #112039; border-radius:50%; z-index:2; pointer-events:none; box-shadow:0 0 0 1px #112039; }
.staff-workspace .admin-avatar-trigger > .admin-presence-dot.is-online { background:#38c778; }
.staff-workspace .admin-avatar-trigger > .admin-presence-dot.is-offline { background:#9299a5; }

/* Admin avatar details: mirror the client's centered profile/settings arrangement. */
.admin-client-dialog {
  position:relative; width:min(460px,calc(100vw - 24px));
  max-height:calc(100dvh - 24px); overflow-y:auto;
  padding:26px 22px 24px; border:1px solid #354a66;
  border-radius:22px; background:#112036; color:#f4f3ed;
  text-align:center; box-shadow:0 18px 60px #0008;
}
.admin-client-dialog::backdrop { background:#061126bb; }
.admin-client-dialog-heading { display:flex; flex-direction:column; align-items:center; gap:12px; margin:8px 0 24px; }
.admin-client-dialog-avatar .avatar { display:block; width:112px; height:112px; border-radius:50%; object-fit:cover; font-size:2rem; }
.admin-client-dialog-heading h2 { margin:0; font-size:1.4rem; line-height:1.3; color:#f4f3ed; }
.admin-client-dialog-heading .sub { margin:0; font-size:1rem; color:#aebcd0; }
.admin-client-dialog-settings { display:grid; gap:10px; }
.admin-client-dialog-settings > button,
.admin-client-dialog-settings > a,
.admin-client-dialog-settings > .tag,
.admin-client-dialog-settings > span,
.admin-client-dialog-settings > details > summary,
.admin-client-dialog-settings > details .row > button {
  display:flex; align-items:center; justify-content:center; width:100%; min-height:52px;
  padding:12px 14px; border:1px solid #354a66; border-radius:12px;
  background:#1a2e49; color:#f4f3ed; font:inherit; text-align:center;
  text-decoration:none; box-sizing:border-box;
}
.admin-client-dialog-settings > details .row { display:grid; gap:8px; padding-top:8px; }
.admin-client-dialog-settings > details { margin:0; }
.admin-client-dialog-settings > details > summary { cursor:pointer; list-style-position:inside; }
.admin-client-dialog-settings > button:hover,
.admin-client-dialog-settings > a:hover,
.admin-client-dialog-settings > details button:hover { background:#263d5c; }
.admin-client-dialog-settings .danger { color:#ffb8b8; }

.admin-client-dialog > .sub { margin:14px 0 0; }
@media(max-width:600px) { .admin-client-dialog { padding:20px 16px; } }

/* Modal is mounted under document.body, not inside .staff-workspace. */
.admin-client-dialog { margin:auto; }
.admin-client-dialog .admin-client-dialog-settings > .tag { border-radius:12px; }

/* Admin profile closes via backdrop click or Escape; no visible X button. */
.admin-client-dialog-heading { margin-top:8px; }

/* Hide any legacy close control left by an older rendered profile dialog. */
.admin-client-dialog > .admin-client-close,
.admin-client-dialog > button[aria-label="Close"],
.admin-client-dialog > button[aria-label="Close profile"] { display:none !important; }

/* Mobile admin: minimal chat header; actions are available from the avatar popup. */
@media (max-width:620px) {
  .staff-workspace.thread-open .mobile-chat-controls { display:none !important; }
  .staff-workspace.thread-open #chatHead { max-height:none; }
  .staff-workspace.thread-open.mobile-requests-open > #tracking:not([hidden]) { display:block; }
}

/* Admin message actions: compact dark context menu, desktop + installed app */
.reaction-picker.admin-message-menu { background:#252525; color:#f2f2f2; border:0; border-radius:12px; width:172px; padding:8px; box-shadow:0 12px 28px #0008; transform:none; }
.reaction-picker.admin-message-menu:popover-open { display:flex; flex-direction:column; gap:0; }
.reaction-picker.admin-message-menu button { display:flex; align-items:center; justify-content:flex-start; width:100%; min-height:34px; padding:8px 10px; background:transparent; color:#f2f2f2; border:0; border-radius:6px; text-align:left; font-size:13px; font-weight:600; }
.reaction-picker.admin-message-menu button:hover,.reaction-picker.admin-message-menu button:focus-visible { background:#3b3b3b; }
.reaction-picker.admin-message-menu .reaction-picker-emoji { display:inline; font-size:17px; margin-right:8px; }
.reaction-picker.admin-message-menu .reaction-trigger { display:none !important; }
.staff-workspace #messages .bubble { -webkit-touch-callout:none; }

/* Compact translucent action menu straddles the selected message edge. */
.reaction-picker.admin-message-menu {
  width:138px !important; max-width:calc(100vw - 16px);
  padding:5px !important; border:0 !important; border-radius:10px !important;
  background:rgba(31,34,39,.84) !important;
  backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
  box-shadow:0 8px 22px rgba(0,0,0,.22) !important;
  transform:none !important; animation:none !important;
}
.reaction-picker.admin-message-menu button {
  min-height:29px !important; padding:5px 7px !important;
  border:0 !important; font-size:12px !important; font-weight:500 !important;
  background:transparent !important;
}
.reaction-picker.admin-message-menu button:hover { background:rgba(255,255,255,.12) !important; }
.reaction-picker.admin-message-menu .reaction-picker-emoji {font-size:15px !important; margin-right:6px !important;}
.admin-reaction-display {display:flex; gap:3px; align-items:center; flex-wrap:wrap; margin-top:5px; width:fit-content;}
.admin-reaction-item {font-size:16px; line-height:1.2; border-radius:12px; padding:2px 5px; background:rgba(255,255,255,.12);}

/* 2026-11-21: explicit top-layer positioning, borderless translucent menu */
.reaction-picker.admin-message-menu:popover-open {
  position:fixed !important; right:auto !important; bottom:auto !important;
  margin:0 !important; transform:none !important; width:140px !important;
  background:rgba(32,34,39,.73) !important;
  border:0 !important; outline:0 !important; box-shadow:0 5px 18px #0003 !important;
  backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px);
}
.staff-workspace #messages .bubble .admin-reaction-display {
  display:flex !important; align-items:center; gap:4px;
  margin:5px 0 0; min-height:20px; width:max-content;
}
.staff-workspace #messages .bubble .admin-reaction-item {
  display:inline-flex !important; font-size:17px; line-height:22px;
  background:rgba(255,255,255,.12); border-radius:12px; padding:1px 6px;
}

/* Admin reactions: compact emoji badge overlapping the bottom-right corner of
   its own chat bubble. This does not change the client chat layout. */
.staff-workspace #messages .bubble.has-reactions {
  min-width:0;
  margin-bottom:9px;
}
.staff-workspace #messages .bubble {
  position:relative;
  overflow:visible;
}
.staff-workspace #messages .bubble .admin-reaction-display {
  position:absolute !important;
  z-index:3;
  display:flex !important;
  align-items:center;
  gap:2px;
  right:7px;
  bottom:0;
  transform:translateY(58%);
  width:max-content;
  max-width:calc(100% - 12px);
  min-height:0;
  margin:0 !important;
  padding:0;
  pointer-events:none;
}
.staff-workspace #messages .bubble .admin-reaction-item {
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  padding:1px 3px !important;
  border:0 !important;
  border-radius:999px;
  background:rgba(33,38,47,.88) !important;
  font-size:15px !important;
  line-height:18px !important;
  white-space:nowrap;
  box-shadow:none;
}

/* Admin replies: compact quoted bubble with a tucked-in response, matching client chat. */
.staff-workspace #messages .bubble.admin-reply {
  display:flex; flex-direction:column; align-items:flex-start;
  width:fit-content; max-width:min(85%,640px); padding:0;
  background:transparent!important; box-shadow:none; overflow:visible;
  gap:0;
}
.staff-workspace #messages .bubble.admin-reply.mine {align-items:flex-end;}
.staff-workspace #messages .admin-reply-caption {
  display:block; padding:0 7px 4px; font-size:11px;
  color:#aebcd0; background:transparent; line-height:1.3;
}
.staff-workspace #messages .admin-reply .message-quote {
  display:block; width:fit-content; max-width:100%;
  margin:0 0 -10px; padding:9px 13px 18px;
  border:0; border-radius:17px; background:#30343b; color:#c7cdd7;
  font-size:12px; line-height:1.35; text-align:left;
  white-space:pre-wrap; overflow-wrap:anywhere;
}
.staff-workspace #messages .admin-reply > .message-body {
  position:relative; z-index:1; width:fit-content; max-width:100%;
  padding:9px 13px; border-radius:17px;
  background:#1c2e4a; color:#f3f5f9;
  font-size:14px; line-height:1.4;
}
.staff-workspace #messages .admin-reply.mine > .message-body {
  background:#5639e9; color:#fff;
}
.staff-workspace #messages .admin-reply .admin-reaction-display {z-index:2;}
@media(max-width:620px){
  .staff-workspace #messages .bubble.admin-reply {max-width:92%;}
}

/* Admin: full-bleed image/document messages, with grouped photo overlap. */
.staff-workspace #messages .bubble.admin-image-bubble,
.staff-workspace #messages .bubble.admin-document-bubble {
  width:fit-content; max-width:min(76%, 330px); padding:0 !important;
  background:transparent !important; border:0 !important;
  box-shadow:none !important; overflow:visible; white-space:normal;
}
.staff-workspace #messages .bubble.admin-image-bubble > small,
.staff-workspace #messages .bubble.admin-document-bubble > small { display:none; }
.staff-workspace #messages .admin-image-preview,
.staff-workspace #messages .admin-document-preview {
  display:block; width:fit-content; max-width:100%; padding:0; margin:0;
  background:transparent; border:0; border-radius:15px; overflow:hidden;
  line-height:0; box-shadow:none; text-align:left;
}
.staff-workspace #messages .admin-image-preview img,
.staff-workspace #messages .admin-document-preview img {
  display:block; width:auto; height:auto; max-width:100%; max-height:440px;
  object-fit:contain; border:0; border-radius:15px;
}
.staff-workspace #messages .admin-image-preview:focus-visible,
.staff-workspace #messages .admin-document-preview:focus-visible { outline:2px solid #d4b574; outline-offset:3px; }
.staff-workspace #messages .bubble.admin-image-stack { margin-top:-34px; z-index:1; }
.staff-workspace #messages .bubble.admin-image-stack:nth-child(even) { transform:translateX(17px); }
.staff-workspace #messages .bubble.admin-image-stack:nth-child(odd) { transform:translateX(-10px); }
.staff-workspace #messages .bubble.admin-image-stack.mine:nth-child(even) { transform:translateX(-17px); }
.staff-workspace #messages .bubble.admin-image-stack.mine:nth-child(odd) { transform:translateX(10px); }
@media(max-width:620px) {
 .staff-workspace #messages .bubble.admin-image-bubble,
 .staff-workspace #messages .bubble.admin-document-bubble { max-width:min(78%, 280px); }
 .staff-workspace #messages .admin-image-preview img,
 .staff-workspace #messages .admin-document-preview img { max-height:390px; }
}

/* Compact admin client list: avatar, assignment, presence. */
.staff-workspace #sidebar .people { display:flex; flex-direction:column; gap:2px; }
.staff-workspace #sidebar .people > .person { display:block; width:100%; margin:0; padding:7px 9px; border:0; border-radius:11px; background:transparent; text-align:left; box-shadow:none; min-height:62px; }
.staff-workspace #sidebar .people > .person:hover { background:rgba(135,160,195,.12); }
.staff-workspace #sidebar .people > .person.selected { background:rgba(135,160,195,.20); }
.staff-workspace #sidebar .people > .person:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.staff-workspace .admin-list-entry { display:flex; align-items:center; gap:11px; min-width:0; width:100%; }
.staff-workspace .admin-list-avatar { position:relative; display:block; width:48px; height:48px; flex:0 0 48px; }
.staff-workspace .admin-list-avatar > .avatar { display:grid; width:48px; height:48px; border-radius:50%; object-fit:cover; overflow:hidden; place-items:center; }
.staff-workspace .admin-list-presence { position:absolute; bottom:0; right:-1px; width:13px; height:13px; border-radius:50%; border:2px solid #112039; background:#9299a5; box-sizing:border-box; }
.staff-workspace .admin-list-presence.is-online { background:#38c778; }
.staff-workspace .admin-list-details { display:flex; flex:1; flex-direction:column; gap:4px; min-width:0; }
.staff-workspace .admin-list-name { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.92rem; line-height:1.25; }
.staff-workspace .admin-list-assignment { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:.78rem; line-height:1.25; }
.staff-workspace .admin-list-unread { width:8px; height:8px; border-radius:50%; background:#d8b36a; flex:none; }
.staff-workspace #sidebar .people > .person:disabled { opacity:.6; }
@media(max-width:620px) { .staff-workspace #sidebar .people > .person { min-height:64px; padding:8px 9px; } }

/* Client list v2: intentionally scoped to the real sidebar rendered by renderSidebar(). */
.workspace.staff-workspace aside#sidebar .people {display:flex!important;flex-direction:column!important;gap:0!important;max-height:none!important;overflow:visible!important;}
.workspace.staff-workspace aside#sidebar .people button.person {display:block!important;width:100%!important;min-height:60px!important;margin:0!important;padding:6px 8px!important;border:0!important;border-radius:10px!important;background:transparent!important;box-shadow:none!important;color:inherit!important;text-align:left!important;}
.workspace.staff-workspace aside#sidebar .people button.person.selected {background:rgba(120,149,190,.18)!important;}
.workspace.staff-workspace aside#sidebar .people button.person .admin-list-entry {display:flex!important;flex-direction:row!important;align-items:center!important;gap:11px!important;width:100%!important;}
.workspace.staff-workspace aside#sidebar .people button.person .admin-list-avatar {position:relative!important;display:block!important;width:46px!important;height:46px!important;flex:0 0 46px!important;}
.workspace.staff-workspace aside#sidebar .people button.person .admin-list-avatar .avatar {width:46px!important;height:46px!important;border-radius:50%!important;object-fit:cover!important;}
.workspace.staff-workspace aside#sidebar .people button.person .admin-list-presence {position:absolute!important;right:0!important;bottom:0!important;display:block!important;width:13px!important;height:13px!important;border-radius:50%!important;border:2px solid #142238!important;background:#888e98!important;z-index:2!important;}
.workspace.staff-workspace aside#sidebar .people button.person .admin-list-presence.is-online {background:#32c76a!important;}
.workspace.staff-workspace aside#sidebar .people button.person .admin-list-details {display:flex!important;flex:1!important;flex-direction:column!important;gap:3px!important;min-width:0!important;}
.workspace.staff-workspace aside#sidebar .people button.person .admin-list-name {display:block!important;font-size:14px!important;font-weight:650!important;line-height:1.25!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;}
.workspace.staff-workspace aside#sidebar .people button.person .admin-list-assignment {display:block!important;font-size:12px!important;line-height:1.25!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;opacity:.78!important;}

/* New clients, unread names, and unobtrusive centered chat timestamps. */
.workspace.staff-workspace #sidebar .pending-list-title { margin-top:14px; color:var(--muted); font-size:.83rem; }
.workspace.staff-workspace #sidebar .pending-list-title + .people { margin-bottom:10px; }
.workspace.staff-workspace aside#sidebar .people button.person .admin-list-name.has-unread { color:#43d67d!important; }
.workspace.staff-workspace aside#sidebar .people button.person .admin-list-unread { background:#43d67d; }
.workspace.staff-workspace #messages .admin-chat-time-divider {
  display:block; width:100%; flex:none; align-self:center; text-align:center;
  font-size:11px; line-height:1.4; color:#b6c5d8; opacity:.85;
  background:transparent; border:0; padding:8px 0 2px; margin:3px 0;
  white-space:nowrap; pointer-events:none;
}

/* Desktop: smaller requests above persistent team chat; mobile retains its original interface. */
@media (min-width: 901px) {
 .workspace.staff-workspace > #tracking:not([hidden]) { display:flex; flex-direction:column; overflow:hidden; padding:0; }
 .workspace.staff-workspace #desktop-request-area { flex:0 0 29%; min-height:100px; max-height:36%; overflow:auto; padding:13px; border-bottom:1px solid rgba(150,170,195,.18); }
 .workspace.staff-workspace #desktop-request-area h2 { font-size:.95rem; margin-bottom:8px; }
 .workspace.staff-workspace #desktop-team-panel { flex:1 1 0; min-height:0; display:flex; flex-direction:column; padding:12px; gap:8px; }
 .workspace.staff-workspace #desktop-team-panel h2 { margin:0; font-size:.95rem; }
 .workspace.staff-workspace #desktop-team-feed { flex:1; min-height:0; overflow:auto; display:flex; flex-direction:column; gap:8px; }
 .workspace.staff-workspace .desktop-team-bubble { align-self:flex-start; max-width:94%; padding:8px 10px; border-radius:13px; background:rgba(120,145,180,.16); overflow-wrap:anywhere; font-size:.82rem; }
 .workspace.staff-workspace .desktop-team-bubble.mine { align-self:flex-end; background:rgba(100,130,190,.3); }
 .workspace.staff-workspace .desktop-team-bubble small { display:block; opacity:.7; font-size:.7rem; margin-bottom:3px; }
 .workspace.staff-workspace .desktop-team-composer { display:flex; flex-direction:row; gap:6px; align-items:center; }
 .workspace.staff-workspace .desktop-team-composer textarea { flex:1; min-width:0; min-height:40px; height:40px; max-height:90px; resize:vertical; border-radius:16px; font-size:13px; }
 .workspace.staff-workspace .desktop-team-send { flex:none; height:40px; min-width:38px; border-radius:12px; }
 .workspace.staff-workspace #sidebar > button.person[data-client-id="team"] { display:none!important; }
}
@media (max-width: 900px) {
 .workspace.staff-workspace #desktop-team-panel { display:none!important; }
 .workspace.staff-workspace #desktop-request-area { display:contents; }
}

/* Show actual team message content beneath the sender label. */
@media (min-width: 901px) {
 .workspace.staff-workspace .desktop-team-bubble .desktop-team-message {display:block;white-space:pre-wrap;color:var(--text,#f0f3f8);font-size:13px;line-height:1.4;overflow-wrap:anywhere;}
}

/* Rich desktop team chat */
@media (min-width:621px) {
.workspace.staff-workspace #desktop-team-panel .desktop-team-composer {gap:4px;}
.workspace.staff-workspace .desktop-team-attach {flex:none;background:transparent;border:0;padding:5px;min-width:28px;font-size:20px;}
.workspace.staff-workspace .desktop-team-file-preview {display:block;background:transparent;border:0;padding:0;max-width:100%;cursor:pointer;}
.workspace.staff-workspace .desktop-team-file-preview img {display:block;max-width:100%;width:auto;max-height:230px;object-fit:contain;border-radius:10px;}
.workspace.staff-workspace .desktop-team-other-file {max-width:100%;overflow-wrap:anywhere;text-align:left;}
.workspace.staff-workspace .desktop-team-quote {font-size:11px;opacity:.75;padding:5px 7px;border-radius:7px;background:rgba(0,0,0,.22);margin:4px 0;}
.workspace.staff-workspace .desktop-team-reactions {position:absolute;right:3px;bottom:-10px;font-size:15px;}
.workspace.staff-workspace .desktop-team-bubble {position:relative;margin-bottom:7px;}
.workspace.staff-workspace .desktop-team-reply {display:flex;justify-content:space-between;gap:6px;font-size:11px;padding:6px 8px;background:rgba(100,130,190,.15);border-radius:9px;}
.workspace.staff-workspace .desktop-team-reply[hidden],.workspace.staff-workspace .desktop-team-selected-files[hidden] {display:none;}
.workspace.staff-workspace .desktop-team-selected-files {font-size:11px;overflow-wrap:anywhere;}
.desktop-team-action-menu {position:fixed;inset:auto;margin:0;width:145px;padding:6px;background:rgba(33,35,40,.94);border:0;border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.3);color:white;z-index:9999;}
.desktop-team-action-menu button {display:block;width:100%;text-align:left;padding:7px 9px;border:0;background:transparent;color:inherit;font-size:12px;}
.desktop-team-action-menu button:hover {background:rgba(255,255,255,.12);}
}

/* File drag target: applies only while a file is hovering over a composer. */
#composer, .desktop-team-composer {position:relative;}
#composer.file-drop-active, .desktop-team-composer.file-drop-active {outline:2px dashed var(--accent, #c9a85c);outline-offset:-3px;background:rgba(140,165,205,.10);border-radius:12px;}
#composer.file-drop-active::after, .desktop-team-composer.file-drop-active::after {content:'Drop files to attach';position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(12,23,40,.88);color:#fff;font-size:13px;font-weight:600;border-radius:12px;pointer-events:none;z-index:5;}

/* Compact Team & Payment Settings dashboard and focused popup panels. */
.owner-settings > div { display:block; margin-top:12px; }
.owner-settings .settings-home { width:100%; }
.settings-intro h3 { margin:0 0 4px; font-size:1.1rem; }
.settings-intro p { margin:0 0 14px; opacity:.72; font-size:.9rem; }
.settings-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:10px; }
.settings-tile { display:flex; align-items:center; gap:12px; width:100%; min-height:100px; padding:15px; text-align:left; border:1px solid rgba(147,170,205,.2); border-radius:14px; background:rgba(117,146,188,.07); color:inherit; cursor:pointer; transition:background .15s,border-color .15s; }
.settings-tile:hover,.settings-tile:focus-visible { background:rgba(117,146,188,.16); border-color:rgba(147,170,205,.5); }
.settings-tile-icon { display:grid; place-items:center; flex:none; width:42px; height:42px; border-radius:12px; background:rgba(117,146,188,.15); font-size:1.35rem; }
.settings-tile-copy { display:flex; flex:1; min-width:0; flex-direction:column; gap:4px; }
.settings-tile-copy strong { font-size:.95rem; }
.settings-tile-copy small { font-size:.79rem; opacity:.72; line-height:1.35; }
.settings-tile-detail { font-size:.75rem; font-weight:600; opacity:.8; margin-top:3px; }
.settings-tile-arrow { font-size:1.7rem; opacity:.55; }
.settings-function-dialog { box-sizing:border-box; width:min(560px,calc(100vw - 24px)); max-height:min(85dvh,850px); margin:auto; padding:0; border:1px solid rgba(147,170,205,.25); border-radius:18px; color:inherit; background:#14243a; box-shadow:0 20px 70px rgba(0,0,0,.45); }
.settings-function-dialog::backdrop { background:rgba(2,9,22,.75); }
.settings-dialog-header { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:17px 20px; border-bottom:1px solid rgba(147,170,205,.18); }
.settings-dialog-header h2 { margin:0; font-size:1.13rem; }
.settings-dialog-close { width:36px; height:36px; border-radius:10px; padding:0; font-size:1.1rem; }
.settings-dialog-body { padding:18px 20px 22px; overflow-y:auto; max-height:calc(85dvh - 75px); }
.settings-dialog-body section { display:block; min-width:0; width:100%; }
.settings-dialog-body section > h3 { display:none; }
.settings-dialog-body form { display:grid; gap:12px; margin:12px 0 18px; }
.settings-dialog-body textarea,.settings-dialog-body input:not([type=checkbox]):not([type=file]) { box-sizing:border-box; max-width:100%; width:100%; }
.settings-dialog-body .row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; padding:8px 0; border-bottom:1px solid rgba(147,170,205,.12); }
.settings-dialog-body label { display:block; }
.settings-dialog-body label:has(input[type=checkbox]) { display:flex; gap:8px; align-items:center; }
@media(max-width:600px) { .settings-grid { grid-template-columns:1fr; } .settings-tile { min-height:82px; } .settings-dialog-body { padding:14px; } }
[data-theme="light"] .settings-function-dialog { background:#fff; color:#17243a; }

/* Settings polish v2 — shared desktop and installed mobile PWA. */
.settings-function-dialog { width:min(540px,calc(100vw - 28px)); max-width:calc(100vw - 28px); max-height:min(88dvh,760px); overflow:hidden; color:#f1f5ff; background:#101e33; border:1px solid #34465f; border-radius:20px; box-shadow:0 26px 90px #0009; }
.settings-function-dialog::backdrop { background:rgba(2,8,20,.78); }
.settings-dialog-header { padding:18px 22px; min-height:64px; box-sizing:border-box; }
.settings-dialog-header h2 { font-size:1.12rem; line-height:1.35; font-weight:750; }
.settings-dialog-body { box-sizing:border-box; max-height:calc(88dvh - 66px); overflow-y:auto; overflow-x:hidden; padding:20px 22px 24px; overscroll-behavior:contain; }
.settings-dialog-body section { width:100%; min-width:0; }
.settings-dialog-body form { display:flex; flex-direction:column; align-items:stretch; gap:14px; margin:0; width:100%; min-width:0; }
.settings-dialog-body form > label:not(.settings-toggle-row), .settings-dialog-body .settings-field { display:flex; flex-direction:column; gap:8px; font-size:.88rem; font-weight:650; line-height:1.4; }
.settings-dialog-body textarea { width:100%; max-width:100%; min-width:0; box-sizing:border-box; resize:vertical; padding:12px 13px; border:1px solid #53657e; border-radius:11px; background:#1b2c47; color:#f5f8ff; font:inherit; font-weight:400; line-height:1.5; }
.settings-dialog-body textarea:focus-visible, .settings-dialog-body input:focus-visible { outline:2px solid #edc987; outline-offset:2px; }
.settings-dialog-body .settings-greeting-form textarea { min-height:170px; }
.settings-dialog-body .settings-rule-form textarea { min-height:75px; }
.settings-dialog-body .settings-rule-form label:has(textarea):nth-of-type(2) textarea { min-height:115px; }
.settings-dialog-body .settings-toggle-group { display:flex; flex-direction:column; gap:10px; }
.settings-dialog-body .settings-toggle-row { display:flex !important; flex-direction:row !important; justify-content:space-between; align-items:center; gap:18px; width:100%; box-sizing:border-box; padding:13px 15px; background:#1a2b45; border:1px solid #30425d; border-radius:12px; cursor:pointer; font-weight:600; line-height:1.35; }
.settings-dialog-body .settings-toggle-text { flex:1; min-width:0; font-size:.88rem; }
.settings-dialog-body .settings-toggle-row input[type=checkbox] { appearance:auto; display:block; width:19px; height:19px; min-width:19px; margin:0; accent-color:#edc987; flex:0 0 19px; cursor:pointer; }
.settings-dialog-body .settings-helper, .settings-dialog-body form > small { margin:0; color:#bac8dd; font-size:.79rem; line-height:1.5; }
.settings-dialog-body form > button.primary { width:100%; min-height:44px; border-radius:11px; margin:2px 0 0; font-weight:750; }
.settings-dialog-body #settings-rule-list, .settings-dialog-body .row { min-width:0; overflow-wrap:anywhere; }
.settings-dialog-body section > p { margin:0 0 18px; font-size:.85rem; line-height:1.55; color:#c5d2e5; }
.settings-dialog-body .row span { flex:1 1 190px; min-width:0; overflow-wrap:anywhere; }
.settings-dialog-body .row button { flex:0 0 auto; }
.settings-tile { min-width:0; }
.settings-tile-copy { overflow-wrap:anywhere; }
[data-theme=light] .settings-function-dialog { background:#fff; color:#17243a; border-color:#d4dce8; }
[data-theme=light] .settings-dialog-body .settings-toggle-row { background:#f3f6fb; border-color:#d7dfeb; }
[data-theme=light] .settings-dialog-body textarea { background:#fff; color:#17243a; border-color:#b6c2d2; }
[data-theme=light] .settings-dialog-body .settings-helper, [data-theme=light] .settings-dialog-body form > small, [data-theme=light] .settings-dialog-body section > p { color:#4b5d75; }
@media(max-width:620px) {
  .settings-function-dialog { width:calc(100vw - 20px); max-width:calc(100vw - 20px); max-height:calc(100dvh - 28px); border-radius:17px; }
  .settings-dialog-header { padding:14px 16px; min-height:58px; }
  .settings-dialog-body { max-height:calc(100dvh - 88px); padding:16px; padding-bottom:max(22px,env(safe-area-inset-bottom)); }
  .settings-dialog-body .settings-greeting-form textarea { min-height:155px; }
  .settings-dialog-body .settings-toggle-row { padding:12px; }
  .settings-grid { grid-template-columns:1fr; }
  .settings-tile { min-height:76px; padding:12px; }
}

/* Minimal client file preview; admin preview retains its controls. */
.file-viewer.client-clean-viewer {
  width: min(100vw - 16px, 900px);
  max-height: calc(100dvh - 24px);
  padding: 8px;
  overflow: hidden;
  border-radius: 14px;
}
.file-viewer.client-clean-viewer .file-preview-stage {
  max-height: calc(100dvh - 44px);
  overflow: auto;
  scrollbar-width: none;
  touch-action: none;
}
.file-viewer.client-clean-viewer .file-preview-stage::-webkit-scrollbar { display:none; }
.file-viewer.client-clean-viewer img { max-height: calc(100dvh - 48px); }
@media (max-width: 600px) {
  .file-viewer.client-clean-viewer { width: calc(100vw - 12px); padding: 5px; }
}

/* Compact client message actions: keep Download readable on one line. */
.client-message-menu {
  width: min(258px, calc(100vw - 16px));
  padding: 6px;
  gap: 5px;
  border-radius: 13px;
}
.client-message-menu:popover-open {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.client-message-menu button {
  box-sizing: border-box;
  min-width: 0;
  min-height: 52px;
  padding: 6px 5px;
  font-size: 11px;
  line-height: 1.15;
  font-weight: 500;
  text-align: center;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
  border-radius: 9px;
}
.client-message-menu .reaction-picker-emoji {
  font-size: 19px;
  line-height: 1.15;
  margin-bottom: 3px;
}
@media (max-width: 360px) {
  .client-message-menu { width: min(240px, calc(100vw - 12px)); }
  .client-message-menu button { font-size: 10.5px; padding-inline: 3px; }
}

/* Ensure the Download action remains fully within its tile. */
.client-message-menu button { overflow: hidden; text-overflow: clip; }

/* Download action: icon above a fully contained, readable label. */
.client-message-menu .client-menu-download {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  padding: 5px 2px;
  overflow: hidden;
  white-space: normal;
}
.client-message-menu .client-menu-download-icon {
  display: block;
  font-size: 19px;
  line-height: 1;
  flex-shrink: 0;
}
.client-message-menu .client-menu-download-label {
  display: block;
  max-width: 100%;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.15px;
  white-space: nowrap;
}

/* Keyword Replies and all settings dialogs: fixed header, scrollable content.
   Works in desktop browsers and installed mobile PWA. */
.settings-function-dialog {
  display: none;
  flex-direction: column;
  box-sizing: border-box;
  height: min(760px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}
.settings-function-dialog[open] { display: flex; }
.settings-function-dialog .settings-dialog-header {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}
.settings-function-dialog .settings-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}
@media (max-width: 600px) {
  .settings-function-dialog {
    height: calc(100dvh - 24px);
    max-height: calc(100dvh - 24px);
  }
  .settings-function-dialog .settings-dialog-body {
    max-height: none;
    padding-bottom: max(36px, env(safe-area-inset-bottom));
  }
}

/* Demiurge Tools Center — responsive settings dialogs */
.tools-workspace{display:flex;flex-direction:column;gap:14px;min-width:0;padding:4px 0 16px}.tools-workspace form{display:flex;flex-direction:column;gap:10px}.tools-workspace textarea{box-sizing:border-box;width:100%;min-height:96px;padding:12px;border:1px solid #526580;border-radius:10px;background:#1a2b45;color:#fff;font:inherit}.tools-workspace input[type=color]{width:68px;height:42px;border:1px solid #526580;border-radius:8px;background:transparent;padding:3px}.tools-storage-summary{display:flex;flex-direction:column;gap:10px;overflow-wrap:anywhere}.tools-storage-summary progress{width:100%;height:14px;accent-color:#e6b969}.tools-storage-summary p{margin:0}.tools-qr-preview{width:min(100%,330px);height:auto;align-self:center;background:white;padding:8px;border-radius:12px}.tools-workspace a.primary{display:block;text-align:center;padding:12px;text-decoration:none;border-radius:9px;background:#f2d29d;color:#122037;font-weight:700}.tools-workspace [hidden]{display:none!important}


.tools-workspace select,.tools-workspace input[type=text],.tools-workspace input[type=file]{width:100%;box-sizing:border-box;padding:11px;border:1px solid #526580;border-radius:9px;background:#1a2b45;color:#fff;font:inherit;min-width:0}.tools-code-status{font-weight:650;color:#b3ebc4;min-height:20px}.tools-image-info{overflow-wrap:anywhere;color:#f2d29d}.tools-workspace input[hidden],.tools-workspace label[hidden]{display:none!important}

/* PDF Studio: compact ordered file list */
.tools-pdf-row{display:flex;align-items:center;gap:8px;padding:8px 0;border-bottom:1px solid rgba(150,160,180,.25)}
.tools-pdf-row span{flex:1;min-width:0;overflow-wrap:anywhere}
.tools-pdf-row button{min-width:36px;min-height:34px;cursor:pointer}
.tools-pdf-order{margin:8px 0 14px}

.tools-clear-files{display:inline-flex;align-items:center;justify-content:center;align-self:flex-start;margin:10px 0;padding:8px 14px;border:1px solid rgba(150,160,180,.45);border-radius:8px;background:transparent;color:inherit;cursor:pointer}
.tools-clear-files:hover{background:rgba(150,160,180,.12)}
