* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    color: #333;
    min-height: 100vh;
}

.hidden { display: none !important; }

.screen {
    min-height: 100vh;
}

/* Login */
#screen-login {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    text-align: center;
}

.login-card h1 {
    font-size: 28px;
    color: #667eea;
    margin-bottom: 4px;
}

.subtitle {
    color: #999;
    margin-bottom: 32px;
    font-size: 14px;
}

#login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

#login-form input:focus {
    outline: none;
    border-color: #667eea;
}

#login-form button {
    width: 100%;
    padding: 14px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#login-form button:hover {
    background: #5a6fd6;
}

.error {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 12px;
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    position: sticky;
    top: 0;
    z-index: 10;
}

header h1 {
    font-size: 20px;
    color: #333;
}

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

.btn-icon {
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.btn-icon:hover { background: #f0f0f0; }

.btn-secondary {
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f0f0f0;
    color: #333;
}

.stage-label {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
}

/* Tabs */
.tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    padding: 0 24px;
    overflow-x: auto;
}

.tab {
    padding: 12px 24px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab:hover { color: #333; }

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Search */
.search-bar {
    padding: 16px 24px 0;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
}

/* Stats */
.stats {
    padding: 12px 24px;
    font-size: 13px;
    color: #888;
}

/* Clients List */
.clients-list, .groups-list {
    padding: 8px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.client-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #eee;
}

.client-row:hover {
    border-color: #667eea;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.1);
}

.client-row.stage1 {
    border-left: 4px solid #e0e0e0;
}

.client-row.stage2 {
    border-left: 4px solid #f39c12;
}

.client-row.stage3 {
    border-left: 4px solid #3498db;
}

.client-row.stage4 {
    border-left: 4px solid #9b59b6;
}

.client-row.activated {
    border-left: 4px solid #27ae60;
}

.client-info {
    flex: 1;
}

.client-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.client-phone {
    font-size: 13px;
    color: #888;
}

.client-child {
    font-size: 13px;
    color: #aaa;
}

.client-progress {
    text-align: right;
}

.progress-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.progress-badge.stage1 { background: #f0f0f0; color: #999; }
.progress-badge.stage2 { background: #fff3cd; color: #856404; }
.progress-badge.stage3 { background: #d4edda; color: #27ae60; }
.progress-badge.stage4 { background: #e8daef; color: #7d3c98; }
.progress-badge.activated { background: #d5f5e3; color: #1e8449; }

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 16px;
    padding: 16px 24px 24px;
    overflow-x: auto;
    min-height: 400px;
    align-items: flex-start;
}

.kanban-column {
    flex: 1;
    min-width: 220px;
    max-width: 320px;
    background: #f0f2f5;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
    margin-bottom: 4px;
}

.kanban-column-title {
    font-weight: 700;
    font-size: 14px;
    color: #333;
}

.kanban-column-count {
    background: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #888;
}

.kanban-column.col-stage1 { border-top: 3px solid #e0e0e0; }
.kanban-column.col-stage2 { border-top: 3px solid #f39c12; }
.kanban-column.col-stage3 { border-top: 3px solid #3498db; }
.kanban-column.col-stage4 { border-top: 3px solid #9b59b6; }
.kanban-column.col-activated { border-top: 3px solid #27ae60; }

.kanban-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #eee;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.kanban-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.kanban-card-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}

.kanban-card-child {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

.kanban-card-phone {
    font-size: 12px;
    color: #aaa;
}

.kanban-card-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.kanban-card-badge.activated {
    background: #d5f5e3;
    color: #1e8449;
}

/* Stage Filters */
.stage-filters {
    display: flex;
    gap: 8px;
    padding: 12px 24px 0;
    flex-wrap: wrap;
    align-items: center;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.filter-btn .filter-count {
    display: inline-block;
    margin-left: 4px;
    background: rgba(255,255,255,0.2);
    padding: 0 5px;
    border-radius: 8px;
    font-size: 11px;
}

.filter-btn.active .filter-count {
    background: rgba(255,255,255,0.3);
}

/* View toggle */
.view-toggle {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.view-btn {
    padding: 6px 10px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.view-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* Days on stage indicator */
.days-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.days-indicator.days-green {
    background: #d5f5e3;
    color: #1e8449;
}

.days-indicator.days-yellow {
    background: #fef9e7;
    color: #b7950b;
}

.days-indicator.days-red {
    background: #fadbd8;
    color: #c0392b;
}

.days-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.days-indicator.days-neutral {
    background: #eaecee;
    color: #5d6d7e;
}
.days-green .days-dot { background: #27ae60; }
.days-yellow .days-dot { background: #f39c12; }
.days-red .days-dot { background: #e74c3c; }
.days-neutral .days-dot { background: #5d6d7e; }

/* Date filters */
.date-filters {
    display: flex;
    gap: 6px;
    padding: 8px 24px 0;
    flex-wrap: wrap;
    align-items: center;
}

.date-filter-btn {
    padding: 5px 12px;
    border: 1px solid #ddd;
    border-radius: 16px;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.date-filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.date-filter-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.date-filter-label {
    font-size: 12px;
    color: #999;
    margin-right: 4px;
}

/* Days on stage filter buttons */
.days-filter-btn {
    padding: 5px 12px;
    border: 1px solid #ddd;
    border-radius: 16px;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.days-filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.days-filter-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.days-filter-btn.active[data-days="green"] {
    background: #27ae60;
    border-color: #27ae60;
}

.days-filter-btn.active[data-days="yellow"] {
    background: #f39c12;
    border-color: #f39c12;
}

.days-filter-btn.active[data-days="red"] {
    background: #e74c3c;
    border-color: #e74c3c;
}

/* Client card created date */
.client-created {
    font-size: 11px;
    color: #bbb;
    margin-top: 2px;
}

.kanban-card-created {
    font-size: 11px;
    color: #bbb;
    margin-top: 4px;
}

/* Kanban empty column */
.kanban-empty {
    color: #bbb;
    font-size: 13px;
    text-align: center;
    padding: 20px 8px;
}

@media (max-width: 600px) {
    .kanban-board {
        padding: 8px 16px 16px;
        gap: 12px;
    }
    .kanban-column {
        min-width: 180px;
    }
    .stage-filters {
        padding: 12px 16px 0;
    }
    .date-filters {
        padding: 8px 16px 0;
    }
}

/* Stage Stepper */
.stage-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 24px 0;
    margin-bottom: 8px;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
}

.stepper-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s;
}

.stepper-step.active .stepper-circle {
    background: #667eea;
    color: #fff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.stepper-step.completed .stepper-circle {
    background: #27ae60;
    color: #fff;
}

.stepper-label {
    font-size: 11px;
    color: #999;
    font-weight: 500;
    text-align: center;
    max-width: 80px;
}

.stepper-step.active .stepper-label {
    color: #667eea;
    font-weight: 600;
}

.stepper-step.completed .stepper-label {
    color: #27ae60;
}

.stepper-line {
    width: 60px;
    height: 3px;
    background: #e0e0e0;
    margin: 0 8px;
    margin-bottom: 20px;
    border-radius: 2px;
    transition: background 0.3s;
}

.stepper-line.completed {
    background: #27ae60;
}

/* Stage Content */
.stage-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stage-block {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #eee;
}

.stage-block h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #333;
}

.stage-hint {
    font-size: 12px;
    color: #888;
    margin-top: 12px;
    font-style: italic;
}

/* Contact Buttons */
.contact-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-contact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-tg {
    background: #0088cc;
    color: #fff;
}

.btn-tg:hover { background: #006da3; }

.btn-call {
    background: #27ae60;
    color: #fff;
}

.btn-call:hover { background: #219a52; }

/* Template Buttons */
.tg-templates-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-template {
    padding: 8px 14px;
    border: 1px solid #667eea;
    background: #f8f9ff;
    color: #667eea;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-template:hover {
    background: #667eea;
    color: #fff;
}

/* Rendered Message */
.rendered-message {
    margin-top: 12px;
    background: #f8f9fb;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 14px;
}

.rendered-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.rendered-message pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

/* Tech Items */
.tech-item {
    background: #f9f9fb;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.tech-item.verified {
    background: #f0fff4;
    border-color: #c3e6cb;
}

.tech-item-header {
    margin-bottom: 8px;
}

.tech-item-name {
    font-weight: 600;
    font-size: 14px;
}

.tech-instruction {
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.4;
    padding-left: 32px;
}

.tech-tg-template {
    padding-left: 32px;
}

.tech-rendered {
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
}

.tech-rendered pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 8px;
}

/* Tech Admin Items */
.tech-admin-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 8px;
}

.tech-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tech-admin-name {
    font-weight: 600;
    font-size: 14px;
}

.tech-admin-actions {
    display: flex;
    gap: 4px;
}

.tech-admin-detail {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
}

/* Followup Groups */
.followup-group {
    margin-bottom: 12px;
}

.followup-group-label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stars Rating */
.rating-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.stars {
    display: flex;
    gap: 4px;
}

.star {
    font-size: 28px;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s;
}

.star:hover,
.star.active {
    color: #f5a623;
}

#feedback-comment {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
}

#feedback-comment:focus {
    outline: none;
    border-color: #667eea;
}

/* Groups */
.group-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #eee;
    overflow: hidden;
}

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
    flex-wrap: wrap;
    gap: 8px;
}

.group-header:hover { background: #fafafa; }

.group-title {
    font-weight: 600;
    font-size: 16px;
}

.group-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #888;
}

.group-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.group-students {
    border-top: 1px solid #f0f0f0;
}

.student-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
}

.student-row:last-child { border-bottom: none; }
.student-row:hover { background: #f9f9ff; }

.student-info {
    flex: 1;
}

.student-name {
    font-weight: 500;
    font-size: 14px;
}

.student-phone {
    font-size: 12px;
    color: #999;
}

.student-badges {
    display: flex;
    gap: 6px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge-green { background: #d4edda; color: #27ae60; }
.badge-gray { background: #f0f0f0; color: #999; }
.badge-blue { background: #d6e9ff; color: #2563eb; }
.badge-purple { background: #ede9fe; color: #7c3aed; }

/* Card */
.card {
    max-width: 640px;
    margin: 24px auto;
    padding: 0 24px 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h2 {
    font-size: 22px;
}

.btn-crm {
    display: inline-block;
    padding: 8px 16px;
    background: #667eea;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
}

.btn-crm:hover { background: #5a6fd6; }

.btn-crm.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.card-info {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #eee;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}

.info-row:last-child { border-bottom: none; }

.label {
    color: #888;
    font-size: 14px;
}

.value {
    font-weight: 500;
    font-size: 14px;
    text-align: right;
}

/* Multi-select dropdown */
.multi-select {
    position: relative;
}

.multi-select-display {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: #fff;
    min-height: 42px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.multi-select-display:hover {
    border-color: #667eea;
}

.multi-select-display.open {
    border-color: #667eea;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.multi-select-display .placeholder {
    color: #999;
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #667eea;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 10;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
    user-select: none;
}

.multi-select-option:hover {
    background: #f5f5ff;
}

.multi-select-option input[type="checkbox"] {
    accent-color: #667eea;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.multi-select-option:has(input:checked) {
    background: #f0f2ff;
    font-weight: 500;
    color: #667eea;
}

/* Checklist */
.checklist h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #333;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    font-size: 15px;
}

.check-item:last-of-type { border-bottom: none; }

.check-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
    cursor: pointer;
}

.saved-msg {
    color: #27ae60;
    font-size: 13px;
    text-align: center;
}

/* Comments */
.comments-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #eee;
    margin-top: 16px;
}

.comments-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #333;
}

.comment-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.comment-form textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn-comment {
    padding: 10px 16px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    align-self: flex-end;
    transition: background 0.2s;
}

.btn-comment:hover { background: #5a6fd6; }

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-item {
    background: #f9f9fb;
    border-radius: 8px;
    padding: 12px 14px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
    color: #667eea;
}

.comment-date {
    font-size: 12px;
    color: #aaa;
}

.comment-text {
    font-size: 14px;
    color: #444;
    line-height: 1.4;
}

/* Enrollment section */
.enrollment-current {
    background: #f0f7ff;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.enrollment-current .group-label {
    font-weight: 600;
    color: #2563eb;
}

.btn-remove-enrollment {
    background: none;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
}

.btn-remove-enrollment:hover { background: #fef2f2; }

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-wide {
    max-width: 640px;
}

.modal-content h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

/* Forms */
.form-row {
    margin-bottom: 14px;
}

.form-row label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.form-row input:not([type="checkbox"]):not([type="radio"]),
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-row textarea {
    resize: vertical;
}

.form-hint {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px;
    line-height: 1.4;
}

.form-row-pair {
    display: flex;
    gap: 12px;
}

.form-row-pair .form-row { flex: 1; }

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Managed group cards */
.mg-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #eee;
    padding: 16px 20px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.mg-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.1);
}

.mg-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.mg-card-title {
    font-weight: 700;
    font-size: 16px;
}

.mg-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.mg-card-details span {
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 6px;
}

.mg-card-capacity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.capacity-bar {
    flex: 1;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.capacity-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.capacity-fill.low { background: #27ae60; }
.capacity-fill.mid { background: #f39c12; }
.capacity-fill.full { background: #e74c3c; }

.capacity-text {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

.mg-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #fff;
    transition: all 0.2s;
}

.btn-sm:hover { background: #f5f5f5; }

.btn-sm.danger {
    color: #e74c3c;
    border-color: #e74c3c;
}

.btn-sm.danger:hover { background: #fef2f2; }

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Group filters */
.mg-filters {
    margin: 12px 0 8px;
    padding: 14px 18px;
    background: #f8f9ff;
    border-radius: 12px;
    border: 1px solid #eef0ff;
}
.mg-filter-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.mg-filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mg-filter-item label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.mg-filter-item select,
.mg-filter-item input {
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
}
.mg-filter-selects {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    padding-top: 4px;
    border-top: 1px solid #e8eaff;
}
.mg-filter-selects select,
.mg-filter-selects input {
    min-width: 140px;
}
.mg-filter-reset-btn {
    padding: 7px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: #888;
    transition: all 0.15s;
    white-space: nowrap;
}
.mg-filter-reset-btn:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    background: #fef2f2;
}
.mg-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.mg-chip {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    color: #555;
}
.mg-chip:hover {
    border-color: #667eea;
    color: #667eea;
}
.mg-chip.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* Group detail view */
#mg-detail-view {
    max-width: 900px;
    margin: 0 auto;
}
.mg-detail-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
    margin-bottom: 16px;
}
.mg-detail-back-btn:hover {
    background: #f5f5f5;
    border-color: #667eea;
    color: #667eea;
}
.mg-detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.mg-detail-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}
.mg-detail-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 14px;
    padding: 20px 24px;
}
.mg-detail-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #555;
}
.mg-detail-info span {
    background: #f5f5f5;
    padding: 4px 12px;
    border-radius: 8px;
}

/* Students table */
.mg-students-list {
    overflow-x: auto;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #eee;
}
.mg-students-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.mg-students-table thead th {
    background: #f8f9ff;
    color: #888;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid #eef0ff;
}
.mg-students-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.mg-students-table tbody tr:last-child td {
    border-bottom: none;
}
.mg-students-table tbody tr.mg-student-clickable {
    cursor: pointer;
}
.mg-students-table tbody tr:hover {
    background: #f8f9ff;
}
.mg-students-table .mg-student-name {
    font-weight: 600;
}
.mg-student-stage {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.mg-student-stage.stage-1 { background: #e0f2fe; color: #0369a1; }
.mg-student-stage.stage-2 { background: #fef3c7; color: #92400e; }
.mg-student-stage.stage-3 { background: #ede9fe; color: #6d28d9; }
.mg-student-stage.stage-4 { background: #d1fae5; color: #065f46; }
.mg-student-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.mg-student-status.status-active { background: #d1fae5; color: #065f46; }
.mg-student-status.status-paused { background: #fef3c7; color: #92400e; }
.mg-student-status.status-left { background: #fee2e2; color: #991b1b; }
.btn-tg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    background: #0088cc;
    color: #fff;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
}
.btn-tg:hover { background: #006daa; }

.mg-student-empty {
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 14px;
}

/* Enrolled count badge on card */
.mg-enrolled-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    margin-left: 6px;
}
.mg-enrolled-badge.has-students { background: #667eea; }
.mg-enrolled-badge.no-students { background: #ccc; }

/* Available groups in Stage 1 */
.available-group-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    background: #f8f9ff;
    border: 1px solid #eef0ff;
    border-radius: 8px;
    margin-bottom: 6px;
}
.available-group-name {
    font-weight: 700;
    font-size: 13px;
    color: #333;
}
.available-group-info {
    font-size: 13px;
    color: #555;
}
.available-group-meta {
    font-size: 11px;
    color: #999;
}

.var-btn-inline {
    padding: 3px 8px;
    border: 1px solid #d0d5ff;
    border-radius: 6px;
    background: #f0f2ff;
    color: #667eea;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.var-btn-inline:hover {
    background: #667eea;
    color: #fff;
}

.add-student-link {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
}
.add-student-link:hover {
    color: #667eea;
    text-decoration: underline;
}

/* Suggest group cards */
.sg-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 16px 0 8px;
}

.sg-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sg-card.recommended {
    border-color: #27ae60;
    background: #f0fff4;
}

.sg-card-info {
    flex: 1;
}

.sg-card-title {
    font-weight: 600;
    font-size: 14px;
}

.sg-card-meta {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.sg-card-reasons {
    font-size: 11px;
    color: #27ae60;
    margin-top: 2px;
}

.btn-enroll {
    padding: 6px 14px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-enroll:hover { background: #5a6fd6; }

/* Settings */
.settings-container {
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.settings-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #eee;
    margin-bottom: 20px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.settings-header h3 {
    font-size: 16px;
    color: #333;
}

/* Template Cards */
.templates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-card {
    background: #f9f9fb;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 14px;
}

.template-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 8px;
}

.template-card-name {
    font-weight: 600;
    font-size: 14px;
}

.template-card-body {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Toggle Switch */
.auto-push-row {
    padding: 12px 0;
    border-top: 1px solid #f5f5f5;
    margin-top: 4px;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 15px;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #667eea;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* Sticky Contact Bar */
.contact-bar {
    position: sticky;
    top: 53px;
    z-index: 9;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    padding: 10px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.contact-bar-inner {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.contact-bar-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.contact-bar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-contact-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-contact-sm.btn-tg {
    background: #0088cc;
    color: #fff;
}
.btn-contact-sm.btn-tg:hover { background: #006da3; }

.btn-contact-sm.btn-call {
    background: #27ae60;
    color: #fff;
}
.btn-contact-sm.btn-call:hover { background: #219a52; }

.btn-contact-sm.btn-crm-sm {
    background: #667eea;
    color: #fff;
}
.btn-contact-sm.btn-crm-sm:hover { background: #5a6fd6; }

/* Stage Accordion */
.stage-accordion {
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid #eee;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.3s;
}

.stage-accordion.active {
    border-color: #667eea;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.12);
}

.stage-accordion.completed {
    border-color: #c3e6cb;
}

.stage-accordion.locked {
    opacity: 0.6;
}

.stage-accordion-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.stage-accordion-header:hover {
    background: #fafafe;
}

.acc-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.3s;
}

.stage-accordion.active .acc-circle {
    background: #667eea;
    color: #fff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.stage-accordion.completed .acc-circle {
    background: #27ae60;
    color: #fff;
}

.acc-title {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    flex: 1;
}

.acc-status {
    font-size: 12px;
    font-weight: 500;
    color: #888;
}

.stage-accordion.completed .acc-status {
    color: #27ae60;
}

.stage-accordion.active .acc-status {
    color: #667eea;
}

.acc-chevron {
    font-size: 12px;
    color: #999;
    transition: transform 0.3s ease;
}

.stage-accordion-body {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    opacity: 1;
    padding: 0 20px 20px;
}

.stage-accordion-body.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0 20px;
}

.stage-accordion-body.collapsed ~ .stage-accordion-header .acc-chevron,
.stage-accordion.collapsed .acc-chevron {
    transform: rotate(-90deg);
}

.stage-accordion:not(.expanded) .acc-chevron {
    transform: rotate(-90deg);
}

.stage-accordion.expanded .acc-chevron {
    transform: rotate(0deg);
}

/* Tasks Sidebar */
.card-with-sidebar {
    display: flex;
    gap: 24px;
    max-width: 960px;
    margin: 24px auto;
    padding: 0 24px 24px;
}

.card-main {
    flex: 1;
    min-width: 0;
}

.card-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.tasks-panel {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #eee;
    padding: 16px;
    position: sticky;
    top: 110px;
}

.tasks-panel h3 {
    font-size: 15px;
    margin-bottom: 12px;
    color: #333;
}

.task-add-form {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.task-add-form input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
}

.task-add-form input:focus {
    outline: none;
    border-color: #667eea;
}

.task-add-form button {
    padding: 8px 12px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.task-add-form button:hover {
    background: #5a6fd6;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
}

.task-item:last-child {
    border-bottom: none;
}

.task-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.task-item.done .task-text {
    text-decoration: line-through;
    color: #aaa;
}

.task-text {
    flex: 1;
    line-height: 1.4;
    word-break: break-word;
}

.task-delete {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    flex-shrink: 0;
}

.task-delete:hover {
    color: #e74c3c;
}

.tasks-empty {
    color: #999;
    font-size: 12px;
    text-align: center;
    padding: 12px 0;
}

/* Stage completed badge */
.stage-accordion.done {
    border-color: #d4edda;
    background: #f8fff9;
}

.stage-accordion.done .acc-circle {
    background: #27ae60;
    color: #fff;
}

.stage-accordion.done .acc-status {
    color: #27ae60;
}

/* Group Status Badges */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.status-open {
    background: #d5f5e3;
    color: #1e8449;
}

.status-badge.status-upcoming {
    background: #fef9e7;
    color: #b7950b;
}

.status-badge.status-in_progress {
    background: #d6eaf8;
    color: #2471a3;
}

.status-badge.status-completed {
    background: #f2f3f4;
    color: #808b96;
}

/* Variable Buttons */
.var-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.var-btn {
    padding: 3px 8px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #f9fafb;
    font-size: 11px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.var-btn:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* Add student modal results */
.add-student-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
}

.add-student-item:last-child { border-bottom: none; }

.add-student-info {
    flex: 1;
    min-width: 0;
}

.add-student-name {
    font-weight: 600;
    font-size: 14px;
}

.add-student-details {
    font-size: 12px;
    color: #888;
}

.add-student-group {
    font-size: 11px;
    color: #e67e22;
    margin-top: 2px;
}

/* Tech template link info */
.tech-link-info {
    font-size: 12px;
    color: #0088cc;
    margin-top: 4px;
    word-break: break-all;
}

.tech-link-info a {
    color: #0088cc;
}

/* Unique link input row */
.unique-link-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.unique-link-row label {
    font-size: 13px;
    color: #333;
    min-width: 150px;
}

.unique-link-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
}

.unique-link-row input:focus {
    outline: none;
    border-color: #667eea;
}

/* Responsive */
@media (max-width: 600px) {
    .login-card { margin: 16px; padding: 32px 24px; }
    header { padding: 12px 16px; }
    .tabs { padding: 0 16px; }
    .tab { padding: 10px 16px; font-size: 14px; }
    .search-bar { padding: 12px 16px 0; }
    .clients-list, .groups-list { padding: 8px 16px 16px; }
    .card { padding: 0 16px 16px; }
    .card-header { flex-direction: column; align-items: flex-start; }
    .info-row { flex-direction: column; gap: 4px; }
    .value { text-align: left; }
    .comment-form { flex-direction: column; }
    .group-meta { flex-wrap: wrap; }
    .stepper-line { width: 30px; }
    .stepper-label { font-size: 10px; max-width: 60px; }
    .settings-container { padding: 16px; }
    .contact-buttons { flex-direction: column; }
    .contact-bar { padding: 8px 16px; }
    .contact-bar-name { font-size: 13px; }
    .btn-contact-sm { padding: 5px 10px; font-size: 12px; }
    .stage-accordion-header { padding: 12px 16px; }
    .stage-accordion-body { padding: 0 16px 16px; }
    .stage-accordion-body.collapsed { padding: 0 16px; }
    .card-with-sidebar { flex-direction: column; padding: 0 16px 16px; }
    .card-sidebar { width: 100%; }
    .tasks-panel { position: static; }
}
