/* Focused management surfaces; desktop layout stays open and unchanged. */
.customer-profile-tabs,.settings-mobile-nav{display:none}
.customer-list-summary{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 10px}
.customer-list-summary p{margin:0}.customer-list-summary .customer-import{min-height:44px;padding:8px 12px;font-size:12px}
.customer-dialog-actions{display:flex;justify-content:flex-end;gap:10px}.customer-dialog-actions>button{flex:1}
.staff-page .customer-dialog .customer-dialog-actions>.primary{margin:0;width:auto}
.settings-section-summary{list-style:none;cursor:default;min-height:44px}.settings-section-summary::-webkit-details-marker{display:none}
.settings-section-summary h2{margin-top:0}.settings-section>.muted{margin-top:7px}
.settings-field-with-help{display:grid;gap:7px}.settings-field-with-help>label{margin:0;min-width:0}.settings-field-help{font-weight:400}.settings-field-help>summary{display:none}

@media(max-width:760px){
  /* Two short, predictable tabs keep contacts and visits a single tap apart. */
  .customer-profile-tabs,.settings-mobile-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;padding:4px;border:1px solid var(--line);border-radius:10px;background:var(--surface-inset);margin:0 0 12px}
  .staff-page :is(.customer-profile-tabs,.settings-mobile-nav)>button{min-height:44px;padding:8px 10px;border:0;border-radius:7px;font-size:13px;background:transparent;color:var(--muted);white-space:nowrap}
  .staff-page :is(.customer-profile-tabs,.settings-mobile-nav)>button[aria-selected=true]{background:var(--selected);color:var(--accent);box-shadow:0 1px 3px #0002}
  .customer-profile[data-mobile-tab=contacts]>.customer-history,.customer-profile[data-mobile-tab=bookings]>.customer-sidebar{display:none}
  #customersPanel :is(input,select,textarea),.staff-page .customer-dialog :is(input:not([type=radio]),select,textarea),#settingsPanel :is(input:not([type=checkbox]),select,textarea){font-size:16px;min-height:46px}
  #customersPanel button,.staff-page .customer-dialog button{min-height:44px}

  /* Directory: identity + direct contact first, one compact visits link beside it. */
  /* Two rows, no orphans: the search and its button, then the two controls that
     decide what the list shows and in which order, each taking half the width. */
  .customer-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:'search add' 'filters filters';gap:8px 10px;margin:0 0 8px}
  .customer-toolbar>label:first-child{grid-area:search;min-width:0}
  .customer-toolbar>.primary{grid-area:add;align-self:end;padding:10px 14px}
  .customer-filters{grid-area:filters;display:grid;gap:8px}
  .customer-toolbar :is(label,.customer-sort-field>label){min-width:0;font-size:12px}
  .customer-filters>label,.customer-sort-field{min-width:0}
  .staff-page .customer-sort-direction{width:48px;min-height:48px;font-size:17px}
  .customer-toolbar #customerSearch{padding-right:28px}
  .customer-list-summary{margin:0 0 6px}.customer-list-summary .customer-import{color:var(--muted);padding:8px;border:0;text-decoration:underline;text-underline-offset:3px}
  .customer-table-wrap{border-radius:10px}
  .customer-table tr{position:relative;grid-template-columns:minmax(0,1fr) 68px;gap:0 10px;padding:10px 12px}
  .customer-table td{min-width:0;padding:0;font-size:13px}
  .customer-table td.customer-list-name{grid-column:1;grid-row:1}
  .customer-list-identity{gap:6px;min-width:0}
  .customer-list-identity>.customer-name{font-size:15px;line-height:1.35;font-weight:500;min-height:44px;padding:6px 0;text-decoration:none;flex:1}
  .staff-page .customer-note-indicator{height:44px;width:44px;min-height:44px;padding:12px;background:transparent;border:0;margin-inline-end:-6px}
  .customer-list-name .customer-flags{font-size:11px;margin:0 0 5px;line-height:1.5}
  .customer-table td.customer-list-contact{grid-column:1;grid-row:2;overflow-wrap:anywhere;color:var(--muted);line-height:1.4}
  .customer-list-contact small{display:inline;font-size:11px;margin-left:7px;color:var(--subtle)}
  .customer-table td.customer-list-count{grid-column:2;grid-row:1/3;align-self:center;display:grid;text-align:center;gap:2px}
  .customer-table td.customer-list-count::before{content:none}
  .customer-list-count>a{min-height:44px;display:grid;align-content:center;gap:1px;padding:5px 4px;text-decoration:none;color:var(--accent);font-size:18px;border-radius:7px;background:var(--surface-raised)}
  .customer-list-count>a::after{content:'бронювань';color:var(--muted);font-size:10px}
  .customer-table td.customer-list-next{grid-column:1/-1;grid-row:3;font-size:11px;color:var(--muted);margin-top:7px}
  .customer-table td.customer-list-next::before{content:'Наступне: '}
  .customer-table td.customer-list-next[data-empty=true],.customer-table td.customer-list-last{display:none}

  .customer-back{margin:0 0 4px;min-height:44px;padding:8px 0;font-size:13px}
  .customer-profile-header{margin-bottom:12px;gap:10px}
  .customer-identity h2{font-size:22px;line-height:1.25}
  .customer-header-tools{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:6px}
  .customer-header-tools>button{min-height:44px;font-size:12px;padding:8px 10px;white-space:normal;line-height:1.3}
  .customer-more>summary{font-size:0;width:44px;min-height:44px;padding:6px;display:grid;place-items:center;list-style:none;border-radius:7px}
  .customer-more>summary::-webkit-details-marker{display:none}
  .customer-more>summary::after{content:'•••';font-size:16px;letter-spacing:1px}
  .customer-more>div{min-width:220px;max-width:calc(100vw - 40px);border-radius:9px;padding:6px;gap:4px}
  .customer-more>div button{font-size:14px;min-height:44px}
  .customer-profile{gap:12px}.customer-sidebar{gap:10px}
  .customer-card,.customer-history{padding:12px;border-radius:10px}
  .customer-section-heading{margin-bottom:0;min-height:32px}
  .customer-section-heading h3,.customer-note-card h3,.customer-history h3{font-size:14px}
  .customer-card .customer-name{min-height:44px;padding:8px 0;font-size:13px}
  .customer-contact-row{padding:5px 0;gap:0}
  .customer-contact-label{padding-top:4px;font-size:11px}
  .customer-contact-row>a,.customer-contact-row>span{display:flex;align-items:center;min-height:44px;font-size:15px;line-height:1.4;padding:5px 0}
  .customer-contact-row:last-child{padding-bottom:0}
  .customer-note-card p{margin:6px 0;font-size:13px;line-height:1.55}
  .customer-review p{font-size:12px;margin:8px 0}
  .customer-booking-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:10px 0 8px}
  .customer-stat{padding:8px 10px;text-align:left;border-radius:7px;gap:9px;min-height:48px;flex-direction:row;align-items:center;justify-content:flex-start}
  .customer-stat strong{font-size:20px;line-height:1.1}.customer-stat span{font-size:11px;line-height:1.4;overflow-wrap:anywhere}
  .customer-history .customer-booking{padding:11px 0;gap:8px;align-items:center}
  .customer-history .customer-booking-open{padding:4px 0;min-height:52px}
  .customer-booking-open strong{font-size:13px;text-decoration:none}.customer-booking-open small{font-size:11px;line-height:1.5}
  .customer-booking-result{gap:5px;max-width:118px;text-align:right}
  .customer-booking-result .status-pill{max-width:100%;font-size:10px;white-space:normal;line-height:1.25}
  .customer-booking-result>strong{font-size:13px}.customer-profile~.customer-legacy{margin-top:10px;padding:0 12px;border-radius:9px}
  .customer-legacy>summary{display:flex;align-items:center;min-height:48px;font-size:13px;gap:7px}
  .customer-legacy>summary::before{content:'›';font-size:19px}.customer-legacy[open]>summary::before{transform:rotate(90deg)}
  .customer-legacy p{font-size:12px;line-height:1.5}.customer-legacy h3{font-size:13px;overflow-wrap:anywhere}
  #customersPanel[data-customer-view=imports]>button:not(.customer-back){width:100%;text-align:left;margin:5px 0;padding:12px;overflow-wrap:anywhere;font-size:13px}
  #customersPanel[data-customer-view=imports]>.customer-booking{display:grid;grid-template-columns:70px minmax(0,1fr);gap:4px 8px;padding:8px 0}
  #customersPanel[data-customer-view=imports]>.customer-booking>:first-child{min-width:0;font-size:11px;color:var(--muted)}
  #customersPanel[data-customer-view=imports]>.customer-booking>.customer-flags{grid-column:2;font-size:11px}

  /* Customer dialogs have one scrolling body, a stable close control, and reachable actions. */
  .staff-page dialog.customer-dialog{width:calc(100vw - 20px);max-width:560px;padding:14px;max-height:calc(var(--app-viewport-height,100dvh) - 24px);margin:12px auto;border-radius:14px;scroll-padding-block:72px 92px;overscroll-behavior:contain}
  .staff-page .customer-dialog .dialog-top{position:sticky;top:-14px;z-index:3;gap:10px;align-items:center;margin:0 -2px 12px;padding:10px 2px;background:var(--surface);border-bottom:1px solid var(--line)}
  .staff-page .customer-dialog .dialog-top h2{font-size:20px;line-height:1.3;margin:0;min-width:0}
  .staff-page .customer-dialog .dialog-top>button{width:44px;min-width:44px;min-height:44px;margin:0;padding:5px;flex-shrink:0}
  .customer-form{gap:12px}.customer-form label{font-size:12px;gap:5px}
  .customer-edit-contact{grid-template-columns:minmax(106px,.9fr) minmax(0,1.4fr);gap:4px 8px;margin:0 0 10px;padding:8px 10px 6px;border-radius:9px;min-width:0}
  .customer-edit-contact legend{font-size:11px;padding:0 5px}
  .customer-edit-contact>label{min-width:0}
  .staff-page .customer-edit-contact input,.staff-page .customer-edit-contact select{padding:9px 8px;min-width:0}
  .customer-edit-contact .customer-preferred-contact{min-height:44px;font-size:11px;gap:4px;align-items:center}
  .staff-page .customer-edit-contact input[type=radio]{width:18px;min-height:18px;height:18px;flex-shrink:0;margin:0 3px 0 0;accent-color:var(--accent)}
  .staff-page .customer-edit-contact .customer-remove-contact{justify-self:end;min-height:44px;padding:6px 0;border:0;color:var(--muted);font-size:12px;background:transparent}
  .customer-edit-contacts:empty{display:none}.customer-edit-contacts+.secondary{justify-self:start;padding:8px 0;border:0;font-size:13px;text-decoration:underline;text-underline-offset:3px}
  .customer-dialog :is(input,select,textarea){scroll-margin-block:82px 104px}
  .customer-dialog .field-error{font-size:11px;line-height:1.45}
  .customer-dialog-actions{position:sticky;bottom:-14px;z-index:2;padding:12px 0 calc(12px + env(safe-area-inset-bottom,0px));margin:4px 0 -14px;background:var(--surface);border-top:1px solid var(--line);gap:8px}
  .staff-page .customer-dialog .customer-dialog-actions>button{min-height:46px;padding:10px 8px;line-height:1.35;font-size:13px}
  .customer-dialog .form-status:empty{display:none}.customer-dialog .form-status{margin:4px 0;scroll-margin-block:80px 100px;overflow-wrap:anywhere}
  .customer-picker{margin-bottom:10px}.customer-picker-results{max-height:min(280px,38dvh);gap:5px;overscroll-behavior:contain}
  .customer-picker-results button{padding:10px;font-size:13px;line-height:1.5;overflow-wrap:anywhere}
  .customer-merge-preview h3{font-size:15px;line-height:1.4;overflow-wrap:anywhere}

  /* Settings: choose a section; a persistent save bar covers no fields or navigation. */
  #settingsPanel .settings-intro{display:none}
  .settings-form,.settings-editor{gap:12px}
  .settings-mobile-nav{grid-template-columns:repeat(3,minmax(0,1fr));margin:0}
  .settings-section>summary,.settings-rules>summary{display:none}
  .settings-card{padding:14px;border-radius:10px}
  .settings-card:not([open]){display:none}
  .settings-card>.muted{font-size:12px;line-height:1.5;margin:0 0 12px}
  .settings-room-list{gap:8px}.settings-room{border-radius:9px;padding:0;overflow:clip}
  .settings-room>summary{min-height:64px;padding:11px 38px 11px 12px;gap:4px}
  .settings-room-identity strong{font-size:14px;line-height:1.4}
  .settings-room-status,.settings-room-prices{font-size:11px}
  .settings-room-body{padding:12px}
  .settings-fields,.settings-fields.settings-pair,.settings-room .settings-fields{gap:12px;grid-template-columns:minmax(0,1fr)}
  .settings-field{gap:5px!important;min-width:0;font-size:12px!important;scroll-margin-block:20px 180px}
  .settings-field>span:first-child{line-height:1.45}
  .settings-field :is(input,select){scroll-margin-block:20px 180px}
  .settings-room .settings-group .settings-fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .settings-room .settings-group .settings-fields>.settings-field:first-child{grid-column:1/-1}
  .settings-room .settings-group .settings-fields>.settings-field:nth-child(2):nth-last-child(2){grid-column:auto}
  .settings-group{margin-top:16px;padding-top:12px}.settings-group legend{font-size:13px;line-height:1.45;max-width:100%}
  .settings-group>.settings-hint{font-size:11px;line-height:1.5;margin-bottom:10px}
  .settings-group>.settings-field,.settings-room .settings-group>.settings-field{max-width:none}
  .settings-room-visibility{margin-top:14px;padding-top:10px}.settings-room-visibility label{font-size:12px;min-height:44px}
  .settings-room-visibility .settings-hint{font-size:11px;line-height:1.5;margin:0}
  .settings-cancel-space{margin-bottom:10px;font-size:12px;min-height:44px;width:100%;padding:8px}
  #addSpace{margin-top:12px;min-height:46px;font-size:13px;width:100%}
  .settings-fields.settings-time-fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .settings-time-fields>.settings-field:nth-child(3){grid-column:1/-1}
  .settings-time-ranges{font-size:13px;line-height:1.5;margin:0 0 12px}
  .settings-card .settings-group:first-of-type{margin-top:8px}
  .settings-rules[open]>.settings-fields{margin-top:0}.settings-rules>.settings-hint{font-size:11px;line-height:1.5;margin-top:12px}
  .settings-field-help>summary{display:flex;align-items:center;gap:6px;min-height:44px;font-size:12px;color:var(--muted);list-style:none;cursor:pointer}
  .settings-field-help>summary::before{content:'ⓘ';font-size:15px}.settings-field-help>summary::after{content:'+';margin-left:auto;font-size:18px}
  .settings-field-help[open]>summary::after{content:'−'}.settings-field-help .settings-hint{font-size:11px;line-height:1.55;padding-bottom:8px}
  .settings-actions{bottom:calc(var(--admin-mobile-nav-height,72px) + 8px);gap:6px;padding:10px;border-radius:10px;scroll-margin-bottom:calc(var(--admin-mobile-nav-height,72px) + 12px)}
  .settings-actions p{font-size:11px;line-height:1.5}
  .settings-action-buttons{gap:8px}.staff-page .settings-action-buttons button{min-height:46px;font-size:13px;line-height:1.35}
  .settings-actions[data-dirty=false]{padding:10px 0 0;border:0;background:transparent;box-shadow:none}
  .settings-actions[data-dirty=false] .settings-action-buttons{display:none}
  .settings-audit{font-size:10px;line-height:1.5;margin-top:10px}.settings-error{scroll-margin-bottom:calc(var(--admin-mobile-nav-height,72px) + 130px)}
}
