:root {
    --bg: #f0f0f0;
    --sidebar-bg: #ffffff;
    --editor-bg: #ffffff;
    --accent: #007bff;
    --danger: #dc3545;
    --text: #333333;
    --muted: #666666;
    --border: #dddddd;
    --crossed: #999999;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top bar */
.top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.app-logo {
    margin: 0;
    font-size: 18px;
    flex-shrink: 0;
}

.top-bar #notes-search {
    flex: 1;
    min-width: 200px;
}

.top-bar .user-bar {
    margin-left: auto;
}

/* Notes grid */
.notes-main {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    align-content: start;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.notes-day-label {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 4px 0 -6px;
}

.unrecognized-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.unrecognized-toggle input[type="checkbox"] {
    cursor: pointer;
}

.notes-day-label:first-child {
    margin-top: 0;
}

.notes-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Note sticker */
.note-sticker {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background-color: #fff8c4;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: transform .15s, box-shadow .15s;
}

.note-sticker:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.note-sticker.active {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Лупа: увеличенный фрагмент фото под курсором, следует за мышью */
.magnifier-lens {
    display: none;
    position: fixed;
    z-index: 3000;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .4);
    background-color: #000;
    background-repeat: no-repeat;
    pointer-events: none;
}

.sticker-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 10px;
    background: linear-gradient(180deg, rgba(0, 0, 0, .65), rgba(0, 0, 0, 0));
}

.note-sticker:not(.has-photo) .sticker-header {
    background: rgba(0, 0, 0, .05);
}

.sticker-plate {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.note-sticker:not(.has-photo) .sticker-plate {
    color: var(--text);
    text-shadow: none;
}

.sticker-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.sticker-actions button {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, .85);
    color: var(--text);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s;
}

.sticker-actions button:hover {
    background: #fff;
}

.sticker-delete:hover {
    color: var(--danger);
}

/* Fullscreen note modal */
.note-modal {
    display: none;
    position: fixed;
    z-index: 900;
    inset: 0;
    background: rgba(0, 0, 0, .5);
}

.note-modal.active {
    display: block;
}

.note-modal-content {
    background: var(--editor-bg);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px 24px;
}

.note-modal-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.note-modal-close {
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}

.note-modal-close:hover {
    color: var(--text);
}

.note-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.note-modal-footer {
    margin-top: 12px;
    flex-shrink: 0;
    max-height: 40vh;
    overflow-y: auto;
}

.plate-input-wrap {
    position: relative;
    flex: 0 0 auto;
    width: 220px;
}

#note-title {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
}

#note-title:focus {
    border-color: var(--accent);
}

.plate-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.plate-suggestions.active {
    display: block;
}

.plate-suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
}

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

.plate-suggestion-item:hover,
.plate-suggestion-item.active {
    background: #f0f7ff;
}

.plate-suggestion-plate {
    font-weight: 600;
}

.plate-suggestion-vin {
    font-size: 12px;
    color: var(--muted);
    font-family: "Courier New", Courier, monospace;
}

#notes-search {
    flex: 1;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 20px;
    outline: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 12px center;
    padding-left: 34px;
}

#notes-search:focus {
    border-color: var(--accent);
}

#notes-search::-webkit-search-cancel-button {
    cursor: pointer;
}

.save-status {
    font-size: 12px;
    color: var(--muted);
    min-width: 90px;
    text-align: right;
}

.user-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

#btn-voice,
#btn-photo {
    padding: 8px 12px;
    font-size: 16px;
    line-height: 1;
}

#btn-voice.recording {
    animation: pulse-red 1.2s infinite;
    background: var(--danger);
}

@keyframes pulse-red {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.editor-meta {
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--muted);
    min-height: 18px;
}

.editor-meta .author-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.editor {
    flex: 1;
    background: var(--editor-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-family: "Courier New", Courier, monospace;
    font-size: 16px;
    line-height: 1.6;
    overflow-y: auto;
    outline: none;
    word-break: break-word;
}

.editor:focus {
    border-color: var(--accent);
}

.editor span[data-user-color] {
    padding: 1px 2px;
    border-radius: 2px;
}

.editor .crossed-out {
    text-decoration: line-through;
    color: var(--crossed);
    background: transparent !important;
}

.editor .active-line {
    background: #f0f7ff;
    border-radius: 4px;
    outline: 1px solid var(--accent);
    outline-offset: -1px;
}

.editor-footer {
    margin-top: 8px;
    color: var(--muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}

.btn:hover {
    opacity: .85;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.btn-sm:hover {
    background: var(--bg);
    opacity: 1;
}

.work-footer {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.work-footer-section {
    flex: 1 1 auto;
    min-width: 140px;
}

.work-total {
    font-weight: bold;
    color: var(--text);
    margin-bottom: 4px;
}

.work-person {
    color: var(--muted);
    padding-left: 12px;
}

.balance-negative {
    font-weight: bold;
}

.balance-zero {
    font-weight: bold;
}

.balance-positive {
    font-weight: bold;
}

.vin-valid {
    background-color: #d4edda !important;
    color: #155724 !important;
    padding: 1px 2px;
    border-radius: 2px;
}

.vin-invalid {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    padding: 1px 2px;
    border-radius: 2px;
}

/* Photo area */
.photo-area {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: none;
}

.photo-area.visible {
    display: block;
}

.photo-area-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.photo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.photo-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    background: #fff;
    flex-shrink: 0;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
}

.photo-delete:hover {
    background: rgba(220, 53, 69, 1);
}

/* Photo modal */
.photo-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.photo-modal.active {
    display: block;
}

.photo-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    border-radius: 4px;
}

.photo-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.photo-modal-close:hover {
    color: #bbb;
}

/* Quick-add forms (работы/оплата) */
.quick-form-modal {
    display: none;
    position: fixed;
    z-index: 1100;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.quick-form-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-form-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px 24px;
    width: 90%;
    max-width: 340px;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.quick-form-content h3 {
    margin: 0 0 14px;
    font-size: 16px;
    color: var(--text);
}

.quick-form-close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
}

.quick-form-close:hover {
    color: var(--text);
}

.quick-form-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 14px;
}

.quick-form-radios label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.quick-form-amount {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.quick-form-label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
}

.quick-form-hint {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 14px;
}

.quick-form-amount.field-valid {
    border-color: #28a745;
    background-color: #d4edda;
}

.quick-form-amount.field-invalid {
    border-color: #dc3545;
    background-color: #f8d7da;
}

.quick-form-content button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .plate-input-wrap {
        width: 100%;
    }
    .notes-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 480px) {
    .plate-input-wrap {
        width: 100%;
    }
    .top-bar {
        padding: 12px 16px;
    }
    .notes-main {
        padding: 16px;
    }
    .notes-grid {
        gap: 12px;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .note-modal-content {
        padding: 12px 14px;
    }
}

/* Catalog modal */
.catalog-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 40px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
}

.catalog-modal.active {
    display: block;
}

.catalog-modal-content {
    background: #fff;
    margin: 0 auto;
    width: 90%;
    max-width: 98vw;
    max-height: 90vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    position: relative;
    min-width: 320px;
    min-height: 200px;
}

.catalog-modal-content::after {
    content: '';
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 14px;
    height: 14px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, var(--border) 50%);
    pointer-events: none;
    z-index: 10;
}

.catalog-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: #f8f9fa;
}

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

.catalog-modal-close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: var(--muted);
}

.catalog-search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
    margin-right: 12px;
}

.catalog-search-wrap input {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    width: 220px;
    outline: none;
}

.catalog-search-wrap input:focus {
    border-color: var(--accent);
}

.catalog-search-wrap button {
    padding: 5px 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.catalog-search-wrap button:hover {
    background: #0056b3;
}

.catalog-modal-close:hover {
    color: var(--text);
}

.catalog-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.catalog-vehicle-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text);
}

.catalog-tree-search-wrap {
    position: relative;
    width: 320px;
    flex-shrink: 0;
    margin-top: 4px;
}

.catalog-tree-search-wrap input {
    width: 100%;
    padding: 6px 28px 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.catalog-tree-search-wrap input:focus {
    border-color: var(--accent);
}

.catalog-tree-search-clear {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--muted);
    font-size: 16px;
    line-height: 1;
}

.catalog-tree-search-clear:hover {
    color: var(--text);
}

.catalog-tree-search-clear.visible {
    display: block;
}

.catalog-search-results {
    display: none;
}

.catalog-search-result {
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.catalog-search-result:hover {
    background: #f0f0f0;
}

.catalog-search-result.active {
    background: #e7f1ff;
}

.catalog-search-result-path {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 2px;
}

.catalog-search-result-name {
    color: var(--accent);
    font-size: 13px;
}

.catalog-search-empty {
    padding: 12px 8px;
    color: var(--muted);
    font-size: 13px;
}

/* Tree layout */
.catalog-layout {
    display: flex;
    gap: 16px;
    flex: 1;
    min-height: 0;
    margin-top: 8px;
}

.catalog-tree {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding-right: 8px;
    font-size: 13px;
}

.catalog-detail-panel {
    flex: 1;
    overflow-y: auto;
    min-width: 0;
}

.catalog-loading {
    text-align: center;
    padding: 20px;
    color: var(--muted);
}

/* Tree nodes */
.catalog-tree-node {
    user-select: none;
}

.catalog-tree-row {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s;
    gap: 4px;
}

.catalog-tree-row:hover {
    background: #f0f0f0;
}

.catalog-tree-row.active {
    background: #e7f1ff;
}

.catalog-tree-toggle {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--muted);
    flex-shrink: 0;
    cursor: pointer;
}

.catalog-tree-toggle:hover {
    color: var(--text);
}

.catalog-tree-children {
    display: none;
    padding-left: 16px;
}

.catalog-tree-children.expanded {
    display: block;
}

.catalog-tree-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-tree-name.searchable {
    color: var(--accent);
}

/* Detail panel */
.catalog-category-title {
    font-weight: bold;
    margin-top: 12px;
    margin-bottom: 4px;
    font-size: 14px;
    color: var(--text);
}

.catalog-unit {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
}

.catalog-unit:hover {
    background: #f0f0f0;
}

.catalog-unit-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.catalog-unit-detail-wrap {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.catalog-unit-imgwrap {
    flex: 1 1 300px;
    position: relative;
}

.catalog-unit-imgwrap img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.catalog-map-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.catalog-zone {
    position: absolute;
    border: 2px solid rgba(255, 0, 0, 0.5);
    background: rgba(255, 0, 0, 0.15);
    cursor: pointer;
    transition: background .15s;
}

.catalog-zone:hover,
.catalog-zone-hover {
    background: rgba(255, 0, 0, 0.4);
}

.catalog-unit-tblwrap {
    flex: 1 1 300px;
    min-width: 0;
}

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

.catalog-parts-table th,
.catalog-parts-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.catalog-parts-table th {
    font-weight: 600;
    background: #f8f9fa;
}

.catalog-row-highlight {
    background: #fff3cd !important;
}

/* ROSSKO pricing panel */
.rossko-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.rossko-header h4 {
    margin: 0;
    font-size: 15px;
    color: var(--text);
}

.btn-back-rossko {
    background: #f0f0f0;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text);
}

.btn-back-rossko:hover {
    background: #e0e0e0;
}

.rossko-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.rossko-table th,
.rossko-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.rossko-table th {
    font-weight: 600;
    background: #f8f9fa;
    font-size: 11px;
    white-space: nowrap;
}

.rossko-table td {
    color: var(--text);
}

.rossko-table tr:hover {
    background: #f8f9fa;
}

.rossko-cross {
    color: #dc3545;
    font-size: 10px;
}

.rossko-delivery-green {
    background-color: #d4edda;
}

.rossko-delivery-blue {
    background-color: #d1ecf1;
}

.rossko-delivery-yellow {
    background-color: #fff3cd;
}

.rossko-qty {
    width: 48px;
    padding: 2px 4px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
}

.btn-rossko-cart {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-rossko-cart:hover {
    background: #0056b3;
}

.btn-rossko-cart.added {
    background: #28a745;
    cursor: default;
}

/* Вкладки поставщиков в каталоге */
.supplier-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.supplier-tab {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}

.supplier-tab:hover {
    background: #e9ecef;
}

.supplier-tab.active {
    background: #fff;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
    font-weight: 600;
}

.supplier-panels {
    position: relative;
}

.supplier-tab-panel {
    display: none;
}

.supplier-tab-panel.active {
    display: block;
}

.supplier-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    padding: 2px 8px;
    border-radius: 12px;
    vertical-align: middle;
}

.supplier-qty {
    width: 48px;
    padding: 2px 4px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 480px) {
    .note-modal-actions {
        flex-wrap: wrap;
        width: 100%;
    }
    #btn-voice,
    #btn-photo {
        flex: 1 1 100%;
        width: 100%;
        padding: 12px;
        font-size: 18px;
    }
    /* Упрощённый мобильный интерфейс записи: оставляем только поле номера
       и кнопки голосового ввода/фото — каталог, правка номера, статус
       сохранения и быстрые формы (работы/оплата/VIN) скрыты, чтобы не
       перегружать маленький экран. */
    #btn-verify-plate,
    #save-status,
    #btn-catalog,
    #btn-add-work,
    #btn-add-payment,
    #btn-add-vin {
        display: none !important;
    }
    .editor-footer,
    #work-footer {
        display: none !important;
    }
}

/* Финансовая сводка (только admin) */
.finance-modal {
    display: none;
    position: fixed;
    z-index: 950;
    inset: 0;
    background: rgba(0, 0, 0, .5);
}

.finance-modal.active {
    display: block;
}

.finance-modal-content {
    background: #fff;
    margin: 30px auto;
    width: 92%;
    max-width: 1100px;
    max-height: calc(100vh - 60px);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.finance-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.finance-modal-head h2 {
    margin: 0;
    font-size: 18px;
}

.finance-modal-close {
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
}

.finance-modal-close:hover {
    color: var(--text);
}

.finance-controls-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.finance-controls-row .period-switch {
    display: inline-flex;
    gap: 2px;
    background: #f4f4f4;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
}

.finance-controls-row .period-switch button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.finance-controls-row .period-switch button:hover {
    background: #e9ecef;
}

.finance-controls-row .period-switch button.active {
    background: var(--accent);
    color: #fff;
}

.finance-custom-range {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--muted);
}

.finance-custom-range.visible {
    display: inline-flex;
}

.finance-custom-range input[type="date"] {
    font: inherit;
    font-size: 12.5px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 7px;
}

.finance-range-caption {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted);
}

.finance-modal-body {
    padding: 18px 20px 24px;
    overflow-y: auto;
}

.finance-loading {
    text-align: center;
    color: var(--muted);
    padding: 40px 0;
}

.finance-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.finance-tile {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
}

.finance-tile .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.finance-tile .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.finance-tile .value {
    font-size: 20px;
    font-weight: 700;
}

.finance-tile .value.crit { color: var(--danger); }
.finance-tile .value.good { color: #28a745; }
.finance-tile .value.warn { color: #f0ad4e; }

.finance-section-title {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 10px;
}

.finance-table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 360px;
    margin-bottom: 22px;
}

table.finance-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12.5px;
}

table.finance-table th,
table.finance-table td {
    padding: 8px 10px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

table.finance-table th:first-child,
table.finance-table td:first-child {
    text-align: left;
    font-variant-numeric: normal;
}

table.finance-table thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    color: var(--muted);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid #ccc;
}

table.finance-table th .th-inner {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    justify-content: flex-end;
}

table.finance-table th:first-child .th-inner {
    justify-content: flex-start;
}

table.finance-table tbody tr:hover {
    background: #f0f7ff;
}

table.finance-table tfoot td {
    font-weight: 700;
    background: #f8f9fa;
    border-top: 1px solid #ccc;
    border-bottom: none;
}

.finance-swatch {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
    display: inline-block;
}

.finance-workers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.finance-worker-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}

.finance-worker-card .fw-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}

.finance-worker-card .fw-total {
    font-size: 16px;
    font-weight: 700;
    margin-top: 4px;
}

.finance-worker-card .fw-count {
    font-size: 11px;
    color: var(--muted);
}

@media (max-width: 768px) {
    .finance-tiles {
        grid-template-columns: repeat(2, 1fr);
    }
    .finance-workers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .finance-modal-content {
        margin: 0;
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .finance-tiles,
    .finance-workers-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Касса */
.cash-add-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.cash-add-form select,
.cash-add-form input[type="number"] {
    font: inherit;
    font-size: 13px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.cash-add-form input[type="text"] {
    font: inherit;
    font-size: 13px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    flex: 1;
    min-width: 160px;
}

.cash-add-form input[type="number"] {
    width: 110px;
}

.cash-add-status {
    font-size: 12px;
    color: var(--muted);
}

.cash-add-status.error {
    color: var(--danger);
}

.cash-add-status.success {
    color: #28a745;
}

.finance-tx-list {
    font-size: 12.5px;
}

.finance-tx-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}

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

.finance-tx-date {
    color: var(--muted);
    white-space: nowrap;
    font-size: 11.5px;
    width: 120px;
    flex-shrink: 0;
}

.finance-tx-recipient {
    font-weight: 600;
    width: 90px;
    flex-shrink: 0;
}

.finance-tx-comment {
    flex: 1;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.finance-tx-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .cash-add-form {
        flex-direction: column;
        align-items: stretch;
    }
    .cash-add-form input[type="number"] {
        width: 100%;
    }
}

/* Информация об автомобиле (расшифровка VIN) */
.vehicle-info-modal {
    display: none;
    position: fixed;
    z-index: 950;
    inset: 0;
    background: rgba(0, 0, 0, .5);
}

.vehicle-info-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.vehicle-info-content {
    background: #fff;
    width: 92%;
    max-width: 560px;
    max-height: calc(100vh - 60px);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.vehicle-info-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
}

.vehicle-info-head h3 {
    margin: 0 0 4px;
    font-size: 19px;
}

.vehicle-info-subtitle {
    font-size: 13px;
    color: var(--muted);
}

.vehicle-info-close {
    font-size: 22px;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}

.vehicle-info-close:hover {
    color: var(--text);
}

.vehicle-info-rows {
    overflow-y: auto;
    padding: 4px 22px 16px;
}

.vehicle-info-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

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

.vehicle-info-label {
    color: var(--muted);
    flex-shrink: 0;
}

.vehicle-info-value {
    font-weight: 600;
    text-align: right;
}
