:root {
    --font-sans: "Manrope", "Segoe UI", system-ui, sans-serif;
    --bg-app: #090d12;
    --bg-sidebar: #0b1017;
    --bg-surface: #111821;
    --bg-surface-2: #151e29;
    --bg-muted: #1a2532;
    --bg-subtle: #202c3a;
    --border-soft: #253241;
    --border-strong: #344456;
    --text-primary: #edf4fb;
    --text-secondary: #aab7c5;
    --text-muted: #778698;
    --accent: #4fb7ff;
    --accent-strong: #8bd2ff;
    --accent-soft: rgba(79, 183, 255, 0.13);
    --success: #65d49b;
    --success-soft: rgba(101, 212, 155, 0.12);
    --warning: #f1b764;
    --warning-soft: rgba(241, 183, 100, 0.13);
    --danger: #ff7d7d;
    --danger-soft: rgba(255, 125, 125, 0.12);
    --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 24px 70px rgba(0, 0, 0, 0.34);
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --space-1: 6px;
    --space-2: 10px;
    --space-3: 14px;
    --space-4: 18px;
    --space-5: 24px;
    --space-6: 32px;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-width: 0;
    background:
        linear-gradient(135deg, rgba(79, 183, 255, 0.08), transparent 32rem),
        linear-gradient(180deg, #0b1118 0%, var(--bg-app) 100%);
    color: var(--text-primary);
    font-family: var(--font-sans);
}

a,
button,
input,
label,
textarea,
select {
    font-family: inherit;
}

a {
    color: inherit;
}

button,
[role="button"],
.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 750;
    letter-spacing: 0;
    line-height: 1.2;
    text-decoration: none;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

button:not(.secondary):not(.ghost):not(.danger),
.button-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #06111a;
}

button:not(.secondary):not(.ghost):not(.danger):hover,
.button-primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

button.secondary,
.button-secondary,
[role="button"].secondary {
    background: var(--bg-muted);
    border-color: var(--border-soft);
    color: var(--text-primary);
}

button.secondary:hover,
.button-secondary:hover,
[role="button"].secondary:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
}

button.ghost,
.button-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}

button.ghost:hover,
.button-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

button.danger,
.button-danger {
    background: var(--danger-soft);
    border-color: rgba(255, 125, 125, 0.22);
    color: var(--danger);
}

button.danger:hover,
.button-danger:hover {
    background: rgba(255, 125, 125, 0.18);
}

button.danger-outline,
.button-danger-outline {
    background: transparent;
    border-color: rgba(255, 125, 125, 0.32);
    color: var(--danger);
}

button.danger-outline:hover,
.button-danger-outline:hover {
    background: rgba(255, 125, 125, 0.12);
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: var(--space-5);
}

.auth-layout {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
    gap: var(--space-4);
    align-items: stretch;
}

.auth-hero,
.auth-card {
    min-width: 0;
    background: rgba(17, 24, 33, 0.92);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
}

.auth-hero {
    min-height: 420px;
    padding: var(--space-6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.auth-brand {
    display: grid;
    gap: var(--space-4);
    max-width: 560px;
}

.brand-badge {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid rgba(79, 183, 255, 0.22);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
}

.auth-title {
    margin: 0;
    max-width: 12ch;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.04;
    letter-spacing: 0;
}

.auth-subtitle {
    margin: 0;
    max-width: 44ch;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.auth-card {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-card-head h1 {
    margin: 0;
    font-size: 1.65rem;
    letter-spacing: 0;
}

.auth-card-head p {
    margin: var(--space-2) 0 0;
    color: var(--text-secondary);
    line-height: 1.55;
}

.auth-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    margin: var(--space-4) 0;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
}

.auth-switch a {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

.auth-switch a.active {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.auth-switch-login,
.auth-switch-register,
.auth-switch-recovery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-stack {
    display: grid;
    gap: var(--space-4);
}

.field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.field-group {
    display: grid;
    gap: var(--space-3);
}

.toggle-row {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.toggle-row input {
    width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
}

.field label,
.field .label {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 800;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: #0d141d;
    color: var(--text-primary);
    box-shadow: none;
}

.field textarea {
    min-height: 128px;
    resize: vertical;
}

.field input[type="file"] {
    min-height: 48px;
    padding: 10px 12px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: rgba(79, 183, 255, 0.62);
    box-shadow: 0 0 0 3px rgba(79, 183, 255, 0.13);
    outline: none;
}

.alert {
    padding: 12px 14px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.alert-error {
    background: var(--danger-soft);
    border-color: rgba(255, 125, 125, 0.22);
    color: #ffc8c8;
}

.alert-success {
    background: var(--success-soft);
    border-color: rgba(101, 212, 155, 0.22);
    color: #bdf5d4;
}

.alert-warning {
    background: var(--warning-soft);
    border-color: rgba(241, 183, 100, 0.22);
    color: #ffe1ad;
}

.auth-inline-form {
    margin-top: var(--space-4);
}

.auth-message-card {
    gap: var(--space-4);
}

.auth-message-actions {
    display: grid;
    gap: var(--space-3);
}

.auth-telegram-flow {
    display: grid;
    gap: var(--space-4);
}

.auth-code-form {
    gap: var(--space-4);
}

.auth-code-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--space-2);
}

.auth-code-cell {
    width: 100%;
    height: 56px;
    min-height: 56px;
    padding: 0 !important;
    border-radius: 10px;
    text-align: center;
    vertical-align: middle;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 56px;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
    direction: ltr;
    unicode-bidi: plaintext;
    caret-color: var(--accent-strong);
    appearance: textfield;
    -moz-appearance: textfield;
}

.auth-code-cell::-webkit-outer-spin-button,
.auth-code-cell::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.auth-code-cell::placeholder {
    color: transparent;
}

.auth-code-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.app-shell {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: var(--space-5) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    border-right: 1px solid var(--border-soft);
    background: rgba(11, 16, 23, 0.96);
}

.sidebar-brand {
    display: grid;
    gap: var(--space-2);
}

.sidebar .brand-badge {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-nav {
    display: grid;
    gap: var(--space-4);
}

.nav-group {
    display: grid;
    gap: var(--space-2);
}

.nav-group-title,
.nav-group-summary {
    padding: 0 var(--space-2);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 850;
    letter-spacing: 0;
    list-style: none;
    text-transform: uppercase;
}

.nav-group-summary {
    cursor: pointer;
}

.nav-group-summary::-webkit-details-marker {
    display: none;
}

.nav-group-links {
    display: grid;
    gap: 6px;
    margin-top: var(--space-2);
}

.nav-link {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.3;
    text-decoration: none;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nav-link span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.nav-link.active {
    background: transparent;
    border-color: transparent;
    color: var(--text-primary);
}

.nav-link-accent {
    color: var(--text-secondary);
}

.nav-link-star {
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 850;
}

.nav-link-bullet {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--border-strong);
}

.nav-link.active .nav-link-bullet {
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 183, 255, 0.12);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-soft);
}

.profile-card {
    display: grid;
    gap: var(--space-3);
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
}

.profile-card strong,
.profile-card span {
    display: block;
    overflow-wrap: anywhere;
}

.profile-card strong {
    font-size: 0.9rem;
}

.profile-card span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.profile-card form,
.profile-card button {
    width: 100%;
}

.main {
    min-width: 0;
    padding: var(--space-5);
}

.workspace {
    min-width: 0;
    min-height: calc(100vh - (var(--space-5) * 2));
    padding: var(--space-5);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    background:
        radial-gradient(circle at 12% 0%, rgba(79, 183, 255, 0.08), transparent 34rem),
        rgba(17, 24, 33, 0.78);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

.workspace:has(.client-page) {
    display: grid;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.campaign-header {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) max-content;
    align-items: end;
    margin-bottom: var(--space-6);
}

.section-headline {
    display: grid;
    min-width: 0;
    gap: var(--space-2);
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 800;
}

.section-title {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 1.9rem);
    line-height: 1.15;
    letter-spacing: 0;
}

.section-copy {
    max-width: 72ch;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.55;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
}

.icon-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.icon-button-symbol {
    font-size: 1rem;
    line-height: 1;
}

.campaign-actions {
    width: max-content;
    max-width: 100%;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
}

.campaign-actions form {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    margin: 0;
}

.campaign-actions button,
.campaign-actions [role="button"] {
    margin: 0;
}

.campaign-actions > .campaign-action-button,
.campaign-actions form > .campaign-action-button {
    display: inline-flex;
    align-self: center;
    align-items: center;
    justify-content: center;
    height: 54px;
    line-height: 1;
}

.campaign-status {
    flex: 0 0 auto;
    min-width: 156px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    color: var(--text-primary);
}

.status-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 5px rgba(255, 125, 125, 0.12);
}

.campaign-action-button {
    flex: 0 0 auto;
    min-width: 148px;
    padding: 0 20px;
    border-radius: var(--radius-md);
    font-size: 0.98rem;
    white-space: nowrap;
}

button.campaign-action-start {
    background: rgba(101, 212, 155, 0.08);
    border-color: rgba(101, 212, 155, 0.28);
    color: var(--text-primary);
}

button.campaign-action-start:hover {
    background: rgba(101, 212, 155, 0.14);
    border-color: rgba(101, 212, 155, 0.42);
}

.campaign-action-pause {
    border-color: rgba(170, 183, 197, 0.22);
}

button.campaign-action-delete {
    min-width: 260px;
    padding-inline: 22px;
    border-color: rgba(255, 125, 125, 0.42);
    color: var(--danger);
}

.action-icon {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.action-icon-play::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 5px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 11px solid var(--success);
}

.action-icon-pause::before,
.action-icon-pause::after {
    content: "";
    position: absolute;
    top: 3px;
    width: 5px;
    height: 12px;
    border-radius: 2px;
    background: var(--text-secondary);
}

.action-icon-pause::before {
    left: 3px;
}

.action-icon-pause::after {
    right: 3px;
}

.action-icon-gear::before {
    content: "";
    position: absolute;
    inset: 3px;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    box-shadow:
        0 -6px 0 -3px var(--text-secondary),
        0 6px 0 -3px var(--text-secondary),
        6px 0 0 -3px var(--text-secondary),
        -6px 0 0 -3px var(--text-secondary);
}

.action-icon-trash::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 6px;
    width: 8px;
    height: 9px;
    border: 2px solid var(--danger);
    border-top: 0;
    border-radius: 0 0 3px 3px;
}

.action-icon-trash::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 3px;
    width: 10px;
    height: 2px;
    border-radius: 999px;
    background: var(--danger);
}

.section-actions form,
.modal-actions form,
.action-row form {
    margin: 0;
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.section-alert {
    margin-bottom: var(--space-4);
}

.summary-card {
    min-width: 0;
    min-height: 94px;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 18px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
        rgba(13, 20, 29, 0.7);
}

.summary-icon {
    position: relative;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 16px;
    background: rgba(79, 183, 255, 0.1);
    color: var(--accent);
}

.summary-icon::before {
    font-size: 1.35rem;
    font-weight: 850;
    line-height: 1;
}

.summary-icon-clients::before,
.summary-icon-accounts::before {
    content: "◎";
}

.summary-icon-active {
    background: rgba(101, 212, 155, 0.1);
    color: var(--success);
}

.summary-icon-active::before {
    content: "○";
}

.summary-icon-silent {
    background: rgba(176, 106, 255, 0.12);
    color: #c78cff;
}

.summary-icon-silent::before {
    content: "◔";
}

.summary-icon-replies {
    background: rgba(241, 137, 55, 0.12);
    color: #ff9b52;
}

.summary-icon-replies::before {
    content: "▱";
}

.summary-label {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 850;
    letter-spacing: 0;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.summary-value {
    display: block;
    margin-top: 6px;
    font-size: 1.35rem;
    font-weight: 850;
    letter-spacing: 0;
}

.board {
    display: grid;
    gap: var(--space-3);
    min-width: 0;
}

.board-columns-5 {
    grid-template-columns: repeat(5, minmax(240px, 1fr));
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: var(--space-3);
    scroll-snap-type: x proximity;
}

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

.board::-webkit-scrollbar,
.column-cards::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.modal-card::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.board::-webkit-scrollbar-thumb,
.column-cards::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(170, 183, 197, 0.28);
}

.board-column {
    min-width: 0;
    min-height: 595px;
    padding: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)),
        rgba(13, 20, 29, 0.76);
    scroll-snap-align: start;
    overflow: hidden;
}

.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 20px 22px;
    border: 0;
    border-bottom: 1px solid rgba(37, 50, 65, 0.72);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.018);
}

.column-title-wrap {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.column-title {
    margin: 0;
    font-size: 1.04rem;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.column-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.count-pill {
    display: inline-flex;
    min-width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 850;
}

.column-cards {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    overflow-y: auto;
    padding: var(--space-3);
}

.board-card {
    display: grid;
    min-width: 0;
    gap: var(--space-3);
    padding: 16px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
        rgba(21, 30, 41, 0.86);
}

.board-card-head {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.board-card-title {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.board-card-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.board-card-preview {
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.board-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    min-width: 0;
}

.board-card-open {
    max-height: 0;
    min-height: 0;
    margin: calc(var(--space-3) * -1) 0 0;
    border-width: 0;
    padding-block: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition:
        max-height 0.16s ease,
        min-height 0.16s ease,
        margin 0.16s ease,
        border-width 0.16s ease,
        padding 0.16s ease,
        opacity 0.16s ease,
        transform 0.16s ease;
}

.board-card:hover .board-card-open,
.board-card:focus-within .board-card-open {
    max-height: 44px;
    min-height: 38px;
    margin-top: 0;
    border-width: 1px;
    padding-block: 8px;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.board-card-status-note {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.79rem;
    line-height: 1.35;
}

.status-chip {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.status-chip.success {
    background: var(--success-soft);
    border-color: rgba(101, 212, 155, 0.18);
    color: var(--success);
}

.status-chip.warning {
    background: var(--warning-soft);
    border-color: rgba(241, 183, 100, 0.18);
    color: var(--warning);
}

.status-chip.danger {
    background: var(--danger-soft);
    border-color: rgba(255, 125, 125, 0.18);
    color: var(--danger);
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.action-row button {
    min-height: 38px;
    padding: 8px 11px;
    font-size: 0.82rem;
}

.empty-state {
    padding: var(--space-4);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    line-height: 1.5;
}

.empty-state strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.board-column .empty-state {
    min-height: 100%;
    display: grid;
    place-items: center;
    align-content: center;
    gap: var(--space-3);
    padding: var(--space-6) var(--space-4);
    text-align: center;
}

.board-column .empty-state strong {
    margin: 0;
    font-size: 1.05rem;
}

.board-column .empty-state div {
    max-width: 20ch;
}

.empty-icon {
    position: relative;
    width: 34px;
    height: 24px;
    display: inline-block;
    border: 2px solid var(--border-strong);
    border-radius: 7px;
    opacity: 0.9;
}

.empty-icon::before {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    top: -7px;
    height: 10px;
    border: 2px solid var(--border-strong);
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
}

.stub-panel {
    max-width: 680px;
    padding: var(--space-4);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: rgba(13, 20, 29, 0.7);
}

.client-back {
    width: fit-content;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.16s ease;
}

.client-back:hover {
    color: var(--text-primary);
}

.client-page {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: var(--space-4);
}

.client-workspace {
    display: grid;
    min-width: 0;
    min-height: 0;
    height: 100%;
    grid-template-columns: minmax(0, 520px);
    justify-content: center;
    gap: var(--space-4);
    align-items: start;
    transition: grid-template-columns 0.28s ease, justify-content 0.28s ease;
}

.client-workspace.chat-open {
    grid-template-columns: minmax(380px, 460px) minmax(560px, 0.92fr);
    justify-content: stretch;
    align-items: stretch;
    height: 100%;
}

.client-profile-panel,
.chat-panel {
    min-width: 0;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: rgba(13, 20, 29, 0.78);
    overflow: hidden;
}

.client-profile-panel {
    display: grid;
    align-content: start;
    justify-items: center;
    gap: var(--space-3);
    padding: var(--space-6);
    text-align: center;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.client-workspace.chat-open .client-profile-panel {
    height: 100%;
    align-content: center;
    padding-block: calc(var(--space-6) * 1.25);
    animation: client-profile-dock 0.28s ease both;
}

.client-profile-panel h2,
.client-profile-panel p {
    max-width: 100%;
    margin: 0;
    overflow-wrap: anywhere;
}

.client-avatar {
    width: 88px;
    height: 88px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(79, 183, 255, 0.2);
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 2rem;
    font-weight: 850;
}

.client-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.client-details {
    width: 100%;
    display: grid;
    gap: var(--space-3);
    margin: var(--space-3) 0;
    text-align: left;
}

.client-details div {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    gap: var(--space-3);
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--border-soft);
}

.client-details dt {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.client-details dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.client-profile-actions {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
}

.client-workspace.chat-open .client-profile-actions {
    grid-template-columns: 1fr;
}

.client-tool-button {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 8px 9px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    white-space: nowrap;
}

.client-chat-slot:empty {
    display: none;
}

.client-workspace.chat-open .client-chat-slot {
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    animation: client-chat-reveal 0.3s ease both;
}

.chat-panel {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 180px),
        rgba(10, 17, 25, 0.92);
}

.chat-header {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(21, 30, 41, 0.72);
}

.chat-header div {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.chat-header strong,
.chat-header span {
    overflow-wrap: anywhere;
}

.chat-header span {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.chat-close {
    width: 36px;
    height: 36px;
    min-height: 36px;
    flex: 0 0 auto;
    padding: 0;
    border-radius: 50%;
    font-size: 1.35rem;
    line-height: 1;
}

.chat-messages {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    gap: 7px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(128, 148, 168, 0.5) transparent;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    padding: 16px 10px 16px 16px;
    scroll-behavior: smooth;
}

@media (min-width: 1081px) {
    .client-page {
        height: calc(100vh - (var(--space-5) * 4) - 2px);
    }

    .client-workspace.chat-open {
        min-height: 0;
    }
}

.chat-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 8px 0;
}

.chat-date-separator span {
    padding: 5px 10px;
    border: 1px solid rgba(52, 68, 86, 0.72);
    border-radius: 999px;
    background: rgba(21, 30, 41, 0.88);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 750;
}

.chat-message {
    max-width: min(78%, 620px);
    display: grid;
    gap: 5px;
    padding: 9px 11px 7px;
    border: 1px solid rgba(52, 68, 86, 0.52);
    border-radius: 12px 12px 12px 4px;
    background: rgba(26, 37, 50, 0.92);
    transition: border-color 0.16s ease, background 0.16s ease;
}

.chat-message:hover,
.chat-message:focus-within {
    border-color: rgba(79, 183, 255, 0.34);
}

.chat-message-outgoing {
    align-self: end;
    border-color: rgba(79, 183, 255, 0.2);
    border-radius: 12px 12px 4px 12px;
    background: rgba(37, 88, 130, 0.72);
}

.chat-message p {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.42;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-message-deleted {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.chat-message-meta {
    display: flex;
    justify-content: flex-end;
    color: rgba(170, 183, 197, 0.78);
    line-height: 1;
}

.chat-message-meta small {
    font-size: 0.68rem;
}

.chat-message-actions {
    display: flex;
    max-height: 0;
    justify-content: flex-end;
    gap: 2px;
    margin-top: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height 0.16s ease, margin-top 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.chat-message:hover .chat-message-actions,
.chat-message:focus-within .chat-message-actions {
    max-height: 28px;
    margin-top: 2px;
    opacity: 1;
    transform: translateY(0);
}

.chat-message-action {
    width: 25px;
    height: 25px;
    min-height: 25px;
    padding: 0;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.94rem;
    line-height: 1;
}

.chat-reply {
    display: block;
    padding-left: 7px;
    border-left: 2px solid var(--accent);
    color: var(--accent-strong);
    font-size: 0.72rem;
}

.chat-attachment {
    color: var(--accent-strong);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.chat-edit-form,
.chat-compose {
    display: flex;
    gap: 8px;
}

.chat-edit-form {
    flex-wrap: wrap;
    padding-top: 4px;
}

.chat-edit-form input {
    flex: 1 1 160px;
}

.chat-compose {
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid var(--border-soft);
    background: rgba(21, 30, 41, 0.72);
}

.chat-compose input[type="text"] {
    min-width: 0;
    flex: 1;
    height: 42px;
    min-height: 42px;
    padding: 9px 11px;
}

.chat-compose input,
.chat-compose button,
.chat-edit-form input,
.chat-edit-form button {
    margin: 0;
}

.chat-attachment-input {
    display: none;
}

.chat-attach,
.chat-compose .chat-send {
    width: 40px;
    max-width: 40px;
    height: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
}

.chat-compose .chat-send {
    font-size: 0.92rem;
}

.chat-load-older {
    align-self: center;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.76rem;
}

@keyframes client-profile-dock {
    from {
        transform: translateX(56px);
        opacity: 0.88;
    }

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

@keyframes client-chat-reveal {
    from {
        transform: translateX(18px);
        opacity: 0;
    }

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

.setup-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.75fr);
    gap: var(--space-4);
}

.setup-panel {
    min-width: 0;
    padding: var(--space-5);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: rgba(13, 20, 29, 0.72);
}

.setup-panel h3 {
    margin: 0 0 var(--space-2);
    font-size: 1.08rem;
}

.setup-aside {
    display: grid;
    align-content: start;
    gap: var(--space-3);
}

.field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: 8px;
}

.text-link,
.danger-link {
    font-size: 0.9rem;
    text-decoration: none;
}

.script-summary-card {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
}

.account-picker {
    display: grid;
    gap: var(--space-3);
}

.selection-summary {
    margin-bottom: var(--space-3);
}

.select-card {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
    cursor: pointer;
}

.select-card:has(input:checked) {
    background: var(--accent-soft);
    border-color: rgba(79, 183, 255, 0.28);
}

.select-card-check {
    position: relative;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex: 0 0 auto;
}

.select-card-check input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: auto;
    margin: 0;
    cursor: pointer;
    opacity: 0;
}

.select-card-indicator {
    position: absolute;
    inset: 0;
    border: 1.5px solid var(--border-strong);
    border-radius: 6px;
    background: #0d141d;
}

.select-card-indicator::after {
    content: "";
    position: absolute;
    inset: 4px;
    opacity: 0;
    transform: scale(0.72);
    transition: opacity 0.12s ease, transform 0.12s ease;
    clip-path: polygon(14% 44%, 0 59%, 41% 100%, 100% 18%, 84% 4%, 39% 62%);
    background: #06111a;
}

.select-card-check input:checked + .select-card-indicator {
    background: var(--accent);
    border-color: var(--accent);
}

.select-card-check input:checked + .select-card-indicator::after {
    opacity: 1;
    transform: scale(1);
}

.select-card-check input:focus-visible + .select-card-indicator {
    outline: 2px solid rgba(79, 183, 255, 0.45);
    outline-offset: 2px;
}

.select-card-body {
    display: grid;
    min-width: 0;
    gap: 6px;
}

.select-card-body strong,
.select-card-body span {
    overflow-wrap: anywhere;
}

.scripts-list {
    display: grid;
    gap: var(--space-3);
}

.script-card {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: rgba(13, 20, 29, 0.72);
}

.script-card-link {
    display: grid;
    gap: 8px;
    color: inherit;
    text-decoration: none;
}

.script-card-link strong {
    font-size: 1rem;
}

.script-card-link span {
    color: var(--text-muted);
    line-height: 1.5;
}

.script-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.script-card-meta form {
    margin: 0;
}

.script-editor-panel textarea {
    min-height: 140px;
    resize: vertical;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
    background: rgba(3, 7, 12, 0.72);
    backdrop-filter: blur(10px);
}

.modal-backdrop.open {
    display: flex;
}

.modal-card {
    width: min(100%, 540px);
    max-height: min(92vh, 820px);
    overflow: auto;
    padding: var(--space-5);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    background: rgba(17, 24, 33, 0.98);
    box-shadow: var(--shadow-md);
}

.wizard {
    display: grid;
    gap: var(--space-4);
}

.wizard-progress {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.wizard-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.wizard-step.active {
    background: var(--accent-soft);
    border-color: rgba(79, 183, 255, 0.22);
    color: var(--accent-strong);
}

.wizard-step.done {
    background: var(--success-soft);
    border-color: rgba(101, 212, 155, 0.18);
    color: var(--success);
}

.wizard-step-index {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.72rem;
}

.modal-head h3 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: 0;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-header p {
    margin: 8px 0 0;
}

.modal-body {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-head p {
    margin: var(--space-2) 0 0;
    color: var(--text-secondary);
    line-height: 1.55;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
}

.success-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(101, 212, 155, 0.2);
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    font-size: 1.45rem;
}

.muted {
    color: var(--text-secondary);
    line-height: 1.55;
}

@media (max-width: 1180px) {
    .campaign-header {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .campaign-actions {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .summary-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

    .setup-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-soft);
    }

    .sidebar-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: start;
    }

    .workspace {
        min-height: auto;
    }
}

@media (max-width: 900px) {
    .auth-layout {
        max-width: 560px;
        grid-template-columns: 1fr;
    }

    .auth-hero {
        min-height: auto;
    }

    .auth-title {
        max-width: 100%;
    }

    .board-columns-3 {
        grid-template-columns: 1fr;
    }

    .board-column {
        min-height: 420px;
    }

    .client-workspace.chat-open {
        grid-template-columns: 1fr;
        align-items: start;
        height: min(720px, calc(100vh - 180px));
    }

    .client-workspace.chat-open .client-profile-panel,
    .client-workspace.chat-open .client-chat-slot {
        height: 100%;
    }

    .client-profile-panel {
        padding: var(--space-5);
    }

    .chat-panel {
        min-height: 0;
    }
}

@media (max-width: 640px) {
    .auth-page,
    .main {
        padding: var(--space-3);
    }

    .auth-hero,
    .auth-card,
    .workspace,
    .modal-card,
    .setup-panel {
        padding: var(--space-4);
        border-radius: var(--radius-lg);
    }

    .auth-switch-login,
    .auth-switch-register,
    .auth-switch-recovery {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .section-actions,
    .modal-actions,
    .action-row {
        justify-content: stretch;
    }

    .section-actions > *,
    .section-actions form,
    .section-actions button,
    .section-actions [role="button"],
    .modal-actions > *,
    .modal-actions form,
    .modal-actions button,
    .modal-actions [role="button"],
    .action-row > *,
    .action-row form,
    .action-row button {
        width: 100%;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
    }

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

    .board-columns-5 {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(270px, calc(100vw - 72px));
    }

    .campaign-actions {
        display: grid;
        grid-template-columns: 1fr;
        overflow-x: visible;
    }

    .campaign-actions form {
        display: block;
    }

    .campaign-status,
    .campaign-action-button,
    button.campaign-action-delete {
        min-width: 0;
    }

    .client-details div {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .client-profile-actions {
        grid-template-columns: 1fr;
    }

    .client-tool-button {
        width: 100%;
    }

    .chat-panel {
        height: min(640px, calc(100vh - 150px));
        min-height: 0;
        border-radius: var(--radius-md);
    }

    .chat-messages {
        padding: 12px;
    }

    .chat-message {
        max-width: 88%;
    }

    .chat-compose {
        padding: 8px;
    }
}

@media (hover: none) {
    .chat-message-actions {
        max-height: 28px;
        margin-top: 2px;
        opacity: 1;
        transform: translateY(0);
    }

    .board-card-open {
        max-height: 44px;
        min-height: 38px;
        margin-top: 0;
        border-width: 1px;
        padding-block: 8px;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
}

@media (max-width: 420px) {
    .summary-strip {
        grid-template-columns: 1fr;
    }

    .auth-page,
    .main,
    .modal-backdrop {
        padding: var(--space-2);
    }

    .board-columns-5 {
        grid-auto-columns: minmax(260px, calc(100vw - 52px));
    }
}
