/*
 * Project: BAU CRM
 * File: public/assets/css/style.css
 * Author: Kainarbek Soltankhan
 * Original interface author: Kainarbek Soltankhan
 * Version: 3.3.1
 * Release date: 2026-09-01
 * Last updated: 2026-09-09
 * Copyright: © Kainarbek Soltankhan. All rights reserved.
 *
 * EN: Responsive CRM, legal-document, privacy, and account-security styles.
 * RU: Адаптивные стили CRM, юридических документов, приватности и безопасности аккаунта.
 */

:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #dfe5ea;
    --text: #28313d;
    --muted: #7c8794;
    --primary: #437ee8;
    --primary-dark: #2f65c3;
    --danger: #df4a4a;
    --sidebar: #263946;
    --sidebar-soft: #314858;
    --shadow: 0 12px 30px rgba(32, 45, 58, 0.14);
    --sidebar-width: 76px;
}

/* EN: v3 legal, import-confirmation, and account controls. RU: Элементы v3 для документов, подтверждения импорта и аккаунта. */
.product-section-priority {
    order: -1;
}

.password-hint,
.login-legal-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.import-compliance-confirm {
    display: grid !important;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 10px;
    line-height: 1.45;
}

.import-compliance-confirm input {
    margin-top: 3px;
}

.login-legal-note {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.login-legal-note a,
.legal-page a {
    color: var(--primary-dark);
    text-underline-offset: 3px;
}

.logout-form button {
    border: 0;
    cursor: pointer;
    font: inherit;
}

.logout-form {
    margin: 0;
}

.settings-export-form {
    margin: 0;
}

.settings-export-form .settings-menu-item {
    width: 100%;
    text-align: left;
}

.user-reauth {
    display: grid;
    gap: 6px;
    margin: 14px 0;
    padding: 12px;
    border: 1px solid #d7e2ee;
    border-radius: 10px;
    background: #f7faff;
    color: #40546a;
    font-size: 0.86rem;
}

.sidebar-legal-links {
    display: grid;
    gap: 3px;
    text-align: center;
}

.sidebar-legal-links a {
    color: #c8d7df;
    font-size: 0.64rem;
    text-decoration: none;
}

.sidebar-legal-links a:hover,
.sidebar-legal-links a:focus-visible {
    color: #ffffff;
    text-decoration: underline;
}

.stage-type-input,
#newStageType {
    min-width: 124px;
}

:where(a, button, input, select, textarea):focus-visible {
    outline: 3px solid rgba(67, 126, 232, 0.45);
    outline-offset: 2px;
}

.legal-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 0 0, rgba(67, 126, 232, 0.11), transparent 36rem),
        #f5f7fa;
    color: #202a36;
}

.legal-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px clamp(18px, 4vw, 58px);
    border-bottom: 1px solid rgba(207, 216, 226, 0.9);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 28px rgba(31, 47, 66, 0.06);
}

.legal-brand {
    color: #263946 !important;
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-decoration: none;
}

.legal-brand span {
    color: var(--primary);
}

.legal-header nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.legal-header nav > a:not(.btn) {
    color: #536170;
    font-size: 0.9rem;
    font-weight: 650;
    text-decoration: none;
}

.legal-header nav > a[aria-current="page"] {
    color: var(--primary-dark);
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

.legal-shell {
    width: min(940px, calc(100% - 32px));
    margin: 0 auto;
    padding: clamp(42px, 7vw, 86px) 0 70px;
}

.legal-hero {
    max-width: 820px;
    margin-bottom: 26px;
}

.legal-hero h1 {
    margin: 10px 0 18px;
    font-size: clamp(2rem, 5vw, 3.65rem);
    line-height: 1.06;
    letter-spacing: -0.035em;
}

.legal-hero > p:last-child {
    max-width: 760px;
    color: #5b6978;
    font-size: 1.08rem;
    line-height: 1.7;
}

.legal-context {
    margin: 0 0 28px;
    padding: 18px 20px;
    border: 1px solid #e4c986;
    border-radius: 14px;
    background: #fff9e9;
    color: #624f24;
    line-height: 1.6;
}

.legal-context p {
    margin: 0;
}

.legal-context p + p {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(98, 79, 36, 0.2);
}

.legal-language-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 24px;
}

.legal-language-nav a {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid #cdd9e7;
    border-radius: 999px;
    background: #ffffff;
    padding: 9px 18px;
    font-weight: 750;
    text-decoration: none;
}

.legal-language-nav a:hover,
.legal-language-nav a:focus-visible {
    border-color: var(--primary);
    background: #eef5ff;
}

.legal-language-section {
    scroll-margin-top: 96px;
}

.legal-language-section + .legal-language-section {
    margin-top: 30px;
}

.legal-language-header {
    margin: 0 0 16px;
    padding: 0 4px;
}

.legal-language-header h2 {
    margin: 7px 0 8px;
    color: #253344;
    font-size: clamp(1.45rem, 3vw, 2rem);
    line-height: 1.2;
}

.legal-language-header > p:last-child {
    margin: 0;
    color: #5b6978;
    line-height: 1.65;
}

.legal-document,
.legal-sources {
    border: 1px solid #dfe5ec;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 22px 60px rgba(33, 49, 68, 0.08);
}

.legal-document {
    padding: clamp(24px, 5vw, 58px);
}

.legal-document section + section {
    margin-top: 34px;
    padding-top: 30px;
    border-top: 1px solid #e7ebef;
}

.legal-document h2,
.legal-document h3,
.legal-sources h2 {
    margin: 0 0 14px;
    color: #253344;
    font-size: clamp(1.15rem, 2vw, 1.42rem);
    line-height: 1.35;
}

.legal-document p,
.legal-document li,
.legal-sources li {
    color: #455465;
    line-height: 1.72;
}

.legal-document p {
    margin: 0 0 14px;
}

.legal-document ul,
.legal-sources ul {
    margin: 10px 0 0;
    padding-left: 22px;
}

.legal-document li + li,
.legal-sources li + li {
    margin-top: 7px;
}

.requisites {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin: 0;
    border: 1px solid #dce4ec;
    border-radius: 12px;
    background: #dce4ec;
}

.requisites div {
    padding: 13px 15px;
    background: #f9fbfc;
}

.requisites dt {
    margin-bottom: 3px;
    color: #7b8793;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.requisites dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: #293746;
    font-weight: 650;
}

.legal-sources {
    margin-top: 24px;
    padding: 24px clamp(22px, 4vw, 36px);
}

.legal-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 24px clamp(18px, 4vw, 58px);
    border-top: 1px solid #dfe5ec;
    background: #263946;
    color: #d6e0e6;
    font-size: 0.84rem;
}

.legal-footer p {
    margin: 0;
}

.legal-footer a {
    color: #ffffff;
}

@media (max-width: 760px) {
    .legal-header {
        position: static;
        align-items: flex-start;
        flex-direction: column;
    }

    .legal-header nav {
        width: 100%;
        flex-wrap: wrap;
        gap: 10px 16px;
    }

    .legal-header nav .btn {
        width: 100%;
        margin-top: 4px;
        text-align: center;
    }

    .legal-language-nav a {
        flex: 1 1 140px;
    }

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

    .legal-footer {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

[hidden] {
    display: none !important;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    display: grid;
    height: 100vh;
    min-height: 100vh;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    overflow: hidden;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: var(--sidebar);
    color: #c9d5dc;
    padding: 18px 8px;
}

.brand-mark {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.brand-mark:hover,
.brand-mark:focus-visible {
    border-color: rgba(255, 255, 255, 0.34);
    background: var(--sidebar-soft);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.side-nav {
    display: grid;
    width: 100%;
    gap: 8px;
}

.side-link,
.logout-link {
    display: grid;
    min-height: 56px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #c9d5dc;
    cursor: pointer;
}

.side-link span,
.logout-link {
    font-size: 22px;
    line-height: 1;
}

.side-link small {
    font-size: 10px;
}

.side-link.active,
.side-link:hover,
.logout-link:hover {
    background: var(--sidebar-soft);
    color: #ffffff;
}

.language-switcher {
    display: grid;
    width: 100%;
    gap: 6px;
}

.language-switcher button {
    min-height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: transparent;
    color: #c9d5dc;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.language-switcher button.active,
.language-switcher button:hover {
    border-color: rgba(255, 255, 255, 0.28);
    background: #ffffff;
    color: var(--sidebar);
}

.sidebar-bottom {
    margin-top: auto;
    width: 100%;
    display: grid;
    gap: 8px;
    position: relative;
}

.settings-slot {
    position: relative;
    width: 100%;
}

.settings-toggle {
    display: grid;
    width: 100%;
    min-height: 56px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #c9d5dc;
    cursor: pointer;
    font-size: 23px;
}

.settings-toggle:hover,
.settings-toggle[aria-expanded="true"] {
    background: var(--sidebar-soft);
    color: #ffffff;
}

.settings-menu {
    position: absolute;
    left: calc(100% + 12px);
    bottom: 0;
    z-index: 30;
    display: grid;
    min-width: 210px;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 8px;
}

.settings-menu[hidden] {
    display: none;
}

.settings-menu::before {
    content: "";
    position: absolute;
    left: -7px;
    bottom: 22px;
    width: 12px;
    height: 12px;
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    transform: rotate(45deg);
}

.settings-menu-item {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: flex-start;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
    padding: 0 12px;
    text-align: left;
    white-space: nowrap;
}

.settings-menu-item:hover {
    background: var(--surface-soft);
    color: var(--primary);
}

.logout-link {
    width: 100%;
}

.workspace {
    display: flex;
    height: 100vh;
    min-height: 0;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 0 0 auto;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    padding: 16px 22px;
}

.pipeline-title h1 {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 18px;
}

.pipeline-title span,
.muted {
    color: var(--muted);
}

.toolbar {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.search-box {
    display: flex;
    flex: 1 1 360px;
    min-width: 260px;
    max-width: 560px;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 0 10px;
}

.search-box span {
    border-radius: 5px;
    background: #d9edb7;
    color: #5d7c2e;
    padding: 5px 8px;
    font-size: 13px;
}

.search-box input {
    width: 100%;
    min-width: 110px;
    border: 0;
    outline: 0;
    padding: 11px 0;
}

.btn {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700;
    padding: 0 14px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-light {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn.ghost {
    border-color: rgba(223, 74, 74, 0.25);
    background: #fff4f4;
    color: var(--danger);
}

/* EN: Admin-only batch controls keep lead distribution compact and usable on every viewport. */
/* KK: Тек әкімшіге арналған топтық басқару лидтерді барлық экранда ыңғайлы бөлуге мүмкіндік береді. */
.bulk-assign-bar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 14px 0;
    border: 1px solid #cbdaf3;
    border-radius: 10px;
    background: #f3f7ff;
    padding: 10px 12px;
}

.bulk-assign-bar[hidden] {
    display: none;
}

.bulk-assign-summary {
    display: grid;
    min-width: max-content;
    gap: 2px;
}

.bulk-assign-summary strong {
    color: #285cae;
    font-size: 14px;
}

.bulk-assign-summary span {
    color: #607087;
    font-size: 12px;
}

.bulk-assign-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.bulk-assign-actions select {
    width: min(300px, 28vw);
    min-width: 190px;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    padding: 0 34px 0 11px;
    font-weight: 700;
}

.board {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    grid-auto-columns: clamp(270px, 18vw, 345px);
    grid-auto-flow: column;
    align-items: stretch;
    gap: 12px;
    overflow: auto;
    padding: 14px;
    scroll-snap-type: x proximity;
}

.stage-column {
    display: flex;
    max-height: 100%;
    min-height: 100%;
    flex-direction: column;
    overflow: hidden;
    scroll-snap-align: start;
}

.stage-header {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    border-top: 3px solid var(--stage-color);
    background: var(--bg);
    padding: 10px 4px 11px;
    text-align: center;
}

.stage-header h2 {
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 13px;
}

.stage-header p {
    margin: 0;
    color: #56616d;
    font-size: 13px;
}

.quick-add,
.lead-card {
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
}

.quick-add {
    flex: 0 0 auto;
    margin-bottom: 8px;
    padding: 14px;
}

.quick-add input {
    width: 100%;
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 10px;
}

.lead-list {
    display: grid;
    align-content: start;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 180px;
    overflow-y: auto;
    padding-bottom: 24px;
}

.lead-list.drag-over {
    outline: 2px dashed var(--stage-color);
    outline-offset: 4px;
}

.lead-card-shell {
    position: relative;
    min-width: 0;
    border-radius: 7px;
}

.lead-card-shell .lead-card {
    padding-right: 46px;
}

.lead-card-shell.is-selected .lead-card {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 126, 232, 0.16);
}

.lead-selection {
    position: absolute;
    top: 11px;
    right: 11px;
    z-index: 2;
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border: 1px solid #b8c4d1;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 2px 7px rgba(32, 45, 58, 0.12);
}

.lead-selection:focus-within {
    outline: 3px solid rgba(67, 126, 232, 0.22);
    outline-offset: 2px;
}

.lead-selection input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.lead-card {
    display: grid;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    cursor: grab;
    gap: 8px;
    padding: 12px;
    color: inherit;
    text-align: left;
    box-shadow: 0 1px 2px rgba(21, 31, 42, 0.06);
}

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

.lead-top {
    display: flex;
    align-items: center;
    gap: 9px;
}

.avatar {
    display: grid;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    background: #dbe1e7;
    color: #ffffff;
    font-weight: 800;
}

.lead-meta {
    min-width: 0;
    flex: 1;
}

.deal-number {
    color: #9aa4ad;
    font-size: 12px;
}

.lead-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.lead-phone {
    overflow-wrap: anywhere;
    color: #2571c8;
    font-size: 17px;
    font-weight: 700;
}

.lead-assignee {
    overflow: hidden;
    color: #667789;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
}

.lead-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #53606b;
    font-size: 13px;
}

.lead-row span,
.lead-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.lead-row strong {
    text-align: right;
}

.empty-state {
    border: 1px dashed var(--border);
    border-radius: 7px;
    color: var(--muted);
    padding: 18px;
    text-align: center;
}

.alert-host {
    position: fixed;
    right: 18px;
    top: 92px;
    z-index: 20;
    display: grid;
    gap: 8px;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
}

.alert-info,
.alert-success {
    border: 1px solid #b7d7ff;
    background: #eef6ff;
    color: #23527f;
}

.alert-error {
    border: 1px solid #ffc0c0;
    background: #fff0f0;
    color: #9d2f2f;
}

.alert-warning {
    border: 1px solid #ecd18a;
    background: #fff8df;
    color: #72591c;
}

.analytics-view {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 18px;
}

.analytics-toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.analytics-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.analytics-card,
.analytics-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(21, 31, 42, 0.04);
}

.analytics-card {
    display: grid;
    gap: 8px;
    padding: 16px;
}

.analytics-card span,
.analytics-card small,
.analytics-panel p {
    color: var(--muted);
}

.analytics-card strong {
    overflow-wrap: anywhere;
    font-size: 24px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.analytics-panel {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 16px;
}

.analytics-panel header {
    display: grid;
    gap: 4px;
}

.analytics-panel h2,
.analytics-panel p {
    margin: 0;
}

.analytics-panel h2 {
    font-size: 17px;
}

.analytics-panel p {
    font-size: 13px;
}

.analytics-bars {
    display: grid;
    gap: 12px;
}

.analytics-bar-row {
    display: grid;
    gap: 7px;
}

.analytics-row-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.analytics-row-header strong,
.analytics-row-header span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.analytics-row-header span {
    color: var(--muted);
    text-align: right;
}

.analytics-bar-track {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2f6;
}

.analytics-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.modal {
    width: min(760px, calc(100vw - 24px));
    border: 0;
    border-radius: 10px;
    padding: 0;
    box-shadow: var(--shadow);
}

.modal.small {
    width: min(560px, calc(100vw - 24px));
}

#leadDialog {
    width: min(1280px, calc(100vw - 32px));
    max-height: min(900px, calc(100vh - 32px));
    overflow-y: auto;
}

#userDialog {
    width: min(1240px, calc(100vw - 32px));
    max-height: min(820px, calc(100vh - 32px));
    overflow: hidden;
}

.modal::backdrop {
    background: rgba(18, 25, 32, 0.52);
}

.modal-card {
    display: grid;
    gap: 18px;
    margin: 0;
    padding: 22px;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 12px;
}

.whatsapp-btn {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid #21b45b;
    border-radius: 999px;
    background: #24d366;
    color: #ffffff;
    font-weight: 800;
    padding: 0 18px;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(36, 211, 102, 0.22);
}

.whatsapp-btn:hover {
    background: #1fb85a;
}

.whatsapp-btn.is-disabled {
    pointer-events: none;
    border-color: #cfd8df;
    background: #edf2f5;
    color: #8c99a6;
    box-shadow: none;
}

.modal-header h2 {
    margin: 3px 0 0;
}

.eyebrow {
    margin: 0;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.icon-btn {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    font-size: 24px;
}

.icon-btn.small {
    width: 34px;
    height: 34px;
    font-size: 16px;
    font-weight: 800;
}

.add-product-btn {
    border-color: #20c85a;
    background: #24d366;
    color: #ffffff;
    font-size: 26px;
    font-weight: 900;
}

.remove-product-btn {
    align-self: end;
    border-color: rgba(223, 74, 74, 0.28);
    background: #fff4f4;
    color: var(--danger);
}

button:disabled,
.btn:disabled,
.icon-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: #4c5662;
    font-size: 13px;
    font-weight: 700;
}

.form-grid > .wide,
label.wide {
    grid-column: 1 / -1;
}

.product-section {
    display: grid;
    gap: 10px;
}

.product-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #4c5662;
    font-size: 13px;
    font-weight: 800;
}

.product-items {
    display: grid;
    gap: 10px;
}

.product-item-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.5fr) minmax(110px, 0.8fr) minmax(80px, 0.55fr) minmax(90px, 0.65fr) minmax(110px, 0.8fr) minmax(110px, 0.8fr) 38px;
    align-items: end;
    gap: 12px;
}

.product-row-spacer {
    width: 38px;
}

.product-item-row [data-product-total],
.product-item-row [data-product-bonus] {
    background: #f4f7fa;
    color: #263241;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    padding: 11px 12px;
}

textarea {
    resize: vertical;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stage-modal {
    max-height: min(760px, calc(100vh - 24px));
    max-height: min(760px, calc(100dvh - 24px));
    overflow: auto;
    overscroll-behavior: contain;
}

.stage-manager,
.user-manager {
    display: grid;
    gap: 10px;
}

.stage-editor {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) 88px minmax(140px, 0.5fr);
    align-items: end;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 12px;
}

.stage-editor > *,
.stage-add-form > * {
    min-width: 0;
}

.stage-editor input,
.stage-editor select,
.stage-add-form input,
.stage-add-form select {
    min-width: 0;
    min-height: 44px;
}

.stage-editor input[type="color"],
.stage-add-form input[type="color"] {
    height: 44px;
    padding: 5px;
    cursor: pointer;
}

.stage-color-dot {
    display: block;
    width: 14px;
    height: 44px;
    border-radius: 10px;
    background: var(--stage-color);
}

.stage-actions {
    /* EN: Actions occupy their own row, never the narrow color-marker column.
       RU: Действия занимают отдельную строку, а не узкую колонку цветовой метки. */
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.stage-actions .icon-btn.small {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
}

.stage-actions [data-action="down"] {
    margin-right: auto;
}

.stage-actions .btn,
.stage-add-form > .btn {
    min-height: 44px;
}

.stage-add-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 88px minmax(140px, 0.5fr);
    align-items: end;
    gap: 10px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.stage-add-form > .btn {
    grid-column: 1 / -1;
    justify-self: end;
}

.user-modal {
    max-height: inherit;
    overflow: auto;
}

.user-editor {
    display: grid;
    grid-template-columns: minmax(92px, 0.6fr) minmax(150px, 1fr) minmax(220px, 1.25fr) minmax(170px, 0.95fr) minmax(112px, 0.55fr) minmax(170px, auto);
    align-items: end;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 12px;
}

.user-editor > *,
.user-add-form > * {
    min-width: 0;
}

.user-editor.is-inactive {
    opacity: 0.58;
}

.user-status {
    display: grid;
    gap: 4px;
    color: #4c5662;
}

.user-status strong {
    text-transform: uppercase;
    font-size: 12px;
}

.user-status span {
    color: var(--muted);
    font-size: 12px;
}

.user-actions {
    display: flex;
    gap: 8px;
}

.user-add-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.2fr) minmax(170px, 1fr) minmax(112px, 0.55fr) minmax(170px, auto);
    align-items: end;
    gap: 10px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.spacer {
    flex: 1;
}

.login-page {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #eef6ff 0%, #f7fafc 100%);
    padding: 24px;
}

.login-shell {
    width: min(430px, 100%);
}

.login-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 28px;
}

.login-language-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 14px;
}

.login-language-switcher button {
    min-height: 32px;
    min-width: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.login-language-switcher button.active,
.login-language-switcher button:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.login-card h1 {
    margin: 5px 0 8px;
}

.login-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

@media (max-width: 980px) {
    body {
        overflow: auto;
    }

    .app-shell {
        height: auto;
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .sidebar {
        position: static;
        min-height: auto;
        flex-direction: row;
        justify-content: space-between;
        padding: 10px;
    }

    .side-nav {
        display: flex;
        width: auto;
    }

    .language-switcher {
        display: flex;
        width: auto;
        gap: 6px;
    }

    .language-switcher button {
        min-width: 42px;
    }

    .side-link,
    .logout-link {
        min-width: 58px;
        min-height: 48px;
    }

    .settings-toggle {
        min-height: 48px;
    }

    .sidebar-bottom {
        margin-top: 0;
        width: auto;
        display: flex;
        gap: 6px;
    }

    .settings-slot {
        width: 58px;
    }

    .settings-menu {
        left: auto;
        right: 0;
        bottom: auto;
        top: calc(100% + 8px);
    }

    .settings-menu::before {
        display: none;
    }

    .logout-link {
        width: 58px;
    }

    .workspace {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .topbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .search-box {
        flex-basis: 100%;
        min-width: 100%;
        max-width: none;
    }

    .bulk-assign-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .bulk-assign-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .bulk-assign-actions select {
        flex: 1 1 230px;
        width: auto;
    }

    .board {
        min-height: calc(100vh - 168px);
        grid-auto-columns: minmax(282px, 42vw);
    }

    .analytics-toolbar,
    .analytics-cards,
    .analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stage-column {
        max-height: none;
    }

    .lead-list {
        overflow-y: visible;
    }

    #userDialog {
        width: min(760px, calc(100vw - 24px));
        max-height: calc(100vh - 24px);
    }

    .user-editor,
    .user-add-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-status,
    .user-actions,
    .user-add-form .btn {
        grid-column: 1 / -1;
    }

    .user-actions {
        justify-content: flex-end;
    }
}

@media (min-width: 641px) and (max-width: 980px) {
    .product-item-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .product-row-spacer {
        display: none;
    }

    .remove-product-btn {
        justify-self: start;
    }
}

@media (max-width: 640px) {
    .sidebar {
        gap: 10px;
        flex-wrap: wrap;
    }

    .sidebar-bottom {
        flex: 1 0 100%;
        justify-content: flex-end;
    }

    .app-shell,
    .workspace,
    .topbar,
    .toolbar,
    .search-box,
    .board {
        min-width: 0;
        max-width: 100%;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
    }

    .side-link small {
        display: none;
    }

    .topbar {
        padding: 14px;
    }

    .toolbar {
        gap: 8px;
    }

    .search-box {
        min-width: 0;
    }

    .bulk-assign-bar {
        margin: 10px 12px 0;
    }

    .bulk-assign-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bulk-assign-actions .btn,
    .bulk-assign-actions select {
        width: 100%;
        min-width: 0;
    }

    .bulk-assign-actions select,
    #bulkAssignSubmit {
        grid-column: 1 / -1;
    }

    .board {
        min-height: calc(100vh - 206px);
        grid-auto-columns: minmax(260px, 88vw);
        padding: 12px;
    }

    .analytics-view {
        padding: 12px;
    }

    .analytics-toolbar,
    .analytics-cards,
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .analytics-card strong {
        font-size: 21px;
    }

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

    .product-item-row {
        grid-template-columns: 1fr;
    }

    .product-row-spacer {
        display: none;
    }

    .remove-product-btn {
        justify-self: start;
    }

    .user-editor,
    .user-add-form {
        grid-template-columns: 1fr;
    }

    .user-status,
    .user-actions,
    .user-add-form .btn {
        grid-column: auto;
    }

    .stage-editor,
    .stage-add-form {
        grid-template-columns: minmax(64px, 0.6fr) minmax(0, 1fr);
    }

    .stage-editor > label:first-of-type,
    .stage-add-form > label:first-of-type,
    .stage-color-dot {
        grid-column: 1 / -1;
    }

    .stage-color-dot {
        width: 100%;
        height: 8px;
    }

    .user-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .user-actions .btn {
        flex: 1;
    }

    .stage-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stage-actions .icon-btn.small,
    .stage-add-form > .btn {
        width: 100%;
    }

    .stage-actions .icon-btn.small {
        border-radius: 7px;
    }

    .stage-actions [data-action="down"] {
        margin-right: 0;
    }

    .modal-card {
        padding: 18px;
    }

    .modal-actions {
        flex-wrap: wrap;
    }

    .modal-actions .btn,
    .toolbar .btn {
        flex: 1;
    }
}


/*
 * EN: Mobile-first full-screen lead editor with safe-area support and compact product cards.
 * KK: Safe-area қолдауы және ықшам тауар карточкалары бар мобильді толық экранды лид редакторы.
 */
@media (max-width: 640px) {
    html:has(#leadDialog[open]),
    body:has(#leadDialog[open]) {
        width: 100%;
        height: 100%;
        overflow: hidden;
        overscroll-behavior: none;
    }

    .modal {
        max-width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
    }

    #leadDialog {
        position: fixed;
        inset: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        overflow: hidden;
        border-radius: 0;
    }

    #leadDialog .modal-card {
        width: 100%;
        min-width: 0;
        height: 100%;
        max-height: 100%;
        align-content: start;
        gap: 14px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0 14px calc(12px + env(safe-area-inset-bottom));
        -webkit-overflow-scrolling: touch;
    }

    #leadDialog .modal-header {
        position: sticky;
        top: 0;
        z-index: 4;
        align-items: center;
        gap: 10px;
        margin: 0 -14px;
        border-bottom: 1px solid var(--border);
        background: rgba(255, 255, 255, 0.96);
        padding: calc(12px + env(safe-area-inset-top)) 14px 11px;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    #leadDialog .modal-header > div:first-child {
        min-width: 0;
        flex: 1;
    }

    #leadDialog .modal-header h2 {
        overflow: hidden;
        margin-top: 1px;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 20px;
        line-height: 1.2;
    }

    #leadDialog .eyebrow {
        font-size: 10px;
    }

    #leadDialog .modal-header-actions {
        gap: 7px;
    }

    #leadDialog .whatsapp-btn {
        min-height: 42px;
        padding: 0 13px;
        font-size: 13px;
    }

    #leadDialog .icon-btn {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
    }

    #leadDialog .form-grid,
    #leadDialog .form-grid > *,
    #leadDialog .product-section,
    #leadDialog .product-items,
    #leadDialog .product-item-row,
    #leadDialog label {
        min-width: 0;
        max-width: 100%;
    }

    #leadDialog .form-grid {
        gap: 12px;
    }

    #leadDialog label {
        gap: 6px;
        font-size: 13px;
        line-height: 1.25;
    }

    #leadDialog input,
    #leadDialog select,
    #leadDialog textarea {
        min-height: 46px;
        border-radius: 9px;
        padding: 11px 12px;
        font-size: 16px;
        line-height: 1.35;
    }

    #leadDialog textarea {
        min-height: 104px;
    }

    #leadDialog .product-section {
        gap: 12px;
        margin-top: 2px;
    }

    #leadDialog .product-section-header {
        position: sticky;
        top: calc(65px + env(safe-area-inset-top));
        z-index: 3;
        margin: 0 -4px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.96);
        padding: 7px 4px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    #leadDialog .add-product-btn {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    #leadDialog .product-item-row {
        position: relative;
        gap: 10px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface-soft);
        padding: 48px 12px 12px;
        box-shadow: 0 2px 8px rgba(32, 45, 58, 0.05);
    }

    #leadDialog .product-item-row::before {
        position: absolute;
        top: 14px;
        left: 12px;
        color: var(--primary);
        content: counter(product-row) ".";
        font-size: 13px;
        font-weight: 900;
    }

    #leadDialog .product-items {
        counter-reset: product-row;
    }

    #leadDialog .product-item-row {
        counter-increment: product-row;
    }

    #leadDialog .remove-product-btn {
        position: absolute;
        top: 7px;
        right: 8px;
        width: 38px;
        height: 38px;
        min-height: 38px;
        justify-self: auto;
        padding: 0;
    }

    #leadDialog .product-item-row [data-product-total],
    #leadDialog .product-item-row [data-product-bonus] {
        border-color: #d6e0e8;
    }

    #leadDialog .modal-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        margin: 2px -14px calc(-12px - env(safe-area-inset-bottom));
        border-top: 1px solid var(--border);
        background: rgba(255, 255, 255, 0.97);
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
        box-shadow: 0 -8px 22px rgba(32, 45, 58, 0.08);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    #leadDialog .modal-actions .spacer {
        display: none;
    }

    #leadDialog .modal-actions .btn {
        width: 100%;
        min-height: 46px;
        flex: none;
        padding-inline: 10px;
    }

    #leadDialog .modal-actions .btn-danger:not([hidden]) {
        grid-column: 1 / -1;
    }

    .alert-host {
        right: 10px;
        left: 10px;
        top: calc(10px + env(safe-area-inset-top));
    }

    .alert {
        width: 100%;
    }

    .login-page {
        min-height: 100dvh;
        padding: 16px;
    }

    .login-card {
        padding: 22px 18px;
    }
}

@media (max-width: 360px) {
    .sidebar {
        padding: 8px;
    }

    .bulk-assign-actions {
        grid-template-columns: 1fr;
    }

    .bulk-assign-actions select,
    #bulkAssignSubmit {
        grid-column: auto;
    }

    .side-link,
    .logout-link,
    .settings-slot {
        min-width: 50px;
        width: 50px;
    }

    #leadDialog .modal-header {
        padding-inline: 10px;
    }

    #leadDialog .modal-card {
        padding-inline: 10px;
    }

    #leadDialog .whatsapp-btn {
        padding-inline: 10px;
        font-size: 12px;
    }

    #leadDialog .modal-actions {
        margin-inline: -10px;
        padding-inline: 10px;
    }
}


/*
 * EN: Precise date filters and responsive daily product movement table.
 * KK: Нақты дата сүзгілері және бейімделетін күндік тауар қозғалысы кестесі.
 */
.analytics-toolbar {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.analytics-daily-panel {
    margin-top: 14px;
}

.analytics-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    -webkit-overflow-scrolling: touch;
}

.analytics-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: var(--surface);
}

.analytics-table th,
.analytics-table td {
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
}

.analytics-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-soft);
    color: #4c5662;
    font-size: 12px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

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

.analytics-table tbody tr:hover {
    background: #f8fbff;
}

.analytics-table td {
    color: var(--text);
    font-size: 13px;
}

.analytics-table td:nth-child(2),
.analytics-table td:last-child {
    font-weight: 800;
}

.analytics-stage-value {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.analytics-stage-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
}

.analytics-table-empty {
    color: var(--muted);
    padding: 24px !important;
    text-align: center !important;
}

@media (max-width: 640px) {
    .analytics-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-toolbar label {
        min-width: 0;
    }

    .analytics-toolbar label:first-child,
    .analytics-toolbar label:nth-child(5),
    .analytics-toolbar label:nth-child(6),
    .analytics-toolbar label:nth-child(7) {
        grid-column: 1 / -1;
    }

    .analytics-daily-panel {
        padding: 12px;
    }

    .analytics-table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .analytics-table {
        min-width: 0;
        border-collapse: separate;
        background: transparent;
    }

    .analytics-table thead {
        display: none;
    }

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

    .analytics-table tbody {
        display: grid;
        gap: 10px;
    }

    .analytics-table tbody tr {
        overflow: hidden;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface);
        box-shadow: 0 2px 8px rgba(32, 45, 58, 0.05);
    }

    .analytics-table td {
        display: grid;
        grid-template-columns: minmax(92px, 0.8fr) minmax(0, 1.2fr);
        gap: 10px;
        border-bottom: 1px solid var(--border);
        padding: 10px 12px;
        overflow-wrap: anywhere;
    }

    .analytics-table td::before {
        color: var(--muted);
        content: attr(data-label);
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.02em;
        text-transform: uppercase;
    }

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

    .analytics-table-empty {
        display: block !important;
    }

    .analytics-table-empty::before {
        display: none;
    }
}

@media (max-width: 360px) {
    .analytics-toolbar {
        grid-template-columns: 1fr;
    }

    .analytics-toolbar label {
        grid-column: auto !important;
    }
}


/*
 * EN: Unified analytics period calendar with presets and custom inclusive range.
 * KK: Дайын кезеңдер мен еркін аралықты біріктіретін аналитика календары.
 */
.analytics-period-field {
    position: relative;
    display: grid;
    grid-column: span 2;
    gap: 7px;
    min-width: 0;
}

.analytics-filter-label {
    color: #4c5662;
    font-size: 13px;
    font-weight: 700;
}

.analytics-period-toggle {
    display: grid;
    width: 100%;
    min-height: 42px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    padding: 10px 12px;
    text-align: left;
}

.analytics-period-toggle:hover,
.analytics-period-toggle[aria-expanded="true"] {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(67, 126, 232, 0.12);
}

.analytics-period-icon {
    color: var(--muted);
    font-size: 18px;
}

#analyticsPeriodSummary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analytics-period-chevron {
    color: var(--muted);
    font-size: 18px;
}

.analytics-period-menu {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    z-index: 35;
    width: min(430px, calc(100vw - 120px));
    max-height: min(650px, calc(100vh - 170px));
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 16px 36px rgba(23, 34, 47, 0.2);
}

.analytics-date-range {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
}

.analytics-date-range input {
    min-width: 0;
}

.analytics-period-actions {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    padding: 0 14px 14px;
}

.analytics-period-actions .btn {
    min-height: 38px;
    padding: 8px 14px;
}

.analytics-period-presets {
    display: grid;
}

.analytics-period-presets button {
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 12px 14px;
    text-align: left;
}

.analytics-period-presets button:last-child {
    border-bottom: 0;
}

.analytics-period-presets button:hover,
.analytics-period-presets button.active {
    background: #eef5ff;
    color: var(--primary-dark);
    font-weight: 800;
}

@media (max-width: 640px) {
    .analytics-period-field {
        grid-column: 1 / -1;
    }

    .analytics-toolbar > label:last-child {
        grid-column: 1 / -1;
    }

    .analytics-period-menu {
        width: 100%;
        max-height: calc(100vh - 320px);
        max-height: calc(100dvh - 320px);
    }
}

@media (max-width: 430px) {
    .analytics-date-range {
        grid-template-columns: 1fr;
    }

    .analytics-period-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
