/* Mobile refinements; desktop keeps the shared CRM workflows. */
.mobile-only { display:none; }
.customer-filters { width:100%; }
.customer-filters summary { cursor:pointer; font-weight:600; padding:12px 0; }
.advanced-filters { display:flex; flex-wrap:wrap; gap:12px; padding:8px 0; }
.advanced-filters .filter-field { flex:1 1 160px; }
.advanced-filters select { width:100%; }
.contact-actions { display:flex; flex-wrap:wrap; gap:8px; margin:8px 0; }
.contact-actions a { text-decoration:none; }
.quick-note-button { margin-left:6px; }
.install-bar { padding:8px 32px; display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.install-bar > span { color:var(--muted); font-size:12px; }
.connection-status { padding:12px 20px; background:#fff0de; color:#704800; }
.modal-body p + p { margin-top:12px; }
@media(max-width:720px) {
  .mobile-only { display:flex; }
  .nav-list { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); overflow:visible; }
  .nav-button { min-width:0; min-height:48px; white-space:normal; padding:9px 4px; font-size:12px; }
  .nav-list > .secondary-nav { display:none; }
  .nav-list.more-open > .secondary-nav:not([hidden]) { display:flex; }
  #more-nav { grid-column:4; grid-row:1; }
  .brand-logo { max-width:160px; }
  .internal-label { display:none; }
  .topbar-actions { min-width:0; }
  .topbar-title { max-width:45%; overflow-wrap:anywhere; }
  .install-bar { padding:8px 15px; }
  .button, .button.small, .nav-button, .tab-button, .modal-close { min-height:44px; }
  input, select, textarea { font-size:16px!important; }
  .customer-table { overflow:visible; }
  .customer-table table { display:block; width:100%; min-width:0; }
  .customer-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .customer-table tbody { display:grid; gap:12px; padding:12px; }
  .customer-table tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); padding:14px; gap:10px; border:1px solid var(--line); border-radius:10px; }
  .customer-table td { display:block; min-width:0; padding:0; border:0; overflow-wrap:anywhere; }
  .customer-table td:first-child, .customer-table td:last-child { grid-column:1/-1; }
  .customer-table td:first-child .table-primary { font-size:17px; min-height:44px; }
  .customer-table td[data-label]::before { content:attr(data-label); display:block; color:var(--muted); font-size:11px; }
  .customer-table td:nth-child(5) { display:none; }
  .customer-table td:last-child { display:flex; flex-wrap:wrap; gap:8px; }
  .quick-note-button { margin:0; }
  .detail-tabs { overflow-x:auto; max-width:100%; gap:16px; }
  .tab-button { flex-shrink:0; }
  .content { padding-bottom:calc(30px + env(safe-area-inset-bottom)); }
  dialog.modal { max-height:calc(100dvh - 24px); width:calc(100vw - 24px); }
}
.advanced-filters label > span { display:block; margin-bottom:5px; color:var(--muted); font-size:12px; }
@media(max-width:720px) {
  .customer-filters summary { min-height:44px; }
  .profile { max-width:150px; overflow-wrap:anywhere; }
  .nav-list > .nav-button:first-child { font-size:11px; }
}

/* A quiet shared register, with space reserved for search and customer work. */
.skip-link { position:fixed; left:16px; top:12px; z-index:1100; padding:12px 18px; border-radius:6px; background:white; color:var(--blue-dark); transform:translateY(-160%); }
.skip-link:focus { transform:translateY(0); }
#view { scroll-margin-top:16px; }
#view:focus-visible { outline:3px solid #7eb0e7; outline-offset:-3px; }
.install-nav { margin-top:12px; border-top:1px solid #31465b; border-radius:0 0 8px 8px; font-size:12px; }
.demo-banner { margin-top:12px; padding:8px 0; border:0; border-radius:0; background:transparent; color:var(--muted); flex-wrap:wrap; gap:2px 10px; }
.demo-banner strong { font-size:12px; }
.sync-status { padding:6px 35px; background:transparent; border-bottom:1px solid var(--line); color:var(--muted); font-size:12px; }
.content { padding-top:22px; }
.eyebrow { text-transform:none; letter-spacing:.2px; font-size:12px; }
.search-field { flex:1 1 520px; min-width:0; max-width:760px; }
.search-field input { min-height:46px; background:white; }
.customer-filters summary { color:var(--blue-dark); }
.active-filters { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:-6px 0 18px; }
.active-filters:empty { display:none; }
.active-filters > .table-secondary { margin:0; }
.filter-chip { text-align:left; white-space:normal; max-width:100%; overflow-wrap:anywhere; }
.customer-pagination { display:flex; justify-content:center; align-items:center; flex-wrap:wrap; gap:16px; padding:16px 20px; border-top:1px solid var(--line); }
.customer-pagination:empty { display:none; }
.pagination-status { color:var(--muted); font-size:13px; font-variant-numeric:tabular-nums; }
.stat-value { font-variant-numeric:tabular-nums; }
.info-grid > .contact-actions { grid-column:1/-1; margin:0; }
.contact-actions .button { min-height:44px; }
.detail-actions .contact-actions { margin:0; }
.modal { overscroll-behavior:contain; }
button, a { touch-action:manipulation; }
@media(max-width:1150px) and (min-width:721px) { .sync-status { padding-inline:25px; } }
@media(max-width:720px) {
  .sidebar { gap:12px; }
  .install-nav { margin-top:0; border-top:0; font-size:12px; }
  .nav-list.more-open > .install-nav { grid-column:span 2; }
  .demo-banner { margin:8px 15px 0; font-size:12px; line-height:1.5; padding:4px 0; }
  .sync-status { padding:5px 15px; }
  .content { padding-top:18px; }
  .page-heading { margin-bottom:16px; }
  .page-heading p { font-size:13px; }
  .stats-row:has(> div.stat-card) { grid-template-columns:repeat(3,minmax(0,1fr)); gap:0; background:white; border:1px solid var(--line); border-radius:8px; margin-bottom:18px; }
  .stats-row > div.stat-card { padding:10px 9px; border:0; border-radius:0; box-shadow:none; background:transparent; }
  .stats-row > div.stat-card + div.stat-card { border-left:1px solid var(--line); }
  .stats-row > div.stat-card .stat-label { font-size:12px; line-height:1.4; min-height:34px; overflow-wrap:anywhere; }
  .stats-row > div.stat-card .stat-value { font-size:23px; margin:3px 0 0; }
  .stats-row > div.stat-card .stat-meta { display:none; }
  .stats-row:has(> .overview-stat) { grid-template-columns:1fr; }
  .overview-stat .stat-label, .overview-stat .stat-meta { font-size:12px; }
  .customer-filters summary { padding:10px 0; }
  .active-filters { margin:0 0 14px; }
  .active-filters .button { min-height:44px; }
  .customer-pagination { gap:10px; padding:14px 12px; }
  .customer-pagination .button { min-width:88px; }
  .customer-table td[data-label]::before { font-size:12px; }
  .customer-table td:last-child .button { min-height:44px; }
  .search-field input { min-height:48px; }
  .toolbar { margin-bottom:8px; }
}

/* External company results stay separate from the customer register. */
.company-search-form { display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px; }
.company-search-form .form-field { flex:1 1 280px; margin:0; }
.company-search-form input { min-height:46px; }
.company-search-form > .button { min-height:46px; }
.company-search-results { display:grid; gap:16px; }
.company-search-result { border-top:1px solid var(--line); padding-top:16px; overflow-wrap:anywhere; }
.company-search-result h3 { margin:0 0 8px; font-size:17px; }
.company-search-result p { margin:5px 0; }
.company-search-actions { display:flex; align-items:flex-start; flex-wrap:wrap; gap:8px; margin-top:12px; }
.company-search-actions .button { white-space:normal; text-align:left; min-height:44px; }
.company-search-existing { flex-basis:100%; color:var(--blue-dark); font-weight:600; }
@media(max-width:720px) {
  .company-search-form > .button { width:100%; }
  .company-search-actions { flex-direction:column; align-items:stretch; }
}

/* Customer editing keeps the main actions visible while optional details unfold. */
dialog.modal.customer-editor[open] { display:flex; flex-direction:column; width:min(960px,calc(100vw - 40px)); max-height:calc(100dvh - 40px); overflow:hidden; }
.customer-editor[open] > .modal-header,
.customer-editor[open] > .modal-footer { flex-shrink:0; }
.customer-editor[open] > .modal-header { background:var(--navy); color:white; }
.customer-editor[open] > .modal-header h2 { color:inherit; }
.customer-editor[open] > .modal-header .modal-close { background:rgba(255,255,255,.12); color:white; min-height:44px; width:44px; }
.customer-editor[open] > .modal-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
.customer-editor[open] > [hidden] { display:none!important; }
.customer-editor #customer-form { display:flex; flex-direction:column; gap:20px; }
.customer-editor-intro { color:var(--muted); margin:0; line-height:1.6; }
.customer-editor .customer-basics h3 { margin:0 0 16px; font-size:17px; color:var(--blue-dark); }
.customer-editor .form-grid { gap:16px 20px; }
.customer-editor .form-field { min-width:0; }
.customer-editor .form-field input,
.customer-editor .form-field select,
.customer-editor .form-field textarea { width:100%; }
.customer-editor .customer-form-section { border-top:1px solid var(--line); }
.customer-editor .customer-form-section > summary { cursor:pointer; padding:18px 0; color:var(--blue-dark); font-size:16px; font-weight:600; }
.customer-editor .customer-form-section > summary > span { display:inline; }
.customer-editor .customer-form-section summary small { display:block; margin:5px 0 0 18px; color:var(--muted); font-size:13px; font-weight:400; line-height:1.5; }
.customer-editor .customer-section-body { padding:0 0 6px; }
.customer-editor .customer-section-help { margin:16px 0 0; line-height:1.6; }
.customer-editor #customer-error { order:-1; position:sticky; top:-24px; z-index:2; margin:0; padding:12px 16px; background:#fff0de; border:1px solid #cda96d; border-radius:6px; }
.customer-editor #customer-error:empty { display:none; }
.customer-editor .brreg-panel { margin:0; padding:18px; border:1px solid var(--line); background:var(--page,#f3f6f9); border-radius:8px; min-width:0; }
.customer-editor .brreg-panel legend { padding:0 6px; font-weight:600; color:var(--blue-dark); }
.customer-editor .brreg-panel input { min-height:46px; }
.customer-editor .brreg-panel .button { min-height:44px; white-space:normal; }
.customer-editor .brreg-panel > .form-field { display:block; margin:0 0 12px; }
.customer-editor .brreg-panel #brreg-message { line-height:1.5; margin:12px 0 0; }
.customer-editor .brreg-panel #brreg-message:empty { display:none; }
.customer-editor .brreg-panel #brreg-results { overflow-wrap:anywhere; }
.customer-editor .brreg-panel .brreg-candidate { display:block; text-align:left; width:100%; margin-top:6px; }
.customer-editor .modal-footer [data-action="delete-customer"] { margin-right:auto; }
.customer-editor :is(input,select,textarea,summary,button):focus-visible { outline:3px solid var(--blue); outline-offset:3px; }
@media(max-width:720px) {
  dialog.modal.customer-editor[open] { width:calc(100% - 12px); max-width:calc(100% - 12px); max-height:calc(100dvh - 12px); margin:auto; border-radius:10px; }
  .customer-editor[open] > .modal-header { padding:12px 16px; }
  .customer-editor[open] > .modal-body { padding:18px 16px; }
  .customer-editor[open] > .modal-footer { padding:12px 16px calc(12px + env(safe-area-inset-bottom)); gap:8px; }
  .customer-editor .form-grid { grid-template-columns:minmax(0,1fr); }
  .customer-editor .span-2 { grid-column:auto; }
  .customer-editor #customer-form { gap:18px; }
  .customer-editor #customer-error { top:-18px; }
  .customer-editor .brreg-panel { padding:14px; }
  .customer-editor .brreg-panel #brreg-search { width:100%; }
  .customer-editor .modal-footer [data-action="delete-customer"] { flex-basis:100%; margin-right:0; }
}

