/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form .form-label {
    font-weight: 600;
    color: #333;
}

.login-form .form-control {
    border-radius: 5px;
    padding: 0.75rem;
    border: 1px solid #ddd;
}

.login-form .btn-primary {
    background: #667eea;
    border: none;
    padding: 0.75rem;
    border-radius: 5px;
    font-weight: 600;
}

/* Calendar Page Styles */
.calendar-events .card {
    border-left: 4px solid #667eea;
}

.calendar-events .card-title {
    color: #333;
    font-weight: 600;
}

.calendar-events .card-text {
    color: #666;
}

/* Tasks Page Styles */
.task-list .card {
    border-left: 4px solid #28a745;
}

.task-list .card.bg-light {
    border-left-color: #6c757d;
}

.task-list .form-check-input {
    cursor: pointer;
}

.task-list .badge {
    font-size: 0.75rem;
}

/* Contacts Page Styles */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
}

.contact-card {
    border-left: 4px solid #17a2b8;
}

.avatar-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #17a2b8;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

/* ActiveSync Page Styles */
.device-list .card.border-success {
    border-left: 4px solid #28a745;
}

.device-list .card.border-warning {
    border-left: 4px solid #ffc107;
}

.device-list .card.border-danger {
    border-left: 4px solid #dc3545;
}

.device-info .card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.device-actions .btn-group-vertical .btn {
    margin-bottom: 0.25rem;
}

/* Common Styles */
.display-1 {
    font-size: 4rem;
    color: #dee2e6;
}

.btn-group .btn {
    margin-right: 0.25rem;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

.text-decoration-line-through {
    text-decoration: line-through;
}

/* Loading Container */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f8f9fa;
}

/* User Info */
.user-info {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Domains Page Styles */
.mailu-domains-page {
    padding: 1.5rem 0 2rem;
}

.mailu-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.mailu-page-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    color: #2c3136;
}

.mailu-primary-action {
    min-width: 130px;
}

.mailu-alert {
    margin-bottom: 1rem;
}

.mailu-form-card,
.mailu-details-card,
.mailu-table-card {
    border: 1px solid #cfd8e3;
    box-shadow: 0 8px 24px rgba(24, 39, 75, 0.06);
}

.mailu-form-section {
    border: 1px solid #d9e1e8;
}

.mailu-form-section .card-body {
    border-top: 3px solid #57a5e5;
}

.mailu-form-section-success .card-body {
    border-top-color: #2db55d;
}

.mailu-section-title {
    margin-bottom: 1rem;
    color: #343a40;
    font-size: 1rem;
    font-weight: 600;
}

.mailu-table-card {
    overflow: hidden;
}

.mailu-table-card .card-body {
    border-top: 3px solid #57a5e5;
    padding: 1rem 0.875rem 1.25rem;
}

.mailu-table-toolbar,
.mailu-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0 0.125rem;
}

.mailu-table-toolbar {
    margin-bottom: 0.875rem;
}

.mailu-table-footer {
    margin-top: 0.875rem;
    color: #495057;
    font-size: 0.95rem;
}

.mailu-length-control,
.mailu-search-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #343a40;
}

.mailu-length-control select {
    width: 72px;
}

.mailu-search-control input {
    width: 210px;
}

.mailu-domain-table {
    margin-bottom: 0;
    border: 1px solid #d9e1e8;
}

.mailu-domain-table thead th {
    white-space: nowrap;
    background: #fff;
    border-bottom: 3px solid #d9e1e8;
    color: #2f343a;
    font-weight: 700;
    vertical-align: middle;
}

.mailu-domain-table tbody td {
    vertical-align: middle;
    color: #2f343a;
}

.mailu-domain-table tbody tr:hover {
    background: #fafcfe;
}

.mailu-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
}

.mailu-sort-indicator {
    color: #a0a9b4;
    font-size: 0.8rem;
}

.mailu-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.35rem;
}

.mailu-icon-link {
    padding: 0;
    text-decoration: none;
    font-weight: 600;
    color: #57a5e5;
}

.mailu-icon-link:hover {
    color: #2f7fc1;
    text-decoration: underline;
}

.mailu-details-card .card-title,
.mailu-form-card .card-title {
    font-weight: 600;
}

.mailu-detail-label {
    margin-bottom: 0.2rem;
    color: #6c757d;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mailu-detail-value {
    color: #2f343a;
    font-size: 0.98rem;
}

.mailu-empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: #6c757d;
}

.mailu-record-block {
    padding: 0.85rem 0;
    border-bottom: 1px solid #e9ecef;
}

.mailu-record-block:last-child {
    border-bottom: 0;
}

.mailu-record-name {
    margin-bottom: 0.35rem;
    color: #495057;
    font-weight: 600;
}

.mailu-record-value {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: #1f2937;
}

.mailu-zone-preview {
    margin: 0;
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    color: #1f2937;
    font-size: 0.92rem;
}

.mailu-quota-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mailu-quota-row .form-range {
    margin: 0;
}

.mailu-quota-badge {
    min-width: 72px;
    padding: 0.45rem 0.7rem;
    border: 1px solid #d9e1e8;
    border-radius: 0.4rem;
    background: #f8fafc;
    color: #495057;
    font-weight: 600;
    text-align: center;
}

.mailu-info-grid {
    display: grid;
    gap: 0.75rem;
}

.mailu-info-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid #eef2f7;
}

.mailu-info-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.mailu-antispam-frame {
    display: block;
    width: 100%;
    min-height: 78vh;
    border: 0;
    border-radius: 0 0 0.5rem 0.5rem;
    background: #fff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
    
    .login-container {
        padding: 1rem;
    }
    
    .login-card {
        margin: 1rem;
    }

    .mailu-page-header,
    .mailu-table-toolbar,
    .mailu-table-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .mailu-search-control input,
    .mailu-length-control select,
    .mailu-primary-action {
        width: 100%;
    }

    .mailu-info-row {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Server Monitor Page */
.smon-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #e9ecef;
    color: #6c757d;
}

.smon-live-badge--active {
    background: #d1fae5;
    color: #065f46;
}

.smon-live-badge--active::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: smon-pulse 1.5s ease-in-out infinite;
}

@keyframes smon-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

.smon-big-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.smon-value--ok      { color: #198754; }
.smon-value--warning { color: #ffc107; }
.smon-value--danger  { color: #dc3545; }

.smon-progress {
    height: 10px;
    border-radius: 5px;
}

.smon-unavailable {
    color: #6c757d;
    font-style: italic;
    font-size: 0.9rem;
}

.smon-os-text {
    font-size: 0.8rem;
    word-break: break-word;
}

/* Server Monitor — Log viewer */
.smon-log-filter,
.smon-log-search {
    width: auto;
    min-width: 120px;
}

.smon-log-list {
    font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
    font-size: 0.78rem;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #0d1117;
}

.smon-log-row {
    display: grid;
    grid-template-columns: 68px 44px 180px 1fr;
    gap: 0 8px;
    padding: 3px 10px;
    border-bottom: 1px solid #1c2128;
    line-height: 1.4;
    color: #c9d1d9;
    align-items: baseline;
}

.smon-log-row:last-child {
    border-bottom: none;
}

.smon-log-row--warning {
    background: #1c160a;
    color: #e3b341;
}

.smon-log-row--error,
.smon-log-row--critical {
    background: #1c0a0a;
    color: #f85149;
}

.smon-log-time {
    color: #8b949e;
    white-space: nowrap;
}

.smon-log-level {
    font-weight: 700;
    white-space: nowrap;
}

.smon-log-row--information .smon-log-level { color: #58a6ff; }
.smon-log-row--warning     .smon-log-level { color: #e3b341; }
.smon-log-row--error       .smon-log-level,
.smon-log-row--critical    .smon-log-level { color: #f85149; }
.smon-log-row--debug       .smon-log-level { color: #8b949e; }

.smon-log-category {
    color: #8b949e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smon-log-message {
    word-break: break-word;
    white-space: pre-wrap;
}

.smon-limit-group {
    width: auto;
}

.smon-limit-input {
    width: 72px;
    min-width: 72px;
}

.smon-log-count {
    font-size: 0.8rem;
}

/* Server Monitor — section dividers */
.smon-section-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #dee2e6;
}

/* Load average secondary values */
.smon-load-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
    margin-bottom: 0.15rem;
}

.smon-load-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}

/* Generic stat label / value pair used in new metric cards */
.smon-stat-label {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.1rem;
}

.smon-stat-value {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.2;
}

/* Small helper text below cards */
.smon-meta {
    font-size: 0.75rem;
}

/* Top processes table */
.smon-proc-table {
    font-size: 0.83rem;
}

.smon-proc-table td,
.smon-proc-table th {
    padding: 0.3rem 0.6rem;
    vertical-align: middle;
}

.smon-proc-name {
    font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
    font-size: 0.82rem;
}

/* Server Monitor — Terminal tab */
.smon-term-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.smon-term-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.smon-term-chip {
    font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
    font-size: 0.72rem;
}

.smon-term-output {
    background: #0d1117;
    color: #c9d1d9;
    font-family: ui-monospace, "Cascadia Code", "Fira Code", Menlo, monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    height: min(62vh, 560px);
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #30363d;
}

.smon-term-output .smon-term-prompt-line {
    color: #7ee787;
}

.smon-term-output .smon-term-meta-line {
    color: #8b949e;
}

.smon-term-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.smon-term-input-row .form-control {
    font-family: ui-monospace, "Cascadia Code", "Fira Code", Menlo, monospace;
    font-size: 0.85rem;
}

.smon-term-hint {
    font-size: 0.78rem;
    color: #6c757d;
}

/* Friendly message shown by AdminErrorBoundary when one admin page fails (details go to ErrorLogs). */
.page-error { border-left: 4px solid #d97706; }
.page-error h2 { margin-top: 0; }

/* Domain info › Branding: a small live preview of the webmail top bar */
.brand-preview { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 8px;
    border-top: 3px solid var(--brand-preview, #00acff); background: var(--bs-body-bg, #fff); }
.brand-preview-logo { max-height: 28px; max-width: 120px; object-fit: contain; }
.brand-preview-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-preview-btn { padding: 4px 12px; border-radius: 6px; background: var(--brand-preview, #00acff); color: #fff; font-size: 13px; font-weight: 600; }
#branding { scroll-margin-top: 16px; }

/* ── Domain › 8. Branding: editor + live light/dark preview of the webmail (same colour variables as /iodwm/brand.css) ── */
.brand-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .brand-layout { grid-template-columns: minmax(0, 1fr); } }
.brand-preview-card { position: sticky; top: 12px; }
.brand-color-row { display: flex; gap: 8px; align-items: center; }
.brand-color-row input[type=color] { width: 3rem; height: 38px; padding: 2px; flex: none; cursor: pointer; }
.brand-color-row #brand-accent { max-width: 9rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.admin-error-text { color: #b42318 !important; }
.brand-previews { display: grid; gap: 14px; padding: 0 18px 4px; }
.brand-pv { --pv-bg: #f6f7f9; --pv-surface: #ffffff; --pv-side: #f3f4f6; --pv-border: #e3e6ea; --pv-text: #1f2328; --pv-muted: #667085;
    --pv-link: var(--brand-text-light); --pv-selected: color-mix(in srgb, var(--brand) 14%, #ffffff);
    border: 1px solid var(--pv-border); border-radius: 10px; overflow: hidden; background: var(--pv-bg); color: var(--pv-text); font-size: 12.5px; }
.brand-pv-dark { --pv-bg: #111417; --pv-surface: #1d2125; --pv-side: #171a1e; --pv-border: #2f353b; --pv-text: #e6e8ea; --pv-muted: #9aa3ad;
    --pv-link: var(--brand-text-dark); --pv-selected: color-mix(in srgb, var(--brand) 22%, #1d2125); }
.brand-pv-mode { padding: 4px 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--pv-muted); background: var(--pv-side); border-bottom: 1px solid var(--pv-border); }
.brand-pv-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--pv-surface); border-top: 3px solid var(--brand); border-bottom: 1px solid var(--pv-border); }
.brand-pv-logo { max-height: 24px; max-width: 110px; object-fit: contain; }
.brand-pv-mono { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: var(--brand-ink); font-weight: 700; flex: none; }
.brand-pv-name { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-pv-btn { padding: 4px 12px; border-radius: 6px; background: var(--brand); color: var(--brand-ink); font-weight: 600; white-space: nowrap; }
.brand-pv-body { display: grid; grid-template-columns: 110px minmax(0, 1fr); min-height: 170px; }
.brand-pv-side { background: var(--pv-side); border-right: 1px solid var(--pv-border); padding: 8px 6px; display: flex; flex-direction: column; gap: 2px; }
.brand-pv-folder { padding: 4px 8px; border-radius: 5px; color: var(--pv-muted); }
.brand-pv-folder.active { background: var(--pv-selected); color: var(--pv-link); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.brand-pv-login { margin: 12px auto; width: min(220px, 90%); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px;
    background: var(--pv-surface); border: 1px solid var(--pv-border); border-top: 3px solid var(--brand); border-radius: 8px; }
.brand-pv-input { align-self: stretch; padding: 4px 8px; border: 1px solid var(--pv-border); border-radius: 5px; color: var(--pv-muted); background: var(--pv-bg); }
.brand-pv-btn-block { align-self: stretch; text-align: center; }
.brand-pv-link { color: var(--pv-link); font-size: 11.5px; }
.brand-color-row .brand-reset { white-space: nowrap; background: #e5e7eb; color: #111827; padding: .45rem .8rem; font-size: .85rem; }
.brand-color-row .brand-reset:hover { background: #d1d5db; }
#branding .card-note, #brand-preview .card-note { padding: 0 1.25rem 1rem; margin: 0; }
