/* ============================================
   ChooseMe Assistant — Base Styles
   Telegram Mini App Theme Integration
   ============================================ */

/* --- Design Tokens --- */
:root {
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #007aff 0%, #00b4d8 100%);
    --gradient-success: linear-gradient(135deg, #34c759 0%, #30d158 100%);
    --gradient-warning: linear-gradient(135deg, #ff9500 0%, #ffcc00 100%);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* --- CSS Reset --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;

    /* Telegram Theme Colors */
    background-color: var(--tg-theme-secondary-bg-color, #f2f2f7);
    color: var(--tg-theme-text-color, #000000);
}

/* --- Safe Area (iOS) --- */
#app {
    min-height: 100vh;
    padding-top: var(--tg-content-safe-area-inset-top, 0);
    padding-bottom: var(--tg-content-safe-area-inset-bottom, 0);
    padding-left: var(--tg-safe-area-inset-left, 0);
    padding-right: var(--tg-safe-area-inset-right, 0);
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--tg-theme-text-color, #000000);
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

a {
    color: var(--tg-theme-link-color, #007aff);
    text-decoration: none;
}

/* --- Screen Container --- */
.screen {
    display: none;
    padding: 16px;
    min-height: 100%;
    animation: fadeIn 0.2s ease-out;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Loading --- */
.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--tg-theme-hint-color, #999999);
    border-top-color: var(--tg-theme-button-color, #007aff);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Utilities --- */
.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-hint {
    color: var(--tg-theme-hint-color, #999999);
}

.text-link {
    color: var(--tg-theme-link-color, #007aff);
}

.text-destructive {
    color: var(--tg-theme-destructive-text-color, #ff3b30);
}

.text-accent {
    color: var(--tg-theme-accent-text-color, #007aff);
}

/* --- Loading Screen --- */
.loading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
}

.loading-text {
    color: var(--tg-theme-hint-color, #999);
    font-size: 1rem;
    margin: 0;
    transition: color 0.3s ease;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--tg-theme-hint-color, #ddd);
    border-top-color: var(--tg-theme-button-color, #007aff);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Access Denied Screen --- */
.access-denied-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.access-denied-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 320px;
    gap: 12px;
}

.access-denied-gif {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 8px;
}

.access-denied-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.access-denied-text {
    margin: 0;
    font-size: 1rem;
}

.access-denied-hint {
    margin: 0;
    font-size: 0.875rem;
}

.access-denied-btn {
    margin-top: 16px;
}

/* Hide navbar on access-denied */
.access-denied-screen~.navbar {
    display: none;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
    -webkit-user-select: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--tg-theme-button-color, #007aff);
    color: var(--tg-theme-button-text-color, #ffffff);
}

.btn-secondary {
    background-color: var(--tg-theme-secondary-bg-color, #f2f2f7);
    color: var(--tg-theme-text-color, #000000);
}

/* --- Form Elements --- */
.input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--tg-theme-hint-color, #c8c8c8);
    border-radius: 12px;
    font-size: 1rem;
    background-color: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    transition: border-color 0.15s ease;
}

.input:focus {
    outline: none;
    border-color: var(--tg-theme-button-color, #007aff);
}

.input::placeholder {
    color: var(--tg-theme-hint-color, #999999);
}

/* --- Cards / Sections --- */
.card {
    background-color: var(--tg-theme-bg-color, #ffffff);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:active {
    transform: scale(0.98);
}

.section-header {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--tg-theme-section-header-text-color, #8e8e93);
    padding: 8px 16px;
}

/* --- List Items --- */
.list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--tg-theme-bg-color, #ffffff);
    border-bottom: 0.5px solid var(--tg-theme-section-separator-color, #c8c8c8);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.list-item:active {
    background-color: var(--tg-theme-secondary-bg-color, #f2f2f7);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-subtitle {
    font-size: 0.875rem;
    color: var(--tg-theme-subtitle-text-color, #8e8e93);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-chevron {
    width: 7px;
    height: 12px;
    margin-left: 8px;
    color: var(--tg-theme-hint-color, #c8c8c8);
}

/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state-text {
    color: var(--tg-theme-hint-color, #999999);
}

/* --- Error State --- */
.error-banner {
    padding: 12px 16px;
    background-color: rgba(255, 59, 48, 0.1);
    color: var(--tg-theme-destructive-text-color, #ff3b30);
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

/* --- Pull to Refresh Indicator --- */
.pull-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: var(--tg-theme-hint-color, #999999);
}

/* --- Dashboard Styles --- */
.dashboard-header {
    padding: 24px 0 16px;
    text-align: center;
}

.dashboard-header h1 {
    margin-bottom: 4px;
}

.dashboard-footer {
    text-align: center;
    padding: 24px;
    font-size: 0.75rem;
}

/* Menu Icon */
.menu-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 12px;
    flex-shrink: 0;
}

.menu-badge {
    background-color: var(--tg-theme-button-color, #007aff);
    color: var(--tg-theme-button-text-color, #ffffff);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 8px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    padding: 0;
}

.stat-card {
    background-color: var(--tg-theme-bg-color, #ffffff);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
}

.stat-card:active {
    transform: scale(0.97);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-sm);
    font-size: 20px;
}

.stat-icon.blue {
    background: rgba(0, 122, 255, 0.1);
}

.stat-icon.green {
    background: rgba(52, 199, 89, 0.1);
}

.stat-icon.orange {
    background: rgba(255, 149, 0, 0.1);
}

.stat-icon.purple {
    background: rgba(175, 82, 222, 0.1);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tg-theme-text-color, #000000);
}

.stat-label {
    font-size: 0.75rem;
    margin-top: var(--spacing-xs);
    color: var(--tg-theme-hint-color, #8e8e93);
}

/* --- Screen Header --- */
.screen-header {
    padding: 8px 0 16px;
}

.screen-header h2 {
    font-size: 1.5rem;
}

/* --- Search --- */

.search-input {
    background-color: var(--tg-theme-secondary-bg-color, #f2f2f7);
    border: none;
}

/* --- Client Avatar --- */
.client-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--tg-theme-button-color, #007aff);
    color: var(--tg-theme-button-text-color, #ffffff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    margin-right: 12px;
    flex-shrink: 0;
}

/* --- Access Denied Screen --- */
.access-denied-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    padding-bottom: 0;
}

.access-denied-content {
    text-align: center;
    max-width: 300px;
}

.access-denied-gif {
    width: 200px;
    height: auto;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.access-denied-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.access-denied-title {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.access-denied-text {
    margin-bottom: 8px;
}

.access-denied-hint {
    font-size: 0.875rem;
    margin-bottom: 32px;
}

.access-denied-btn {
    width: 100%;
}

/* --- FAB Button (Floating Action Button) --- */
.fab {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--tg-theme-button-color, #007aff);
    color: var(--tg-theme-button-text-color, #ffffff);
    border: none;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    z-index: 50;
    -webkit-tap-highlight-color: transparent;
}

.fab:active {
    transform: scale(0.92);
    box-shadow: var(--shadow-md);
}

.fab:hover {
    box-shadow: var(--shadow-xl);
}

/* --- Welcome Banner (Gradient) --- */
.welcome-banner {
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    color: #ffffff;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.welcome-banner-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    position: relative;
    z-index: 1;
}

.welcome-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.welcome-text h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: #ffffff;
}

.welcome-text p {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* --- Quick Actions Grid --- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-sm);
    background-color: var(--tg-theme-bg-color, #ffffff);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.quick-action:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-md);
}

.quick-action-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: var(--spacing-sm);
}

.quick-action-icon.blue {
    background: rgba(0, 122, 255, 0.12);
}

.quick-action-icon.green {
    background: rgba(52, 199, 89, 0.12);
}

.quick-action-icon.orange {
    background: rgba(255, 149, 0, 0.12);
}

.quick-action-icon.purple {
    background: rgba(175, 82, 222, 0.12);
}

.quick-action-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--tg-theme-text-color, #000000);
    text-align: center;
}

/* --- Icon Circle (for menu items) --- */
.icon-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: var(--spacing-md);
    flex-shrink: 0;
}

.icon-circle.blue {
    background: rgba(0, 122, 255, 0.12);
}

.icon-circle.green {
    background: rgba(52, 199, 89, 0.12);
}

.icon-circle.orange {
    background: rgba(255, 149, 0, 0.12);
}

.icon-circle.purple {
    background: rgba(175, 82, 222, 0.12);
}

.icon-circle.red {
    background: rgba(255, 59, 48, 0.12);
}

/* --- Bottom Navigation Bar --- */
.navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--tg-theme-bg-color, #ffffff);
    border-top: 0.5px solid var(--tg-theme-section-separator-color, #c8c8c8);
    padding-bottom: var(--tg-safe-area-inset-bottom, 0);
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.navbar-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 67px;
    max-width: 500px;
    margin: 0 auto;
}

.navbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    padding: var(--spacing-xs) 0;
    cursor: pointer;
    color: #c7c7cc;
    transition: color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.navbar-item.active {
    color: var(--tg-theme-text-color, #000000);
}

.navbar-item:active {
    opacity: 0.7;
}

.navbar-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
    stroke: #c7c7cc;
    stroke-width: 1.5;
    transition: stroke var(--transition-fast);
}

.navbar-item.active .navbar-icon {
    stroke: var(--tg-theme-text-color, #000000);
}

.navbar-label {
    font-size: 0.625rem;
    font-weight: 500;
}

/* Adjust screen padding for navbar + MainButton */
.screen {
    padding-bottom: calc(130px + var(--tg-safe-area-inset-bottom, 0));
}

/* --- Clients Screen --- */
.clients-screen {
    padding: 0 !important;
}

/* Fixed header block */
.clients-header-fixed {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--tg-theme-secondary-bg-color, #f2f2f7);
    padding-bottom: 8px;
    box-shadow: 0px 0px 4px 0px rgb(0 0 0 / 30%);
}

.clients-screen .screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 8px 16px;
}

.header-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-title-row h2 {
    margin: 0;
}

.header-add-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.25rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clients-screen .client-list {
    padding: 0 16px 16px 16px;
    padding-bottom: calc(80px + var(--tg-safe-area-inset-bottom, 0));
}

.client-list-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Loading more indicator */
.loading-more {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    color: var(--tg-theme-hint-color, #999);
    font-size: 0.875rem;
}

.loading-more-text {
    opacity: 0.8;
}

.loading-dots {
    display: inline-block;
    width: 20px;
    text-align: left;
    animation: loadingDots 1.4s infinite steps(4, end);
}

@keyframes loadingDots {

    0%,
    20% {
        content: '';
        opacity: 0.2;
    }

    40% {
        content: '.';
        opacity: 0.4;
    }

    60% {
        content: '..';
        opacity: 0.6;
    }

    80%,
    100% {
        content: '...';
        opacity: 1;
    }
}

/* Fallback animation for browsers that don't support content animation */
.loading-dots {
    animation: dotPulse 1.4s infinite ease-in-out;
}

@keyframes dotPulse {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

.client-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--tg-theme-bg-color, #ffffff);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.client-item:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

.client-item .avatar {
    flex-shrink: 0;
}

.list-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
}

.client-indicators {
    display: flex;
    gap: 6px;
}

.indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

.indicator-active {
    background: rgba(52, 199, 89, 0.15);
    color: #34c759;
}

.indicator-debt {
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
}

/* Loading more indicator */
.loading-more {
    display: flex;
    justify-content: center;
    padding: var(--spacing-lg);
}

.spinner.small {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

/* Screen header for clients */
.clients-screen .screen-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--tg-theme-secondary-bg-color, #f2f2f7);
}

.clients-screen .screen-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

/* Search container improvements */
.search-container {
    position: relative;
    padding: 8px 16px 8px 16px;
    background: var(--tg-theme-secondary-bg-color, #f2f2f7);
}

/* Header count badge */
.header-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    margin-left: 8px;
    background: var(--tg-theme-button-color, #007aff);
    color: var(--tg-theme-button-text-color, #fff);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.search-input {
    width: 100%;
    padding: 14px var(--spacing-md);
    padding-right: 40px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--tg-theme-bg-color, #ffffff);
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: 2px solid var(--tg-theme-button-color, #007aff);
}

/* Search clear button */
.search-clear {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tg-theme-hint-color, #c4c4c4);
    color: var(--tg-theme-bg-color, #fff);
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.search-clear:hover,
.search-clear:active {
    opacity: 1;
}

/* Quick Filters */
.quick-filters {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--tg-theme-secondary-bg-color, #f2f2f7);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: var(--tg-theme-bg-color, #ffffff);
    border: none;
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--tg-theme-text-color, #000);
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-chip.active {
    background: var(--tg-theme-button-color, #007aff);
    color: var(--tg-theme-button-text-color, #fff);
}

.filter-chip:active {
    transform: scale(0.95);
}

/* --- Client Detail Screen --- */
.client-detail-screen {
    background: var(--tg-theme-secondary-bg-color, #f2f2f7);
}

.client-detail-body {
    padding: var(--spacing-sm);
}

.client-detail-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--spacing-md) 0;
}

.client-detail-header .avatar {
    margin-bottom: var(--spacing-sm);
    font-size: 32px;
}

.client-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.client-city {
    font-size: 0.8rem;
}

.client-contacts {
    margin-bottom: var(--spacing-md);
}

.contact-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #f2f2f7);
}

.contact-row:last-child {
    border-bottom: none;
}

.contact-icon {
    font-size: 1.25rem;
}

.contact-value {
    color: var(--tg-theme-link-color, #007aff);
    text-decoration: none;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
    background: var(--tg-theme-bg-color, #ffffff);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    min-width: 72px;
}

.quick-action-btn:active {
    transform: scale(0.95);
}

.quick-action-icon {
    width: 24px;
    height: 24px;
    stroke: var(--tg-theme-button-color, #007aff);
}

.quick-action-label {
    font-size: 0.75rem;
    color: var(--tg-theme-hint-color, #8e8e93);
}

/* Client Stats */
.client-stats {
    display: flex;
    justify-content: space-around;
    padding: var(--spacing-md);
    background: var(--tg-theme-bg-color, #ffffff);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--tg-theme-hint-color, #8e8e93);
}

.text-danger {
    color: #ff3b30;
}

/* Sections */
.section {
    margin-bottom: var(--spacing-lg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
}

.btn-small {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
}

.empty-hint {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--tg-theme-hint-color, #8e8e93);
    font-size: 0.875rem;
}

/* Order items */
.order-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #f2f2f7);
    cursor: pointer;
}

.order-item:last-child {
    border-bottom: none;
}

.order-item-header,
.order-item-info {
    display: flex;
    justify-content: space-between;
}

.order-number {
    font-weight: 500;
}

.order-status {
    font-size: 0.75rem;
}

.order-date,
.payment-date {
    font-size: 0.75rem;
    color: var(--tg-theme-hint-color, #8e8e93);
}

.order-amount,
.payment-amount {
    font-weight: 600;
}

/* Payment items */
.payment-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #f2f2f7);
}

.payment-item:last-child {
    border-bottom: none;
}

.payment-item-header,
.payment-item-info {
    display: flex;
    justify-content: space-between;
}

.payment-method {
    font-size: 0.75rem;
    color: var(--tg-theme-hint-color, #8e8e93);
}

/* --- Bottom Sheet --- */
.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bottom-sheet-overlay.active {
    opacity: 1;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--tg-theme-bg-color, #ffffff);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bottom-sheet.active {
    transform: translateY(0);
}

/* Fixed header container */
.bottom-sheet-header-fixed {
    flex-shrink: 0;
    background: var(--tg-theme-bg-color, #ffffff);
}

.bottom-sheet-handle {
    width: 36px;
    height: 5px;
    background: var(--tg-theme-hint-color, #c4c4c4);
    border-radius: 3px;
    margin: var(--spacing-sm) auto var(--spacing-md);
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--spacing-md) var(--spacing-md);
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #f2f2f7);
}

/* Scrollable content */
.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(var(--spacing-lg) + var(--tg-safe-area-inset-bottom, 0));
}

.bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 36px;
    height: 5px;
    background: var(--tg-theme-hint-color, #c4c4c4);
    border-radius: 3px;
    margin: var(--spacing-sm) auto var(--spacing-md);
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--spacing-md) var(--spacing-md);
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #f2f2f7);
}

.bottom-sheet-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.bottom-sheet-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--tg-theme-secondary-bg-color, #f2f2f7);
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-sheet-form {
    padding: var(--spacing-md);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    color: var(--tg-theme-hint-color, #8e8e93);
}

.form-row {
    display: flex;
    gap: var(--spacing-md);
}

.form-row .form-group {
    flex: 1;
}

.textarea {
    resize: vertical;
    min-height: 60px;
}

.btn-block {
    width: 100%;
    margin-top: var(--spacing-md);
}