* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #f4f7fb 0%, #eef2f7 100%);
    color: #1f2937;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.18);
}

.header-inner {
    width: min(90%, 1400px);
    margin: 0 auto;
    padding: 18px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: 12px;
    background: #ffffff;
}

.brand h1 {
    margin: 0;
    font-size: 1.6rem;
}

.brand p {
    margin: 4px 0 0;
    color: #cbd5e1;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.welcome-text {
    color: #cbd5e1;
    font-size: 0.95rem;
}

.nav-link {
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.2s ease;
}

.nav-link:hover,
.nav-link:focus {
    background: rgba(255, 255, 255, 0.16);
}

.nav-link-danger {
    background: rgba(239, 68, 68, 0.2);
}

.page-content {
    width: 90%;
    margin: 30px auto 40px;
}

.site-footer {
    width: min(90%, 1400px);
    margin: 0 auto 24px;
    color: #64748b;
    text-align: center;
    font-size: 0.95rem;
}

.content-card,
.auth-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 15px 45px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.content-card-wide {
    padding: 24px 18px;
}

.inner-section {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px;
    background: #f8fafc;
}

.inner-section h3 {
    margin-top: 0;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.section-head h2,
.auth-card h2,
.confirm-card h2 {
    margin: 0 0 6px;
}

.section-head p,
.auth-card p,
.confirm-card p {
    margin: 0;
    color: #64748b;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 12px;
    border: 0;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover,
.btn:focus {
    transform: translateY(-1px);
    opacity: 0.95;
}

.btn-primary {
    background: #1d4ed8;
    color: #ffffff;
}

.btn-secondary {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-danger {
    background: #dc2626;
    color: #ffffff;
}

.btn-block {
    width: 100%;
}

.table-wrap {
    overflow-x: auto;
}

.monitoring-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.overview-card {
    border: 1px solid #dbeafe;
    background: #f8fbff;
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.overview-label {
    color: #64748b;
    font-size: 0.88rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1320px;
}

.data-table th,
.data-table td {
    vertical-align: top;
    text-align: left;
    padding: 16px 14px;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    background: #f8fafc;
    font-size: 0.95rem;
}

.data-table th a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 14px;
}

.sort-indicator.inactive {
    color: #94a3b8;
}

.sort-indicator.active {
    color: #1d4ed8;
}

.subtext,
.muted {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 6px;
}

.mail-status-grid {
    display: grid;
    gap: 8px;
}

.mail-status-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 700;
    width: fit-content;
}

.status-pill-compact {
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 999px;
}

.status-success {
    background: #dcfce7;
    color: #166534;
}

.status-warning {
    background: #ffedd5;
    color: #c2410c;
}

.status-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.status-neutral {
    background: #e5e7eb;
    color: #374151;
}

.multiline-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.line-badge {
    display: block;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
}

.line-badge-alert {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
    font-weight: 700;
}

.actions {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e0f2fe;
    color: #0369a1;
}

.icon-btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.empty-state {
    text-align: center;
    color: #64748b;
    padding: 28px;
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.auth-card {
    width: min(100%, 480px);
    margin: 40px auto;
}

.wide-auth-card {
    width: min(100%, 650px);
}

.auth-form,
.data-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.data-form {
    gap: 22px;
}

label {
    font-weight: 700;
    margin-bottom: 6px;
    display: block;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    background: #ffffff;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #93c5fd;
    border-color: #60a5fa;
}

.field-error {
    margin: 4px 0 0;
    color: #b91c1c;
    font-size: 0.92rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.form-grid-full {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.status-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.form-actions,
.inline-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
}

.cleanup-form {
    display: grid;
    grid-template-columns: minmax(220px, 320px) auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 24px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #f8fafc;
}

.hotmail-followup {
    font-weight: 700;
}

.auto-mail-issues {
    color: #b91c1c;
    font-weight: 700;
}

.is-hidden {
    display: none;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
}

.checkbox-card {
    padding: 14px 16px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: #eff6ff;
    margin-bottom: 18px;
}

.mail-test-section {
    margin: 18px 0 10px;
}

.mail-test-section h4 {
    margin: 0;
    font-size: 1rem;
}

.mail-test-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.mail-test-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mail-test-auth-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.mail-test-recipient-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.history-card {
    margin-top: 24px;
}

.logs-table td {
    white-space: normal;
    word-break: break-word;
}

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

.detail-card {
    background: #f8fafc;
    border-radius: 16px;
    padding: 18px;
    border: 1px solid #e2e8f0;
}

.detail-card h3 {
    margin-top: 0;
}

@media (max-width: 980px) {
    .header-inner,
    .section-head {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid,
    .form-grid-full,
    .status-form-grid,
    .monitoring-overview,
    .mail-test-grid,
    .mail-test-grid-2,
    .mail-test-auth-grid,
    .mail-test-recipient-grid,
    .details-grid,
    .filter-grid,
    .cleanup-form {
        grid-template-columns: 1fr;
    }

    .header-nav {
        justify-content: flex-start;
    }
}
