/* Keep tenant customization separate from finance and operational master data. */
.page[data-panel="backoffice"] > .backoffice-custom-settings {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* Self-contained settings surface; never inherit the backoffice's card spans. */
.page[data-panel="backoffice"] > [data-backoffice-custom-settings] {
  grid-column: 1 / -1 !important;
  width: 100% !important; max-width: 1240px; min-width: 0;
  margin: 0 auto; padding: 0 0 24px; box-sizing: border-box;
  align-items: start; gap: 20px; color: #19283f; font-family: inherit;
}
.page[data-panel="backoffice"] [data-backoffice-custom-settings] > .content-card {
  grid-column: auto !important; width: 100% !important; min-width: 0; max-width: none;
  margin: 0 !important; padding: 24px !important; box-sizing: border-box;
  border: 1px solid #e5e8ed; border-radius: 18px; background: #fff;
  box-shadow: 0 4px 20px rgba(25,40,63,.045);
}
.page[data-panel="backoffice"] [data-backoffice-custom-settings] > :is(.custom-settings-intro,[data-brand-layout-settings],[data-login-layout-settings],[data-backoffice-shared-public-link]) { grid-column: 1 / -1 !important; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .custom-settings-intro {
  display: block !important; margin: 0; padding: 4px 0 4px 16px !important;
  border: 0; border-left: 3px solid #bd8b36; border-radius: 0 !important;
  background: transparent !important; box-shadow: none;
}
.page[data-panel="backoffice"] [data-backoffice-custom-settings] :is(h2,h3) { margin: 0; color: #19283f !important; font-size: 20px; line-height: 1.45; font-weight: 750; letter-spacing: 0; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .custom-settings-intro h2 { font-size: 24px; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] :is(p,.settings-description) { margin: 8px 0 20px; color: #667085; font-size: 14px; line-height: 1.75; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .custom-settings-intro p { margin: 4px 0 0; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .settings-card-heading {
  display: flex !important; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: #19283f;
}
.page[data-panel="backoffice"] [data-backoffice-custom-settings] button:not([data-login-layout-preview-button]) {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: auto; min-width: 0; height: auto; min-height: 42px; padding: 10px 16px;
  box-sizing: border-box; border: 1px solid #dcd3c3; border-radius: 10px;
  background: #fff; box-shadow: none; color: #665130;
  font-family: inherit; font-size: 14px; font-weight: 700; line-height: 1.4;
  text-align: center; white-space: normal; cursor: pointer; transition: border-color .15s,background .15s;
}
.page[data-panel="backoffice"] [data-backoffice-custom-settings] :is(button.settings-primary,[data-brand-layout-settings] button[type="submit"],button[data-public-contact-phone-save],button[data-login-layout-settings-save],button[data-backoffice-shared-link-generate]) { border-color: #a7792b; background: linear-gradient(120deg,#b78837,#92621d); color: #fff; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] button:disabled { opacity: .55; cursor: not-allowed; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] :is(button,a,input,select):focus-visible { outline: 3px solid #d5a44f; outline-offset: 3px; }
@media (hover: hover) {
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] :is(button:not(:disabled):not([data-login-layout-preview-button]),.settings-website-links a):hover { border-color: #ac7929; filter: brightness(.97); }
}
.page[data-panel="backoffice"] [data-backoffice-custom-settings] :is(input:not([type="file"]):not([type="hidden"]),select) {
  width: 100%; min-width: 0; height: 44px; padding: 10px 12px; box-sizing: border-box;
  border: 1px solid #d9dfe7; border-radius: 10px; background-color: #fff; color: #19283f;
  font-family: inherit; font-size: 16px !important; line-height: 1.4; box-shadow: none;
}
.page[data-panel="backoffice"] [data-backoffice-custom-settings] select { padding-right: 30px; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] input[readonly] { background: #f7f8fa; }
.settings-company-list { display: grid; gap: 10px; }
.settings-company-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 14px; border: 1px solid #e5e8ed; border-radius: 12px; background: #fafbfc; }
.settings-company-row > strong { flex: 1 1 100px; min-width: 0; overflow-wrap: anywhere; font-size: 16px; line-height: 1.5; }
.settings-company-actions { display: flex; gap: 8px; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .settings-company-actions button { padding: 8px 12px; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .settings-company-actions [data-sql-repair-master-delete-kind] { border-color: #eeddd9; color: #a45141; background: #fff; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .settings-empty { margin: 0; padding: 24px 16px; border: 1px dashed #d9dfe7; border-radius: 12px; text-align: center; }
.settings-website-links { display: grid !important; grid-template-columns: minmax(0,1fr); gap: 10px; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .settings-website-links a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px; border: 1px solid #e5e8ed; border-radius: 12px; background: #fafbfc;
  color: #19283f; text-decoration: none; font-size: 16px; font-weight: 700;
}
.settings-website-links a::after { content: '→'; color: #a87728; font-size: 20px; }
.settings-website-links small { display: block; margin-top: 4px; color: #667085; font-size: 14px; line-height: 1.5; font-weight: 400; }
.brand-layout-workspace { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); gap: 28px; align-items: start; }
.brand-layout-preview-panel { min-width: 0; padding: 18px; border: 1px solid #e9e4da; border-radius: 14px; background: #faf9f6; }
.brand-layout-preview-panel > span { display: block; color: #8c7552; font-size: 13px; font-weight: 700; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .brand-layout-preview {
  display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 200px;
  padding: 40px; margin: 12px 0; border: 1px solid #e8e4dc; border-radius: 10px; background: #fff;
  overflow: hidden; box-sizing: border-box;
}
.brand-layout-preview .brand-layout-logo { display: grid; place-items: center; width: var(--brand-logoSize,46px); height: var(--brand-logoSize,46px); flex: 0 0 auto; object-fit: contain; font-style: normal; font-weight: 700; color: #987028; }
.brand-layout-preview .brand-layout-text { color: #19283f; font-size: var(--brand-textSize,18px); line-height: 1.4; white-space: nowrap; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .brand-layout-preview-panel p { margin: 0; font-size: 13px; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .brand-layout-controls { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px 12px; }
.brand-layout-workspace form { min-width: 0; margin: 0; padding: 0; }
.brand-logo-upload { display: grid; gap: 12px; padding: 16px 0; margin: 0 0 12px; border-bottom: 1px solid #e5dfd3; }
.brand-logo-upload-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #19283f; font-size: 15px; }
.brand-logo-upload-heading > span { padding: 4px 8px; border-radius: 6px; background: #f0e8d9; color: #80612e; font-size: 12px; white-space: nowrap; }
.brand-logo-upload-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.brand-logo-upload-actions > button { flex: 1 1 120px; }
.brand-logo-filename { min-width: 0; color: #536074; font-size: 13px; overflow-wrap: anywhere; }
.brand-logo-filename:empty { display: none; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] [data-brand-layout-settings] .brand-logo-upload [role="status"] { text-align: left; line-height: 1.6; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] [data-brand-layout-settings] .brand-logo-upload [data-error="true"] { color: #b3382c; }
.brand-logo-upload [hidden] { display: none !important; }
.brand-layout-workspace label { display: grid; gap: 8px; min-width: 0; color: #455267; font-size: 14px; font-weight: 600; line-height: 1.5; }
.brand-layout-direction { margin-top: 18px; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] [data-brand-layout-settings] footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; padding: 18px 0 0; border-top: 1px solid #e5e8ed; background: transparent; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] [data-brand-layout-settings] [role="status"] { flex-basis: 100%; color: #637054; font-size: 14px; text-align: right; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] [role="status"]:empty { display: none; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] [data-public-contact-phone-settings] > .field-grid { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 12px; padding: 0; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] [data-public-contact-phone-settings] :is(label,.form-actions) { display: grid; gap: 8px; margin: 0; padding: 0; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] [data-public-contact-phone-settings] label span { font-size: 14px; color: #455267; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .backoffice-shared-public-link { grid-template-columns: minmax(0,.7fr) minmax(0,1.3fr); }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .backoffice-shared-public-result { grid-template-columns: 1fr 1fr; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .backoffice-shared-public-result input { grid-column: 1 / -1; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .backoffice-shared-public-main > header { flex-wrap: wrap; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .backoffice-shared-public-preview { align-self: start; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .login-layout-settings-heading { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding: 0 0 20px; background: transparent; color: #19283f; border: 0; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .login-layout-settings-heading > div { flex: 1 1 300px; min-width: 0; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .login-layout-settings-heading span { display: block; margin-top: 8px; color: #667085; font-size: 14px; line-height: 1.7; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .login-layout-settings-heading p { margin: 0 0 4px; font-size: 12px; color: #95671d; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .login-layout-device-grid { padding: 0 0 20px; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .login-layout-device-card { grid-template-columns: 44px minmax(0,1fr); }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .login-layout-device-card select { grid-column: 1 / -1; }
.page[data-panel="backoffice"] [data-backoffice-custom-settings] .login-layout-editor { border: 1px solid #e5e8ed; border-radius: 14px; }
@media (min-width: 1100px) {
  .page[data-panel="backoffice"] > [data-backoffice-custom-settings] {
    grid-template-columns: repeat(2,minmax(0,1fr));
    grid-template-areas: "intro intro" "brand brand" "website company" "website phone" "shared shared" "login login";
  }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] > .custom-settings-intro { grid-area: intro !important; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] > [data-brand-layout-settings] { grid-area: brand !important; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] > [data-visitor-website-settings] { grid-area: website !important; align-self: stretch; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] > [data-company-settings] { grid-area: company !important; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] > [data-public-contact-phone-settings] { grid-area: phone !important; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] > [data-backoffice-shared-public-link] { grid-area: shared !important; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] > [data-login-layout-settings] { grid-area: login !important; }
}
@media (max-width: 899px) {
  .page[data-panel="backoffice"] > [data-backoffice-custom-settings] { gap: 16px; padding: 0 12px 24px; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] > .content-card { padding: 18px !important; border-radius: 14px; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] :is(.brand-layout-workspace,.backoffice-shared-public-link) { grid-template-columns: minmax(0,1fr); gap: 20px; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] .brand-layout-preview { min-height: 150px; padding: 28px; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] .brand-layout-controls { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] [data-brand-layout-settings] footer button { flex: 1 1 0; }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] [data-public-contact-phone-settings] > .field-grid { grid-template-columns: minmax(0,1fr); }
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] .login-layout-editor { padding: 16px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .page[data-panel="backoffice"] [data-backoffice-custom-settings] :is(button,a) { transition: none; }
}
.page[data-panel="backoffice"] > .backoffice-custom-settings[hidden] { display: none !important; }
.page[data-panel="backoffice"].custom-settings-active > :not(.backoffice-title-strip):not(.backoffice-settings-tabs):not(.backoffice-custom-settings):not([data-backoffice-repair-master-form]) { display: none !important; }
.backoffice-custom-settings > .content-card { min-width: 0; width: 100%; box-sizing: border-box; margin: 0; }
.backoffice-custom-settings > [hidden] { display: none !important; }
.page[data-panel="backoffice"] > .backoffice-settings-tabs {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
@media (max-width: 899px) {
  .page[data-panel="backoffice"] > .backoffice-settings-tabs > button {
    flex: 0 0 auto !important;
    white-space: nowrap;
  }
}
