/* Date/time native controls must fit their grid track on iPad Safari.
   Important declarations belong to the first cascade layer, above finance. */
@layer visibility {
  .form-grid > label,.semantic-form-grid > label {min-width:0!important;min-inline-size:0!important;max-width:100%!important;}
  input:is([type="date"],[type="time"],[type="datetime-local"]) {
    display:block!important;box-sizing:border-box!important;
    width:100%!important;inline-size:100%!important;
    min-width:0!important;min-inline-size:0!important;-webkit-min-logical-width:0!important;
    max-width:100%!important;max-inline-size:100%!important;
    appearance:none!important;-webkit-appearance:none!important;
  }
  input:is([type="date"],[type="time"],[type="datetime-local"])::-webkit-date-and-time-value {
    min-width:0!important;min-inline-size:0!important;width:auto!important;text-align:left!important;
  }
  #loadImportDialog .semantic-form-grid {grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:16px!important;}
  @media(max-width:700px) {
    #loadImportDialog .semantic-form-grid {grid-template-columns:minmax(0,1fr)!important;}
  }
}

/* Targeted additions for v11; existing Clean Finance styles are unchanged. */
@layer finance {
  #communityConsentDialog[open] {display:flex!important;flex-direction:column;gap:0;width:min(680px,calc(100vw - 24px))!important;max-height:calc(100dvh - 24px)!important;padding:0!important;background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:16px!important;overflow:hidden!important;}
  #communityConsentText {padding:24px;overflow:auto;overscroll-behavior:contain;min-height:0;line-height:1.55;}
  #communityConsentText h2 {margin:0 0 16px;font-size:22px;line-height:1.25;}
  #communityConsentText p {margin:0 0 16px;overflow-wrap:anywhere;}
  #communityConsentDialog .dialog-actions {display:grid;grid-template-columns:1fr 1fr;gap:12px;flex-shrink:0;padding:16px 24px max(16px,env(safe-area-inset-bottom));margin:0;background:var(--surface);border-top:1px solid var(--line);}
  #communityConsentDialog .btn {min-height:48px;white-space:normal;}
  #statCashFlow {overflow-wrap:anywhere;font-size:clamp(16px,2vw,24px);}
  [data-financial-scope] {font-size:14px;line-height:1.4;color:var(--muted);}
}
#chartEmpty.cf-chart-single-note{padding:8px 0!important;text-align:left!important;}
.cf-chart-legend .cf-chart-line{display:inline-block;flex:none;width:18px;height:0;border-top:2px solid var(--blue);vertical-align:middle;}
.cf-chart-line.operating{border-color:var(--muted);border-top-style:dashed;}
.cf-chart-line.net{border-color:var(--green);}
.cf-chart-scale-title{font-weight:700;margin:12px 0 4px;}

@layer finance {
#errorRecoveryDialog{box-sizing:border-box;width:min(460px,calc(100vw - 32px))!important;height:fit-content!important;max-height:calc(100dvh - 32px)!important;inset:0!important;margin:auto!important;overflow:auto!important;padding:24px!important;border:1px solid var(--line,#64748b)!important;border-radius:16px!important;background:var(--surface,#fff);color:var(--text,#182235)}
#errorRecoveryDialog::backdrop{background:rgba(0,0,0,.65)}
#errorRecoveryDialog h2{font-size:1.25rem;margin:0 0 16px;overflow-wrap:anywhere}
#errorRecoveryDialog p{line-height:1.5;overflow-wrap:anywhere}
#errorRecoveryDialog button{display:block;width:100%;min-height:44px;margin-top:12px;padding:12px;white-space:normal;color:inherit;background:transparent;border:1px solid currentColor;border-radius:8px}
[data-theme="dark"] #errorRecoveryDialog{background:#172235;color:#f4f7fb}
}

.numeric-input-error{display:block;color:var(--red);line-height:1.4;white-space:normal;overflow-wrap:anywhere;}

@layer finance {
  .onboarding-brand-row strong,.onboarding-card .vehicle-class-fieldset legend{color:var(--text)!important;}
  .onboarding-brand-row span{color:var(--muted)!important;}
  .onboarding-actions{background:linear-gradient(transparent,var(--surface) 18%)!important;}
}
#ownerArchiveShortcut { margin: 2px 0 14px; }

@layer visibility {
  #workStagesDialog{width:min(760px,calc(100vw - 24px))!important;height:auto!important;max-height:calc(100dvh - 24px)!important;margin:auto!important;inset:0!important;overflow:auto!important;padding:24px!important;border:1px solid var(--line)!important;border-radius:18px!important}
  #workStagesDialog form{height:auto!important;max-height:none!important;overflow:visible!important;padding:0!important;margin:0!important}
  #workStagesDialog .form-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important}
  #workStagesDialog .stage-inline{display:flex!important;gap:10px!important;flex-wrap:wrap!important}
  #workStagesDialog .dialog-title{position:sticky;top:-24px;background:var(--surface);padding:12px 0;z-index:2}
  #workStagesDialog label{font-size:14px;line-height:1.45}
  @media(max-width:540px){#workStagesDialog{padding:16px!important}#workStagesDialog .form-grid{grid-template-columns:1fr!important}#workStagesDialog .dialog-title{top:-16px}}
}

@layer visibility {
 #paymentsDialog {width:min(760px,calc(100vw - 24px))!important;height:auto!important;max-height:calc(100dvh - 24px)!important;inset:0!important;margin:auto!important;overflow:auto!important;padding:24px!important;background:var(--surface,#fff)!important;color:var(--text,#152030)!important}
 #paymentsDialog form {height:auto!important;max-height:none!important;overflow:visible!important;padding:0!important}
 #paymentsDialog .form-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important}
 #paymentsDialog .dialog-title{position:sticky;top:-24px;background:var(--surface);padding:12px 0;z-index:2}
 #paymentsDialog legend label{display:flex!important;align-items:center;gap:8px}
 #paymentsDialog input[type=checkbox]{width:20px!important;min-height:20px!important;display:inline-block!important}
 #paymentsDialog .payment-card {padding:16px;margin:16px 0;border:1px solid var(--line,#d5dce5);border-radius:12px;min-width:0}
 #paymentsDialog .payment-totals,#paymentsDialog .payment-row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
 #paymentsDialog .payment-totals span{flex:1;min-width:120px}#paymentsDialog b{display:block}
 #paymentsError:not(:empty){padding:12px;background:#ffe8e4;color:#921c13;border-radius:8px}
 @media(max-width:540px){#paymentsDialog{padding:14px!important}#paymentsDialog .form-grid{grid-template-columns:1fr!important}}
}

/* Inline recovery stays inside the trip dialog on iPad and narrow screens. */
.route-location-panel{min-width:0;max-width:100%;margin:16px 0;padding:16px;border:1px solid #b9c9dc;border-radius:14px;background:var(--surface,#fff);color:var(--text,#17212f);overflow-wrap:anywhere}
.route-location-panel h3{margin:0 0 8px;font-size:1.1rem}
.route-location-panel label{display:grid;gap:8px;margin:12px 0;min-width:0}
.route-location-panel input{box-sizing:border-box;width:100%;max-width:100%;min-width:0}
.route-location-results{display:grid;gap:12px;margin:12px 0}
.route-location-result{display:grid;gap:10px;padding:12px;border:1px solid #b9c9dc;border-radius:10px;min-width:0}
.route-location-panel .btn{white-space:normal;max-width:100%;min-height:44px}
.route-location-result a{color:#245bd1}

/* Preserve whole navigation labels, including Armenian, without page overflow. */
.cf-nav-list button{min-width:0;overflow:hidden;}
.cf-nav-list button span:last-child{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;word-break:normal;overflow-wrap:normal;}

/* Simple settings: one entry point and progressive disclosure. */
.simple-settings-actions{display:grid;gap:12px}.simple-settings-action{text-align:left;display:grid;gap:8px;padding:18px;border:1px solid var(--border,#dce1ea);border-radius:14px;background:var(--surface,#fff);color:inherit}.simple-settings-action small{font-weight:400;line-height:1.5}.settings-details>summary{cursor:pointer;font-size:1.08rem;font-weight:700;padding:14px 0;list-style-position:inside}.settings-details[open]>summary{margin-bottom:14px}.asset-payment-link,.payment-preview{padding:14px;border-radius:12px;background:var(--bg,#f1f4f9);line-height:1.5}.payment-preview{grid-column:1/-1}.settings-details>button{margin-top:10px}#paymentOverview .finance-list-card{width:100%;text-align:left;margin-top:8px}#paymentOverview .finance-list-card>strong{white-space:nowrap}#paymentOverview small{line-height:1.5}
