* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
}

body {
    font-family: Arial, Tahoma, sans-serif;
    background: #f3f6fb;
    color: #1f2937;
    overflow-x: hidden;
}

/* =========================
   Topbar
========================= */

.topbar {
    width: 100%;
    background: #111827;
    color: #fff;
    padding: 14px 4%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
}

.brand {
    font-size: 20px;
    font-weight: bold;
    white-space: nowrap;
}

.nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav a {
    text-decoration: none;
    color: #fff;
    background: #374151;
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.nav a:hover {
    opacity: .9;
}

.nav .logout {
    background: #b91c1c;
}

/* =========================
   Main container
========================= */

.container {
    width: min(94%, 1450px);
    margin: 25px auto;
}

/* =========================
   Headers
========================= */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-header h1,
h1,
h2 {
    margin-top: 0;
}

.campaign-button {
    text-decoration: none;
    background: #1877f2;
    color: #fff;
    padding: 11px 16px;
    border-radius: 9px;
    font-weight: bold;
    display: inline-block;
}

/* =========================
   Stats
========================= */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat {
    background: #fff;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,.06);
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    margin-top: 8px;
}

/* =========================
   Cards
========================= */

.card {
    background: #fff;
    padding: 22px;
    border-radius: 14px;
    box-shadow: 0 3px 15px rgba(0,0,0,.06);
    margin-bottom: 22px;
}

/* =========================
   Tables
========================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,.06);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

th,
td {
    padding: 13px;
    border-bottom: 1px solid #e5e7eb;
    text-align: right;
    vertical-align: middle;
}

th {
    background: #1f2937;
    color: #fff;
    white-space: nowrap;
}

tr:hover {
    background: #f9fafb;
}

.message {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.small {
    font-size: 12px;
    color: #6b7280;
}

/* =========================
   Badges
========================= */

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.eligible {
    background: #dcfce7;
    color: #166534;
}

.ineligible {
    background: #fee2e2;
    color: #991b1b;
}

.unsubscribed {
    background: #f3f4f6;
    color: #4b5563;
}

/* =========================
   Forms
========================= */

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 13px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    font-size: 15px;
    outline: none;
    background: #fff;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #1877f2;
    box-shadow: 0 0 0 3px rgba(24,119,242,.10);
}

textarea {
    min-height: 140px;
    resize: vertical;
}

.form-group {
    margin-bottom: 18px;
}

button {
    border: 0;
    border-radius: 9px;
    padding: 12px 18px;
    background: #1877f2;
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

button:hover {
    background: #0f66d0;
}

.actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* =========================
   Alerts
========================= */

.alert {
    padding: 13px;
    border-radius: 9px;
    margin-bottom: 18px;
}

.success {
    background: #dcfce7;
    color: #166534;
}

.error {
    background: #fee2e2;
    color: #991b1b;
}

.warning {
    background: #fef3c7;
    color: #92400e;
}

/* =========================
   Login
========================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: min(100%, 420px);
    background: #fff;
    border-radius: 18px;
    padding: 30px;
    box-shadow: 0 12px 35px rgba(0,0,0,.10);
}

.logo {
    text-align: center;
    margin-bottom: 25px;
}

.logo-circle {
    width: 65px;
    height: 65px;
    margin: 0 auto 15px;
    border-radius: 50%;
    background: #1877f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
}

/* =========================
   Campaign result
========================= */

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.result-item {
    background: #f9fafb;
    padding: 15px;
    border-radius: 10px;
}

.result-number {
    font-size: 24px;
    font-weight: bold;
    margin-top: 5px;
}

.empty {
    padding: 25px;
    text-align: center;
    color: #6b7280;
}

/* =========================
   Tablet
========================= */

@media (max-width: 900px) {

    .container {
        width: 96%;
        margin: 20px auto;
    }

    .topbar {
        padding: 12px 3%;
    }

    .brand {
        width: 100%;
        text-align: center;
    }

    .nav {
        width: 100%;
        justify-content: center;
    }

    .page-header {
        align-items: stretch;
    }

    .page-header h1 {
        width: 100%;
    }

    .campaign-button {
        text-align: center;
    }

    .card {
        padding: 18px;
    }

    table {
        min-width: 760px;
    }
}

/* =========================
   Mobile
========================= */

@media (max-width: 600px) {

    body {
        font-size: 14px;
    }

    .topbar {
        display: block;
        text-align: center;
    }

    .brand {
        margin-bottom: 12px;
        font-size: 18px;
    }

    .nav {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .nav a {
        width: 100%;
        text-align: center;
    }

    .container {
        width: 94%;
        margin: 16px auto;
    }

    .page-header {
        display: block;
    }

    .page-header h1 {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .campaign-button {
        width: 100%;
        text-align: center;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 15px;
        border-radius: 10px;
    }

    .table-wrapper {
        border-radius: 10px;
    }

    table {
        min-width: 700px;
        font-size: 13px;
    }

    th,
    td {
        padding: 10px;
    }

    .message {
        max-width: 180px;
    }

    button {
        width: 100%;
    }

    .actions {
        display: block;
    }

    .login-box {
        padding: 22px 18px;
    }

    .logo-circle {
        width: 55px;
        height: 55px;
        font-size: 24px;
    }
}

/* =========================
   Very small mobile
========================= */

@media (max-width: 390px) {

    body {
        font-size: 13px;
    }

    .container {
        width: 96%;
    }

    .card {
        padding: 12px;
    }

    input,
    textarea,
    select,
    button {
        font-size: 14px;
    }
}