/* Compact phone workbench. Desktop keeps its established layout. */
.calendar-mobile-date,.calendar-mobile-controls,.mobile-related-cards,.mobile-customer-sort { display:none; }
.calendar-desktop-label { display:flex;align-items:center;gap:8px;flex:1; }
.calendar-desktop-label>span { margin-left:auto; }
.calendar-day-popup { inset:auto;margin:0;padding:8px;border:1px solid #aec5d8;border-radius:12px;background:#f4f8fb;color:#203d52;box-shadow:0 12px 32px #173b5833;max-height:55dvh;overflow-y:auto; }
.calendar-day-popup::backdrop { background:#173b5810; }
.calendar-day-popup>header { display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px; }
.calendar-day-popup>header strong { font-size:14px; }
.calendar-day-popup>.btn { width:100%;margin-top:8px; }
.task-title-button { display:block;width:100%;border:0;padding:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer; }
@media(max-width:767px) {
  body[data-theme="blue"] { --crm-grid-gap:6px; }
  body[data-theme="blue"] #view { padding:8px 8px calc(80px + env(safe-area-inset-bottom)); }
  .preview-bar { min-height:24px;padding:3px 8px;font-size:10px; }
  .preview-bar .preview-hint { font-size:10px; }
  .page-content .section { padding:10px;margin-top:8px;border-radius:10px; }
  .section-head { margin-bottom:6px; }
  .section-head h2 { font-size:15px;line-height:22px; }
  .page-content .btn,.page-content .text-btn { min-height:30px;padding:3px 6px;font-size:12px;line-height:20px;gap:3px; }
  .page-content .icon-btn { min-width:28px;width:28px;min-height:30px;height:30px;padding:5px; }
  .page-content .btn svg,.page-content .text-btn svg,.page-content .icon-btn svg { width:15px;height:15px; }
  .toolbar { gap:5px;margin-bottom:8px; }
  .toolbar .filters { gap:3px;padding:0;flex-shrink:0; }
  .toolbar .grade { width:28px;min-height:30px;height:30px;padding:2px 0;font-size:14px;line-height:22px;border-radius:6px; }
  .toolbar .grade.all { width:36px;font-size:12px; }
  .toolbar>.btn { flex-shrink:0;white-space:nowrap; }
  .toolbar .search { min-width:0;max-width:none;width:auto;flex:1 1 48px;min-height:30px;height:30px;gap:3px;padding:3px 5px; }
  .toolbar .search>svg { width:14px;height:14px;flex:0 0 14px; }
  .toolbar .search input { font-size:16px;line-height:22px; }
  .toolbar .search input::placeholder { font-size:11px; }
  .toolbar .counter,.toolbar .community-count { display:none; }
  .prop-toolbar,.customer-preview-toolbar { flex-wrap:nowrap; }
  .mobile-customer-sort { display:block; }
  .prop-sort { flex:0 0 42px;position:relative;width:42px;max-width:none; }
  .prop-sort::before { content:'排序';position:absolute;inset:0;display:grid;place-items:center;font-size:12px;color:#285577;pointer-events:none; }
  .prop-sort select { width:42px;min-height:30px;height:30px;padding:0;color:transparent;font-size:16px;appearance:none; }
  .prop-sort option { color:#203d52; }
  .customer-preview-clear { min-width:20px!important;width:20px!important;margin:0; }
  .toolbar .search:focus-within { position:relative;z-index:3; }

  /* The calendar replaces the phone's former date and creation header. */
  .agenda .today-header { display:none; }
  .blue-agenda-layout { gap:8px; }
  .blue-calendar { border-radius:10px; }
  .blue-calendar>summary { padding:4px 8px;min-height:38px;gap:5px; }
  .calendar-desktop-label,.blue-calendar .blue-month-head,.blue-calendar .blue-day-agenda { display:none; }
  .calendar-mobile-date { display:block;font:600 14px/22px var(--crm-font-sans);color:#234d6b;white-space:nowrap; }
  .blue-calendar summary>.calendar-mobile-controls { display:flex;align-items:center;gap:2px;margin-left:auto; }
  .calendar-mobile-controls .icon-btn { width:26px;min-width:26px; }
  .blue-calendar>summary>svg { width:15px;height:15px;flex:0 0 15px;transform:rotate(90deg); }
  .blue-calendar[open]>summary>svg { transform:rotate(-90deg); }
  .blue-calendar-content { padding:0 7px 7px; }
  .blue-weekdays { padding:0 0 4px;font-size:11px;line-height:18px; }
  .blue-month-grid { gap:3px; }
  .blue-calendar .blue-day { min-height:0;height:clamp(27px,4.1dvh,34px);padding:2px;border-radius:5px;aspect-ratio:auto; }
  .blue-day-number { width:20px;height:20px;font-size:11px;line-height:18px;border-radius:4px; }
  .blue-day-colors.is-grid { align-content:stretch;grid-auto-rows:1fr;width:auto;height:100%;aspect-ratio:1;inset:0 auto 0 0; }
  .blue-day-colors.is-grid .blue-day-block { aspect-ratio:auto; }
  .blue-day[aria-pressed=true] { outline-width:1px;outline-offset:0; }
  .agenda-day { margin:9px 0 4px;font-size:12px;line-height:18px; }
  .task-list { gap:5px; }
  .task-wrap { border-radius:8px; }
  .page-content .task-body,.calendar-day-popup .task-body { display:grid;grid-template-columns:minmax(0,1fr) auto 24px;gap:1px 5px;min-height:0;padding:6px 8px;align-items:center; }
  .task-body .task-grade { display:none; }
  .page-content .task-copy,.calendar-day-popup .task-copy { display:contents; }
  .page-content .task-title,.calendar-day-popup .task-title { grid-column:1;grid-row:1;font-size:13px;line-height:20px;white-space:normal;overflow-wrap:anywhere; }
  .page-content .task-copy p,.calendar-day-popup .task-copy p { grid-column:1/-1;grid-row:2;margin:0;font-size:12px;line-height:18px;white-space:normal;overflow-wrap:anywhere; }
  .page-content .task-time,.calendar-day-popup .task-time { grid-column:2;grid-row:1;display:flex;flex-direction:row;gap:4px;align-items:center;font-size:11px;padding:0; }
  .task-time time { font-size:11px!important;white-space:nowrap!important;max-width:none!important; }
  .agenda .task-date,.calendar-day-popup .task-date { display:none; }
  .due-label { font-size:10px; }
  .page-content .task-more,.calendar-day-popup .task-more { position:static;grid-column:3;grid-row:1;min-width:24px;width:24px;height:24px;min-height:24px;margin:0;padding:2px; }
  .task-actions { width:144px; }
  .task-actions button { font-size:12px; }
  .task-wrap.actions-open .task-body { transform:translateX(-144px); }
  .calendar-day-popup .task-copy p { overflow:hidden;white-space:nowrap;text-overflow:ellipsis; }
  .calendar-day-popup .task-title { white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
  .calendar-day-popup .btn { min-height:34px;font-size:13px; }
  .calendar-day-popup .icon-btn { width:30px;min-width:30px;height:30px;min-height:30px; }

  /* Three property cards and two client cards, with full details one tap away. */
  .prop-grid { grid-template-columns:repeat(3,minmax(0,1fr));gap:6px; }
  .prop-card { border-radius:8px; }
  .prop-cover { aspect-ratio:4/3; }
  .prop-cover>svg { width:21px;height:21px; }
  .prop-card-info { padding:5px; }
  .prop-card-title { display:flex;flex-wrap:wrap;gap:0 4px; }
  .prop-card-title strong { width:100%;font-size:12px;line-height:18px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis; }
  .prop-card-title .price { font-size:13px;line-height:18px; }
  .prop-card-inline { display:flex;flex-wrap:wrap;gap:0 3px;margin:1px 0 0;font-size:11px;line-height:16px; }
  .prop-card-inline>span:first-child { flex-basis:100%;white-space:nowrap; }
  .prop-card-school { margin:2px 0 0;gap:2px;font-size:11px;line-height:16px; }
  .prop-card-school svg { width:11px;height:11px;flex-basis:11px; }
  .prop-task-dot { width:18px;height:18px;right:4px;bottom:4px; }
  .prop-task-dot svg { width:12px;height:12px; }
  .prop-cover>.property-tags { inset:4px 4px auto;gap:2px; }
  .prop-cover .property-tag { padding:0 3px;font-size:10px;line-height:15px;border-radius:4px; }
  .customer-preview-page .customer-preview-grid { grid-template-columns:repeat(2,minmax(0,1fr));gap:6px; }
  .customer-preview-card { --crm-avatar-list:34px;grid-template-columns:34px minmax(0,1fr);grid-template-rows:20px 18px 18px;gap:0 5px;padding:6px;min-height:70px;border-radius:8px; }
  .customer-preview-card .avatar { width:34px;height:34px;font-size:18px;grid-row:1/3;align-self:center; }
  .customer-preview-card-head { gap:3px; }
  .customer-preview-card-head strong,.customer-preview-budget { font-size:12px;line-height:20px; }
  .customer-preview-card-head strong { flex-shrink:0; }
  .customer-preview-budget { font-size:11px;max-width:none; }
  .customer-preview-card p { font-size:11px;line-height:18px; }
  .customer-preview-line { grid-column:1/-1;gap:4px; }
  .customer-preview-line span:first-child { max-width:55%; }

  /* Related inventory follows the detail instead of blocking its first screen. */
  .blue-detail-layout { display:flex;flex-direction:column;gap:10px; }
  .blue-detail-main { width:100%; }
  .blue-detail-layout>.blue-related { display:none; }
  .mobile-related-cards { display:block;width:100%; }
  .mobile-property-heading { display:grid;grid-template-columns:24px minmax(0,1fr) auto auto auto;align-items:center;gap:4px;margin-bottom:5px; }
  .mobile-property-heading .blue-property-title,.mobile-property-heading .blue-property-price-row { display:contents; }
  .mobile-property-heading .blue-back { width:24px;min-width:24px;min-height:28px;height:28px;padding:4px; }
  .mobile-property-heading h1 { font-size:13px;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
  .mobile-property-heading .blue-room-badge { font-size:10px;line-height:18px;padding:2px 3px; }
  .mobile-property-heading .prop-field-price { font-size:14px;line-height:20px;white-space:nowrap; }
  .mobile-property-heading .prop-detail-actions { flex-wrap:nowrap;gap:3px;margin:0; }
  .mobile-property-heading .prop-detail-actions .btn { font-size:11px;padding:3px 4px;min-height:28px; }
  .mobile-property-heading .prop-detail-actions svg { display:none; }
  .blue-property-tax { font-size:11px;gap:6px;margin:4px 0; }
  .blue-property-data .field-grid { gap:4px 8px;margin-top:4px; }
  .blue-property-data .field-grid>div { display:flex;gap:5px;font-size:12px;line-height:20px; }
  .blue-property-data .field-grid dt { width:auto;flex:0 0 auto;font-size:12px; }
  .blue-property-data .field-grid dd { font-size:12px;min-width:0; }
  body[data-theme="blue"] .blue-property-data .blue-property-notes { margin-top:5px;padding-top:5px; }
  .blue-property-notes p { font-size:12px;line-height:20px; }
  body[data-theme="blue"] .property-media-footer .prop-owner,body[data-theme="blue"] .property-media-footer .blue-property-pager .btn { min-height:32px;padding:4px 6px;font-size:11px; }
  .property-media-footer { gap:5px; }
  body[data-theme="blue"] .property-media-footer .prop-owners { flex-basis:145px; }
  .media-thumbnail { flex-basis:60px;width:60px;height:44px; }
  .blue-profile-toolbar { gap:6px;margin-bottom:6px; }
  .blue-profile-toolbar .customer-preview-profile-actions { gap:3px; }
  .blue-customer-profile-body { display:flow-root; }
  .blue-customer-contact { float:left;display:flex;flex-direction:column;align-items:center;width:100px;margin:0 9px 5px 0;gap:5px; }
  .blue-customer-contact .avatar { width:70px;height:70px;font-size:28px; }
  .blue-customer-phone { display:flex;align-items:center;justify-content:center;gap:2px;max-width:100%;padding:4px;border-radius:6px;background:linear-gradient(140deg,#d9f1e6,#aed9c7);border:1px solid #83baa4;color:#14583e;font-size:11px;line-height:18px;min-height:28px;white-space:nowrap; }
  .blue-customer-phone svg { width:11px;height:11px; }
  .blue-customer-profile-body .field-grid { display:block;margin:0;font-size:12px;line-height:25px; }
  .blue-customer-profile-body .field-grid>div { display:inline-flex;align-items:baseline;gap:4px;margin:0 9px 0 0;max-width:100%;font-size:12px;line-height:25px;vertical-align:top; }
  .blue-customer-profile-body .field-grid dt { font-size:12px;flex-shrink:0; }
  .blue-customer-profile-body .field-grid dd { font-size:12px;line-height:25px;min-width:0; }
  .blue-customer-name dt { display:none; }
  .blue-customer-name h1 { color:var(--crm-text);font:600 13px/25px var(--crm-font-sans);margin:0; }
  .blue-customer-footer { gap:4px;margin-top:5px; }
  .blue-customer-note { font-size:12px;line-height:20px; }
  .blue-customer-profile .blue-customer-footer .blue-customer-pager .btn { min-height:30px; }
  .customer-preview-composer textarea,.prop-followup textarea { min-height:60px;padding:6px 8px;font-size:16px;line-height:22px; }
  .customer-preview-composer textarea::placeholder,.prop-followup textarea::placeholder { font-size:12px; }
  .customer-preview-record-text,.prop-followup-text { font-size:13px;line-height:20px; }
  .customer-preview-record-top time,.prop-record-top time { font-size:11px; }
  .customer-preview-record-top .text-btn,.prop-record-top .text-btn { min-height:28px; }
  .customer-preview-created { font-size:11px;padding-top:5px; }

  .community-list-toolbar { gap:5px; }
  .community-types { gap:3px; }
  .community-grid { grid-template-columns:repeat(2,minmax(0,1fr));gap:6px; }
  .community-card-info { padding:6px; }
  .blue-community-card-head { gap:1px 5px; }
  .blue-community-card-head>strong { font-size:13px;line-height:20px;width:100%; }
  .blue-community-card-head>span,.blue-community-card-head>.price { font-size:11px;line-height:18px; }
  .community-card-facts { display:flex;flex-direction:column;gap:1px;font-size:11px;line-height:18px; }
  .community-card-facts dt,.community-card-facts dd { font-size:11px;line-height:18px; }
  .community-card-available { font-size:11px;margin-top:3px; }
  .community-market-label { font-size:10px;padding:2px 5px; }
  .community-detail .detail-title h1 { font-size:16px;line-height:22px; }
  .community-header-meta { font-size:11px; }
  .blue-community-data .community-edit { min-height:30px; }
  .blue-community-data .community-fields { gap:4px 8px; }
  .blue-community-data .community-fields>div { grid-template-columns:48px minmax(0,1fr);gap:3px;font-size:12px;line-height:20px; }
  .blue-community-data .community-fields dt,.blue-community-data .community-fields dd { font-size:12px;line-height:20px; }

  .resource-toolbar { gap:5px; }
  .resource-toolbar .resource-tabs { gap:6px; }
  .resource-toolbar .resource-tabs a { min-height:30px;padding:4px 0;font-size:12px;line-height:20px; }
  .resource-toolbar .search { flex:1 1 35px;min-width:35px; }
  .resource-toolbar .resource-tags { display:flex;width:100%;gap:4px;margin:0; }
  .resource-toolbar .chip { min-height:26px;padding:2px 5px;font-size:11px;gap:2px; }
  .resource-toolbar .chip svg { width:12px;height:12px; }
  .resource-list { gap:6px; }
  .resource-card { padding:9px;gap:8px;border-radius:9px; }
  .resource-card>.resource-symbol { width:30px;height:32px; }
  .resource-card h3 { font-size:14px;line-height:20px;margin-bottom:2px; }
  .resource-card p { font-size:12px;line-height:18px; }
  .resource-card .resource-labels { margin-top:4px;font-size:11px; }
  .contacts-page h1 { font-size:16px; }
  .contacts-page .toolbar>.meta { display:none; }
  .contact-grid { gap:6px; }
  .contacts-page .contact-card { padding:8px;margin:0; }
  .contact-avatar { width:40px;height:40px;flex-basis:40px;border-radius:12px;font-size:20px; }
  .contact-identity { gap:7px; }
  .contact-identity h2 { font-size:14px;margin-bottom:1px; }
  .contact-phone { font-size:12px;line-height:18px; }
  .contact-facts { margin:5px 0 3px;font-size:12px;gap:5px; }
  .contact-facts dt { font-size:11px; }
  .contact-note { font-size:11px;line-height:17px;padding-top:4px; }

  .mobile-nav { inset:auto 6px max(6px,env(safe-area-inset-bottom));padding:4px;border:1px solid #80acbb;border-radius:14px;background:linear-gradient(155deg,#dff1f5 0%,#b7d8e2 55%,#a4c9d7 100%);box-shadow:inset 0 1px 0 #f7ffff,0 4px 16px #204d6433; }
  .mobile-nav a { min-height:44px;font-size:11px;color:#31596e;gap:1px;border-radius:10px; }
  .mobile-nav a svg { width:19px;height:19px; }
  .mobile-nav a.active { color:#174d70;background:linear-gradient(145deg,#f0faff,#d0e8f2);box-shadow:inset 0 1px 0 #fff,0 2px 4px #31597025; }
  .mobile-nav .badge { min-width:15px;height:15px;font-size:10px;left:calc(50% + 5px); }
}

@media(max-width:767px){
  .customer-preview-card{--crm-avatar-list:44px;grid-template-columns:44px minmax(0,1fr);grid-template-rows:20px 18px 18px;gap:0 5px;min-height:72px;}
  .customer-preview-card{font-family:var(--crm-font-sans);font-weight:400;}
  .customer-preview-card .avatar{width:44px;height:44px;font-size:23px;grid-row:1/4;align-self:center;}
  .customer-preview-card-head strong,.customer-preview-budget{font-weight:500;}
  .customer-preview-card-head strong{font-size:12px;}
  .customer-preview-line{grid-column:2;gap:4px;}
  .customer-preview-card p{font-size:11px;font-weight:400;}
  .blue-customer-profile-body{display:grid;grid-template-columns:84px minmax(0,1fr);gap:7px;align-items:start;}
  .blue-customer-contact{float:none;width:84px;margin:0;}
  .blue-customer-profile-body .field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px 8px;line-height:20px;}
  .blue-customer-profile-body .field-grid>div{display:grid;grid-template-columns:48px minmax(0,1fr);align-items:baseline;gap:3px;margin:0;line-height:20px;min-width:0;}
  .blue-customer-profile-body .field-grid dd{line-height:20px;font-size:12px;}
  .blue-customer-profile-body .field-grid dt{font-size:11px;line-height:20px;}
  .blue-customer-profile-body .blue-customer-name{grid-template-columns:1fr;}
  .blue-customer-name h1{font-size:13px;line-height:20px;}
  .blue-customer-profile-body .customer-extra-fields{grid-column:1/-1;grid-template-columns:repeat(3,minmax(0,1fr));border-top:1px solid #c7d9e7;padding-top:6px;}
  .blue-customer-profile-body .field-grid>.wide{grid-column:1/-1;}
  .prop-card-title{display:flex;align-items:baseline;flex-wrap:wrap;gap:0 3px;}
  .prop-card-title strong{width:auto;flex:0 1 auto;font-size:12px;max-width:100%;color:#fff;font-weight:500;}
  .prop-card-title .price{font-size:11px;font-weight:500;line-height:18px;flex-shrink:0;color:#fff;}
  .prop-card-title strong:has(+.price){overflow-wrap:anywhere;}
}
@media(max-width:360px){
  .customer-preview-card{grid-template-rows:auto 18px 18px;}
  .customer-preview-card-head{flex-wrap:wrap;gap:0;}
  .customer-preview-card-head strong,.customer-preview-budget{flex:0 0 100%;line-height:17px;}
  .blue-customer-profile-body{grid-template-columns:70px minmax(0,1fr);gap:6px;}
  .blue-customer-contact{width:70px;}
  .blue-customer-contact .avatar{width:60px;height:60px;}
  .blue-customer-profile-body .field-grid{column-gap:5px;}
  .blue-customer-profile-body .field-grid>div{grid-template-columns:44px minmax(0,1fr);gap:2px;}
  .blue-customer-profile-body .field-grid>.wide{grid-template-columns:48px minmax(0,1fr);}
}
@media(max-width:767px){
  .customer-preview-card-head strong,.prop-card-title>strong{font-family:var(--crm-font-sans);}
}

@media(max-width:767px) {
  .blue-calendar summary > .calendar-date-weather { gap:5px; }
  .calendar-current-date { font-size:12px; }
  .calendar-date-weather .calendar-weather { font-size:11px; }
  .blue-calendar summary > .calendar-header-controls { gap:0; }
  .calendar-header-controls .icon-btn { width:22px;min-width:22px;padding:3px; }
  .calendar-header-controls .text-btn { padding:3px; }
  .blue-property-meta { display:flex;flex-direction:column;align-items:flex-start; }
  .blue-property-meta .blue-property-tax { order:-2; }
  .blue-property-meta .property-tags { order:-1; }
}
