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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    padding-bottom: 20px;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 16px 16px;
    border-radius: 0 0 20px 20px;
}

.header h1 { font-size: 22px; margin-bottom: 8px; }

.stats-bar {
    display: flex;
    gap: 12px;
    font-size: 13px;
    opacity: 0.9;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
}

/* Главное меню */
.main-menu {
    display: flex;
    background: white;
    margin: 12px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.menu-btn {
    flex: 1;
    padding: 14px 8px;
    border: none;
    background: white;
    font-size: 14px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.section { display: none; }
.section.active { display: block; }

.tabs {
    display: flex;
    background: white;
    margin: 12px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: white;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background: #667eea;
    color: white;
}

.tab-content { display: none; padding: 0 12px; }
.tab-content.active { display: block; }

.search-box {
    margin: 12px 0;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus { border-color: #667eea; }

.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-btn {
    padding: 6px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 20px;
    background: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Карточка материала */
.mat-card {
    background: white;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.15s;
}

.mat-card:active { transform: scale(0.98); }
.mat-card.low-stock { border-left: 4px solid #ff6b6b; }

.mat-info { flex: 1; }
.mat-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.mat-details { font-size: 12px; color: #888; }

.mat-qty { text-align: center; min-width: 70px; }
.mat-qty-value { font-size: 20px; font-weight: 700; color: #667eea; }
.mat-qty-value.low { color: #ff6b6b; }
.mat-qty-unit { font-size: 11px; color: #aaa; }

.mat-actions { display: flex; gap: 6px; margin-left: 10px; }

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.action-btn.minus { background: #fff0f0; color: #ff6b6b; }
.action-btn.plus { background: #f0fff0; color: #51cf66; }
.action-btn:active { transform: scale(0.9); }

/* Карточка клиента */
.client-card {
    background: white;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.15s;
}

.client-card:active { transform: scale(0.98); }

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

.client-name {
    font-size: 16px;
    font-weight: 600;
}

.client-phone {
    font-size: 13px;
    color: #667eea;
    font-weight: 500;
}

.client-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #888;
}

.client-stat {
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 8px;
}

.client-car {
    font-size: 13px;
    color: #555;
    margin-top: 6px;
}

/* Форма */
.form-card {
    background: white;
    border-radius: 14px;
    padding: 20px;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.form-card h3 { margin-bottom: 16px; }

.form-card input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 15px;
    margin-bottom: 10px;
    outline: none;
}

.form-card input:focus { border-color: #667eea; }

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

.form-row input { flex: 1; }

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}

.btn-primary:active { opacity: 0.85; }

.btn-secondary {
    padding: 14px 24px;
    background: #f0f0f0;
    color: #555;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    cursor: pointer;
}

/* Модалка */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: white;
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 340px;
}

.modal.client-modal {
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 { margin-bottom: 16px; text-align: center; }

.qty-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.qty-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: none;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
}

.qty-btn.minus { background: #fff0f0; color: #ff6b6b; }
.qty-btn.plus { background: #f0fff0; color: #51cf66; }

.qty-controls input {
    width: 80px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    padding: 8px;
    outline: none;
}

.modal input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 16px;
    outline: none;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button { flex: 1; }

/* Лог */
.log-item {
    background: white;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.log-item .log-name { font-weight: 600; }
.log-item .log-change.positive { color: #51cf66; }
.log-item .log-change.negative { color: #ff6b6b; }
.log-item .log-date { color: #aaa; font-size: 11px; }

/* История клиента */
.client-history-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 13px;
}

.client-history-date {
    color: #888;
    font-size: 11px;
    margin-bottom: 4px;
}

.client-history-service {
    font-weight: 600;
    margin-bottom: 2px;
}

.client-history-price {
    color: #667eea;
    font-weight: 600;
}

.warning-badge {
    display: inline-block;
    background: #fff0f0;
    color: #ff6b6b;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 8px;
    margin-left: 6px;
}
