.entities-module {
    /* module-level spacing or background */
}

.entities-module .module-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.entities-module .module-menu button {
    margin-left: 6px;
}

.entities-module .entities-table {
    width: 100%;
    border-collapse: collapse;
}

.entities-module .entities-table th,
.entities-module .entities-table td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
}

.entities-module .entities-table th {
    background: #e2e8f0;
}

.entities-module .entities-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.entities-module .entities-modal {
    background: #fff;
    width: 520px;
    border-radius: 6px;
    padding: 15px;
}

.entities-module .entities-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.entities-module .entities-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 15px;
}

.entities-module .entities-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.entities-module .entities-form-section h4 {
    margin: 0 0 10px;
    font-size: 1rem;
    color: #1f2933;
}

.entities-module .entities-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.entities-module .entities-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #344053;
}

.entities-module .entities-form-field input {
    padding: 8px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.entities-module .entities-form-field input:focus {
    outline: none;
    border-color: #4c8bf5;
    box-shadow: 0 0 0 2px rgba(76, 139, 245, 0.2);
}

.entities-module .entities-form-toggle {
    justify-content: space-between;
}

.entities-module .entities-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 0.85rem;
}

.entities-module .entities-row-actions {
    display: flex;
    gap: 8px;
}

.entities-module .entities-modal-footer .btn-primary,
.entities-module .entities-modal-footer .btn-cancel,
.entities-module .entities-header button,
.entities-module .entities-row-actions button {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
}

.entities-module .entities-modal-footer .btn-primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.entities-module .entities-modal-footer .btn-cancel {
    background: #f8fafc;
}

.entities-module .hidden {
    display: none;
}
.entities-table {
    font-family: var(--app-list-font-family);
    font-size: var(--app-list-font-size);
    line-height: var(--app-list-line-height);
    letter-spacing: var(--app-list-letter-spacing);
    color: var(--app-list-color);
}
.entity-admin-module,
.entity-admin-module button,
.entity-admin-module input,
.entity-admin-module select,
.entity-admin-module textarea {
    font-family: var(--app-list-font-family);
}

.entities-titlebar {
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.entities-eyebrow,
.entities-kicker,
.entities-subtitle,
.entities-section-header p {
    margin: 0;
    color: #64748b;
}

.entities-eyebrow,
.entities-kicker {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.entities-subtitle {
    margin-top: 5px;
    font-size: 13px;
}

.entities-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.entities-tabs button,
.entities-card-header button,
.entities-section-header button {
    border: 1px solid #dbe3ef;
    background: #f8fafc;
    color: #334155;
    border-radius: 999px;
    padding: 6px 11px;
    cursor: pointer;
    font-weight: 700;
}

.entities-tabs button.active,
.entities-card-header button,
.entities-section-header button {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.entities-card-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 18px;
}

.entities-card,
.entities-section-header,
.entities-table {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.entities-card {
    padding: 20px;
}

.entities-card-header,
.entities-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.entities-section-header {
    padding: 16px 18px;
    margin-bottom: 14px;
}

.entities-profile-body {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 20px;
    margin-top: 18px;
}

.entities-logo-preview {
    min-height: 120px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #64748b;
    font-weight: 800;
    background: #f8fafc;
    overflow: hidden;
}

.entities-logo-preview img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.entities-detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
}

.entities-detail-list dt {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.entities-detail-list dd {
    margin: 4px 0 0;
    color: #0f172a;
    font-weight: 650;
}

.entities-stat-grid {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.entities-stat-tile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    color: inherit;
}

.entities-stat-tile:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.entities-stat-grid strong {
    font-size: 28px;
    color: #1d4ed8;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 800;
}

.status-pill.active { background: #dcfce7; color: #166534; }
.status-pill.inactive { background: #fee2e2; color: #991b1b; }

.entities-module .entities-table {
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
}

.entities-module .entities-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.entities-module .entities-table td,
.entities-module .entities-table th {
    padding: 12px 14px;
}

.entities-module .entities-table tbody tr:hover {
    background: #f8fafc;
}

.entities-module .entities-modal {
    width: min(860px, calc(100vw - 48px));
    max-height: calc(100vh - 70px);
    overflow: auto;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.entities-module .entities-form-field input,
.entities-module .entities-form-field select,
.entities-module .entities-form-field textarea {
    padding: 9px 11px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    font-size: 0.95rem;
}

.entities-module .entities-form-field textarea {
    min-height: 90px;
    resize: vertical;
}

.entities-form-field-wide {
    grid-column: 1 / -1;
}

@media (max-width: 900px) {
    .entities-card-grid,
    .entities-profile-body,
    .entities-detail-list {
        grid-template-columns: 1fr;
    }
}


/* Tighter entity management tables */
.entities-module .entities-compact-table {
    table-layout: auto;
}

.entities-module .entities-compact-table th,
.entities-module .entities-compact-table td {
    padding: 6px 10px;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.entities-module .entities-compact-table th {
    font-size: 10px;
    line-height: 1.15;
}

.entities-module .entities-compact-table td {
    font-size: 12px;
    line-height: 1.2;
}

.entities-module .entities-compact-table .entities-status-col,
.entities-module .entities-compact-table .entities-freight-col {
    text-align: right;
    width: 1%;
}

.entities-module .entities-clickable-row {
    cursor: pointer;
}

.entities-module .entities-clickable-row:hover {
    background: #f1f5f9;
}

.entities-module .entities-danger-btn {
    justify-self: start;
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #b91c1c;
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 800;
    cursor: pointer;
}

.entities-module .entities-danger-btn:hover {
    background: #fee2e2;
}

.entities-module .entities-compact-table .status-pill {
    padding: 2px 7px;
    font-size: 10px;
}

.entities-settings-form {
    gap: 14px;
}

.entities-settings-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
    padding: 16px;
}

.entities-settings-card-title {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.entities-settings-card-title i {
    align-items: center;
    background: #eff6ff;
    border-radius: 12px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 18px;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.entities-settings-card-title h4,
.entities-settings-card-title p {
    margin: 0;
}

.entities-settings-card-title p {
    color: #64748b;
    font-size: 12px;
    margin-top: 3px;
}

.entities-module .entities-form-field small {
    color: #64748b;
    font-size: 11px;
    margin-top: 4px;
}

.entities-module .entities-form-action {
    align-self: end;
}

.entities-module .entities-smtp-test-grid {
    align-items: end;
}

.entities-module #entities-smtp-test-result {
    white-space: pre-wrap;
}

.entities-connection-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(240px, 1fr));
}

.entities-connection-tile {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
}

.entities-connection-tile.configured {
    border-color: #bbf7d0;
}

.entities-connection-top {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.entities-connection-logo {
    align-items: center;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    border: 1px solid #dbeafe;
    border-radius: 16px;
    color: #1d4ed8;
    display: inline-flex;
    font-weight: 900;
    gap: 8px;
    min-height: 52px;
    padding: 0 14px;
}

.entities-connection-logo i {
    font-size: 22px;
}

.entities-connection-tile h4,
.entities-connection-tile p {
    margin: 0;
}

.entities-connection-tile p {
    color: #64748b;
    font-size: 13px;
}

.entities-connection-fields {
    grid-template-columns: 1fr;
}

.entities-connection-test {
    align-self: flex-start;
    border: 1px solid #1d4ed8;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 800;
    padding: 7px 13px;
}

.entities-connection-test:disabled {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

@media (max-width: 1100px) {
    .entities-connection-grid {
        grid-template-columns: 1fr;
    }
}

.entities-logo-upload-field {
    gap: 8px;
}

.entities-logo-upload-preview {
    align-items: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    min-height: 72px;
    padding: 8px;
}

.entities-logo-upload-preview img {
    max-height: 64px;
    max-width: 100%;
    object-fit: contain;
}
