* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #ffffff;
    --sidebar: #f7f8f9;
    --panel: #ffffff;
    --border: #e8eaed;
    --soft: #f4f5f7;
    --text: #1f2328;
    --muted: #6b7280;
    --green: #1fa855;
    --green-dark: #178a45;
    --green-soft: #e8f7ee;
    --alarm: #e5383b;
}

body {
    font-family: "Inter", system-ui, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Slim icon sidebar */
.sidebar {
    width: 56px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 14px;
    gap: 18px;
}

.logo {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--green);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 14px;
}

.nav-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--muted);
    cursor: pointer;
}

.nav-icon.active {
    background: var(--green-soft);
    color: var(--green);
}

/* Page */
.page {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 56px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 28px;
}

.topbar-title {
    font-weight: 600;
    font-size: 15px;
}

.controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

#updated {
    color: var(--muted);
    font-size: 13px;
}

button {
    font-family: inherit;
    background: var(--green);
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

button:hover {
    background: var(--green-dark);
}

button:disabled {
    background: #a7d8b9;
    cursor: wait;
}

.content {
    padding: 32px 40px;
}

h1 {
    font-size: 22px;
    font-weight: 600;
}

.subtitle {
    color: var(--muted);
    font-size: 14px;
    margin: 6px 0 28px;
}

/* Panel, like WATI's "Your tokens" box */
.panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    background: var(--panel);
}

.panel-head {
    margin-bottom: 20px;
}

.panel-head h3 {
    font-size: 16px;
    font-weight: 600;
}

.panel-head p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

/* Cards */
#cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    background: #fff;
    animation: fadeIn 0.25s ease-out both;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
    border-color: #cfe9d9;
    box-shadow: 0 4px 14px rgba(31, 168, 85, 0.08);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.card h2 {
    font-size: 15px;
    font-weight: 600;
}

.phone {
    font-size: 18px;
    font-weight: 600;
    color: var(--green);
    font-variant-numeric: tabular-nums;
    margin-bottom: 6px;
}

.count {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eef0f2;
}

.count-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a9099;
}

.count-value {
    font-size: 22px;
    font-weight: 700;
    color: #1f2328;
    font-variant-numeric: tabular-nums;
}

.count-todayLeads {
    font-size: 22px;
    font-weight: 700;
    color: #1f2328;
    font-variant-numeric: tabular-nums;
}

/* Small caps status, like WATI's "CONNECTED" label */
.status {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    color: var(--green);
}

/* Pill tags, like WATI's scope pills */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: var(--soft);
}

.badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

/* Health colours */
.green .badge {
    background: var(--green-soft);
    color: var(--green-dark);
}

.unknown .badge {
    background: #e8f1fd;
    color: #1d5fbf;
}

.yellow .badge {
    background: #fff7e6;
    color: #b26a00;
}

.red .badge {
    background: #fdecec;
    color: #c0262d;
}

/* Banned/disconnected */
.down {
    border-color: #f5b5b6;
    background: #fffafa;
}

.down .phone,
.down .status {
    color: var(--alarm);
}

.down .badge {
    background: var(--alarm);
    color: #fff;
}

.down .badge::before {
    animation: pulse 1.3s infinite;
}

@keyframes pulse {
    50% {
        opacity: 0.25;
    }
}

.error {
    border-color: #f5b5b6;
    color: var(--alarm);
}

@media (max-width: 640px) {
    .sidebar {
        display: none;
    }
}

.name {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 4px;
}

#cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 900px) {
    #cards {
        grid-template-columns: repeat(2, 1fr);
    }
}