/* =========================================================
   Settings pages (Fields & Forms, Approval Rules, Email
   Templates, Security). Same look as the Audit Trail.
   ========================================================= */

.sp-lead { margin-top: 4px; }
.sp-section { margin: 22px 0 10px; font-size: 1.05rem; font-weight: 650; color: #e6fff1; }
.sp-section:first-of-type { margin-top: 14px; }

.sp-btn {
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.12);
  color: inherit; font: inherit; font-size: 0.9rem; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.sp-btn:hover { background: rgba(255,255,255,0.2); }
.sp-btn.primary { background: #2ecc71; border-color: #2ecc71; color: #0f3d2e; font-weight: 650; }
.sp-btn.primary:hover { background: #3ad97e; }
.sp-btn.danger { border-color: rgba(255,140,140,0.6); color: #ffc9c9; }
.sp-btn.small { height: 28px; padding: 0 10px; font-size: 0.8rem; }
.sp-btn[disabled] { opacity: 0.45; cursor: default; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }

.sp-panel {
  background: rgba(0,0,0,0.16); border: 1px solid rgba(230,255,241,0.12);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 12px;
}
.sp-list { display: flex; flex-direction: column; gap: 8px; }
.sp-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: rgba(0,0,0,0.16); border: 1px solid rgba(230,255,241,0.12); border-radius: 12px;
  padding: 10px 14px; color: inherit; text-decoration: none;
}
a.sp-row:hover { background: rgba(0,0,0,0.24); border-color: rgba(230,255,241,0.25); }
.sp-row-main { min-width: 0; flex: 1 1 260px; }
.sp-row-title { font-weight: 650; }
.sp-row-sub { font-size: 0.82rem; opacity: 0.75; margin-top: 2px; overflow-wrap: anywhere; }
.sp-row-side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.sp-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 9px;
  border-radius: 999px; background: rgba(230,255,241,0.14); white-space: nowrap;
}
.sp-badge.ok { background: #8ff0c0; color: #0f3d2e; }
.sp-badge.warn { background: #ffd28a; color: #3b2a00; }
.sp-badge.bad { background: #ffb3b3; color: #4d0b0b; }
.sp-badge.off { background: rgba(230,255,241,0.1); color: rgba(230,255,241,0.75); }
.sp-badge.info { background: #b9d7ff; color: #0b2a4d; }

/* Status icons carry meaning with text, never colour alone */
.sp-check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid rgba(230,255,241,0.08); }
.sp-check:last-child { border-bottom: 0; }
.sp-check-icon { flex: 0 0 22px; font-size: 1rem; line-height: 1.3; }
.sp-check-title { font-weight: 600; }
.sp-check-detail { font-size: 0.82rem; opacity: 0.75; }

.sp-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.sp-stat { background: rgba(0,0,0,0.16); border: 1px solid rgba(230,255,241,0.12); border-radius: 12px; padding: 10px 12px; color: inherit; text-decoration: none; }
a.sp-stat:hover { border-color: rgba(230,255,241,0.3); }
.sp-stat-label { font-size: 0.78rem; opacity: 0.75; }
.sp-stat-value { font-size: 1.45rem; font-weight: 650; margin-top: 2px; }

.sp-table-wrap { overflow-x: auto; }
.sp-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.sp-table th { text-align: left; font-weight: 600; opacity: 0.8; padding: 7px 8px; border-bottom: 1px solid rgba(230,255,241,0.15); white-space: nowrap; }
.sp-table td { padding: 7px 8px; border-bottom: 1px solid rgba(230,255,241,0.08); vertical-align: top; }
.sp-table td.c, .sp-table th.c { text-align: center; }
.sp-table a { text-decoration: underline; }
.sp-table .sp-btn { text-decoration: none; }

/* Forms */
.sp-form { display: flex; flex-direction: column; gap: 14px; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.sp-field label, .sp-label { display: block; font-size: 0.78rem; font-weight: 600; opacity: 0.85; margin-bottom: 5px; }
.sp-field input[type=text], .sp-field input[type=number], .sp-field input[type=email],
.sp-field input:not([type]), .sp-field select, .sp-field textarea {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.2); color: inherit; font: inherit; font-size: 0.92rem; box-sizing: border-box;
}
.sp-field textarea { min-height: 90px; resize: vertical; }
.sp-field textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; min-height: 240px; }
.sp-field select option { color: #111; }
.sp-field .help { font-size: 0.78rem; opacity: 0.7; margin-top: 4px; }
.sp-field .err, .sp-err { font-size: 0.82rem; color: #ffc9c9; margin-top: 4px; }
.sp-inline { display: flex; align-items: center; gap: 8px; }
.sp-inline input[type=checkbox] { width: 18px; height: 18px; accent-color: #2ecc71; }

.sp-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .sp-two { grid-template-columns: minmax(0, 1fr); } }

.sp-preview { background: #f7faf8; color: #1d2b25; border-radius: 10px; padding: 14px 16px; font-size: 0.88rem; }
.sp-preview .subj { font-weight: 650; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid #d9e4de; }
.sp-preview pre { white-space: pre-wrap; word-break: break-word; margin: 0; font: inherit; }
.sp-preview .form-row { margin-bottom: 12px; }
.sp-preview label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; color: #1d2b25 !important; }
.sp-preview input, .sp-preview select, .sp-preview textarea { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid #b9c9c0; border-radius: 6px; font: inherit; background: #fff; color: #1d2b25; }
.sp-preview input[type=checkbox] { width: auto; }
.sp-preview ul { list-style: none; padding: 0; margin: 0; }
.sp-preview .helptext { display: block; font-size: 0.78rem; color: #5a6e64; margin-top: 3px; }

.sp-vars { font-size: 0.82rem; }
.sp-vars code { background: rgba(0,0,0,0.25); padding: 1px 6px; border-radius: 5px; font-size: 0.8rem; cursor: pointer; }
.sp-vars li { margin-bottom: 6px; }
.sp-vars ul { padding-left: 0; list-style: none; margin: 0; }

.sp-flow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.85rem; }
.sp-flow span.step { background: rgba(230,255,241,0.12); border-radius: 999px; padding: 3px 11px; }
.sp-flow span.arrow { opacity: 0.6; }

.sp-msgs { margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.sp-msg { border-radius: 10px; padding: 9px 12px; font-size: 0.9rem; background: rgba(143,240,192,0.18); border: 1px solid rgba(143,240,192,0.45); }
.sp-msg.error { background: rgba(255,179,179,0.15); border-color: rgba(255,179,179,0.5); }
.sp-msg.warning { background: rgba(255,210,138,0.15); border-color: rgba(255,210,138,0.5); }

/* Tables written with Bootstrap class names (.table ...) get the same look
   as .sp-table; Bootstrap itself isn't loaded. */
.table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.table th { text-align: left; font-weight: 600; opacity: 0.8; padding: 7px 8px; border-bottom: 1px solid rgba(230,255,241,0.15); white-space: nowrap; }
.table td { padding: 7px 8px; border-bottom: 1px solid rgba(230,255,241,0.08); vertical-align: top; }
.table-striped tbody tr:nth-child(odd) td { background: rgba(255,255,255,0.03); }
.table-hover tbody tr:hover td { background: rgba(255,255,255,0.06); }
.table a { text-decoration: underline; }
.table .btn { text-decoration: none; }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.w-auto { width: auto; }
