:root {
    --app-bg: #f3efe7;
    --app-bg-soft: #fbf8f2;
    --app-surface: rgba(255, 255, 255, 0.88);
    --app-surface-strong: #ffffff;
    --app-text: #17313c;
    --app-muted: #5c7480;
    --app-border: rgba(23, 49, 60, 0.12);
    --app-primary: #0f766e;
    --app-primary-strong: #0b5f58;
    --app-secondary: #d97706;
    --app-accent: #ef4444;
    --app-shadow: 0 24px 60px rgba(23, 49, 60, 0.12);
    --app-radius-xl: 28px;
    --app-radius-lg: 22px;
    --app-radius-md: 16px;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    color: var(--app-text);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 28%),
        radial-gradient(circle at top right, rgba(217, 119, 6, 0.14), transparent 24%),
        linear-gradient(180deg, #f7f2e9 0%, #eef4f3 52%, #f5f0e5 100%);
    font-family: "Instrument Sans", "Segoe UI", sans-serif;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand,
.app-eyebrow,
.page-title,
.metric-card__value,
.login-hero__title,
.chat-bubble__author,
.section-card__title {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

a {
    color: var(--app-primary);
}

.app-shell {
    position: relative;
    padding-bottom: 3rem;
}

.app-shell::before {
    content: "";
    position: fixed;
    inset: auto auto 10% -6rem;
    width: 18rem;
    height: 18rem;
    border-radius: 50%;
    background: rgba(15, 118, 110, 0.08);
    filter: blur(10px);
    pointer-events: none;
    z-index: 0;
}

.app-nav {
    position: sticky;
    top: 1rem;
    z-index: 1020;
    margin: 1rem auto 0;
    padding: 0.9rem 1rem;
    max-width: 1200px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
    box-shadow: 0 16px 44px rgba(23, 49, 60, 0.1);
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.05rem;
    letter-spacing: 0.03em;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--app-primary), #57b0a4);
    color: #fff;
    box-shadow: 0 12px 24px rgba(15, 118, 110, 0.28);
}

.navbar-nav .nav-link {
    padding: 0.6rem 0.95rem;
    border-radius: 999px;
    font-weight: 600;
    color: var(--app-muted);
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link:hover,
.dropdown-item.active,
.dropdown-item:active {
    color: var(--app-primary-strong);
    background: rgba(15, 118, 110, 0.12);
}

.app-main {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem 0;
}

.app-page {
    animation: page-rise 320ms ease-out;
}

@keyframes page-rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 2rem;
    margin-bottom: 1.75rem;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: var(--app-radius-xl);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(244, 251, 250, 0.82)),
        linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(217, 119, 6, 0.08));
    box-shadow: var(--app-shadow);
}

.app-eyebrow {
    display: inline-block;
    margin-bottom: 0.7rem;
    color: var(--app-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.page-title {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 0.95;
}

.page-subtitle {
    max-width: 44rem;
    margin: 0.85rem 0 0;
    color: var(--app-muted);
    font-size: 1rem;
}

.page-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
}

.btn {
    border-radius: 999px;
    font-weight: 700;
}

.btn-primary {
    border-color: var(--app-primary);
    background: linear-gradient(135deg, var(--app-primary), #1f968c);
    box-shadow: 0 14px 28px rgba(15, 118, 110, 0.22);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--app-primary-strong);
    background: linear-gradient(135deg, var(--app-primary-strong), #177f75);
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger,
.btn-info {
    border-width: 1px;
}

.btn-info {
    color: #fff;
    border-color: #0f8d8f;
    background: linear-gradient(135deg, #0f8d8f, #2cb6a3);
}

.app-alerts .alert,
.alert {
    border: 0;
    border-radius: var(--app-radius-md);
    box-shadow: 0 14px 32px rgba(23, 49, 60, 0.08);
}

.section-card,
.card,
.modal-content,
.calendar-shell,
.metric-card,
.timeline-card,
.prompt-card,
.connection-card,
.login-shell__card {
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    backdrop-filter: blur(14px);
    box-shadow: var(--app-shadow);
}

.card,
.modal-content {
    overflow: hidden;
}

.card-header,
.section-card__header {
    padding: 1.2rem 1.4rem 0;
    border-bottom: 0;
    background: transparent;
}

.card-body,
.section-card__body {
    padding: 1.4rem;
}

.section-card__title {
    margin: 0;
    font-size: 1.1rem;
}

.section-card__subtitle {
    margin-top: 0.4rem;
    color: var(--app-muted);
    font-size: 0.95rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.metric-card {
    padding: 1.2rem;
    min-height: 150px;
}

.metric-card__label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--app-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.metric-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 16px;
    background: rgba(15, 118, 110, 0.12);
    color: var(--app-primary);
}

.metric-card__value {
    margin-top: 1.1rem;
    font-size: 2.2rem;
    line-height: 1;
}

.metric-card__hint {
    margin-top: 0.7rem;
    color: var(--app-muted);
    font-size: 0.92rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.9fr);
    gap: 1rem;
}

.calendar-shell {
    padding: 1.2rem;
}

.fc {
    max-width: 100%;
    margin: 0 auto;
}

.fc .fc-toolbar-title {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 1.15rem;
}

.fc .fc-button {
    border-radius: 999px;
    border: 0;
    font-weight: 700;
    box-shadow: none !important;
}

.fc .fc-button-primary {
    background-color: rgba(15, 118, 110, 0.18);
    color: var(--app-primary-strong);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active,
.fc .fc-button-primary:hover {
    background-color: var(--app-primary);
    color: #fff;
}

.timeline-list {
    display: grid;
    gap: 0.9rem;
}

.timeline-item {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    padding: 0.95rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--app-border);
}

.timeline-item__date {
    padding: 0.6rem 0.75rem;
    border-radius: 16px;
    background: rgba(15, 118, 110, 0.1);
    text-align: center;
    font-weight: 700;
    color: var(--app-primary-strong);
}

.timeline-item__title {
    margin: 0;
    font-size: 1rem;
}

.timeline-item__meta {
    margin-top: 0.35rem;
    color: var(--app-muted);
    font-size: 0.92rem;
}

.timeline-item__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.55rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(217, 119, 6, 0.12);
    color: #a15b06;
    font-size: 0.75rem;
    font-weight: 700;
}

.chat-grid {
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    gap: 1rem;
}

.prompt-card,
.chat-card,
.support-card {
    padding: 1.3rem;
}

.prompt-chip-list {
    display: grid;
    gap: 0.75rem;
}

.prompt-chip {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--app-text);
    text-align: left;
    transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.prompt-chip:hover,
.prompt-chip:focus {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.24);
    background: rgba(15, 118, 110, 0.08);
}

.chat-card {
    display: grid;
    gap: 1rem;
}

.chat-card__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.chat-state {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chat-state__pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(23, 49, 60, 0.06);
    color: var(--app-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.chat-messages {
    display: grid;
    gap: 0.95rem;
    min-height: 420px;
}

.chat-empty-state {
    padding: 1.15rem;
    border-radius: 20px;
    background: rgba(15, 118, 110, 0.08);
    color: var(--app-primary-strong);
}

.chat-message-row {
    display: flex;
}

.chat-message-row--user {
    justify-content: flex-end;
}

.chat-bubble {
    width: min(100%, 780px);
    padding: 1rem 1.1rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--app-border);
}

.chat-bubble--user {
    background: linear-gradient(135deg, var(--app-primary), #1a8c82);
    color: #fff;
    border-color: transparent;
}

.chat-bubble__author {
    font-size: 0.86rem;
    font-weight: 700;
}

.chat-bubble__meta {
    margin-top: 0.25rem;
    font-size: 0.74rem;
    opacity: 0.72;
}

.chat-bubble__content {
    margin-top: 0.7rem;
    white-space: pre-wrap;
}

.chat-action-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.9rem;
}

.chat-action-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.chat-action-pill--success {
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
}

.chat-action-pill--error {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.chat-composer {
    display: grid;
    gap: 0.85rem;
}

.chat-composer textarea,
.form-control,
.form-select {
    border-color: rgba(23, 49, 60, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--app-text);
}

.chat-composer textarea {
    min-height: 132px;
    resize: vertical;
}

.chat-composer__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: center;
}

.support-card__list,
.connection-highlights,
.settings-grid {
    display: grid;
    gap: 0.9rem;
}

.support-stat {
    display: grid;
    gap: 0.35rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--app-border);
}

.support-stat__label {
    color: var(--app-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.support-stat__value {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 1.45rem;
}

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

.connection-grid,
.manager-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.connection-card {
    padding: 1.4rem;
}

.connection-card__header,
.manager-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-badge--success {
    color: #166534;
    background: rgba(34, 197, 94, 0.12);
}

.status-badge--muted {
    color: var(--app-muted);
    background: rgba(23, 49, 60, 0.08);
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 420px);
    gap: 1.3rem;
    align-items: stretch;
    min-height: calc(100vh - 8rem);
}

.login-hero {
    position: relative;
    overflow: hidden;
    padding: 2.4rem;
    border-radius: var(--app-radius-xl);
    background: linear-gradient(145deg, rgba(15, 118, 110, 0.95), rgba(12, 90, 96, 0.92));
    color: #fff;
    box-shadow: 0 24px 60px rgba(11, 95, 88, 0.3);
}

.login-hero::after {
    content: "";
    position: absolute;
    inset: auto -2rem -5rem auto;
    width: 12rem;
    height: 12rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.login-hero__title {
    max-width: 14ch;
    margin: 0 0 1rem;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 0.92;
}

.login-hero__copy {
    max-width: 30rem;
    font-size: 1.02rem;
    color: rgba(255, 255, 255, 0.86);
}

.login-hero__list {
    display: grid;
    gap: 0.9rem;
    margin-top: 2rem;
}

.login-hero__item {
    padding: 1rem 1.05rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
}

.login-shell__card {
    padding: 2rem;
    align-self: center;
}

.app-footer {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding: 1.2rem 1rem 2rem;
    color: var(--app-muted);
}

.app-footer__inner {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(23, 49, 60, 0.12);
}

.small-muted {
    color: var(--app-muted);
    font-size: 0.9rem;
}

@media (max-width: 991px) {
    .metric-grid,
    .dashboard-grid,
    .chat-grid,
    .connection-grid,
    .manager-grid,
    .settings-grid,
    .login-shell {
        grid-template-columns: 1fr;
    }

    .app-nav {
        border-radius: 28px;
    }

    .page-header {
        padding: 1.5rem;
    }
}

@media (max-width: 575px) {
    .app-main {
        padding-top: 1.4rem;
    }

    .page-header {
        padding: 1.25rem;
    }

    .card-body,
    .chat-card,
    .prompt-card,
    .support-card,
    .connection-card,
    .login-shell__card {
        padding: 1.05rem;
    }

    .timeline-item {
        grid-template-columns: 1fr;
    }

    .chat-composer__actions {
        align-items: stretch;
    }
}
