/* Loaded on phones and in the desktop phone preview. */
:root {
  --phone-ink: #172c26;
  --phone-muted: #596e65;
  --phone-green: #146d57;
  --phone-tint: #e8f4ed;
  --phone-line: #e5ebe7;
  --phone-pad: clamp(15px, 4vw, 22px);
  --phone-sheet-width: 530px;
  background: #fff;
}
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  position: fixed; inset: 0; width: 100%; margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--phone-ink); background: #fff;
}
.phone-only { display: inline-flex; }
.app-shell { height: var(--app-height,100dvh); min-height: 0; background: white; transform: translateY(var(--phone-offset,0px)); }
.workspace { height: 100%; min-height: 0; padding: 0; }
body:not(.has-chat):not(.mobile-device) .workspace { padding-top: env(safe-area-inset-top,0px); }
.rail, .workspace > .topbar, .workspace-heading, .account-toolbar, .list-footer, .demo-banner { display: none; }
.inbox-layout { display: flex; flex: 1; min-height: 0; overflow: clip; border: none; border-radius: 0; box-shadow: none; }
.conversation-panel { width: 100%; min-width: 0; border: 0; display: flex; background: white; }
.conversation-main, .connection-panel { display: none; }
.has-chat .conversation-panel, .has-chat .phone-nav { display: none; }
.has-chat .conversation-main { display: flex; flex: 1; width: 100%; min-height: 0; }
.mobile-device .conversation-panel, .mobile-device .conversation-main { display: none; }
.mobile-device .connection-panel { display: block; width: 100%; border: 0; overflow: auto; }
body:has(#loginDialog[open]) .app-shell { visibility: hidden; }

.list-tools {
  padding: 8px var(--phone-pad) 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; flex: 0 0 auto;
}
.search {
  grid-row: 1; grid-column: 1; min-height: 45px; gap: 9px; padding: 0 13px;
  background: #f3f5f3; border: 1px solid transparent; border-radius: 14px;
}
.search:focus-within { border-color: #86ae9b; }
.search svg { width: 19px; height: 19px; color: #637a6e; }
.search input, .search input::placeholder { color: #61756a; }
.search input { color: var(--phone-ink); }
.list-tools:not(:has(.owner-control:not([hidden]))) .search { grid-column: 1 / -1; }
.owner-control {
  grid-column: 2; grid-row: 1; position: relative; display: grid; place-items: center; width: 45px;
  border-radius: 14px; background: #f3f5f3; color: #50665a;
}
.owner-control svg { width: 20px; height: 20px; }
.owner-control select { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.owner-control.filtered { color: var(--phone-green); background: #dcefe4; }
.owner-control:focus-within { outline: 2px solid #87ac9c; }
.filter-tabs { grid-column: 1/-1; grid-row: 2; display: flex; align-items: center; gap: 6px; margin: 0; padding: 0 0 6px; border: 0; }
.filter-tabs button {
  min-height: 42px; padding: 0 12px; color: #5a6d62; font-size: 13px; font-weight: 550;
  border: 0; border-radius: 14px; background: transparent; line-height: 1.3;
}
.filter-tabs button.selected { color: #155a43; background: var(--phone-tint); font-weight: 650; }
.filter-tabs span { display: inline; margin-left: 3px; padding: 0; color: inherit; background: none; font-size: 11px; font-variant-numeric: tabular-nums; }

.chat-list { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 var(--phone-pad) 8px; border-top: 1px solid var(--phone-line); }
.chat-row {
  align-items: center; gap: 13px; position: relative; padding: 13px 0;
  border-radius: 0; color: var(--phone-ink); min-height: 82px;
}
.chat-row::after { content: ""; position: absolute; left: 62px; bottom: 0; right: 0; height: 1px; background: #edf0ed; }
.chat-row.selected, .chat-row:hover { background: transparent; }
.chat-row:active, .phone-nav button:active, .sheet-actions button:active { background: #eef5ef; }
.avatar {
  width: 49px; height: 49px; border-radius: 50%; font-weight: 650; font-size: 17px;
  color: #3c715b; background: #dcebe0; letter-spacing: .2px;
}
.avatar.c1 { color: #6f587f; background: #eee4ef; }
.avatar.c2 { color: #426781; background: #dceaf2; }
.avatar.c3 { color: #8d5b42; background: #f5e5d8; }
.avatar.c4 { color: #775d38; background: #f2e9ce; }
.avatar.c5 { color: #3e706c; background: #d9eae7; }
.avatar svg { width: 23px; height: 23px; }
.row-top { margin: 0 0 3px; gap: 10px; }
.row-name { color: var(--phone-ink); font-size: 16px; line-height: 1.35; font-weight: 650; }
.row-time { color: #64766c; font-size: 11px; font-variant-numeric: tabular-nums; }
.row-preview { color: #52655b; font-size: 14px; line-height: 1.45; }
.row-owner { color: #65786e; font-size: 11px; line-height: 1.35; margin-top: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.unread-badge { min-width: 21px; height: 20px; padding: 0 5px; border-radius: 12px; background: #197456; font-weight: 650; font-size: 11px; }
.list-empty, .no-messages { font-size: 14px; color: var(--phone-muted); padding: 52px 16px; }
.phone-nav {
  display: flex; justify-content: space-around; align-items: stretch; gap: 4px; flex-shrink: 0;
  padding: 5px 12px calc(5px + env(safe-area-inset-bottom,0px)); border-top: 1px solid var(--phone-line); background: #fff;
}
#phoneClaimSlot { display: contents; }
.phone-nav button {
  position: relative; display: flex; flex: 1; align-items: center; justify-content: center; flex-direction: column;
  gap: 2px; min-width: 0; min-height: 53px; font-size: 11px; line-height: 1.3; font-weight: 550;
  color: #5b7064; border: none; border-radius: 13px; background: transparent; box-shadow: none; padding: 3px;
}
.phone-nav button svg { width: 43px; height: 27px; padding: 2px 10px; border-radius: 14px; stroke-width: 1.8; }
.phone-nav button[aria-current="page"], body:has(#claimsDialog[open]) #openClaims, body:has(#phoneWorkSheet[open]) #phoneWork { color: var(--phone-green); font-weight: 650; }
.phone-nav button[aria-current="page"] svg { color: var(--phone-green); background: var(--phone-tint); }
#claimCount { position: absolute; left: calc(50% + 7px); top: 0; border-radius: 10px; border: 2px solid white; min-width: 17px; padding: 0 3px; background: #cbefdd; color: #1a533c; font-size: 10px; line-height: 14px; }

.chat-view { width: 100%; height: 100%; background: #f0f4f0; }
.chat-header {
  flex: 0 0 auto; align-items: center; gap: 7px; min-height: 65px;
  padding: calc(8px + env(safe-area-inset-top,0px)) 8px 8px; background: #fff; border-bottom: 1px solid #e0e8e2;
}
.chat-header .avatar { width: 39px; height: 39px; font-size: 14px; }
.chat-profile-trigger { min-height: 44px; gap: 7px; }
.chat-name { color: var(--phone-ink); margin: 0 0 3px; font-size: 17px; line-height: 1.3; font-weight: 650; }
.chat-subtitle { color: #63766b; font-size: 11px; line-height: 1.4; }
.back-button, .phone-icon, .sheet-heading button {
  display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; color: #345045; padding: 0; border-radius: 50%; flex: 0 0 auto;
}
.back-button svg, .phone-icon svg { width: 22px; height: 22px; }
.chat-header .handle-full { display: none; }
#markHandled {
  display: inline-flex; align-items: center; justify-content: center; min-width: 45px; min-height: 42px; padding: 0 9px;
  border: 0; border-radius: 14px; color: #4b6958; background: #f2f5f2; font-size: 12px;
}
#markHandled:enabled { background: var(--phone-tint); color: #216444; }
#markHandled:disabled { opacity: .75; cursor: default; }
.focus-notice, .connection-notice { margin: 0; border: 0; border-radius: 0; padding: 8px 16px; color: #635831; font-size: 12px; background: #faf3da; }
.focus-notice button { min-height: 32px; font-size: 12px; }
.messages { min-height: 0; flex: 1; padding: 12px var(--phone-pad) 8px; overscroll-behavior: contain; }
.messages .text-button { font-size: 12px; min-height: 40px; margin-bottom: 4px; color: #4e6d5d; }
.date-label {
  width: max-content; margin: 5px auto 16px; border-radius: 12px; padding: 4px 10px;
  color: #5b7061; background: #e3eae4; font-size: 11px; line-height: 1.4; letter-spacing: 0;
}
.message-row { margin: 0 0 14px; }
.bubble {
  max-width: 85%; background: white; border: 1px solid #e2e9e2; border-radius: 17px 17px 17px 5px;
  padding: 10px 13px; color: #253a2e; font-size: 16px; line-height: 1.55; box-shadow: 0 1px 2px #172f2110;
}
.own .bubble { background: #166e57; border-color: #166e57; color: white; border-radius: 17px 17px 5px 17px; }
.own .bubble .message-url { color: white; }
.own .bubble.has-attachment { background: #e2f0e5; border-color: #ccdfd0; color: var(--phone-ink); }
.own .bubble.has-attachment .message-url { color: var(--phone-green); }
.bubble.has-attachment { max-width: 87%; width: 285px; padding: 7px; }
.media-frame { border-radius: 11px; }
.inline-image { max-height: 290px; }
.media-actions { gap: 9px; }
.media-button,.media-download { min-height: 36px; display: inline-flex; align-items: center; font-size: 12px; }
.message-meta { font-size: 11px; color: #617368; margin-top: 4px; gap: 6px; }
.message-meta.uncertain { color: #7c5528; }
.message-meta button { min-height: 32px; font-size: 12px; color: #226349; }
.message-meta .read { color: #1c7665; }
.message-author { font-size: 12px; color: #556e5d; }
.message-highlight > .bubble { outline: 2px solid #a77c28; outline-offset: 3px; }

.composer {
  flex: 0 0 auto; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 0 9px;
  padding: 8px max(12px,env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left));
  margin: 0; border: 0; border-top: 1px solid #dde6df; border-radius: 0; background: #fff; box-shadow: none;
}
.composer:focus-within { border-color: #dde6df; box-shadow: none; }
.composer:has(#chooseComposeMedia:not([hidden])) { grid-template-columns: 44px minmax(0,1fr) auto; }
.composer:has(#chooseComposeMedia:not([hidden])) textarea { grid-column: 2; }
.composer .reply-label, .composer-bottom > span, #send > span { display: none; }
.composer textarea {
  grid-column: 1; grid-row: 3;
  min-height: 44px; height: 44px; max-height: 132px; overflow: auto; outline: none;
  padding: 10px 15px; border: 1px solid #e3e9e4; border-radius: 22px; background: #f3f6f3; color: var(--phone-ink); line-height: 22px;
}
.composer textarea.composer-measure {
  position: absolute; inset: 0 auto auto 0; height: 0; min-height: 0; max-height: none;
  visibility: hidden; overflow: hidden; pointer-events: none;
}
.keyboard-open .composer { flex-shrink: 1; min-height:0; grid-template-rows: minmax(0,auto) minmax(0,auto) auto; padding-bottom: 8px; }
.keyboard-open .composer .draft-translation, .keyboard-open .composer-extras { min-height:0; overflow:auto; overscroll-behavior:contain; }
.composer textarea:focus { border-color: #8bb8a2; }
.composer textarea::placeholder { color: #697b70; }
.composer-bottom { display: contents; }
#send {
  grid-column: -2; grid-row: 3;
  display: grid; place-items: center; width: 46px; height: 46px; min-height: 44px; padding: 0;
  background: var(--phone-green); color: #fff; border: 0; border-radius: 50%; box-shadow: none;
}
#send:disabled { opacity: 1; color: #759182; background: #e5eee8; cursor: default; }
#send svg { width: 21px; height: 21px; margin-left: 2px; }
#send.translate-send { display:flex;justify-content:center;width:auto;min-width:46px;padding:0 10px;border-radius:16px; }
#send.translate-send > span { display:inline;font-size:12px;white-space:nowrap; }
#send.translate-send > svg { display:none; }
.composer .compose-error { grid-column: 1/-1; grid-row: 2; margin: 0 2px 5px; color: #855323; }
.composer .draft-translation { grid-column: 1/-1; grid-row: 1; margin: 0 0 6px; }
.composer-extras { grid-column: 1/-1; grid-row: 2; min-width: 0; }
.compose-media { margin: 0 0 6px; }
.compose-media .button { min-height: 44px; }
#chooseComposeMedia {
  grid-column: 1; grid-row: 3; width: 44px; min-width: 44px; height: 44px; min-height: 44px;
  display: grid; place-items: center; border-radius: 50%; background: #eef3ef; color: var(--phone-green);
}
#chooseComposeMedia svg { width: 22px; height: 22px; }
.draft-translation-toolbar .button { min-height:44px; }
#draftTranslationText { max-height: clamp(40px,calc(var(--app-height,100dvh) * .22),100px); }
input, textarea, select, .search input, .composer textarea, dialog input, dialog select, dialog textarea,
.form-grid input, .form-grid textarea, .form-grid select { font-size: 16px!important; }
.notice-stack { bottom: calc(75px + env(safe-area-inset-bottom,0px)); }
.has-chat .notice-stack, .keyboard-open .notice-stack {
  bottom: auto; top: calc(70px + var(--phone-offset,0px) + env(safe-area-inset-top,0px));
}
.toast { width: max-content; max-width: min(90vw,390px); border-radius: 13px; font-size: 13px; }
.incoming-notice .button, .incoming-notice .icon-button { min-height: 44px; }
.incoming-notice .icon-button { width: 44px; }

.phone-sheet, .wide-dialog, .customer-dialog, #passwordDialog, #newAccountDialog {
  box-sizing: border-box; position: fixed; inset: auto 0 0; width: min(100%,var(--phone-sheet-width)); max-width: 100%;
  max-height: calc(var(--app-height,100dvh) - 20px - env(safe-area-inset-top,0px));
  margin: 0 auto; padding: 10px 18px calc(20px + env(safe-area-inset-bottom,0px));
  overflow: auto; overscroll-behavior: contain; color: var(--phone-ink); background: white;
  border: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 46px #12291c26;
}
.phone-sheet::before, .wide-dialog::before, .customer-dialog::before, #passwordDialog::before, #newAccountDialog::before {
  content: ""; display: block; margin: 0 auto 7px; width: 35px; height: 4px; border-radius: 4px; background: #d3ddd5;
}
dialog::backdrop { background: #172b2254; backdrop-filter: blur(2px); }
.sheet-heading, .dialog-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; gap: 12px; }
.sheet-heading h2, .dialog-heading h2 { font-size: 21px; margin: 0; color: var(--phone-ink); }
.sheet-heading button, .dialog-heading > button { min-width: 42px; min-height: 42px; color: #486052; background: #f1f5f1; }
.sheet-heading button svg { width: 17px; height: 17px; }
.sheet-user { display: flex; align-items: center; gap: 12px; padding: 9px 0 16px; }
.phone-user-icon { display: grid; place-items: center; background: #deeee4; color: #32684f; border-radius: 50%; width: 43px; height: 43px; }
.sheet-user strong, .sheet-user small { display: block; }
.sheet-user strong { font-size: 16px; } .sheet-user small { font-size: 12px; color: var(--phone-muted); margin-top: 3px; }
.sheet-select { display: block; margin: 0 0 12px; color: var(--phone-muted); font-size: 13px; }
.sheet-select select { display: block; width: 100%; margin-top: 6px; min-height: 45px; border: 1px solid #dce7de; border-radius: 11px; padding: 8px; background: white; color: var(--phone-ink); }
.sheet-actions { display: grid; border-top: 1px solid var(--phone-line); }
.sheet-actions button {
  display: flex; flex-direction: row; justify-content: flex-start; align-items: center; gap: 13px;
  width: 100%; min-height: 46px; padding: 9px 5px; border: 0; border-radius: 7px; background: white; box-shadow: none; font-size: 15px; color: #30473a; text-align: left;
}
.sheet-actions button:disabled { opacity: .55; cursor: default; }
.sheet-actions button span { font-size: inherit; }
.sheet-actions button svg { width: 19px; height: 19px; color: #597564; }
#exitPhonePreview { display: block; padding: 12px 4px; color: var(--phone-green); font-size: 13px; }
.settings-tabs { gap: 5px; } .settings-tabs button { flex: 1; padding: 8px 3px; min-height: 42px; }
.form-grid { grid-template-columns: 1fr; gap: 13px; } .span-two { grid-column: auto; }
.form-grid label { margin: 0; } .wide-dialog .button,.customer-dialog .button { min-height: 42px; }
.dossier-section {padding:10px;margin:11px 0}
.dossier-summary-fields {grid-template-columns:4.3em minmax(0,1fr);gap:7px}
.dossier-tag button {min-width:32px;height:32px}
.dossier-tag-editor input {font-size:16px}
.dossier-settings>summary,.dossier-basics>summary {min-height:37px;padding-block:7px}
.claim-dossier {padding:8px}
.media-preview { width: min(94vw,var(--phone-sheet-width)); padding: 12px; }
.preview-toolbar { gap: 7px; }
#loginDialog {
  width: min(90%,360px); max-height: calc(var(--app-height,100dvh) - 20px); overflow: auto; margin: auto; border-radius: 22px;
  padding: 25px; color: var(--phone-ink); border: 1px solid #deebe2; box-shadow: 0 12px 50px #1939241c;
}
#loginDialog::backdrop { background: #edf4ee; }
#loginDialog label { font-size: 13px; margin: 16px 0; }
#loginDialog input { border-radius: 11px; }
#loginDialog .button { min-height: 45px; }
.connection-panel { padding: calc(16px + env(safe-area-inset-top,0px)) var(--phone-pad) 20px; }
.connection-panel .panel-heading { font-size: 21px; font-weight: 650; color: var(--phone-ink); }
#deviceBack { display: inline-block; margin-left: auto; min-height: 42px; padding: 0 12px; font-size: 13px; }
.connection-panel .channel-label { display: none; }
.qr-box { max-width: 260px; margin-left: auto; margin-right: auto; }
.channel-card h3 { font-size: 16px; } .connection-status strong,.connection-detail { font-size: 14px; }

@media (min-width:761px) {
  :root.phone-preview { --phone-pad: 18px; --phone-sheet-width: 414px; background: #e8eeea; }
  .phone-preview body { background: #e8eeea; }
  .phone-preview .app-shell { width: 414px; margin: 0 auto; box-shadow: 0 0 0 1px #d2ddd5,0 12px 60px #243a2b1a; }
}
@media (max-width:350px) {
  .chat-header { gap: 4px; padding-left: 4px; padding-right: 4px; }
  .chat-header .avatar { width: 34px; height: 34px; }
  .filter-tabs { gap: 3px; } .filter-tabs button { padding: 0 9px; }
}
