:root {
    --primary-brown: #7a4e2d;
    --dark-brown: #4a2c1a;
    --soft-brown: #a67c52;
    --gold: #c9a227;
    --soft-gold: #e8d8a8;
    --cream: #f8f3ea;
    --ivory: #fffdf7;
    --warm-beige: #efe2d0;
    --soft-taupe: #d8c3a5;
    --text-dark: #2f241d;
    --text-muted: #7b6a5a;
    --success-soft: #8fae8b;
    --warning-soft: #d9a441;
    --danger-soft: #c97a6a;
    --info-soft: #8ba6a9;
    --shadow-soft: 0 18px 45px rgba(74, 44, 26, 0.10);
    --shadow-card: 0 12px 30px rgba(74, 44, 26, 0.08);
}

* {
    box-sizing: border-box;
}

body.gayatri-app {
    min-height: 100vh;
    margin: 0;
    color: var(--text-dark);
    background:
        radial-gradient(circle at top left, rgba(232, 216, 168, 0.55), transparent 34rem),
        linear-gradient(135deg, var(--cream), var(--ivory) 54%, #f3eadb);
    font-family: Inter, Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 18rem minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1rem;
    overflow-y: auto;
    color: var(--ivory);
    background:
        linear-gradient(180deg, rgba(74, 44, 26, 0.98), rgba(122, 78, 45, 0.96)),
        radial-gradient(circle at 20% 0%, rgba(201, 162, 39, 0.22), transparent 18rem);
    box-shadow: 12px 0 35px rgba(74, 44, 26, 0.14);
    z-index: 40;
}

.brand-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem;
    border: 1px solid rgba(232, 216, 168, 0.25);
    border-radius: 1.35rem;
    background: rgba(255, 253, 247, 0.09);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 1rem;
    color: var(--dark-brown);
    background: linear-gradient(135deg, var(--soft-gold), var(--gold));
    box-shadow: 0 10px 22px rgba(201, 162, 39, 0.25);
}

.brand-title {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.brand-subtitle {
    margin: 0.15rem 0 0;
    color: rgba(255, 253, 247, 0.68);
    font-size: 0.78rem;
}

.nav-section {
    margin-top: 1.2rem;
}

.nav-label {
    margin: 1rem 0 0.45rem 0.75rem;
    color: rgba(255, 253, 247, 0.56);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    min-height: 44px;
    margin-bottom: 0.25rem;
    padding: 0.72rem 0.78rem;
    border-radius: 0.95rem;
    color: rgba(255, 253, 247, 0.78);
    transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-link:hover,
.nav-link.is-active {
    color: var(--ivory);
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.26), rgba(255, 253, 247, 0.08));
    transform: translateX(2px);
}

.nav-link i,
.nav-link svg {
    width: 1.1rem;
    height: 1.1rem;
    color: var(--soft-gold);
}

.main-panel {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.5rem;
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid rgba(216, 195, 165, 0.62);
    background: rgba(248, 243, 234, 0.86);
    backdrop-filter: blur(18px);
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: min(32rem, 100%);
    min-height: 44px;
    padding: 0 0.9rem;
    border: 1px solid var(--soft-taupe);
    border-radius: 999px;
    background: rgba(255, 253, 247, 0.82);
}

.topbar-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-dark);
}

.page-content {
    padding: 1.5rem;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.eyebrow {
    margin: 0 0 0.35rem;
    color: var(--soft-brown);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-title {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.05;
    color: var(--dark-brown);
}

.page-description {
    max-width: 45rem;
    margin: 0.55rem 0 0;
    color: var(--text-muted);
    line-height: 1.7;
}

.grid {
    display: grid;
    gap: 1rem;
}

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

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

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

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

.card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(216, 195, 165, 0.82);
    border-radius: 1.35rem;
    background: rgba(255, 253, 247, 0.90);
    box-shadow: var(--shadow-card);
}

.card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), rgba(201, 162, 39, 0.12));
}

.card-body {
    position: relative;
    padding: 1.15rem;
}

.stat-card {
    min-height: 9.2rem;
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.icon-circle {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 1rem;
    color: var(--gold);
    background: rgba(122, 78, 45, 0.10);
}

.stat-label {
    margin: 1rem 0 0.25rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat-value {
    margin: 0;
    color: var(--dark-brown);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.stat-note {
    margin: 0.4rem 0 0;
    color: var(--soft-brown);
    font-size: 0.8rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.72rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.9rem;
    cursor: pointer;
    font-weight: 700;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: var(--ivory);
    background: linear-gradient(135deg, var(--primary-brown), var(--dark-brown));
    box-shadow: 0 12px 24px rgba(74, 44, 26, 0.16);
}

.button-secondary {
    color: var(--dark-brown);
    border-color: var(--soft-taupe);
    background: linear-gradient(135deg, var(--ivory), var(--soft-gold));
}

.button-ghost {
    color: var(--primary-brown);
    border-color: rgba(216, 195, 165, 0.8);
    background: rgba(255, 253, 247, 0.72);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.75rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
}

.badge-gold {
    color: var(--dark-brown);
    background: rgba(232, 216, 168, 0.95);
}

.badge-green {
    color: #263f29;
    background: rgba(143, 174, 139, 0.28);
}

.badge-red {
    color: #6e3128;
    background: rgba(201, 122, 106, 0.24);
}

.badge-brown {
    color: var(--ivory);
    background: rgba(122, 78, 45, 0.82);
}

.section-title {
    margin: 0 0 0.8rem;
    color: var(--dark-brown);
    font-size: 1rem;
    font-weight: 800;
}

.soft-list {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.soft-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.78rem;
    border: 1px solid rgba(216, 195, 165, 0.56);
    border-radius: 1rem;
    background: rgba(248, 243, 234, 0.72);
}

.muted {
    color: var(--text-muted);
}

.pagination {
    display: grid;
    gap: 0.65rem;
}

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.35rem;
    min-height: 2.35rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(216, 195, 165, 0.78);
    border-radius: 0.75rem;
    color: var(--primary-brown);
    background: rgba(255, 253, 247, 0.78);
    font-size: 0.86rem;
    font-weight: 800;
}

.pagination-link.is-active {
    color: var(--ivory);
    border-color: var(--primary-brown);
    background: linear-gradient(135deg, var(--primary-brown), var(--dark-brown));
}

.pagination-link.is-disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.pagination-summary {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.table-card {
    width: 100%;
    border-collapse: collapse;
}

.table-card th,
.table-card td {
    padding: 0.85rem;
    border-bottom: 1px solid rgba(216, 195, 165, 0.64);
    text-align: left;
}

.table-card th {
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-layout {
    display: grid;
    grid-template-columns: 19rem minmax(0, 1fr) 18rem;
    gap: 1rem;
    min-height: calc(100vh - 8.8rem);
}

.chat-layout-vertical {
    grid-template-columns: 1fr;
    align-items: start;
}

.inbox-conversation-list {
    max-height: 24rem;
    margin-top: 1rem;
    padding-right: 0.35rem;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.78rem;
    border: 1px solid transparent;
    border-radius: 1rem;
    cursor: pointer;
}

.conversation-item.is-active,
.conversation-item:hover {
    border-color: rgba(201, 162, 39, 0.34);
    background: rgba(232, 216, 168, 0.38);
}

.avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 999px;
    color: var(--dark-brown);
    background: linear-gradient(135deg, var(--soft-gold), var(--warm-beige));
    font-weight: 800;
}

.chat-window {
    display: flex;
    flex-direction: column;
    min-height: 34rem;
}

.chat-messages {
    display: grid;
    align-content: start;
    gap: 0.75rem;
    min-height: 22rem;
    max-height: 34rem;
    overflow-y: auto;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(248, 243, 234, 0.75), rgba(255, 253, 247, 0.86));
}

.chat-history-limit {
    justify-self: center;
    max-width: 42rem;
    padding: 0.65rem 0.9rem;
    border: 1px dashed rgba(166, 124, 82, 0.45);
    border-radius: 999px;
    background: rgba(255, 253, 247, 0.82);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
}

.bubble {
    width: fit-content;
    max-width: min(36rem, 82%);
    padding: 0.8rem 0.95rem;
    border-radius: 1.1rem;
    line-height: 1.55;
}

.bubble-incoming {
    border-top-left-radius: 0.35rem;
    background: var(--warm-beige);
}

.bubble-outgoing {
    justify-self: end;
    color: var(--ivory);
    border-top-right-radius: 0.35rem;
    background: var(--soft-brown);
}

.bubble-ai {
    border: 1px solid rgba(201, 162, 39, 0.34);
    background: rgba(232, 216, 168, 0.68);
}

.reply-box {
    display: flex;
    gap: 0.7rem;
    padding: 1rem;
    border-top: 1px solid rgba(216, 195, 165, 0.68);
}

.input {
    width: 100%;
    min-height: 44px;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--soft-taupe);
    border-radius: 0.9rem;
    outline: none;
    color: var(--text-dark);
    background: rgba(255, 253, 247, 0.96);
}

.input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(232, 216, 168, 0.55);
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 16rem;
    padding: 2rem;
    text-align: center;
}

.empty-state .icon-circle {
    margin: 0 auto 1rem;
    width: 3.4rem;
    height: 3.4rem;
}

.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 0.8rem;
    background: rgba(216, 195, 165, 0.55);
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 253, 247, 0.52), transparent);
    animation: skeleton-pulse 1.35s infinite;
}

.skeleton-line {
    height: 0.85rem;
}

.skeleton-card {
    height: 8.2rem;
}

@keyframes skeleton-pulse {
    100% {
        transform: translateX(100%);
    }
}

.mobile-toggle {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(24rem, 0.95fr);
    gap: 2rem;
    min-height: 100vh;
    padding: clamp(1rem, 4vw, 3rem);
}

.login-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    min-height: 34rem;
    padding: clamp(1.3rem, 4vw, 2.4rem);
    border: 1px solid rgba(216, 195, 165, 0.75);
    border-radius: 2rem;
    color: var(--ivory);
    background:
        linear-gradient(135deg, rgba(74, 44, 26, 0.94), rgba(122, 78, 45, 0.82)),
        radial-gradient(circle at 20% 10%, rgba(232, 216, 168, 0.38), transparent 19rem);
    box-shadow: var(--shadow-soft);
}

.login-hero::after {
    content: "";
    position: absolute;
    right: -6rem;
    bottom: -6rem;
    width: 22rem;
    height: 22rem;
    border: 1px solid rgba(232, 216, 168, 0.18);
    border-radius: 999px;
}

.login-card {
    align-self: center;
    width: min(100%, 31rem);
    margin: auto;
    padding: clamp(1.25rem, 4vw, 2rem);
    border: 1px solid rgba(216, 195, 165, 0.82);
    border-radius: 1.7rem;
    background: rgba(255, 253, 247, 0.94);
    box-shadow: var(--shadow-soft);
}

.login-feature-list {
    display: grid;
    gap: 0.8rem;
    margin: 2rem 0 0;
    padding: 0;
    list-style: none;
}

.login-feature-list li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: rgba(255, 253, 247, 0.82);
}

@media (max-width: 1180px) {
    .grid-4,
    .grid-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chat-layout {
        grid-template-columns: 17rem minmax(0, 1fr);
    }

    .customer-side {
        display: none;
    }

    .chat-layout-vertical .customer-side {
        display: block;
    }
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero {
        min-height: auto;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(19rem, 86vw);
        transform: translateX(-105%);
        transition: transform 220ms ease;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-backdrop.is-open {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(74, 44, 26, 0.38);
        z-index: 35;
    }

    .mobile-toggle {
        display: inline-flex;
    }

    .topbar {
        padding: 0.8rem 1rem;
    }

    .topbar-search {
        display: none;
    }

    .page-content {
        padding: 1rem;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .grid-3,
    .grid-4,
    .grid-5,
    .grid-2 {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 680px) {
    .table-card thead {
        display: none;
    }

    .table-card,
    .table-card tbody,
    .table-card tr,
    .table-card td {
        display: block;
        width: 100%;
    }

    .table-card tr {
        margin-bottom: 0.8rem;
        border: 1px solid rgba(216, 195, 165, 0.68);
        border-radius: 1rem;
        background: rgba(255, 253, 247, 0.82);
    }

    .table-card td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        border-bottom: 1px solid rgba(216, 195, 165, 0.46);
    }

    .table-card td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-weight: 800;
    }

    .reply-box {
        position: sticky;
        bottom: 0;
        flex-direction: column;
        background: var(--ivory);
    }
}
