.settings-toolbar-spread {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.settings-form-inline {
  margin-bottom: 0;
  gap: 8px;
}

.settings-toolbar-end {
  justify-content: flex-end;
  gap: 8px;
}

.settings-section-title {
  margin: 0;
}

.settings-tabs {
  display: inline-flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.settings-tab {
  border: none;
  background: transparent;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  color: #475569;
  transition: all 0.15s ease;
}

.settings-tab[aria-selected="true"] {
  background: #0f172a;
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
}

.settings-tab:not([aria-selected="true"]):hover {
  background: rgba(15, 23, 42, 0.08);
}

.settings-tabpanels {
  margin-top: 8px;
}

.settings-tabpanel {
  display: none;
}

.settings-tabpanel[aria-hidden="false"] {
  display: block;
}

.category-tabpanel[aria-hidden="true"] {
  display: none;
}

.category-tabpanel[aria-hidden="false"] {
  display: block;
}

.mail-driver-toggle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.mail-driver-toggle__btn {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.mail-driver-toggle__btn small {
  font-size: 0.8rem;
  opacity: 0.85;
}

.mail-driver-toggle__btn.is-active {
  background: #0f172a;
  color: #fff;
}

.mail-driver-toggle__btn:not(.is-active) {
  background: rgba(148, 163, 184, 0.08);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header__actions > button {
  border: 1px solid rgba(37, 99, 235, 0.6);
  background: var(--accent);
  color: var(--accent-fg);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.12s ease;
}

.page-header__actions > button:hover {
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.page-header__actions > button:active {
  transform: translateY(1px);
}

.settings-form-inline button {
  border: 1px solid rgba(37, 99, 235, 0.6);
  background: var(--accent);
  color: var(--accent-fg);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.card .toolbar button:not(.button),
.card .toolbar button.primary:not(.button) {
  border: 1px solid rgba(37, 99, 235, 0.6);
  background: var(--accent);
  color: var(--accent-fg);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.card .toolbar button.ghost:not(.button) {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.qb-main-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: transparent;
  padding: 0;
  border-radius: 14px;
}

.qb-main-tabs::-webkit-scrollbar {
  display: none;
}

.qb-main-tab {
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  background: #1f2937;
  color: #e5e7eb;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
  position: relative;
  top: 0;
  margin-right: 8px;
}

.qb-main-tab.is-active,
.qb-main-tab[aria-selected="true"] {
  background: rgba(248, 250, 252, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  color: #0f172a;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.12);
  top: 0;
}

.mail-section {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  padding: 20px 24px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mail-template-group {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  padding: 20px 24px;
  background: rgba(248, 250, 252, 0.65);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mail-template {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mail-template label {
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mail-template__tokens {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.mail-template__tokens code {
  background: rgba(148, 163, 184, 0.2);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.mail-section[hidden] {
  display: none !important;
}

.mail-section + .mail-section {
  margin-top: 16px;
}

.mail-section h2 {
  margin: 0;
}

.mail-section p {
  margin: 0;
  color: var(--fg-muted);
}

.branding-wrapper {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.branding-preview {
  width: 160px;
  height: 160px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.7);
  overflow: hidden;
}

.branding-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.branding-preview--background {
  width: 260px;
  height: 160px;
  border-style: solid;
  border-width: 2px;
  border-color: rgba(148, 163, 184, 0.4);
  border-radius: 18px;
  background-color: rgba(15, 23, 42, 0.05);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  transition: box-shadow 0.2s ease;
}

.branding-preview--background[data-has-image="true"] {
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
}

.branding-hint {
  margin: 0;
}

#brandingLogoPlaceholder {
  color: var(--fg-muted);
  text-align: center;
  padding: 0 12px;
  font-size: 0.9rem;
}

.branding-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.branding-actions .button {
  width: max-content;
}

.category-card {
  margin-bottom: 24px;
}

.category-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.category-list li span {
  font-weight: 600;
}

.category-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.category-list li:empty {
  justify-content: flex-start;
}

.quote-sections-board {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  padding: 20px;
  min-height: 200px;
  background: rgba(248, 250, 252, 0.6);
  position: relative;
}

.quote-sections-board[data-loading="true"]::after {
  content: 'Loading sections…';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(2px);
  border-radius: 18px;
  font-weight: 600;
  color: var(--fg-muted);
}

.quote-section-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quote-section-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.quote-section-row__handle {
  width: 48px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}

.quote-section-row__handle-btn {
  width: 40px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.9);
  color: #334155;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.quote-section-row__handle-btn:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.5);
  color: #1d4ed8;
}

.quote-section-row__handle-btn:active {
  transform: translateY(1px);
}

.quote-section-row__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quote-section-row__header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.quote-section-title {
  flex: 1 1 240px;
  padding: 10px 14px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.85);
  font-weight: 700;
}

.quote-section-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.quote-section-row__save-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #16a34a;
}

.quote-section-editor .wysiwyg {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.quote-section-editor .wysiwyg__editor {
  height: 190px;
  min-height: 190px;
  max-height: 190px;
  overflow-y: auto;
  overflow-x: hidden;
  word-break: break-word;
}

.quote-section-editor textarea {
  height: 190px;
  min-height: 190px;
  max-height: 190px;
  resize: none;
  overflow: auto;
  max-width: 100%;
  width: 100%;
}

.quote-sections-empty {
  margin: 24px 0 0;
  text-align: center;
  color: var(--fg-muted);
}

.quote-section-row--fixed {
  background: rgba(248, 250, 252, 0.7);
  border-style: dashed;
}

.quote-section-row__fixed-note {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.permission-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.role-permission-group {
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  padding: 12px;
}

.role-permission-group__title {
  font-weight: 700;
  margin-bottom: 10px;
  color: #0f172a;
}

.role-permission-group__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.role-permission-group__grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(248, 250, 252, 0.9);
  font-weight: 600;
}

.form-message {
  margin: 12px 0;
  font-weight: 600;
  color: #0f172a;
}
