/* ============================================================
   Кликер — мобильные стили
   ============================================================ */

:root {
    --primary: #7c3aed;
    --primary-light: #f0e9ff;
    --primary-dark: #6d28d9;
    --green: #10b981;
    --green-light: #d1fae5;
    --red: #ef4444;
    --red-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --radius: 14px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    margin: 0;
    padding: 0;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.4;
}

.app {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 14px 16px;
}

/* ============================================================
   AUTH PAGE
   ============================================================ */
.auth-page {
    background: linear-gradient(160deg, #7c3aed 0%, #a78bfa 50%, #ddd6fe 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-wrap { width: 100%; max-width: 400px; }

.auth-card {
    background: #fff;
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.2);
    text-align: center;
}

.logo { margin-bottom: 16px; }
.logo img { filter: drop-shadow(0 8px 20px rgba(124, 58, 237, 0.3)); }

.title { font-size: 24px; font-weight: 700; margin: 0 0 4px; color: var(--gray-900); }
.subtitle { color: var(--gray-500); margin-bottom: 24px; font-size: 14px; }

.key-input {
    height: 56px;
    border-radius: var(--radius);
    border: 2px solid var(--gray-200);
    font-size: 18px;
    text-align: center;
    font-family: 'SF Mono', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
    transition: all 0.2s;
}
.key-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
    outline: none;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    height: 50px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 15px;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-success {
    height: 50px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 15px;
}

.footer-hint { margin-top: 18px; font-size: 12px; color: var(--gray-500); }

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    position: sticky;
    top: 0;
    background: var(--gray-50);
    z-index: 100;
}

.app-header.compact { padding: 8px 0; }

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}
.avatar.small { width: 32px; height: 32px; font-size: 13px; }

.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: var(--gray-500); }

.logo-mini {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
}
.logo-mini img { width: 100%; height: 100%; object-fit: cover; }

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
    text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
    cursor: pointer;
}
.icon-btn:hover { background: var(--gray-100); color: var(--gray-900); }

/* Dropdown menu */
.dropdown-menu {
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    border-radius: 12px;
    padding: 6px 0;
    min-width: 220px;
}
.dropdown-header {
    padding: 10px 14px;
    background: var(--gray-50);
    margin: -6px 0 4px;
    border-bottom: 1px solid var(--gray-100);
}
.dropdown-item {
    padding: 8px 14px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gray-900);
}
.dropdown-item svg { color: var(--gray-500); flex-shrink: 0; }
.dropdown-item:hover, .dropdown-item:focus {
    background: var(--primary-light);
    color: var(--primary-dark);
}
.dropdown-item.text-danger:hover { background: var(--red-light); color: var(--red); }
.dropdown-item.text-danger:hover svg { color: var(--red); }
.dropdown-divider { margin: 4px 0; }

/* ============================================================
   SCOPE SWITCH (Только я / Вся ветка)
   ============================================================ */
.scope-switch {
    display: inline-flex;
    background: var(--gray-100);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
    margin: 0 0 12px;
}
.scope-btn {
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.scope-btn.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* ============================================================
   EARNINGS BLOCK
   ============================================================ */
.earnings { padding: 8px 0 12px; }
.earnings-label { font-size: 13px; color: var(--gray-500); margin-bottom: 4px; }

.earnings-row { display: flex; align-items: flex-end; gap: 14px; }

.earnings-value {
    font-size: 42px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
    color: var(--gray-900);
}
.earnings-value .num { color: var(--gray-900); }
.earnings-value .cur { color: var(--green); font-size: 38px; margin-left: 4px; font-weight: 800; }

.earnings-stats { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }

.stat {
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    min-width: 56px;
    text-align: center;
}
.stat-label { font-size: 10px; color: var(--gray-500); margin-bottom: 2px; }
.stat-val { font-size: 15px; font-weight: 700; color: var(--gray-900); }

/* ============================================================
   CHART CARD
   ============================================================ */
.chart-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.chart-title { font-weight: 600; font-size: 14px; }
.chart-more { color: var(--primary); font-size: 13px; text-decoration: none; }

.chart-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; align-items: end; }
.chart-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-day { font-size: 11px; font-weight: 600; color: var(--gray-700); }
.chart-date { font-size: 10px; color: var(--gray-500); }

.chart-bar-wrap {
    width: 100%;
    height: 60px;
    background: var(--gray-100);
    border-radius: 6px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
.chart-bar {
    width: 100%;
    background: linear-gradient(180deg, #7c3aed, #a78bfa);
    border-radius: 6px 6px 0 0;
    transition: height 0.4s;
}

.chart-add {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gray-100);
    border: none;
    color: var(--gray-500);
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
}
.chart-add:hover { background: var(--primary-light); color: var(--primary); }

/* ============================================================
   YESTERDAY ROW
   ============================================================ */
.yesterday-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    padding: 14px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    text-decoration: none;
    color: var(--gray-900);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
    font-size: 14px;
}
.yesterday-row:hover { background: var(--gray-50); }

/* ============================================================
   BLOCK CARDS
   ============================================================ */
.block-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.block-left, .step-title { display: flex; align-items: center; gap: 12px; }

.block-ico, .step-ico {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.block-title { font-weight: 600; font-size: 15px; }
.block-sub { font-size: 12px; color: var(--gray-500); }

/* ============================================================
   PHOTO TOGGLE
   ============================================================ */
.photo-card { display: flex; align-items: center; gap: 12px; }
.photo-card .photo-form { margin-left: auto; }

.btn-toggle {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-toggle:disabled,
.btn-toggle[disabled] {
    background: var(--gray-200);
    color: var(--gray-500);
    cursor: not-allowed;
    transform: none;
}
.btn-toggle:hover:not(:disabled) { transform: scale(1.02); }

.photo-done-badge {
    background: var(--green);
    color: #fff;
    border-radius: 30px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

/* ============================================================
   ADD MEETING
   ============================================================ */
.add-meeting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
    padding: 0 18px;
    min-height: 56px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 0;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
    box-sizing: border-box;
}
.add-meeting .plus {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* ============================================================
   TEAM ROW
   ============================================================ */
.team-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--gray-900);
    transition: background 0.2s;
}
.team-row:hover { background: var(--gray-50); }
.team-name { font-weight: 600; font-size: 14px; }
.team-sub { font-size: 11px; color: var(--gray-500); }
.team-sum { font-weight: 700; color: var(--primary); }

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--gray-200);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--gray-500);
    font-size: 11px;
    padding: 4px 0;
    transition: color 0.2s;
}
.nav-item.active { color: var(--primary); }
.nav-item:hover { color: var(--primary); }

/* ============================================================
   TABS BAR
   ============================================================ */
.tabs-bar {
    display: flex;
    gap: 6px;
    padding: 8px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 12px 14px;
    position: sticky;
    top: 64px;
    background: var(--gray-50);
    z-index: 50;
}

.tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: #fff;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--gray-200);
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   FILTERS
   ============================================================ */
.filters-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.form-label.small { font-size: 12px; color: var(--gray-500); margin-bottom: 2px; }
.form-control-sm, .form-select-sm { font-size: 16px; }

/* iOS: запрет авто-зума при фокусе — все поля ввода минимум 16px */
input, select, textarea { font-size: 16px; }

/* ============================================================
   DAY SUMMARY
   ============================================================ */
.day-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }

.day-summary-item {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.day-summary-label { font-size: 11px; color: var(--gray-500); }
.day-summary-val { font-weight: 700; font-size: 18px; color: var(--gray-900); }

/* ============================================================
   MEETING CARD
   ============================================================ */
.meeting-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}
.meeting-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.meeting-time { font-size: 12px; color: var(--gray-500); font-weight: 600; }
.meeting-user { font-weight: 600; font-size: 14px; flex: 1; }
.meeting-sum { font-weight: 700; color: var(--green); font-size: 16px; }
.meeting-body { font-size: 13px; }
.meeting-line { padding: 2px 0; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-500); }

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.stats-card { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); }
.stats-card.primary { background: linear-gradient(135deg, #7c3aed, #a78bfa); color: #fff; grid-column: span 2; }
.stats-label { font-size: 12px; opacity: 0.8; }
.stats-value { font-size: 24px; font-weight: 800; margin-top: 4px; }
.stats-card.primary .stats-label { color: rgba(255,255,255,0.85); }
.stats-card.primary .stats-value { color: #fff; font-size: 32px; }

/* ============================================================
   CHART WRAP (для Chart.js)
   ============================================================ */
.chart-wrap {
    position: relative;
    width: 100%;
    min-height: 220px;
}

/* ============================================================
   TOP ROWS
   ============================================================ */
.top-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}
.top-row:last-child { border-bottom: none; }
.top-place {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.top-place.gold { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.top-sum { font-weight: 700; color: var(--primary); }

/* ============================================================
   PROFILE
   ============================================================ */
.profile-card { text-align: center; padding: 24px 0; }
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
    overflow: hidden;
}
.profile-avatar.has-image {
    background: var(--gray-100);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Аватар-картинка внутри .avatar / .profile-avatar */
.avatar .avatar-img,
.profile-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Форма загрузки аватара на профиле */
.avatar-form { margin-top: 8px; }
.avatar-form label.btn { display: inline-flex; align-items: center; justify-content: center; }

/* ============================================================
   АВАТАР С КНОПКАМИ +/- НА САМОМ АВАТАРЕ
   ============================================================ */
.profile-avatar-wrap {
    position: relative;
    display: inline-block;
}
.profile-avatar-wrap .profile-avatar {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.profile-avatar-wrap .avatar-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity 0.2s;
}
.profile-avatar-wrap:hover .profile-avatar,
.profile-avatar-wrap:focus-within .profile-avatar {
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.45);
}
.profile-avatar-wrap:hover .avatar-overlay,
.profile-avatar-wrap.is-touched .avatar-overlay {
    opacity: 1;
}
/* На тач-устройствах overlay чуть приоткрыт всегда */
@media (hover: none) {
    .profile-avatar-wrap .avatar-overlay {
        opacity: 0.25;
    }
    .profile-avatar-wrap .avatar-overlay:active {
        opacity: 1;
    }
}

.avatar-action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    color: var(--primary-dark);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s, background 0.15s, color 0.15s;
    padding: 0;
    font-family: inherit;
}
.avatar-action-btn:hover {
    transform: scale(1.08);
}
.avatar-action-btn:active {
    transform: scale(0.95);
}
.avatar-action-btn svg {
    display: block;
}
.avatar-action-change:hover {
    background: var(--primary);
    color: #fff;
}
.avatar-action-delete {
    color: var(--red);
}
.avatar-action-delete:hover {
    background: var(--red);
    color: #fff;
}
.key-display {
    background: var(--primary-light);
    color: var(--primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 16px;
    font-weight: 600;
    margin: 8px 0;
    word-break: break-all;
}
.hint { font-size: 12px; color: var(--gray-500); }

.stat-mini {
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
}
.stat-mini-label { font-size: 11px; color: var(--gray-500); }
.stat-mini-val { font-size: 18px; font-weight: 700; margin-top: 2px; }

/* ============================================================
   STEP PROGRESS (сегмент-бар)
   ============================================================ */
.step-progress { margin: 6px 0 14px; }
.step-progress-bar {
    display: flex;
    gap: 3px;
    height: 8px;
}
.step-progress-bar .seg {
    flex: 1;
    background: var(--gray-200);
    border-radius: 4px;
    transition: background 0.25s;
}
.step-progress-bar .seg.done { background: var(--primary); }
.step-progress-bar .seg.active {
    background: linear-gradient(90deg, var(--primary), #a78bfa);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.step-progress-label {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 6px;
    text-align: right;
    font-weight: 600;
}

/* ============================================================
   MEETING FORM
   ============================================================ */
.step { display: none; }
.step.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* CHIPS */
.chips-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }

.chip {
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px 10px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 70px;
    justify-content: space-between;
    color: var(--gray-900);
    font-family: inherit;
}
.chip:hover { border-color: var(--primary); transform: translateY(-1px); }
.chip.selected { background: var(--primary-light); border-color: var(--primary); }
.chip.selected .chip-name { color: var(--primary-dark); font-weight: 700; }
.chip-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.chip-price { font-size: 12px; color: var(--gray-500); }
.chip.selected .chip-price { color: var(--primary); font-weight: 600; }

/* CHOICE BUTTONS */
.choice-btn {
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-900);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
    font-family: inherit;
}
.choice-btn .check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    display: inline-block;
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
}
.choice-btn.selected { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.choice-btn.selected .check { background: var(--primary); border-color: var(--primary); }
.choice-btn.selected .check::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.choice-btn.success.selected { background: var(--green-light); border-color: var(--green); color: #065f46; }
.choice-btn.success.selected .check { background: var(--green); border-color: var(--green); }
.choice-btn.danger.selected { background: var(--red-light); border-color: var(--red); color: #991b1b; }
.choice-btn.danger.selected .check { background: var(--red); border-color: var(--red); }
.choice-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* SUB PANEL */
.sub-panel {
    background: #fff;
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius);
    padding: 12px;
    animation: fadeIn 0.25s ease;
}
.sub-panel-title {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* CROSS SELECTED LIST */
.cross-selected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--green-light);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 13px;
}
.cross-selected-item .x {
    background: none;
    border: none;
    color: var(--red);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

/* SUMMARY BLOCK */
.summary {
    background: linear-gradient(135deg, #f0e9ff, #fff);
    border-radius: var(--radius);
    padding: 14px;
    border: 1px solid var(--primary-light);
}
.summary-title {
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-copy {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-copy:hover { background: var(--primary-dark); }
.btn-copy:active { transform: scale(0.96); }
.btn-copy svg { flex-shrink: 0; }

.summary-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.summary-total {
    display: flex;
    justify-content: space-between;
    padding: 10px 0 4px;
    margin-top: 6px;
    border-top: 1.5px solid var(--primary);
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
}
.summary-potential {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 14px;
    color: #b45309;
    font-weight: 600;
}

/* DATE BANNER (бэк-филл за прошлый день) */
.date-banner {
    background: linear-gradient(135deg, #f0e9ff, #fff);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 12px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 14px;
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--gray-900);
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    z-index: 9999;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* MINI MEETING (список встреч на главной) */
.mini-meeting {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}
.mini-meeting:last-child { border-bottom: none; }
.mini-meeting-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    min-width: 56px;
    flex-shrink: 0;
}
.mini-meeting-info { flex: 1; min-width: 0; }
.mini-meeting-product {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mini-meeting-meta {
    font-size: 11px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.mini-meeting-sum {
    font-weight: 700;
    color: var(--green);
    font-size: 14px;
    flex-shrink: 0;
}

/* ============================================================
   SWIPEABLE MEETING CARD (свайп для удаления)
   ============================================================ */
.meeting-swipeable {
    position: relative;
    overflow: hidden;
    margin-bottom: 8px;
    border-radius: var(--radius);
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}
.meeting-swipeable .delete-zone {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 72px;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 1;
    border-radius: var(--radius);
    overflow: hidden;
}
.meeting-swipeable .delete-zone.has-edit,
.meeting-swipeable .delete-zone:has(.edit-btn) {
    width: 144px;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.meeting-swipeable .delete-zone.has-edit > *,
.meeting-swipeable .delete-zone:has(.edit-btn) > * {
    min-width: 0;
    width: auto;
}
.meeting-swipeable.swiped .delete-zone { transform: translateX(0) !important; }
.meeting-swipeable .content {
    position: relative;
    background: #fff;
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease;
    z-index: 2;
    cursor: pointer;
}
.meeting-swipeable.swiped .content { transform: translateX(-72px); }
.meeting-swipeable.swiped .delete-zone.has-edit ~ .content,
.meeting-swipeable.swiped .delete-zone:has(.edit-btn) ~ .content { transform: translateX(-144px); }
.meeting-swipeable .delete-form { width: 72px; height: 100%; flex-shrink: 0; background: var(--red); }
.meeting-swipeable .delete-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    width: 100%;
    height: 100%;
    font-family: inherit;
}
.meeting-swipeable .delete-btn:hover { opacity: 0.85; }
.meeting-swipeable .delete-btn:active { opacity: 0.7; }
.meeting-swipeable .delete-icon { font-size: 22px; line-height: 1; }
.meeting-swipeable .edit-btn {
    width: 72px;
    height: 100%;
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    font-family: inherit;
    text-decoration: none;
}
.meeting-swipeable .edit-btn:hover { opacity: 0.85; color: #fff; }
.meeting-swipeable .edit-btn:active { opacity: 0.7; }
.meeting-swipeable .edit-icon { font-size: 22px; line-height: 1; }

/* MEETING TEXT BLOCK */
.meeting-text {
    margin: 0;
    font-family: inherit;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.55;
    color: var(--gray-900);
    word-wrap: break-word;
}
.meeting-text-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}
.meeting-text-card:hover { box-shadow: var(--shadow); }
.meeting-text-card:active { transform: scale(0.99); }
.meeting-text-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.meeting-employee {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--gray-200);
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-700);
}
.meeting-employee .avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

/* Агрегат внутри .block-card — убираем двойные отступы и тень */
.block-card > .meeting-text-card { margin-bottom: 0; }
.meeting-swipeable > .meeting-text-card { margin-bottom: 0; }

/* Десктоп: показываем кнопки при hover */
@media (hover: hover) {
    .meeting-swipeable:hover .content { transform: translateX(-56px); }
    .meeting-swipeable:hover .delete-zone { transform: translateX(0); width: 56px; }
    .meeting-swipeable:hover .delete-zone.has-edit,
    .meeting-swipeable:hover .delete-zone:has(.edit-btn) { width: 112px; }
    .meeting-swipeable:hover .delete-zone.has-edit ~ .content,
    .meeting-swipeable:hover .delete-zone:has(.edit-btn) ~ .content { transform: translateX(-112px); }
    .meeting-swipeable:hover .delete-btn { width: 56px; }
    .meeting-swipeable:hover .edit-btn { width: 56px; }
    .meeting-swipeable:hover .delete-icon,
    .meeting-swipeable:hover .edit-icon { font-size: 20px; }
}

/* Маленькие экраны — те же компактные размеры */
@media (max-width: 360px) {
    .meeting-swipeable .delete-zone { width: 72px; }
    .meeting-swipeable.swiped .content { transform: translateX(-72px); }
    .meeting-swipeable .delete-zone.has-edit,
    .meeting-swipeable .delete-zone:has(.edit-btn) { width: 144px; }
    .meeting-swipeable.swiped .delete-zone.has-edit ~ .content,
    .meeting-swipeable.swiped .delete-zone:has(.edit-btn) ~ .content { transform: translateX(-144px); }
}

/* STEP NAV */
.step-nav {
    display: flex;
    gap: 8px;
    position: sticky;
    bottom: 76px;
    margin: 16px 0;
    z-index: 50;
}
.step-nav .btn {
    height: 50px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.step-nav .btn-light { background: #fff; border: 1px solid var(--gray-200); }

/* TOTAL BAR (sticky bottom) */
.total-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--gray-200);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 999;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
}
.total-bar-label { font-size: 14px; color: var(--gray-500); }
.total-bar-value { font-size: 28px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 768px) {
    body { padding-bottom: 24px; }
    .app { max-width: 600px; }
    .bottom-nav { display: none; }
    .total-bar { position: sticky; bottom: 0; }
    .step-nav { position: sticky; bottom: 0; }
}

@media (max-width: 360px) {
    .earnings-value { font-size: 32px; }
    .earnings-stats { gap: 2px; }
    .stat { min-width: 48px; padding: 4px 6px; }
    .stat-val { font-size: 13px; }
    .chips-grid { grid-template-columns: repeat(2, 1fr); }
    .chip { padding: 10px 8px; min-height: 60px; }
    .chip-name { font-size: 12px; }
}

/* ============================================================
   МОДАЛКА — блоки "Итого" / "Потенциал" в footer
   ============================================================ */
#meetingDetailModal .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
#meetingDetailModal .modal-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-right: auto;
}
.modal-total {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 12px;
    background: var(--primary-light);
    border-radius: 10px;
    font-size: 14px;
}
.modal-total.potential {
    background: #fff7ed;
}
.modal-total-label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
}
.modal-total.potential .modal-total-label { color: #b45309; }
.modal-total-value {
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 15px;
}
.modal-total.potential .modal-total-value { color: #b45309; }
#meetingDetailModal .modal-actions {
    display: flex;
    gap: 6px;
}

/* === Applications count block === */
.applications-card {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
}
.applications-card .block-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}
.applications-card .block-text {
    min-width: 0;
}
.applications-card .block-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.applications-input-wrap {
    position: relative;
    flex: 0 0 auto;
    width: 90px;
}
.applications-input {
    width: 100%;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    padding: 8px 28px 8px 8px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    box-sizing: border-box;
    height: 40px;
}
.applications-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}
.applications-input::-webkit-outer-spin-button,
.applications-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.applications-input { -moz-appearance: textfield; }
.applications-check {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #16a34a;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    display: flex;
    align-items: center;
}
.applications-check.show { opacity: 1; }

/* === Action buttons (Новая встреча + Отказ) === */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.action-buttons .add-meeting {
    flex: 1 1 auto;
    min-width: 0;
}
.btn-refusal {
    flex: 0 0 auto;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 0 18px;
    min-height: 56px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(239, 68, 68, .25);
    transition: background .15s;
    font-size: 15px;
    box-sizing: border-box;
}
.btn-refusal:hover { background: #dc2626; }
.btn-refusal[aria-expanded="true"] { background: #b91c1c; }

.refusal-submenu {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    background: #fff;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 8px;
}
.refusal-submenu.open {
    display: flex;
}
.refusal-note-input {
    margin-bottom: 4px;
    font-size: 16px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
}
.refusal-note-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}
.refusal-option {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background .15s;
    font-size: 14px;
    font-family: inherit;
}
.refusal-option:hover { background: #fee2e2; }
.refusal-option:active { background: #fecaca; }

/* === Required field validation === */
.form-control.is-invalid,
.form-control.is-invalid:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .15) !important;
}
.refusal-note-input.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .15) !important;
}

/* === Disabled buttons === */
.refusal-option:disabled,
.refusal-option.disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* === Admin tree users === */
.tree-block { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace; }
.tree-row {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tree-row:last-child { border-bottom: none; }
.tree-row .tree-line {
    font-size: 14px;
    line-height: 1.5;
}
.tree-row .tree-prefix {
    color: #94a3b8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    white-space: pre;
}
.tree-row .tree-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding-left: 1em;
}
.tree-row .tree-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding-left: 1em;
}
.tree-row .tree-name-input {
    width: 140px;
    font-size: 13px;
}
.tree-row select.form-select-sm {
    width: auto;
    min-width: 120px;
    font-size: 13px;
}
.badge-role-manager {
    background: #dbeafe;
    color: #1e40af;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
}
.badge-role-emp {
    background: #f3f4f6;
    color: #374151;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
}
