/* InvoiceSafe visual polish — refined implementation of the documented V5.7D world.
   Keep the printed .paper, PDF/DOCX metrics, data model and invoice templates unchanged. */
/* A previous flex rule made deliberately hidden legacy buttons visible. */
#is-dashboard #is-save-all[hidden],
#is-dashboard #is-import-all[hidden]{display:none!important}

/* A quieter, more legible dashboard: keep the existing navy and gradient. */
#is-dashboard .is-page-heading h1{letter-spacing:-.035em;line-height:1.18}
#is-dashboard .is-page-heading p,#is-dashboard .is-section-heading p{font-size:13px;line-height:1.6;color:var(--ifs-text-muted)}
#is-dashboard .is-page-count{font-size:12px;color:var(--ifs-text-muted)}
#is-dashboard .is-side-caption{font-size:11px;letter-spacing:.085em;color:var(--ifs-text-muted)}
#is-dashboard .is-side-link{font-size:13px;min-height:44px;line-height:1.35}
#is-dashboard .is-side-privacy{font-size:11px;line-height:1.65;color:var(--ifs-text-muted)}
#is-dashboard :is(.is-filters button,.is-sort-label,.is-home-actions button,#is-transfer-trigger,.is-bulk-intro button,.is-view-toggle button){font-family:var(--ifs-ui-font);font-size:12px;line-height:1.35}
#is-dashboard .is-filter{min-height:38px;padding:8px 13px}
#is-dashboard .is-sort-label select{min-height:42px;font-size:12px}
#is-dashboard .is-search input{font-size:13px}
#is-dashboard .is-card-heading strong{font-size:14px;letter-spacing:-.02em}
#is-dashboard .is-card-location{font-size:12px;line-height:1.45;min-height:2.9em}
#is-dashboard .is-card-meta{font-size:11px;line-height:1.4;color:var(--ifs-text-muted);gap:7px;white-space:normal}
#is-dashboard .is-new-card small{font-size:12px;color:var(--ifs-text-muted)}
#is-dashboard .is-new-card strong{font-size:15px}
#is-dashboard .is-doc-actions button{font-family:var(--ifs-ui-font);font-size:11px;min-height:32px}
#is-dashboard .is-doc-actions .is-more-button{min-width:32px}
#is-dashboard .is-client-card small,#is-dashboard .is-jobsite-card small{font-size:12px}
#is-dashboard :is(.is-profile-form,.is-settings-card,.is-client-dialog,.is-job-dialog) label{font-size:13px;line-height:1.5}
#is-dashboard :is(.is-profile-form,.is-settings-card,.is-client-dialog,.is-job-dialog) :is(input,select,textarea){font-size:14px}
#is-dashboard .is-field-note,#is-dashboard .is-help-inline{font-size:12px;line-height:1.5}
#is-dashboard .is-policy-links button{font-size:12px;min-height:40px}

/* Toolbar hierarchy: one clear Save icon, confident Export, quieter secondary actions. */
body:not(.is-home) .topbar{align-items:center;gap:12px;padding:12px 20px}
body:not(.is-home) .topbar .toolbar{display:flex;align-items:center;gap:8px;justify-content:flex-end}
body:not(.is-home) .topbar .toolbar .btn{font-family:var(--ifs-ui-font)!important;font-size:12px;min-height:var(--ifs-ui-control-height);border-radius:8px;padding:0 12px;font-weight:600}
body:not(.is-home) #save-invoice{min-width:43px;min-height:43px;padding:0 10px;background:var(--ifs-action)!important;color:#fff!important;border-color:#568db4!important}
body:not(.is-home) #save-invoice:hover{background:var(--ifs-action-hover)!important;border-color:#8bc8eb!important}
body:not(.is-home) #save-invoice svg{width:19px;height:19px}
body:not(.is-home) #export-menu-trigger{background:#265575!important;border-color:#4e87ac!important;color:#eef8ff!important}
body:not(.is-home) #export-menu-trigger:hover{background:#326f94!important}
body:not(.is-home) #new-invoice{background:#20354a!important;border-color:#415f79!important}
body:not(.is-home) #new-invoice:hover{background:#294760!important}
body:not(.is-home) #open-settings{background:transparent!important;border-color:#3d536b!important;color:#d2e1f0!important}
body:not(.is-home) #open-settings:hover{background:#243a51!important}
body:not(.is-home) .toolbar .save-indicator{margin:0 3px 0 0;padding:5px 0;color:#c7d9e9;font-size:12px;font-weight:500;max-width:240px;white-space:normal;line-height:1.4}
body:not(.is-home) .editor .panel-heading h1{letter-spacing:-.025em}
body:not(.is-home) .editor .panel-heading p{font-size:12px;line-height:1.6;color:var(--ifs-text-muted)}
body:not(.is-home) .editor .card{padding:21px 19px;gap:13px}
body:not(.is-home) .editor .card-title{margin-bottom:14px}
body:not(.is-home) .editor .card-title h2{font-size:15px;letter-spacing:-.015em}
body:not(.is-home) .editor :is(.field label,.small-label){font-size:13px;font-weight:600;letter-spacing:0;line-height:1.4;color:#d5e6f7}
body:not(.is-home) .editor .field{gap:7px}
body:not(.is-home) .editor .field :is(input,textarea,select){font-size:14px;line-height:1.5;min-height:41px;padding:9px 12px}
body:not(.is-home) .editor .field textarea{min-height:76px}
body:not(.is-home) .editor .field :is(input,textarea)::placeholder{color:#9fb5cb}
body:not(.is-home) .editor .entry{padding:16px;margin-block:8px 11px}
body:not(.is-home) .painting-task{gap:11px;padding:11px}
body:not(.is-home) .painting-task textarea{min-height:82px;font-size:14px}
body:not(.is-home) .settings-drawer .settings-section h3{font-size:15px}
body:not(.is-home) .settings-drawer :is(.settings-desc,.setting-text small){font-size:12px;line-height:1.6;color:#b6cde0}
body:not(.is-home) .settings-drawer :is(label,.setting-text strong){font-size:13px}
body:not(.is-home) .settings-drawer :is(input,select){font-size:13px}

/* Accessible focus, no unnecessary animated decoration. */
#is-dashboard :is(button,a,input,select,textarea,summary):focus-visible,
body:not(.is-home) :is(button,input,select,textarea):focus-visible{
  outline:2px solid var(--ifs-focus)!important;outline-offset:2px!important;
  box-shadow:var(--ifs-ui-focus-ring);
}
.is-transfer-menu button:focus-visible,.editor-export-menu button:focus-visible{background:#31526f}
#is-dashboard button:disabled,body:not(.is-home) button:disabled{opacity:.52;cursor:not-allowed}
/* Storage failures should stay visible, but not become a large technical overlay. */
.is-storage-alert{width:min(610px,calc(100vw - 24px));padding:11px 13px;gap:12px;border-radius:10px;font-size:12px;line-height:1.5;box-shadow:0 12px 28px #0006}
.is-storage-alert button{min-height:39px;padding:8px 12px;font-size:12px}

@media(max-width:1050px){
  body:not(.is-home) .topbar .toolbar{gap:6px}
  body:not(.is-home) .toolbar .save-indicator{max-width:160px}
}
@media(max-width:700px){
  #is-dashboard .is-side-link{font-size:12px;min-height:43px;padding:10px 12px}
  #is-dashboard .is-side-link svg{width:16px;height:16px}
  #is-dashboard .is-card-meta{font-size:11px}
  #is-dashboard .is-card-location{font-size:12px}
  #is-dashboard .is-card-heading strong{font-size:13px}
  #is-dashboard .is-page-heading h1{font-size:32px}
  #is-dashboard .is-page-heading p{font-size:12px}
  #is-dashboard .is-filter{font-size:12px;min-height:40px}
  #is-dashboard .is-view-toggle button{min-height:40px}
  body:not(.is-home) .topbar{padding:11px 13px;gap:9px}
  body:not(.is-home) .topbar .toolbar{width:100%;justify-content:flex-start;flex-wrap:wrap;gap:7px}
  body:not(.is-home) .topbar .toolbar .btn{min-height:41px;font-size:12px;padding-inline:11px}
  body:not(.is-home) #save-invoice{min-height:42px;min-width:42px}
  body:not(.is-home) .toolbar .save-indicator{display:block;order:10;width:100%;max-width:none;font-size:11px;padding:2px 0 0;margin:0}
  body:not(.is-home) .editor .card{padding:18px 14px}
  body:not(.is-home) .preview-zone .preview-pencil,
  body:not(.is-home) .preview-zone .zoom-fit{min-height:39px!important;height:39px!important;font-size:12px!important}
  body:not(.is-home) .preview-zone .zoom-toolbar{height:39px!important}
  body:not(.is-home) .preview-zone .zoom-toolbar button{height:37px!important;min-width:37px}
  body:not(.is-home) .preview-zone .zoom-toolbar output{font-size:12px!important}
  .is-storage-alert{bottom:10px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;font-size:11px;padding:9px 11px}
  .is-storage-alert button{width:auto;min-height:40px}
}
@media(max-width:650px){
  /* Search must not be squeezed between the view toggle and sort on narrow screens. */
  #is-dashboard .is-controls-line{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center}
  #is-dashboard .is-controls-primary{display:contents}
  #is-dashboard .is-controls-line .is-search{grid-column:1/-1;width:100%;max-width:none;margin:0}
  #is-dashboard .is-controls-line .is-search input{width:100%;min-height:44px;font-size:13px}
  #is-dashboard .is-controls-line .is-view-toggle{grid-column:1;grid-row:2;justify-self:start}
  #is-dashboard .is-controls-line .is-sort-label{grid-column:2;grid-row:2;margin:0;justify-self:end}
  #is-dashboard .is-controls-line .is-sort-label select{min-height:43px;max-width:168px;font-size:12px}
}
@media(max-width:410px){
  #is-dashboard .is-grid:not(.is-list) .is-doc-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;padding:7px}
  #is-dashboard .is-grid:not(.is-list) .is-doc-actions button{min-width:0;min-height:34px;margin:0;font-size:10px;padding:6px 3px}
  #is-dashboard .is-grid:not(.is-list) .is-doc-actions .is-more-button{min-width:0}
  #is-dashboard .is-grid:not(.is-list) .is-doc-actions .is-lock-toggle{justify-content:center}
  .is-storage-alert{grid-template-columns:1fr}
  .is-storage-alert button{justify-self:end}
}
@media(prefers-reduced-motion:reduce){
  #is-dashboard .is-document,#is-dashboard .is-new-plus{transition:none!important}
}
/* Align floating menu trigger with the other editor toolbar buttons. */
body:not(.is-home) #export-menu-trigger{height:42px!important;min-height:42px!important}
