* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: #0f172a;
    color: #111827;
}

.topbar {
    background: linear-gradient(135deg, #111827, #1e293b);
    color: white;
    padding: 22px 36px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.logo {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: .5px;
}

.nav {
    background: #020617;
    padding: 12px 36px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 10px;
    transition: .2s;
}

.nav a:hover {
    background: #1e293b;
    color: white;
}

.container {
    max-width: 1200px;
    margin: 28px auto;
    background: #ffffff;
    padding: 28px;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

h2 {
    margin-top: 0;
    font-size: 28px;
    color: #0f172a;
}

h3 {
    color: #1e293b;
    margin-top: 28px;
}

.muted {
    color: #64748b;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.card {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    padding: 22px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 20px rgba(15,23,42,.06);
}

.block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 12px;
}

label {
    display: block;
    font-weight: 700;
    color: #334155;
    margin-top: 12px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    margin: 6px 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 15px;
    background: #ffffff;
    outline: none;
    transition: .2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220,38,38,.12);
}

textarea {
    min-height: 90px;
    resize: vertical;
}

button,
.btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 11px 16px;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin: 3px;
    font-weight: 700;
    transition: .2s;
}

button:hover,
.btn:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 18px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
}

th {
    background: #f1f5f9;
    color: #334155;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

th,
td {
    border-bottom: 1px solid #e2e8f0;
    padding: 13px 14px;
    text-align: left;
    vertical-align: top;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f8fafc;
}

.status {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 28px 0;
}

a {
    color: #dc2626;
}

@media (max-width: 768px) {
    .topbar {
        padding: 18px 20px;
    }

    .nav {
        padding: 10px 20px;
    }

    .container {
        margin: 16px;
        padding: 18px;
        border-radius: 14px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    h2 {
        font-size: 24px;
    }
}
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
    gap: 16px;
    flex-wrap: wrap;
}

.calendar-nav strong {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px 18px;
    border-radius: 14px;
    font-size: 18px;
    color: #0f172a;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(130px, 1fr));
    gap: 14px;
}

.calendar-head {
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    padding: 8px;
}

.calendar-day {
    min-height: 155px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
    transition: .2s;
}

.calendar-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(15, 23, 42, .10);
    border-color: #cbd5e1;
}

.calendar-day.empty {
    background: transparent;
    border: 1px dashed transparent;
    box-shadow: none;
}

.calendar-date {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    margin-bottom: 10px;
}

.calendar-item {
    background: white;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #dc2626;
    padding: 10px;
    border-radius: 14px;
    margin-bottom: 8px;
    font-size: 13px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, .06);
}

.calendar-item strong {
    color: #dc2626;
    font-size: 14px;
}

.calendar-item span {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
}

@media (max-width: 900px) {
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .calendar-head {
        display: none;
    }

    .calendar-day.empty {
        display: none;
    }
}

@media (max-width: 520px) {
    .calendar-grid {
        grid-template-columns: 1fr;
    }
}
.status-badge {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    display: inline-block;
}

.status-accepted { background: #e5e7eb; color: #374151; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-ready { background: #dcfce7; color: #166534; }
.status-issued { background: #bbf7d0; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

.status-select {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #fff;
    font-weight: 600;
    cursor: pointer;
}

.table-card {
    background: white;
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
    overflow: hidden;
}

.crm-table {
    width: 100%;
    border-collapse: collapse;
}

.crm-table thead {
    background: #f1f5f9;
}

.crm-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    color: #64748b;
    padding: 14px;
}

.crm-table td {
    padding: 14px;
    border-top: 1px solid #f1f5f9;
}

.crm-table tr {
    transition: .2s;
}

.crm-table tr:hover {
    background: #f8fafc;
}

.order-number {
    font-weight: 700;
    color: #0f172a;
}

.actions {
    text-align: right;
}

.btn.small {
    padding: 6px 10px;
    font-size: 12px;
}

.status-form {
    margin-top: 6px;
}

.status-form select {
    width: 100%;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 12px;
}

.payment {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.payment.unpaid {
    background: #fee2e2;
    color: #991b1b;
}

.payment.paid {
    background: #dcfce7;
    color: #166534;
}
.status-badge {
    text-decoration: none;
    cursor: pointer;
    transition: .2s;
}

.status-badge:hover {
    transform: translateY(-1px);
    filter: brightness(.95);
}
.payment-badge {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.payment-unpaid {
    background: #fee2e2;
    color: #991b1b;
}

.payment-partial {
    background: #fef9c3;
    color: #854d0e;
}

.payment-paid {
    background: #dcfce7;
    color: #166534;
}

.table-card {
    overflow-x: auto;
}

.crm-table {
    width: 100%;
    min-width: 980px;
    table-layout: fixed;
}

.crm-table th,
.crm-table td {
    vertical-align: middle;
}

.crm-table th:nth-child(1),
.crm-table td:nth-child(1) {
    width: 55px;
}

.crm-table th:nth-child(2),
.crm-table td:nth-child(2) {
    width: 150px;
}

.crm-table th:nth-child(5),
.crm-table td:nth-child(5) {
    width: 135px;
}

.crm-table th:nth-child(6),
.crm-table td:nth-child(6) {
    width: 130px;
    white-space: nowrap;
}

.crm-table th:nth-child(7),
.crm-table td:nth-child(7) {
    width: 135px;
    white-space: nowrap;
}

.crm-table th:nth-child(8),
.crm-table td:nth-child(8) {
    width: 100px;
    text-align: right;
}

.status-badge,
.payment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 105px;
    white-space: nowrap;
}
.modal {
    display: none !important;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .65);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex !important;
}

.modal-box {
    width: 100%;
    max-width: 520px;
    background: white;
    border-radius: 20px;
    padding: 26px;
    box-shadow: 0 30px 80px rgba(0,0,0,.35);
}


.btn-secondary {
    background: #64748b;
}

.btn-secondary:hover {
    background: #475569;
}

.card {
    padding: 18px;
    border-radius: 14px;
    background: #f8fafc;
    text-align: center;
}

.card h3 {
    margin: 0;
    font-size: 22px;
}

.card p {
    margin-top: 6px;
    color: #64748b;
    font-size: 13px;
}

.report-filter {
    display: grid;
    grid-template-columns: 80px 1fr 80px 1fr auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .report-filter {
        grid-template-columns: 1fr;
    }
}

.mechanics-table {
    min-width: 760px;
    table-layout: auto;
}

.mechanics-table th,
.mechanics-table td {
    white-space: nowrap;
}

.mechanics-table th:nth-child(1),
.mechanics-table td:nth-child(1) {
    width: 35%;
    min-width: 220px;
}

.mechanics-table th:nth-child(2),
.mechanics-table td:nth-child(2) {
    width: 15%;
    min-width: 120px;
    text-align: center;
}

.mechanics-table th:nth-child(3),
.mechanics-table td:nth-child(3),
.mechanics-table th:nth-child(5),
.mechanics-table td:nth-child(5) {
    width: 20%;
    min-width: 160px;
}

.mechanics-table th:nth-child(4),
.mechanics-table td:nth-child(4) {
    width: 10%;
    min-width: 80px;
    text-align: center;
}

.client-table-wrap {
    width: 100%;
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin-top: 14px;
}

.client-appointments-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    table-layout: fixed;
}

.client-appointments-table th,
.client-appointments-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    text-align: left;
    white-space: nowrap;
}

.client-appointments-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.client-appointments-table tr:last-child td {
    border-bottom: none;
}

.client-appointments-table th:nth-child(1),
.client-appointments-table td:nth-child(1) {
    width: 120px;
}

.client-appointments-table th:nth-child(2),
.client-appointments-table td:nth-child(2) {
    width: 90px;
}

.client-appointments-table th:nth-child(3),
.client-appointments-table td:nth-child(3) {
    width: 200px;
}

.client-appointments-table th:nth-child(4),
.client-appointments-table td:nth-child(4) {
    width: 150px;
}

.client-appointments-table th:nth-child(5),
.client-appointments-table td:nth-child(5) {
    width: 150px;
    max-width: 150px;
    white-space: normal;
    word-break: break-word;
}

.client-appointments-table th:nth-child(6),
.client-appointments-table td:nth-child(6) {
    width: 180px;
    min-width: 180px;
    white-space: nowrap;
}

.client-actions {
    white-space: nowrap;
}

.client-actions .btn {
    margin: 0;
}

@media (max-width: 768px) {
    .client-appointments-table {
        min-width: 850px;
    }
}

.client-actions {
    width: 180px;
    min-width: 180px;
    white-space: nowrap;
    text-align: right;
}
.mechanic-comment {
    margin-top: 10px;
    padding: 12px 14px;
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
    border-radius: 10px;
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
}
.client-order-list {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.client-order-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.client-order-main {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    font-size: 16px;
}

.client-order-main strong {
    color: #0f172a;
}

.client-order-main span {
    font-weight: 800;
    color: #16a34a;
    white-space: nowrap;
}

.client-order-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
    color: #64748b;
    font-size: 14px;
}

@media (max-width: 520px) {
    .client-order-main {
        flex-direction: column;
    }

    .client-order-main span {
        white-space: normal;
    }
}

.service-photo-gallery {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.service-photo-gallery img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.mechanic-tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.mechanic-task-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

.mechanic-task-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.mechanic-order {
    font-weight: 900;
    color: #0f172a;
    font-size: 16px;
}

.mechanic-car {
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
    color: #334155;
    font-weight: 700;
}

.mechanic-work {
    font-size: 17px;
    color: #111827;
    margin-bottom: 12px;
}

.mechanic-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

@media (max-width: 520px) {
    .mechanic-tasks-grid {
        grid-template-columns: 1fr;
    }

    .mechanic-task-card {
        padding: 15px;
    }
}

.mechanic-orders-table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
}

.mechanic-orders-table th,
.mechanic-orders-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    text-align: left;
}

.mechanic-orders-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.mechanic-orders-table tr:hover td {
    background: #f8fafc;
}

.mechanic-orders-table .actions-cell {
    white-space: nowrap;
    text-align: right;
}

.order-overdue td {
    background: #fee2e2 !important;
}

.order-overdue:hover td {
    background: #fecaca !important;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 800;
    margin-bottom: 18px;
}

button[disabled],
.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
    background: #94a3b8;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.dashboard-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
}

.dashboard-card span {
    font-size: 30px;
    width: 54px;
    height: 54px;
    background: #f1f5f9;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-card h3 {
    margin: 0;
    font-size: 24px;
    color: #0f172a;
}

.dashboard-card p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 14px;
}

.dashboard-card.danger {
    background: #fff7f7;
    border-color: #fecaca;
}

.dashboard-columns {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 20px;
    margin-bottom: 28px;
}

.dashboard-panel {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
}

.mini-chart {
    height: 190px;
    display: flex;
    align-items: end;
    gap: 12px;
    margin-top: 18px;
}

.mini-chart-item {
    flex: 1;
    text-align: center;
}

.mini-chart-bar {
    width: 100%;
    background: linear-gradient(180deg, #dc2626, #991b1b);
    border-radius: 12px 12px 4px 4px;
    min-height: 8px;
}

.mini-chart-item small {
    display: block;
    margin-top: 8px;
    color: #64748b;
}

.mini-chart-item strong {
    display: block;
    font-size: 12px;
    color: #0f172a;
}

.mechanic-load-row {
    margin-top: 14px;
}

.mechanic-load-row > div:first-child {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.load-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.load-bar div {
    height: 100%;
    background: #dc2626;
    border-radius: 999px;
}

@media (max-width: 900px) {
    .dashboard-columns {
        grid-template-columns: 1fr;
    }
}

.dashboard-overdue-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.dashboard-overdue-table th,
.dashboard-overdue-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    text-align: left;
}

.dashboard-overdue-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.dashboard-overdue-table tr:last-child td {
    border-bottom: none;
}

.dashboard-overdue-table td:nth-child(1) {
    width: 170px;
    white-space: nowrap;
}

.dashboard-overdue-table td:nth-child(2) {
    width: 180px;
}

.dashboard-overdue-table td:nth-child(3) {
    min-width: 220px;
}

.dashboard-overdue-table td:nth-child(4) {
    width: 110px;
    white-space: nowrap;
}

.dashboard-overdue-table td:nth-child(5) {
    width: 120px;
    white-space: nowrap;
    text-align: right;
}

@media (max-width: 768px) {
    .dashboard-overdue-table {
        min-width: 720px;
    }
}

.telegram-connect-card {
    margin-top: 24px;
    padding: 22px;
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .06);
}

.telegram-connect-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.telegram-connected {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #166534;
    font-weight: 700;
}

.inventory-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.inventory-table th,
.inventory-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    text-align: left;
}

.inventory-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.inventory-low td {
    background: #fff7ed;
}

.inventory-low td:first-child {
    border-left: 4px solid #f97316;
}

.inventory-action-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: #dc2626;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
    box-shadow: 0 4px 12px rgba(220, 38, 38, .25);
}

.inventory-action-btn:hover {
    transform: translateY(-1px);
    background: #b91c1c;
}

.service-catalog-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.order-actions-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.summary-card {
    margin-top: 24px;
    padding: 24px;
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .06);
}

.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.summary-header h3 {
    margin: 0;
    font-size: 24px;
}

.summary-total {
    font-size: 30px;
    font-weight: 800;
    color: #0f172a;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.summary-item {
    padding: 18px;
    border-radius: 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.summary-label {
    display: block;
    margin-bottom: 8px;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
}

.summary-value {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
}

.summary-value.success {
    color: #16a34a;
}

.summary-value.danger {
    color: #dc2626;
}