:root {
    color-scheme: light;
    --ts-gold: #ffcd06;
    --ts-gold-100: #fff3c4;
    --ts-gold-300: #ffe066;
    --ts-gold-600: #e6b800;
    --ts-gold-700: #b38f00;
    --ts-gold-ink: #8a6d00;
    --ts-graphite: #212529;
    --ts-obsidian: #16181d;
    --ts-carbon: #343a40;
    --ts-slate: #495057;
    --ts-steel: #6c757d;
    --ts-silver: #adb5bd;
    --ts-ash: #ced4da;
    --ts-mist: #e9ecef;
    --ts-cloud: #f8f9fa;
    --ts-white: #fff;
    --ts-green: #0ecb81;
    --ts-green-ink: #0a8f5b;
    --ts-red: #f6465d;
    --ts-red-ink: #d32f45;
    --ts-blue: #4da3ff;
    --ts-blue-ink: #1e72d6;
    --ts-bg: #f6f7f8;
    --ts-surface: #fff;
    --ts-surface-2: #f8f9fa;
    --ts-surface-3: #eef0f2;
    --ts-line: #e9ecef;
    --ts-line-strong: #dee2e6;
    --ts-text: #212529;
    --ts-text-dim: #6c757d;
    --ts-text-mute: #adb5bd;
    --ts-navbar: linear-gradient(100deg, #2b3037, #16181d);
    --ts-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
    --ts-shadow-lg: 0 18px 48px rgba(16, 24, 40, .11);
    --ts-radius-sm: 10px;
    --ts-radius: 14px;
    --ts-radius-lg: 20px;
    --ts-font-display: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --ts-font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bs-body-font-family: var(--ts-font-body);
    --bs-body-bg: var(--ts-bg);
    --bs-body-color: var(--ts-text);
    --bs-primary: var(--ts-gold);
    --bs-primary-rgb: 255, 205, 6;
    --bs-secondary: var(--ts-slate);
    --bs-secondary-rgb: 73, 80, 87;
    --bs-success: var(--ts-green);
    --bs-success-rgb: 14, 203, 129;
    --bs-danger: var(--ts-red);
    --bs-danger-rgb: 246, 70, 93;
    --bs-info: var(--ts-blue);
    --bs-info-rgb: 77, 163, 255;
    --bs-warning: var(--ts-gold);
    --bs-warning-rgb: 255, 205, 6;
    --bs-border-color: var(--ts-line-strong);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --ts-bg: #111318;
    --ts-surface: #1a1d23;
    --ts-surface-2: #20242b;
    --ts-surface-3: #292e36;
    --ts-line: #2b3038;
    --ts-line-strong: #3a414b;
    --ts-text: #f4f5f6;
    --ts-text-dim: #b3bac4;
    --ts-text-mute: #7e8794;
    --ts-gold-100: #3b3314;
    --ts-gold-ink: #ffe066;
    --ts-green-ink: #40d99b;
    --ts-red-ink: #ff7486;
    --ts-blue-ink: #75b8ff;
    --ts-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 28px rgba(0, 0, 0, .22);
    --ts-shadow-lg: 0 22px 60px rgba(0, 0, 0, .34);
    --bs-body-bg: var(--ts-bg);
    --bs-body-color: var(--ts-text);
    --bs-border-color: var(--ts-line-strong);
}

html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-warning {
    --bs-btn-hover-color: #212529;
    --bs-btn-active-color: #212529;
}

html[data-theme="dark"] .btn-primary:hover:not(:disabled),
html[data-theme="dark"] .btn-warning:hover:not(:disabled) {
    color: #212529;
    box-shadow: 0 0 0 3px rgba(255, 205, 6, .35), 0 7px 22px rgba(255, 205, 6, .25);
}

html[data-theme="dark"] .btn-outline-primary:hover:not(:disabled),
html[data-theme="dark"] .btn-outline-warning:hover:not(:disabled) {
    color: #212529;
    box-shadow: 0 0 0 3px rgba(255, 205, 6, .35), 0 7px 22px rgba(255, 205, 6, .25);
}

.tasks-main .app-content {
    max-width: none;
}

.tasks-page {
    width: 100%;
    max-width: none;
    min-width: 0;
}

.tasks-board {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    min-height: 680px;
    overflow-x: auto;
    padding: .25rem .25rem 1.75rem;
    scroll-snap-type: x proximity;
}

.tasks-column {
    position: relative;
    display: flex;
    flex: 1 0 calc((100% - 4rem) / 5);
    min-width: 250px;
    min-height: 640px;
    max-height: calc(100vh - 150px);
    flex-direction: column;
    border: 1px solid var(--ts-line);
    border-color: color-mix(in srgb, var(--task-column-color, var(--ts-line)) 34%, var(--ts-line));
    border-radius: var(--ts-radius-lg);
    background: var(--ts-surface);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--task-column-color, #ffcd06) 12%, transparent), transparent 150px),
        var(--ts-surface);
    box-shadow: var(--ts-shadow);
    overflow: hidden;
    scroll-snap-align: start;
}

.tasks-column::before {
    content: "";
    display: block;
    height: 5px;
    flex: 0 0 auto;
    background: var(--task-column-color, var(--ts-gold));
}

.tasks-column__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem .45rem;
    border-bottom: 1px solid var(--ts-line);
    padding: .85rem .75rem;
}

.tasks-column__title {
    min-width: 0;
    flex: 1 1 0;
}

.tasks-column__title h3 {
    margin: 0;
    color: var(--ts-text);
    font-family: var(--ts-font-body);
    font-size: .94rem;
    font-weight: 500;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tasks-column__actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    margin-left: auto;
}

.tasks-column-drag,
.tasks-column-menu,
.tasks-board-settings,
.tasks-add-card,
.tasks-card-action {
    position: relative;
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
    line-height: 0;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.tasks-board-settings {
    border: 1px solid rgba(255, 205, 6, .55);
    background: rgba(255, 205, 6, .16);
    color: var(--ts-gold-ink);
}

.tasks-board-settings:hover,
.tasks-board-settings[aria-expanded="true"] {
    background: var(--ts-gold);
    color: #212529;
    transform: translateY(-1px);
}

.tasks-board-settings__icon {
    display: block;
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.tasks-column-drag {
    flex: 0 0 auto;
    border: 1px solid color-mix(in srgb, var(--task-column-color, var(--ts-line)) 36%, var(--ts-line));
    background: color-mix(in srgb, var(--task-column-color, var(--ts-gold)) 12%, transparent);
    color: var(--ts-text-dim);
    cursor: grab;
}

.tasks-icon {
    position: relative;
    display: block;
    flex: 0 0 auto;
    color: currentColor;
    pointer-events: none;
}

.tasks-icon--drag {
    width: 13px;
    height: 17px;
}

.tasks-icon--drag::before {
    content: "";
    position: absolute;
    top: 1px;
    left: 2px;
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    box-shadow:
        6px 0 0 currentColor,
        0 6px 0 currentColor,
        6px 6px 0 currentColor,
        0 12px 0 currentColor,
        6px 12px 0 currentColor;
}

.tasks-icon--menu {
    width: 14px;
    height: 6px;
}

.tasks-icon--menu::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: -5px 0 0 currentColor, 5px 0 0 currentColor;
    transform: translate(-50%, -50%);
}

.tasks-icon--plus {
    width: 14px;
    height: 14px;
}

.tasks-icon--plus::before,
.tasks-icon--plus::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 999px;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.tasks-icon--plus::before {
    width: 13px;
    height: 2px;
}

.tasks-icon--plus::after {
    width: 2px;
    height: 13px;
}

.tasks-column-drag:hover {
    background: color-mix(in srgb, var(--task-column-color, var(--ts-gold)) 22%, transparent);
    color: var(--ts-text);
    transform: translateY(-1px);
}

.tasks-column-drag:active {
    cursor: grabbing;
}

.tasks-column-menu {
    border: 1px solid color-mix(in srgb, var(--task-column-color, var(--ts-line)) 34%, var(--ts-line));
    background: color-mix(in srgb, var(--task-column-color, var(--ts-gold)) 10%, transparent);
    color: var(--ts-text-dim);
}

.tasks-column-menu:hover,
.tasks-column-menu[aria-expanded="true"] {
    background: color-mix(in srgb, var(--task-column-color, var(--ts-gold)) 24%, transparent);
    color: var(--ts-text);
    transform: translateY(-1px);
}

.tasks-add-card {
    border: 1px solid rgba(255, 205, 6, .55);
    background: rgba(255, 205, 6, .14);
    color: var(--ts-gold-ink);
}

.tasks-add-card:hover {
    background: var(--ts-gold);
    color: #212529;
    transform: translateY(-1px);
}

.tasks-card-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .75rem;
    overflow-y: auto;
    padding: 1rem;
}

.tasks-card {
    cursor: grab;
    border: 1px solid var(--ts-line);
    border-radius: var(--ts-radius);
    background: var(--ts-surface-2);
    box-shadow: 0 10px 22px rgba(16, 24, 40, .06);
    padding: .95rem 1rem;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.tasks-card:hover {
    border-color: rgba(255, 205, 6, .52);
    box-shadow: var(--ts-shadow);
    transform: translateY(-2px);
}

.tasks-card:active {
    cursor: grabbing;
}

.tasks-card.is-dragging {
    opacity: .72;
    transform: rotate(.4deg) scale(.99);
}

.tasks-column.is-column-dragging {
    opacity: .72;
    transform: rotate(.25deg) scale(.995);
}

.tasks-card h4 {
    margin: 0;
    color: var(--ts-text);
    font-size: .98rem;
    letter-spacing: -.01em;
}

.tasks-card p {
    margin: .55rem 0 0;
    color: var(--ts-text-dim);
    font-size: .9rem;
    line-height: 1.45;
    white-space: pre-line;
}

.tasks-card__meta {
    display: flex;
    flex-direction: column;
    gap: .22rem;
    margin-top: .75rem;
    padding-top: .65rem;
    border-top: 1px solid var(--ts-line);
    color: var(--ts-text-dim);
    font-size: .76rem;
    font-weight: 500;
    line-height: 1.35;
}

html[data-theme="dark"] .tasks-column {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--task-column-color, #ffcd06) 16%, transparent), transparent 150px),
        var(--ts-surface);
}

html[data-theme="dark"] .tasks-card {
    box-shadow: 0 12px 26px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] .tasks-add-card {
    color: var(--ts-gold);
}

html[data-theme="dark"] .tasks-column-drag,
html[data-theme="dark"] .tasks-column-menu {
    color: var(--ts-text-dim);
}

html[data-theme="dark"] .tasks-column-drag:hover,
html[data-theme="dark"] .tasks-column-menu:hover,
html[data-theme="dark"] .tasks-column-menu[aria-expanded="true"] {
    color: var(--ts-text);
}

.tasks-color-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
}

.tasks-tooltip {
    position: fixed;
    z-index: 3000;
    max-width: 220px;
    padding: .32rem .55rem;
    border-radius: 8px;
    background: rgba(22, 24, 29, .94);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.2;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -2px);
    transition: opacity .12s ease, transform .12s ease;
    white-space: nowrap;
}

.tasks-tooltip.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 767.98px) {
    .tasks-board {
        min-height: 560px;
    }

    .tasks-column {
        flex: 0 0 250px;
        min-width: 250px;
        max-height: none;
        min-height: 540px;
    }
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-y: scroll;
    background: var(--ts-bg);
    color: var(--ts-text);
    font-family: var(--ts-font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background-color .18s ease, color .18s ease;
}

a {
    color: var(--ts-blue-ink);
    text-decoration: none;
}

a:hover {
    color: var(--ts-graphite);
}

html[data-theme="dark"] a:hover {
    color: var(--ts-gold);
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
    color: var(--ts-text);
    font-family: var(--ts-font-display);
    font-weight: 800;
    letter-spacing: -.025em;
}

h1 {
    font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
    font-size: clamp(1.75rem, 3vw, 2.35rem);
}

h3 {
    font-size: clamp(1.45rem, 2.4vw, 1.9rem);
}

code,
.font-monospace {
    color: var(--ts-gold-ink);
}

:focus-visible {
    outline: 3px solid rgba(255, 205, 6, .42) !important;
    outline-offset: 2px;
}

.app-navbar {
    min-height: 68px;
    padding: .55rem 0;
    background: var(--ts-navbar);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .12);
}

.app-navbar .container {
    max-width: 1440px;
}

.app-navbar .navbar-brand img {
    width: auto;
    height: 31px;
}

.app-navbar .navbar-nav {
    gap: .18rem;
}

.app-navbar .nav-link {
    position: relative;
    border-radius: 9px;
    color: #c4cbd6;
    font-size: .9rem;
    font-weight: 600;
    padding: .58rem .72rem !important;
    transition: color .15s ease, background-color .15s ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .nav-link.active {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.app-navbar .nav-link.active::after {
    position: absolute;
    right: .7rem;
    bottom: .18rem;
    left: .7rem;
    height: 2px;
    border-radius: 999px;
    background: var(--ts-gold);
    content: "";
}

.nav-new-badge {
    position: absolute;
    top: -.3rem;
    right: -.8rem;
    z-index: 2;
    padding: .12rem .34rem;
    border-radius: 999px;
    background: var(--ts-gold);
    box-shadow: 0 5px 12px rgba(255, 205, 6, .28);
    color: #212529;
    font-size: .58rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: .02em;
    text-transform: uppercase;
    pointer-events: none;
}

.app-shop-switcher {
    max-width: 220px;
    border-color: rgba(255, 205, 6, .58);
    color: #fff;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-shop-switcher:hover,
.app-shop-switcher:focus,
.app-shop-switcher.show {
    border-color: var(--ts-gold);
    background: var(--ts-gold);
    color: var(--ts-graphite);
}

.app-navbar .navbar-toggler {
    border-color: rgba(255, 205, 6, .52);
    box-shadow: none !important;
}

.app-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 205, 6, .75);
    background: var(--ts-carbon);
}

.app-main {
    min-height: calc(100vh - 68px);
}

.app-content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 4.5rem;
}

.app-footer {
    display: flex;
    min-height: 230px;
    align-items: center;
    justify-content: center;
    background: #e5e5e5;
    color: var(--ts-text-dim);
    padding: 2rem 1.25rem;
}

.app-footer__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    width: 100%;
    max-width: 1440px;
    gap: 1rem;
    text-align: center;
}

.app-footer__telegram {
    display: inline-flex;
    width: 50px;
    height: 50px;
    align-items: center;
    justify-content: center;
    justify-self: start;
    border: 1px solid rgba(77, 163, 255, .3);
    border-radius: 50%;
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow);
    transition: transform .15s ease, opacity .15s ease;
}

.app-footer__telegram:hover {
    transform: translateY(-2px);
}

.app-footer__content {
    display: grid;
    gap: 1rem;
}

.app-footer__links,
.app-footer__details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .55rem;
}

.app-footer a {
    color: var(--ts-text);
    font-weight: 700;
}

.app-footer a:hover {
    color: var(--ts-gold-ink);
}

html[data-theme="dark"] .app-footer {
    background: var(--ts-navbar);
    color: #c4cbd6;
}

html[data-theme="dark"] .app-footer a {
    color: #fff;
}

html[data-theme="dark"] .app-footer a:hover {
    color: var(--ts-gold);
}

.app-content > .container,
.app-content > .container-fluid,
.app-content > .container > .container,
.app-content > .container > .container-fluid {
    max-width: none;
    margin-top: 0 !important;
    padding-right: 0;
    padding-left: 0;
}

.app-content > .container > .container,
.app-content > .container > .container-fluid {
    width: 100%;
}

.page-header,
.app-content > .container > .d-flex:first-child,
.app-content > .container-fluid > .d-flex:first-child {
    min-height: 48px;
    margin-bottom: 1.25rem !important;
}

.page-header h1,
.page-header h2,
.app-content > .container > .d-flex:first-child > h2,
.app-content > .container-fluid > .d-flex:first-child > h2 {
    margin-bottom: 0;
}

.card {
    border: 1px solid var(--ts-line) !important;
    border-radius: var(--ts-radius) !important;
    background: var(--ts-surface) !important;
    color: var(--ts-text);
    box-shadow: var(--ts-shadow);
}

.card-header,
.card-footer {
    border-color: var(--ts-line) !important;
    background: var(--ts-surface-2) !important;
    color: var(--ts-text);
}

.card-header:first-child {
    border-radius: calc(var(--ts-radius) - 1px) calc(var(--ts-radius) - 1px) 0 0 !important;
}


.alert-primary {
    border-color: rgba(77, 163, 255, .3);
    background: rgba(77, 163, 255, .11);
}

.card-body {
    padding: 1.25rem;
}

.shadow-sm {
    box-shadow: var(--ts-shadow) !important;
}

.bg-light {
    background-color: var(--ts-surface-2) !important;
}

.text-dark {
    color: var(--ts-text) !important;
}

.text-muted,
.form-text {
    color: var(--ts-text-dim) !important;
}

.text-success {
    color: var(--ts-green-ink) !important;
}

.text-danger {
    color: var(--ts-red-ink) !important;
}

.text-info {
    color: var(--ts-blue-ink) !important;
}

.text-warning {
    color: var(--ts-gold-ink) !important;
}

.btn {
    min-height: 40px;
    border-radius: var(--ts-radius-sm);
    font-family: var(--ts-font-display);
    font-size: .88rem;
    font-weight: 700;
    letter-spacing: -.01em;
    padding: .56rem 1rem;
    transition: transform .12s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn-sm {
    min-height: 34px;
    border-radius: 8px;
    font-size: .8rem;
    padding: .38rem .68rem;
}

.btn-primary,
.btn-warning {
    --bs-btn-color: var(--ts-graphite);
    --bs-btn-bg: var(--ts-gold);
    --bs-btn-border-color: var(--ts-gold);
    --bs-btn-hover-color: var(--ts-graphite);
    --bs-btn-hover-bg: var(--ts-gold-600);
    --bs-btn-hover-border-color: var(--ts-gold-600);
    --bs-btn-active-color: var(--ts-graphite);
    --bs-btn-active-bg: var(--ts-gold-600);
    --bs-btn-active-border-color: var(--ts-gold-600);
    box-shadow: 0 7px 18px rgba(230, 184, 0, .16);
}

.btn-success {
    --bs-btn-bg: var(--ts-green);
    --bs-btn-border-color: var(--ts-green);
    --bs-btn-hover-bg: #0aae70;
    --bs-btn-hover-border-color: #0aae70;
    --bs-btn-color: #10231c;
    --bs-btn-hover-color: #07150f;
}

.btn-danger {
    --bs-btn-bg: var(--ts-red);
    --bs-btn-border-color: var(--ts-red);
    --bs-btn-hover-bg: #df3c52;
    --bs-btn-hover-border-color: #df3c52;
}

.btn-info {
    --bs-btn-bg: var(--ts-blue);
    --bs-btn-border-color: var(--ts-blue);
    --bs-btn-color: #102236;
    --bs-btn-hover-color: #08131f;
    --bs-btn-hover-bg: #338fe9;
    --bs-btn-hover-border-color: #338fe9;
}

.btn-secondary {
    --bs-btn-bg: var(--ts-slate);
    --bs-btn-border-color: var(--ts-slate);
    --bs-btn-hover-bg: var(--ts-carbon);
    --bs-btn-hover-border-color: var(--ts-carbon);
}

.btn-outline-primary,
.btn-outline-warning {
    --bs-btn-color: var(--ts-gold-ink);
    --bs-btn-border-color: var(--ts-gold-600);
    --bs-btn-hover-color: var(--ts-graphite);
    --bs-btn-hover-bg: var(--ts-gold);
    --bs-btn-hover-border-color: var(--ts-gold);
    --bs-btn-active-color: var(--ts-graphite);
    --bs-btn-active-bg: var(--ts-gold);
    --bs-btn-active-border-color: var(--ts-gold);
}

html[data-theme="light"] .app-navbar .btn-outline-warning {
    --bs-btn-color: var(--ts-gold-300);
    color: var(--ts-gold-300);
}

.btn-outline-secondary {
    --bs-btn-color: var(--ts-text-dim);
    --bs-btn-border-color: var(--ts-line-strong);
    --bs-btn-hover-color: var(--ts-text);
    --bs-btn-hover-bg: var(--ts-surface-3);
    --bs-btn-hover-border-color: var(--ts-line-strong);
    --bs-btn-active-color: var(--ts-text);
    --bs-btn-active-bg: var(--ts-surface-3);
    --bs-btn-active-border-color: var(--ts-line-strong);
}

.btn-outline-success {
    --bs-btn-color: var(--ts-green-ink);
    --bs-btn-border-color: var(--ts-green);
    --bs-btn-hover-bg: var(--ts-green);
    --bs-btn-hover-border-color: var(--ts-green);
}

.btn-outline-danger {
    --bs-btn-color: var(--ts-red-ink);
    --bs-btn-border-color: var(--ts-red);
    --bs-btn-hover-bg: var(--ts-red);
    --bs-btn-hover-border-color: var(--ts-red);
}

.btn-link {
    color: var(--ts-blue-ink);
    box-shadow: none;
}

.form-label {
    margin-bottom: .45rem;
    color: var(--ts-text);
    font-size: .88rem;
    font-weight: 700;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 43px;
    border-color: var(--ts-line-strong);
    border-radius: var(--ts-radius-sm);
    background-color: var(--ts-surface);
    color: var(--ts-text);
    font-size: .92rem;
}

.form-control-sm,
.form-select-sm {
    min-height: 36px;
    font-size: .84rem;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--ts-gold-600);
    background-color: var(--ts-surface);
    color: var(--ts-text);
    box-shadow: 0 0 0 .22rem rgba(255, 205, 6, .2);
}

.form-control::placeholder {
    color: var(--ts-text-mute);
}

.form-control[type="file"] {
    padding: .36rem;
}

.form-control[type="file"]::file-selector-button {
    margin: -.36rem .75rem -.36rem -.36rem;
    padding: .55rem .85rem;
    border: 0;
    border-right: 1px solid var(--ts-gold-600);
    border-radius: 8px 0 0 8px;
    background: var(--ts-gold);
    color: var(--ts-graphite);
    font-family: var(--ts-font-display);
    font-weight: 700;
    transition: background-color .15s ease;
}

.form-control[type="file"]:hover:not(:disabled):not([readonly])::file-selector-button {
    background: var(--ts-gold-600);
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
    border-color: var(--ts-line);
    background-color: var(--ts-surface-2);
    color: var(--ts-text-dim);
}

.form-check-input {
    border-color: var(--ts-ash);
    background-color: var(--ts-surface);
}

.form-check-input:checked {
    border-color: var(--ts-gold);
    background-color: var(--ts-gold);
}

html[data-theme="dark"] .form-switch .form-check-input:not(:checked) {
    background-color: var(--ts-line-strong);
    border-color: var(--ts-line-strong);
}

.form-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 0;
}

.form-switch .form-check-input {
    float: none;
    margin-left: 0;
    flex-shrink: 0;
    width: 3rem;
    height: 1.55rem;
    cursor: pointer;
}

.input-group > :not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.dropdown-menu {
    border: 1px solid var(--ts-line);
    border-radius: var(--ts-radius);
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow-lg);
    padding: .5rem;
}

.dropdown-item {
    border-radius: 8px;
    color: var(--ts-text);
    font-size: .9rem;
    padding: .55rem .7rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--ts-surface-2);
    color: var(--ts-text);
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--ts-gold);
    color: var(--ts-graphite);
}

.dropdown-divider {
    border-color: var(--ts-line);
}

.item-product-dropdown,
.item-serial-dropdown,
#client-dropdown {
    border-color: var(--ts-line-strong) !important;
    background: var(--ts-surface) !important;
    color: var(--ts-text);
    box-shadow: var(--ts-shadow-lg) !important;
}

.item-product-option,
.serial-option,
.client-option {
    border-bottom-color: var(--ts-line) !important;
    color: var(--ts-text);
}

.item-product-option strong,
.serial-option,
.client-option strong {
    color: var(--ts-text);
}

.item-product-option:hover,
.serial-option:hover,
.client-option:hover {
    background: var(--ts-surface-2) !important;
}

.nav-tabs {
    gap: .35rem;
    border-bottom-color: var(--ts-line-strong);
}

.nav-tabs .nav-link {
    margin-bottom: -1px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 9px 9px 0 0;
    color: var(--ts-text-dim);
    font-family: var(--ts-font-display);
    font-size: .9rem;
    font-weight: 700;
    padding: .72rem .9rem;
}

.nav-tabs .nav-link:hover,
.nav-tabs .nav-link:focus {
    border-bottom-color: transparent;
    background: transparent;
    color: var(--ts-text-dim);
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-link.active:hover,
.nav-tabs .nav-link.active:focus {
    border-bottom-color: var(--ts-gold);
    background: transparent;
    color: var(--ts-text);
}

.inventory-tab-help {
    position: relative;
    z-index: 20;
    display: inline-flex;
    width: 17px;
    height: 17px;
    align-items: center;
    justify-content: center;
    margin-left: .25rem;
    transform: translateY(-.35rem);
    border: 1px solid rgba(255, 205, 6, .65);
    border-radius: 999px;
    background: color-mix(in srgb, var(--ts-gold) 16%, transparent);
    color: var(--ts-gold-ink);
    font-family: var(--ts-font-body);
    font-size: .68rem;
    font-weight: 800;
    line-height: 1;
    cursor: default;
}

.inventory-tab-help::after {
    content: attr(data-tooltip);
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    width: max-content;
    max-width: min(390px, 84vw);
    padding: .62rem .78rem;
    transform: translate(-50%, 6px);
    border: 1px solid var(--ts-line);
    border-radius: var(--ts-radius);
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow-lg);
    color: var(--ts-text);
    font-family: var(--ts-font-body);
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.42;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    white-space: normal;
    transition: opacity .18s ease, transform .18s ease;
}

.inventory-tab-help::before {
    content: "";
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    width: 10px;
    height: 10px;
    transform: translate(-50%, 6px) rotate(45deg);
    border-right: 1px solid var(--ts-line);
    border-bottom: 1px solid var(--ts-line);
    background: var(--ts-surface);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.inventory-tab-help:hover::before,
.inventory-tab-help:focus::before,
.inventory-tab-help:hover::after,
.inventory-tab-help:focus::after {
    transform: translate(-50%, 0) rotate(45deg);
    opacity: 1;
}

.inventory-tab-help:hover::after,
.inventory-tab-help:focus::after {
    transform: translate(-50%, 0);
}

.inventory-tab-tooltip-floating {
    position: fixed;
    z-index: 1200;
    width: max-content;
    max-width: min(390px, calc(100vw - 24px));
    padding: .62rem .78rem;
    transform: translateY(6px);
    border: 1px solid var(--ts-line);
    border-radius: var(--ts-radius);
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow-lg);
    color: var(--ts-text);
    font-family: var(--ts-font-body);
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.42;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transition: opacity .18s ease, transform .18s ease;
}

.inventory-tab-tooltip-floating.is-visible {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 767.98px), (hover: none) and (pointer: coarse) {
    .inventory-tab-help {
        cursor: pointer;
    }
}

.table-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .25rem;
    flex-wrap: nowrap !important;
    white-space: nowrap;
}

.sale-total-summary {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .75rem;
    padding: .25rem 0 0;
}

.sale-total-summary__label {
    color: var(--ts-text);
    font-family: var(--ts-font-display);
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    font-weight: 800;
    line-height: 1;
}

.sale-total-summary__amount {
    flex: 0 0 auto;
    color: var(--ts-green-ink) !important;
    font-family: var(--ts-font-display);
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.serial-input-shell {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .3rem;
    min-height: 43px;
    width: 100%;
    border: 1px solid var(--ts-line-strong);
    border-radius: var(--ts-radius-sm);
    background: var(--ts-surface);
    color: var(--ts-text);
    padding: .42rem .65rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.serial-input-shell:focus-within {
    border-color: rgba(255, 205, 6, .72);
    box-shadow: 0 0 0 .2rem rgba(255, 205, 6, .18);
}

.serial-input-shell .serial-chips {
    min-width: 0;
    margin: 0;
}

.serial-input-field {
    appearance: none;
    -webkit-appearance: none;
    flex: 1 1 90px;
    min-width: 90px;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    color: var(--ts-text);
    font: inherit;
    font-size: .92rem;
    line-height: 1.5;
    padding: 0;
}

.serial-input-field:focus,
.serial-input-field:focus-visible {
    border: 0;
    outline: 0 !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
}

.serial-input-field::placeholder {
    color: var(--ts-text-mute);
}

.item-sum {
    display: flex;
    align-items: center;
    min-height: 43px;
    color: var(--ts-green-ink);
    font-weight: 800;
    padding-top: 0 !important;
    font-size: .92rem !important;
    line-height: 1.5;
}

.item-row,
.service-row {
    position: relative;
}

.item-row > .row,
.service-row > .row {
    padding-right: 48px;
}

.item-row > .row > .text-end:last-child,
.service-row > .row > .text-end:last-child {
    position: absolute;
    top: 46px;
    right: 1rem;
    display: block;
    min-height: 0;
    width: auto;
    padding: 0;
}

.item-row > .row > .text-end:last-child .form-label,
.service-row > .row > .text-end:last-child .form-label {
    display: none;
}

.item-row > .row > .text-end:last-child br,
.service-row > .row > .text-end:last-child br {
    display: none;
}

.item-row > .row > .text-end:last-child .btn,
.service-row > .row > .text-end:last-child .btn {
    margin-top: 0;
}

@media (max-width: 767.98px) {
    .item-row > .row > .text-end:last-child .form-label,
    .service-row > .row > .text-end:last-child .form-label,
    .item-row > .row > .text-end:last-child br,
    .service-row > .row > .text-end:last-child br {
        visibility: visible;
        display: none;
    }

    .item-row > .row > .text-end:last-child .btn,
    .service-row > .row > .text-end:last-child .btn {
        margin-top: 0;
    }
}

.item-row > .row > .text-end:last-child .item-delete-input,
.service-row > .row > .text-end:last-child .service-delete-input {
    display: none;
}

.table-action-button {
    position: relative;
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--ts-line);
    border-radius: 999px;
    background: var(--ts-surface-2);
    color: var(--ts-text-dim);
    line-height: 0;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.table-action-button:hover,
.table-action-button:focus,
.table-action-button[aria-expanded="true"] {
    border-color: rgba(255, 205, 6, .55);
    background: rgba(255, 205, 6, .16);
    color: var(--ts-gold-ink);
    transform: translateY(-1px);
}

.table-action-button--print {
    border-color: rgba(255, 205, 6, .48);
    background: rgba(255, 205, 6, .12);
    color: var(--ts-gold-ink);
}

.table-action-button--print:hover,
.table-action-button--print:focus {
    background: var(--ts-gold);
    color: #212529;
}

.table-action-button--danger {
    border-color: rgba(220, 53, 69, .3);
    background: rgba(220, 53, 69, .07);
    color: #dc3545;
}

.table-action-button--danger:hover,
.table-action-button--danger:focus {
    border-color: rgba(220, 53, 69, .55);
    background: rgba(220, 53, 69, .16);
    color: #dc3545;
    transform: translateY(-1px);
}

.table-action-icon {
    display: block;
    width: 17px;
    height: 17px;
    stroke: currentColor;
}

.contact-name-link {
    color: var(--ts-text);
}

.contact-name-link:hover {
    color: var(--ts-gold-ink);
}

.list-group {
    border-radius: var(--ts-radius);
    box-shadow: var(--ts-shadow);
}

.list-group-item {
    border-color: var(--ts-line);
    background: var(--ts-surface);
    color: var(--ts-text);
    padding: .85rem 1rem;
}

.list-group-item-action:hover {
    background: var(--ts-surface-2);
    color: var(--ts-text);
}

.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
    z-index: 1;
    border-color: var(--ts-gold);
    background: var(--ts-gold);
    color: var(--ts-graphite) !important;
    font-weight: 700;
}

.finance-account-list .list-group-item.active *,
.finance-account-list .list-group-item.active:hover * {
    color: var(--ts-graphite) !important;
}

.table-responsive {
    margin-bottom: 1.25rem;
    border: 1px solid var(--ts-line);
    border-radius: var(--ts-radius);
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow);
}

.card-body.p-0 > .table-responsive {
    margin-bottom: 0;
    border: 0;
    border-radius: 0 0 var(--ts-radius) var(--ts-radius);
    box-shadow: none;
}

/* Таблица как прямой потомок карточки (без .card-body) должна сидеть вплотную:
   иначе собственные рамка/тень/скругление таблицы дают «карточку в карточке», а
   margin-bottom оставляет под таблицей полосу, похожую на вторую таблицу. */
.settings-card > .table-responsive {
    margin-bottom: 0;
    border: 0;
    border-radius: inherit;
    box-shadow: none;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ts-text);
    --bs-table-border-color: var(--ts-line);
    --bs-table-striped-bg: var(--ts-surface-2);
    --bs-table-striped-color: var(--ts-text);
    --bs-table-hover-bg: var(--ts-gold-100);
    --bs-table-hover-color: var(--ts-text);
    margin-bottom: 0;
    color: var(--ts-text);
    font-size: .89rem;
    vertical-align: middle;
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--ts-line);
    padding: .82rem .9rem;
}

.table > thead {
    background: var(--ts-surface-2);
    color: var(--ts-text-dim);
    font-family: var(--ts-font-display);
    font-size: .76rem;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.table > thead th {
    border-bottom-width: 1px;
    white-space: nowrap;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.sale-products-line + .sale-products-line,
.sale-account-line + .sale-account-line {
    margin-top: .45rem;
    padding-top: .45rem;
    border-top: 1px dashed var(--ts-line);
}

.sale-products-line__name,
.sale-account-line__name {
    color: var(--ts-text);
    font-weight: 600;
    line-height: 1.25;
}

.sale-products-line__meta,
.sale-account-line__amount {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem;
    margin-top: .18rem;
    color: var(--ts-text-dim);
    font-size: .78rem;
    line-height: 1.25;
}

.sale-products-line__meta strong,
.sale-account-line__amount {
    color: var(--ts-green-ink);
    font-weight: 700;
}

.sale-money-cell {
    min-width: 118px;
    white-space: nowrap;
}

.sale-products-line--service .sale-products-line__name {
    color: var(--ts-text-dim);
    font-style: italic;
    font-weight: 500;
}

.sale-info-trigger {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--ts-blue-ink);
    font: inherit;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
    transition: color .18s ease;
}

.sale-info-trigger--client {
    font-weight: 600;
}

.sale-info-trigger:hover,
.sale-info-trigger:focus-visible {
    color: var(--ts-blue);
    outline: none;
}

.sale-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.sale-info-field {
    min-width: 0;
    padding: .85rem 1rem;
    border: 1px solid var(--ts-line);
    border-radius: var(--ts-radius);
    background: var(--ts-surface-2);
}

.sale-info-field--wide {
    grid-column: 1 / -1;
}

.sale-info-label {
    display: block;
    margin-bottom: .3rem;
    color: var(--ts-text-dim);
    font-size: .78rem;
    font-weight: 600;
}

.sale-info-text {
    overflow-wrap: anywhere;
    color: var(--ts-text);
    line-height: 1.5;
}

@media (max-width: 575.98px) {
    .sale-info-grid {
        grid-template-columns: 1fr;
    }

    .sale-info-field--wide {
        grid-column: auto;
    }
}

.table-success {
    --bs-table-bg: rgba(14, 203, 129, .09);
    --bs-table-striped-bg: rgba(14, 203, 129, .12);
    --bs-table-hover-bg: rgba(14, 203, 129, .15);
    --bs-table-color: var(--ts-text);
}

.table-danger {
    --bs-table-bg: rgba(246, 70, 93, .08);
    --bs-table-striped-bg: rgba(246, 70, 93, .11);
    --bs-table-hover-bg: rgba(246, 70, 93, .14);
    --bs-table-color: var(--ts-text);
}

.table-secondary {
    --bs-table-bg: var(--ts-surface-2);
    --bs-table-color: var(--ts-text);
}

.badge {
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .01em;
    padding: .4em .72em;
}

.badge.bg-warning,
.badge.bg-primary {
    color: var(--ts-graphite);
}

.product-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    border-radius: 999px;
    padding: .34rem .62rem;
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .02em;
    white-space: nowrap;
}

.product-type-badge--serial {
    background: #2563eb;
}

.product-type-badge--quantity {
    background: var(--ts-graphite);
}

[data-theme="dark"] .product-type-badge--quantity {
    background: #3b4454;
}

.serial-delete-button {
    width: 24px;
    height: 24px;
    border: 1px solid rgba(246, 70, 93, .28);
    border-radius: 50%;
    background: rgba(246, 70, 93, .08);
    color: #f6465d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.serial-delete-button:hover {
    border-color: #f6465d;
    background: rgba(246, 70, 93, .16);
    transform: translateY(-1px);
}

.pagination {
    flex-wrap: wrap;
    gap: .25rem;
}

.page-link {
    min-width: 38px;
    border-color: var(--ts-line);
    border-radius: 8px !important;
    background: var(--ts-surface);
    color: var(--ts-text-dim);
    text-align: center;
}

.page-link:hover {
    border-color: var(--ts-gold);
    background: var(--ts-gold-100);
    color: var(--ts-text);
}

.active > .page-link,
.page-link.active {
    border-color: var(--ts-gold);
    background: var(--ts-gold);
    color: var(--ts-graphite);
}

.modal-content {
    border: 1px solid var(--ts-line);
    border-radius: var(--ts-radius-lg);
    background: var(--ts-surface);
    color: var(--ts-text);
    box-shadow: var(--ts-shadow-lg);
}

.modal-header,
.modal-footer {
    border-color: var(--ts-line);
}

.btn-close {
    filter: none;
}

html[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%);
}

.alert {
    border-width: 1px;
    border-radius: var(--ts-radius);
    color: var(--ts-text);
}

.alert-info {
    border-color: rgba(77, 163, 255, .3);
    background: rgba(77, 163, 255, .11);
}

.alert-warning {
    border-color: rgba(255, 205, 6, .4);
    background: rgba(255, 205, 6, .14);
}

.alert-danger {
    border-color: rgba(246, 70, 93, .3);
    background: rgba(246, 70, 93, .11);
}

.alert-success {
    border-color: rgba(14, 203, 129, .3);
    background: rgba(14, 203, 129, .11);
}

.alert-link {
    color: var(--ts-text) !important;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.settings-layout {
    margin-top: 1.25rem;
}

.settings-sidebar {
    position: sticky;
    top: 88px;
}

.settings-sidebar .list-group-item {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.settings-sidebar .list-group-item::before {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: var(--ts-line-strong);
    content: "";
}

.settings-sidebar .list-group-item.active::before {
    background: var(--ts-graphite);
}

.settings-sidebar .list-group-item.active,
.settings-sidebar .list-group-item.active:hover,
.settings-sidebar .list-group-item.active:focus {
    color: var(--ts-graphite) !important;
}

.settings-content {
    min-width: 0;
}

.settings-content > h3:first-child,
.settings-content > .d-flex:first-child h3,
.settings-content > h5:first-child {
    margin-bottom: 1rem;
}

.settings-card {
    overflow: hidden;
}

.settings-card + .settings-card {
    margin-top: 1rem;
}

.print-forms-table .print-form-group-row td {
    background: var(--ts-surface-2);
    color: var(--ts-text);
}

.print-form-name {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
}

.print-form-tree-line {
    width: 18px;
    height: 26px;
    margin-left: .35rem;
    border-left: 2px solid var(--ts-line-strong);
    border-bottom: 2px solid var(--ts-line-strong);
    border-bottom-left-radius: 7px;
    flex: 0 0 auto;
}

.inventory-bulk-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.print-form-variable-select {
    width: min(100%, 340px);
    min-height: 34px;
    border-color: var(--ts-line-strong);
    background-color: var(--ts-surface);
}

.print-form-variable-control {
    flex: 0 1 340px;
}

.print-form-ckeditor-shell .ck.ck-editor {
    --ck-border-radius: 0;
    --ck-color-toolbar-background: var(--ts-surface-2);
    --ck-color-base-background: var(--ts-surface);
    --ck-color-base-border: var(--ts-line);
    --ck-color-button-default-hover-background: rgba(255, 205, 6, .14);
    --ck-color-button-on-background: rgba(255, 205, 6, .22);
    --ck-color-button-on-hover-background: rgba(255, 205, 6, .3);
    --ck-color-focus-border: var(--ts-gold);
    color: var(--ts-text);
}

.print-form-ckeditor-shell .ck.ck-toolbar {
    border-color: var(--ts-line);
    border-radius: 0;
}

.print-form-ckeditor-shell .ck.ck-toolbar.ck-toolbar_grouping > .ck-toolbar__items {
    flex-wrap: wrap;
    gap: .25rem;
}

.print-form-ckeditor-shell .ck.ck-button,
.print-form-ckeditor-shell .ck.ck-dropdown .ck-dropdown__button {
    min-height: 34px;
    color: var(--ts-text);
}

.print-form-ckeditor-shell .ck.ck-button:hover,
.print-form-ckeditor-shell .ck.ck-dropdown .ck-dropdown__button:hover,
.print-form-ckeditor-shell .ck.ck-button.ck-on {
    color: var(--ts-gold-ink);
}

.print-form-ckeditor-shell .ck.ck-editor__main {
    overflow: auto;
    max-width: 100%;
    padding: 1rem;
    border: 1px solid var(--ts-line);
    border-top: 0;
    background:
        linear-gradient(45deg, rgba(128, 128, 128, .08) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(128, 128, 128, .08) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(128, 128, 128, .08) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(128, 128, 128, .08) 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

/* В тёмной теме редактор ценника оставляем «бумажным» (светлым): иначе панель
   инструментов и холст почти сливаются с тёмной карточкой и плохо видны.
   Светлый редактор совпадает по виду с белым ценником, который он редактирует. */
html[data-theme="dark"] .print-form-ckeditor-shell .ck.ck-editor {
    --ck-color-toolbar-background: #f4f5f6;
    --ck-color-base-background: #ffffff;
    --ck-color-base-border: #cfd4da;
    --ck-color-text: #212529;
    color: #212529;
    box-shadow: 0 0 0 1px #cfd4da;
}

html[data-theme="dark"] .print-form-ckeditor-shell .ck.ck-toolbar {
    border-color: #cfd4da;
}

html[data-theme="dark"] .print-form-ckeditor-shell .ck.ck-button,
html[data-theme="dark"] .print-form-ckeditor-shell .ck.ck-dropdown .ck-dropdown__button {
    color: #212529;
}

html[data-theme="dark"] .print-form-ckeditor-shell .ck.ck-editor__main {
    border-color: #cfd4da;
    background-color: #e9ecef;
}

/* Neutralize django_ckeditor_5's injected `min-height: 300px` so the price
   tag never balloons to the default editor height (e.g. on focus). */
.print-form-ckeditor-shell .ck.ck-content.ck-editor__editable,
.print-form-ckeditor-shell .ck.ck-editor__editable_inline {
    min-height: 0;
}

.print-form-ckeditor-shell .ck.ck-editor__editable_inline {
    min-width: 30mm;
    margin: 0 auto;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px dashed #adb5bd;
    background: #fff;
    color: #000;
    font-family: Arial, sans-serif;
    resize: none !important;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .12);
}

.print-form-ckeditor-shell .ck.ck-editor__editable_inline:focus {
    border-color: var(--ts-gold);
    box-shadow: 0 0 0 .2rem rgba(255, 205, 6, .2), 0 14px 32px rgba(15, 23, 42, .12);
}

.print-form-ckeditor-shell .ck-content {
    line-height: 1.08;
}

.print-form-ckeditor-shell .ck-content .pf-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 1mm;
    padding: 1.5mm;
    line-height: 1.08;
    text-align: center;
}

.print-form-ckeditor-shell .ck-content .pf-name {
    font-size: 8pt;
    font-weight: 700;
}

.print-form-ckeditor-shell .ck-content .pf-price {
    font-size: 14pt;
    font-weight: 800;
}

.print-form-ckeditor-shell .ck-content .pf-code,
.print-form-ckeditor-shell .ck-content .pf-description {
    font-size: 6.5pt;
}

/* CKEditor оборачивает вставленную таблицу в <figure class="table">, поэтому на
   неё попадают глобальные стили .table (в тёмной теме — светлый текст) и текст/
   переменные в ячейках становятся не видны на белом холсте. Возвращаем чёрный. */
.print-form-ckeditor-shell .ck-content .table,
.print-form-ckeditor-shell .ck-content figure.table,
.print-form-ckeditor-shell .ck-content table,
.print-form-ckeditor-shell .ck-content table td,
.print-form-ckeditor-shell .ck-content table th {
    color: #000;
}

.print-form-ckeditor-shell .ck-content table,
.print-form-ckeditor-shell .ck-content .pf-user-table {
    width: 100%;
    border-collapse: collapse !important;
}

.print-form-ckeditor-shell .ck-content table td,
.print-form-ckeditor-shell .ck-content table th,
.print-form-ckeditor-shell .ck-content .pf-user-table td,
.print-form-ckeditor-shell .ck-content .pf-user-table th {
    border: 1px solid #000 !important;
    padding: 1mm;
}

.ck-powered-by,
.ck-powered-by-balloon,
.ck-powered-by-balloon__label,
.ck a[href*="ckeditor.com"],
.ck-balloon-panel a[href*="ckeditor.com"] {
    display: none !important;
}

.print-form-editor-size-note {
    margin-bottom: .55rem;
    color: var(--ts-text-dim);
    font-size: .875rem;
}

.print-form-editor-sheet {
    overflow: auto;
    max-width: 100%;
    padding: 1rem;
    border: 1px solid var(--ts-line);
    border-radius: var(--ts-radius);
    background:
        linear-gradient(45deg, rgba(128, 128, 128, .08) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(128, 128, 128, .08) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(128, 128, 128, .08) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(128, 128, 128, .08) 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

.print-form-editor {
    min-width: 30mm;
    margin: 0 auto;
    overflow: hidden;
    border: 1px dashed #adb5bd;
    background: #fff;
    color: #000;
    font-family: Arial, sans-serif;
    outline: none;
}

.print-form-editor:focus {
    border-color: var(--ts-gold);
    box-shadow: 0 0 0 .2rem rgba(255, 205, 6, .2);
}

.print-form-editor .pf-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 1mm;
    padding: 1.5mm;
    line-height: 1.08;
    text-align: center;
}

.print-form-editor .pf-name {
    font-size: 8pt;
    font-weight: 700;
}

.print-form-editor .pf-price {
    font-size: 14pt;
    font-weight: 800;
}

.print-form-editor .pf-code,
.print-form-editor .pf-description {
    font-size: 6.5pt;
}

.print-form-editor table,
.print-form-editor .pf-user-table {
    width: 100%;
    border-collapse: collapse !important;
}

.print-form-editor table td,
.print-form-editor table th,
.print-form-editor .pf-user-table td,
.print-form-editor .pf-user-table th {
    border: 1px solid #000 !important;
    padding: 1mm;
}

.inventory-bulk-print-fab {
    position: fixed;
    left: 23px;
    bottom: 23px;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .7rem;
    border: 1px solid rgba(255, 205, 6, .45);
    /* Скругление как у кнопки «Создать товар» (стандартный .btn). */
    border-radius: 22px;
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow-lg);
}

.inventory-bulk-print-fab[hidden] {
    display: none !important;
}

.inventory-bulk-print-fab .btn {
    /* Закругления как у кнопки «Создать товар» (стандартный .btn). */
    border-radius: 14px;
    /* Кнопка «Массовая печать» на 30% крупнее стандартного btn-sm. */
    font-size: 1.14rem;
    padding: .33rem .65rem;
}

.inventory-bulk-print-fab__count {
    color: var(--ts-text-dim);
    font-size: .85rem;
    white-space: nowrap;
}

.merge-field-card {
    height: 100%;
    padding: 1rem;
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius-md);
    background: var(--ts-surface);
}

.merge-field-card--conflict {
    border-color: rgba(255, 205, 6, .65);
    box-shadow: 0 0 0 1px rgba(255, 205, 6, .18);
}

.merge-field-options {
    padding-top: .65rem;
    border-top: 1px dashed var(--ts-border);
}

.merge-option {
    white-space: normal;
    text-align: left;
}

.merge-option:hover .merge-option__source,
.merge-option:focus .merge-option__source,
.merge-option:active .merge-option__source {
    color: #212529 !important;
    opacity: .72;
}

@media (max-width: 767.98px) {
    .inventory-bulk-print-fab {
        left: 14px;
        right: 14px;
        /* Поднимаем над кнопкой сообщений (.chat-toggle: снизу 23px, высота 64px). */
        bottom: calc(env(safe-area-inset-bottom) + 96px);
        justify-content: space-between;
    }

    .print-form-variable-control,
    .print-form-variable-select {
        width: 100%;
        flex-basis: 100%;
    }
}

.formset-remove {
    border-left: 0;
    background: var(--ts-surface-2);
    color: var(--ts-text-dim);
    cursor: pointer;
    font-weight: 600;
}

.formset-remove:hover {
    background: var(--ts-surface-3);
    color: var(--ts-red-ink);
}

.kpi-card {
    position: relative;
    overflow: hidden;
    min-height: 118px;
}

.kpi-card::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: var(--ts-gold);
    content: "";
}

.kpi-card .kpi-label {
    color: var(--ts-text-dim);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.kpi-card .kpi-value {
    margin-top: .35rem;
    color: var(--ts-text);
    font-family: var(--ts-font-display);
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    font-weight: 800;
}

.kpi-card.kpi-positive::before {
    background: var(--ts-green);
}

.kpi-card.kpi-info::before {
    background: var(--ts-blue);
}

.kpi-card.kpi-danger::before {
    background: var(--ts-red);
}

.net-profit-card {
    border: 1px solid var(--ts-line-strong) !important;
    border-left: 4px solid var(--ts-green) !important;
    background: var(--ts-surface) !important;
}

.net-profit-label {
    color: var(--ts-text-dim);
}

.net-profit-value {
    color: var(--ts-text);
}

html[data-theme="dark"] .net-profit-value {
    color: var(--ts-green-ink);
}

.dashboard-chart-card .card-body {
    display: flex;
    min-height: 360px;
    flex-direction: column;
}

.dashboard-chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-chart-controls {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
}

.dashboard-chart-controls .btn {
    min-height: 34px;
    white-space: nowrap;
}

.dashboard-chart-period-menu {
    width: 270px;
    padding: .45rem;
}

.dashboard-chart-custom-box {
    padding: .45rem .55rem .55rem;
}

.dashboard-chart-custom-fields {
    display: grid;
    gap: .45rem;
}

.dashboard-chart-custom-fields .form-control {
    min-height: 36px;
}

.dashboard-chart-canvas-wrap {
    position: relative;
    width: 100%;
    height: 270px;
    margin-top: 1rem;
    transition: opacity .15s ease;
}

.dashboard-chart-card.is-loading .dashboard-chart-canvas-wrap {
    opacity: .55;
}

.dashboard-chart-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.dashboard-chart-tooltip {
    position: fixed;
    z-index: 1090;
    min-width: 118px;
    padding: .45rem .6rem;
    border: 1px solid var(--ts-line-strong);
    border-radius: var(--ts-radius-sm);
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow-lg);
    color: var(--ts-text);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -100%);
    transition: opacity .12s ease;
}

.dashboard-chart-tooltip.is-visible {
    opacity: 1;
}

.dashboard-chart-tooltip__label {
    color: var(--ts-text-dim);
    font-size: .72rem;
    line-height: 1.2;
}

.dashboard-chart-tooltip__value {
    margin-top: .15rem;
    color: var(--ts-green-ink);
    font-family: var(--ts-font-display);
    font-size: .95rem;
    font-weight: 800;
    line-height: 1.2;
}

@media (max-width: 575.98px) {
    .dashboard-chart-card .card-body {
        min-height: 340px;
    }

    .dashboard-chart-header {
        flex-direction: column;
        gap: .75rem;
    }

    .dashboard-chart-controls {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .dashboard-chart-controls .dropdown,
    .dashboard-chart-controls .btn {
        flex: 1 1 140px;
        width: 100%;
    }

    .dashboard-chart-period-menu {
        width: min(270px, calc(100vw - 2rem));
    }

    .dashboard-chart-canvas-wrap {
        height: 240px;
    }
}


.chat-widget {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(23px, env(safe-area-inset-bottom));
    z-index: 1041;
    font-family: var(--ts-font-body);
}

.chat-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: .95rem;
    width: min(280px, calc(100vw - 32px));
    min-height: 64px;
    border: 0;
    border-radius: 22px;
    background: var(--ts-gold);
    box-shadow: 0 16px 38px rgba(230, 184, 0, .28);
    color: var(--ts-graphite);
    font-family: var(--ts-font-display);
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -.04em;
    padding: .55rem .6rem .55rem 1.15rem;
    transition: transform .15s ease, box-shadow .15s ease;
}

.chat-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 46px rgba(230, 184, 0, .36);
}

.chat-widget.is-open .chat-toggle {
    display: none;
}

.chat-widget.is-closing .chat-toggle {
    display: none;
}

.chat-toggle__label {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: .45rem;
}

.chat-toggle__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, .36);
}

.chat-toggle__arrow svg,
.chat-panel__action svg,
.chat-send-button svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.6;
}

.chat-toggle__badge {
    min-width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--ts-red);
    color: #fff;
    font-size: .7rem;
    line-height: 20px;
    text-align: center;
}

.chat-panel {
    display: none;
    width: min(424px, calc(100vw - 24px));
    height: min(564px, calc(100vh - 42px));
    overflow: hidden;
    border: 0;
    border-radius: 34px;
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow-lg);
    color: var(--ts-text);
    padding: 1.35rem;
    opacity: 0;
    transform: translateY(18px) scale(.97);
    transform-origin: right bottom;
}

.chat-widget.is-open .chat-panel {
    display: flex;
    flex-direction: column;
    animation: chat-panel-in .2s ease forwards;
}

.chat-widget.is-closing .chat-panel {
    display: flex;
    flex-direction: column;
    animation: chat-panel-out .18s ease forwards;
}

@keyframes chat-panel-in {
    from {
        opacity: 0;
        transform: translateY(18px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes chat-panel-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(16px) scale(.97);
    }
}

.chat-sidebar,
.chat-thread {
    min-width: 0;
}

.chat-sidebar {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    background: var(--ts-surface);
}

.chat-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .1rem 0 1.05rem;
}

.chat-panel__title {
    color: var(--ts-text);
    font-family: var(--ts-font-display);
    font-size: clamp(1.55rem, 3.4vw, 2rem);
    font-weight: 800;
    letter-spacing: -.05em;
}

.chat-panel__actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.chat-panel__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 15px;
    background: var(--ts-surface-2);
    color: var(--ts-text);
}

.chat-panel__action:hover {
    background: var(--ts-surface-3);
}

.chat-dialogs {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0 .25rem .25rem 0;
}

.chat-dialog {
    display: grid;
    grid-template-columns: 58px 1fr auto;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    width: 100%;
    border: 0;
    border-radius: 24px;
    background: transparent;
    color: var(--ts-text);
    margin-bottom: .55rem;
    padding: .82rem;
    text-align: left;
}

.chat-dialog:hover,
.chat-dialog.is-active {
    background: var(--ts-surface-2);
}

.chat-dialog--service {
    background: rgba(77, 163, 255, .14);
}

.chat-dialog--service:hover,
.chat-dialog--service.is-active {
    background: rgba(77, 163, 255, .2);
}

.chat-dialog__avatar,
.chat-message__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 50%;
    background: var(--ts-gold);
    color: var(--ts-graphite);
    font-weight: 800;
}

.chat-dialog__avatar {
    width: 58px;
    height: 58px;
    font-size: 1.35rem;
}

.chat-message__avatar {
    width: 30px;
    height: 30px;
}

.chat-dialog__avatar img,
.chat-message__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-dialog__main {
    min-width: 0;
}

.chat-dialog__title-row {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
}

.chat-dialog__title {
    display: block;
    overflow: hidden;
    min-width: 0;
    color: var(--ts-text);
    font-size: 1.05rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-dialog__preview {
    display: block;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
    margin-top: .15rem;
    color: var(--ts-text-dim);
    font-size: .92rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-dialog__time {
    min-width: max-content;
    color: var(--ts-text-mute);
    font-size: .68rem;
    white-space: nowrap;
}

.chat-dialog__unread {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--ts-red);
    box-shadow: 0 0 0 3px rgba(246, 70, 93, .12);
}

.chat-thread {
    display: none;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    background: var(--ts-surface);
}

.chat-widget.is-thread-open .chat-sidebar {
    display: none;
}

.chat-widget.is-thread-open .chat-thread {
    display: flex;
}

.chat-thread__empty {
    display: grid;
    flex: 1 1 auto;
    place-items: center;
    padding: 1.5rem;
    color: var(--ts-text-dim);
    text-align: center;
}

.chat-thread__header {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 0 0 1rem;
    border-bottom: 1px solid var(--ts-line);
    background: var(--ts-surface);
}

.chat-thread__meta {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .7rem;
    flex: 1 1 auto;
}

.chat-thread__title-wrap {
    min-width: 0;
}

.chat-thread__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--ts-text);
    font-size: 1.25rem;
}

.chat-thread__title {
    overflow: hidden;
    color: var(--ts-text);
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-thread__close {
    width: 42px;
    height: 42px;
    border-radius: 14px;
}

.chat-messages {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    gap: .72rem;
    overflow-y: auto;
    padding: 1rem 0;
}

.chat-message {
    display: flex;
    align-items: center;
    gap: .55rem;
    max-width: 86%;
}

.chat-message.is-mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message__bubble {
    min-width: 0;
    border: 1px solid var(--ts-line);
    border-radius: 16px 16px 16px 5px;
    background: var(--ts-surface);
    padding: .68rem .78rem;
    box-shadow: 0 8px 18px rgba(16, 24, 40, .05);
}

.chat-message.is-mine .chat-message__bubble {
    border-color: rgba(255, 205, 6, .45);
    border-radius: 16px 16px 5px 16px;
    background: var(--ts-gold-100);
}

.chat-message.chat-message--image-only .chat-message__bubble,
.chat-message.is-mine.chat-message--image-only .chat-message__bubble {
    border: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.chat-message__body {
    color: var(--ts-text);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message__time {
    flex: 0 0 auto;
    color: var(--ts-text-mute);
    font-size: .8rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.chat-message-date {
    align-self: center;
    border-radius: 999px;
    background: var(--ts-surface-2);
    color: var(--ts-text-dim);
    font-size: .82rem;
    font-weight: 700;
    line-height: 1;
    padding: .42rem .8rem;
}

.chat-attachments {
    display: grid;
    gap: .38rem;
    margin-top: .45rem;
}

.chat-attachment {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    max-width: 220px;
    border: 1px solid var(--ts-line);
    border-radius: 10px;
    background: var(--ts-surface-2);
    color: var(--ts-text);
    font-size: .78rem;
    padding: .38rem .48rem;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
}

.chat-attachment img {
    width: 126px;
    height: 92px;
    border-radius: 8px;
    object-fit: cover;
}

.chat-attachment__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attachment--image {
    display: block;
    max-width: none;
    border: 0;
    background: transparent;
    padding: 0;
}

.chat-attachment--image:hover {
    background: transparent;
}

.chat-attachment-modal {
    position: fixed;
    inset: 0;
    z-index: 1065;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.chat-attachment-modal[hidden] {
    display: none;
}

.chat-attachment-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 14, 18, .62);
    backdrop-filter: blur(4px);
}

.chat-attachment-modal__dialog {
    position: relative;
    display: grid;
    width: min(720px, calc(100vw - 32px));
    max-height: min(82vh, 720px);
    overflow: hidden;
    border: 1px solid var(--ts-line);
    border-radius: 24px;
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow-lg);
    color: var(--ts-text);
    padding: 1.25rem;
}

.chat-attachment-modal__close {
    position: absolute;
    top: .7rem;
    right: .7rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--ts-surface-2);
    color: var(--ts-text);
    font-size: 1.45rem;
    line-height: 1;
}

.chat-attachment-modal__body {
    display: grid;
    min-height: 180px;
    place-items: center;
    overflow: auto;
}

.chat-attachment-modal__image {
    max-width: 100%;
    max-height: 64vh;
    border-radius: 18px;
    object-fit: contain;
}

.chat-attachment-modal__file {
    display: grid;
    gap: .75rem;
    justify-items: center;
    padding: 2.5rem 1rem 1.5rem;
    text-align: center;
}

.chat-attachment-modal__file-icon {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    border-radius: 50%;
    background: var(--ts-gold-100);
    font-size: 2rem;
}

.chat-attachment-modal__file-name {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-weight: 800;
}

.chat-attachment-modal__link {
    justify-self: center;
    margin-top: 1rem;
    border-radius: 999px;
    background: var(--ts-gold);
    color: var(--ts-graphite);
    font-weight: 800;
    padding: .68rem 1.15rem;
}

.chat-attachment-modal__link:hover {
    color: var(--ts-graphite);
    filter: brightness(.96);
}

.chat-compose {
    position: relative;
    border-top: 1px solid var(--ts-line);
    background: var(--ts-surface);
    padding: .75rem 0 0;
}

.chat-compose__row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: end;
    gap: .45rem;
}

.chat-compose textarea {
    font-size: 1rem;
    font-weight: 600;
    min-height: 42px;
    max-height: 120px;
    overflow-y: hidden;
    resize: none;
    text-align: center;
}

.chat-compose textarea:focus,
.chat-compose textarea:not(:placeholder-shown) {
    text-align: left;
}

.chat-compose textarea::placeholder {
    text-align: center;
}

.chat-compose__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--ts-line);
    border-radius: 50%;
    background: var(--ts-surface-2);
    color: var(--ts-text);
}

.chat-compose__icon:hover {
    border-color: var(--ts-gold);
    background: var(--ts-gold-100);
}

.chat-file-menu {
    position: absolute;
    bottom: 58px;
    left: 0;
    z-index: 3;
    display: none;
    min-width: 190px;
    border: 1px solid var(--ts-line);
    border-radius: 16px;
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow-lg);
    padding: .45rem;
}

.chat-file-menu.is-open {
    display: grid;
    gap: .25rem;
}

.chat-file-menu button {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ts-text);
    font-weight: 700;
    padding: .62rem .7rem;
    text-align: left;
}

.chat-file-menu button:hover {
    background: var(--ts-surface-2);
}

.chat-send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--ts-gold);
    color: var(--ts-graphite);
    box-shadow: 0 8px 18px rgba(230, 184, 0, .22);
}

.chat-send-button:disabled {
    cursor: wait;
    opacity: .65;
}

.chat-compose__icon:disabled {
    cursor: wait;
    opacity: .55;
}

.chat-emoji {
    position: absolute;
    right: 68px;
    bottom: 64px;
    display: none;
    grid-template-columns: repeat(8, 1fr);
    gap: .18rem;
    width: 292px;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--ts-line);
    border-radius: var(--ts-radius);
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow-lg);
    padding: .45rem;
}

.chat-emoji.is-open {
    display: grid;
}

.chat-emoji button {
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 1.15rem;
    padding: .28rem .2rem;
}

.chat-emoji button:hover {
    background: var(--ts-surface-2);
}

.chat-selected-files {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .5rem;
}

.chat-upload-status {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    width: fit-content;
    margin-bottom: .5rem;
    border: 1px solid rgba(255, 205, 6, .7);
    border-radius: 999px;
    background: var(--ts-gold-100);
    color: var(--ts-text);
    font-size: .78rem;
    font-weight: 800;
    padding: .36rem .65rem;
}

.chat-upload-status[hidden] {
    display: none;
}

.chat-upload-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(33, 37, 41, .22);
    border-top-color: var(--ts-graphite);
    border-radius: 50%;
    animation: chat-upload-spin .75s linear infinite;
}

@keyframes chat-upload-spin {
    to {
        transform: rotate(360deg);
    }
}

.chat-file-chip {
    border-radius: 999px;
    background: var(--ts-surface-2);
    color: var(--ts-text-dim);
    font-size: .72rem;
    padding: .22rem .5rem;
}

.chat-error {
    display: none;
    margin-bottom: .45rem;
    color: var(--ts-red-ink);
    font-size: .78rem;
}

.chat-error.is-visible {
    display: block;
}

html[data-theme="dark"] .chat-message.is-mine .chat-message__bubble {
    background: rgba(255, 205, 6, .16);
}

html[data-theme="dark"] .chat-message.is-mine.chat-message--image-only .chat-message__bubble {
    background: transparent;
}

html[data-theme="dark"] .chat-panel {
    background: var(--ts-surface);
}

html[data-theme="dark"] .chat-toggle {
    background: var(--ts-gold);
    color: var(--ts-graphite);
}

html[data-theme="dark"] .chat-toggle__arrow {
    background: rgba(255, 255, 255, .28);
}

html[data-theme="dark"] .chat-attachment {
    background: var(--ts-surface-3);
}

html[data-theme="dark"] .chat-upload-status {
    background: rgba(255, 205, 6, .16);
    color: var(--ts-text);
}

html[data-theme="dark"] .chat-upload-spinner {
    border-color: rgba(255, 255, 255, .24);
    border-top-color: var(--ts-gold);
}

.auth-shell {
    max-width: 460px;
    margin: 2.5rem auto;
    padding: 2rem;
    border: 1px solid var(--ts-line);
    border-radius: var(--ts-radius-lg);
    background: var(--ts-surface);
    box-shadow: var(--ts-shadow);
}

#custom-range[style*="display:none"],
#custom-range[style*="display: none"] {
    display: none !important;
}

[style*="background:#e8f5e9"],
[style*="background: #e8f5e9"] {
    background: rgba(14, 203, 129, .09) !important;
}

[style*="background:#e3f2fd"],
[style*="background: #e3f2fd"],
[style*="background:#e0f7fa"],
[style*="background: #e0f7fa"] {
    background: rgba(77, 163, 255, .09) !important;
}

[style*="background:#fff3e0"],
[style*="background: #fff3e0"],
[style*="background:#fffde7"],
[style*="background: #fffde7"] {
    background: rgba(255, 205, 6, .11) !important;
}

[style*="background:#fce4ec"],
[style*="background: #fce4ec"],
[style*="background:#ffebee"],
[style*="background: #ffebee"] {
    background: rgba(246, 70, 93, .09) !important;
}

[style*="background:#f3e5f5"],
[style*="background: #f3e5f5"],
[style*="background:#e8eaf6"],
[style*="background: #e8eaf6"] {
    background: var(--ts-surface-2) !important;
    color: var(--ts-text) !important;
}

@media (max-width: 991.98px) {
    .app-navbar {
        min-height: 62px;
    }

    .app-navbar .navbar-collapse {
        margin-top: .75rem;
        padding: .65rem;
        border: 1px solid rgba(255, 255, 255, .1);
        border-radius: var(--ts-radius);
        background: rgba(0, 0, 0, .14);
    }

    .app-navbar .navbar-nav {
        gap: .15rem;
    }

    .app-navbar .nav-link.active::after {
        top: .55rem;
        right: auto;
        bottom: .55rem;
        left: .15rem;
        width: 3px;
        height: auto;
    }

    .app-navbar .nav-link-new-feature {
        display: inline-flex;
        width: auto;
        padding-right: .72rem !important;
    }

    .app-navbar .nav-new-badge {
        top: -.2rem;
        right: -.62rem;
    }

    .settings-sidebar {
        position: static;
        margin-bottom: 1rem;
    }

    .settings-sidebar .list-group {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem;
        padding: .5rem;
        box-shadow: none;
    }

    .settings-sidebar .list-group-item {
        border: 1px solid var(--ts-line) !important;
        border-radius: 9px !important;
        text-align: center;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 14px;
    }

    .app-content {
        padding: 1.1rem .75rem 5rem;
    }

    .app-content .container,
    .app-content .container-fluid {
        padding-right: 0;
        padding-left: 0;
    }

    .page-header,
    .app-content > .container > .d-flex:first-child,
    .app-content > .container-fluid > .d-flex:first-child {
        align-items: stretch !important;
        gap: .65rem !important;
    }

    .page-header .ms-auto,
    .app-content > .container > .d-flex:first-child .ms-auto,
    .app-content > .container-fluid > .d-flex:first-child .ms-auto {
        width: 100%;
        margin-left: 0 !important;
    }

    .page-header .btn,
    .app-content > .container > .d-flex:first-child > .btn,
    .app-content > .container-fluid > .d-flex:first-child > .btn {
        width: 100%;
    }

    .row > [class*="col-md-"] {
        min-width: 0;
    }

    .app-content .d-flex {
        flex-wrap: wrap;
    }

    .app-content .input-group {
        flex-wrap: nowrap;
    }

    .app-content [style*="max-width"] {
        max-width: 100% !important;
    }

    .app-content .row > [style*="width:20%"],
    .app-content .row > [style*="width:80%"] {
        width: 100% !important;
    }

    .card-body {
        padding: 1rem;
    }

    .sale-total-summary {
        flex-wrap: wrap;
    }

    .item-row > .row,
    .service-row > .row {
        padding-right: 0;
    }

    .item-row > .row > .text-end:last-child,
    .service-row > .row > .text-end:last-child {
        position: static;
        display: flex;
        justify-content: flex-end;
        min-height: 0;
        width: 100%;
        padding: 0 calc(var(--bs-gutter-x) * .5);
    }

    .btn:not(.btn-sm):not(.btn-close) {
        min-height: 44px;
    }

    .form-control,
    .form-select {
        min-height: 45px;
        font-size: 16px;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
    }

    .mobile-card-table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .mobile-card-table {
        display: block;
    }

    .mobile-card-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        clip-path: inset(50%);
    }

    .mobile-card-table tbody,
    .mobile-card-table tr,
    .mobile-card-table td {
        display: block;
        width: 100%;
    }

    .mobile-card-table tbody {
        display: grid;
        gap: .75rem;
    }

    .mobile-card-table tbody tr {
        overflow: hidden;
        border: 1px solid var(--ts-line);
        border-radius: var(--ts-radius);
        background: var(--ts-surface);
        box-shadow: var(--ts-shadow);
    }

    .mobile-card-table tbody tr.table-success,
    .mobile-card-table tbody tr.table-danger {
        background: var(--ts-surface);
    }

    .mobile-card-table td {
        display: grid;
        grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
        gap: .75rem;
        align-items: start;
        min-height: 42px;
        border-bottom: 1px solid var(--ts-line);
        padding: .68rem .8rem;
        text-align: right;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    .mobile-card-table td::before {
        color: var(--ts-text-dim);
        content: attr(data-label);
        font-family: var(--ts-font-display);
        font-size: .72rem;
        font-weight: 700;
        letter-spacing: .025em;
        text-align: left;
        text-transform: uppercase;
    }

    .mobile-card-table td:last-child {
        border-bottom: 0;
    }

    .mobile-card-table td[colspan] {
        display: block;
        text-align: center;
    }

    .mobile-card-table td[colspan]::before {
        display: none;
    }

    .mobile-card-table td .d-flex {
        justify-content: flex-end;
    }

    .mobile-card-table .table-actions {
        display: flex;
        justify-content: flex-end;
    }

    .mobile-card-table td .btn-sm {
        min-width: 38px;
        min-height: 38px;
    }

    .mobile-card-table .table-action-button {
        width: 38px;
        height: 38px;
    }

    .mobile-card-table td > .badge {
        justify-self: start;
    }

    .mobile-card-table td .product-type-badge {
        width: auto;
        max-width: max-content;
        justify-self: end;
        align-self: start;
        flex: 0 0 auto;
    }

    .mobile-card-table td[data-label="Действия"],
    .mobile-card-table td[data-label=""] {
        grid-template-columns: 1fr;
    }

    .mobile-card-table td[data-label="Действия"]::before,
    .mobile-card-table td[data-label=""]::before {
        display: none;
    }

    .settings-sidebar .list-group {
        grid-template-columns: 1fr;
    }

    .modal-dialog {
        margin: .75rem;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
    }

    #custom-range,
    #custom-range form {
        width: 100%;
        flex-wrap: wrap;
    }

    #custom-range input[type="date"] {
        width: calc(50% - 1rem) !important;
        flex: 1 1 135px;
    }

    .chat-widget {
        right: 14px;
        bottom: max(14px, env(safe-area-inset-bottom));
    }

    .chat-panel {
        width: calc(100vw - 28px);
        height: min(501px, calc(100vh - 104px));
        border-radius: 28px;
        padding: 1rem;
    }

    .chat-toggle {
        width: min(280px, calc(100vw - 28px));
        min-height: 64px;
        border-radius: 22px;
        font-size: 1.12rem;
        padding: .55rem .6rem .55rem 1.1rem;
    }

    .chat-toggle__arrow {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .chat-panel__action {
        width: 42px;
        height: 42px;
        border-radius: 16px;
    }

    .chat-emoji {
        right: 0;
        width: min(292px, calc(100vw - 48px));
    }

    .app-footer__inner {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .app-footer__telegram {
        justify-self: center;
    }

    .chat-dialog {
        grid-template-columns: 50px 1fr auto;
        gap: .75rem;
        border-radius: 20px;
        padding: .7rem;
    }

    .chat-dialog__avatar {
        width: 50px;
        height: 50px;
    }

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

@media (max-width: 420px) {
    .mobile-card-table td {
        grid-template-columns: 1fr;
        gap: .25rem;
        text-align: left;
    }

    .mobile-card-table td .d-flex {
        justify-content: flex-start;
    }

    .mobile-card-table .table-actions {
        justify-content: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
