@import url('https://fonts.googleapis.com/css2?family=Mulish:wght@400;600;700&display=swap');

/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Mulish', sans-serif;
    background: #f4f6fb;
    min-height: 100vh;
}

/* ===== LOGIN PAGE (centered card) ===== */
body:not(.admin-layout) {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* ===== ADMIN LAYOUT (sidebar + main) ===== */
.admin-layout {
    display: flex;
    align-items: stretch;
    padding: 0;
}

/* Sidebar */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.sidebar__logo {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
}

.sidebar__nav {
    flex: 1;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
}
.sidebar__nav .sidebar__link:last-child {
    margin-top: auto;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar__link--active {
    background: rgba(91, 106, 191, 0.15);
    color: #fff;
    border-left-color: #5b6abf;
    font-weight: 600;
}

.sidebar__icon {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar__footer {
    padding: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__link--logout {
    color: rgba(255, 255, 255, 0.5);
}

.sidebar__link--logout:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

/* Main content area */
.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 2rem 2.5rem;
    min-height: 100vh;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.content-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
}

.content-header__actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn--header {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

/* ===== PANELS (white blocks inside main content) ===== */
.panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.panel__title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
}

.panel--form {
    max-width: 500px;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ===== DASHBOARD CARDS ===== */
.dashboard-cards {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.dash-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    padding: 1.5rem 2rem;
    min-width: 200px;
}

.dash-card__value {
    font-size: 2rem;
    font-weight: 700;
    color: #5b6abf;
    margin-bottom: 0.25rem;
}

.dash-card__label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.dash-card__link {
    font-size: 0.85rem;
    color: #5b6abf;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.dash-card__link:hover {
    color: #4a58a8;
}

/* ===== FORM COMPONENTS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group select {
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group select:focus {
    outline: none;
    border-color: #5b6abf;
    box-shadow: 0 0 0 3px rgba(91, 106, 191, 0.15);
}

.form-group textarea {
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: #5b6abf;
    box-shadow: 0 0 0 3px rgba(91, 106, 191, 0.15);
}

.form-group input:focus {
    outline: none;
    border-color: #5b6abf;
    box-shadow: 0 0 0 3px rgba(91, 106, 191, 0.15);
}

.form-group input::placeholder {
    color: #aaa;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group--inline {
    flex: 1;
    min-width: 180px;
    margin-bottom: 0;
}

.form-group--btn {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    margin-bottom: 0;
}

.hint {
    font-size: 0.8rem;
    color: #888;
    font-weight: 400;
}

/* ===== BUTTONS ===== */
.btn {
    width: 100%;
    padding: 0.75rem;
    background: #5b6abf;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn:hover {
    background: #4a58a8;
}

.btn:active {
    transform: scale(0.98);
}

.btn--small {
    width: auto;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
}

.btn--secondary {
    background: #e5e7eb;
    color: #333;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn--secondary:hover {
    background: #d1d5db;
}

/* ===== MESSAGE BLOCKS ===== */
.message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.message--error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.message--success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ===== USERS TABLE ===== */
.table-wrap {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.users-table th,
.users-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.users-table th {
    font-weight: 700;
    color: #555;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.users-table tbody tr:hover {
    background: #f9fafb;
}

.users-table .empty-row {
    text-align: center;
    color: #999;
    padding: 2rem;
}

/* ===== ACTION BUTTONS (table) ===== */
.actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.inline-form {
    display: inline;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.action-btn--edit {
    background: #eef2ff;
    color: #5b6abf;
}

.action-btn--edit:hover {
    background: #5b6abf;
    color: #fff;
}

.action-btn--delete {
    background: #fef2f2;
    color: #dc2626;
    font-weight: 700;
}

.action-btn--delete:hover {
    background: #dc2626;
    color: #fff;
}

/* ===== LOGOUT LINK (login page only) ===== */
.logout-link {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    color: #5b6abf;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.logout-link:hover {
    color: #4a58a8;
}

/* ===== RESPONSIVE — desktop only (1200px–1920px) ===== */
@media (max-width: 1200px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
        padding: 1.5rem;
    }

    .card {
        max-width: 380px;
        padding: 2rem;
    }

    .form-row {
        flex-direction: column;
    }
}

/* ===== EDITOR-SPECIFIC STYLES ===== */

/* Editor area wrapper */
#editor-area {
    margin-bottom: 1.5rem;
}

/* Editor toolbar */
.editor-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-radius: 8px 8px 0 0;
    border: 1px solid #e5e7eb;
    border-bottom: 1px solid #ddd;
}

/* Toolbar rows */
.editor-toolbar__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    align-items: center;
    width: 100%;
}

.editor-toolbar__row:not(:last-child) {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

/* Toolbar buttons */
.editor-toolbar button {
    padding: 0.35rem 0.65rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f9fafb;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    color: #333;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.editor-toolbar button:hover {
    background: #e5e7eb;
    border-color: #bbb;
}

.editor-toolbar button:active {
    background: #d1d5db;
    transform: scale(0.97);
}

/* Active state for layout buttons */
.editor-toolbar__btn--active {
    background: #eef2ff !important;
    border-color: #5b6abf !important;
    color: #5b6abf !important;
    font-weight: 600;
}

/* Editor canvas wrapper */
.editor-canvas-wrapper {
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: #fff;
    overflow-y: auto;
    max-height: 600px;
    padding: 1rem;
}

/* Editor canvas (contenteditable) */
#editor-canvas {
    min-height: 400px;
    padding: 0.5rem;
    outline: none;
}

/* Canvas placeholder when empty */
#editor-canvas:empty::before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
    pointer-events: none;
}

/* File operations bar */
.editor-file-ops {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0;
}

/* Editor notifications */
.editor-notifications {
    margin-top: 0.75rem;
}

.editor-notification {
    position: relative;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
    animation: editorNotifFadeIn 0.2s ease;
}

.editor-notification--success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.editor-notification--warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.editor-notification--error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.editor-notification__dismiss {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    line-height: 1;
    padding: 0;
}

.editor-notification__dismiss:hover {
    opacity: 1;
}

@keyframes editorNotifFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Panel color control */
.panel-color-control {
    display: inline-flex;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 0.375rem;
}

.panel-color-control button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.1s ease;
}

.panel-color-control button:hover {
    transform: scale(1.15);
}

.panel-color-control button.active {
    border-color: #333;
}

.panel-color-control button[data-color="default"] {
    background: #D3DEF5;
}

.panel-color-control button[data-color="violet"] {
    background: #EAD9F8;
}

.panel-color-control button[data-color="orange"] {
    background: #FFEDC1;
}

/* Layout blocks inside editor canvas */
.editor-canvas-wrapper .row {
    display: flex;
    gap: 16px;
}

.editor-canvas-wrapper .row > div {
    flex: 1;
    min-height: 50px;
    border: 1px dashed #ccc;
    padding: 8px;
}

.editor-canvas-wrapper .panel {
    background: #D3DEF5;
    border-radius: 16px;
    padding: 16px;
    min-height: 50px;
}

.editor-canvas-wrapper .panel.violet {
    background: #EAD9F8;
}

.editor-canvas-wrapper .panel.orange {
    background: #FFEDC1;
}

/* ===== EDITOR RESPONSIVE — 1200px–1920px ===== */
@media (min-width: 1200px) {
    .editor-canvas-wrapper {
        max-height: 650px;
    }

    .editor-toolbar {
        gap: 0.5rem;
        padding: 0.625rem 1rem;
    }

    .editor-toolbar__row {
        gap: 0.5rem;
    }
}

@media (min-width: 1600px) {
    .editor-canvas-wrapper {
        max-height: 700px;
    }
}

/* ===== EDITOR SOURCE CODE VIEW ===== */
.editor-source-code {
    width: 100%;
    min-height: 400px;
    max-height: 600px;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    border: none;
    outline: none;
    resize: vertical;
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 0 0 8px 8px;
    tab-size: 4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.editor-toolbar__btn--toggle {
    margin-left: auto;
    font-size: 1.1rem;
    padding: 0.35rem 0.6rem;
    background: #e5e7eb;
    border-color: #bbb;
}

.editor-toolbar__btn--toggle:hover {
    background: #5b6abf;
    color: #fff;
    border-color: #5b6abf;
}

.editor-toolbar__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.editor-toolbar__btn:disabled:hover {
    background: #f9fafb;
    border-color: #ddd;
    transform: none;
}

/* ===== EDITOR TOOLBAR DROPDOWN ===== */
.editor-toolbar__dropdown {
    position: relative;
    display: inline-flex;
}

.editor-toolbar__btn--dropdown {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.editor-toolbar__dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 20;
    min-width: 160px;
    padding: 0.25rem 0;
}

.editor-toolbar__dropdown--open .editor-toolbar__dropdown-menu {
    display: block;
}

.editor-toolbar__dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    font-size: 0.85rem;
    font-family: inherit;
    color: #333;
    cursor: pointer;
    text-align: left;
}

.editor-toolbar__dropdown-item:hover {
    background: #f3f4f6;
}

.editor-color-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}


/* ===== IMAGE PICKER MODAL ===== */

/* Overlay: semi-transparent full-screen backdrop */
.image-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: imagePickerFadeIn 0.2s ease;
}

@keyframes imagePickerFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal dialog: centered white box */
.image-picker-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: 90%;
    max-width: 720px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: imagePickerSlideIn 0.2s ease;
}

@keyframes imagePickerSlideIn {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header: title + close button */
.image-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.image-picker-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.image-picker-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 1.25rem;
    color: #555;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.image-picker-close:hover {
    background: #e5e7eb;
    color: #1a1a2e;
}

/* Body: scrollable content area */
.image-picker-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Upload area */
.image-picker-upload-area {
    margin-bottom: 1rem;
}

/* Message feedback (success/error) */
.image-picker-message {
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    display: none;
}

.image-picker-message--visible {
    display: block;
}

.image-picker-message--success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.image-picker-message--error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Loading indicator */
.image-picker-loading {
    text-align: center;
    padding: 2rem 1rem;
    color: #888;
    font-size: 0.9rem;
    display: none;
}

.image-picker-loading--visible {
    display: block;
}

/* Empty state */
.image-picker-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #999;
    font-size: 0.9rem;
    display: none;
}

.image-picker-empty--visible {
    display: block;
}

/* Thumbnail grid: responsive CSS Grid */
.image-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
}

/* Thumbnail item */
.image-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    background: #fafafa;
}

.image-picker-item:hover {
    border-color: #5b6abf;
    box-shadow: 0 2px 8px rgba(91, 106, 191, 0.15);
    transform: translateY(-2px);
}

.image-picker-item--selected {
    border-color: #5b6abf;
    box-shadow: 0 0 0 3px rgba(91, 106, 191, 0.2);
    background: #f0f2ff;
}

/* Thumbnail image preview */
.image-picker-item img {
    width: 100%;
    height: 90px;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 0.4rem;
    background: #fff;
}

/* Thumbnail filename */
.image-picker-item span {
    font-size: 0.75rem;
    color: #555;
    text-align: center;
    word-break: break-all;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ===== IMAGE PICKER RESPONSIVE ===== */
@media (max-width: 1200px) {
    .image-picker-modal {
        max-width: 600px;
        max-height: 75vh;
    }

    .image-picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.75rem;
    }
}


/* ===== COMMUNICATIONS SECTION ===== */

/* --- Communications Table (extends .users-table pattern) --- */
.comm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.comm-table th,
.comm-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.comm-table th {
    font-weight: 700;
    color: #555;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.comm-table tbody tr:hover {
    background: #f9fafb;
}

.comm-table .empty-row {
    text-align: center;
    color: #999;
    padding: 2rem;
}

.comm-row-clickable {
    cursor: pointer;
}

/* --- Sort Links --- */
.comm-sort-link {
    color: #555;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.2s ease;
}

.comm-sort-link:hover {
    color: #5b6abf;
}

.comm-sort-link::after {
    content: '⇅';
    font-size: 0.75rem;
    opacity: 0.4;
}

.comm-sort-link--active {
    color: #5b6abf;
    font-weight: 700;
}

.comm-sort-link--active::after {
    opacity: 1;
}

.comm-sort-link--active[data-dir="asc"]::after {
    content: '↑';
}

.comm-sort-link--active[data-dir="desc"]::after {
    content: '↓';
}

/* --- Status Indicators --- */
.comm-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
    margin-left: 0.35rem;
}

.comm-indicator--pending {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
}

.comm-indicator--pending::before {
    content: '⏳';
    font-size: 0.75rem;
}

.comm-indicator--warning {
    background: rgba(217, 119, 6, 0.12);
    color: #d97706;
}

.comm-indicator--warning::before {
    content: '⚠';
    font-size: 0.75rem;
}

.comm-indicator--check {
    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;
}

.comm-indicator--check::before {
    content: '✓';
    font-size: 0.8rem;
}

/* --- Form Sections --- */
.comm-form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.comm-form-section__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

/* --- Color Field (color picker + text input pair) --- */
.comm-color-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comm-color-field input[type="color"] {
    width: 40px;
    height: 40px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
}

.comm-color-field input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.comm-color-field input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.comm-color-field input[type="text"] {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comm-color-field input[type="text"]:focus {
    outline: none;
    border-color: #5b6abf;
    box-shadow: 0 0 0 3px rgba(91, 106, 191, 0.15);
}

/* --- Checkbox Group (daysOfWeek, daysOfMonth, channels) --- */
.comm-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.75rem 0;
}

.comm-checkbox-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    user-select: none;
}

.comm-checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #5b6abf;
    cursor: pointer;
}

/* --- Multiselect (regions) --- */
.comm-multiselect {
    width: 100%;
    min-height: 120px;
    max-height: 200px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    overflow-y: auto;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comm-multiselect:focus {
    outline: none;
    border-color: #5b6abf;
    box-shadow: 0 0 0 3px rgba(91, 106, 191, 0.15);
}

.comm-multiselect option {
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
}

.comm-multiselect option:checked {
    background: rgba(91, 106, 191, 0.12);
    color: #5b6abf;
}

/* --- URL List (dynamic URLs for detailsScreen) --- */
.comm-url-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comm-url-list__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comm-url-list__item input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comm-url-list__item input:focus {
    outline: none;
    border-color: #5b6abf;
    box-shadow: 0 0 0 3px rgba(91, 106, 191, 0.15);
}

.comm-url-list__item .action-btn--delete {
    flex-shrink: 0;
}

.comm-url-list__add {
    align-self: flex-start;
    padding: 0.5rem 1rem;
    background: #eef2ff;
    color: #5b6abf;
    border: 1px solid #5b6abf;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.comm-url-list__add:hover {
    background: #5b6abf;
    color: #fff;
}

/* --- Buttons Section (cloudParameters.buttons) --- */
.comm-buttons-section {
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 0.75rem;
}

.comm-buttons-section .form-group {
    margin-bottom: 1rem;
}

.comm-buttons-section .form-group:last-child {
    margin-bottom: 0;
}

.comm-buttons-section fieldset {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.comm-buttons-section fieldset:last-child {
    margin-bottom: 0;
}

.comm-buttons-section legend {
    font-weight: 700;
    font-size: 0.9rem;
    color: #555;
    padding: 0 0.5rem;
}

.comm-buttons-section fieldset[disabled] {
    opacity: 0.6;
}

/* --- Form Actions (top and bottom button blocks) --- */
.comm-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 0;
}

.comm-form-actions .btn {
    width: auto;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
}

.comm-form-actions .btn--danger {
    background: #dc2626;
    color: #fff;
}

.comm-form-actions .btn--danger:hover {
    background: #b91c1c;
}

.comm-form-actions .btn--danger:disabled {
    background: #e5e7eb;
    color: #999;
    cursor: not-allowed;
}

.comm-form-actions .btn--outline {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
}

.comm-form-actions .btn--outline:hover {
    background: #f3f4f6;
    border-color: #bbb;
}

/* --- Inline Validation Errors --- */
.comm-field-error {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: #dc2626;
    font-weight: 500;
    line-height: 1.3;
}

.comm-field-error::before {
    content: '⚠ ';
}

/* --- Utility: Hidden --- */
.hidden {
    display: none;
}

/* --- Compact form-group (not full width) --- */
.form-group--compact {
    max-width: fit-content;
}

.form-group--compact select.field-compact,
.form-group--compact input.field-readonly {
    width: auto;
    min-width: 140px;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    color: #333;
    background: #fff;
}

.form-group--compact input.field-readonly {
    background: #f3f4f6;
    color: #666;
    cursor: not-allowed;
}

/* --- Inline checkbox styled like other fields --- */
.comm-field-inline-checkbox {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
}

.comm-field-inline-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #5b6abf;
    cursor: pointer;
}

/* --- Clear selection button for multiselect --- */
.comm-clear-select {
    margin-top: 0.5rem;
}

/* --- Communications Form Grid Layout --- */
.comm-form-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comm-form-grid__row-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

.comm-form-grid__row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

.comm-form-grid .comm-form-section {
    margin-bottom: 0;
}

/* --- Communications Toggle Switch (Haptic Feedback) --- */
.comm-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.comm-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.comm-toggle__slider {
    display: inline-block;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    position: relative;
    transition: background 0.2s ease;
}

.comm-toggle__slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.comm-toggle input:checked + .comm-toggle__slider {
    background: #5b6abf;
}

.comm-toggle input:checked + .comm-toggle__slider::before {
    transform: translateX(20px);
}

.comm-toggle__label {
    margin-left: 0.75rem;
    font-size: 0.95rem;
    color: #333;
}

/* --- Communications Status Active Color --- */
.comm-status--active {
    color: #16a34a;
    font-weight: 600;
}
