/* Final interface polish for dense CRM screens. */
.content .btn,
.modal .btn,
.report-toolbar .btn,
.city-tools .btn,
.desk-head .btn,
.salary-header .btn,
.delivery-editor-actions .btn {
    margin-top: 0;
}

.content .btn-sm,
.modal .btn-sm,
.report-toolbar .btn-sm,
.city-tools .btn-sm,
.desk-head .btn-sm,
.salary-header .btn-sm {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border-radius: 10px;
    line-height: 1;
    white-space: nowrap;
}

.content h1 {
    font-size: 28px;
    line-height: 1.18;
    letter-spacing: 1px;
}

.tabs {
    gap: 4px;
    padding: 4px;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    background: #fff;
    overflow: visible;
}

.tab {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 500;
}

.search-bar {
    margin: 14px 0;
    align-items: center;
}

.search-bar input,
.field input,
.field select,
.field textarea,
.phone-box {
    border-radius: 10px;
}

.table-wrap {
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    box-shadow: none;
}

.table-wrap th {
    height: 38px;
    padding: 9px 10px;
    font-size: 11px;
    letter-spacing: .4px;
}

.table-wrap td {
    padding: 11px 10px;
    font-size: 12px;
    vertical-align: middle;
}

.table-wrap tbody tr:hover {
    background: #fafafa;
}

.actions {
    gap: 6px;
    align-items: center;
}

.action-btn {
    min-height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.status-select {
    min-height: 30px;
    border-radius: 8px;
    font-size: 11px;
}

.report-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    padding: 10px;
    margin: 14px 0 16px;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    background: #fff;
}

.report-toolbar label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    line-height: 1.1;
    color: #6e6e73;
}

.report-toolbar input,
.report-toolbar select {
    height: 34px;
    min-width: 122px;
    max-width: 160px;
    padding: 0 10px;
    border: 1px solid #d2d2d7;
    border-radius: 9px;
    background: #fff;
    font: inherit;
    font-size: 12px;
}

.city-tools {
    display: grid;
    grid-template-columns: minmax(220px, 320px) auto;
    align-items: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    padding: 10px;
    margin: 14px 0 10px;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    background: #fff;
}

.city-tools input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    font: inherit;
    font-size: 13px;
}

.city-tools .btn {
    height: 36px;
}

.city-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 16px;
}

.city-filter .city-chip {
    min-height: 34px;
    border-radius: 10px;
    border-color: #d2d2d7;
    background: #fff;
}

.city-filter .city-chip > button {
    min-height: 32px;
}

.city-filter .city-chip > button:first-child {
    padding: 0 12px;
    font-weight: 500;
}

.city-filter .city-chip .mini {
    width: 32px;
    font-size: 13px;
}

.salary-header,
.report-summary,
.desk-section,
.faq-section,
.delivery-panel,
.client-order {
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    box-shadow: none;
}

.client-debt-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 14px;
    padding: 14px 16px;
    border: 1px solid #ffd6d6;
    border-radius: 12px;
    background: #fff5f5;
}

.client-debt-summary span,
.client-order-body span,
.client-warranty span,
.client-history span {
    display: block;
    color: #6e6e73;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.client-debt-summary strong {
    display: block;
    margin-top: 3px;
    color: #ff3b30;
    font-size: 24px;
    line-height: 1;
}

.client-debt-summary p {
    color: #8e2d2d;
    font-size: 13px;
    line-height: 1.35;
    text-align: right;
}

.client-order {
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease;
}

.client-order:hover {
    border-color: #c7c7cc;
    transform: translateY(-1px);
}

.client-order-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.client-order-top strong {
    display: block;
    margin-top: 4px;
    font-size: 17px;
    line-height: 1.25;
}

.client-order-id {
    color: #8e8e93;
    font-size: 12px;
}

.client-status-pill {
    flex: 0 0 auto;
    padding: 7px 11px;
    border-radius: 999px;
    background: #f5f5f7;
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 600;
}

.status-inprogress .client-status-pill {
    background: #e8f0ff;
    color: #1a5fb4;
}

.status-ready .client-status-pill {
    background: #f5edff;
    color: #6f2dbd;
}

.status-paid .client-status-pill {
    background: #e8f8ee;
    color: #1a7a2e;
}

.status-nopay .client-status-pill {
    background: #fff0f0;
    color: #cc1a1a;
}

.client-order-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    padding: 12px;
    border-radius: 10px;
    background: #f8f8fa;
}

.client-order-body p {
    margin-top: 5px;
    color: #3a3a3c;
    font-size: 13px;
    line-height: 1.4;
}

.client-price {
    display: block;
    margin-top: 5px;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
}

.client-price.debt {
    color: #ff3b30;
}

.client-history {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    list-style: none;
}

.client-history li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-left: 14px;
    position: relative;
}

.client-history li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34c759;
}

.client-history b {
    color: #3a3a3c;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.client-warranty {
    margin-top: 14px;
    padding: 12px;
    border-radius: 10px;
    background: #f0fff4;
    border: 1px solid #ccefd7;
}

.client-warranty b {
    display: block;
    margin-top: 4px;
    color: #1a7a2e;
    font-size: 13px;
}

.chat-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #e5e5ea;
    background: #f5f5f7;
    color: #6e6e73;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.chat-section-title span {
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #fff;
    color: #1d1d1f;
    font-size: 11px;
}

.chat-section-empty {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: #8e8e93;
    font-size: 13px;
}

.salary-header {
    padding: 14px;
    margin: 14px 0 18px;
}

.salary-header select,
.salary-header input {
    min-height: 36px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    padding: 0 12px;
    background: #fff;
    font: inherit;
}

.report-summary {
    padding: 16px;
    margin-bottom: 16px;
}

.report-row {
    font-size: 13px;
}

.report-row:last-child {
    font-size: 16px;
}

.desk-head {
    min-height: 54px;
}

.desk-item {
    gap: 12px;
}

.modal-box {
    border-radius: 16px;
}

#createRepairModal .modal-wide,
#repairDetailModal .modal-wide {
    width: 780px;
}

.repair-form-grid,
.repair-detail-grid,
.repair-edit-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.repair-form-grid .field,
.repair-detail-grid .field,
.repair-edit-panel .field {
    margin-bottom: 0;
}

.repair-form-grid .full,
.repair-detail-grid .full,
.repair-edit-panel .full {
    grid-column: 1 / -1;
}

.repair-form-grid textarea,
.repair-detail-grid textarea,
.repair-edit-panel textarea {
    min-height: 92px;
    resize: vertical;
}

.repair-edit-panel {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    background: #f8f8fa;
}

.repair-edit-panel .btn {
    width: fit-content;
}

.guest-app-actions {
    display: flex;
    gap: 10px;
    margin-top: 32px;
    flex-wrap: wrap;
    justify-content: center;
}

.guest-app-link {
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    background: #fff;
    color: #1d1d1f;
    font: 500 11px/1.3 inherit;
    text-decoration: none;
    cursor: pointer;
}

.guest-app-link.android {
    border-color: #1d1d1f;
    background: #1d1d1f;
    color: #fff;
}

.guest-app-link:hover {
    transform: translateY(-1px);
}

.chat-group-toolbar {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e5ea;
    background: #fff;
}

.chat-group-toolbar button {
    width: 100%;
    min-height: 30px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    background: #fff;
    color: #1d1d1f;
    font: 500 12px/1 inherit;
    cursor: pointer;
}

.group-member-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #e5e5ea;
    border-radius: 10px;
}

.group-member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f2;
    cursor: pointer;
}

.group-member-item:last-child {
    border-bottom: 0;
}

.group-member-item span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.group-member-item small {
    color: #8e8e93;
    font-size: 11px;
}

.repair-print-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(300px, .8fr) minmax(620px, 1.4fr);
    gap: 16px;
    margin-top: 16px;
}

.settings-section {
    padding: 18px;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    background: #fff;
}

.settings-section h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.settings-note {
    margin: -4px 0 14px;
    color: #6e6e73;
    font-size: 12px;
}

.permission-table {
    min-width: 760px;
    margin-bottom: 14px;
    overflow: hidden;
    border: 1px solid #e5e5ea;
    border-radius: 10px;
}

.settings-section:has(.permission-table) {
    overflow-x: auto;
}

.permission-row {
    display: grid;
    grid-template-columns: 130px repeat(8, minmax(70px, 1fr));
    align-items: stretch;
    border-bottom: 1px solid #e5e5ea;
}

.permission-row:last-child {
    border-bottom: 0;
}

.permission-row > div,
.permission-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 7px;
    border-right: 1px solid #e5e5ea;
    text-align: center;
    font-size: 11px;
}

.permission-row > :last-child {
    border-right: 0;
}

.permission-head {
    background: #f7f7f8;
    color: #6e6e73;
    font-weight: 600;
}

.permission-role {
    justify-content: flex-start !important;
    font-weight: 600;
}

.permission-cell input {
    width: 16px;
    height: 16px;
}

.ios-install-modal h2 {
    margin-bottom: 18px;
}

.ios-install-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 20px 20px;
    color: #3a3a3c;
    font-size: 14px;
    line-height: 1.45;
}

.confirm-btn,
.submit,
.btn-outline,
.chat-delete,
.chat-input button,
.side-nav-btn {
    font-family: inherit;
}

@media (max-width: 720px) {
    .main {
        min-height: 100vh;
        height: auto;
        padding: 56px 16px 32px;
    }

    .guest-app-actions {
        width: min(100%, 240px);
    }

    .guest-app-link {
        width: auto;
        flex: 1 1 100%;
    }

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

    .content {
        padding: 20px 14px;
    }

    .tabs {
        margin: 18px 0;
    }

    .tab {
        min-width: 105px;
    }

    .search-bar,
    .report-toolbar,
    .salary-header {
        width: 100%;
    }

    .report-toolbar {
        align-items: stretch;
    }

    .report-toolbar label,
    .report-toolbar input,
    .report-toolbar select,
    .report-toolbar .btn {
        width: 100%;
        max-width: none;
    }

    .city-tools {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .city-tools .btn {
        width: 100%;
    }

    .repair-form-grid,
    .repair-detail-grid,
    .repair-edit-panel {
        grid-template-columns: 1fr;
    }

    .repair-edit-panel .btn {
        width: 100%;
    }

    .client-debt-summary,
    .client-order-top,
    .client-order-body,
    .client-history li {
        display: block;
    }

    .client-debt-summary p {
        margin-top: 8px;
        text-align: left;
    }

    .client-status-pill,
    .client-price {
        display: inline-flex;
        margin-top: 8px;
    }

    .client-history b {
        display: block;
        margin-top: 3px;
    }

    .action-btn {
        min-height: 30px;
    }
}
