body {
        margin: 0;
        font-family: "Segoe UI", sans-serif;
        display: flex;
        background: #f1f5f9;
      }

      /* SIDEBAR */
      .sidebar {
        width: 250px;
        background: linear-gradient(180deg, #0f172a 0%, #131c31 100%);
        color: white;
        min-height: 100vh;
        height: 100%;
        padding: 22px 16px;
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
      }

      .sidebar h2 {
        text-align: center;
        margin: 4px 0 26px 0;
        font-size: 16px;
        font-weight: 700;
        letter-spacing: 0.2px;
        color: #f8fafc;
      }

      .sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 4px;
      }

      .sidebar button {
        width: 100%;
        padding: 12px 14px;
        margin: 0;
        border: none;
        background: transparent;
        color: #cbd5e1;
        border-radius: 10px;
        cursor: pointer;
        transition: 0.2s ease;
        text-align: left;
        font-size: 13.5px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 10px;
        letter-spacing: 0.1px;
      }

      .sidebar button:hover {
        background: rgba(148, 163, 184, 0.12);
        color: #ffffff;
        transform: translateX(2px);
      }

      .sidebar button.active {
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
        color: white;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
      }

      .sidebar-divider {
        height: 1px;
        background: rgba(148, 163, 184, 0.15);
        margin: 10px 4px;
      }

      .sidebar button.logout-btn {
        background: rgba(220, 38, 38, 0.12);
        color: #fca5a5;
        margin-top: 6px;
      }
      .sidebar button.logout-btn:hover {
        background: rgba(220, 38, 38, 0.22);
        color: #fecaca;
      }

      /* MAIN */
      .main {
        flex: 1;
        padding: 25px;
      }

      .card {
        background: white;
        padding: 22px;
        margin-bottom: 20px;
        border-radius: 16px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06);
        border: 1px solid #eef2f7;
      }

      .title {
        font-size: 22px;
        font-weight: 800;
        margin-bottom: 15px;
        color: #0f172a;
        letter-spacing: 0.2px;
      }

      /* DASHBOARD */
      .stats {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
      }

      .stat {
        flex: 1;
        padding: 22px 20px;
        border-radius: 16px;
        color: white;
        min-width: 200px;
        position: relative;
        overflow: hidden;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.2px;
        opacity: 0.95;
      }

      .stat:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 26px rgba(0, 0, 0, 0.16);
      }

      .stat b {
        display: block;
        font-size: 28px;
        font-weight: 800;
        margin-top: 8px;
        letter-spacing: 0.3px;
      }

      .stat::after {
        content: "";
        position: absolute;
        top: -30px;
        right: -30px;
        width: 90px;
        height: 90px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
      }

      .blue {
        background: linear-gradient(135deg, #2563eb, #1e40af);
      }
      .green {
        background: linear-gradient(135deg, #16a34a, #166534);
      }
      .orange {
        background: linear-gradient(135deg, #f59e0b, #b45309);
      }

      /* TABLE */
      table {
        width: 100%;
        border-collapse: collapse;
      }

      th,
      td {
        padding: 12px;
        border-bottom: 1px solid #eee;
      }

      th {
        background: #0f172a;
        color: white;
      }

      /* INPUT FIX */
      input {
        width: 100%;
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 10px;
        border: 1px solid #ddd;
        box-sizing: border-box;
      }

      /* BUTTONS */
      .btn {
        padding: 8px 14px;
        border: none;
        border-radius: 8px;
        cursor: pointer;
      }

      .view-btn {
        background: linear-gradient(135deg, #2563eb, #1e40af);
        color: white;
        border: none;
        padding: 8px 14px;
        border-radius: 8px;
        cursor: pointer;
        font-weight: 600;
        transition: 0.2s;
      }

      .view-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
      }

      .on {
        background: #16a34a;
        color: white;
      }
      .off {
        background: #dc2626;
        color: white;
      }

      /* GRID */
      .grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
      }

      /* MODAL */
      .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        display: none;
        justify-content: center;
        align-items: center;
      }

      .modal-box {
        background: white;
        padding: 25px;
        border-radius: 15px;
        width: 90%;
        max-width: 500px;
      }

      .chip {
        background: #e0f2fe;
        padding: 5px 10px;
        border-radius: 20px;
        margin: 3px;
        display: inline-block;
      }

      .btn-big {
        padding: 12px 18px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: bold;
      }

      /* 🔥 LOG TABLE UPGRADE */
      #logs table {
        width: 100%;
        border-collapse: collapse;
        overflow: hidden;
        border-radius: 12px;
      }

      /* HEADER */
      #logs th {
        background: linear-gradient(135deg, #0f172a, #1e293b);
        color: #fff;
        padding: 14px;
        text-align: left;
        font-size: 14px;
        letter-spacing: 0.5px;
      }

      /* ROW */
      #logs td {
        padding: 12px 14px;
        font-size: 14px;
        color: #334155;
      }

      /* ROW SPACING */
      #logs tr {
        transition: 0.2s;
      }

      /* HOVER EFFECT */
      #logs tr:hover {
        background: #f1f5f9;
        transform: scale(1.01);
      }

      /* ALTERNATE ROW */
      #logs tr:nth-child(even) {
        background: #f8fafc;
      }

      /* TYPE BADGES */
      .badge {
        padding: 4px 10px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: bold;
      }

      .badge.broadcast {
        background: #dbeafe;
        color: #1d4ed8;
      }

      .badge.email {
        background: #dcfce7;
        color: #166534;
      }

      .badge.target {
        background: #fef3c7;
        color: #92400e;
      }

      .badge.ban {
        background: #fee2e2;
        color: #991b1b;
      }

      #logs .title {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }

      #logs .title::after {
        content: "Live Logs";
        font-size: 12px;
        color: #64748b;
      }

      .btn {
        padding: 10px 14px;
        border-radius: 8px;
        border: none;
        cursor: pointer;
        font-weight: 600;
        transition: 0.2s;
      }

      .btn:hover {
        transform: scale(1.05);
      }

      /* NORMAL ACTION */
      .btn.action {
        background: linear-gradient(135deg, #3b82f6, #1e40af);
        color: white;
      }

      /* DATABASE CONTROL SUB-TABS (Subjects / Universities / Colleges) */
      .db-subtab-btn {
        background: #e2e8f0;
        color: #334155;
      }

      .db-subtab-btn.active {
        background: linear-gradient(135deg, #3b82f6, #1e40af);
        color: white;
      }

      /* EDIT */
      .btn.edit {
        background: linear-gradient(135deg, #f59e0b, #b45309);
        color: white;
      }

      /* DANGER */
      .btn.danger {
        background: linear-gradient(135deg, #ef4444, #7f1d1d);
        color: white;
      }

      /* CLOSE */
      .btn.close {
        background: #e2e8f0;
      }
      .modal-box {
        background: white;
        padding: 25px;
        border-radius: 15px;

        width: 90%;
        max-width: 550px;

        max-height: 80vh;
        overflow-y: auto;

        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
      }
      .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);

        display: none; /* IMPORTANT */
        justify-content: center;
        align-items: center;
      }
      .input-modern {
        width: 100%;
        padding: 12px;
        border-radius: 10px;
        border: 1px solid #e2e8f0;
        margin-bottom: 12px;
        transition: 0.2s;
      }

      .input-modern:focus {
        border-color: #6366f1;
        outline: none;
        box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
      }

      .modern-card {
        background: linear-gradient(135deg, #eef2ff, #f8fafc);
        border: 1px solid #c7d2fe;
        max-width: 750px;
      }

      .section-title {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 15px;
      }

      .section-title span {
        font-size: 12px;
        color: #64748b;
      }

      .grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        max-width: 700px;
      }

      .preview-box {
        margin-top: 15px;
        margin-bottom: 15px;
        padding: 12px;
        border-radius: 10px;
        background: #ffffff;
        border: 1px dashed #cbd5e1;
        font-size: 14px;
      }

      .modern-btn-blue {
        background: linear-gradient(135deg, #6366f1, #4f46e5);
        color: white;
        width: 100%;
        margin-top: 10px;
      }

      .modern-btn-green {
        background: linear-gradient(135deg, #22c55e, #15803d);
        color: white;
        width: 100%;
      }

      .btn-big:hover {
        transform: scale(1.03);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
      }
      /* ================= EDUCATION COMMUNICATION CENTER ================= */
      .ecc-category-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
        gap: 14px;
        margin-top: 12px;
      }

      .ecc-cat-card {
        background: white;
        border: 2px solid #e2e8f0;
        border-radius: 14px;
        padding: 16px;
        cursor: pointer;
        transition: 0.2s;
      }

      .ecc-cat-card:hover {
        border-color: #a5b4fc;
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
      }

      .ecc-cat-card.active {
        border-color: #6366f1;
        background: linear-gradient(135deg, #eef2ff, #f8fafc);
        box-shadow: 0 6px 16px rgba(99, 102, 241, 0.18);
      }

      .ecc-cat-card .ecc-icon {
        font-size: 26px;
        margin-bottom: 8px;
      }

      .ecc-cat-card .ecc-cat-title {
        font-weight: 700;
        font-size: 14px;
        color: #0f172a;
      }

      .ecc-cat-card .ecc-cat-sub {
        font-size: 12px;
        color: #64748b;
        margin-top: 3px;
      }

      .ecc-cat-card.disabled {
        opacity: 0.55;
        cursor: not-allowed;
      }

      .ecc-chip {
        display: inline-block;
        background: #e0e7ff;
        color: #3730a3;
        font-size: 12px;
        font-weight: 600;
        padding: 4px 10px;
        border-radius: 20px;
        margin: 0 6px 6px 0;
      }

      .ecc-field-label {
        font-size: 13px;
        font-weight: 600;
        margin-bottom: 4px;
        display: block;
      }

      textarea.input-modern {
        max-width: 100%;
        resize: vertical;
      }

      /* 🔥 MODERN TOGGLE */

      .switch {
        position: relative;
        display: inline-block;
        width: 58px;
        height: 30px;
      }

      .switch input {
        opacity: 0;
        width: 0;
        height: 0;
      }

      .slider {
        position: absolute;
        cursor: pointer;

        top: 0;
        left: 0;
        right: 0;
        bottom: 0;

        background-color: #cbd5e1;

        transition: 0.4s;

        border-radius: 34px;
      }

      .slider:before {
        position: absolute;

        content: "";

        height: 22px;
        width: 22px;

        left: 4px;
        bottom: 4px;

        background-color: white;

        transition: 0.4s;

        border-radius: 50%;
      }

      input:checked + .slider {
        background: linear-gradient(135deg, #22c55e, #15803d);
      }

      input:checked + .slider:before {
        transform: translateX(28px);
      }

      .switch:hover {
        transform: scale(1.05);
      }

      /* 🔥 FEATURE MANAGEMENT CENTER */

      .fm-toolbar {
        display: flex;
        gap: 10px;
        align-items: center;
        margin: 18px 0 16px;
        flex-wrap: wrap;
      }

      .fm-toolbar input.input-modern,
      .fm-toolbar select.input-modern {
        margin-bottom: 0;
        width: auto;
        min-width: 220px;
      }

      .fm-cat-heading {
        font-size: 13px;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #6366f1;
        margin: 26px 0 10px;
        padding-bottom: 6px;
        border-bottom: 2px solid #eef2ff;
      }

      .fm-cat-heading:first-of-type {
        margin-top: 6px;
      }

      .fm-feature-row {
        display: flex;
        align-items: center;
        gap: 16px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        padding: 14px 16px;
        margin-bottom: 10px;
        transition: 0.2s;
      }

      .fm-feature-row:hover {
        border-color: #c7d2fe;
        background: #fbfbff;
      }

      .fm-feature-row.disabled {
        opacity: 0.6;
      }

      .fm-feature-row.restricted {
        background: #fffaf0;
        border-color: #fde8c9;
      }

      .fm-restricted-badge {
        font-size: 10.5px;
        font-weight: 700;
        color: #9a3412;
        background: #ffedd5;
        border: 1px solid #fed7aa;
        border-radius: 20px;
        padding: 2px 8px;
      }

      .fm-status-toggle {
        display: flex;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        overflow: hidden;
      }

      .fm-status-toggle button {
        border: none;
        background: #f8fafc;
        color: #64748b;
        font-size: 12.5px;
        font-weight: 700;
        padding: 8px 14px;
        cursor: pointer;
        transition: 0.15s;
      }

      .fm-status-toggle button + button {
        border-left: 1px solid #e2e8f0;
      }

      .fm-status-toggle button.active[data-status="enabled"] {
        background: #16a34a;
        color: white;
      }

      .fm-status-toggle button.active[data-status="restricted"] {
        background: #ea580c;
        color: white;
      }

      .fm-status-toggle button.active[data-status="disabled"] {
        background: #dc2626;
        color: white;
      }

      .fm-feature-icon {
        font-size: 26px;
        width: 44px;
        height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: white;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
      }

      .fm-feature-info {
        flex: 1;
        min-width: 0;
      }

      .fm-feature-name {
        font-weight: 700;
        color: #0f172a;
        font-size: 14.5px;
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
      }

      .fm-feature-desc {
        color: #64748b;
        font-size: 12.5px;
        margin-top: 2px;
      }

      .fm-feature-audience {
        margin-top: 6px;
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
      }

      .fm-feature-actions {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-shrink: 0;
      }

      .fm-core-badge {
        font-size: 10.5px;
        font-weight: 700;
        color: #92400e;
        background: #fef3c7;
        border: 1px solid #fde68a;
        border-radius: 20px;
        padding: 2px 8px;
      }

      .fm-cat-pill {
        font-size: 10.5px;
        font-weight: 700;
        color: #4338ca;
        background: #eef2ff;
        border: 1px solid #c7d2fe;
        border-radius: 20px;
        padding: 2px 8px;
      }

      .fm-history-item {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 12px 14px;
        margin-bottom: 10px;
        background: #f8fafc;
      }

      .fm-history-meta {
        font-size: 12px;
        color: #64748b;
        margin-bottom: 6px;
      }

      .fm-user-result {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 10px;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        margin-bottom: 6px;
        cursor: pointer;
        font-size: 13px;
      }

      .fm-user-result:hover {
        border-color: #6366f1;
        background: #eef2ff;
      }

      .fm-user-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: #eef2ff;
        border: 1px solid #c7d2fe;
        border-radius: 20px;
        padding: 4px 10px;
        font-size: 12px;
        margin: 3px 4px 3px 0;
      }

      .fm-user-chip .x {
        cursor: pointer;
        font-weight: 800;
        color: #6366f1;
      }

      /* 🆕 Multi-select checkbox list (education level / board / class /
         stream / course / department / year / semester / state / district).
         Replaces single <select> pickers so an admin can target several
         values at once (e.g. UG + PG together, or Primary + Secondary +
         Higher Secondary together). */
      .fm-check-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 12px;
      }

      .fm-check-row {
        display: flex;
        align-items: center;
        gap: 7px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 7px 12px;
        font-size: 13px;
        cursor: pointer;
        user-select: none;
        transition: 0.15s;
      }

      .fm-check-row:hover {
        border-color: #a5b4fc;
        background: #eef2ff;
      }

      .fm-check-row input[type="checkbox"] {
        cursor: pointer;
        width: 15px;
        height: 15px;
        accent-color: #6366f1;
      }

      .fm-check-row.has-value {
        border-color: #6366f1;
        background: #eef2ff;
        color: #3730a3;
        font-weight: 600;
      }

      /* 🆕 Whitelist / Blacklist audience-mode toggle */
      .fm-mode-toggle {
        display: flex;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        overflow: hidden;
        margin-top: 10px;
      }

      .fm-mode-toggle button {
        flex: 1;
        border: none;
        background: #f8fafc;
        color: #64748b;
        font-size: 12.5px;
        font-weight: 700;
        padding: 9px 12px;
        cursor: pointer;
        transition: 0.15s;
      }

      .fm-mode-toggle button + button {
        border-left: 1px solid #e2e8f0;
      }

      .fm-mode-toggle button.active[data-mode="whitelist"] {
        background: #16a34a;
        color: white;
      }

      .fm-mode-toggle button.active[data-mode="blacklist"] {
        background: #dc2626;
        color: white;
      }

      /* 🆕 History select + bulk-delete */
      .fm-history-item {
        position: relative;
        padding-left: 40px;
      }

      .fm-history-checkbox {
        position: absolute;
        left: 14px;
        top: 14px;
        width: 16px;
        height: 16px;
        cursor: pointer;
        accent-color: #dc2626;
      }

      .fm-history-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 12px;
        padding-bottom: 10px;
        border-bottom: 1px solid #e2e8f0;
      }

      .fm-history-toolbar label {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 12.5px;
        color: #64748b;
        cursor: pointer;
      }

      /* 🔥 MAINTENANCE CARD */

      .maintenance-card {
        display: flex;
        justify-content: space-between;
        align-items: center;

        padding: 18px;

        border-radius: 18px;

        background: linear-gradient(135deg, #ffffff, #f8fafc);

        border: 1px solid #e2e8f0;

        transition: 0.25s;
      }

      .maintenance-card:hover {
        transform: translateY(-3px);

        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
      }

      .maint-title {
        font-size: 15px;
        font-weight: 700;
        color: #0f172a;
      }

      .maint-sub {
        font-size: 12px;
        color: #64748b;
        margin-top: 4px;
      }

      /* 🔥 TOGGLE */

      .switch {
        position: relative;
        display: inline-block;
        width: 58px;
        height: 30px;
      }

      .switch input {
        opacity: 0;
        width: 0;
        height: 0;
      }

      .slider {
        position: absolute;

        cursor: pointer;

        top: 0;
        left: 0;
        right: 0;
        bottom: 0;

        background: #cbd5e1;

        transition: 0.4s;

        border-radius: 34px;
      }

      .slider:before {
        position: absolute;

        content: "";

        height: 22px;
        width: 22px;

        left: 4px;
        bottom: 4px;

        background: white;

        transition: 0.4s;

        border-radius: 50%;
      }

      input:checked + .slider {
        background: linear-gradient(135deg, #22c55e, #15803d);

        box-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
      }

      input:checked + .slider:before {
        transform: translateX(28px);
      }



      /* SDUI Cards — Broadcast module jaisi styling */
.sdui-module-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.sdui-module-card .sdui-card-title {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sdui-module-card .sdui-card-desc {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 18px;
}
.sdui-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.sdui-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.sdui-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sdui-field-group label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.sdui-helper {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}
.sdui-toggle-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 16px;
}
.sdui-toggle-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #334155;
}
.sdui-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
}
.sdui-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.sdui-status-live { background: #dcfce7; color: #15803d; }
.sdui-status-draft { background: #fef9c3; color: #a16207; }
.sdui-status-disabled { background: #fee2e2; color: #b91c1c; }
.sdui-media-preview {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.sdui-media-preview:hover { border-color: #6366f1; }
.sdui-media-preview img,
.sdui-media-preview video {
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  margin-top: 8px;
}
@media (max-width: 768px) {
  .sdui-grid-2, .sdui-grid-3 { grid-template-columns: 1fr; }
  .sdui-module-card { padding: 16px; }
}

/* ================= SDUI HISTORY MANAGEMENT ================= */
.sdui-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sdui-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
}
.sdui-history-item-main { flex: 1; min-width: 220px; }
.sdui-history-type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 6px;
}
.sdui-history-type-announcement { background: #dbeafe; color: #1d4ed8; }
.sdui-history-type-notice { background: #fef3c7; color: #92400e; }
.sdui-history-type-image_banner { background: #e0e7ff; color: #4338ca; }
.sdui-history-type-video_banner { background: #fce7f3; color: #be185d; }
.sdui-history-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.sdui-history-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}
.sdui-history-status {
  font-weight: 600;
  color: #15803d;
}
.sdui-history-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ================= COMMUNICATION CENTER (Email Templates) ================= */
.tpl-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.tpl-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}
.tpl-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}
.tpl-card-desc {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 14px;
}
.tpl-category-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.tpl-category-Security { background: #fee2e2; color: #991b1b; }
.tpl-category-Account { background: #dbeafe; color: #1d4ed8; }
.tpl-category-Authentication { background: #fef3c7; color: #92400e; }
.tpl-category-General { background: #e2e8f0; color: #334155; }
.tpl-vars {
  font-size: 11px;
  color: #64748b;
  margin: -6px 0 12px 0;
}
.tpl-vars code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 6px;
  color: #4338ca;
  font-size: 11px;
}
.tpl-field-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 5px;
  display: block;
}
.tpl-body-textarea {
  min-height: 160px;
  font-family: "Segoe UI", sans-serif;
}
.tpl-save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.tpl-save-status {
  font-size: 12px;
  color: #16a34a;
  font-weight: 600;
}

/* ---- Rich-text editor toolbar for email Body ---- */
.tpl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 6px 8px;
}
.tpl-tb-btn {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13px;
  cursor: pointer;
  color: #334155;
  line-height: 1;
}
.tpl-tb-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}
.tpl-tb-sep {
  width: 1px;
  align-self: stretch;
  background: #e2e8f0;
  margin: 2px 4px;
}
.tpl-tb-select {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12.5px;
  padding: 5px 6px;
  background: #fff;
  color: #334155;
  cursor: pointer;
}
.tpl-tb-color {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  background: none;
}
.tpl-body-editable {
  min-height: 180px;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0 0 10px 10px;
  padding: 14px 16px;
  font-family: "Segoe UI", sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  color: #1f2937;
  background: #fff;
}
.tpl-body-editable:focus {
  outline: 2px solid #86efac;
  outline-offset: -1px;
}
.tpl-body-editable img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin: 10px 0;
}
.tpl-body-editable video {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin: 10px 0;
  background: #000;
}
.tpl-body-editable:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

/* ---- Insert-position chooser (Top / Cursor / Bottom) for media uploads ---- */
.tpl-pos-popover {
  position: fixed;
  z-index: 10000;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
}
.tpl-pos-title {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 4px 8px 6px 8px;
}
.tpl-pos-popover button {
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 8px;
  border-radius: 7px;
  font-size: 13px;
  color: #1f2937;
  cursor: pointer;
}
.tpl-pos-popover button:hover {
  background: #f1f5f9;
}
.tpl-toolbar-row2 {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 2px 0;
}
.tpl-preview-btn {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.tpl-preview-btn:hover { background: #e0e7ff; }

/* ---- Email preview modal (matches the real branded HTML wrapper) ---- */
.tpl-preview-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.tpl-preview-overlay.open { display: flex; }
.tpl-preview-box {
  background: #f3f4f6;
  border-radius: 16px;
  max-width: 640px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  padding: 28px 12px;
}
.tpl-preview-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  color: #334155;
}

/* ================= ADVANCED USER INFORMATION PANEL ================= */
.user-details-modal-box {
  max-width: 820px !important;
}
.uinfo-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.uinfo-section-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.uinfo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 20px;
}
.uinfo-item-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}
.uinfo-item-value {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}
.uinfo-flag-warning {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
}
.uinfo-flag-ok {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
}
.uinfo-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
}
.uinfo-history-table th {
  background: #0f172a;
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
}
.uinfo-history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
}
.uinfo-history-scroll {
  max-height: 220px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.uinfo-actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* =================================================================
   RICH NOTIFICATION STUDIO — scoped entirely under .rn- so nothing
   here can collide with Broadcast / SDUI / Education Communication
   / Communication Center styling above.
================================================================= */
.rn-subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.rn-subnav-btn {
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: #475569;
}
.rn-subnav-btn.active {
  background: #0f172a;
  color: white;
  border-color: #0f172a;
}
.rn-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 980px) {
  .rn-layout { grid-template-columns: 1fr; }
}
.rn-section-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}
.rn-section-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
}
.rn-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.rn-field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
  margin-top: 8px;
}
.rn-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: #fff;
  border: 1px solid #ddd;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 6px;
}
.rn-tb-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #1f2937;
}
.rn-tb-btn:hover { background: #eef2f7; }
.rn-body-editable {
  min-height: 70px;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 0 0 10px 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  margin-bottom: 12px;
}
.rn-body-editable:empty:before {
  content: attr(data-placeholder);
  color: #9ca3af;
}
.rn-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  color: #64748b;
  font-size: 13px;
}
.rn-dropzone:hover { border-color: #2563eb; color: #2563eb; }
.rn-image-preview {
  max-width: 100%;
  border-radius: 10px;
  margin-top: 10px;
  display: block;
}
.rn-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
}
.rn-remove-btn {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-weight: 700;
}
.rn-add-btn {
  background: #eff6ff;
  color: #2563eb;
  border: 1px dashed #93c5fd;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.rn-chip {
  display: inline-block;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  margin: 0 6px 6px 0;
  font-weight: 600;
}
/* Android notification live preview mockup */
.rn-phone {
  position: sticky;
  top: 16px;
  background: #e2e8f0;
  border-radius: 20px;
  padding: 14px;
}
.rn-notif-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  font-family: Roboto, Arial, sans-serif;
}
.rn-notif-app-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 0 12px;
  font-size: 11px;
  color: #5f6368;
}
.rn-notif-app-icon {
  width: 16px; height: 16px; border-radius: 4px;
  background: linear-gradient(135deg,#2563eb,#1e40af);
  display: inline-block;
}
.rn-notif-body-row { padding: 6px 12px 10px 12px; }
.rn-notif-title { font-size: 14px; font-weight: 700; color: #202124; }
.rn-notif-text { font-size: 13px; color: #3c4043; margin-top: 2px; white-space: pre-wrap; }
.rn-notif-image {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  display: block;
}
.rn-notif-actions {
  display: flex;
  border-top: 1px solid #f1f3f4;
}
.rn-notif-action {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 700;
  color: #1a73e8;
  text-transform: uppercase;
}
.rn-notif-progress-track {
  background: #e0e0e0;
  border-radius: 4px;
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
}
.rn-notif-progress-fill {
  background: #1a73e8;
  height: 100%;
}
.rn-status-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}
.rn-status-draft { background: #f1f5f9; color: #475569; }
.rn-status-scheduled { background: #fef9c3; color: #854d0e; }
.rn-status-sent { background: #dcfce7; color: #166534; }
.rn-status-failed { background: #fee2e2; color: #b91c1c; }
.rn-status-expired { background: #f1f5f9; color: #94a3b8; }
.rn-history-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.rn-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.rn-analytics-stat {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.rn-analytics-stat b { display: block; font-size: 20px; color: #0f172a; }

#dashboardShell {
  display: flex;
  width: 100%;
}


.dashboard-maintenance-freeze {
  filter: blur(8px) grayscale(40%);
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}


.tier-maintenance-overlay {
  display: none; /* toggled to flex via JS */
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.92);
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: auto;
}

.tier-maintenance-box {
  max-width: 560px;
  width: 100%;
  background: #ffffff;
  border-radius: 16px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.tier-maintenance-icon {
  font-size: 44px;
  margin-bottom: 8px;
}

.tier-maintenance-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #dc2626;
  margin-bottom: 6px;
}

.tier-maintenance-subtitle {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 16px;
}

.tier-maintenance-message {
  color: #334155;
  line-height: 1.6;
  margin-bottom: 16px;
  white-space: pre-line;
}

.tier-maintenance-support {
  color: #64748b;
  font-size: 14px;
  margin-bottom: 24px;
}

.tier-maintenance-logout-btn {
  background: linear-gradient(135deg, #dc2626, #991b1b) !important;
  color: #fff !important;
  padding: 12px 32px !important;
  font-size: 15px !important;
  border-radius: 10px !important;
}

/* Infrastructure Settings tab — per-tier toggle cards */
.maintenance-card {
  display: flex;
  margin-bottom: 14px;
}

.maint-title {
  font-weight: 700;
  font-size: 15px;
  color: #0f172a;
}

.maint-sub {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}


/* ---- Page background / default text ---- */
[data-theme="dark"] body {
  background: var(--color-bg);
  color: var(--color-text-primary);
}

[data-theme="dark"] .main {
  color: var(--color-text-primary);
}

/* ---- Card-like surfaces (every "box on the page" shared by all roles) ---- */
[data-theme="dark"] .card,
[data-theme="dark"] .modal-box,
[data-theme="dark"] .modern-card,
[data-theme="dark"] .preview-box,
[data-theme="dark"] .ecc-cat-card,
[data-theme="dark"] .fm-feature-row,
[data-theme="dark"] .fm-feature-icon,
[data-theme="dark"] .fm-history-item,
[data-theme="dark"] .fm-user-result,
[data-theme="dark"] .fm-check-row,
[data-theme="dark"] .fm-history-toolbar,
[data-theme="dark"] .maintenance-card,
[data-theme="dark"] .sdui-module-card,
[data-theme="dark"] .sdui-history-item,
[data-theme="dark"] .sdui-media-preview,
[data-theme="dark"] .tpl-card,
[data-theme="dark"] .tpl-toolbar,
[data-theme="dark"] .tpl-tb-select,
[data-theme="dark"] .tpl-pos-popover,
[data-theme="dark"] .tpl-preview-close,
[data-theme="dark"] .uinfo-section,
[data-theme="dark"] .uinfo-history-scroll,
[data-theme="dark"] .user-details-modal-box,
[data-theme="dark"] .rn-section-card,
[data-theme="dark"] .rn-toolbar,
[data-theme="dark"] .rn-body-editable,
[data-theme="dark"] .rn-dropzone,
[data-theme="dark"] .rn-btn-row,
[data-theme="dark"] .rn-notif-card,
[data-theme="dark"] .rn-history-item,
[data-theme="dark"] .rn-analytics-stat,
[data-theme="dark"] .db-subtab-btn,
[data-theme="dark"] .tier-maintenance-box {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

/* Surfaces that were a step lighter than pure white (#f8fafc) in Light
   mode -- keep that same "step" using --color-surface-alt in Dark mode. */
[data-theme="dark"] .rn-subnav-btn,
[data-theme="dark"] .fm-status-toggle button,
[data-theme="dark"] .fm-mode-toggle button,
[data-theme="dark"] .fm-feature-row:hover {
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

/* ---- Primary heading / value text (was #0f172a / #1e293b) ---- */
[data-theme="dark"] .title,
[data-theme="dark"] .maint-title,
[data-theme="dark"] .fm-feature-name,
[data-theme="dark"] .sdui-history-title,
[data-theme="dark"] .sdui-module-card .sdui-card-title,
[data-theme="dark"] .ecc-cat-card .ecc-cat-title,
[data-theme="dark"] .tpl-card-title,
[data-theme="dark"] .rn-section-title,
[data-theme="dark"] .rn-notif-title,
[data-theme="dark"] .uinfo-section-title,
[data-theme="dark"] .uinfo-item-value,
[data-theme="dark"] .rn-analytics-stat b,
[data-theme="dark"] .tier-maintenance-subtitle,
[data-theme="dark"] .sdui-toggle-row label,
[data-theme="dark"] .tpl-tb-btn,
[data-theme="dark"] .tpl-pos-popover button,
[data-theme="dark"] .rn-tb-btn {
  color: var(--color-text-primary);
}

/* ---- Secondary / muted text (was #64748b / #94a3b8 / #475569) ---- */
[data-theme="dark"] .section-title span,
[data-theme="dark"] .maint-sub,
[data-theme="dark"] .fm-feature-desc,
[data-theme="dark"] .fm-history-meta,
[data-theme="dark"] .fm-history-toolbar label,
[data-theme="dark"] .sdui-module-card .sdui-card-desc,
[data-theme="dark"] .sdui-helper,
[data-theme="dark"] .ecc-cat-card .ecc-cat-sub,
[data-theme="dark"] .tpl-card-desc,
[data-theme="dark"] .tpl-vars,
[data-theme="dark"] .tpl-field-label,
[data-theme="dark"] .rn-field-label,
[data-theme="dark"] .uinfo-item-label,
[data-theme="dark"] .rn-dropzone,
[data-theme="dark"] .tier-maintenance-support,
[data-theme="dark"] .tier-maintenance-message,
[data-theme="dark"] #logs .title::after,
[data-theme="dark"] .fm-cat-heading {
  color: var(--color-text-secondary);
}

/* ---- Tables (used by Users, Logs, Login History, and every other
        role's list views) ---- */
[data-theme="dark"] table,
[data-theme="dark"] #logs table,
[data-theme="dark"] .uinfo-history-table {
  background: var(--color-surface);
}

[data-theme="dark"] th,
[data-theme="dark"] td,
[data-theme="dark"] #logs td,
[data-theme="dark"] .uinfo-history-table td {
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

/* Table headers already use a dark navy background in Light mode by
   design (#0f172a) -- that reads fine on both themes, so only the text
   color is reasserted here for consistency via the token. */
[data-theme="dark"] th,
[data-theme="dark"] #logs th,
[data-theme="dark"] .uinfo-history-table th {
  background: var(--color-surface-alt);
  color: var(--color-text-primary);
}

[data-theme="dark"] #logs tr:hover {
  background: var(--color-surface-alt);
}

[data-theme="dark"] #logs tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

/* ---- Inputs / textareas / selects (every form field in every section) ---- */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .input-modern,
[data-theme="dark"] .tpl-body-textarea,
[data-theme="dark"] .tpl-body-editable,
[data-theme="dark"] .rn-body-editable {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

[data-theme="dark"] .tpl-body-editable:empty:before,
[data-theme="dark"] .rn-body-editable:empty:before {
  color: var(--color-text-secondary);
}

/* ---- Overlays / scrims (modal backdrops, preview overlays, lockout
        screen) -- reuse the same --overlay-scrim token everywhere ---- */
[data-theme="dark"] .modal,
[data-theme="dark"] .tpl-preview-overlay,
[data-theme="dark"] .tier-maintenance-overlay {
  background: var(--overlay-scrim);
}

[data-theme="dark"] .tpl-preview-box {
  background: var(--color-surface-alt);
}

/* ---- Toggle switch "off" track (checked/on state keeps its green
        gradient in both themes -- only the neutral "off" grey needs to
        match the surrounding dark surface) ---- */
[data-theme="dark"] .slider {
  background-color: var(--color-border);
}

/* ---- Divider lines that used very light greys ---- */
[data-theme="dark"] .sdui-toggle-row,
[data-theme="dark"] .sdui-action-row,
[data-theme="dark"] .rn-subnav,
[data-theme="dark"] .fm-history-toolbar {
  border-color: var(--color-border);
}