:root {
    color-scheme: light;
    font-family: Inter, system-ui, sans-serif;
    line-height: 1.5;
    color: #241b22;
    background: #f7f5f7;
    --surface: #fff;
    --border: #e7dfe6;
    --muted: #635762;
    --brand: #862846;
    --brand-dark: #671b36;
    --brand-soft: #faedf2;
    --focus: #6339a1;
    --shadow: 0 12px 36px rgb(54 21 43 / 7%);
}

* { box-sizing: border-box; }

body { margin: 0; }
a { color: var(--brand-dark); }
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.skip-link {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    transform: translateY(-160%);
    padding: 12px 16px;
    color: #fff;
    background: var(--brand-dark);
    border-radius: 8px;
}

.skip-link:focus { transform: translateY(0); }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 72px;
    max-width: 1160px;
    margin-inline: auto;
    padding: 10px clamp(16px, 4vw, 36px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: inherit;
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -.04em;
    text-decoration: none;
    white-space: nowrap;
}

.brand-label { color: var(--brand); }

.brand-mark {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 3px;
    width: 34px;
    height: 34px;
    padding: 8px;
    border-radius: 10px;
    background: var(--brand-dark);
}

.brand-mark i { width: 4px; height: 7px; border-radius: 2px; background: #fff; }
.brand-mark i:nth-child(2) { height: 12px; }
.brand-mark i:nth-child(3) { height: 17px; }

.account {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 16px);
    min-width: 0;
}

.account > span {
    overflow: hidden;
    color: var(--muted);
    font-size: .875rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.container {
    width: min(100%, 1160px);
    margin-inline: auto;
    padding: clamp(24px, 6vw, 68px) clamp(16px, 4vw, 36px);
}

h1 {
    margin: 0 0 24px;
    font-size: clamp(1.875rem, 5vw, 2.65rem);
    font-weight: 800;
    line-height: 1.14;
    letter-spacing: -.055em;
    overflow-wrap: anywhere;
}

.panel {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

button, .secondary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #fff;
    background: var(--brand);
    cursor: pointer;
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 160ms ease;
}

button:hover { background: var(--brand-dark); }

.secondary {
    border-color: var(--border);
    color: #433442;
    background: var(--surface);
}

.secondary:hover { background: var(--brand-soft); }

.guest-page {
    min-height: 100vh;
    background: radial-gradient(ellipse at 16% 10%, #f7e8ef, transparent 56%), #f7f5f7;
}

.guest-page .container { padding-block: clamp(24px, 8vw, 104px); }

.login-layout {
    display: grid;
    gap: 12px;
    max-width: 980px;
    margin-inline: auto;
}

.login-intro {
    position: relative;
    isolation: isolate;
    display: grid;
    align-content: center;
    min-height: 225px;
    overflow: hidden;
    padding: clamp(24px, 5vw, 56px);
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(145deg, #301027, #5e1d3d 58%, #742340);
}

.login-intro-copy { position: relative; z-index: 1; }

.eyebrow {
    margin: 0 0 12px;
    color: #f6c4d9;
    font-size: .75rem;
    font-weight: 750;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.intro-title {
    margin: 0;
    font-size: clamp(1.875rem, 4.8vw, 3.4rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.065em;
}

.login-intro-copy > p:last-child {
    max-width: 34ch;
    margin: 16px 0 0;
    color: #f5dce8;
    font-size: .9375rem;
}

.signal-art {
    position: absolute;
    right: -8%;
    bottom: -35%;
    width: 60%;
    aspect-ratio: 1;
    transform: rotate(-19deg);
    opacity: .7;
}

.signal-art i {
    position: absolute;
    inset: 0;
    border: 1px solid #e996b7;
    border-radius: 28%;
    background: linear-gradient(150deg, rgb(255 207 226 / 14%), transparent 80%);
}

.signal-art i:nth-child(2) { transform: translate(-18%, -14%) scale(.83); }
.signal-art i:nth-child(3) { transform: translate(-38%, -31%) scale(.67); }

.login {
    display: grid;
    align-content: center;
    padding: clamp(22px, 4.5vw, 48px);
}

.login h1 { margin-bottom: 8px; }
.login-description { margin: 0 0 24px; color: var(--muted); }
.login form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: .875rem; font-weight: 700; }

.field input {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid #a99aa7;
    border-radius: 9px;
    background: var(--surface);
    color: inherit;
}

.field input[aria-invalid="true"] { border-color: var(--brand); }
.login button { justify-content: space-between; min-height: 48px; }
.login button span { font-size: 1.1em; }

.error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: .875rem;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tabs a, .back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--muted);
    background: var(--surface);
    font-size: .875rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 160ms ease;
}

.tabs a:hover, .back:hover { background: var(--brand-soft); }
.tabs a[aria-current] { color: var(--brand-dark); background: var(--brand-soft); border-color: #e5b8cb; }
.back { margin-bottom: 16px; }

.messages { list-style: none; padding: 0; margin: 0; }
.message, .empty { padding: clamp(16px, 3vw, 24px); overflow-wrap: anywhere; }
.message + .message { border-top: 1px solid var(--border); }

.message-header, .message-sender {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    min-width: 0;
}

.message-header { justify-content: space-between; }
.message-sender { flex: 1 1 250px; }
.contact { font-weight: 750; }
.contact:hover { text-decoration-thickness: 2px; }

.direction {
    padding: 2px 8px;
    border-radius: 999px;
    color: #534752;
    background: #f2edf2;
    font-size: .75rem;
    font-weight: 700;
}

.direction-inbound { color: #17543f; background: #e6f5ee; }
.message time { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.message-text { max-width: 80ch; margin: 12px 0; white-space: pre-wrap; }

.message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    color: var(--muted);
    font-size: .8125rem;
}

.review {
    padding: 2px 8px;
    border-radius: 6px;
    color: #6a3d00;
    background: #fff1d5;
    font-weight: 700;
}

.empty {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 8px;
    min-height: 235px;
    color: var(--muted);
    text-align: center;
}

.empty strong { color: #35252f; }
.empty p { margin: 0; font-size: .875rem; }

.empty-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 4px;
    border-radius: 12px;
    background: var(--brand-soft);
}

.empty-mark::before {
    content: "";
    width: 18px;
    height: 14px;
    border: 2px solid var(--brand);
    border-radius: 5px 5px 5px 1px;
}

.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

@media (min-width: 48rem) {
    .login-layout { grid-template-columns: 1.1fr 1fr; gap: 16px; }
    .login-intro { min-height: 450px; }
    .login { min-height: 450px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
