/* Responsive settings: presentation only, with existing panels and handlers intact. */
@media screen {
 html body #page-settings {min-width:0}
 html body #page-settings .wf-settings-workspace {
  grid-template-columns:210px minmax(0,1fr)!important;gap:20px;
 }
 html body #page-settings .wf-settings-workspace>.tabs {
  background:var(--card)!important;border-color:var(--business-line,var(--border))!important;
  box-shadow:0 5px 20px rgba(34,77,94,.05);padding:8px!important;
 }
 html body #page-settings .tabs .tab-btn {
  min-width:0;overflow-wrap:anywhere;min-height:48px!important;gap:10px!important;
  transition:background .16s,border-color .16s;
 }
 html body #page-settings .tabs .tab-btn:hover {background:var(--ui-soft)!important;color:var(--ui-accent)!important}
 html body #page-settings .tabs .tab-btn.active {
  background:var(--brand-primary)!important;border-color:var(--brand-primary)!important;color:#fff!important;
 }
 html body #page-settings .tabs .tab-btn.active .wf-ui-icon {color:inherit!important}
 html body #page-settings .wf-settings-content>[id^="stab-"] {
  border-color:var(--business-line,var(--border))!important;border-radius:20px!important;
  padding:24px!important;box-shadow:0 8px 26px rgba(34,77,94,.05)!important;
 }
 html body #page-settings .wf-settings-panel-title {color:var(--text);font-size:20px;line-height:1.5;border-color:var(--border);gap:9px;margin-bottom:20px}
 html body #page-settings .wf-settings-panel-title .wf-ui-icon {color:var(--ui-accent)}
 html body #page-settings .fgrid {grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:18px!important}
 html body #page-settings .fg {min-width:0}
 html body #page-settings .fg .fl {font-size:12px!important;line-height:1.6;margin-bottom:7px}
 html body #page-settings .fc {min-width:0;max-width:100%;min-height:46px!important;font-size:15px!important;box-sizing:border-box}
 html body #page-settings :is(.wf-data-actions,.wf3-drive-actions) {gap:10px}
 html body #page-settings :is(.wf-data-actions,.wf3-drive-actions) .btn {min-width:0;min-height:46px;white-space:normal;line-height:1.5;padding:10px 12px!important}
 html body #page-settings .wf-data-grid {grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:8px}
 html body #page-settings .wf-data-stat {min-width:0;background:var(--ui-soft);border:1px solid var(--border);border-radius:12px;padding:12px 6px}
 html body #page-settings .wf-data-stat b {color:var(--ui-accent);font-variant-numeric:tabular-nums}
 html body #page-settings :is(.wf3-drive-head,.wf3-drive-frequency-row,.wf3-drive-footer-actions) {flex-wrap:wrap;gap:12px}
 html body #page-settings .wf3-drive-frequency {max-width:100%;min-height:44px;background:var(--input);color:var(--text);border-color:var(--border)}
 html body #page-settings :is(.wf3-drive-summary-item,.wf3-drive-copy) {min-width:0;overflow-wrap:anywhere}
 html body #page-settings .wf3-link-btn {min-height:44px;white-space:normal}
 html body #page-settings #stab-company>.card,
 html body #page-settings #stab-bank>.card,
 html body #page-settings #stab-invoice>.card {padding:0!important;border:0!important;box-shadow:none!important;background:transparent!important;margin:0!important}
 html body #page-settings #stab-company>div:not(.card):not(.wf-settings-panel-title)>div {flex-wrap:wrap}
 html body #page-settings #stab-currency>.card:first-of-type>div[style*="display:grid"] {
  grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;
 }
 html body #page-settings #stab-currency>.card:first-of-type>div[style*="display:grid"]>div {
  background:var(--ui-soft);border-radius:10px;padding:10px;line-height:1.7;font-size:12px;overflow-wrap:anywhere;
 }
 html body #page-settings .wf-language-card {min-width:0;overflow-wrap:anywhere}
 html body #page-settings .wf-language-card[aria-pressed="true"]::after {background:var(--brand-primary)!important}
 @media(max-width:900px) {
  html body #page-settings .wf-settings-workspace {grid-template-columns:1fr!important;gap:14px;margin:14px auto!important}
  html body #page-settings .wf-settings-workspace>.tabs {position:static;display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:6px!important}
  html body #page-settings .tabs .tab-btn {flex-direction:column;justify-content:center!important;text-align:center;min-height:64px!important;padding:9px 6px!important;font-size:12px!important;gap:5px!important}
 }
 @media(max-width:600px) {
  html body #page-settings .wf-settings-content>[id^="stab-"] {padding:16px!important;border-radius:16px!important}
  html body #page-settings .wf-settings-workspace>.tabs {grid-template-columns:repeat(3,minmax(0,1fr))!important;padding:6px!important}
  html body #page-settings .tabs .tab-btn {font-size:11px!important;min-height:62px!important}
  html body #page-settings .fgrid {grid-template-columns:minmax(0,1fr)!important;gap:15px!important}
  /* 16px prevents iPhone focus zoom without disabling user zoom. */
  html body #page-settings .fc {font-size:16px!important;min-height:46px!important}
  html body #page-settings .wf-settings-panel-title {font-size:18px;margin-bottom:16px;padding-bottom:12px}
  html body #page-settings .wf-data-grid {grid-template-columns:repeat(2,minmax(0,1fr))!important}
  html body #page-settings :is(.wf-data-actions,.wf3-drive-actions) {display:grid;grid-template-columns:minmax(0,1fr)}
  html body #page-settings .wf3-drive-frequency-row>div {flex-basis:100%}
  html body #page-settings .wf3-drive-frequency {width:100%;font-size:16px}
  html body #page-settings #stab-about>.card>div>div {gap:10px!important;padding:14px!important;flex-wrap:wrap}
  html body #page-settings #stab-about>.card>div>div>div {min-width:150px}
 }
 @media(max-width:360px) {
  html body #page-settings .wf-settings-workspace>.tabs {grid-template-columns:repeat(2,minmax(0,1fr))!important}
  html body #page-settings .tabs .tab-btn {flex-direction:row;min-height:48px!important;text-align:start;justify-content:flex-start!important}
  html body #page-settings #stab-currency>.card:first-of-type>div[style*="display:grid"] {grid-template-columns:minmax(0,1fr)!important}
 }
}

/* A single compact section picker avoids stacking a second app navigation bar on mobile. */
@media screen {
 html body #page-settings .wf-settings-picker {display:none}
 html body #page-settings .wf-settings-panel-enter {animation:wfSettingsPanelEnter .18s ease-out both}
 @keyframes wfSettingsPanelEnter {from{opacity:.65;transform:translateY(5px)}to{opacity:1;transform:none}}
 @media(max-width:900px) {
  html body #page-settings.wf-settings-picker-ready .wf-settings-workspace>.tabs {display:none!important}
  html body #page-settings.wf-settings-picker-ready .wf-settings-picker {
   display:flex;align-items:center;gap:10px;padding:12px;background:var(--card);
   border:1px solid var(--business-line,var(--border));border-radius:14px;min-width:0;
  }
  html body #page-settings .wf-settings-picker-icon {color:var(--ui-accent);flex:0 0 24px;display:grid;place-items:center}
  html body #page-settings .wf-settings-picker select {
   flex:1;min-width:0;width:100%;min-height:46px;padding:9px 12px;font:inherit;font-size:16px;font-weight:700;
   background:var(--input)!important;color:var(--text)!important;border:1px solid var(--border)!important;border-radius:10px!important;
  }
 }
 @media(prefers-reduced-motion:reduce) {html body #page-settings .wf-settings-panel-enter {animation:none!important}}
}
/* Inline section tiles replace the native picker; the form never sits behind a modal. */
@media screen {
 /* Settings shares the dashboard navigation. */
 html body #page-settings.wf-settings-inline-ready .wf-settings-picker {display:none!important}
 html body #page-settings.wf-settings-inline-ready .wf-settings-save-footer {
  display:flex;justify-content:flex-end;max-width:1240px;margin:16px auto 24px;
  padding:14px;background:var(--card);border:1px solid var(--business-line,var(--border));border-radius:16px;
 }
 html body #page-settings .wf-settings-save-footer .btn {
  min-width:180px;min-height:48px;font-size:14px;padding:12px 20px!important;
  background:var(--brand-primary)!important;color:#fff!important;box-shadow:none!important;
 }
 @media(max-width:900px){
  html body #page-settings.wf-settings-inline-ready .wf-settings-workspace>.tabs {
   display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;
   position:static!important;gap:8px!important;padding:8px!important;background:var(--card)!important;
   overflow:visible!important;box-shadow:none;
  }
  html body #page-settings.wf-settings-inline-ready .tabs .tab-btn {
   min-height:54px!important;flex-direction:row;justify-content:flex-start!important;text-align:start;
   padding:10px!important;gap:8px!important;font-size:12px!important;border:1px solid var(--border)!important;
   border-radius:12px!important;background:var(--input)!important;color:var(--text2)!important;
  }
  html body #page-settings.wf-settings-inline-ready .tabs .tab-btn.active {
   background:var(--brand-primary)!important;border-color:var(--brand-primary)!important;color:#fff!important;
  }
  html body #page-settings.wf-settings-inline-ready .tabs .tab-btn .wf-ui-icon {flex:0 0 19px;width:19px;height:19px}
  html body #page-settings.wf-settings-inline-ready .wf-settings-save-footer {margin-block:14px 20px;padding:12px}
  html body #page-settings .wf-settings-save-footer .btn {width:100%;min-width:0}
 }
 @media(max-width:600px){
  html body #page-settings.wf-settings-inline-ready .wf-settings-workspace>.tabs {grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important}
  html body #page-settings.wf-settings-inline-ready .tabs .tab-btn {min-height:46px!important;font-size:11px!important;padding:9px!important}
 }
}
@media screen {
 html body #page-settings .wf-heading-actions:empty {display:none!important}
 html.wf-settings-open body .main {padding-bottom:24px!important}
}
/* A compact fixed save dock replaces the app navigation only in Settings. */
@media screen {
 html body #wf-settings-save-footer {display:none}
 html.wf-settings-open body #wf-settings-save-footer {
  display:flex;position:fixed;z-index:690;bottom:max(8px,env(safe-area-inset-bottom,0px));
  left:12px;right:12px;max-width:720px;margin:0 auto;padding:6px;
  background:var(--card);border:1px solid var(--border);border-radius:18px;
  box-shadow:0 5px 24px rgba(34,77,94,.15);
 }
 html body #wf-settings-save-footer .btn {width:100%;min-height:44px;max-height:52px;margin:0;display:flex;justify-content:center;align-items:center;gap:8px;padding:9px 16px!important;font-size:13px;border-radius:12px!important;background:var(--brand-primary)!important;color:#fff!important;box-shadow:none!important}
 html.wf-settings-open body .main {padding-bottom:calc(94px + env(safe-area-inset-bottom,0px))!important}
 html.wf-settings-open {scroll-padding-bottom:calc(94px + env(safe-area-inset-bottom,0px))}
 html body #page-settings :is(input,select,textarea,button) {scroll-margin-bottom:100px}
 html body #page-settings .tabs .tab-btn {position:relative}
 html body #page-settings.wf-settings-inline-ready .tabs .tab-btn .wf-ui-icon {
  display:grid;place-items:center;width:32px!important;height:32px!important;flex:0 0 32px!important;
  background:var(--ui-soft);border:1px solid var(--border);border-radius:11px;color:var(--ui-accent)!important;
 }
 html body #page-settings.wf-settings-inline-ready .tabs .tab-btn .wf-ui-icon svg {width:19px;height:19px}
 html body #page-settings.wf-settings-inline-ready .tabs .tab-btn.active .wf-ui-icon {background:rgba(255,255,255,.15);border-color:rgba(255,255,255,.2);color:#fff!important}
 html body #page-settings.wf-settings-inline-ready .tabs .tab-btn.active {box-shadow:0 5px 12px rgba(63,124,148,.14)!important}
 @media(max-width:900px){
  html body #page-settings.wf-settings-inline-ready .wf-settings-workspace>.tabs {border:0!important;padding:0!important;background:transparent!important;gap:9px!important}
  html body #page-settings.wf-settings-inline-ready .tabs .tab-btn {min-height:62px!important;border-radius:15px!important;background:var(--card)!important;padding:10px!important;box-shadow:0 3px 12px rgba(34,77,94,.035)!important}
  html body #page-settings.wf-settings-inline-ready .tabs .tab-btn.active {background:var(--brand-primary)!important}
 }
}
/* Sculpted save dock: a centered action in the same recessed form as app navigation. */
@media screen {
 html.wf-settings-open body #wf-settings-save-footer {
  height:58px;box-sizing:border-box;display:flex;align-items:flex-end;justify-content:center;
  padding:0 12px 4px;background:transparent;border:0;border-radius:22px;box-shadow:none;
  isolation:isolate;filter:drop-shadow(0 4px 12px rgba(34,77,94,.14));
 }
 html body #wf-settings-save-footer::before {
  content:'';position:absolute;inset:0;border-radius:22px;z-index:-1;background:var(--card,#fff);
  -webkit-mask:radial-gradient(circle 31px at 50% 0,transparent 30px,#000 31px);
  mask:radial-gradient(circle 31px at 50% 0,transparent 30px,#000 31px);
 }
 html body #wf-settings-save-footer .btn {
  position:relative;flex:0 1 auto;width:auto;min-width:100px;max-width:100%;min-height:78px;max-height:none;
  flex-direction:column;gap:5px;padding:0 8px 3px!important;border:0!important;border-radius:16px!important;
  background:transparent!important;color:var(--brand-primary,#3f7c94)!important;white-space:normal!important;
  line-height:1.2;font-size:12px!important;font-weight:700;overflow:visible;transform:none!important;
 }
 html body #wf-settings-save-footer .wf-settings-save-symbol {
  width:48px;height:48px;flex:0 0 48px;display:grid;place-items:center;border-radius:50%;
  background:var(--brand-primary,#3f7c94);color:#fff;box-shadow:0 3px 8px rgba(34,77,94,.18);
  transition:transform .18s ease,box-shadow .18s ease;
 }
 html body #wf-settings-save-footer .wf-settings-save-symbol svg {width:23px;height:23px}
 html body #wf-settings-save-footer .btn:active .wf-settings-save-symbol {transform:scale(.94)}
 html body #wf-settings-save-footer .btn:focus-visible {outline:2px solid var(--brand-primary,#3f7c94);outline-offset:3px}
 html.wf-settings-open body .main {padding-bottom:calc(112px + env(safe-area-inset-bottom,0px))!important}
 html.wf-settings-open {scroll-padding-bottom:calc(112px + env(safe-area-inset-bottom,0px))}
 html body #page-settings :is(input,select,textarea,button) {scroll-margin-bottom:118px}
 @media(prefers-reduced-motion:reduce){html body #wf-settings-save-footer *{transition:none!important;animation:none!important}}
}
@media print{#wf-settings-save-footer{display:none!important}}
/* Edge-to-edge save navigation, matching the main bottom bar. */
@media screen {
 html.wf-settings-open body #wf-settings-save-footer {
  left:0;right:0;bottom:0;width:100%;max-width:none;margin:0;
  height:calc(58px + env(safe-area-inset-bottom,0px));
  padding:0 12px calc(4px + env(safe-area-inset-bottom,0px));
  border-radius:22px 22px 0 0;
 }
 html body #wf-settings-save-footer::before {border-radius:22px 22px 0 0;background:#fff;}
}

/* Settings directory and grouped content share the workspace palette. */
@media screen {
  html body #mainContent #page-settings .wf-settings-workspace {
    max-width: 1260px !important;
    grid-template-columns: minmax(185px,220px) minmax(0,1fr) !important;
    margin-block-start: 0 !important;
    align-items: start;
  }
  html body #mainContent #page-settings .wf-settings-workspace > .tabs {
    gap: 4px !important;
    padding: 8px !important;
    border: 1px solid var(--hairline) !important;
    border-radius: 17px !important;
    background: var(--paper) !important;
    box-shadow: var(--lift) !important;
  }
  html body #mainContent #page-settings .wf-settings-workspace .tab-btn {
    position: relative;
    min-height: 47px !important;
    padding: 7px 9px !important;
    border: 1px solid transparent !important;
    border-radius: 11px !important;
    background: transparent !important;
    color: var(--text2) !important;
    box-shadow: none !important;
    line-height: 1.3;
    white-space: normal;
  }
  html body #mainContent #page-settings .wf-settings-workspace .tab-btn.active {
    background: var(--wf-section-tint) !important;
    border-color: color-mix(in srgb, var(--brand-primary) 38%, var(--border)) !important;
    color: var(--ink) !important;
    font-weight: 800;
  }
  html body #mainContent #page-settings .wf-settings-workspace .tab-btn .wf-ui-icon {
    width: 26px !important; height: 26px !important; flex-basis: 26px !important;
    color: var(--ui-accent) !important; background: transparent !important; border: 0 !important;
  }
  html body #mainContent #page-settings .wf-settings-content > [role="tabpanel"] {
    min-width: 0;
    border-radius: 18px !important;
    padding: clamp(14px, 2.4vw, 30px) !important;
  }
  html body #page-settings :is(.wf-settings-panel-title,#wfLanguageTitle) {
    margin-block: 0 18px;
    padding-block-end: 12px;
    border-block-end: 1px solid var(--hairline);
    font-size: clamp(17px,2.3vw,24px); font-weight: 800;
    color: var(--ink);
  }
  html body #mainContent #page-settings .wf-settings-content .fc {
    background: var(--input) !important;
    border-radius: 12px !important;
  }
  html body #mainContent #page-settings .wf-settings-content :is(.wf-language-card,.wf-data-stat) {
    border-color: var(--hairline) !important;
    background: var(--wf-section-tint) !important;
    border-radius: 12px !important;
  }
  html body #mainContent #page-settings .wf-language-card[aria-pressed="true"] {
    border-color: var(--brand-primary) !important;
  }
  html body #mainContent #page-settings #stab-company .wf-company-identity {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px;
    margin-block-end: 18px;
    border: 1px solid var(--hairline);
    border-radius: 14px;
    background: var(--wf-section-tint);
  }
  html body #page-settings .wf-company-identity .settings-logo-prev {
    width: 58px; height: 58px; margin: 0 !important; flex: 0 0 58px;
  }
  html body #page-settings .wf-company-identity > div:last-child { justify-content: flex-start !important; }
  @media (max-width: 900px) {
    html body #mainContent #page-settings .wf-settings-workspace { grid-template-columns: minmax(0,1fr) !important; gap: 12px !important; }
    html body #mainContent #page-settings .wf-settings-workspace > .tabs {
      grid-template-columns: repeat(auto-fit,minmax(min(100%,105px),1fr)) !important;
    }
  }
}

@media screen {
  #page-settings .wf-about-identity {
    display: grid; justify-items: center;
    gap: 6px; padding: clamp(16px, 3vw, 32px); margin-block-end: 16px;
    text-align: center; border: 1px solid var(--hairline); border-radius: 14px;
    background: linear-gradient(135deg, var(--wf-section-tint), var(--paper));
  }
}

@media screen {
  #page-settings .wf-settings-rates { margin-block-end: 16px; }
  #page-settings .wf-settings-rate-grid {
    display: grid; gap: 7px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 105px), 1fr));
  }
  #page-settings .wf-settings-rate-grid > div {
    display: grid; gap: 3px;
    padding: 8px 10px;
    border: 1px solid var(--hairline); border-radius: 10px;
    background: var(--wf-section-tint);
    color: var(--text2); font-size: 11px;
  }
  #page-settings .wf-settings-rate-grid strong {
    color: var(--ink); font-size: 16px;
    overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
  }
}

@media screen {
 html.wf-settings-open body #bottomNav #bnav-2 .bnav-label:not(.settings-save-label),
 html.wf-settings-open body #bottomNav #bnavCircleIcon > * { display:none!important }
 html.wf-settings-open body #bottomNav .settings-save-label { display:inline!important }
 html:not(.wf-settings-open) body #bottomNav #bnav-2 .settings-save-label { display:none!important }
 html.wf-settings-open body #bottomNav #bnavCircleIcon { font-size:0 }
 html.wf-settings-open body #bottomNav #bnavCircleIcon::after {
   content:""; width:23px; height:23px; background:currentColor;
   mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 3h14l4 4v14H3zM7 3v6h10V3M7 21v-8h10v8'/%3E%3C/svg%3E") center/contain no-repeat;
 }
 .cashbox-shortcut { margin-block:6px 12px }
}
