:root {
    --sidebar-width: 260px;
    --surface: #ffffff;
    --line: #e5e7eb;
    --ink: #111827;
    --muted: #6b7280;
    --accent: #128c7e;
}

body {
    min-height: 100vh;
    background: #f3f5f7;
    color: var(--ink);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: #0f172a;
    color: #fff;
    padding: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    margin-bottom: 22px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
}

.brand small {
    display: block;
    color: #cbd5e1;
    font-size: 12px;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.app-main {
    flex: 1;
    padding: 24px;
    min-width: 0;
}

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

.metric {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 18px;
}

.metric .icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e7f7f4;
    color: var(--accent);
}

.table-card,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.panel {
    padding: 18px;
}

.whatsapp-preview {
    max-width: 380px;
    background: #e5ddd5;
    border-radius: 8px;
    padding: 16px;
}

.wa-bubble {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

.wa-button {
    background: #fff;
    color: #128c7e;
    border-top: 1px solid #edf2f7;
    padding: 10px;
    text-align: center;
    font-weight: 600;
}

.message-thread {
    max-height: 620px;
    overflow-y: auto;
    padding-right: 6px;
}

.thread-message {
    max-width: 82%;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    white-space: pre-wrap;
}

.thread-message.inbound {
    background: #fff;
    border: 1px solid var(--line);
}

.thread-message.outbound {
    margin-left: auto;
    background: #dcf8c6;
}

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }

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

    .app-main {
        padding: 16px;
    }
}
