:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e6eaf0;
    --text: #182234;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar: #101827;
    --sidebar-soft: #172033;
    --success: #15803d;
    --danger: #be123c;
    --warning: #b45309;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}


/* ---------- Login ---------- */

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(
            circle at 15% 20%,
            rgba(37, 99, 235, 0.16),
            transparent 28rem
        ),
        radial-gradient(
            circle at 90% 90%,
            rgba(59, 130, 246, 0.08),
            transparent 24rem
        ),
        linear-gradient(
            145deg,
            #f8fafc 0%,
            #eef2f7 100%
        );
}

.auth-card {
    width: min(100%, 440px);
    padding: 34px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.9);
    backdrop-filter: blur(10px);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 34px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background:
        linear-gradient(
            135deg,
            #2563eb,
            #1d4ed8
        );
    box-shadow:
        0 10px 22px
        rgba(37, 99, 235, 0.26);
}

.auth-brand-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-brand-subtitle {
    color: var(--muted);
    font-size: 0.88rem;
}

.auth-kicker,
.section-kicker,
.page-kicker {
    color: var(--primary);
    font-size: 0.73rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.11em;
}

.auth-copy h1 {
    margin: 6px 0 8px;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.035em;
}

.auth-copy p {
    margin-bottom: 26px;
    color: var(--muted);
}

.auth-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.78rem;
}


/* ---------- App shell ---------- */

.portal-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 245px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    background:
        linear-gradient(
            180deg,
            var(--sidebar) 0%,
            #0d1421 100%
        );
    color: #fff;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    text-decoration: none;
    color: #fff;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--primary);
    box-shadow:
        0 10px 22px
        rgba(37, 99, 235, 0.28);
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand strong {
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.sidebar-brand small {
    color: rgba(255, 255, 255, 0.48);
    font-size: 0.72rem;
    margin-top: 2px;
}

.sidebar-customer {
    margin-top: 30px;
    padding: 15px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-label {
    color: rgba(255, 255, 255, 0.42);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: 5px;
}

.sidebar-customer-name {
    font-weight: 750;
}

.sidebar-customer-id {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.46);
    font-size: 0.73rem;
}

.sidebar-nav {
    margin-top: 24px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: 11px;
    color: rgba(255, 255, 255, 0.62);
    text-decoration: none;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
}

.sidebar-link.active {
    color: #fff;
    background: var(--sidebar-soft);
    box-shadow:
        inset 3px 0 0
        var(--primary);
}

.sidebar-bottom {
    margin-top: auto;
}

.portal-main {
    min-width: 0;
    padding: 34px;
}

.portal-topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.portal-topbar h1 {
    margin: 5px 0 4px;
    font-size: clamp(
        1.9rem,
        3vw,
        2.7rem
    );
    font-weight: 820;
    letter-spacing: -0.04em;
}

.portal-topbar p {
    margin: 0;
    color: var(--muted);
}

.topbar-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 999px;
    background: #fff;
    color: #475569;
    border: 1px solid var(--border);
    box-shadow:
        0 1px 2px rgba(16, 24, 40, 0.03);
    font-size: 0.82rem;
}


/* ---------- Metrics ---------- */

.stats-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 112px;
    padding: 20px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow:
        0 1px 2px rgba(16, 24, 40, 0.03),
        0 10px 28px rgba(16, 24, 40, 0.04);
}

.metric-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    font-size: 1.05rem;
}

.metric-neutral {
    background: #eef2ff;
    color: #4338ca;
}

.metric-success {
    background: #ecfdf3;
    color: #15803d;
}

.metric-info {
    background: #eff6ff;
    color: #2563eb;
}

.metric-danger {
    background: #fff1f2;
    color: #be123c;
}

.metric-label {
    color: var(--muted);
    font-size: 0.79rem;
    margin-bottom: 2px;
}

.metric-value {
    font-size: 1.78rem;
    font-weight: 820;
    line-height: 1;
    letter-spacing: -0.03em;
}


/* ---------- Cards ---------- */

.content-card {
    margin-bottom: 20px;
    overflow: hidden;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow:
        0 1px 2px rgba(16, 24, 40, 0.025),
        0 10px 30px rgba(16, 24, 40, 0.035);
}

.content-card-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.content-card-header h2 {
    margin: 4px 0 0;
    font-size: 1.12rem;
    font-weight: 750;
}

.section-note {
    color: var(--muted);
    font-size: 0.78rem;
}

.content-card-body {
    padding: 22px;
}


/* ---------- Form controls ---------- */

.form-label {
    font-weight: 650;
    font-size: 0.82rem;
    color: #475569;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 42px;
    border-color: #d9dee7;
}

.input-group-lg .form-control,
.input-group-lg .input-group-text {
    min-height: 50px;
}

.form-control:focus,
.form-select:focus {
    border-color: #8ab4ff;
    box-shadow:
        0 0 0 0.2rem
        rgba(37, 99, 235, 0.1);
}

.btn {
    border-radius: 9px;
    font-weight: 650;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}


/* ---------- Table ---------- */

.portal-table {
    margin-bottom: 0 !important;
}

.portal-table thead th {
    padding-top: 13px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--border);
    color: #64748b;
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.055em;
    white-space: nowrap;
}

.portal-table tbody td {
    padding-top: 15px;
    padding-bottom: 15px;
    border-color: #edf0f4;
}

.portal-table tbody tr {
    transition:
        background 0.15s ease;
}

.portal-table tbody tr:hover {
    background: #fafcff;
}

.date-cell strong {
    font-size: 0.82rem;
    font-weight: 650;
    color: #334155;
}

.phone-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #334155;
    font-size: 0.83rem;
    font-weight: 600;
}

.phone-pill i {
    color: #94a3b8;
}

.message-cell {
    min-width: 300px;
    max-width: 680px;
    white-space: normal;
    color: #334155;
    line-height: 1.45;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-delivered {
    background: #ecfdf3;
    color: #15803d;
}

.status-submitted,
.status-sending {
    background: #eff6ff;
    color: #1d4ed8;
}

.status-queued {
    background: #f1f5f9;
    color: #475569;
}

.status-failed {
    background: #fff1f2;
    color: #be123c;
}

.status-suppressed {
    background: #fff7ed;
    color: #c2410c;
}

.status-unknown {
    background: #fefce8;
    color: #a16207;
}

.delivered-time {
    color: #475569;
    font-size: 0.79rem;
}


/* ---------- DataTables ---------- */

.dt-container .dt-layout-row {
    margin: 0 0 16px !important;
}

.dt-container .dt-search input,
.dt-container .dt-length select {
    min-height: 38px;
    border: 1px solid #d9dee7 !important;
    border-radius: 9px !important;
    background: #fff !important;
}

.dt-container .dt-search input {
    min-width: 220px;
    padding: 7px 10px !important;
}

.dt-container .dt-paging .dt-paging-button {
    border-radius: 8px !important;
}

.dt-container .dt-info {
    color: var(--muted);
    font-size: 0.79rem;
}


/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .portal-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 16px;
        padding: 14px 18px;
    }

    .sidebar-customer {
        display: none;
    }

    .sidebar-nav {
        margin: 0 0 0 auto;
    }

    .sidebar-bottom {
        margin: 0;
    }

    .sidebar-link {
        padding: 9px 11px;
    }

    .sidebar-link span,
    .sidebar-link.active {
        box-shadow: none;
    }

    .stats-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .portal-main {
        padding: 20px 14px;
    }

    .portal-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .content-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .auth-card {
        padding: 26px;
    }

    .auth-meta {
        flex-direction: column;
    }

    .sidebar-nav {
        display: none;
    }

    .sidebar-brand small,
    .sidebar-bottom .sidebar-link {
        font-size: 0;
    }

    .sidebar-bottom .sidebar-link i {
        font-size: 1rem;
    }

    .message-cell {
        min-width: 240px;
    }
}
