:root {
    --bg: #F5F5F7;
    --surface: #ffffff;
    --surface-muted: #fff3eb;
    --elevated: #f8fbff;
    --text: #1A1A2E;
    --text-body: #31415e;
    --muted: #5c5c72;
    --primary: #FF6A00;
    --primary-dark: #d95500;
    --accent: #6B3CF4;
    --accent-pink: #F23AC7;
    --brand-gradient: linear-gradient(135deg, #FF6A00 0%, #F23AC7 50%, #6B3CF4 100%);
    --border: #e8e8ed;
    --shadow: 0 24px 70px rgba(26, 26, 46, 0.12);
    --radius: 26px;
    --header-bg: rgba(245, 245, 247, 0.88);
    --header-border: rgba(232, 232, 237, 0.75);
    --app-shell-bg: #eef2f7;
    --input-bg: #ffffff;
    --chip-bg: #edf6ff;
    --map-stripe: #fff3eb;
    --footer-bg: #1A1A2E;
    --footer-text: rgba(255, 255, 255, 0.76);
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #12121f;
    --surface: #1e1e30;
    --surface-muted: #2a2235;
    --elevated: #252538;
    --text: #F5F5F7;
    --text-body: #c4c4d4;
    --muted: #9898b0;
    --primary: #FF6A00;
    --primary-dark: #ff8533;
    --accent: #8b5cf6;
    --accent-pink: #F23AC7;
    --border: #34344a;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    --header-bg: rgba(26, 26, 46, 0.92);
    --header-border: rgba(52, 52, 74, 0.85);
    --app-shell-bg: #12121f;
    --input-bg: #2a2a3e;
    --chip-bg: #2a2235;
    --map-stripe: #2a2235;
    --footer-bg: #0f0f1a;
    --footer-text: rgba(255, 255, 255, 0.72);
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(1140px, calc(100% - 40px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    backdrop-filter: blur(18px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 78px;
    gap: 24px;
}

.logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-image {
    display: block;
    width: auto;
    height: 36px;
}

.logo-image--light {
    height: 34px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    color: var(--muted);
    font-weight: 600;
}

.main-nav a {
    transition: color 0.2s ease;
}

.main-nav a:hover {
    color: var(--primary);
}

.hero {
    overflow: hidden;
    padding: 92px 0 84px;
    background:
        radial-gradient(circle at 80% 20%, rgba(242, 58, 199, 0.16), transparent 34%),
        radial-gradient(circle at 15% 10%, rgba(255, 106, 0, 0.14), transparent 28%),
        var(--bg);
}

.hero-grid,
.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    align-items: center;
    gap: 54px;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 760px;
    margin-bottom: 24px;
    font-size: clamp(2.7rem, 6vw, 5.4rem);
    line-height: 0.98;
    letter-spacing: -0.06em;
}

h2 {
    margin-bottom: 18px;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
}

h3 {
    margin-bottom: 10px;
    font-size: 1.24rem;
    line-height: 1.25;
}

.hero-lead {
    max-width: 720px;
    color: var(--text-body);
    font-size: clamp(1.16rem, 2vw, 1.45rem);
}

.hero-text,
.section-note {
    color: var(--muted);
    font-size: 1.05rem;
}

.store-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 32px;
}

.store-button,
.primary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 22px;
    border-radius: 999px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 14px 28px rgba(255, 106, 0, 0.24);
}

.store-button-dark {
    background: var(--text);
    box-shadow: 0 14px 28px rgba(20, 32, 51, 0.18);
}

.hero-card {
    display: flex;
    justify-content: center;
}

.phone-mockup {
    position: relative;
    width: min(360px, 100%);
    min-height: 560px;
    padding: 28px;
    border: 12px solid #1A1A2E;
    border-radius: 44px;
    background:
        linear-gradient(160deg, rgba(255, 106, 0, 0.12), transparent 42%),
        var(--surface);
    box-shadow: var(--shadow);
}

.phone-bar {
    width: 112px;
    height: 7px;
    margin: 0 auto 42px;
    border-radius: 99px;
    background: #1A1A2E;
    opacity: 0.16;
}

.map-card,
.chat-bubble,
.quick-row span {
    border: 1px solid var(--border);
    background: var(--input-bg);
    box-shadow: 0 16px 36px rgba(20, 32, 51, 0.08);
}

.map-card {
    min-height: 220px;
    padding: 24px;
    border-radius: 28px;
    background:
        linear-gradient(135deg, rgba(107, 60, 244, 0.18), transparent),
        repeating-linear-gradient(45deg, var(--map-stripe), var(--map-stripe) 12px, var(--input-bg) 12px, var(--input-bg) 24px);
}

.map-card span {
    display: block;
    margin-bottom: 70px;
    color: var(--muted);
    font-weight: 700;
}

.map-card strong {
    display: block;
    font-size: 1.35rem;
}

.chat-bubble {
    margin: 22px 0;
    padding: 18px;
    border-radius: 22px 22px 22px 6px;
    color: var(--text-body);
    font-weight: 700;
}

.quick-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.quick-row span {
    padding: 18px 12px;
    border-radius: 18px;
    color: var(--primary-dark);
    font-weight: 800;
    text-align: center;
}

.section {
    padding: 92px 0;
}

.section-muted {
    background: var(--surface-muted);
}

.section-heading {
    max-width: 780px;
    margin-bottom: 42px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.feature-card,
.quote-card,
.step-card,
.price-card,
.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 16px 40px rgba(20, 32, 51, 0.06);
}

.feature-card {
    padding: 28px;
}

.feature-icon {
    display: inline-grid;
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 18px;
    background: var(--chip-bg);
    font-size: 1.7rem;
}

.feature-card p,
.step-card p,
.price-card p,
.faq-item p {
    color: var(--muted);
}

.check-list {
    display: grid;
    gap: 16px;
    margin: 26px 0 30px;
    padding: 0;
    list-style: none;
}

.check-list li {
    position: relative;
    padding-left: 34px;
    color: var(--text-body);
    font-weight: 600;
}

.check-list li::before {
    position: absolute;
    left: 0;
    top: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    content: "✓";
    font-size: 0.82rem;
    font-weight: 900;
    line-height: 22px;
    text-align: center;
}

.quote-card {
    margin: 0;
    padding: 38px;
}

.quote-card blockquote {
    margin: 0 0 20px;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.45;
}

.quote-card figcaption {
    color: var(--muted);
    font-weight: 700;
}

#agents .agent-panel {
    padding: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        linear-gradient(145deg, rgba(255, 106, 0, 0.92), rgba(107, 60, 244, 0.94)),
        var(--primary);
    color: #ffffff;
    box-shadow: 0 16px 40px rgba(20, 32, 51, 0.06);
}

#agents .agent-panel p {
    color: rgba(255, 255, 255, 0.78);
    font-size: 1.1rem;
}

.agent-badge {
    display: inline-flex;
    margin-bottom: 60px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    font-weight: 900;
    letter-spacing: 0.08em;
}

.steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px;
}

.step-card {
    padding: 24px;
}

.step-number {
    display: inline-grid;
    width: 42px;
    height: 42px;
    margin-bottom: 22px;
    place-items: center;
    border-radius: 14px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 900;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.price-card {
    padding: 34px;
}

.auth-card {
    display: grid;
    gap: 18px;
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 16px 40px rgba(20, 32, 51, 0.06);
}

.auth-card-login {
    display: flex;
    flex-direction: column;
}

.login-main {
    display: grid;
    gap: 18px;
}

.auth-card label {
    display: grid;
    gap: 8px;
    color: var(--text-body);
    font-weight: 800;
}

.auth-terms {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 600;
    line-height: 1.45;
}

.auth-terms input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
    height: 18px;
    margin-top: 2px;
    padding: 0;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.auth-terms a {
    color: var(--primary);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-terms a:hover {
    color: var(--primary-dark);
}

.auth-card input,
.auth-card select {
    width: 100%;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
}

.auth-card input:focus,
.auth-card select:focus {
    border-color: rgba(255, 106, 0, 0.7);
    outline: 3px solid rgba(255, 106, 0, 0.12);
}

.auth-submit {
    width: 100%;
    border: 0;
    cursor: pointer;
    font: inherit;
}

.auth-card .store-button,
.auth-card .store-button.store-button-dark,
.auth-card .primary-link,
.auth-card .captcha-refresh,
.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    min-height: 52px;
    padding: 0 22px;
    border: 0;
    background: var(--primary);
    color: #ffffff;
    font: inherit;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    box-shadow: 0 14px 28px rgba(255, 106, 0, 0.24);
}

.auth-card .store-button:hover,
.auth-card .store-button.store-button-dark:hover,
.auth-card .primary-link:hover,
.auth-card .captcha-refresh:hover,
.auth-submit:hover {
    background: var(--primary-dark);
    box-shadow: 0 16px 32px rgba(255, 106, 0, 0.28);
}

.captcha-row {
    display: grid;
    grid-template-columns: 200px minmax(120px, 1fr);
    gap: 12px;
    align-items: center;
}

.captcha-row img {
    width: 200px;
    height: 58px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--input-bg);
}

.captcha-refresh {
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.captcha-refresh:hover {
    transform: translateY(-1px);
}

.captcha-refresh:focus-visible {
    outline: 3px solid rgba(255, 106, 0, 0.18);
    outline-offset: 3px;
}

.social-login {
    display: grid;
    gap: 12px;
    margin-top: auto;
    padding-top: 24px;
}

.password-reset {
    display: grid;
    gap: 14px;
    padding-top: 4px;
    color: var(--muted);
}

.password-reset[hidden],
.social-login[hidden],
[data-login-password][hidden],
[data-login-submit][hidden],
[data-reset-start][hidden] {
    display: none;
}

.auth-result {
    margin-top: 24px;
    padding: 18px 22px;
    border: 1px solid rgba(107, 60, 244, 0.35);
    border-radius: 18px;
    background: rgba(107, 60, 244, 0.1);
    color: #0d6f60;
    font-weight: 800;
}

.auth-result-error {
    border-color: rgba(220, 38, 38, 0.28);
    background: rgba(220, 38, 38, 0.08);
    color: #b42318;
}

.agent-dashboard {
    min-height: 60vh;
}

.dashboard-card {
    padding: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.dashboard-card h1 {
    max-width: 760px;
    margin-bottom: 18px;
    font-size: clamp(2.4rem, 5vw, 4.4rem);
}

.dashboard-profile {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 30px;
}

.dashboard-profile > div {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--elevated);
}

.dashboard-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.dashboard-profile strong {
    overflow-wrap: anywhere;
    font-size: 1.18rem;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 28px;
}

.admin-dashboard {
    min-height: 70vh;
    padding-bottom: 48px;
}

.admin-shell {
    display: grid;
    gap: 24px;
    width: min(100%, calc(100% - 40px));
    max-width: 1440px;
}

.admin-head {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 18px;
    padding: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.admin-head h1 {
    max-width: none;
    margin-bottom: 8px;
    font-size: clamp(2rem, 4vw, 3.2rem);
}

.dashboard-profile--compact {
    margin-top: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-profile--compact > div {
    padding: 14px;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-tab {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--elevated);
    color: var(--muted);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.admin-tab:hover,
.admin-tab.is-active {
    border-color: rgba(255, 106, 0, 0.35);
    background: rgba(255, 106, 0, 0.08);
    color: var(--primary);
}

.admin-panel {
    display: none;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.admin-panel.is-active {
    display: block;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 22px;
}

.admin-toolbar input,
.admin-toolbar select {
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--elevated);
    color: var(--text);
    font: inherit;
}

.admin-toolbar input {
    min-width: min(280px, 100%);
    flex: 1 1 220px;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.admin-table tbody tr:hover,
.admin-table tbody tr.is-selected {
    background: rgba(255, 106, 0, 0.06);
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--primary-dark);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-badge-client {
    background: rgba(107, 60, 244, 0.14);
    color: #0d7f6c;
}

.admin-badge-agent {
    background: rgba(255, 106, 0, 0.12);
    color: var(--primary-dark);
}

.admin-badge-admin {
    background: rgba(20, 32, 51, 0.1);
    color: var(--text);
}

.admin-empty,
.admin-status {
    color: var(--muted);
}

.admin-panel-agent-dialogs {
    padding: 0;
    overflow: hidden;
}

.admin-panel-agent-dialogs.admin-panel.is-active {
    display: block;
}

.admin-agent-dialogs-layout {
    display: grid;
    grid-template-columns: minmax(320px, 1.1fr) minmax(0, 1fr);
    gap: 0;
    min-height: min(72vh, 640px);
    width: 100%;
}

.admin-agent-dialogs-list,
.admin-agent-dialogs-view {
    border: 1px solid var(--border);
    background: var(--elevated);
}

.admin-panel-agent-dialogs .admin-agent-dialogs-list {
    border-right: 1px solid var(--border);
    overflow: auto;
    padding: 16px;
}

.admin-panel-agent-dialogs .admin-agent-dialogs-view {
    border: none;
    min-height: inherit;
}

.admin-table-dialogs td:nth-child(3),
.admin-table-dialogs td:nth-child(4) {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-message-deleted {
    color: var(--muted, #6b7b8c);
    font-style: italic;
}

.admin-panel-chat {
    padding: 0;
    overflow: hidden;
}

.admin-panel-chat.admin-panel.is-active {
    display: block;
}

.admin-panel-chat .admin-chat-layout {
    width: 100%;
}

.admin-chat-layout {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 0;
    min-height: min(72vh, 640px);
    width: 100%;
}

.admin-chat-layout-single {
    grid-template-columns: minmax(0, 1fr);
}

.admin-chat-list,
.admin-chat-view {
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--elevated);
}

.admin-panel-chat .admin-chat-list,
.admin-panel-chat .admin-chat-view {
    border: none;
    border-radius: 0;
}

.admin-panel-chat .admin-chat-list {
    border-right: 1px solid var(--border);
}

.admin-chat-layout-single .admin-chat-view {
    border: 1px solid var(--border);
    border-radius: 20px;
}

.admin-chat-list {
    overflow: auto;
    max-height: none;
    min-height: inherit;
}

.admin-chat-view {
    display: flex;
    flex-direction: column;
    min-height: inherit;
    width: 100%;
}

.admin-chat-view-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 800;
}

.admin-messages {
    flex: 1;
    overflow: auto;
    padding: 16px 18px;
    display: grid;
    gap: 12px;
}

.admin-message {
    max-width: 85%;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.admin-message-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.admin-message-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message-status {
    margin-left: auto;
    letter-spacing: -0.08em;
    color: var(--muted);
}

.message-status-delivered,
.message-status-read {
    color: var(--primary);
}

.admin-message-edited {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--muted);
    font-style: italic;
}

.admin-message-deleted-peer {
    opacity: 0.72;
    background: var(--elevated);
    border-color: var(--border);
}

.admin-message-deleted-peer .admin-message-meta {
    color: var(--muted);
}

.admin-message-deleted-remote {
    margin: 0;
    color: var(--muted);
    text-decoration: line-through;
    font-style: italic;
}

.admin-message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.admin-message-own {
    margin-left: auto;
    background: rgba(255, 106, 0, 0.08);
    border-color: rgba(255, 106, 0, 0.2);
}

.admin-chat-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "attach attach"
        "input send";
    gap: 12px;
    padding: 16px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.chat-compose-attach {
    grid-area: attach;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--elevated);
}

.chat-file-picker {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.chat-file-picker-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.chat-file-picker-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(255, 106, 0, 0.35);
    border-radius: 12px;
    background: rgba(255, 106, 0, 0.08);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.chat-file-picker:hover .chat-file-picker-button,
.chat-file-picker:focus-within .chat-file-picker-button {
    background: rgba(255, 106, 0, 0.14);
    border-color: rgba(255, 106, 0, 0.55);
}

.chat-file-picker-hint {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
}

.chat-file-picker-names {
    flex: 1 1 180px;
    min-width: 0;
    font-size: 0.86rem;
    color: var(--text);
    font-weight: 600;
    word-break: break-word;
}

.admin-chat-compose > textarea {
    grid-area: input;
}

.admin-chat-compose > button[type="submit"] {
    grid-area: send;
    align-self: end;
    min-width: 132px;
    white-space: nowrap;
}

.admin-message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.admin-message-attachments a {
    color: var(--primary);
    font-weight: 700;
}

.admin-message-image {
    display: block;
    max-width: min(240px, 100%);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.admin-chat-compose textarea {
    flex: 1;
    min-height: 48px;
    max-height: 140px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--elevated);
    color: var(--text);
    font: inherit;
    resize: vertical;
}

.admin-inline-form {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: var(--elevated);
}

.admin-inline-form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.admin-inline-form input,
.admin-inline-form textarea {
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    font: inherit;
}

.admin-inline-form textarea {
    padding: 12px 14px;
    resize: vertical;
}

.admin-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-link-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.admin-detail-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.admin-conversation {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.admin-conversation:hover,
.admin-conversation.is-active {
    background: rgba(255, 106, 0, 0.08);
}

.admin-conversation-title {
    display: block;
    margin-bottom: 4px;
    font-weight: 800;
}

.admin-conversation-preview {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-detail {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--elevated);
}

.admin-detail h3 {
    margin-bottom: 12px;
}

.admin-detail-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}

.admin-pagination button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.price-card.highlighted {
    border-color: rgba(255, 106, 0, 0.4);
    box-shadow: var(--shadow);
}

.price {
    margin-bottom: 16px;
    color: var(--primary);
    font-size: clamp(2.5rem, 4vw, 4rem);
    font-weight: 900;
    letter-spacing: -0.05em;
}

.small-text {
    font-size: 0.95rem;
}

.faq-list {
    display: grid;
    gap: 14px;
}

.faq-item {
    padding: 0 26px;
}

.faq-item summary {
    cursor: pointer;
    padding: 22px 0;
    font-size: 1.08rem;
    font-weight: 800;
}

.faq-item p {
    margin-bottom: 24px;
}

.site-footer {
    padding: 56px 0;
    background: var(--footer-bg);
    color: var(--footer-text);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 1fr;
    gap: 34px;
    align-items: start;
}

.footer-logo {
    margin-bottom: 18px;
    color: #ffffff;
}

.site-footer a {
    color: #ffffff;
}

.footer-links {
    display: grid;
    gap: 12px;
    font-weight: 700;
}

.footer-actions {
    justify-content: flex-end;
    margin-top: 0;
}

@media (max-width: 980px) {
    .header-inner {
        align-items: flex-start;
        flex-direction: column;
        padding: 16px 0;
    }

    .main-nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
        white-space: nowrap;
    }

    .hero-grid,
    .split-grid,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .feature-grid,
    .auth-grid,
    .steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-profile,
    .footer-actions,
    .admin-head {
        grid-template-columns: 1fr;
    }

    .admin-chat-layout,
    .admin-agent-dialogs-layout {
        grid-template-columns: 1fr;
        min-height: 60vh;
    }

    .admin-panel-agent-dialogs .admin-agent-dialogs-list {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 320px;
    }

    .admin-panel-chat .admin-chat-list {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 220px;
    }

    .admin-chat-compose {
        grid-template-columns: 1fr;
        grid-template-areas:
            "attach"
            "input"
            "send";
    }

    .admin-chat-compose > button[type="submit"] {
        width: 100%;
    }
}

.legal-page {
    padding-top: 48px;
}

.legal-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 36px;
    align-items: start;
}

.legal-toc {
    position: sticky;
    top: 96px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 16px 40px rgba(20, 32, 51, 0.06);
}

.legal-toc-title {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.legal-toc nav {
    display: grid;
    gap: 8px;
}

.legal-toc a {
    color: var(--text-body);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.legal-toc a:hover {
    color: var(--primary);
}

.legal-content {
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 16px 40px rgba(20, 32, 51, 0.06);
}

.legal-header {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.legal-header h1 {
    margin: 0 0 12px;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.15;
}

.legal-meta {
    margin: 0;
    color: var(--muted);
}

.legal-section {
    scroll-margin-top: 96px;
    padding-top: 28px;
}

.legal-section + .legal-section {
    margin-top: 8px;
    padding-top: 28px;
    border-top: 1px solid rgba(220, 229, 242, 0.9);
}

.legal-section h2 {
    margin: 0 0 16px;
    font-size: 1.45rem;
    line-height: 1.25;
}

.legal-section h3 {
    margin: 22px 0 10px;
    font-size: 1.08rem;
    line-height: 1.35;
}

.legal-section p,
.legal-section li {
    color: var(--text-body);
}

.legal-section ul {
    margin: 0;
    padding-left: 1.2rem;
}

.legal-section li + li {
    margin-top: 8px;
}

.legal-section a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-section a:hover {
    color: var(--primary-dark);
}

.legal-back-link {
    display: inline-flex;
    margin-top: 8px;
    padding: 0 22px;
    width: auto;
    height: 48px;
    min-height: 48px;
    color: #ffffff;
    text-decoration: none;
}

.legal-section .legal-back-link:hover {
    color: #ffffff;
}

@media (max-width: 900px) {
    .legal-layout {
        grid-template-columns: 1fr;
    }

    .legal-toc {
        position: static;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 28px, 1140px);
    }

    .hero,
    .section {
        padding: 64px 0;
    }

    .store-actions,
    .store-button,
    .primary-link {
        width: 100%;
    }

    .feature-grid,
    .auth-grid,
    .dashboard-profile,
    .steps,
    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .phone-mockup {
        min-height: 480px;
        padding: 20px;
    }

    .captcha-row {
        grid-template-columns: 1fr;
    }

    .captcha-row img {
        width: 100%;
        max-width: 200px;
    }

    .legal-content {
        padding: 24px 20px;
    }
}

/* ── App shell (cabinet pages) ── */

.app-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--app-shell-bg);
}

.app-body .agent-dashboard,
.app-body .admin-dashboard {
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── Agent dashboard (2026) ── */

.agent-dashboard {
    --agent-sidebar: #1A1A2E;
    --agent-sidebar-hover: rgba(255, 255, 255, 0.06);
    --agent-sidebar-active: rgba(255, 106, 0, 0.16);
    --agent-sidebar-text: rgba(255, 255, 255, 0.88);
    --agent-sidebar-muted: rgba(255, 255, 255, 0.62);
    --agent-surface: #ffffff;
    --agent-surface-muted: #f8fafc;
    --agent-border: #e8edf4;
    --agent-radius: 14px;
    --agent-radius-sm: 10px;
    --agent-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0;
    background: var(--app-shell-bg);
}

.agent-dashboard.section {
    padding: 0;
}

.agent-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
}

.agent-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 14px;
    background: var(--agent-sidebar);
    color: var(--agent-sidebar-text);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
}

.agent-sidebar-header,
.agent-nav {
    color: var(--agent-sidebar-text);
}

.agent-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 4px;
}

.agent-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.agent-sidebar-brand .logo-image {
    height: 32px;
}

.agent-nav {
    display: grid;
    gap: 4px;
    flex: 1;
    align-content: start;
}

.agent-nav .agent-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--agent-radius-sm);
    background: transparent;
    color: var(--agent-sidebar-text);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.agent-nav .agent-nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: currentColor;
    opacity: 0.9;
}

.agent-nav .agent-nav-item:hover {
    background: var(--agent-sidebar-hover);
    color: #ffffff;
}

.agent-nav .agent-nav-item.is-active {
    background: var(--agent-sidebar-active);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--primary);
}

.agent-sidebar-footer {
    display: grid;
    gap: 10px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.agent-sidebar-user {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--agent-radius-sm);
    background: rgba(255, 255, 255, 0.04);
}

.agent-user-name {
    overflow-wrap: anywhere;
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
}

.agent-user-meta {
    overflow-wrap: anywhere;
    color: var(--agent-sidebar-muted);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.35;
}

.agent-sidebar-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--agent-radius-sm);
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.agent-sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.agent-sidebar-logout svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

.agent-sidebar-logout--full {
    width: 100%;
    min-height: 40px;
    padding: 0 14px;
}

.agent-sidebar-logout--compact {
    display: none;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    flex-shrink: 0;
}

.agent-channels {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    background: var(--agent-surface);
    box-shadow: var(--agent-shadow);
}

.agent-channels-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.agent-channels-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agent-channel-btn {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--agent-border);
    border-radius: 999px;
    background: var(--agent-surface-muted);
    color: var(--text);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.agent-channel-btn:hover {
    border-color: rgba(255, 106, 0, 0.28);
    background: var(--elevated);
    color: var(--primary-dark);
}

.agent-toolbar--search {
    justify-content: space-between;
}

.agent-toolbar--search .agent-toolbar-search {
    flex: 1 1 320px;
}

.agent-main {
    display: grid;
    align-content: start;
    gap: 20px;
    min-width: 0;
    padding: 28px 32px 40px;
    overflow: auto;
    color: var(--text);
}

.agent-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.agent-topbar-eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.agent-topbar-title {
    margin: 0 0 4px;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.agent-topbar-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.agent-dashboard .agent-panel,
.agent-dashboard .admin-panel {
    color: var(--text);
}

.agent-dashboard .agent-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.agent-dashboard .agent-panel p.admin-status,
.agent-dashboard .agent-panel-head .admin-status {
    color: var(--muted);
}

.agent-dashboard .agent-panel-head h2,
.agent-dashboard .agent-panel h3 {
    color: var(--text);
}

.agent-dashboard .admin-table th {
    color: var(--muted);
}

.agent-dashboard .admin-table td {
    color: var(--text);
}

.agent-panel-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.agent-panel-head h2 {
    margin: 0 0 4px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.agent-panel-head .admin-status {
    margin: 0;
    font-size: 0.88rem;
}

.agent-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--agent-radius-sm);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.agent-btn--primary {
    border-color: transparent;
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(255, 106, 0, 0.22);
}

.agent-btn--primary:hover {
    background: var(--primary-dark);
}

.agent-btn--secondary {
    border-color: var(--agent-border);
    background: var(--agent-surface);
    color: var(--text);
}

.agent-btn--secondary:hover {
    border-color: rgba(255, 106, 0, 0.28);
    background: var(--elevated);
    color: var(--primary-dark);
}

.agent-btn--ghost {
    border-color: transparent;
    background: transparent;
    color: var(--primary);
}

.agent-btn--ghost:hover {
    background: rgba(255, 106, 0, 0.08);
}

.agent-btn--danger {
    border-color: rgba(220, 38, 38, 0.2);
    background: rgba(220, 38, 38, 0.06);
    color: #b42318;
}

.agent-btn--danger:hover {
    background: rgba(220, 38, 38, 0.12);
}

.agent-btn--sm {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.82rem;
}

.agent-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    background: var(--agent-surface);
    box-shadow: var(--agent-shadow);
}

.agent-toolbar--compact {
    margin-top: 16px;
}

.agent-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agent-toolbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 240px;
    min-width: min(100%, 240px);
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface-muted);
}

.agent-toolbar-search svg {
    width: 18px;
    height: 18px;
    fill: var(--muted);
    flex-shrink: 0;
}

.agent-toolbar-search input,
.agent-toolbar input {
    width: 100%;
    min-height: 38px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
}

.agent-toolbar-search input:focus,
.agent-toolbar input:focus {
    outline: none;
}

.agent-table-card {
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    background: var(--agent-surface);
    box-shadow: var(--agent-shadow);
    overflow: hidden;
}

.agent-dashboard .admin-table-wrap {
    overflow-x: auto;
}

.agent-dashboard .admin-table {
    font-size: 0.9rem;
}

.agent-dashboard .admin-table th {
    padding: 12px 16px;
    border-bottom: 1px solid var(--agent-border);
    background: var(--agent-surface-muted);
    font-size: 0.72rem;
}

.agent-dashboard .admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.agent-dashboard .admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.agent-dashboard .admin-table tbody tr:hover,
.agent-dashboard .admin-table tbody tr.is-selected {
    background: rgba(255, 106, 0, 0.04);
}

.agent-dashboard .admin-badge {
    min-height: 24px;
    padding: 0 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.agent-chat-shell {
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    background: var(--agent-surface);
    box-shadow: var(--agent-shadow);
    overflow: hidden;
}

.agent-chat-sidebar {
    display: flex;
    flex-direction: column;
    min-height: inherit;
    border-right: 1px solid var(--agent-border);
    background: var(--agent-surface-muted);
    overflow: hidden;
}

.agent-chat-mode {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 10px;
    border-bottom: 1px solid var(--agent-border);
    background: var(--agent-surface);
}

.agent-chat-mode-btn {
    min-height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.agent-chat-mode-btn:hover {
    background: var(--agent-surface-muted);
    color: var(--text);
}

.agent-chat-mode-btn.is-active {
    background: rgba(255, 106, 0, 0.1);
    color: var(--primary-dark);
}

.agent-chat-mode-panel {
    display: none;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.agent-chat-mode-panel.is-active {
    display: flex;
    flex-direction: column;
}

.agent-chat-mode-panel .admin-chat-list,
.agent-groups-list {
    flex: 1;
    overflow: auto;
}

.agent-groups-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px 0;
}

.agent-groups-toolbar .admin-status {
    margin: 0;
    font-size: 0.82rem;
}

.agent-group-create {
    display: grid;
    gap: 10px;
    margin: 12px 14px;
    padding: 12px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface);
}

.agent-group-create label {
    display: grid;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}

.agent-group-create input,
.agent-group-create textarea {
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--agent-border);
    border-radius: 8px;
    background: var(--agent-surface-muted);
    color: var(--text);
    font: inherit;
    font-weight: 500;
}

.agent-group-create textarea {
    padding: 8px 10px;
    resize: vertical;
}

.agent-chat-messages-pane,
.agent-group-manage-pane {
    display: flex;
    flex-direction: column;
    min-height: inherit;
}

.agent-group-manage-body {
    flex: 1;
    overflow: auto;
    padding: 16px 18px;
}

.agent-group-manage-body .admin-inline-form {
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface-muted);
}

.agent-group-manage-body .admin-inline-form label {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--muted);
}

.agent-group-manage-body .admin-inline-form input,
.agent-group-manage-body .admin-inline-form textarea,
.agent-group-manage-body .admin-inline-form select {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--agent-border);
    border-radius: 8px;
    background: var(--agent-surface);
    color: var(--text);
    font: inherit;
}

.agent-group-manage-body .admin-inline-form textarea {
    padding: 10px 12px;
}

.agent-dashboard .admin-panel-chat {
    padding: 0;
}

.agent-dashboard .admin-chat-layout {
    min-height: min(68vh, 620px);
}

.agent-dashboard .admin-chat-list,
.agent-dashboard .admin-chat-view {
    background: var(--agent-surface);
}

.agent-dashboard .admin-chat-list {
    background: transparent;
}

.agent-dashboard .admin-chat-view-head {
    padding: 16px 20px;
    background: var(--agent-surface);
    font-size: 0.95rem;
    font-weight: 700;
}

.agent-dashboard .admin-messages {
    padding: 20px;
    background: linear-gradient(180deg, var(--elevated) 0%, var(--surface) 100%);
}

.agent-dashboard .admin-message {
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.agent-dashboard .admin-message-own {
    background: linear-gradient(135deg, rgba(255, 106, 0, 0.1), rgba(107, 60, 244, 0.08));
    border-color: rgba(255, 106, 0, 0.16);
}

.agent-dashboard .admin-conversation {
    padding: 14px 16px;
    border-bottom: 1px solid var(--agent-border);
    transition: background 0.15s ease;
}

.agent-dashboard .admin-conversation:hover,
.agent-dashboard .admin-conversation.is-active {
    background: rgba(255, 106, 0, 0.08);
}

.agent-dashboard .admin-conversation.is-active {
    box-shadow: inset 3px 0 0 var(--primary);
}

.agent-dashboard .admin-conversation {
    color: var(--text);
}

.agent-dashboard .admin-conversation-title {
    font-size: 0.9rem;
    color: var(--text);
}

.agent-dashboard .admin-conversation-preview {
    color: var(--muted);
}

.agent-dashboard .admin-chat-compose {
    background: var(--agent-surface);
}

.agent-dashboard .chat-compose-attach {
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface-muted);
}

.agent-dashboard .chat-file-picker-button {
    min-height: 36px;
    border-radius: 8px;
    font-size: 0.84rem;
}

.agent-dashboard .admin-chat-compose textarea {
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface-muted);
}

.agent-form-card {
    margin-bottom: 16px;
    padding: 20px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    background: var(--agent-surface);
    box-shadow: var(--agent-shadow);
}

.agent-form-card-head h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 800;
}

.agent-form-card-head p {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 0.88rem;
}

.agent-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.agent-form-span {
    grid-column: 1 / -1;
}

.agent-dashboard .admin-inline-form {
    margin-bottom: 16px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.agent-form-card.admin-inline-form label,
.agent-detail-card .admin-inline-form label {
    display: grid;
    gap: 6px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--muted);
}

.agent-form-card.admin-inline-form input,
.agent-form-card.admin-inline-form textarea,
.agent-form-card.admin-inline-form select,
.agent-detail-card .admin-inline-form input,
.agent-detail-card .admin-inline-form textarea,
.agent-detail-card .admin-inline-form select {
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface-muted);
    color: var(--text);
    font-weight: 500;
}

.agent-form-card.admin-inline-form textarea,
.agent-detail-card .admin-inline-form textarea {
    padding: 10px 12px;
}

.agent-detail-card {
    margin-top: 16px;
    padding: 20px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    background: var(--agent-surface);
    box-shadow: var(--agent-shadow);
}

.agent-detail-card h3 {
    margin: 0 0 16px;
    font-size: 1.05rem;
    font-weight: 800;
}

.agent-dashboard .admin-detail-list li {
    padding: 12px 14px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius-sm);
    background: var(--agent-surface-muted);
}

[data-agent-app][hidden],
[data-chat-messages-pane][hidden],
[data-group-manage-pane][hidden] {
    display: none !important;
}

@media (max-width: 1100px) {
    .agent-layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .agent-main {
        padding: 24px 20px 32px;
    }
}

@media (max-width: 900px) {
    .agent-layout {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .agent-sidebar {
        display: contents;
    }

    .agent-sidebar-header {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        order: 1;
        padding: 12px 16px;
        background: var(--agent-sidebar);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .agent-sidebar-brand {
        padding: 0;
    }

    .agent-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        order: 3;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
        flex: none;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        background: var(--agent-sidebar);
    }

    .agent-nav .agent-nav-item {
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        min-height: 56px;
        padding: 6px 4px;
        font-size: 0.72rem;
        color: rgba(255, 255, 255, 0.86);
    }

    .agent-nav .agent-nav-item svg {
        width: 22px;
        height: 22px;
    }

    .agent-nav .agent-nav-item.is-active {
        box-shadow: none;
        background: var(--agent-sidebar-active);
        color: #ffffff;
    }

    .agent-sidebar-footer {
        order: 2;
        display: block;
        margin: 0;
        padding: 10px 16px;
        border-top: 0;
        border-bottom: 1px solid var(--agent-border);
        background: var(--app-shell-bg);
        color: var(--text);
    }

    .agent-sidebar-footer .agent-sidebar-user {
        padding: 0;
        border: 0;
        background: transparent;
    }

    .agent-sidebar-footer .agent-user-name {
        color: var(--text);
        font-size: 0.9rem;
    }

    .agent-sidebar-footer .agent-user-meta {
        color: var(--muted);
        font-size: 0.8rem;
    }

    .agent-sidebar-logout--full {
        display: none;
    }

    .agent-sidebar-logout--compact {
        display: inline-flex;
    }

    .agent-main {
        order: 2;
        flex: 1;
        padding: 20px 16px calc(96px + env(safe-area-inset-bottom, 0px));
    }

    .agent-form-grid {
        grid-template-columns: 1fr;
    }

    .agent-toolbar,
    .agent-toolbar--search {
        flex-direction: column;
        align-items: stretch;
    }

    .agent-toolbar--search .agent-toolbar-search {
        flex: 1 1 auto;
    }

    .agent-channels-list {
        display: grid;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .agent-dashboard .admin-chat-layout {
        grid-template-columns: 1fr;
        min-height: 60vh;
    }

    .agent-dashboard .agent-chat-sidebar {
        max-height: 240px;
        border-bottom: 1px solid var(--agent-border);
    }
}

/* ── Theme toggle ── */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
    border-color: rgba(255, 106, 0, 0.45);
    color: var(--primary);
}

.theme-toggle:focus-visible {
    outline: 3px solid rgba(255, 106, 0, 0.22);
    outline-offset: 2px;
}

.theme-toggle-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.theme-toggle-icon--moon {
    display: none;
}

[data-theme="dark"] .theme-toggle-icon--sun {
    display: none;
}

[data-theme="dark"] .theme-toggle-icon--moon {
    display: block;
}

.app-body > .theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 60;
    box-shadow: var(--shadow);
}

[data-theme="dark"] .agent-dashboard {
    --agent-surface: #1e1e30;
    --agent-surface-muted: #252538;
    --agent-border: #34344a;
    --agent-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .phone-mockup {
    border-color: #34344a;
    background:
        linear-gradient(160deg, rgba(255, 106, 0, 0.1), transparent 42%),
        var(--surface);
}

[data-theme="dark"] .auth-card input,
[data-theme="dark"] .auth-card select,
[data-theme="dark"] .admin-chat-compose input,
[data-theme="dark"] .admin-chat-compose textarea,
[data-theme="dark"] .agent-toolbar-search input,
[data-theme="dark"] .agent-form-grid input,
[data-theme="dark"] .agent-form-grid select,
[data-theme="dark"] .agent-form-grid textarea {
    background: var(--input-bg);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .captcha-row img,
[data-theme="dark"] .admin-chat-message img {
    opacity: 0.92;
}

@media (max-width: 980px) {
    .app-body > .theme-toggle {
        top: 12px;
        right: 12px;
    }
}
