/* Shared form fields, toggles, validation, and modal variants */

.fontawesome-picker-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.fontawesome-picker-row > .input {
  flex: 1 1 auto;
  min-width: 0;
}

.fontawesome-picker-preview,
.fontawesome-picker-trigger {
  min-width: 48px;
}

.fontawesome-picker-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--brand);
  background: var(--surface-subtle, #f7f9fc);
}

.fontawesome-picker-preview-icon {
  font-size: 18px;
}

.fontawesome-picker-modal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
}

.fontawesome-picker-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  max-height: min(52vh, 420px);
  overflow: auto;
  padding: 2px;
}

.fontawesome-picker-option {
  display: grid;
  min-height: 64px;
  place-items: center;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}

.fontawesome-picker-option:hover,
.fontawesome-picker-option:focus-visible,
.fontawesome-picker-option[aria-selected="true"] {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--surface-subtle, #f7f9fc);
}

.fontawesome-picker-option > i {
  font-size: 23px;
}

.fontawesome-picker-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

@media (max-width: 800px) {
  .fontawesome-picker-row {
    flex-wrap: wrap;
  }

  .fontawesome-picker-row > .input {
    flex-basis: calc(100% - 56px);
  }

  .fontawesome-picker-trigger {
    min-height: 48px;
  }

  .fontawesome-picker-modal {
    grid-template-columns: 1fr;
  }

  .fontawesome-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: 48vh;
  }
}

/* Keep text inputs and selects the same outer box (native <select> is taller otherwise). */
.input,
.select {
  box-sizing: border-box;
  height: 44px;
  min-height: 44px;
  padding: 0 12px;
  line-height: 1.25;
}

/* Phone/tablet: ≥16px prevents iOS focus auto-zoom (desktop keeps inherited density). */
@media (max-width: 800px) {
  .input,
  .select,
  .textarea,
  select.input,
  select.select,
  .table-mobile-sort-select,
  .table-page-size select {
    font-size: 16px;
  }
}

/* Native browser spinners use the field's decimal step (for example 0.01).
   Hide them globally; integer quantity controls use the shared ±1 stepper. */
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.modal-alert-body p,
.modal-dialog-body p,
.modal-alert-body ul {
  font-size: 15px;
  line-height: 1.55;
}

/* Product form sections are shared by create, edit, and read-only detail modals. */
.entity-form-sections{display:contents}
.entity-form-section-tabs{grid-column:1/-1;display:flex;gap:6px;flex-wrap:wrap;padding-bottom:4px;border-bottom:1px solid var(--line)}
.entity-form-section-tab{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:9px 12px;border:1px solid transparent;border-radius:10px;background:transparent;color:var(--muted);font-weight:800;cursor:pointer}
.entity-form-section-tab:hover,.entity-form-section-tab:focus-visible{border-color:var(--brand-2);background:var(--mint);color:var(--brand);outline:0}
.entity-form-section-tab.is-active{border-color:var(--brand);background:var(--mint);color:var(--brand)}
.entity-form-section-panel{grid-column:1/-1;align-content:start}
.entity-form-section-panel[hidden]{display:none!important}
@media (max-width:800px){
  .entity-form-section-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
  .entity-form-section-tab{min-height:44px;padding:8px 5px;font-size:11px;line-height:1.2}
}

.number-stepper {
  --number-stepper-control-height: 44px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: stretch;
  height: var(--number-stepper-control-height);
  width: 100%;
  max-width: 140px;
}

.number-stepper .input {
  min-width: 0;
  height: var(--number-stepper-control-height);
  min-height: var(--number-stepper-control-height);
  border-radius: 0;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.number-stepper .input::-webkit-outer-spin-button,
.number-stepper .input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.number-stepper-button {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: var(--number-stepper-control-height);
  min-height: var(--number-stepper-control-height);
  padding: 0;
  border: 1px solid var(--line, #d8e4e0);
  background: var(--surface, #fff);
  color: var(--brand-primary, var(--brand));
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.number-stepper-button:first-child {
  border-radius: 10px 0 0 10px;
}

.number-stepper-button:last-child {
  border-radius: 0 10px 10px 0;
}

.number-stepper-button:hover,
.number-stepper-button:focus-visible {
  background: var(--brand-soft, var(--mint));
  outline: 0;
}

.number-stepper-button:focus-visible {
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-secondary, var(--brand-2)) 25%, transparent);
}

.number-stepper-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.textarea {
  box-sizing: border-box;
  height: auto;
  min-height: 90px;
  padding: 11px 12px;
  line-height: 1.5;
}

.select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--surface, #fff);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.2 1.4L6 6.2l4.8-4.8' stroke='%2370827d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
  padding-right: 36px;
}

/* Multi-select list boxes need auto height and no single-select chevron. */
.select[multiple] {
  height: auto;
  min-height: 88px;
  padding: 8px 12px;
  line-height: 1.45;
  background-image: none;
  padding-right: 12px;
}

.select[multiple] option {
  padding: 6px 8px;
  border-radius: 6px;
}

/* Shared searchable single-select (formField searchable => true). No create/add. */
.searchable-select {
  position: relative;
  display: grid;
  min-width: 0;
}

.searchable-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.searchable-select-panel {
  position: relative;
  min-width: 0;
  z-index: 12;
}

.searchable-select-input {
  width: 100%;
  min-width: 0;
  background-color: var(--surface, #fff);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.2 1.4L6 6.2l4.8-4.8' stroke='%2370827d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
  padding-right: 36px;
}

.searchable-select-menu {
  /* Body-mounted (enhanceSearchableSelects); fixed so modal overflow cannot clip. */
  position: fixed;
  top: 0;
  left: 0;
  z-index: 150;
  width: auto;
  min-width: 180px;
  display: grid;
  gap: 4px;
  max-height: min(280px, 40vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px;
  border: 1px solid #b9d2f3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(24, 50, 77, .12);
}

.searchable-select-menu[hidden] {
  display: none !important;
}

.searchable-select-option {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line, #d7e2ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ink, #18324d);
  text-align: left;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.searchable-select-option:hover,
.searchable-select-option:focus-visible,
.searchable-select-option.is-active {
  border-color: #c5d4e6;
  background: #f3f6fa;
  outline: 0;
}

.searchable-select-option.is-selected {
  border-color: var(--brand-2, #3d8bd2);
  background: var(--mint, #eaf4fd);
  color: var(--brand, #2463a8);
}

.searchable-select-message {
  margin: 0;
  padding: 8px 10px;
  color: var(--muted, #70827d);
  font-size: 12px;
}

.searchable-select-option--create {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  border: 1px solid #b9d2f3;
  background: #d7e6fb;
  color: #204d8c;
}

.searchable-select-option--create:hover,
.searchable-select-option--create:focus-visible,
.searchable-select-option--create.is-active {
  border-color: #8fb5e8;
  background: #c7dbf7;
  color: #18447e;
  outline: 0;
}

.searchable-select-option--create i {
  flex: 0 0 auto;
  font-size: 13px;
}

.field.is-invalid .searchable-select-input[aria-invalid="true"] {
  border-color: var(--danger, var(--red));
  outline: 3px solid color-mix(in srgb, var(--danger, var(--red)) 18%, transparent);
}

.date-picker {
  position: relative;
  display: grid;
  min-width: 0;
}

.date-picker-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.date-picker-panel {
  position: relative;
  display: grid;
  min-width: 0;
}

.date-picker-input {
  width: 100%;
  min-width: 0;
  padding-right: 48px;
}

.date-picker-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: auto;
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--brand-primary, var(--brand));
  line-height: 1;
  transform: none;
  cursor: pointer;
}

.date-picker-toggle i {
  display: block;
  line-height: 1;
  font-size: 14px;
}

.date-picker-toggle:hover,
.date-picker-toggle:focus-visible {
  background: var(--brand-soft, var(--mint));
  outline: 0;
}

.date-picker-toggle:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.date-picker-popover {
  position: fixed;
  /* Above .modal-backdrop (130) / --stack (140); same band as .line-item-combobox-menu. */
  z-index: 150;
  display: grid;
  gap: 10px;
  width: min(320px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid var(--border, var(--line));
  border-radius: 14px;
  background: var(--surface, #fff);
  box-shadow: 0 14px 30px rgba(24, 50, 77, .16);
  color: var(--text-primary, var(--ink));
}

.date-picker-popover[hidden] {
  display: none !important;
}

.date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.date-picker-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary, var(--ink));
}

.date-picker-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.date-picker-nav-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border, var(--line));
  border-radius: 10px;
  background: var(--surface, #fff);
  color: var(--brand-primary, var(--brand));
  cursor: pointer;
}

.date-picker-nav-btn:hover,
.date-picker-nav-btn:focus-visible {
  background: var(--brand-soft, var(--mint));
  outline: 0;
}

.date-picker-weekdays,
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.date-picker-weekdays span {
  display: grid;
  place-items: center;
  min-height: 28px;
  color: var(--text-muted, var(--muted));
  font-size: 11px;
  font-weight: 800;
}

.date-picker-day {
  display: grid;
  place-items: center;
  min-height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary, var(--ink));
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.date-picker-day:hover,
.date-picker-day:focus-visible {
  background: var(--brand-soft, var(--mint));
  outline: 0;
}

.date-picker-day.is-outside {
  color: var(--text-muted, var(--muted));
  font-weight: 600;
}

.date-picker-day.is-today {
  box-shadow: inset 0 0 0 1px var(--brand-secondary, var(--brand-2));
  background: color-mix(in srgb, var(--brand-soft, var(--mint)) 70%, #fff);
}

.date-picker-day.is-selected {
  background: var(--brand-primary, var(--brand));
  color: #fff;
  border-color: var(--brand-primary-dark, var(--brand-primary));
}

.date-picker-day.is-selected:hover,
.date-picker-day.is-selected:focus-visible {
  background: var(--brand-primary-dark, var(--brand-primary));
  color: #fff;
}

.date-picker-day.is-disabled,
.date-picker-day:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.date-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.date-picker-footer-btn {
  border: 0;
  background: transparent;
  color: var(--brand-primary, var(--brand));
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  min-height: 36px;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
}

.date-picker-footer-btn:hover,
.date-picker-footer-btn:focus-visible {
  background: var(--brand-soft, var(--mint));
  outline: 0;
}

.date-picker-footer-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.date-picker-footer-btn--primary {
  margin-left: auto;
}

.field.is-invalid .date-picker-input[aria-invalid="true"] {
  border-color: var(--danger, var(--red));
  outline: 3px solid color-mix(in srgb, var(--danger, var(--red)) 18%, transparent);
}

@media (max-width: 800px) {
  .date-picker-popover.is-mobile-sheet {
    left: 12px !important;
    right: 12px !important;
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    top: auto !important;
    width: auto !important;
    max-height: min(70dvh, 460px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .date-picker-day,
  .date-picker-nav-btn,
  .date-picker-footer-btn {
    min-height: 48px;
  }

  /* Square inset toggle tracks .input height; do not force a fixed width taller/wider mismatch. */
  .date-picker-toggle {
    top: 6px;
    right: 6px;
    bottom: 6px;
    width: auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .date-picker-nav-btn {
    width: 44px;
    height: 44px;
  }
}

.select::-ms-expand {
  display: none;
}

.field-required {
  color: var(--danger, var(--red));
  font-weight: 700;
  font-size: 11px;
  margin-left: 2px;
}

.field-hint {
  margin: 0;
  color: var(--text-muted, var(--muted));
  font-size: 12px;
  line-height: 1.4;
}

.field-error {
  margin: 0;
  color: var(--danger, var(--red));
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.field.is-invalid .input,
.field.is-invalid .select,
.field.is-invalid .textarea {
  border-color: var(--danger, var(--red));
}

.field.is-invalid .input:focus,
.field.is-invalid .select:focus,
.field.is-invalid .textarea:focus {
  border-color: var(--danger, var(--red));
  outline: 3px solid color-mix(in srgb, var(--danger, var(--red)) 25%, transparent);
  outline-offset: 2px;
}

.field-control {
  position: relative;
  display: block;
}

.field-control-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--text-muted, var(--muted));
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}

.field-control .input {
  padding-left: 40px;
}

.field-control .input[type="password"] { padding-right: 46px; }
.field-password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted, var(--muted));
  cursor: pointer;
}
.field-password-toggle:hover,
.field-password-toggle:focus-visible {
  background: var(--brand-soft, var(--mint));
  color: var(--brand-primary, var(--brand));
  outline: 0;
}
.field-password-toggle:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-secondary, var(--brand-2)) 25%, transparent);
}

.field-copy-from-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.field-copy-from-row > .input,
.field-copy-from-row > .field-control {
  flex: 1 1 auto;
  min-width: 0;
}
.field-copy-from-row > .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.field-copy-from-control {
  position: relative;
}
.field-copy-from-control.is-tip-open .table-identity-view-tip:not(.table-identity-view-tip--floating) {
  opacity: 0;
  transform: translateY(4px);
}

.field.is-invalid .field-control-icon {
  color: var(--danger, var(--red));
}

/* Web Katalog: static app base + editable publicPath slug in one control */
.settings-website-public-url-compose {
  display: flex;
  align-items: stretch;
  min-width: 0;
  flex: 1 1 220px;
  border: 1px solid var(--border, var(--line, #d8e4e0));
  border-radius: 10px;
  background: var(--surface, #fff);
  overflow: hidden;
}

.settings-website-public-url-compose .settings-website-public-url-prefix {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  max-width: min(58%, 320px);
  margin-left: 40px;
  padding: 0 2px 0 0;
  overflow: hidden;
  color: var(--text-muted, var(--muted));
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  user-select: none;
  pointer-events: none;
}

.settings-website-public-url-compose .input.settings-website-public-path-input {
  flex: 1 1 96px;
  width: auto;
  min-width: 72px;
  border: 0 !important;
  border-radius: 0;
  padding-left: 0 !important;
  background: transparent;
  box-shadow: none !important;
}

.settings-website-public-url-compose .input.settings-website-public-path-input:focus,
.settings-website-public-url-compose .input.settings-website-public-path-input:focus-visible {
  border: 0 !important;
  outline: 0;
  box-shadow: none !important;
}

.settings-website-public-url-compose:focus-within {
  border-color: var(--brand-secondary, var(--brand-2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-secondary, var(--brand-2)) 14%, transparent);
}

.field.is-invalid .settings-website-public-url-compose {
  border-color: var(--danger, var(--red));
}

.field.is-invalid .settings-website-public-url-compose:focus-within {
  border-color: var(--danger, var(--red));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger, var(--red)) 25%, transparent);
}

@media (max-width: 800px) {
  .settings-website-public-url-compose .settings-website-public-url-prefix {
    max-width: min(48%, 180px);
    font-size: 12px;
  }
}

/* Floating label: rests inside the control, animates onto the top border */
.field-floating {
  gap: 8px;
}

.field-floating .field-control {
  --floating-label-left: 12px;
}

.field-floating.field-floating--icon .field-control {
  --floating-label-left: 40px;
}

.field-floating .input {
  height: auto;
  min-height: 52px;
  padding-top: 16px;
  padding-bottom: 10px;
}

.field-floating .field-control > label {
  position: absolute;
  left: var(--floating-label-left);
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0 6px;
  max-width: calc(100% - 52px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted, var(--muted));
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  background: transparent;
  pointer-events: none;
  z-index: 2;
  transition:
    top .2s ease,
    transform .2s ease,
    font-size .2s ease,
    color .2s ease,
    left .2s ease,
    background-color .2s ease;
}

.field-floating:focus-within .field-control > label,
.field-floating .input:not(:placeholder-shown) + label,
.field-floating .input:-webkit-autofill + label {
  top: 0;
  left: 12px;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--brand-primary, var(--brand));
  background: var(--surface, #fff);
}

.field-floating:focus-within .field-control-icon,
.field-floating:has(.input:not(:placeholder-shown)) .field-control-icon {
  color: var(--brand-primary, var(--brand));
}

.field-floating.is-invalid .field-control > label,
.field-floating.is-invalid:focus-within .field-control > label {
  color: var(--danger, var(--red));
}

.field-floating.is-invalid:focus-within .input,
.field-floating.is-invalid .input:not(:placeholder-shown) {
  border-color: var(--danger, var(--red));
}

@media (prefers-reduced-motion: reduce) {
  .field-floating .field-control > label {
    transition: none;
  }
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: 12px;
  color: var(--text-primary, var(--ink));
}

.switch.full {
  grid-column: 1 / -1;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 44px;
  height: 26px;
  flex: 0 0 44px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border, var(--line)) 85%, var(--text-muted, var(--muted)));
  transition: background-color .18s ease;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  transition: transform .18s ease;
}

.switch input:checked + .switch-track {
  background: var(--brand-primary, var(--brand));
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid color-mix(in srgb, var(--brand-secondary, var(--brand-2)) 35%, transparent);
  outline-offset: 2px;
}

.switch input:disabled + .switch-track {
  opacity: .55;
}

.switch input:disabled ~ .switch-label {
  opacity: .65;
  cursor: not-allowed;
}

.switch:has(input:disabled) {
  cursor: not-allowed;
}

.modal-backdrop {
  /* Above .mobile-nav (z-index 100) so sheet footers are not covered on phones. */
  z-index: 130;
}

.modal-backdrop.modal-backdrop--stack {
  z-index: 140;
}

.modal-backdrop.is-covered {
  pointer-events: none;
}

.modal-backdrop.is-covered .modal {
  visibility: hidden;
}

.modal-backdrop .modal {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  max-height: min(90vh, 860px);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  margin: 0;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border, var(--line));
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.modal-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.modal-head-title .modal-alert-icon,
.modal-head-title .modal-dialog-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 14px;
  background: color-mix(in srgb, var(--danger, var(--red)) 13%, #fff);
  color: var(--danger, var(--red));
}

.modal-body,
.modal-alert-body,
.modal-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 18px 22px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  margin: 0;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border, var(--line));
  background: color-mix(in srgb, var(--canvas, #f4f8fc) 55%, #fff);
}

/* Modal action intents: .modal-btn-save|update|confirm (+ .btn-primary),
   .modal-btn-cancel (+ .btn-dismiss), .modal-btn-edit (+ .btn-table-edit),
   .modal-btn-success (+ .btn-success), .modal-btn-delete (+ .btn-danger).
   Always pair intent + base .btn variant. */
.modal-btn {
  min-height: 40px;
  padding: 11px 15px;
  border-radius: 10px;
  font-weight: 700;
  flex: 0 0 auto;
  width: auto;
  align-self: center;
}

/* Keep modal Düzenle green like table edit, but at modal footer size (not compact table sizing). */
.modal-btn.modal-btn-edit,
.modal-btn.btn-table-edit,
.modal-btn.modal-btn-success,
.modal-btn.btn-success,
.modal-btn.modal-btn-cancel,
.modal-btn.btn-dismiss {
  min-height: 40px;
  padding: 11px 15px;
  font-size: inherit;
  line-height: inherit;
}

.modal[data-modal-variant="dialog"],
.modal[data-modal-variant="alert"] {
  width: min(480px, 100%);
}

.modal[data-modal-variant="normal"] {
  width: min(920px, 100%);
  max-height: min(88vh, 860px);
}

.modal[data-modal-variant="normal"] .modal-body .form-grid {
  margin: 0;
}

/* Responsive modal forms: grid tracks and their children must be allowed to shrink
   inside the modal body instead of creating a horizontal scrollbar. */
.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  max-width: 100%;
}

.form-grid > *,
.form-grid .field,
.modal-body > [data-modal-body-host],
.modal-alert-body > [data-modal-body-host],
.modal-dialog-body > [data-modal-body-host] {
  min-width: 0;
  max-width: 100%;
}

.modal-body form.form-grid,
.modal-alert-body form.form-grid,
.modal-dialog-body form.form-grid {
  width: 100%;
}

[data-line-items] {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
}

.line-items-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.line-items-table .input,
.line-items-table .select {
  min-width: 72px;
}

.line-items-table th,
.line-items-table td {
  vertical-align: middle;
}

/* Order, quotation, and purchase-order line items: a scoped saved-item editor. */
.line-items-editor--saved-list {
  --line-items-head-height: 2.25rem;
  --line-items-row-height: 3.75rem;
  --line-items-row-cap: 4;
  --line-items-scroll-max: calc(var(--line-items-head-height) + (var(--line-items-row-cap) * var(--line-items-row-height)));
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  overflow: visible;
}

.line-items-editor--saved-list .line-items-saved {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.line-items-editor--saved-list > .line-items-total {
  grid-column: 1 / -1;
}

.line-items-editor--saved-list .line-items-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.line-items-editor--saved-list .line-items-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.line-items-editor--saved-list .line-items-section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* Cap ~4 desktop rows; section title + document Toplam stay outside. */
.line-items-editor--saved-list .line-items-wrap {
  max-width: 100%;
  max-height: var(--line-items-scroll-max);
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #8fb5e8 #eef4fd;
}

.line-items-editor--saved-list .line-items-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.line-items-editor--saved-list .line-items-wrap::-webkit-scrollbar-track {
  background: #eef4fd;
  border-radius: 999px;
}

.line-items-editor--saved-list .line-items-wrap::-webkit-scrollbar-thumb {
  background: #8fb5e8;
  border-radius: 999px;
}

.line-items-editor--saved-list .line-items-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fbfcfb;
  box-shadow: 0 1px 0 var(--line, #e2ebe7);
}

.line-items-editor--saved-list .line-items-table {
  width: 100%;
  table-layout: fixed;
}

.line-items-editor--saved-list .line-items-table th,
.line-items-editor--saved-list .line-items-table td {
  min-width: 0;
  padding: 8px 6px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.line-items-editor--saved-list .line-items-table th {
  font-size: 10px;
  line-height: 1.25;
}

.line-items-editor--saved-list .line-items-table .input,
.line-items-editor--saved-list .line-items-table .select {
  width: 100%;
  min-width: 0;
  padding-right: 26px;
  font-size: 11px;
}

.line-items-editor--saved-list .line-items-table input[type="number"] {
  min-width: 54px;
  padding-right: 7px;
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.line-items-editor--saved-list .line-items-table .number-stepper {
  width: max-content;
  min-width: 0;
  max-width: 5.25rem;
  grid-template-columns: 24px minmax(1.5rem, 2rem) 24px;
}

.line-items-editor--saved-list .line-items-table .number-stepper .input {
  min-width: 0;
  width: 100%;
  padding-left: 2px;
  padding-right: 2px;
  text-align: center;
}

.line-items-editor--saved-list .line-items-table .number-stepper-button {
  min-width: 24px;
  padding: 0;
}

.line-items-editor--saved-list .line-items-table input[type="text"],
.line-items-editor--saved-list .line-items-table input[type="number"],
.line-items-editor--saved-list .line-items-table .select {
  color: var(--ink);
  font-size: 12px;
  opacity: 1;
}

.line-items-editor--saved-list .line-items-table th:nth-child(1),
.line-items-editor--saved-list .line-items-table td:nth-child(1) { width: 10%; }
.line-items-editor--saved-list .line-items-table th:nth-child(2),
.line-items-editor--saved-list .line-items-table td:nth-child(2) { width: 26%; }
.line-items-editor--saved-list .line-items-table th:nth-child(3),
.line-items-editor--saved-list .line-items-table td:nth-child(3) { width: 9%; }
.line-items-editor--saved-list .line-items-table th:nth-child(4),
.line-items-editor--saved-list .line-items-table td:nth-child(4) { width: 12%; }
.line-items-editor--saved-list .line-items-table th:nth-child(5),
.line-items-editor--saved-list .line-items-table td:nth-child(5) { width: 9%; }
.line-items-editor--saved-list .line-items-table th:nth-child(6),
.line-items-editor--saved-list .line-items-table td:nth-child(6) { width: 6%; }
.line-items-editor--saved-list .line-items-table th:nth-child(7),
.line-items-editor--saved-list .line-items-table td:nth-child(7) { width: 13%; }
.line-items-editor--saved-list .line-items-table th:nth-child(8),
.line-items-editor--saved-list .line-items-table td:nth-child(8) { width: 15%; }

.line-items-editor--saved-list .line-items-table input[data-line-item-field="discount"] {
  width: 100%;
  max-width: 3.25rem;
  min-width: 2.75rem;
  margin-inline-start: auto;
  padding-left: 6px;
  padding-right: 6px;
}

.line-items-editor--saved-list .line-item-native-select {
  display: none !important;
}

.line-items-editor--saved-list .line-item-combobox {
  position: relative;
  display: grid;
  gap: 6px;
}

.line-items-editor--saved-list .line-item-combobox-panel {
  position: relative;
  display: none;
  gap: 6px;
  z-index: 20;
}

.line-items-editor--saved-list tr[data-line-item-active="product"] [data-line-item-combobox-panel="product"],
.line-items-editor--saved-list tr[data-line-item-active="service"] [data-line-item-combobox-panel="service"] {
  display: grid;
}

.line-items-editor--saved-list .line-item-combobox-input {
  width: 100%;
  min-width: 0;
  padding-right: 10px;
}

/* Fixed + body-mounted so modal transform / .line-items-wrap overflow cannot clip or mis-anchor. JS sets top/left/width. */
/* The menu is portaled to document.body by portalOptionsMenu(); keep these
   selectors unscoped so the fixed overlay retains its styling after moving. */
.line-item-combobox-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 150;
  width: auto;
  min-width: 180px;
  margin-top: 0;
  display: grid;
  gap: 4px;
  max-height: min(360px, 45vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #8fb5e8 #eef4fd;
  padding: 5px;
  border: 1px solid #b9d2f3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(24, 50, 77, .12);
}

.line-item-combobox-menu::-webkit-scrollbar {
  width: 8px;
}

.line-item-combobox-menu::-webkit-scrollbar-track {
  border-radius: 10px;
  background: #eef4fd;
}

.line-item-combobox-menu::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #8fb5e8;
}

.line-item-combobox-menu::-webkit-scrollbar-thumb:hover {
  background: #6e9ddd;
}

.line-item-combobox-menu[hidden],
.line-items-editor--saved-list .line-item-add-custom[hidden] {
  display: none !important;
}

.line-item-option {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid #cfd8e6;
  border-radius: 7px;
  background: #fff;
  color: var(--ink, #1f2a37);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.line-item-combobox-message {
  min-height: 0;
  padding: 6px 8px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted, #6b7a90);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.line-item-option:hover,
.line-item-option:focus-visible {
  border-color: #9eb0c9;
  background: #f5f7fb;
  color: var(--ink, #1f2a37);
  outline: 0;
}

.line-item-option--custom {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  border: 1px solid #b9d2f3;
  border-top: 1px solid #b9d2f3;
  background: #d7e6fb;
  color: #204d8c;
}

.line-item-option--custom:hover,
.line-item-option--custom:focus-visible {
  border-color: #8fb5e8;
  background: #c7dbf7;
  color: #18447e;
}

.line-item-option--custom i {
  flex: 0 0 auto;
  font-size: 13px;
}

.line-items-editor--saved-list .line-item-add-custom:not([hidden]) {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-items-editor--saved-list .line-items-table td[data-label="Toplam"] {
  color: var(--brand);
  font-weight: 800;
  text-align: right;
}

.line-items-editor--saved-list .line-item-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.line-items-editor--saved-list .line-item-actions .btn {
  width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  font-size: 11px;
  white-space: nowrap;
}

.line-items-editor--saved-list .line-item-actions .btn[hidden] {
  display: none !important;
}

.line-items-editor--saved-list .line-items-inline-warning {
  margin: 0 0 12px;
  align-items: flex-start;
  gap: 10px;
}

.line-items-editor--saved-list .line-items-inline-warning[hidden] {
  display: none !important;
}

.line-items-editor--saved-list [data-line-item-field][aria-invalid="true"] {
  border-color: var(--danger, var(--red));
  outline: 3px solid color-mix(in srgb, var(--danger, var(--red)) 18%, transparent);
}

.line-items-editor--saved-list [data-line-item-combobox][aria-invalid="true"] {
  border-color: var(--danger, var(--red));
  outline: 3px solid color-mix(in srgb, var(--danger, var(--red)) 18%, transparent);
}

@media (max-width: 900px) {
  /* Labeled cards are taller than table rows — keep a usable viewport cap, not a strict 4-card height. */
  .line-items-editor--saved-list {
    --line-items-scroll-max: min(55vh, 26rem);
  }

  .line-items-editor--saved-list .line-items-table thead th {
    position: static;
    box-shadow: none;
  }

  .line-items-editor--saved-list .line-items-table,
  .line-items-editor--saved-list .line-items-table thead,
  .line-items-editor--saved-list .line-items-table tbody,
  .line-items-editor--saved-list .line-items-table tr,
  .line-items-editor--saved-list .line-items-table td {
    display: block;
  }

  .line-items-editor--saved-list .line-items-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .line-items-editor--saved-list .line-items-table tr {
    width: 100%;
    margin: 0 0 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface, #fff);
  }

  .line-items-editor--saved-list .line-items-table tr:last-child {
    margin-bottom: 0;
  }

  .line-items-editor--saved-list .line-items-table td {
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    width: 100% !important;
    padding: 7px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  }

  .line-items-editor--saved-list .line-items-table input[type="number"] {
    min-width: 0;
  }

  .line-items-editor--saved-list .line-items-table .number-stepper {
    max-width: 9.5rem;
    grid-template-columns: 48px minmax(2rem, 1fr) 48px;
  }

  .line-items-editor--saved-list .line-items-table .number-stepper-button {
    min-width: 48px;
  }

  .line-items-editor--saved-list .line-items-table td:last-child {
    border-bottom: 0;
  }

  .line-items-editor--saved-list .line-items-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .line-items-editor--saved-list .line-items-table td[data-label="Toplam"] {
    text-align: left;
  }

  .line-items-editor--saved-list .line-items-table td[data-label="İşlemler"] {
    display: block;
    padding-top: 10px;
  }

  .line-items-editor--saved-list .line-items-table td[data-label="İşlemler"]::before {
    display: block;
    margin-bottom: 7px;
  }

  .line-items-editor--saved-list .line-item-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
  }

  .line-items-editor--saved-list .line-item-actions .btn {
    width: 100%;
    min-height: 44px;
  }
}

.modal[data-modal-variant="normal"] .modal-body .actions.full {
  display: none;
}

/* Legacy 1-col label/value rows (audit metadata and other non-entity details). */
.detail-list {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 11px 12px;
  border: 1px solid var(--border, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--canvas, #f4f8fc) 70%, #fff);
}

.detail-row span {
  color: var(--text-muted, var(--muted));
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.detail-row strong {
  color: var(--text-primary, var(--ink));
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  line-height: 1.4;
  word-break: break-word;
}

/* Entity view modals: same 2-col rhythm as edit `.form-grid` (stacks at ≤720px). */
.modal[data-modal-variant="normal"] .modal-body .detail-grid {
  margin: 0;
}

.detail-grid .detail-field {
  min-width: 0;
}

.detail-grid .field-label {
  font-weight: 700;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink);
}

.detail-grid .detail-value {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--canvas, #f4f8fc) 70%, #fff);
  color: var(--text-primary, var(--ink));
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-grid .detail-value:has(.detail-chip-list),
.detail-grid .detail-line-items-field > .table-wrap,
.detail-grid .detail-line-items-field > .detail-line-items-total {
  width: 100%;
}

.detail-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--mint, #e1f5ef) 80%, #fff);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.detail-grid .detail-line-items-field {
  gap: 10px;
}

.detail-grid .detail-line-items-total {
  margin: 0;
  font-size: 12px;
}

.detail-grid .detail-line-items-total strong {
  color: var(--ink);
}

.modal-dialog-copy p {
  margin: 0;
  color: var(--text-muted, var(--muted));
  line-height: 1.55;
}

.modal-dialog-copy form {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.modal-alert-body,
.modal-dialog-body {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.modal-alert-icon,
.modal-dialog-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.modal[data-modal-tone="error"] .modal-alert-icon {
  background: color-mix(in srgb, var(--danger, var(--red)) 14%, #fff);
  color: var(--danger, var(--red));
}

.modal[data-modal-tone="warning"] .modal-alert-icon,
.modal[data-modal-tone="warning"] .modal-dialog-icon {
  background: color-mix(in srgb, var(--yellow) 22%, #fff);
  color: #986d1e;
}

.modal[data-modal-tone="info"] .modal-alert-icon,
.modal[data-modal-tone="info"] .modal-dialog-icon {
  background: var(--brand-soft, var(--mint));
  color: var(--brand-primary, var(--brand));
}

.modal-alert-body p,
.modal-dialog-body p {
  margin: 0;
  color: var(--text-muted, var(--muted));
  line-height: 1.55;
}

.modal-alert-body ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted, var(--muted));
}

html.modal-open,
body.modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

/* Hide bottom nav while any modal/sheet is open so .modal-foot stays reachable. */
@media (max-width: 800px) {
  body.modal-open .mobile-nav {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 720px) {
  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }

  .modal-head {
    padding: 16px 16px 14px;
  }

  .modal-body,
  .modal-alert-body,
  .modal-dialog-body {
    padding: 16px;
  }

  .modal-foot {
    flex-wrap: wrap;
    padding: 12px 16px 16px;
  }

  .modal-foot .btn,
  .modal-foot .modal-btn {
    flex: 1 1 calc(50% - 6px);
    min-height: 44px;
  }
}

@media (max-width: 800px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-backdrop { align-items: end; padding: 0; }
  .modal {
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    /* Nav is hidden while modal-open; keep only safe-area clearance for the foot. */
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .modal-head { padding: 16px 16px 14px; }
  .modal-body, .modal-alert-body, .modal-dialog-body { padding: 16px; }
  .modal-foot {
    flex-wrap: wrap;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    position: sticky;
    bottom: 0;
    z-index: 2;
    box-shadow: 0 -8px 18px rgba(24, 50, 77, 0.08);
  }
  .modal-foot .btn, .modal-foot .modal-btn { flex: 1 1 calc(50% - 6px); min-height: 44px; }
  .modal-head .icon-btn, .modal-head [data-modal-close] { width: 44px; height: 44px; min-width: 44px; }
}

/* On-page list filter panels: collapsible on all viewports; remember open/closed in localStorage. */
.filter-panel {
  display: grid;
  gap: 12px;
}

.filter-panel-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--canvas);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}

.filter-panel-toggle:hover,
.filter-panel-toggle:focus-visible {
  border-color: var(--brand-2);
  background: var(--mint);
  color: var(--brand);
  outline: 3px solid rgba(61, 139, 210, .2);
  outline-offset: 2px;
}

.filter-panel-toggle .button-icon,
.filter-panel-toggle .filter-panel-chevron {
  flex: 0 0 auto;
  color: var(--brand);
}

.filter-panel-toggle [data-filter-panel-label] {
  flex: 1 1 auto;
}

.filter-panel-chevron {
  transition: transform .18s ease;
}

.filter-panel.is-open .filter-panel-chevron {
  transform: rotate(180deg);
}

.filter-panel:not(.is-open) .filter-panel-body {
  display: none;
}

/* External toggle (table head Filtreler): hide the whole card when closed to avoid an empty gap. */
.filter-panel.filter-panel--external-toggle:not(.is-open) {
  display: none;
}

/* Mobile bottom sheet: live form moved into openModal (no resting page chrome). */
.filter-panel.filter-panel--in-sheet {
  display: block !important;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.filter-panel.filter-panel--in-sheet .filter-panel-toggle {
  display: none;
}

.filter-panel.filter-panel--in-sheet .filter-panel-body,
.filter-panel.filter-panel--in-sheet.is-open .filter-panel-body {
  display: block !important;
}

.filter-panel-body.shared-table-toolbar {
  margin: 0;
}

/* Filtrele + Sıfırla stay on one row under a field-style label (do not place the
   two buttons as direct `.field` children — `.field` is a column grid). */
.filter-panel-actions-field {
  display: grid;
  gap: 7px;
  align-content: start;
  flex: 0 0 auto;
  min-width: 0;
}

.filter-panel-actions-field > label {
  font-weight: 700;
  font-size: 12px;
}

.filter-panel-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.filter-panel-actions .btn {
  width: auto;
  min-width: 0;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .shared-table-toolbar .filter-panel-actions-field {
    width: 100%;
  }

  .shared-table-toolbar .filter-panel-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .shared-table-toolbar .filter-panel-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Destructive table confirmations stay fully inside the mobile visual viewport. */
@media (max-width: 800px) {
  .modal-backdrop[data-modal-variant="dialog"] {
    align-items: center;
    height: 100dvh;
    max-height: 100dvh;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  }

  .modal-backdrop .modal[data-modal-variant="dialog"] {
    width: min(480px, 100%);
    max-height: 100%;
    height: auto;
    min-height: 0;
    border-radius: 20px;
  }

  .modal[data-modal-variant="dialog"] .modal-dialog-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .modal[data-modal-variant="dialog"] .modal-foot {
    flex: 0 0 auto;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* Customer SATIŞ NOTU picker / results (clientside PDF export) */
.sales-note-picker-item:focus-within,
.sales-note-picker-item:hover {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 2px rgba(45, 155, 127, 0.15);
}
.sales-note-picker-list {
  overscroll-behavior: contain;
}
.sales-note-result-row .btn {
  min-height: 44px;
}
@media (max-width: 800px) {
  .sales-note-picker-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .sales-note-result-row {
    align-items: stretch;
  }
  .sales-note-result-row .btn {
    width: 100%;
  }
}

/* Customer view modal tabbed layout & symmetric styling */
.customer-view-container {
  display: block;
}
.customer-tabs-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.customer-panel-content {
  padding-top: 4px;
}
.customer-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.customer-table-block {
  margin-bottom: 24px;
}
.customer-table-block:last-child {
  margin-bottom: 0;
}
.customer-table-block h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
}
@media (max-width: 800px) {
  .customer-tabs-header {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .customer-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tahsilat form: sipariş/fatura balance preview as a compact bill card */
.payment-balance-bill {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border, var(--line));
  border-radius: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface, #fff) 92%, var(--brand-soft, var(--mint)) 8%), var(--surface, #fff));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 70%, transparent);
}

.payment-balance-bill.is-empty {
  background: color-mix(in srgb, var(--surface, #fff) 96%, var(--border, var(--line)) 4%);
  box-shadow: none;
}

.payment-balance-bill-empty {
  margin: 0;
  color: var(--text-muted, var(--muted));
  font-size: 13px;
  line-height: 1.45;
}

.payment-balance-bill-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border, var(--line));
}

.payment-balance-bill-kicker {
  color: var(--text-muted, var(--muted));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.payment-balance-bill-title {
  color: var(--text, var(--ink));
  font-size: 14px;
  font-weight: 800;
}

.payment-balance-bill-rows {
  margin: 0;
  display: grid;
  gap: 6px;
}

.payment-balance-bill-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
}

.payment-balance-bill-row dt {
  margin: 0;
  color: var(--text-muted, var(--muted));
  font-size: 13px;
  font-weight: 600;
}

.payment-balance-bill-row dd {
  margin: 0;
  color: var(--text, var(--ink));
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.payment-balance-bill-row.is-emphasis {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border, var(--line));
}

.payment-balance-bill-row.is-emphasis dt,
.payment-balance-bill-row.is-emphasis dd {
  color: var(--brand-primary, var(--brand));
  font-size: 14px;
}

.payment-balance-bill-row.is-settled dt,
.payment-balance-bill-row.is-settled dd {
  color: var(--brand-2, var(--brand-secondary, #0f8a5f));
}

.payment-balance-bill-row.is-over dt,
.payment-balance-bill-row.is-over dd {
  color: var(--red, #c62828);
}

/* Tahsilat form: keep Sipariş (+ bill) on the right; stack yöntem/kasa/tarih on the left. */
form.form-grid[data-payment-balance-fields] {
  align-items: start;
}

form.form-grid[data-payment-balance-fields] > .payment-form-guidance {
  grid-column: 1 / -1;
  margin: 0;
}

form.form-grid[data-payment-balance-fields] > .payment-form-columns {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.payment-form-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}

@media (max-width: 800px) {
  form.form-grid[data-payment-balance-fields] > .payment-form-columns {
    grid-template-columns: 1fr;
  }

  .payment-balance-bill {
    padding: 12px;
  }

}
