/* ===== CSS Variables ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== Container ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 30px 20px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.header .subtitle {
    opacity: 0.9;
    font-size: 14px;
}

.header-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Tabs Navigation ===== */
.tabs {
    display: flex;
    gap: 5px;
    margin: 20px 0;
    background: var(--white);
    padding: 5px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.tab:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.tab.active {
    background: var(--primary);
    color: var(--white);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== Main ===== */
.main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 30px;
}

/* ===== Panels ===== */
.panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.panel h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 20px;
}

.panel h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 15px;
}

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

.panel-header h2,
.panel-header h3 {
    margin-bottom: 0;
}

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

/* ===== Dashboard Cards ===== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.card-primary .card-icon { background: #dbeafe; }
.card-secondary .card-icon { background: #e0e7ff; }
.card-warning .card-icon { background: #fef3c7; }
.card-info .card-icon { background: #d1fae5; }

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
}

.card-label {
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.card-sub {
    font-size: 12px;
    color: var(--gray-400);
}

/* ===== Dashboard Charts ===== */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-panel {
    min-height: 350px;
}

.chart-container {
    position: relative;
    height: 280px;
}

/* ===== Dashboard Reports (Mini Reports) ===== */
.dashboard-reports {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.mini-report {
    max-height: 500px;
    display: flex;
    flex-direction: column;
}

.mini-report-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border-left: 3px solid var(--warning);
    cursor: pointer;
    transition: all 0.2s;
}

.mini-report-item:hover {
    background: var(--gray-100);
    transform: translateX(3px);
}

.mini-report-item.critical {
    border-left-color: var(--danger);
    background: #fef2f2;
}

.mini-report-item.critical:hover {
    background: #fee2e2;
}

.mini-report-car {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 14px;
}

.mini-report-time {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.mini-report-zone {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}

.mini-report-duration {
    font-weight: 600;
    font-size: 14px;
    color: var(--warning);
    white-space: nowrap;
}

.mini-report-item.critical .mini-report-duration {
    color: var(--danger);
}

.mini-report-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--success);
    background: #f0fdf4;
    border-radius: var(--radius);
}

.mini-report-empty .icon {
    font-size: 32px;
    margin-bottom: 10px;
}

/* ===== Zones Grid ===== */
.zones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.zone-item {
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

.zone-name {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 14px;
    margin-bottom: 5px;
}

.zone-stats {
    font-size: 12px;
    color: var(--gray-500);
}

.zone-stats span {
    display: inline-block;
    margin-right: 10px;
}

/* ===== Forms ===== */
.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-group {
    flex: 1;
    min-width: 150px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-buttons {
    flex: 0 0 auto;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-primary:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

.btn-outline {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

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

.btn-icon {
    font-size: 12px;
}

.quick-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* ===== Progress ===== */
.progress-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 10px;
    font-size: 13px;
    color: var(--gray-600);
}

/* ===== Reports List ===== */
.reports-list {
    display: grid;
    gap: 10px;
}

.report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}

.report-item:hover {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.report-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.report-name {
    font-weight: 500;
    color: var(--gray-800);
}

.report-meta {
    font-size: 12px;
    color: var(--gray-500);
}

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

.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

/* ===== Data Table ===== */
.table-container {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tr:hover td {
    background: var(--gray-50);
}

.data-table td:nth-child(3) {
    font-weight: 500;
    color: var(--primary);
}

.table-info {
    margin-top: 15px;
    font-size: 13px;
    color: var(--gray-500);
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    padding: 14px 20px;
    background: var(--gray-800);
    color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Telegram Panel ===== */
.telegram-panel {
    border-left: 4px solid #0088cc;
}

.panel-description {
    color: var(--gray-600);
    font-size: 14px;
    margin-bottom: 20px;
}

.btn-telegram {
    background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
    color: var(--white);
}

.btn-telegram:hover {
    background: linear-gradient(135deg, #0077b5 0%, #006699 100%);
}

/* ===== Downtimes Preview ===== */
.downtimes-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.downtimes-preview h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 15px;
}

.downtimes-list {
    display: grid;
    gap: 10px;
}

.downtime-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border-left: 3px solid var(--warning);
}

.downtime-item.critical {
    border-left-color: var(--danger);
    background: #fef2f2;
}

.downtime-car {
    font-weight: 600;
    color: var(--gray-800);
}

.downtime-details {
    font-size: 13px;
    color: var(--gray-600);
    margin-top: 4px;
}

.downtime-duration {
    font-weight: 600;
    color: var(--warning);
    font-size: 14px;
}

.downtime-item.critical .downtime-duration {
    color: var(--danger);
}

.downtime-zone {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.downtimes-empty {
    text-align: center;
    padding: 30px;
    color: var(--success);
    background: #f0fdf4;
    border-radius: var(--radius);
}

.downtimes-count {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 15px;
    text-align: right;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.modal-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.modal-stat:last-child {
    border-bottom: none;
}

.modal-stat-label {
    color: var(--gray-600);
}

.modal-stat-value {
    font-weight: 600;
    color: var(--gray-800);
}

.modal-records {
    margin-top: 20px;
}

.modal-records h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--gray-700);
}

.modal-record {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.modal-record-time {
    font-weight: 500;
}

.modal-record-duration {
    color: var(--primary);
    font-weight: 500;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--gray-500);
    font-size: 13px;
}

/* ===== Projects ===== */
.projects-header {
    border-left: 4px solid var(--primary);
}

.assignments-controls {
    background: var(--gray-50);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.project-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--project-color, var(--primary));
    transition: transform 0.2s, box-shadow 0.2s;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.project-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.project-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.project-name {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.project-actions {
    display: flex;
    gap: 5px;
}

.btn-icon-small {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--gray-100);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon-small:hover {
    background: var(--gray-200);
}

.project-description {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 15px;
}

.project-vehicles {
    min-height: 100px;
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
    transition: all 0.2s;
}

.project-vehicles.drag-over {
    background: #e0f2fe;
    border-color: var(--primary);
    border-style: solid;
}

.drop-hint {
    width: 100%;
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
    padding: 20px;
}

.vehicle-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--white);
    border: 1px solid var(--badge-color, var(--gray-300));
    border-left: 3px solid var(--badge-color, var(--primary));
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: grab;
    transition: all 0.2s;
}

.vehicle-badge:hover {
    box-shadow: var(--shadow-sm);
}

.vehicle-badge.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.badge-remove {
    width: 18px;
    height: 18px;
    border: none;
    background: var(--gray-200);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-remove:hover {
    background: var(--danger);
    color: var(--white);
}

.project-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-count {
    font-size: 13px;
    color: var(--gray-500);
}

/* ===== Vehicles Pool ===== */
.vehicles-pool {
    border-left: 4px solid var(--success);
}

.vehicles-pool .panel-header {
    margin-bottom: 15px;
}

.vehicles-pool h3 {
    margin: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--success);
    color: var(--white);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.vehicles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vehicle-chip {
    padding: 8px 14px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: grab;
    transition: all 0.2s;
}

.vehicle-chip:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.vehicle-chip.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.empty-hint {
    width: 100%;
    text-align: center;
    padding: 20px;
    color: var(--gray-400);
    font-size: 13px;
}

/* ===== Color Picker ===== */
.color-picker {
    display: flex;
    align-items: center;
    gap: 15px;
}

.color-picker input[type="color"] {
    width: 50px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    cursor: pointer;
}

.color-presets {
    display: flex;
    gap: 8px;
}

.color-preset {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-preset:hover {
    transform: scale(1.15);
}

/* ===== Form Actions ===== */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

/* ===== Textarea ===== */
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ===== Modal Sizes ===== */
.modal-medium {
    max-width: 500px;
}

.modal-large {
    max-width: 800px;
}

/* ===== Vehicles Checkbox List ===== */
.vehicles-checkbox-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.vehicle-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.vehicle-checkbox:hover {
    border-color: var(--primary);
}

.vehicle-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.vehicle-checkbox input[type="checkbox"]:checked + span {
    color: var(--primary);
    font-weight: 500;
}

/* ===== Project Vehicles Preview ===== */
.project-vehicles-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-top: 15px;
    flex-wrap: wrap;
}

.preview-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}

.preview-vehicles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-vehicle {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary);
    color: var(--white);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.preview-empty {
    font-size: 13px;
    color: var(--warning);
    font-style: italic;
}

/* ===== Schedule ===== */
.schedule-header {
    border-left: 4px solid var(--warning);
}

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schedule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border-left: 4px solid var(--success);
    transition: all 0.2s;
}

.schedule-item:hover {
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.schedule-item.inactive {
    border-left-color: var(--gray-400);
    opacity: 0.7;
}

.schedule-info {
    flex: 1;
}

.schedule-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.schedule-details {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.schedule-time {
    font-weight: 600;
    color: var(--primary);
}

.schedule-divider {
    color: var(--gray-300);
    margin: 0 6px;
}

.schedule-days {
    font-size: 12px;
    color: var(--gray-500);
}

.schedule-last-run {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
}

.schedule-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Days Selector */
.days-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.day-checkbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.day-checkbox input[type="checkbox"] {
    display: none;
}

.day-checkbox span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-100);
    border: 2px solid var(--gray-300);
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
}

.day-checkbox input[type="checkbox"]:checked + span {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.day-checkbox:hover span {
    border-color: var(--primary);
}

/* Schedule History */
.schedule-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.history-info {
    flex: 1;
}

.history-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-800);
}

.history-details {
    font-size: 12px;
    color: var(--gray-500);
}

.history-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.history-status.success {
    background: #d1fae5;
    color: var(--success);
}

.history-status.error {
    background: #fee2e2;
    color: var(--danger);
}

.history-status.running {
    background: #dbeafe;
    color: var(--primary);
}

.history-time {
    font-size: 12px;
    color: var(--gray-400);
    white-space: nowrap;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }

    .header-stats {
        justify-content: center;
    }

    .tabs {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    .form-group {
        width: 100%;
    }

    .quick-buttons {
        flex-direction: column;
    }

    .quick-buttons .btn {
        width: 100%;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    .dashboard-reports {
        grid-template-columns: 1fr;
    }

    .report-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .panel-header {
        flex-direction: column;
        gap: 15px;
    }

    .panel-actions {
        width: 100%;
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }
}

/* ===== Telegram Chat Input ===== */
.telegram-chat-input {
    display: flex;
    gap: 10px;
}

.telegram-chat-input input {
    flex: 1;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--gray-500);
}

.form-hint a {
    color: var(--primary);
    text-decoration: none;
}

.form-hint a:hover {
    text-decoration: underline;
}

/* ===== Telegram Help Modal ===== */
.help-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.help-step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    margin-bottom: 5px;
    color: var(--gray-800);
}

.step-content p {
    color: var(--gray-600);
    font-size: 14px;
    margin: 5px 0;
}

.step-content code {
    display: inline-block;
    background: var(--gray-100);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    color: var(--gray-700);
    word-break: break-all;
}

/* ===== AI Assistant Tab ===== */
.tab-ai {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white !important;
}

.tab-ai:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
}

.ai-config {
    border-left: 4px solid #8b5cf6;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-400);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
    background: var(--danger);
}

.ai-setup {
    margin-top: 15px;
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.ai-setup .panel-description {
    margin-bottom: 15px;
}

.ai-setup a {
    color: var(--primary);
}

/* Chat Container */
.ai-chat-panel {
    padding: 0 !important;
    overflow: hidden;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--gray-50);
}

/* Welcome Screen */
.chat-welcome {
    text-align: center;
    padding: 40px 20px;
}

.welcome-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.chat-welcome h3 {
    margin-bottom: 10px;
    color: var(--gray-800);
}

.chat-welcome p {
    color: var(--gray-600);
    margin-bottom: 20px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.quick-action {
    padding: 10px 16px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-message.user .message-avatar {
    background: var(--primary);
}

.chat-message.assistant .message-avatar {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.chat-message.user .message-content {
    background: var(--primary);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
    background: var(--white);
    color: var(--gray-800);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.chat-message.error .message-content {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
}

.message-content strong {
    font-weight: 600;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Chat Input */
.chat-input-container {
    padding: 15px 20px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}

.chat-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.chat-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
}

.chat-option input {
    cursor: pointer;
}

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

.chat-input-row input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-row input:focus {
    border-color: var(--primary);
}

.btn-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-icon {
    font-size: 18px;
}

/* AI Tips */
.ai-tips {
    border-left: 4px solid #f59e0b;
}

.ai-tips h3 {
    margin-bottom: 15px;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.tip-item {
    padding: 12px 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

.tip-item:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Responsive AI */
@media (max-width: 768px) {
    .chat-container {
        height: 400px;
    }

    .message-content {
        max-width: 85%;
    }

    .quick-actions {
        flex-direction: column;
    }

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