.settings-view {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-lg);
  padding: var(--kf-space-lg);
}

.settings-view__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--kf-space-md);
}

.settings-view__heading h3 {
  margin: 0 0 var(--kf-space-xs) 0;
  font-size: 1.5rem;
}

.settings-view__heading p {
  margin: 0;
  color: var(--kf-color-text-muted);
  max-width: 520px;
}

.settings-view__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kf-space-sm);
  align-items: flex-end;
}

.settings-view__action-block {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-xs);
}

.settings-view__action-label {
  font-size: var(--kf-font-size-sm);
  font-weight: 600;
  color: var(--kf-color-text-muted);
}

.settings-view__action-inputs {
  display: flex;
  align-items: center;
  gap: var(--kf-space-sm);
}

.settings-input {
  width: 100%;
  border-radius: var(--kf-radius-sm);
  border: 1px solid rgba(30, 58, 14, 0.12);
  background: var(--kf-color-surface-alt);
  padding: 0.65rem 0.9rem;
  font-size: var(--kf-font-size-base);
  color: var(--kf-color-text);
  transition:
    border-color var(--kf-transition-base),
    box-shadow var(--kf-transition-base),
    background var(--kf-transition-base);
}

.settings-input::placeholder {
  color: var(--kf-color-text-muted);
}

.settings-input:focus {
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
  outline: none;
  background: var(--kf-color-surface);
}

.settings-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.settings-input--number {
  max-width: 120px;
}

.settings-input--textarea {
  min-height: 220px;
  resize: vertical;
}

.settings-input--textarea-small {
  min-height: 110px;
  resize: vertical;
}

/* ===================================
   Tab Bar & Panel Styles
   =================================== */
.settings-tab-bar {
  background: var(--kf-color-surface-alt);
  border: 1px solid rgba(30, 58, 14, 0.1);
  border-radius: var(--kf-radius-md);
}

.settings-panels .mud-expand-panel {
  border: 1px solid rgba(30, 58, 14, 0.1);
  border-radius: var(--kf-radius-md) !important;
  overflow: hidden;
}

.settings-panels .mud-expand-panel-header {
  font-weight: 600;
}

/* ===================================
   Settings Sections (inside panels)
   =================================== */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-sm);
}

.settings-section__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--kf-space-sm);
}

.settings-section__meta-group {
  display: flex;
  align-items: center;
  gap: var(--kf-space-md);
  flex-wrap: wrap;
}

.settings-section__title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--kf-space-sm);
}

.settings-section__meta {
  font-size: var(--kf-font-size-sm);
  color: var(--kf-color-text-muted);
}

/* ===================================
   Azure Settings Groups (Sub-sections)
   =================================== */
.azure-settings-group {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-md);
  padding: var(--kf-space-lg);
  background: rgba(45, 80, 22, 0.03);
  border: 1px solid rgba(45, 80, 22, 0.12);
  border-radius: var(--kf-radius-md);
  margin-top: var(--kf-space-md);
}

.azure-settings-group__title {
  margin: 0 0 var(--kf-space-xs) 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--kf-color-primary);
  display: flex;
  align-items: center;
  gap: var(--kf-space-sm);
}

.azure-settings-group__title i {
  font-size: 1.1em;
}

.azure-settings-group__description {
  margin: 0 0 var(--kf-space-md) 0;
  font-size: var(--kf-font-size-sm);
  color: var(--kf-color-text-muted);
  line-height: 1.5;
}

/* Settings Field Row (2-column layout) */
.settings-field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--kf-space-lg);
}

@media (max-width: 768px) {
  .settings-field-row {
    grid-template-columns: 1fr;
  }
}

/* ===================================
   Settings Grid (IMAP/SMTP Cards)
   =================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--kf-space-lg);
  margin-top: var(--kf-space-sm);
}

.settings-grid .settings-section {
  background: var(--kf-color-surface);
  border: 1px solid rgba(30, 58, 14, 0.12);
  border-radius: var(--kf-radius-md);
  padding: var(--kf-space-lg);
  transition:
    border-color var(--kf-transition-base),
    box-shadow var(--kf-transition-base);
}

.settings-grid .settings-section:hover {
  border-color: rgba(45, 80, 22, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.settings-grid .settings-section__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--kf-color-primary);
  margin-bottom: var(--kf-space-md);
  padding-bottom: var(--kf-space-sm);
  border-bottom: 1px solid rgba(30, 58, 14, 0.08);
}

.settings-grid .settings-section__title i {
  margin-right: var(--kf-space-xs);
  opacity: 0.8;
}

.settings-grid .settings-field {
  margin-bottom: var(--kf-space-md);
}

.settings-grid .settings-field:last-child {
  margin-bottom: 0;
}

.settings-grid .settings-field__label {
  display: block;
  font-size: var(--kf-font-size-sm);
  font-weight: 600;
  color: var(--kf-color-text);
  margin-bottom: var(--kf-space-xs);
}

.settings-grid .settings-field__input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid rgba(30, 58, 14, 0.15);
  border-radius: var(--kf-radius-sm);
  font-size: var(--kf-font-size-base);
  background: var(--kf-color-surface-alt);
  color: var(--kf-color-text);
  transition:
    border-color var(--kf-transition-base),
    box-shadow var(--kf-transition-base);
}

.settings-grid .settings-field__input:focus {
  border-color: rgba(45, 80, 22, 0.5);
  box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.12);
  outline: none;
  background: var(--kf-color-surface);
}

.settings-grid .settings-field__input::placeholder {
  color: var(--kf-color-text-muted);
}

.settings-grid .settings-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--kf-space-md);
}

@media (max-width: 480px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid .settings-field-row {
    grid-template-columns: 1fr;
  }
}

/* Markdown Preview */
.markdown-preview {
  padding: var(--kf-space-lg);
  background: var(--kf-color-surface-alt);
  border: 1px solid rgba(30, 58, 14, 0.12);
  border-radius: var(--kf-radius-sm);
  min-height: 220px;
  font-size: var(--kf-font-size-base);
  line-height: 1.7;
  color: var(--kf-color-text);
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
  margin: 1.5em 0 0.75em 0;
  font-family: var(--kf-font-family-heading);
  font-weight: 600;
  color: var(--kf-color-text);
  line-height: 1.3;
}

.markdown-preview h1:first-child,
.markdown-preview h2:first-child,
.markdown-preview h3:first-child,
.markdown-preview h4:first-child,
.markdown-preview h5:first-child,
.markdown-preview h6:first-child {
  margin-top: 0;
}

.markdown-preview h1 {
  font-size: 1.8rem;
  border-bottom: 2px solid rgba(30, 58, 14, 0.1);
  padding-bottom: 0.3em;
}
.markdown-preview h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid rgba(30, 58, 14, 0.08);
  padding-bottom: 0.25em;
}
.markdown-preview h3 {
  font-size: 1.3rem;
}
.markdown-preview h4 {
  font-size: 1.15rem;
}
.markdown-preview h5 {
  font-size: 1rem;
}
.markdown-preview h6 {
  font-size: 0.95rem;
  color: var(--kf-color-text-muted);
}

.markdown-preview p {
  margin: 0.75em 0;
}

.markdown-preview ul,
.markdown-preview ol {
  margin: 0.75em 0;
  padding-left: 2em;
}

.markdown-preview li {
  margin: 0.35em 0;
}

.markdown-preview code {
  padding: 0.15em 0.4em;
  background: rgba(45, 80, 22, 0.1);
  border-radius: 3px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9em;
  color: var(--kf-color-primary);
}

.markdown-preview pre {
  padding: var(--kf-space-md);
  background: rgba(30, 58, 14, 0.05);
  border: 1px solid rgba(30, 58, 14, 0.1);
  border-radius: var(--kf-radius-sm);
  overflow-x: auto;
  margin: 1em 0;
}

/* Email Signature Preview */
.email-signature-preview {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: var(--kf-radius-sm);
  padding: var(--kf-space-md);
}

.email-signature-preview__label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: var(--kf-space-sm);
  padding-bottom: var(--kf-space-sm);
  border-bottom: 1px solid #e5e7eb;
}

.email-signature-preview__label i {
  color: var(--kf-color-primary);
}

.email-signature-preview__content {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #1f2937;
  padding: var(--kf-space-sm);
  background: #f9fafb;
  border-radius: 4px;
  min-height: 80px;
}

.email-signature-preview__content em {
  color: #9ca3af;
  font-style: italic;
}

/* Email Preview */
.email-preview-container {
  margin: var(--kf-space-md) 0;
}

.email-preview {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: var(--kf-radius-md);
  overflow: hidden;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.email-preview__header {
  background: #f9fafb;
  padding: var(--kf-space-md);
  border-bottom: 1px solid #e5e7eb;
}

.email-preview__field {
  display: flex;
  gap: 0.5rem;
  padding: 0.375rem 0;
  font-size: 0.875rem;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

.email-preview__field strong {
  color: #6b7280;
  font-weight: 600;
  min-width: 60px;
}

.email-preview__body {
  padding: var(--kf-space-lg);
  background: #ffffff;
}

.email-preview__content {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #1f2937;
}

.email-preview__content p {
  margin: 0 0 1rem 0;
}

.email-preview__content p:last-child {
  margin-bottom: 0;
}

.email-preview__content strong {
  color: var(--kf-color-primary);
  font-weight: 600;
}

.email-preview__signature {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #374151;
}

.email-preview__signature-placeholder {
  margin-top: 1.5rem;
  padding: var(--kf-space-md);
  background: #fef3c7;
  border: 1px dashed #f59e0b;
  border-radius: var(--kf-radius-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: #92400e;
}

.email-preview__signature-placeholder i {
  color: #f59e0b;
  font-size: 1.125rem;
}

/* Iframe Previews */
.signature-preview-iframe {
  width: 100%;
  min-height: 250px;
  max-height: 400px;
  height: auto;
  border: none;
  display: block;
}

.email-preview-iframe {
  width: 100%;
  min-height: 650px;
  max-height: 800px;
  height: auto;
  border: none;
  display: block;
}

.email-preview__signature-placeholder em {
  font-style: italic;
  color: #92400e;
}

.markdown-preview pre code {
  padding: 0;
  background: none;
  color: var(--kf-color-text);
}

.markdown-preview blockquote {
  margin: 1em 0;
  padding: 0.5em 1em;
  border-left: 4px solid var(--kf-color-primary);
  background: rgba(45, 80, 22, 0.05);
  color: var(--kf-color-text-muted);
  font-style: italic;
}

.markdown-preview strong {
  font-weight: 600;
  color: var(--kf-color-text);
}

.markdown-preview em {
  font-style: italic;
}

.markdown-preview hr {
  margin: 1.5em 0;
  border: none;
  border-top: 1px solid rgba(30, 58, 14, 0.15);
}

.markdown-preview a {
  color: var(--kf-color-primary);
  text-decoration: underline;
  transition: color var(--kf-transition-base);
}

.markdown-preview a:hover {
  color: var(--kf-color-accent);
}

.markdown-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.markdown-preview th,
.markdown-preview td {
  padding: 0.5em;
  border: 1px solid rgba(30, 58, 14, 0.15);
  text-align: left;
}

.markdown-preview th {
  background: rgba(45, 80, 22, 0.1);
  font-weight: 600;
}

.markdown-preview tr:nth-child(even) {
  background: rgba(30, 58, 14, 0.02);
}

.settings-field__label {
  font-weight: 600;
}

.settings-field__help {
  margin: 0;
  font-size: var(--kf-font-size-sm);
  color: var(--kf-color-text-muted);
  line-height: 1.6;
}

/* Field validation states */
.settings-grid .settings-field__input--error {
  border-color: var(--mud-palette-error, #f44336);
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.15);
}

.settings-grid .settings-field__input--error:focus {
  border-color: var(--mud-palette-error, #f44336);
  box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.2);
}

.settings-grid .settings-field__input--valid {
  border-color: var(--mud-palette-success, #4caf50);
}

.settings-field__error {
  display: block;
  font-size: var(--kf-font-size-xs, 0.75rem);
  color: var(--mud-palette-error, #f44336);
  margin-top: var(--kf-space-xs, 0.25rem);
  line-height: 1.4;
}

/* Security Section Info Boxes */
.passkey-info,
.password-change-info {
  padding: var(--kf-space-md);
  background: rgba(212, 175, 55, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: var(--kf-radius-md);
  margin-top: var(--kf-space-sm);
}

.passkey-info .settings-field__help,
.password-change-info .settings-field__help {
  margin: 0;
  color: var(--kf-color-text);
}

.settings-custom-fields {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-sm);
}

.settings-custom-field {
  display: flex;
  gap: var(--kf-space-sm);
  align-items: stretch;
}

.settings-custom-field__inputs {
  flex: 1;
  display: grid;
  gap: var(--kf-space-sm);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-add-field {
  align-self: flex-start;
}

.settings-empty-state {
  width: 100%;
}

.settings-progress {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-xs);
}

.settings-progress__track {
  height: 6px;
  background: rgba(212, 175, 55, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.settings-progress__fill {
  height: 100%;
  background: var(--kf-color-accent);
  border-radius: inherit;
  transition: width var(--kf-transition-base);
}

.settings-progress__meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--kf-font-size-sm);
  color: var(--kf-color-text-muted);
}

.settings-section__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kf-space-sm);
  margin-top: var(--kf-space-sm);
}

.settings-section--dev {
  padding: var(--kf-space-lg);
  border-radius: var(--kf-radius-md);
  box-shadow: var(--kf-shadow-sm);
}

@media (max-width: 992px) {
  .settings-custom-field__inputs {
    grid-template-columns: 1fr;
  }

  .settings-view__heading p {
    max-width: none;
  }
}

@media (max-width: 768px) {
  .settings-view {
    padding: var(--kf-space-md);
  }

  .settings-view__actions {
    align-items: stretch;
  }

  .settings-view__action-inputs {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-view__action-block {
    width: 100%;
  }

  .settings-add-field {
    width: 100%;
  }

  .settings-section__header {
    align-items: flex-start;
  }

  .settings-section__actions {
    width: 100%;
  }

  .settings-section__actions .btn-kf-outline {
    flex: 1;
    justify-content: center;
  }
}

/* Email Import Settings Section */
.settings-email-import {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-lg);
  padding: var(--kf-space-md);
  background: var(--kf-color-surface-alt);
  border-radius: var(--kf-radius-md);
  border: 1px solid rgba(30, 58, 14, 0.08);
}

.settings-email-import__info {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-xs);
}

.settings-email-import__timestamp {
  font-size: var(--kf-font-size-lg);
  font-weight: 600;
  color: var(--kf-color-text);
  margin: 0;
  font-family: "Courier New", monospace;
}

.settings-email-import__timestamp.text-muted {
  font-weight: 400;
  font-style: italic;
  color: var(--kf-color-text-muted);
}

.settings-email-import__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kf-space-sm);
  align-items: center;
}

@media (max-width: 768px) {
  .settings-email-import__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-email-import__actions .btn-kf-outline {
    width: 100%;
    justify-content: center;
  }
}

/* Admin Danger Zone Section */
.settings-section--danger {
  padding: var(--kf-space-xl);
  border: 2px solid var(--kf-color-danger);
  border-radius: var(--kf-radius-lg);
  background: linear-gradient(
    135deg,
    rgba(207, 75, 71, 0.06) 0%,
    rgba(207, 75, 71, 0.02) 100%
  );
  box-shadow: 0 4px 16px rgba(207, 75, 71, 0.15);
}

.settings-danger-zone {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-lg);
  margin-top: var(--kf-space-md);
}

.settings-danger-zone__item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--kf-space-lg);
  padding: var(--kf-space-xl);
  background: var(--kf-color-surface);
  border-radius: var(--kf-radius-md);
  border: 2px solid rgba(207, 75, 71, 0.2);
  transition: all var(--kf-transition-base);
}

.settings-danger-zone__item:hover {
  border-color: rgba(207, 75, 71, 0.4);
  box-shadow: 0 4px 12px rgba(207, 75, 71, 0.15);
  transform: translateY(-2px);
}

.settings-danger-zone__info {
  flex: 1;
  min-width: 280px;
}

.settings-danger-zone__title {
  margin: 0 0 var(--kf-space-sm) 0;
  font-family: var(--kf-font-family-heading);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--kf-color-danger);
  display: flex;
  align-items: center;
  gap: var(--kf-space-sm);
}

.settings-danger-zone__title i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(
    135deg,
    rgba(207, 75, 71, 0.15) 0%,
    rgba(207, 75, 71, 0.08) 100%
  );
  border-radius: var(--kf-radius-sm);
  flex-shrink: 0;
}

.settings-danger-zone__description {
  margin: 0;
  color: var(--kf-color-text-muted);
  font-size: var(--kf-font-size-sm);
  line-height: 1.6;
}

.settings-danger-zone__description strong {
  color: var(--kf-color-text);
  font-weight: 600;
}

/* Delete Data Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: var(--kf-space-md);
  backdrop-filter: blur(4px);
}

.kf-modal {
  background: var(--kf-color-surface);
  border-radius: var(--kf-radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.kf-modal--danger {
  border: 3px solid #dc3545;
}

.kf-modal__header {
  padding: var(--kf-space-lg);
  border-bottom: 1px solid rgba(30, 58, 14, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(220, 53, 69, 0.1);
}

.kf-modal__title {
  margin: 0;
  font-size: var(--kf-font-size-xl);
  font-weight: 700;
  color: #dc3545;
  display: flex;
  align-items: center;
  gap: var(--kf-space-sm);
}

.kf-modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--kf-color-text-muted);
  cursor: pointer;
  padding: var(--kf-space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--kf-radius-sm);
  transition:
    background var(--kf-transition-base),
    color var(--kf-transition-base);
}

.kf-modal__close:hover {
  background: rgba(30, 58, 14, 0.1);
  color: var(--kf-color-text);
}

.kf-modal__body {
  padding: var(--kf-space-lg);
  flex: 1;
  overflow-y: auto;
}

.kf-modal__footer {
  padding: var(--kf-space-lg);
  border-top: 1px solid rgba(30, 58, 14, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: var(--kf-space-sm);
}

.delete-warning-list h5 {
  margin: var(--kf-space-md) 0 var(--kf-space-sm) 0;
  font-size: var(--kf-font-size-base);
  font-weight: 600;
  color: var(--kf-color-text);
}

.delete-warning-list ul {
  margin: 0;
  padding-left: var(--kf-space-lg);
  list-style: none;
}

.delete-warning-list li {
  margin: var(--kf-space-xs) 0;
  display: flex;
  align-items: center;
  gap: var(--kf-space-sm);
  font-size: var(--kf-font-size-sm);
}

.delete-warning-list li i {
  font-size: var(--kf-font-size-base);
}

.delete-confirmation-input {
  margin-top: var(--kf-space-md);
}

.delete-confirmation-input label {
  display: block;
  margin-bottom: var(--kf-space-sm);
  font-weight: 600;
}

.btn-kf-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--kf-space-sm);
  padding: var(--kf-space-md) var(--kf-space-xl);
  border-radius: var(--kf-radius-sm);
  font-weight: 600;
  font-size: var(--kf-font-size-base);
  background: linear-gradient(
    135deg,
    var(--kf-color-danger) 0%,
    color-mix(in srgb, var(--kf-color-danger) 90%, black 10%) 100%
  );
  color: white;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--kf-transition-base);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(207, 75, 71, 0.25);
}

.btn-kf-danger:hover:not(:disabled) {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--kf-color-danger) 85%, black 15%) 0%,
    color-mix(in srgb, var(--kf-color-danger) 80%, black 20%) 100%
  );
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(207, 75, 71, 0.35);
}

.btn-kf-danger:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(207, 75, 71, 0.25);
}

.btn-kf-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.text-danger {
  color: #dc3545;
}

.text-success {
  color: #28a745;
}

@media (max-width: 768px) {
  .settings-section--danger {
    padding: var(--kf-space-lg);
  }

  .settings-danger-zone {
    gap: var(--kf-space-md);
  }

  .settings-danger-zone__item {
    flex-direction: column;
    align-items: stretch;
    padding: var(--kf-space-md);
    gap: var(--kf-space-md);
  }

  .settings-danger-zone__info {
    min-width: unset;
  }

  .settings-danger-zone__title {
    font-size: 1rem;
  }

  .btn-kf-danger {
    width: 100%;
    justify-content: center;
  }

  .kf-modal {
    max-width: 95%;
    margin: var(--kf-space-sm);
  }

  .kf-modal__footer {
    flex-direction: column;
  }

  .kf-modal__footer button {
    width: 100%;
    justify-content: center;
  }
}

/* URL Content Fetching Styles */
.url-fetch-controls {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-xs);
  margin-top: var(--kf-space-sm);
  padding: var(--kf-space-sm);
  background: rgba(212, 175, 55, 0.05);
  border-radius: var(--kf-radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.2);
}

.url-fetch-info {
  display: flex;
  align-items: center;
  gap: var(--kf-space-xs);
  font-size: var(--kf-font-size-sm);
  color: var(--kf-color-text-muted);
}

.url-fetch-info i {
  color: #d4af37;
}

.fetch-timestamp {
  font-size: var(--kf-font-size-xs);
  color: var(--kf-color-text-muted);
}

.fetch-error {
  color: #dc3545;
  font-weight: 600;
}

.fetch-success {
  color: #28a745;
  font-weight: 600;
  animation: fadeIn 0.3s ease-in;
}

.fetch-success i {
  color: #28a745;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.url-fetch-actions {
  display: flex;
  gap: var(--kf-space-xs);
  flex-wrap: wrap;
}

.btn-kf-sm {
  display: inline-flex;
  align-items: center;
  gap: var(--kf-space-xs);
  padding: 0.4rem 0.75rem;
  border-radius: var(--kf-radius-sm);
  font-weight: 500;
  font-size: var(--kf-font-size-sm);
  background: #d4af37;
  color: white;
  border: none;
  cursor: pointer;
  transition:
    background var(--kf-transition-base),
    transform var(--kf-transition-base);
  white-space: nowrap;
}

.btn-kf-sm:hover:not(:disabled) {
  background: #4257db;
  transform: translateY(-1px);
}

.btn-kf-sm:active:not(:disabled) {
  transform: translateY(0);
}

.btn-kf-sm:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-kf-sm.btn-kf-outline {
  background: transparent;
  color: #d4af37;
  border: 1px solid #d4af37;
}

.btn-kf-sm.btn-kf-outline:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.1);
  border-color: #4257db;
  color: #4257db;
}

.fetched-content {
  margin-top: var(--kf-space-sm);
  border: 1px solid rgba(30, 58, 14, 0.15);
  border-radius: var(--kf-radius-md);
  overflow: hidden;
  background: var(--kf-color-surface);
}

.fetched-content__header {
  padding: var(--kf-space-sm) var(--kf-space-md);
  background: rgba(212, 175, 55, 0.08);
  border-bottom: 1px solid rgba(30, 58, 14, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--kf-space-sm);
}

.fetched-content__title {
  display: flex;
  align-items: center;
  gap: var(--kf-space-xs);
  font-size: var(--kf-font-size-sm);
  font-weight: 600;
  color: var(--kf-color-text);
}

.fetched-content__title i {
  color: #d4af37;
}

.fetched-content__hint {
  display: flex;
  align-items: center;
  gap: var(--kf-space-xs);
  font-size: var(--kf-font-size-xs);
  color: var(--kf-color-text-muted);
  font-style: italic;
}

.fetched-content__hint i {
  color: #d4af37;
  opacity: 0.7;
}

.fetched-content__editor {
  width: 100%;
  padding: var(--kf-space-md);
  border: none;
  font-size: var(--kf-font-size-sm);
  line-height: 1.6;
  color: var(--kf-color-text);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: "Courier New", monospace;
  background: var(--kf-color-surface-alt);
  resize: vertical;
  min-height: 200px;
  outline: none;
}

.fetched-content__editor:focus {
  background: var(--kf-color-surface);
  box-shadow: inset 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.fetched-content__body {
  padding: var(--kf-space-md);
  max-height: 300px;
  overflow-y: auto;
  font-size: var(--kf-font-size-sm);
  line-height: 1.6;
  color: var(--kf-color-text);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: "Courier New", monospace;
  background: var(--kf-color-surface-alt);
}

.fetch-error-message {
  display: flex;
  align-items: flex-start;
  gap: var(--kf-space-xs);
  margin-top: var(--kf-space-sm);
  padding: var(--kf-space-sm);
  background: rgba(220, 53, 69, 0.05);
  border: 1px solid rgba(220, 53, 69, 0.2);
  border-radius: var(--kf-radius-sm);
  font-size: var(--kf-font-size-sm);
  color: #dc3545;
}

.fetch-error-message i {
  flex-shrink: 0;
  margin-top: 2px;
}

@media (max-width: 768px) {
  .url-fetch-actions {
    flex-direction: column;
  }

  .url-fetch-actions button {
    width: 100%;
    justify-content: center;
  }

  .fetched-content__body {
    max-height: 200px;
  }
}

/* ============================================================
   TEMPLATE EDITOR GRID (Optimized Template Management)
   ============================================================ */

.template-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--kf-space-md);
  margin-top: var(--kf-space-md);
}

.template-editor {
  display: flex;
  flex-direction: column;
  gap: var(--kf-space-xs);
  padding: var(--kf-space-md);
  background: var(--kf-color-surface-secondary);
  border: 1px solid var(--kf-color-border);
  border-radius: var(--kf-radius-md);
  transition: all 0.2s ease;
}

.template-editor:hover {
  border-color: var(--kf-color-primary-light);
  box-shadow: 0 2px 8px rgba(45, 80, 22, 0.08);
}

.template-editor--full-width {
  grid-column: 1 / -1;
}

.template-editor__label {
  display: flex;
  align-items: center;
  gap: var(--kf-space-xs);
  font-weight: 600;
  font-size: var(--kf-font-size-base);
  color: var(--kf-color-text-primary);
  margin-bottom: var(--kf-space-xs);
}

.template-editor__label i {
  font-size: 1.1em;
}

.template-editor__hint {
  font-size: var(--kf-font-size-sm);
  color: var(--kf-color-text-muted);
  font-style: italic;
  margin-top: var(--kf-space-xs);
}

.template-editor textarea {
  resize: vertical;
  min-height: 120px;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.9em;
  line-height: 1.6;
}

@media (max-width: 1024px) {
  .template-editor-grid {
    grid-template-columns: 1fr;
  }

  .template-editor--full-width {
    grid-column: 1;
  }
}

@media (max-width: 768px) {
  .template-editor {
    padding: var(--kf-space-sm);
  }

  .template-editor textarea {
    font-size: 0.85em;
  }
}
