* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f7fb;
    color: #172033;
}

.hidden {
    display: none !important;
}

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 380px;
    background: white;
    padding: 35px;
    border-radius: 14px;
    box-shadow: 0 10px 35px rgba(0,0,0,.08);
}

.brand {
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 25px;
}

input,
select {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #d7dce5;
    border-radius: 7px;
}

button {
    cursor: pointer;
    border: 0;
    border-radius: 7px;
    padding: 11px 15px;
}

.login-box button {
    width: 100%;
    margin-top: 10px;
    background: #111827;
    color: white;
}

.error {
    color: #b91c1c;
    margin-top: 12px;
}

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

.sidebar {
    width: 230px;
    background: #111827;
    color: white;
    padding: 25px 18px;
    display: flex;
    flex-direction: column;
}

.logo {
    font-size: 27px;
    font-weight: 800;
}

.portal-label {
    color: #9ca3af;
    margin: 5px 0 30px;
}

.nav-group {
    margin: 20px 11px 7px;
    color: #6b7280;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nav-group:first-child {
    margin-top: 0;
}

.nav-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    color: #d1d5db;
    margin-bottom: 5px;
}

.nav-item:hover,
.nav-item.active {
    background: #1f2937;
    color: white;
}

.logout {
    margin-top: auto;
    background: #374151;
    color: white;
}

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

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

.topbar h1 {
    margin: 0;
}

.topbar p {
    margin: 5px 0 0;
    color: #6b7280;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.card,
.panel,
.service-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
}

.card span {
    display: block;
    color: #6b7280;
}

.card strong {
    display: block;
    font-size: 30px;
    margin-top: 10px;
}

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

.service-card h3,
.service-card p {
    margin-top: 0;
}

.service-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.service-card-head h2,
.service-card-head h3 {
    margin: 0 0 6px;
}

.service-card-head p {
    margin: 0;
    color: #6b7280;
}

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 9px;
    background: #eef2f7;
    color: #374151;
    font-size: 12px;
    font-weight: 800;
    text-transform: capitalize;
    white-space: nowrap;
}

.billing-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 0;
    border-top: 1px solid #eef0f3;
}

.billing-row:first-child {
    border-top: 0;
}

.billing-row span,
.muted {
    color: #6b7280;
}

.billing-row strong {
    text-align: right;
}

.usage-list {
    margin-top: 10px;
}

.agent {
    border-bottom: 1px solid #e5e7eb;
    padding: 15px 0;
}

.agent:last-child {
    border-bottom: 0;
}

.status {
    font-size: 13px;
    font-weight: bold;
}

.chat-box {
    min-height: 320px;
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    background: #fafafa;
}

.chat-row {
    margin-bottom: 12px;
}

.chat-row strong {
    display: block;
    margin-bottom: 4px;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
}

.chat-input button {
    background: #111827;
    color: white;
    min-width: 100px;
}

.conversation-item {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
}

.conversation-item:hover {
    background: #f9fafb;
}

.conversation-messages {
    margin-top: 20px;
}

.inbox-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}

.inbox-heading h2 {
    margin: 0 0 6px;
}

.inbox-filters {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(220px, 2fr) auto;
    gap: 12px;
    align-items: end;
    margin: 20px 0;
}

.inbox-filters label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
}

.inbox-search-button {
    height: 42px;
    margin-bottom: 8px;
    background: #111827;
    color: white;
}

.inbox-layout {
    display: grid;
    grid-template-columns: minmax(280px, 38%) minmax(0, 1fr);
    min-height: 560px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.inbox-list {
    border-right: 1px solid #e5e7eb;
    background: #fff;
    max-height: 680px;
    overflow-y: auto;
}

.inbox-item {
    width: 100%;
    border-radius: 0;
    background: #fff;
    color: #172033;
    text-align: left;
    padding: 16px;
    border-bottom: 1px solid #eef0f3;
}

.inbox-item:hover,
.inbox-item.selected {
    background: #f3f6fa;
}

.inbox-item-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.inbox-item-top span {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
}

.inbox-item p {
    margin: 9px 0 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.45;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.inbox-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.inbox-badge {
    display: inline-flex;
    border: 1px solid #dfe4ea;
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 700;
    background: #f8fafc;
    color: #475569;
}

.inbox-contact {
    margin-top: 7px;
    font-size: 12px;
    color: #6b7280;
}

.inbox-thread {
    margin: 0;
    padding: 20px;
    background: #fafbfc;
    min-width: 0;
    overflow-y: auto;
    max-height: 680px;
}

.inbox-thread-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 18px;
}

.inbox-thread-head h3 {
    margin: 0;
}

.inbox-message-list {
    display: grid;
    gap: 12px;
}

.inbox-message {
    max-width: 78%;
    border-radius: 12px;
    padding: 12px 14px;
    background: white;
    border: 1px solid #e5e7eb;
    line-height: 1.5;
}

.inbox-message.user {
    margin-left: auto;
    background: #eef2f7;
}

.inbox-message small {
    display: block;
    margin-top: 7px;
    color: #9ca3af;
}

.empty-state {
    padding: 28px 18px;
    color: #6b7280;
    text-align: center;
}

.capability-cards .card strong {
    font-size: 26px;
}

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

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

    .inbox-search-button {
        width: 100%;
    }

    .inbox-layout {
        grid-template-columns: 1fr;
    }

    .inbox-list {
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
        max-height: 360px;
    }
}

@media(max-width: 680px) {
    .portal {
        display: block;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
    }

    .main {
        padding: 20px;
    }

    .cards,
    .service-grid,
    .inbox-filters {
        grid-template-columns: 1fr;
    }

    .topbar,
    .billing-row,
    .service-card-head,
    .inbox-thread-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .billing-row strong {
        text-align: left;
    }

    .inbox-message {
        max-width: 94%;
    }
}


/* =========================================
   PASSWORD SECURITY UI
   ========================================= */

#login-screen button[onclick="showForgotPassword()"] {
    color: #2563eb !important;
    background: transparent !important;
    font-weight: 600;
}

#forgot-password-form p,
#reset-password-form p {
    color: #374151 !important;
}

#forgot-message,
#reset-message,
#change-password-message {
    color: #dc2626 !important;
    margin-top: 10px;
}

#forgot-password-form button,
#reset-password-form button {
    color: #ffffff;
}

#forgot-password-form button[onclick="showNormalLogin()"],
#reset-password-form button[onclick="showForgotPassword()"] {
    color: #374151 !important;
    background: #f3f4f6 !important;
}
