:root {
    --bg-cream: #fff7ed;
    --bg-sky: #dbeafe;
    --bg-mint: #d1fae5;
    --ink: #162033;
    --ink-soft: #53607a;
    --line: rgba(22, 32, 51, 0.12);
    --card: rgba(255, 255, 255, 0.82);
    --card-strong: rgba(255, 255, 255, 0.92);
    --accent: #ea580c;
    --accent-dark: #9a3412;
    --amber: #f59e0b;
    --teal: #0f766e;
    --teal-soft: #14b8a6;
    --danger: #dc2626;
    --success: #15803d;
    --info: #1d4ed8;
    --shadow: 0 30px 80px rgba(27, 44, 71, 0.16);
    --heading-font: Cambria, Georgia, "Times New Roman", serif;
    --body-font: Aptos, "Trebuchet MS", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--body-font);
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(251, 191, 36, 0.28), transparent 28rem),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.24), transparent 30rem),
        linear-gradient(135deg, var(--bg-cream), var(--bg-sky) 58%, var(--bg-mint));
}

body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(8px);
}

body::before {
    width: 18rem;
    height: 18rem;
    top: 4rem;
    right: 8%;
    background: rgba(249, 115, 22, 0.12);
}

body::after {
    width: 24rem;
    height: 24rem;
    left: -4rem;
    bottom: -5rem;
    background: rgba(13, 148, 136, 0.16);
}

.page-shell,
.dashboard-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0;
}

.page-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    gap: 1.5rem;
    align-items: center;
}

.dashboard-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: stretch;
}

.brand-panel,
.auth-card,
.side-panel,
.workspace-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.46);
    border-radius: 32px;
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.brand-panel {
    padding: 3rem;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));
}

.brand-panel::after,
.side-panel::after {
    content: "";
    position: absolute;
    inset: auto -4rem -4rem auto;
    width: 14rem;
    height: 14rem;
    border-radius: 3rem;
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.16), rgba(14, 165, 233, 0.18));
    transform: rotate(24deg);
}

.brand-panel__badge,
.auth-card__eyebrow,
.workspace-header__eyebrow,
.status-pill,
.hero-card__eyebrow,
.content-card__eyebrow,
.side-panel__role {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    font-size: 0.84rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.brand-panel__badge,
.auth-card__eyebrow,
.hero-card__eyebrow,
.content-card__eyebrow {
    background: rgba(234, 88, 12, 0.1);
    color: var(--accent-dark);
}

.workspace-header__eyebrow,
.status-pill,
.side-panel__role {
    background: rgba(15, 118, 110, 0.12);
    color: var(--teal);
}

.side-panel__role--admin,
.role-badge--admin {
    background: rgba(234, 88, 12, 0.12);
    color: var(--accent-dark);
}

.side-panel__role--member,
.role-badge--member {
    background: rgba(15, 118, 110, 0.12);
    color: var(--teal);
}

.brand-panel h1,
.auth-card h2,
.workspace-card h2,
.side-panel h1 {
    margin: 1rem 0 0.75rem;
    font-family: var(--heading-font);
    font-size: clamp(2.2rem, 4vw, 4rem);
    line-height: 1;
}

.auth-card h2,
.workspace-card h2,
.side-panel h1 {
    font-size: clamp(1.9rem, 3vw, 2.8rem);
}

.brand-panel__copy,
.side-panel p,
.hero-card p,
.content-card__copy,
.stat-card p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 1rem;
    line-height: 1.75;
}

.feature-list,
.side-panel__cards,
.stats-grid,
.insight-grid,
.profile-grid {
    display: grid;
    gap: 1rem;
}

.feature-list {
    margin-top: 2rem;
}

.feature-card,
.mini-card,
.stat-card,
.content-card {
    padding: 1.1rem 1.15rem;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
}

.feature-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.feature-card__icon {
    min-width: 2.75rem;
    min-height: 2.75rem;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.16), rgba(20, 184, 166, 0.18));
    color: var(--accent-dark);
    font-weight: 700;
}

.feature-card h2,
.workspace-card h3,
.content-card h3 {
    margin: 0 0 0.4rem;
    font-family: var(--heading-font);
    font-size: 1.4rem;
}

.feature-card p,
.mini-card__label,
.stat-card__label,
.muted-note,
.user-table__subtext {
    margin: 0;
    color: var(--ink-soft);
}

.auth-card,
.workspace-card,
.side-panel {
    background: var(--card);
}

.auth-card,
.workspace-card {
    padding: 2rem;
}

.side-panel {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.side-panel__top,
.side-panel__logout {
    position: relative;
    z-index: 1;
}

.auth-card__header,
.workspace-header,
.hero-card {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.workspace-header__highlight {
    min-width: 180px;
    padding: 1rem 1.1rem;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid var(--line);
    text-align: right;
}

.workspace-header__highlight span {
    display: block;
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.workspace-header__highlight strong {
    font-size: 1.08rem;
}

.panel-toggle,
.workspace-nav {
    display: grid;
    gap: 0.45rem;
}

.panel-toggle {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0.3rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--line);
}

.workspace-nav {
    position: relative;
    z-index: 1;
}

.panel-toggle__button,
.workspace-nav__button,
.button,
.password-toggle {
    font: inherit;
    cursor: pointer;
    border: 0;
}

.panel-toggle__button,
.workspace-nav__button {
    min-width: 6.75rem;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    color: var(--ink-soft);
    background: rgba(255, 255, 255, 0.8);
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.panel-toggle__button[aria-selected="true"],
.workspace-nav__button[aria-selected="true"] {
    background: linear-gradient(135deg, #f97316, #fb923c);
    color: white;
    box-shadow: 0 12px 24px rgba(249, 115, 22, 0.28);
}

.workspace-nav__button {
    text-align: left;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.alert,
.inline-message {
    margin-top: 1.25rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    font-size: 0.96rem;
}

.alert--success,
.inline-message {
    border: 1px solid rgba(21, 128, 61, 0.16);
    background: rgba(220, 252, 231, 0.9);
}

.alert--error,
.inline-message--error {
    border: 1px solid rgba(220, 38, 38, 0.14);
    background: rgba(254, 242, 242, 0.9);
}

.alert--info {
    border: 1px solid rgba(29, 78, 216, 0.12);
    background: rgba(239, 246, 255, 0.9);
}

.form-stage,
.workspace-stage {
    margin-top: 1.75rem;
}

.auth-form,
.stack-form {
    display: grid;
    gap: 1rem;
}

.auth-form {
    display: none;
}

[data-auth-card][data-active-panel="login"] .auth-form[data-panel="login"],
[data-auth-card][data-active-panel="register"] .auth-form[data-panel="register"],
[data-dashboard-shell][data-active-view="overview"] .workspace-view[data-view="overview"],
[data-dashboard-shell][data-active-view="profile"] .workspace-view[data-view="profile"],
[data-dashboard-shell][data-active-view="messages"] .workspace-view[data-view="messages"],
[data-dashboard-shell][data-active-view="admin"] .workspace-view[data-view="admin"] {
    display: grid;
    animation: fade-up 220ms ease;
}

.workspace-view {
    display: none;
    gap: 1rem;
}

.field {
    display: grid;
    gap: 0.5rem;
    font-size: 0.96rem;
    color: var(--ink);
}

.field input,
.field textarea {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(22, 32, 51, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink);
    font: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.field textarea {
    resize: vertical;
    min-height: 7rem;
}

.field input::placeholder,
.field textarea::placeholder {
    color: rgba(83, 96, 122, 0.7);
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: rgba(249, 115, 22, 0.65);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.14);
    background: white;
}

.field__error,
.strength-meter__text {
    color: var(--ink-soft);
    line-height: 1.5;
}

.field__error {
    color: var(--danger);
}

.password-input {
    position: relative;
    display: block;
}

.password-input input {
    padding-right: 4.75rem;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.6rem;
    transform: translateY(-50%);
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(22, 32, 51, 0.08);
    color: var(--ink);
}

.password-toggle:hover,
.panel-toggle__button:hover,
.workspace-nav__button:hover,
.button:hover {
    transform: translateY(-1px);
}

.strength-meter {
    display: block;
    width: 100%;
    height: 0.6rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(22, 32, 51, 0.08);
}

.strength-meter__bar {
    display: block;
    width: 25%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f97316, #fb923c);
    transition: width 180ms ease, background 180ms ease;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.95rem 1.2rem;
    border-radius: 18px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    font-weight: 700;
    box-shadow: 0 18px 30px rgba(234, 88, 12, 0.24);
    transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
    text-decoration: none;
}

.button--secondary {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    box-shadow: 0 18px 30px rgba(13, 148, 136, 0.2);
}

.button--ghost {
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    box-shadow: none;
    border: 1px solid var(--line);
    padding: 0.75rem 0.95rem;
}

.button--block {
    width: 100%;
}

.hero-card {
    padding: 1.35rem;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 247, 237, 0.84));
    border: 1px solid rgba(255, 255, 255, 0.46);
}

.hero-card__stack {
    display: grid;
    gap: 0.75rem;
    justify-items: end;
}

.status-pill--soft {
    background: rgba(29, 78, 216, 0.1);
    color: var(--info);
}

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

.stat-card strong,
.mini-card strong {
    display: block;
    margin: 0.3rem 0 0.4rem;
    font-size: 2rem;
    font-family: var(--heading-font);
}

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

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

.content-card--accent {
    background: linear-gradient(160deg, rgba(234, 88, 12, 0.12), rgba(20, 184, 166, 0.1));
}

.content-card--wide {
    padding-bottom: 1.4rem;
}

.plain-list {
    margin: 0.9rem 0;
    padding-left: 1.2rem;
    color: var(--ink-soft);
    line-height: 1.75;
}

.mini-card__label,
.stat-card__label {
    display: block;
    font-size: 0.92rem;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 1rem;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.user-table th,
.user-table td {
    padding: 1rem 0.85rem;
    border-bottom: 1px solid rgba(22, 32, 51, 0.08);
    text-align: left;
    vertical-align: top;
}

.user-table th {
    font-size: 0.86rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

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

.inline-form {
    margin: 0;
}

.messenger-shell {
    display: grid;
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.contacts-card,
.conversation-card {
    padding: 1.2rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.contacts-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.contact-card {
    display: grid;
    gap: 0.45rem;
    width: 100%;
    padding: 1rem;
    border-radius: 20px;
    border: 1px solid rgba(22, 32, 51, 0.08);
    background: rgba(255, 255, 255, 0.78);
    text-align: left;
    color: var(--ink);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.contact-card:hover,
.contact-card.is-active {
    transform: translateY(-1px);
    border-color: rgba(249, 115, 22, 0.35);
    box-shadow: 0 14px 30px rgba(22, 32, 51, 0.08);
}

.contact-card__top,
.contact-card__footer,
.conversation-card__header,
.conversation-card__actions,
.message-composer__footer {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
}

.contact-card__top,
.conversation-card__actions,
.message-composer__footer {
    flex-wrap: wrap;
}

.contact-card__meta,
.contact-card__preview,
.message-bubble__meta,
.message-composer__hint {
    color: var(--ink-soft);
}

.contact-card__preview {
    line-height: 1.5;
}

.unread-badge {
    min-width: 1.6rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
}

.call-status {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: rgba(239, 246, 255, 0.9);
    border: 1px solid rgba(29, 78, 216, 0.12);
    color: var(--info);
}

.video-stage {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.video-stage.is-idle video {
    opacity: 0.45;
}

.video-card {
    margin: 0;
    padding: 0.9rem;
    border-radius: 22px;
    background: linear-gradient(160deg, rgba(22, 32, 51, 0.92), rgba(46, 58, 86, 0.88));
    color: white;
}

.video-card video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    object-fit: cover;
}

.video-card figcaption {
    margin-top: 0.65rem;
    color: rgba(255, 255, 255, 0.8);
}

.message-stream {
    display: grid;
    gap: 0.85rem;
    max-height: 28rem;
    margin-top: 1rem;
    padding: 0.3rem 0.1rem 0.3rem 0;
    overflow-y: auto;
}

.message-bubble {
    max-width: min(34rem, 86%);
    padding: 0.95rem 1rem;
    border-radius: 20px 20px 20px 6px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(22, 32, 51, 0.08);
}

.message-bubble--mine {
    justify-self: end;
    border-radius: 20px 20px 6px 20px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.16), rgba(255, 255, 255, 0.92));
}

.message-bubble__body {
    line-height: 1.65;
    white-space: pre-wrap;
}

.message-bubble__meta {
    margin-top: 0.45rem;
    font-size: 0.82rem;
}

.message-composer {
    margin-top: 1rem;
}

.message-composer textarea {
    min-height: 6.5rem;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 0.35rem;
    min-height: 12rem;
    padding: 1.2rem;
    border-radius: 22px;
    border: 1px dashed rgba(22, 32, 51, 0.18);
    color: var(--ink-soft);
    text-align: center;
}

.compact-empty {
    min-height: 9rem;
}

.is-hidden {
    display: none !important;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@media (max-width: 1040px) {
    .page-shell,
    .dashboard-shell {
        grid-template-columns: 1fr;
        padding: 1rem 0 2rem;
    }

    .brand-panel,
    .auth-card,
    .side-panel,
    .workspace-card {
        border-radius: 28px;
    }

    .brand-panel,
    .auth-card,
    .workspace-card,
    .side-panel {
        padding: 1.5rem;
    }

    .stats-grid,
    .insight-grid,
    .profile-grid,
    .messenger-shell {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .page-shell,
    .dashboard-shell {
        width: min(100% - 1rem, 42rem);
        gap: 1rem;
    }

    .brand-panel h1,
    .auth-card h2,
    .workspace-card h2,
    .side-panel h1 {
        line-height: 1.08;
    }

    .auth-card__header,
    .workspace-header,
    .hero-card {
        flex-direction: column;
    }

    .panel-toggle,
    .panel-toggle__button,
    .workspace-nav__button,
    .workspace-header__highlight {
        width: 100%;
    }

    .stats-grid,
    .insight-grid,
    .profile-grid,
    .messenger-shell,
    .video-stage {
        grid-template-columns: 1fr;
    }

    .hero-card__stack {
        justify-items: start;
    }
}
