:root {
    --bg: #f7f7fb;
    --bg-soft: #f2f2f8;
    --panel: #ffffff;
    --panel-soft: #fafafe;
    --text: #171628;
    --text-soft: #343247;
    --muted: #77758a;
    --muted-strong: #5e5b70;
    --line: #e8e7ef;
    --line-strong: #dbd9e6;
    --primary: #6d5dfc;
    --primary-strong: #5948ec;
    --primary-dark: #4334c8;
    --primary-soft: #f0edff;
    --primary-softer: #f7f5ff;
    --violet: #8a6df1;
    --green: #22a06b;
    --green-soft: #eaf8f1;
    --amber: #c77a12;
    --amber-soft: #fff6e6;
    --red: #d33f5a;
    --red-soft: #fff0f3;
    --blue: #2f7ee6;
    --blue-soft: #edf5ff;
    --shadow-xs: 0 1px 2px rgba(25, 22, 52, .04);
    --shadow-sm: 0 8px 24px rgba(28, 24, 58, .055);
    --shadow-md: 0 16px 44px rgba(28, 24, 58, .08);
    --shadow-lg: 0 28px 80px rgba(30, 24, 78, .13);
    --sidebar-width: 248px;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
a,
input,
textarea,
summary {
    -webkit-tap-highlight-color: transparent;
}

svg {
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(109, 93, 252, .2);
    outline-offset: 2px;
}

::selection {
    color: #fff;
    background: var(--primary);
}

/* Application shell */

.app-frame {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: var(--sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 24px 16px 18px;
    background: #fff;
    border-right: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: var(--text);
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    position: relative;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 74% 22%, rgba(255, 255, 255, .4), transparent 25%),
        linear-gradient(145deg, #8877ff 0%, var(--primary) 54%, #4f40de 100%);
    border-radius: 12px;
    box-shadow: 0 7px 18px rgba(109, 93, 252, .27);
}

.brand-mark span {
    position: relative;
    z-index: 2;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.06em;
    transform: translateX(-1px);
}

.brand-mark i {
    position: absolute;
    width: 7px;
    height: 7px;
    top: 6px;
    right: 6px;
    border-radius: 50%;
    background: #d9ff8d;
    box-shadow: 0 0 0 3px rgba(217, 255, 141, .15);
}

.brand-copy {
    min-width: 0;
    display: grid;
    line-height: 1.12;
}

.brand-copy strong {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.025em;
}

.brand-copy small {
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .035em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar > .brand {
    padding: 0 8px;
    margin-bottom: 30px;
}

.app-nav {
    display: grid;
    gap: 4px;
}

.nav-label {
    padding: 0 12px;
    margin: 0 0 7px;
    color: #aaa7b8;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.app-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    padding: 0 12px;
    color: #666377;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 650;
    transition: color .16s ease, background .16s ease, transform .16s ease;
}

.app-nav a svg {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-nav a:hover {
    color: var(--text);
    background: #f6f5fa;
    text-decoration: none;
}

.app-nav a.active {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.app-nav a.active::before {
    content: "";
    position: absolute;
    left: 0;
    width: 3px;
    height: 20px;
    border-radius: 0 4px 4px 0;
    background: var(--primary);
}

.app-nav a.active svg {
    stroke-width: 1.9;
}

.sidebar-spacer {
    flex: 1 1 auto;
    min-height: 30px;
}

.sidebar-ai-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px;
    margin: 0 4px 14px;
    overflow: hidden;
    border: 1px solid #e6e1ff;
    border-radius: 14px;
    background:
        radial-gradient(circle at 100% 0%, rgba(109, 93, 252, .1), transparent 62%),
        #faf9ff;
}

.sidebar-ai-card strong {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 800;
}

.sidebar-ai-card p {
    margin: 0;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.35;
}

.ai-orbit {
    position: relative;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, #7c6aff, #5949e7);
    box-shadow: 0 7px 16px rgba(109, 93, 252, .2);
}

.ai-orbit::before,
.ai-orbit::after {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 50%;
}

.ai-orbit::after {
    inset: 13px;
    border: 0;
    background: #fff;
}

.ai-orbit i {
    position: absolute;
    z-index: 2;
    width: 6px;
    height: 6px;
    right: 2px;
    bottom: 3px;
    background: #67da9b;
    border: 2px solid #faf9ff;
    border-radius: 50%;
}

.sidebar-user {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 9px;
    padding: 12px 8px 0;
    border-top: 1px solid var(--line);
}

.user-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #6e6a80;
    background: #f0eff5;
    border-radius: 11px;
}

.user-avatar svg,
.icon-button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.user-copy {
    min-width: 0;
    display: grid;
    line-height: 1.2;
}

.user-copy strong {
    font-size: 11px;
    font-weight: 800;
}

.user-copy small {
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 9.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
}

.icon-button:hover {
    color: var(--text);
    background: #f3f2f7;
}

.app-content {
    grid-column: 2;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
}

.mobile-header {
    display: none;
}

.shell {
    width: min(1260px, calc(100% - 64px));
    margin: 0 auto;
    padding: 42px 0 56px;
}

/* Shared page typography */

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 28px;
}

.page-heading > div:first-child {
    min-width: 0;
}

.eyebrow,
.section-kicker {
    display: inline-block;
    color: var(--primary);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.page-heading h1 {
    margin: 5px 0 8px;
    font-size: clamp(34px, 4vw, 50px);
    line-height: 1;
    letter-spacing: -.055em;
    font-weight: 800;
}

.page-heading p {
    max-width: 700px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.heading-status,
.count-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 13px;
    color: #5d596f;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow-xs);
    font-size: 11px;
    font-weight: 750;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28b575;
    box-shadow: 0 0 0 4px rgba(40, 181, 117, .1);
}

.surface,
.card,
.form-card,
.table-wrap {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
}

.section-header h2,
.card-icon-heading h2,
.panel-header h2 {
    margin: 3px 0 0;
    color: var(--text);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.15;
}

.section-header p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 750;
}

.text-link span {
    transition: transform .15s ease;
}

.text-link:hover span {
    transform: translateX(3px);
}

.muted {
    color: var(--muted);
}

.is-hidden {
    display: none !important;
}

/* Buttons and inputs */

button,
.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 11px;
    box-shadow: 0 5px 14px rgba(109, 93, 252, .16);
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

button:hover,
.button:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
    box-shadow: 0 7px 18px rgba(109, 93, 252, .2);
    text-decoration: none;
    transform: translateY(-1px);
}

button:active,
.button:active {
    transform: translateY(0);
}

button.secondary,
.button.secondary {
    color: var(--text-soft);
    background: #fff;
    border-color: var(--line-strong);
    box-shadow: var(--shadow-xs);
}

button.secondary:hover,
.button.secondary:hover {
    color: var(--primary-dark);
    background: var(--primary-softer);
    border-color: #d8d1ff;
}

button.danger {
    background: var(--red);
    border-color: var(--red);
}

.button-with-icon svg,
button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.full-width {
    width: 100%;
}

label {
    display: grid;
    gap: 7px;
    color: #4e4b5f;
    font-size: 11px;
    font-weight: 720;
}

label > span:first-child small {
    margin-left: 4px;
    color: #aaa6b5;
    font-size: 9px;
    font-weight: 650;
}

input,
textarea,
select {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: 0;
    font-size: 12px;
    box-shadow: inset 0 1px 1px rgba(20, 16, 48, .015);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

textarea {
    min-height: 96px;
    padding-top: 11px;
    padding-bottom: 11px;
    line-height: 1.45;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #b1aebb;
}

input:hover,
textarea:hover,
select:hover {
    border-color: #cbc8d8;
}

input:focus,
textarea:focus,
select:focus {
    background: #fff;
    border-color: #9689ff;
    box-shadow: 0 0 0 3px rgba(109, 93, 252, .1);
}

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stack-form {
    display: grid;
    gap: 17px;
}

.field-hint {
    margin-top: -1px;
    color: #9793a4;
    font-size: 9px;
    font-weight: 500;
    line-height: 1.45;
}

.input-with-suffix,
.input-with-prefix,
.input-with-icon {
    position: relative;
    display: block;
}

.input-with-suffix input {
    padding-right: 48px;
}

.input-with-suffix > i {
    position: absolute;
    right: 12px;
    top: 50%;
    color: #aaa6b5;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    pointer-events: none;
    transform: translateY(-50%);
}

.input-with-prefix input {
    padding-left: 30px;
}

.input-with-prefix > i {
    position: absolute;
    left: 12px;
    top: 50%;
    color: #8c8998;
    font-size: 11px;
    font-style: normal;
    font-weight: 750;
    pointer-events: none;
    transform: translateY(-50%);
}

.input-with-icon svg {
    position: absolute;
    z-index: 1;
    left: 13px;
    top: 50%;
    width: 17px;
    height: 17px;
    fill: none;
    stroke: #9a97a7;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
    transform: translateY(-50%);
}

.input-with-icon input {
    padding-left: 40px;
}

/* Status */

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 27px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
}

.status i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status.ok {
    color: #188459;
    background: var(--green-soft);
    border: 1px solid #d6efe3;
}

.status.warn {
    color: #b56c0f;
    background: var(--amber-soft);
    border: 1px solid #f5e5c6;
}

.status.danger {
    color: var(--red);
    background: var(--red-soft);
    border: 1px solid #f4d6dd;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-dot.success {
    background: var(--green);
}

.status-dot.warning {
    background: var(--amber);
}

/* Dashboard */

.dashboard-heading {
    margin-bottom: 24px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.metric-card {
    min-height: 168px;
    display: flex;
    gap: 15px;
    padding: 19px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 17px;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.metric-card:hover {
    border-color: #dedbe9;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metric-card.primary {
    position: relative;
    overflow: hidden;
}

.metric-card.primary::after {
    content: "";
    position: absolute;
    width: 100px;
    height: 100px;
    right: -52px;
    top: -48px;
    background: radial-gradient(circle, rgba(109, 93, 252, .1), transparent 70%);
    border-radius: 50%;
}

.metric-icon,
.feature-icon {
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 12px;
}

.metric-icon.violet {
    color: #7b5ecb;
    background: #f3edff;
}

.metric-icon.amber {
    color: #bd751c;
    background: #fff4e5;
}

.metric-icon.mint {
    color: #218964;
    background: #eaf8f2;
}

.metric-icon svg,
.feature-icon svg,
.empty-icon svg,
.contact-avatar svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.metric-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.metric-copy > span:first-child {
    color: var(--muted);
    font-size: 10px;
    font-weight: 680;
}

.metric-copy > strong {
    margin: 7px 0 2px;
    font-size: 32px;
    line-height: 1;
    letter-spacing: -.055em;
    font-weight: 800;
}

.metric-copy > strong.metric-state {
    margin-top: 10px;
    font-size: 22px;
}

.metric-detail {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    color: var(--muted) !important;
    font-size: 9.5px !important;
}

.metric-copy > a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 12px;
    color: var(--primary-dark);
    font-size: 10px;
    font-weight: 750;
}

.metric-copy > a span {
    transition: transform .15s ease;
}

.metric-copy > a:hover span {
    transform: translateX(3px);
}

.dashboard-lower-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(290px, .8fr);
    gap: 14px;
    margin-top: 14px;
}

.recent-chats-card {
    min-width: 0;
    padding: 21px;
}

.dashboard-conversation-list {
    display: grid;
    margin-top: 16px;
}

.dashboard-conversation {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 12px;
    padding: 13px 7px;
    border-bottom: 1px solid #efedf4;
    border-radius: 8px;
    transition: background .15s ease;
}

.dashboard-conversation:last-child {
    border-bottom: 0;
}

.dashboard-conversation:hover {
    background: #faf9fd;
    text-decoration: none;
}

.contact-avatar,
.conversation-avatar,
.chat-contact-avatar {
    display: grid;
    place-items: center;
    color: #716d82;
    background: #f0eff4;
    border-radius: 12px;
}

.contact-avatar {
    width: 38px;
    height: 38px;
}

.dashboard-conversation-body {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.conversation-title-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.conversation-title-line strong {
    overflow: hidden;
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-title-line time {
    flex: 0 0 auto;
    color: #aaa6b4;
    font-size: 8.5px;
}

.conversation-snippet {
    overflow: hidden;
    color: #656173;
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-info-line {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    color: #9c98a7;
    font-size: 8.5px;
    white-space: nowrap;
}

.inline-warning {
    display: inline-flex;
    padding: 2px 6px;
    color: #ae6817;
    background: #fff5e7;
    border-radius: 999px;
    font-weight: 750;
}

.row-arrow {
    color: #aaa6b5;
    font-size: 15px;
    transition: color .15s ease, transform .15s ease;
}

.dashboard-conversation:hover .row-arrow {
    color: var(--primary);
    transform: translateX(2px);
}

.julia-summary-card {
    position: relative;
    min-height: 330px;
    padding: 22px;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 92% 10%, rgba(255,255,255,.12), transparent 27%),
        radial-gradient(circle at 15% 95%, rgba(199,187,255,.25), transparent 32%),
        linear-gradient(145deg, #6251e9 0%, #4b3dcb 54%, #392d9d 100%);
    border-color: transparent;
}

.julia-summary-card .section-kicker {
    color: #d9d3ff;
}

.julia-summary-card h2 {
    max-width: 280px;
    margin: 8px 0 10px;
    font-size: 25px;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -.04em;
}

.julia-summary-card > p {
    max-width: 310px;
    margin: 0;
    color: rgba(255,255,255,.72);
    font-size: 11px;
    line-height: 1.55;
}

.julia-summary-visual {
    position: absolute;
    top: 20px;
    right: 20px;
}

.julia-orb {
    position: relative;
    width: 55px;
    height: 55px;
    display: grid;
    place-items: center;
    color: #5444da;
    background: rgba(255,255,255,.95);
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 18px;
    box-shadow: 0 14px 30px rgba(30, 19, 108, .22);
    font-size: 24px;
    font-weight: 850;
}

.julia-orb i,
.julia-orb b {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #bff86a;
}

.julia-orb i {
    top: 8px;
    right: 8px;
}

.julia-orb b {
    width: 4px;
    height: 4px;
    left: 8px;
    bottom: 9px;
    background: #aca2ff;
}

.summary-feature-list {
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: 20px;
    display: grid;
    gap: 7px;
}

.summary-feature-list span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,.8);
    font-size: 9.5px;
    font-weight: 650;
}

.summary-feature-list i {
    width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 50%;
}

.summary-feature-list i::after {
    content: "";
    width: 5px;
    height: 3px;
    border-left: 1.5px solid #d9ff8d;
    border-bottom: 1.5px solid #d9ff8d;
    transform: rotate(-45deg) translateY(-1px);
}

/* Empty states */

.empty-state,
.empty-panel {
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
}

.empty-state {
    min-height: 300px;
    padding: 35px;
}

.empty-state.compact {
    min-height: 210px;
}

.empty-state h3 {
    margin: 13px 0 5px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.empty-state p {
    max-width: 380px;
    margin: 0;
    color: var(--muted);
    font-size: 10.5px;
}

.empty-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 14px;
}

.empty-icon.large {
    width: 52px;
    height: 52px;
    border-radius: 17px;
}

.empty-icon.small {
    width: 38px;
    height: 38px;
}

/* Services */

.services-layout {
    display: grid;
    grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.create-service-card {
    position: sticky;
    top: 28px;
    padding: 22px;
}

.card-icon-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.feature-icon {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
}

.card-intro {
    margin: 14px 0 20px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.55;
}

.services-catalog {
    min-width: 0;
    padding: 22px;
}

.catalog-header {
    padding-bottom: 17px;
    border-bottom: 1px solid var(--line);
}

.service-list {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}

.service-item {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 13px;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.service-item:hover {
    border-color: #dcd8e8;
}

.service-item[open] {
    border-color: #d9d3ff;
    box-shadow: 0 8px 22px rgba(79, 65, 179, .06);
}

.service-item summary {
    min-height: 68px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto 20px;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.service-item summary::-webkit-details-marker {
    display: none;
}

.service-item[open] summary {
    background: var(--primary-softer);
}

.service-summary-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    color: #77728c;
    background: #f2f1f6;
    border-radius: 11px;
}

.service-item[open] .service-summary-icon {
    color: var(--primary);
    background: var(--primary-soft);
}

.service-summary-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.service-summary-main {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.service-summary-main > strong {
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.service-summary-main > span {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #9995a4;
    font-size: 9px;
}

.service-summary-main > span b {
    color: #777386;
    font-weight: 650;
}

.service-summary-main > span i {
    width: 3px;
    height: 3px;
    background: #c5c2cc;
    border-radius: 50%;
}

.edit-service-label {
    color: var(--primary-dark);
    font-size: 9px;
    font-weight: 750;
}

.chevron {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: #aaa6b5;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .18s ease;
}

.service-item[open] .chevron {
    color: var(--primary);
    transform: rotate(180deg);
}

.service-editor {
    padding: 18px;
    border-top: 1px solid #e9e6f5;
}

.editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.ghost-danger {
    color: var(--red) !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.ghost-danger:hover {
    background: var(--red-soft) !important;
}

/* Calendar */

.calendar-workspace {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.calendar-side {
    position: sticky;
    top: 28px;
    overflow: hidden;
}

.calendar-side-header {
    padding: 20px 20px 15px;
}

.month-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.month-title-row h2,
.day-agenda-header h2 {
    margin: 3px 0 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.04em;
}

.today-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    border-radius: 999px;
    font-size: 9px;
    font-weight: 780;
}

.calendar-nav {
    display: grid;
    grid-template-columns: 32px 1fr 32px;
    align-items: center;
    gap: 7px;
    margin-top: 17px;
}

.calendar-nav > span {
    color: var(--muted-strong);
    font-size: 9px;
    font-weight: 720;
    text-align: center;
}

.icon-nav-button,
.event-open-button {
    display: grid;
    place-items: center;
    color: #706c80;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.icon-nav-button {
    width: 32px;
    height: 32px;
}

.icon-nav-button svg,
.event-open-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-nav-button:hover,
.event-open-button:hover {
    color: var(--primary-dark);
    background: var(--primary-softer);
    border-color: #d7d1ff;
}

.calendar-board {
    margin: 0 14px;
}

.calendar-weekdays,
.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    padding: 0 2px 6px;
}

.calendar-weekdays div {
    color: #9d99a9;
    font-size: 8px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.calendar-week {
    gap: 2px;
    margin-bottom: 2px;
}

.calendar-day {
    position: relative;
    min-width: 0;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #4d495d;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 680;
    transition: color .15s ease, background .15s ease;
}

.calendar-day:hover {
    color: var(--primary-dark);
    background: #f5f3ff;
}

.calendar-day.outside {
    color: #c5c2cc;
}

.calendar-day.today .calendar-date-number {
    color: var(--primary);
    font-weight: 850;
}

.calendar-day.selected {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 6px 13px rgba(109, 93, 252, .2);
}

.calendar-day.selected:hover {
    color: #fff;
    background: var(--primary-strong);
}

.calendar-day.selected.today .calendar-date-number {
    color: #fff;
}

.calendar-event-dots {
    height: 4px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.calendar-event-dots small {
    color: inherit;
    font-size: 6px;
    line-height: 1;
}

.calendar-dot {
    width: 4px;
    height: 4px;
    display: inline-block;
    background: #8e7eff;
    border-radius: 50%;
}

.calendar-dot.julia {
    background: var(--primary);
}

.calendar-dot.google {
    background: #64a2eb;
}

.calendar-day.selected .calendar-dot {
    background: rgba(255,255,255,.9);
}

.calendar-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px 17px;
    margin-top: 12px;
    border-top: 1px solid var(--line);
}

.calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #9793a3;
    font-size: 8px;
}

.day-agenda {
    min-height: 520px;
    padding: 21px;
}

.day-agenda-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.agenda-counter {
    display: flex;
    align-items: baseline;
    gap: 5px;
    color: var(--muted);
    font-size: 9px;
}

.agenda-counter-number {
    color: var(--text);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -.04em;
}

.agenda-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.agenda-event {
    position: relative;
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    min-height: 78px;
    padding: 13px 14px 13px 18px;
    overflow: hidden;
    background: #fcfbfe;
    border: 1px solid var(--line);
    border-radius: 13px;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.agenda-event::before {
    content: "";
    position: absolute;
    inset: 10px auto 10px 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

.agenda-event.google::before {
    background: #64a2eb;
}

.agenda-event:hover {
    background: #fff;
    border-color: #ddd9e9;
    transform: translateY(-1px);
}

.agenda-time-block {
    display: grid;
    gap: 4px;
}

.agenda-time {
    color: var(--text);
    font-size: 12px;
    font-weight: 820;
}

.agenda-source {
    width: fit-content;
    padding: 2px 6px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    border-radius: 999px;
    font-size: 7.5px;
    font-weight: 800;
}

.agenda-event.google .agenda-source {
    color: #2f6cae;
    background: #edf5ff;
}

.agenda-event-body h3 {
    margin: 0 0 5px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -.015em;
}

.agenda-event-meta {
    display: flex;
    align-items: center;
    gap: 13px;
    flex-wrap: wrap;
}

.agenda-event-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #8d8999;
    font-size: 8.5px;
}

.agenda-event-meta svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.event-open-button {
    width: 32px;
    height: 32px;
}

.calendar-empty {
    min-height: 390px;
}

/* Conversations */

body.chat-page {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

body.chat-page .app-frame,
body.chat-page .app-content {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
}

body.chat-page .app-content {
    display: flex;
    flex-direction: column;
}

.chat-shell {
    flex: 1 1 auto;
    width: min(1440px, calc(100% - 40px));
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 26px 0 20px;
    margin: 0 auto;
    overflow: hidden;
}

.conversations-heading {
    flex: 0 0 auto;
    align-items: center;
    margin-bottom: 17px;
}

.conversations-heading h1 {
    margin-top: 3px;
    margin-bottom: 4px;
    font-size: 32px;
}

.conversations-heading p {
    font-size: 11px;
}

.compact-status {
    min-height: 31px;
    font-size: 9px;
}

.chat-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 285px minmax(380px, 1fr) 270px;
    gap: 10px;
}

.chat-sidebar,
.chat-main,
.chat-controls {
    min-width: 0;
    min-height: 0;
}

.chat-sidebar,
.chat-controls {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-sidebar {
    padding: 14px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.panel-header h2 {
    font-size: 15px;
}

.panel-header p {
    margin: 3px 0 0;
    font-size: 9px;
}

.inbox-header {
    padding: 2px 2px 11px;
    border-bottom: 1px solid var(--line);
}

.sync-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 23px;
    padding: 0 8px;
    color: #2b875f;
    background: var(--green-soft);
    border-radius: 999px;
    font-size: 7.5px;
    font-weight: 800;
}

.sync-status i {
    width: 5px;
    height: 5px;
    background: #27ac73;
    border-radius: 50%;
}

.sync-status.syncing {
    color: #a56818;
    background: var(--amber-soft);
}

.sync-status.error {
    color: var(--red);
    background: var(--red-soft);
}

.conversation-list {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 8px;
    padding-right: 2px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #dcd9e4 transparent;
}

.conversation-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.chat-controls::-webkit-scrollbar {
    width: 5px;
}

.conversation-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.chat-controls::-webkit-scrollbar-thumb {
    background: #dcd9e4;
    border-radius: 999px;
}

.conversation-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    padding: 10px 9px;
    color: var(--text);
    border: 1px solid transparent;
    border-radius: 11px;
    transition: background .15s ease, border-color .15s ease;
}

.conversation-item:hover {
    background: #f8f7fb;
    text-decoration: none;
}

.conversation-item.active {
    background: var(--primary-softer);
    border-color: #e2ddff;
}

.conversation-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    color: #797587;
    border-radius: 11px;
}

.conversation-avatar svg,
.chat-contact-avatar svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.conversation-avatar i {
    position: absolute;
    width: 7px;
    height: 7px;
    right: -1px;
    bottom: 1px;
    background: #29ae73;
    border: 2px solid #fff;
    border-radius: 50%;
}

.conversation-item-content {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.conversation-top {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conversation-top strong {
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-top time {
    flex: 0 0 auto;
    color: #aaa6b4;
    font-size: 7.2px;
}

.conversation-preview {
    overflow: hidden;
    color: #666274;
    font-size: 9px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-bottom-line {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    color: #aaa6b4;
    font-size: 7.3px;
    white-space: nowrap;
}

.conversation-intent {
    overflow: hidden;
    padding: 2px 5px;
    color: #7569b3;
    background: #f0edff;
    border-radius: 999px;
    text-overflow: ellipsis;
}

.mini-pause-badge {
    padding: 2px 5px;
    color: #ad6817;
    background: #fff4e4;
    border-radius: 999px;
    font-weight: 750;
}

.chat-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-pane {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chat-header {
    min-height: 66px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.chat-contact {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-contact-avatar {
    width: 38px;
    height: 38px;
}

.chat-contact h2 {
    margin: 0;
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-channel {
    display: block;
    margin-top: 2px;
    color: #9995a4;
    font-size: 8px;
}

.chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 15% 0%, rgba(109, 93, 252, .035), transparent 30%),
        #fafafd;
    scrollbar-width: thin;
    scrollbar-color: #dcd9e4 transparent;
}

.chat-message {
    display: flex;
    width: 100%;
}

.chat-message.in {
    justify-content: flex-start;
}

.chat-message.out,
.chat-message.manual {
    justify-content: flex-end;
}

.bubble {
    max-width: min(72%, 630px);
    padding: 9px 11px;
    color: #3d394b;
    background: #fff;
    border: 1px solid #ebe9f0;
    border-radius: 13px 13px 13px 4px;
    box-shadow: 0 4px 12px rgba(31, 27, 61, .04);
}

.chat-message.out .bubble {
    color: #37314e;
    background: #f1eeff;
    border-color: #e0d9ff;
    border-radius: 13px 13px 4px 13px;
}

.chat-message.manual .bubble {
    color: #244c3c;
    background: #eaf8f1;
    border-color: #d6efe3;
    border-radius: 13px 13px 4px 13px;
}

.chat-message.send-failed .bubble {
    color: #7a2d3c;
    background: var(--red-soft);
    border-color: #f1ccd5;
}

.bubble-author {
    display: block;
    margin-bottom: 3px;
    color: #7669c3;
    font-size: 7px;
    font-weight: 800;
    letter-spacing: .02em;
}

.chat-message.manual .bubble-author {
    color: #33825f;
}

.message-content {
    font-size: 10px;
    line-height: 1.48;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 5px;
    color: #a19dac;
    font-size: 7px;
}

.send-failure {
    color: var(--red);
    font-weight: 750;
}

.chat-composer {
    flex: 0 0 auto;
    padding: 11px 13px;
    background: #fff;
    border-top: 1px solid var(--line);
}

.chat-composer form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    align-items: end;
    gap: 8px;
}

.composer-field {
    position: relative;
}

.chat-composer textarea {
    min-height: 58px;
    max-height: 120px;
    padding: 10px 11px 22px;
    background: #fafafd;
    border-color: #e5e2eb;
    border-radius: 12px;
    font-size: 9.5px;
    resize: none;
}

.composer-hint {
    position: absolute;
    left: 11px;
    bottom: 6px;
    color: #aaa6b5;
    font-size: 6.8px;
    pointer-events: none;
}

.composer-send {
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 12px;
}

.composer-send svg {
    width: 16px;
    height: 16px;
}

.empty-chat {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    place-items: center;
    align-content: center;
    padding: 30px;
    text-align: center;
}

.empty-chat h2 {
    margin: 18px 0 5px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.03em;
}

.empty-chat > p {
    max-width: 330px;
    margin: 0;
    font-size: 10px;
}

.empty-chat-visual {
    position: relative;
    width: 190px;
    height: 112px;
}

.empty-chat-orb {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #8574ff, #5d4bea);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(109, 93, 252, .25);
    font-size: 25px;
    font-weight: 850;
    transform: translate(-50%, -50%);
}

.empty-chat-orb i {
    position: absolute;
    width: 8px;
    height: 8px;
    top: 8px;
    right: 8px;
    background: #cfff7d;
    border-radius: 50%;
}

.floating-bubble {
    position: absolute;
    padding: 6px 9px;
    color: #777286;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
    box-shadow: var(--shadow-sm);
    font-size: 7.5px;
    font-weight: 700;
}

.floating-bubble.one {
    left: 0;
    top: 7px;
}

.floating-bubble.two {
    right: 0;
    bottom: 6px;
    color: #277b5a;
    background: #f0fbf5;
    border-color: #dcefe6;
}

.chat-controls {
    padding: 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #dcd9e4 transparent;
}

.chat-controls-empty,
.chat-controls-active {
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 14px;
}

.empty-control-visual {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 220px;
    padding: 20px;
    text-align: center;
}

.empty-control-visual p {
    max-width: 170px;
    margin: 0;
    color: var(--muted);
    font-size: 9px;
}

.control-ai-orb,
.control-ai-mini {
    position: relative;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #8170ff, #5948e6);
    font-weight: 850;
    box-shadow: 0 10px 24px rgba(109, 93, 252, .2);
}

.control-ai-orb {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    font-size: 23px;
}

.control-ai-mini {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    font-size: 14px;
}

.control-ai-orb i,
.control-ai-mini i {
    position: absolute;
    width: 7px;
    height: 7px;
    top: 7px;
    right: 7px;
    background: #cfff7d;
    border-radius: 50%;
}

.control-ai-mini i {
    width: 5px;
    height: 5px;
    top: 5px;
    right: 5px;
}

.control-panel-heading {
    padding-bottom: 13px;
    border-bottom: 1px solid var(--line);
}

.control-status-card {
    padding: 12px;
    background: #f5fbf8;
    border: 1px solid #dcefe6;
    border-radius: 12px;
}

.control-status-card.paused {
    background: #fff9ef;
    border-color: #f3e4c8;
}

.control-status-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.control-label {
    color: #8d8999;
    font-size: 8px;
    font-weight: 750;
}

.control-status-card p {
    margin: 8px 0 0;
    color: #6d6978;
    font-size: 8.5px;
    line-height: 1.45;
}

.control-block {
    display: grid;
    gap: 10px;
}

.pause-control-block {
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.control-block h3 {
    margin: 0;
    font-size: 11px;
    font-weight: 800;
}

.control-block > div > p {
    margin: 4px 0 0;
    font-size: 8.5px;
    line-height: 1.45;
}

.control-block form {
    display: grid;
    gap: 10px;
}

.chat-controls input {
    min-height: 38px;
    font-size: 9.5px;
}

.chat-controls label {
    gap: 5px;
    font-size: 9px;
}

.chat-controls button {
    min-height: 38px;
    font-size: 9px;
}

.empty-panel {
    min-height: 150px;
    gap: 8px;
    padding: 18px;
    border: 1px dashed #dedbe6;
    border-radius: 12px;
    background: #fbfafd;
}

.empty-panel p {
    margin: 0;
    font-size: 9px;
}

/* Login */

body.login-page {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    background: #f8f7fb;
}

.login-page .public-frame {
    position: relative;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.public-brand-wrap {
    position: absolute;
    z-index: 5;
    top: 24px;
    left: 30px;
}

.login-page .public-brand-wrap .brand-copy strong,
.login-page .public-brand-wrap .brand-copy small {
    color: #fff;
}

.login-page .public-brand-wrap .brand-copy small {
    opacity: .68;
}

.login-page .login-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.login-layout {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(360px, 1.05fr);
    overflow: hidden;
}

.login-showcase {
    position: relative;
    height: 100%;
    min-height: 0;
    display: grid;
    place-items: center;
    padding: clamp(54px, 9vh, 100px) clamp(34px, 5.5vw, 70px) clamp(28px, 6vh, 60px);
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 15% 85%, rgba(183, 169, 255, .28), transparent 34%),
        radial-gradient(circle at 90% 15%, rgba(255,255,255,.1), transparent 26%),
        linear-gradient(145deg, #5f4ee7 0%, #4c3cc8 56%, #392d9c 100%);
}

.login-showcase::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .13;
    background-image: radial-gradient(rgba(255,255,255,.8) .7px, transparent .7px);
    background-size: 18px 18px;
    mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
}

.login-showcase-content {
    position: relative;
    z-index: 2;
    width: min(510px, 100%);
}

.showcase-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 0 11px;
    color: #e5e0ff;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 999px;
    backdrop-filter: blur(8px);
    font-size: 9px;
    font-weight: 700;
}

.showcase-badge i {
    width: 6px;
    height: 6px;
    background: #cfff7d;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(207,255,125,.08);
}

.login-showcase h1 {
    max-width: 500px;
    margin: clamp(14px, 2.5vh, 23px) 0 clamp(10px, 1.8vh, 16px);
    font-size: clamp(38px, min(5vw, 7vh), 67px);
    font-weight: 800;
    line-height: .98;
    letter-spacing: -.06em;
}

.login-showcase > .login-showcase-content > p {
    max-width: 450px;
    margin: 0;
    color: rgba(255,255,255,.68);
    font-size: clamp(11px, 1.45vh, 13px);
    line-height: 1.6;
}

.showcase-flow {
    width: min(430px, 95%);
    display: grid;
    gap: clamp(5px, .8vh, 8px);
    margin-top: clamp(17px, 3.8vh, 42px);
}

.flow-message,
.flow-confirmation {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 82%;
    min-height: clamp(44px, 6vh, 56px);
    padding: clamp(8px, 1.2vh, 11px) 13px;
    color: #353147;
    background: rgba(255,255,255,.95);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(31, 22, 104, .15);
}

.flow-message.julia-message {
    justify-self: end;
    background: #f3f0ff;
}

.flow-message.client-reply {
    width: 70%;
}

.flow-avatar {
    position: relative;
    width: clamp(28px, 4vh, 32px);
    height: clamp(28px, 4vh, 32px);
    flex: 0 0 clamp(28px, 4vh, 32px);
    display: grid;
    place-items: center;
    color: #706b80;
    background: #eeedf2;
    border-radius: 10px;
}

.flow-avatar svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.flow-avatar.julia {
    color: #fff;
    background: var(--primary);
    font-size: 14px;
    font-weight: 850;
}

.flow-avatar.julia i {
    position: absolute;
    width: 5px;
    height: 5px;
    top: 5px;
    right: 5px;
    background: #cfff7d;
    border-radius: 50%;
}

.flow-message div,
.flow-confirmation div {
    min-width: 0;
    display: grid;
}

.flow-message small,
.flow-confirmation small {
    color: #9b97a7;
    font-size: 7px;
    font-weight: 700;
}

.flow-message strong,
.flow-confirmation strong {
    margin-top: 2px;
    overflow: hidden;
    font-size: 9px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-chip {
    margin-left: auto;
    padding: 2px 6px;
    color: #6d5dfc;
    background: #e9e4ff;
    border-radius: 999px;
    font-size: 7px;
    font-weight: 850;
}

.flow-connector {
    height: clamp(5px, 1.25vh, 12px);
    display: flex;
    justify-content: center;
}

.flow-connector span {
    height: 100%;
    width: 1px;
    background: rgba(255,255,255,.22);
}

.flow-confirmation {
    width: 63%;
    justify-self: center;
    color: #285744;
    background: #effbf5;
    border-color: rgba(216,244,230,.8);
}

.check-circle {
    width: clamp(25px, 3.5vh, 28px);
    height: clamp(25px, 3.5vh, 28px);
    flex: 0 0 clamp(25px, 3.5vh, 28px);
    display: grid;
    place-items: center;
    color: #258158;
    background: #daf3e7;
    border-radius: 50%;
}

.check-circle svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.showcase-glow {
    position: absolute;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 50%;
}

.showcase-glow.one {
    width: 420px;
    height: 420px;
    top: -200px;
    right: -170px;
}

.showcase-glow.two {
    width: 600px;
    height: 600px;
    bottom: -430px;
    left: -220px;
}

.login-panel {
    height: 100%;
    min-height: 0;
    display: grid;
    place-items: center;
    padding: clamp(24px, 7vh, 80px) clamp(24px, 5vw, 50px);
    overflow: hidden;
    background: #fbfafd;
}

.login-card {
    width: min(385px, 100%);
    max-height: 100%;
}

.login-heading {
    margin-bottom: clamp(16px, 3vh, 27px);
}

.login-heading h2 {
    margin: 7px 0 6px;
    font-size: clamp(27px, 4vh, 31px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.05em;
}

.login-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.login-form {
    display: grid;
    gap: clamp(10px, 2vh, 17px);
}

.login-form input {
    min-height: clamp(40px, 5.5vh, 46px);
    border-radius: 11px;
}

.login-submit {
    min-height: clamp(41px, 5.7vh, 47px);
    justify-content: space-between;
    padding: 0 17px;
    margin-top: 2px;
    border-radius: 11px;
    font-size: 11px;
}

.login-submit svg {
    width: 17px;
    height: 17px;
}

.login-footnote {
    margin: clamp(11px, 2vh, 18px) 0 0;
    color: #aaa6b5;
    font-size: 8.5px;
    text-align: center;
}

.form-error,
.field-error {
    color: var(--red);
    font-size: 9px;
    font-weight: 600;
}

.form-error:empty,
.field-error:empty {
    display: none;
}

.form-error ul {
    margin: 0;
    padding: 9px 12px 9px 27px;
    background: var(--red-soft);
    border: 1px solid #f3d4dc;
    border-radius: 10px;
}

/* Toasts */

.alert {
    display: none;
}

.toast-stack {
    position: fixed;
    top: 22px;
    right: 22px;
    z-index: 100;
    width: min(340px, calc(100vw - 32px));
    display: grid;
    gap: 8px;
    pointer-events: none;
}

.toast {
    position: relative;
    padding: 11px 13px 11px 36px;
    color: #4b4759;
    background: rgba(255,255,255,.97);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    font-size: 10px;
    font-weight: 650;
    pointer-events: auto;
    animation: toast-in .2s ease-out both;
}

.toast::before {
    content: "✓";
    position: absolute;
    left: 12px;
    top: 10px;
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--green);
    border-radius: 50%;
    font-size: 9px;
    font-weight: 900;
}

.toast.error::before {
    content: "!";
    background: var(--red);
}

.toast.error {
    border-color: #f0d1d9;
}

.toast-exit {
    animation: toast-out .18s ease-in both;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-7px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-6px) scale(.98); }
}

/* Generic/error pages */

.hero {
    margin-bottom: 24px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -.05em;
}

.hero p {
    margin: 0;
    color: var(--muted);
}

.card {
    padding: 22px;
}

code {
    padding: 3px 6px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    border-radius: 6px;
}

/* Responsive */

@media (max-width: 1180px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chat-layout {
        grid-template-columns: 260px minmax(360px, 1fr);
    }

    .chat-controls {
        grid-column: 1 / -1;
        overflow: visible;
    }

    .chat-controls-active {
        grid-template-columns: minmax(180px, .8fr) minmax(210px, .9fr) minmax(300px, 1.3fr);
        align-items: start;
    }

    .chat-controls-active .control-panel-heading {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .chat-controls-active .control-block {
        align-self: stretch;
    }

    .chat-controls-active .pause-control-block {
        padding-top: 0;
        border-top: 0;
    }
}

@media (max-width: 980px) {
    :root {
        --sidebar-width: 0px;
    }

    .app-frame {
        display: block;
    }

    .app-sidebar {
        display: none;
    }

    .app-content {
        min-height: 100vh;
    }

    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
        min-height: 66px;
        padding: 10px 22px;
        background: rgba(255,255,255,.94);
        border-bottom: 1px solid var(--line);
        backdrop-filter: blur(12px);
    }

    .brand.compact .brand-mark {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .mobile-nav {
        display: flex;
        gap: 16px;
        overflow-x: auto;
        color: var(--muted);
        font-size: 10px;
        font-weight: 700;
    }

    .mobile-nav a:hover {
        color: var(--primary);
    }

    .shell {
        width: min(calc(100% - 36px), 1180px);
        padding-top: 30px;
    }

    body.chat-page {
        height: auto;
        overflow: auto;
    }

    body.chat-page .app-frame,
    body.chat-page .app-content {
        height: auto;
        min-height: 100dvh;
    }

    body.chat-page .app-content {
        display: block;
    }

    .chat-shell {
        width: min(100% - 28px, 1180px);
        height: auto;
        overflow: visible;
        padding: 24px 0 40px;
    }

    .chat-layout {
        min-height: 700px;
        grid-template-columns: 245px minmax(0, 1fr);
    }

    .services-layout,
    .calendar-workspace {
        grid-template-columns: 1fr;
    }

    .create-service-card,
    .calendar-side {
        position: static;
    }

    .calendar-side {
        max-width: 520px;
    }

    .login-layout {
        grid-template-columns: 1fr 1fr;
    }

    .login-showcase {
        padding-left: 42px;
        padding-right: 42px;
    }

    .login-showcase h1 {
        font-size: 46px;
    }
}

@media (max-width: 760px) {
    .mobile-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: 10px 16px 9px;
    }

    .mobile-nav {
        width: 100%;
        gap: 20px;
        padding: 2px 1px 3px;
    }

    .shell {
        width: calc(100% - 28px);
        padding-top: 25px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .page-heading h1 {
        font-size: 38px;
    }

    .heading-status,
    .count-pill {
        min-height: 31px;
    }

    .dashboard-grid,
    .dashboard-lower-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 148px;
    }

    .julia-summary-card {
        min-height: 310px;
    }

    .services-catalog,
    .create-service-card,
    .day-agenda {
        padding: 17px;
    }

    .form-grid.two {
        grid-template-columns: 1fr;
    }

    .service-item summary {
        grid-template-columns: 36px minmax(0, 1fr) 18px;
    }

    .edit-service-label {
        display: none;
    }

    .editor-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .editor-actions button {
        width: 100%;
    }

    .agenda-event {
        grid-template-columns: 1fr auto;
        gap: 9px 12px;
    }

    .agenda-time-block {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .chat-shell {
        width: calc(100% - 20px);
        padding-top: 18px;
    }

    .conversations-heading {
        display: none;
    }

    .chat-layout {
        min-height: 0;
        display: block;
    }

    .chat-sidebar {
        max-height: 285px;
        margin-bottom: 10px;
    }

    .chat-main {
        min-height: 610px;
    }

    .chat-controls {
        margin-top: 10px;
    }

    .chat-controls-active {
        grid-template-columns: 1fr;
    }

    .chat-controls-active .control-panel-heading {
        padding-bottom: 13px;
        border-bottom: 1px solid var(--line);
    }

    .chat-controls-active .pause-control-block {
        padding-top: 14px;
        border-top: 1px solid var(--line);
    }

    .chat-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .bubble {
        max-width: 88%;
    }

    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-showcase {
        display: none;
    }

    .login-panel {
        height: 100%;
        min-height: 0;
        padding: clamp(66px, 12vh, 90px) 24px clamp(16px, 5vh, 45px);
    }

    .public-brand-wrap {
        top: 22px;
        left: 24px;
    }

    .login-page .public-brand-wrap .brand-copy strong {
        color: var(--text);
    }

    .login-page .public-brand-wrap .brand-copy small {
        color: var(--muted);
        opacity: 1;
    }

    .login-heading h2 {
        font-size: clamp(26px, 4.8vh, 29px);
    }
}

@media (max-width: 480px) {
    .brand-copy small {
        display: none;
    }

    .page-heading h1 {
        font-size: 34px;
    }

    .dashboard-conversation {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .row-arrow {
        display: none;
    }

    .conversation-title-line time {
        display: none;
    }

    .service-summary-main > span {
        gap: 5px;
    }

    .service-summary-main > span > span:last-child,
    .service-summary-main > span > i:last-of-type {
        display: none;
    }

    .calendar-side-header,
    .calendar-legend {
        padding-left: 15px;
        padding-right: 15px;
    }

    .calendar-board {
        margin-left: 9px;
        margin-right: 9px;
    }

    .day-agenda-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .agenda-event {
        padding-left: 14px;
    }

    .agenda-event-meta {
        gap: 8px;
    }

    .chat-composer form {
        grid-template-columns: minmax(0, 1fr) 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
    }
}
