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

html {
    /* фиксация высоты для iOS PWA */
    height: 100%;
    height: -webkit-fill-available;
    overflow: hidden;
    /* Блокировка зума на iOS */
    touch-action: pan-x pan-y;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: #2c3e50;
    background: #f8f9fa;
    /* фиксация высоты для iOS PWA */
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    /* блокируем body от прокрутки, прокрутка только внутри контейнеров */
    overflow-y: auto;
    /* Блокировка зума на iOS */
    touch-action: pan-x pan-y;
    -webkit-text-size-adjust: 100%;
    /* iOS momentum scrolling */
    -webkit-overflow-scrolling: touch;
}

/* layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px;
}

.container-fluid {
    padding: 12px;
}

/* header */
header {
    background: #fff;
    border-bottom: 1px solid #e1e4e8;
    padding: 8px 0;
    margin-bottom: 12px;
}

header h1 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

/* navigation */
nav {
    margin-top: 6px;
}

nav a {
    display: inline-block;
    padding: 4px 10px;
    margin-right: 3px;
    color: #586069;
    text-decoration: none;
    border-radius: 3px;
    font-size: 12px;
    transition: background 0.15s;
}

nav a:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

nav a.active {
    background: #0366d6;
    color: #fff;
}

/* forms */
input, select, textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    /* Блокировка двойного тапа для зума на iOS */
    touch-action: manipulation;
}

input[type="file"] {
    padding: 4px 8px;
}

input[type="checkbox"] {
    width: auto;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 2px rgba(3, 102, 214, 0.1);
}

input:disabled, select:disabled, textarea:disabled {
    background: #f6f8fa;
    color: #586069;
    cursor: not-allowed;
    opacity: 0.7;
}

label {
    display: block;
    margin-bottom: 3px;
    font-weight: 500;
    font-size: 12px;
    color: #24292e;
}

.form-group {
    margin-bottom: 10px;
}

/* buttons */
button, .btn {
    padding: 6px 12px;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-weight: 500;
    min-height: 40px;
    /* Блокировка двойного тапа для зума на iOS */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;

}

.btn-primary {
    background: #0366d6;
    color: #fff;
}

.btn-primary:hover {
    background: #0256c7;
}

.btn-success {
    background: #28a745;
    color: #fff;
}

.btn-success:hover {
    background: #22863a;
}

.btn-danger {
    background: #d73a49;
    color: #fff;
}

.btn-danger:hover {
    background: #cb2431;
}

.btn-secondary {
    background: #6a737d;
    color: #fff;
}

.btn-secondary:hover {
    background: #586069;
}

.btn-sm {
    padding: 3px 8px;
    font-size: 11px;
    min-height: auto;
}

/* table */
table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    overflow: hidden;
    font-size: 12px;
}

th, td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #e1e4e8;
}

th {
    background: #fafbfc;
    font-weight: 600;
    color: #24292e;
    font-size: 11px;  
    letter-spacing: 0.3px;
}

tr:hover {
    background: #f6f8fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* hierarchy styles */
tr[data-level="0"] {
    background: #fafbfc;
}

tr[data-level="0"] td:first-child {
    font-weight: 600;
}

tr[data-level="1"] td:first-child {
    padding-left: 20px;
}

tr[data-level="2"] td:first-child {
    padding-left: 40px;
}

tr[data-level="3"] td:first-child {
    padding-left: 60px;
}

/* card */
.card {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    padding: 12px;
    margin-bottom: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #1a1a1a;
}

/* alerts */
.alert {
    padding: 8px 12px;
    border-radius: 3px;
    margin-bottom: 12px;
    font-size: 12px;
    border: 1px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-color: #d73a49;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #0366d6;
}

/* mobile search */
.search-box {
    position: relative;
    margin-bottom: 12px;
}

.search-box input {
    padding: 12px;
    font-size: 15px;
    border: 2px solid #0366d6;
}

.search-results {
    margin-top: 12px;
}

.result-item {
    background: #fff;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 3px;
    border: 1px solid #e1e4e8;
}

.result-item h3 {
    font-size: 14px;
    margin-bottom: 4px;
    font-weight: 600;
}

.result-item .location {
    font-size: 16px;
    font-weight: 600;
    color: #0366d6;
    margin: 6px 0;
}

.result-item .quantity {
    font-size: 12px;
    color: #586069;
}

/* search dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    margin-top: 2px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-group {
    border-bottom: 1px solid #e1e4e8;
}

.search-group:last-child {
    border-bottom: none;
}

.search-group-title {
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 600; 
    color: #6a737d;
    background: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
}

.search-subgroup-title {
    padding: 4px 12px;
    font-size: 9px;
    font-weight: 600; 
    color: #959da5;
    background: #fafbfc;
    margin-top: 2px;
}

.search-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.1s;
    border-bottom: 1px solid #f6f8fa;
}

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

.search-item:hover {
    background: #f6f8fa;
}

.search-item strong {
    color: #1a1a1a;
}

.search-item small {
    display: block;
    margin-top: 2px;
}

.form-group {
    position: relative;
}

/* photo viewer */
.photo-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10102;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.photo-viewer-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-viewer-image {
    width: 90vw;
    height: 90vh;
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    transition: transform 0.3s;
    user-select: none;
}

.photo-viewer-close,
.photo-viewer-rotate,
.photo-viewer-save {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10001;
}

.photo-viewer-close:hover,
.photo-viewer-rotate:hover,
.photo-viewer-save:hover {
    background: #fff;
}

.photo-viewer-save {
    background: rgba(40, 167, 69, 0.9);
    color: #fff;
}

.photo-viewer-save:hover {
    background: #28a745;
}

.photo-viewer-close {
    top: 20px;
    right: 20px;
}

.photo-viewer-rotate {
    bottom: 20px;
    right: 80px;
}

.photo-viewer-save {
    bottom: 20px;
    right: 20px;
}

.photo-clickable {
    cursor: pointer;
    transition: opacity 0.2s;
}

.photo-clickable:hover {
    opacity: 0.8;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* photos gallery */
.photos-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.photo-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.photo-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 3px;
}

.photo-item {
    transition: all 0.2s;
}

.photo-item-delete {
    width: 100%;
    padding: 6px 8px;
    font-size: 11px;
    background: #fff;
    border: 1px solid #d73a49;
    color: #d73a49;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.photo-item-delete:hover {
    background: #d73a49;
    color: #fff;
}

.photo-item-delete i {
    font-size: 10px;
}

.photo-count-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 600;
}

/* photo upload interface */
.photo-upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 3px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f6f8fa;
    margin-bottom: 12px;
}

.photo-upload-zone:hover {
    border-color: #0366d6;
    background: #f0f6ff;
}

.photo-upload-zone.photo-upload-dragover {
    border-color: #28a745;
    background: #f0fff4;
}

.photo-upload-content i {
    font-size: 36px;
    color: #959da5;
    margin-bottom: 8px;
}

.photo-upload-content p {
    margin: 8px 0 4px 0;
    color: #586069;
    font-size: 13px;
}

.photo-upload-link {
    color: #0366d6;
    cursor: pointer;
    text-decoration: underline;
}

.photo-upload-link:hover {
    color: #0256c7;
}

.photo-upload-content small {
    color: #959da5;
    font-size: 11px;
}

.photo-upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.photo-upload-item {
    position: relative;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.photo-upload-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 3px;
}

.photo-upload-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(211, 58, 73, 0.9);
    border: none;
    width: 35px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.2s;
}

.photo-upload-remove:hover {
    background: #d73a49;
}

.photo-upload-name {
    font-size: 10px;
    color: #586069;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* board visualization (trello-style) */
.board-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top, 0);
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    height: calc(44px + env(safe-area-inset-top, 0));
    background: #0366d6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.board-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    transition: opacity 0.25s;
}

.board-header-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.board-search-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    opacity: 0;
    overflow: visible;
    transition: all 0.25s ease;
    z-index: 10;
    pointer-events: none;
}

.board-search-container.active {
    width: 60%;
    max-width: 400px;
    opacity: 1;
    pointer-events: auto;
    min-height: 32px;
}

.board-header-right {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

.view-toggle-header {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px;
    border-radius: 3px;
}

.view-toggle-header .board-header-btn {
    width: 28px;
    height: 28px;
    font-size: 20px;
    margin: 4px;
}

.board-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 3px;
    color: white;
    cursor: pointer;
    transition: background 0.15s, opacity 0.25s;
    text-decoration: none;
}

.board-header-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.board-header-btn.active {
    background: rgba(255, 255, 255, 0.25);
}

#search-toggle-btn {
    opacity: 1;
}


.board-search-container {
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible;
}

.board-search-icon {
    position: absolute;
    left: 10px;
    color: #6a737d;
    pointer-events: none;
    font-size: 13px;
}

.board-search-input {
    width: 100%;
    padding: 6px 32px 6px 32px;
    border: none;
    border-radius: 3px;
    font-size: 13px;
    transition: all 0.2s;
    background: white;
    height: 32px;
}

.board-search-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.board-search-clear {
    position: absolute;
    right: 4px;
    background: transparent;
    border: none;
    color: #6a737d;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    font-size: 12px;
    transition: all 0.2s;
}

.board-search-clear:hover {
    background: #f6f8fa;
    color: #d73a49;
}

/* Кнопка сброса фильтра */
.board-search-reset-btn {
    position: absolute;
    left: 0;
    top: 0;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: green;
    border: none;
    border-radius: 3px;
    color: white;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    animation: fadeInScale 0.2s ease;
    z-index: 5;
    pointer-events: auto;
    height: 32px;
    width: 100%;
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.board-search-reset-btn:hover {
    background: linear-gradient(135deg, #0256c7 0%, #024fb8 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.board-search-reset-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.board-search-reset-btn i {
    font-size: 14px;
}

.board-search-reset-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.board-search-reset-info:hover {
    opacity: 0.9;
}

.board-search-reset-btn span {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-search-reset-btn .fa-filter {
    opacity: 0.9;
    flex-shrink: 0;
}

.board-search-reset-btn > .fa-times {
    opacity: 0.8;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 4px;
    margin: -4px;
    border-radius: 2px;
}

.board-search-reset-btn > .fa-times:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* На мобильных устройствах */
@media (max-width: 768px) {
    .board-search-reset-btn {
        font-size: 12px;
        padding: 6px 8px;
        gap: 4px;
    }
    
    .board-search-reset-btn i {
        font-size: 12px;
    }
    
    .board-search-reset-info {
        gap: 6px;
    }
}

.board-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #0366d6;
    color: white;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: none;
}

@keyframes highlight-card {
    0%, 100% {
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.3);
        transform: scale(1.02);
    }
}


.container-fluid {
    max-width: 100%;
    padding: 60px 16px 0 16px;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    box-sizing: border-box;
}

.board-container {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 16px;
    height: calc(100% - 3px);
    cursor: grab;
}

.board-container::-webkit-scrollbar {
    height: 8px;
}

.board-container::-webkit-scrollbar-track {
    background: #f6f8fa;
    border-radius: 4px;
}

.board-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.board-container::-webkit-scrollbar-thumb:hover {
    background: #959da5;
}

.board-column {
    min-width: 230px;
    max-width: 230px;
    background: #fff;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
}

.board-column-header {
    padding: 12px 14px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 3px 3px 0 0;
}

.board-column-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.board-column-title-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.board-column-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #24292e;
}

.board-column-description {
    font-size: 11px;
    color: #6a737d;
    font-weight: normal;
    line-height: 1.3;
}

.board-column-edit-input {
    padding: 4px 8px;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    font-size: 13px;
    width: 100%;
    font-family: inherit;
    transition: border-color 0.2s;
}

.board-column-edit-input:focus {
    outline: none;
    border-color: #0366d6;
}

.board-column-name .board-column-edit-input {
    font-size: 14px;
    font-weight: 600;
}

.board-column-description .board-column-edit-input {
    font-size: 11px;
    margin-top: 4px;
}

.board-column-edit-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.board-column-edit-actions .btn {
    padding: 4px 8px;
    min-height: auto;
}

.board-column-title.editing .board-column-count {
    display: none;
}

.board-column-count { 
    color: #586069;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.board-column-menu {
    position: relative;
}

.board-column-menu-btn {
    background: transparent;
    border: none;
    color: #6a737d;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.board-column-menu-btn:hover {
    background: #f6f8fa;
    color: #24292e;
}

.board-column-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    min-width: 200px;
    padding: 4px 0;
}

.board-column-menu-dropdown button,
.board-column-menu-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #24292e;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.board-column-menu-dropdown button:hover,
.board-column-menu-link:hover {
    background: #f6f8fa;
}

.board-column-menu-link {
    color: #0366d6;
    font-weight: 500;
}

.board-column-menu-link:hover {
    color: #0256c7;
}

.board-column-menu-dropdown button i,
.board-column-menu-link i {
    color: #6a737d;
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.board-column-menu-link i {
    color: #0366d6;
}

.board-column-menu-divider {
    height: 1px;
    background: #e1e4e8;
    margin: 4px 0;
}

.menu-delete {
    color: #d73a49 !important;
}

.menu-delete:hover {
    background: #ffeef0 !important;
}

.menu-delete i {
    color: #d73a49 !important;
}

.board-column-menu-item-submenu {
    position: relative;
}

.board-column-menu-item-submenu .submenu-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 10px;
}

.board-column-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 4px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 0;
    z-index: 101;
}

.board-column-menu-item-submenu:hover .board-column-submenu {
    display: block;
}

.board-column-submenu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #24292e;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.board-column-submenu button:hover {
    background: #f6f8fa;
}

/* Меню выбора цвета открывается вниз */
.color-menu-container {
    position: relative;
}

.color-menu-dropdown {
    display: none;
    position: absolute;
    left: -50px;
    top: 100%;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    padding: 8px;
    z-index: 1060;
}

.color-menu-dropdown.show {
    display: block;
}

.color-picker-recent {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.color-picker-divider {
    height: 1px;
    background: #e1e4e8;
    margin: 8px 0;
}

.color-picker-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.color-option {
    width: 36px;
    height: 36px;
    border: 2px solid #e1e4e8;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-option:hover {
    border-color: #0366d6;
    transform: scale(1.1);
}

.color-option i {
    color: #959da5;
    font-size: 16px;
}

.color-option-recent {
    border: 2px solid #0366d6;
    opacity: 0.8;
}

.color-option-recent:hover {
    opacity: 1;
}

/* Модальное окно переноса мест */
.move-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
}

.move-modal-overlay.modal-show {
    background: rgba(0, 0, 0, 0.5);
    opacity: 1;
}

.move-modal-container {
    background: white;
    border-radius: 6px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: scale(0.85) translateY(40px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}

.move-modal-overlay.modal-show .move-modal-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.move-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.move-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #24292e;
}

.move-modal-close {
    background: transparent;
    border: none;
    color: #959da5;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 20px;
    transition: color 0.2s;
}

.move-modal-close:hover {
    color: #24292e;
}

.move-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.move-source-info {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.move-source-label {
    color: #856404;
    font-size: 12px;
    font-weight: 600; 
    letter-spacing: 0.5px;
}

.move-source-location {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 6px 12px;
    border-radius: 3px;
    border: 1px solid #ffc107;
    flex: 1;
}

.move-source-location i {
    color: #ffc107;
    font-size: 14px;
}

.move-source-location span {
    font-weight: 600;
    color: #856404;
    font-size: 14px;
}

.move-target-label {
    color: #6a737d;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
}

.move-search {
    margin-bottom: 16px;
}

.move-locations-list {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    padding: 8px;
}

.move-locations-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.move-location-item {
    display: flex;
    flex-direction: column;
}

.move-location-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}

.move-location-content:hover {
    background: #f6f8fa;
}

.move-location-content.selected {
    background: #0366d6;
    color: white;
}

.move-location-content.selected .move-location-desc {
    color: rgba(255, 255, 255, 0.8);
}

.move-location-content i {
    color: #959da5;
    font-size: 14px;
}

.move-location-content.selected i {
    color: white;
}

.move-location-name {
    font-weight: 500;
    font-size: 14px;
}

.move-location-desc {
    font-size: 12px;
    color: #6a737d;
    margin-left: auto;
}

.move-loading,
.move-error,
.move-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6a737d;
    font-size: 14px;
}

.move-error {
    color: #d73a49;
}

.move-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e1e4e8;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.move-modal-footer .btn {
    min-height: auto;
}

@media (max-width: 768px) {
    .move-modal-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .move-modal-footer {
        flex-direction: column;
    }
    
    .move-modal-footer .btn {
        width: 100%;
    }
}

/* Подсветка переносимого места */
.location-moving {
    border: 3px dashed #ffc107 !important;
    animation: moving-pulse 2s ease-in-out infinite;
    position: relative;
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.1) !important;
}

@keyframes moving-pulse {
    0%, 100% {
        border-color: #ffc107;
        box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.1);
    }
    50% {
        border-color: #ff9800;
        box-shadow: 0 0 0 8px rgba(255, 193, 7, 0.2);
    }
}

.location-moving::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px dashed transparent;
    border-radius: inherit;
    animation: moving-dash 20s linear infinite;
}

@keyframes moving-dash {
    to {
        border-spacing: 20px;
    }
}

/* Бадж с информацией о задаче перемещения */
.location-task-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: badge-pulse 3s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.location-task-badge i {
    font-size: 10px;
}

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

.location-task-current {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
}

.location-task-arrow {
    font-size: 10px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.location-task-arrow i {
    font-size: 9px;
}

.location-task-target {
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.location-task-action {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.location-task-complete-btn {
    background: white;
    color: #ff9800;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.location-task-complete-btn:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

.location-task-complete-btn:active {
    transform: scale(0.98);
}

/* Адаптация бейджа для слотов */
.board-slot .location-task-badge {
    position: static;
    margin-left: auto;
    flex-shrink: 0;
}

.board-slot-header {
    position: relative;
}

/* Уведомление об успешном перемещении */
.move-success-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    z-index: 3000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.move-success-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.move-success-notification i {
    font-size: 20px;
}

@media (max-width: 768px) {
    .move-success-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        font-size: 13px;
        padding: 12px 16px;
    }
}

/* === Модальное окно добавления позиций === */
.add-storage-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    background: rgba(27, 31, 35, 0);
    backdrop-filter: blur(0);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease, backdrop-filter 0.3s ease;
}

.add-storage-modal-overlay.modal-show {
    background: rgba(27, 31, 35, 0.5);
    backdrop-filter: blur(4px);
    opacity: 1;
}

.add-storage-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    transform: scale(0.85) translateY(40px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}

.add-storage-modal-overlay.modal-show .add-storage-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.add-storage-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.add-storage-header h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #24292e;
}

.add-storage-location {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    color: #586069;
    font-size: 14px;
}

.add-storage-location i {
    color: #0366d6;
}

.add-storage-location-description {
    margin-top: 4px; 
    font-size: 12px;
    color: #6a737d;
    line-height: 1.4;
}

.add-storage-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #586069;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.add-storage-close:hover {
    background: #f6f8fa;
    color: #24292e;
}

.add-storage-body {
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Начальное состояние - только поиск по центру */
.add-storage-body.initial-state {
    justify-content: center;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.add-storage-body.initial-state .add-storage-search-section {
    width: 100%;
    max-width: 400px;
    margin-bottom: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.add-storage-body.initial-state .add-storage-selected,
.add-storage-body.initial-state .add-storage-new-form,
.add-storage-body.initial-state .add-storage-fields,
.add-storage-body.initial-state .add-storage-field:not(.add-storage-field-quantity) {
    display: none !important;
}

/* Скрываем footer с кнопками на этапе поиска */
.add-storage-body.initial-state ~ .add-storage-footer {
    display: none !important;
}

/* При фокусе - переезжаем вверх */
.add-storage-body.searching {
    justify-content: flex-start;
    align-items: stretch;
}

.add-storage-body.searching .add-storage-search-section {
    max-width: 100%;
}

.add-storage-body.searching .add-storage-selected,
.add-storage-body.searching .add-storage-new-form,
.add-storage-body.searching .add-storage-fields,
.add-storage-body.searching .add-storage-field:not(.add-storage-field-quantity) {
    display: none !important;
}

.add-storage-body.searching ~ .add-storage-footer {
    display: none !important;
}

.add-storage-search-section {
    margin-bottom: 24px;
    position: relative;
    transition: all 0.3s ease;
}

/* Когда есть результаты - инпут прилипает */
.add-storage-search-section.has-results {
    margin-bottom: 0;
}

.add-storage-search-section.has-results .add-storage-search {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.add-storage-search {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.15s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23586069' d='M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zM15 14l-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.add-storage-search:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.add-storage-search-hint {
    margin-top: 6px;
    padding: 4px 8px;
    font-size: 12px;
    color: #586069;
    display: flex;
    align-items: center;
    gap: 4px;
}

.add-storage-search-hint i {
    font-size: 10px;
    color: #0366d6;
}

.add-storage-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border: 2px solid #0366d6;
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    max-height: calc(90vh - 200px);
    overflow-y: auto;
    background: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.add-storage-results:empty {
    display: none;
}

/* Анимация появления результатов */
.add-storage-results.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Красивая прокрутка для результатов поиска */
.add-storage-results::-webkit-scrollbar {
    width: 8px;
}

.add-storage-results::-webkit-scrollbar-track {
    background: transparent;
}

.add-storage-results::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.add-storage-results::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.add-storage-results {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.add-storage-results-title {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #586069;
    text-transform: uppercase;
    background: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
}

.add-storage-category-group {
    /* Группа позиций одной категории */
}

.add-storage-category-title {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #0366d6;
    background: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.add-storage-category-title i {
    font-size: 11px;
    color: #959da5;
}

.add-storage-result-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    align-items: center;
    gap: 12px;
}

.add-storage-result-item:last-child {
    border-bottom: none;
}

.add-storage-result-item:hover {
    background: #f6f8fa;
}

.add-storage-result-photo-wrapper {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-storage-result-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
    display: block;
}

.add-storage-result-no-photo {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f6f8fa;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
    color: #959da5;
    font-size: 20px;
}

.add-storage-result-content {
    flex: 1;
    min-width: 0;
}

.add-storage-result-name {
    font-size: 14px;
    font-weight: 500;
    color: #24292e;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.add-storage-result-meta {
    font-size: 12px;
    color: #586069;
}

.add-storage-divider {
    height: 1px;
    background: #e1e4e8;
}

.add-storage-create-new {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #0366d6;
    font-size: 14px;
    font-weight: 500;
}

.add-storage-create-new:hover {
    background: #f1f8ff;
}

.add-storage-create-new i {
    font-size: 16px;
}

.add-storage-loading {
    padding: 20px;
    text-align: center;
    color: #586069;
    font-size: 14px;
}

.add-storage-empty {
    padding: 20px;
    text-align: center;
    color: #959da5;
    font-size: 14px;
}

.add-storage-selected {
    display: none;
    padding: 12px 16px;
    background: #f1f8ff;
    border: 1px solid #c8e1ff;
    border-radius: 8px;
    margin-bottom: 24px;
    position: relative;
}

.add-storage-selected-name {
    font-size: 14px;
    font-weight: 500;
    color: #0366d6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-storage-selected-name i {
    color: #28a745;
}

.add-storage-selected-reset {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #d73a49;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: #d73a49;
    font-size: 12px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.add-storage-selected-reset:hover {
    background: #d73a49;
    border-color: #d73a49;
    color: white;
}

/* Существующие места хранения товара */
.add-storage-existing-locations {
    width: 100%;
    border: 2px solid #ffd33d;
    border-radius: 8px;
    background: #fffbdd;
    overflow: hidden;
    order: -1;
}

.add-storage-existing-header {
    padding: 6px 16px;
    background: #fff8c5;
    border-bottom: 1px solid #ffd33d;
    font-size: 13px;
    font-weight: 600;
    color: #735c0f;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-storage-existing-header i {
    color: #f9c513;
}

.add-storage-existing-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.add-storage-existing-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #ffd33d;
    transition: background 0.15s ease;
}

.add-storage-existing-item:last-child {
    border-bottom: none;
}

.add-storage-existing-item:hover {
    background: #fff8c5;
}

.add-storage-existing-info {
    flex: 1;
    min-width: 0;
}

.add-storage-existing-name {
    font-size: 14px;
    font-weight: 500;
    color: #24292e;
    margin-bottom: 4px;
}

.add-storage-existing-qty {
    font-size: 12px;
    color: #735c0f;
}

.add-storage-existing-btn {
    padding: 6px 12px;
    background: #28a745;
    border: 1px solid #22863a;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.add-storage-existing-btn:hover {
    background: #22863a;
}

.add-storage-existing-btn i {
    margin-right: 4px;
}

.add-storage-new-form {
    display: none;
    padding: 16px;
    background: #fffbdd;
    border: 1px solid #ffd33d;
    border-radius: 8px;
    margin-bottom: 24px;
    position: relative;
}

/* Баннер предупреждения AI */
.ai-warning-banner {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.ai-warning-banner.ai-warning-warning {
    background: #fff8c5;
    border: 1px solid #ffd33d;
    color: #735c0f;
}

.ai-warning-banner.ai-warning-error {
    background: #ffeef0;
    border: 1px solid #f97583;
    color: #86181d;
}

.ai-warning-banner i {
    font-size: 16px;
    flex-shrink: 0;
}

.ai-warning-banner span {
    flex: 1;
}

.ai-warning-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    transition: opacity 0.15s ease;
    font-size: 14px;
    flex-shrink: 0;
}

.ai-warning-close:hover {
    opacity: 1;
}

.add-storage-new-header {
    display: flex;
    align-items: center;
    justify-content: space-between; 
    gap: 12px;
}

.add-storage-new-title {
    font-size: 14px;
    font-weight: 600;
    color: #735c0f;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-storage-new-reset {
    background: white;
    border: 1px solid #d73a49;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: #d73a49;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.add-storage-new-reset:hover {
    background: #d73a49;
    color: white;
}

.add-storage-new-field {
    margin-bottom: 12px;
}

.add-storage-new-field:last-child {
    margin-bottom: 0;
}

.add-storage-new-field-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.add-storage-new-field-row .add-storage-new-field {
    flex: 1;
    margin-bottom: 0;
}

.add-storage-new-field-row .add-storage-new-field:first-child {
    flex: 2;
}

.add-storage-new-field-row .add-storage-new-field:last-child {
    flex: 1;
    min-width: 120px;
}

.add-storage-new-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #24292e;
    margin-bottom: 6px;
}

.add-storage-new-field input,
.add-storage-new-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.15s ease;
}

.add-storage-new-field input:focus,
.add-storage-new-field select:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.add-storage-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

/* Красивый скроллбар для полей */
.add-storage-fields::-webkit-scrollbar {
    width: 6px;
}

.add-storage-fields::-webkit-scrollbar-track {
    background: transparent;
}

.add-storage-fields::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.add-storage-fields::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.add-storage-fields {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.add-storage-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #24292e;
    margin-bottom: 6px;
}

.add-storage-field input,
.add-storage-field select,
.add-storage-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.15s ease;
}

.add-storage-field input:focus,
.add-storage-field select:focus,
.add-storage-field textarea:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.add-storage-field textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

/* Поле количества с кнопками +/- */
.add-storage-quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-storage-quantity-btn {
    width: 40px;
    height: 40px;
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    color: #24292e;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    user-select: none;
}

.add-storage-quantity-btn:hover {
    background: white;
    border-color: #0366d6;
    color: #0366d6;
}

.add-storage-quantity-btn:active {
    transform: scale(0.95);
}

.add-storage-quantity-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.add-storage-quantity-input {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    padding: 10px 12px;
}

/* Загрузка фото */
.add-storage-photo-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.add-storage-photo-buttons {
    display: flex;
    gap: 8px;
}

.add-storage-photo-btn {
    padding: 10px 16px;
    background: #f6f8fa;
    border: 2px dashed #e1e4e8;
    border-radius: 6px;
    color: #586069;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: all 0.15s ease;
    flex: 1;
    min-width: 0;
}

/* Скрываем кнопку камеры на десктопе */
@media (min-width: 769px) {
    .add-storage-photo-btn:last-child {
        display: none;
    }
    
    .add-storage-photo-btn:first-child {
        flex: none;
        width: auto;
    }
}

.add-storage-photo-btn:hover {
    background: #fff;
    border-color: #0366d6;
    color: #0366d6;
}

.add-storage-photo-btn i {
    font-size: 16px;
}

.add-storage-photo-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.add-storage-photo-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 1;
    border: 2px solid #e1e4e8;
}

.add-storage-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.add-storage-photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    font-size: 12px;
}

.add-storage-photo-item:hover .add-storage-photo-remove {
    opacity: 1;
}

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

.add-storage-footer {
    padding: 12px 24px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid #e1e4e8;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: white;
    position: relative;
}

/* Overlay для footer во время AI анализа */
.add-storage-footer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #764ba2;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
    gap: 10px;
    z-index: 10;
    border-radius: 0;
}

.add-storage-footer-overlay i {
    font-size: 16px;
}

/* Селект автопечати этикеток */
.add-storage-auto-print-select {
    position: relative;
    margin-left: 8px;
}

.add-storage-auto-print-toggle {
    padding: 8px 10px;
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #586069;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    width: 40px;
    height: 100%;
    margin-left: -10px;
}

.add-storage-auto-print-toggle:hover {
    background: white;
    border-color: #0366d6;
    color: #0366d6;
}

.add-storage-auto-print-toggle i:first-child {
    color: #0366d6;
    font-size: 13px;
}

.add-storage-auto-print-toggle i:last-child {
    font-size: 9px;
    opacity: 0.6;
}

.add-storage-auto-print-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 4px;
    background: white;
    border: 2px solid #0366d6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1000;
    min-width: 180px;
}

.add-storage-auto-print-dropdown button {
    width: 100%;
    padding: 10px 14px;
    background: white;
    border: none;
    border-bottom: 1px solid #e1e4e8;
    font-size: 13px;
    font-weight: 500;
    color: #24292e;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}

.add-storage-auto-print-dropdown button:last-child {
    border-bottom: none;
}

.add-storage-auto-print-dropdown button:hover {
    background: #f6f8fa;
}

.add-storage-auto-print-dropdown button.active {
    background: #f1f8ff;
    color: #0366d6;
}

.add-storage-auto-print-dropdown button i {
    font-size: 12px;
    width: 16px;
    text-align: center;
}

/* Блок основных кнопок */
.add-storage-footer-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.add-storage-btn-secondary {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #24292e;
    cursor: pointer;
    transition: all 0.15s ease;
}

.add-storage-btn-secondary:hover {
    background: #f6f8fa;
    border-color: #d1d5da;
}

.add-storage-btn-primary {
    padding: 8px 16px;
    background: #0366d6;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-storage-btn-primary:hover {
    background: #0256c5;
}

.add-storage-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.add-storage-btn-more {
    padding: 8px 16px;
    background: white;
    border: 1px solid #0366d6;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #0366d6;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-storage-btn-more:hover {
    background: #f1f8ff;
}

.add-storage-btn-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toast уведомление */
.add-storage-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 10001;
}

.add-storage-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.add-storage-toast i {
    font-size: 16px;
}

/* Кнопка добавления в места */
.board-add-btn {
    background: none;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    color: #586069;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.board-add-btn:hover {
    background: rgba(3, 102, 214, 0.1);
    color: #0366d6;
}

.board-add-btn i {
    font-size: 14px;
}

/* Интерфейс выбора категории */
.category-select-wrapper {
    position: relative;
    display: flex;
    gap: 4px;
}

.category-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.15s ease;
}

.category-search-input:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.category-create-btn {
    padding: 8px 12px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    cursor: pointer;
    color: #0366d6;
    transition: all 0.15s ease;
    font-size: 14px;
}

.category-create-btn:hover {
    background: #f1f8ff;
    border-color: #0366d6;
}

.category-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 40px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
}

.category-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.category-item:hover {
    background: #f6f8fa;
}

.category-item i {
    color: #959da5;
    font-size: 12px;
}

.category-empty {
    padding: 20px;
    text-align: center;
    color: #959da5;
    font-size: 13px;
}

/* LLM подсказки */
.llm-hint {
    margin-bottom: 12px;
    border-radius: 6px;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

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

.llm-hint.loading {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    padding: 12px;
    text-align: center;
    color: #586069;
    font-size: 13px;
}

.llm-hint.loading i {
    margin-right: 6px;
    color: #0366d6;
}

.llm-hint.error {
    background: #ffe8e6;
    border: 1px solid #ff5252;
    padding: 12px;
    text-align: center;
    color: #d73a49;
    font-size: 13px;
}

.llm-hint.error i {
    margin-right: 6px;
}

.llm-hint.success {
    background: white;
    border: 2px solid #8e44ad;
    box-shadow: 0 2px 8px rgba(142, 68, 173, 0.1);
}

.llm-hint-header {
    padding: 8px 10px;
    background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%);
    color: white;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.llm-hint-header i {
    font-size: 13px;
}

.llm-hint-header span {
    flex: 1;
    white-space: nowrap;
}

.llm-apply-all-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.llm-apply-all-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.llm-apply-all-btn i {
    font-size: 11px;
}

.llm-hint-header > button:last-child {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.15s ease;
}

.llm-hint-header > button:last-child:hover {
    opacity: 1;
}

/* Предупреждение AI */
.llm-warning {
    padding: 8px 10px;
    background: #fff3cd;
    border-bottom: 1px solid #ffc107;
    color: #856404;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.llm-warning i {
    color: #ffc107;
    font-size: 12px;
}

.llm-hint-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.llm-suggestion {
    padding: 6px 8px;
    background: #f6f8fa;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.llm-suggestion strong {
    color: #24292e;
    min-width: 70px;
    font-size: 11px;
}

.llm-apply-btn {
    padding: 3px 8px;
    background: #8e44ad;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.llm-apply-btn:hover {
    background: #9b59b6;
    transform: translateY(-1px);
}

.llm-apply-btn:active {
    transform: translateY(0);
}

.llm-apply-btn i {
    font-size: 10px;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .llm-hint-header {
        padding: 6px 8px;
        font-size: 11px;
        gap: 4px;
    }
    
    .llm-hint-header i {
        font-size: 12px;
    }
    
    .llm-apply-all-btn {
        padding: 3px 6px;
        font-size: 10px;
        gap: 3px;
    }
    
    .llm-apply-all-btn i {
        font-size: 10px;
    }
    
    .llm-warning {
        padding: 6px 8px;
        font-size: 10px;
    }
    
    .llm-warning i {
        font-size: 11px;
    }
    
    .llm-hint-body {
        padding: 8px;
        gap: 4px;
    }
    
    .llm-suggestion {
        padding: 5px 6px;
        font-size: 11px;
        gap: 6px;
    }
    
    .llm-suggestion strong {
        min-width: 60px;
        font-size: 10px;
    }
    
    .llm-apply-btn {
        padding: 2px 6px;
        font-size: 10px;
    }
    
    .llm-apply-btn i {
        font-size: 9px;
    }
    
    /* Модальное окно добавления на мобильных */
    .add-storage-modal {
        width: 95%;
        max-height: 90vh; 
    }
    
    .add-storage-body {
        padding: 16px;
    }
    
    .add-storage-results {
        
    max-height: calc(90vh - 200px);
        font-size: 13px;
    }
    
    .add-storage-result-item {
        padding: 8px;
    }
    
    .add-storage-result-photo-wrapper {
        width: 40px;
        height: 40px;
    }
    
    .add-storage-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    
    .add-storage-btn-secondary,
    .add-storage-btn-more,
    .add-storage-btn-primary {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* Фото превью на мобильных */
    .add-storage-photo-preview {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
}

/* Форма создания категории */
.create-category-form {
    margin-top: 12px;
    border: 1px solid #0366d6;
    border-radius: 6px;
    background: #f1f8ff;
    overflow: hidden;
}

.create-category-header {
    padding: 8px 12px;
    background: #0366d6;
    color: white;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.create-category-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.15s ease;
}

.create-category-header button:hover {
    opacity: 1;
}

.create-category-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.create-category-body input,
.create-category-body select {
    padding: 6px 10px;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-size: 13px;
}

.create-category-body input:focus,
.create-category-body select:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 2px rgba(3, 102, 214, 0.1);
}

.create-category-footer {
    padding: 8px 12px;
    background: white;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px solid #e1e4e8;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .add-storage-modal {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh; /* dynamic viewport height для iOS */
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        animation: slideUpModal 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    }
    
    @keyframes slideUpModal {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .add-storage-modal-overlay {
        padding: 0;
        align-items: flex-start;
    }
    
    .add-storage-quantity-btn {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    .add-storage-quantity-input {
        font-size: 18px;
    }
    
    .add-storage-selected {
        padding-right: 100px;
    }
    
    .add-storage-footer-actions {
        width: 100%;
    }
    
    .add-storage-btn-secondary {
        display: none;
    }
    
    .add-storage-btn-more {
        flex: 1;
    }
    
    .add-storage-btn-primary {
        flex: 1;
    }
    
    .add-storage-auto-print-select {
        margin-left: 8px;
    }
    
    .add-storage-new-field-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .add-storage-new-field-row .add-storage-new-field {
        width: 100%;
    }
    
    .add-storage-header {
        padding: 16px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    /* Кнопка закрытия на мобильных справа вверху */
    .add-storage-close {
        position: fixed !important;
        top: 8px !important;
        right: 8px !important;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    }
    
    .add-storage-body {
        padding-bottom: 80px; /* Дополнительный отступ для кнопок */
    }
    
    .add-storage-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 20px));
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        z-index: 10;
    }
    
    /* Скрываем кнопку отмена на мобильных (свайп вместо неё) */
    .add-storage-btn-secondary {
        display: none;
    }
    
    .add-storage-btn-more,
    .add-storage-btn-primary {
        flex: 1;
        justify-content: center;
        font-size: 15px;
        min-height: 44px; /* iOS рекомендуемый размер для touch target */
    }
    
    /* Кнопки фото на мобильных */
    .add-storage-photo-btn {
        font-size: 13px;
        padding: 12px 10px;
        min-height: 44px; /* iOS рекомендуемый размер для touch target */
    }
    
    .add-storage-photo-btn span {
        display: block; /* Текст под иконкой на маленьких экранах */
    }
    
    .category-results {
        right: 0;
    }
}

.board-column-content {
    padding: 4px;
    overflow-y: auto;
    overflow-x: visible;
    flex: 1;
    /*background:white;*/
}

.board-column-content::-webkit-scrollbar {
    width: 8px;
}

.board-column-content::-webkit-scrollbar-track {
    background: transparent;
}

.board-column-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background 0.2s ease;
}

.board-column-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.board-column-content::-webkit-scrollbar-thumb:active {
    background: rgba(0, 0, 0, 0.4);
}

/* Firefox */
.board-column-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.board-slot {
    background: #fff;
    border-radius: 3px;
    margin-bottom: 10px;
    border: 1px solid #e1e4e8;
    overflow: visible;
}

.board-slot-header {
    padding: 2px 10px;
    background: #fafbfc;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.board-slot-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.board-slot-title-main {
    display: flex;
    align-items: center;
    gap: 6px;
}

.board-slot-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.board-slot-name {
    font-size: 12px;
    font-weight: 600;
    color: #24292e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.board-slot-name i {
    font-size: 10px;
    color: #959da5;
}

.board-slot-description {
    font-size: 11px;
    color: #6a737d;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 18px;
}

.board-slot-count {  
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 8px;
    font-weight: 600;
}

.board-slot-menu {
    position: relative;
    z-index: 1;
}

.board-slot-menu-btn {
    background: transparent;
    border: none;
    color: #959da5;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.board-slot-menu-btn:hover {
    background: #e1e4e8;
    color: #24292e;
}

.board-slot-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    min-width: 180px;
    padding: 4px 0;
}

.board-slot-menu-dropdown button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #24292e;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.board-slot-menu-dropdown button:hover {
    background: #f6f8fa;
}

.board-slot-menu-dropdown button i {
    color: #6a737d;
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.board-slot-edit-input {
    padding: 2px 6px;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    font-size: 12px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
}

.board-slot-edit-input:focus {
    outline: none;
    border-color: #0366d6;
}

.board-slot-edit-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.board-slot-edit-actions .btn {
    padding: 2px 6px;
    min-height: auto;
    font-size: 11px;
}

.board-slot-header.editing .board-slot-count {
    display: none;
}

.board-slot-edit-form {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.board-slot-edit-field {
    flex: 1;
}

.board-slot-edit-desc {
    font-size: 11px;
    color: #6a737d;
}

.board-cards {
    padding: 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.board-card {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    overflow: hidden;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    /* Блокировка двойного тапа для зума на iOS */
    touch-action: manipulation;
}

.board-card:hover {
    border-color: #0366d6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); 
}

.board-card-photo {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    overflow: hidden;
    opacity: 1;
    transition: height 0.3s ease, opacity 0.3s ease;
}

.board-card-no-photo {
    width: 100%;
    height: 120px;
    background: #f6f8fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #959da5;
    font-size: 32px;
    overflow: hidden;
    opacity: 1;
    transition: height 0.3s ease, opacity 0.3s ease;
}

.board-card-header {
    padding: 4px 6px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.board-card-title {
    font-size: 12px;
    font-weight: 500;
    color: #24292e;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.board-card-quantity {
    font-size: 12px;
    font-weight: 600;
    color: #0366d6;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 1px 4px;
    background: #f0f6fc;
    border-radius: 4px;
}

.board-card-note {
    padding: 0 6px 6px 6px;
    font-size: 10px;
    color: #6a737d;
    line-height: 1.4;
    border-top: 1px solid #f6f8fa;
    margin-top: -2px;
}

/* подсветка поиска */
.search-highlight {
    background: #ffeb3b;
    color: #000;
    font-weight: 600;
    padding: 2px 0px;
    border-radius: 2px;
    box-shadow: 0 0 0 2px rgba(255, 235, 59, 0.3);
    animation: highlight-pulse 0.4s ease;
}

@keyframes highlight-pulse {
    0% {
        background: rgba(255, 235, 59, 0.3);
    }
    50% {
        background: #ffeb3b;
        box-shadow: 0 0 0 4px rgba(255, 235, 59, 0.4);
    }
    100% {
        background: #ffeb3b;
        box-shadow: 0 0 0 2px rgba(255, 235, 59, 0.3);
    }
}

/* компактный вид */
.board-container[data-view="compact"] .board-card-photo,
.board-container[data-view="compact"] .board-card-no-photo {
    height: 0;
    opacity: 0;
}

/* скрытие фото по настройке места - временно отключено */
/*
.board-column[data-show-photos="0"] .board-card-photo,
.board-column[data-show-photos="0"] .board-card-no-photo {
    display: none;
}
*/

/* адаптивность для board */
@media (max-width: 768px) {
    .board-header {
        height: 44px;
        padding: 0 8px;
    }
    
    .board-header-title {
        font-size: 14px;
    }
    
    .board-header-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .view-toggle-header .board-header-btn {
        width: 32px;
        height: 32px;
    }
    
    .board-search-container {
        left: 8px;
        transform: none;
    }
    
    .board-search-container.active {
        width: calc(100% - 120px);
        max-width: none;
    }
    
    .board-search-input {
        font-size: 14px;
        height: 36px;
    }
    
    .container-fluid {
        padding: calc(52px + env(safe-area-inset-top, 0)) 8px 0 8px;
    }
    
    .board-column {
        min-width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        height: 100%;
        scroll-snap-align: center;
    }
    
    .board-column-header {
        padding: 10px 12px;
    }
    
    .board-column-name {
        font-size: 14px;
    }
    
    .board-card {
        padding: 2px;
    }
    
    .board-slot {
        margin-left: 0 !important;
    }
    
    .board-slot-header {
        padding: 8px;
    }
    
    .board-container { 
        scroll-snap-type: x mandatory;
        padding-left: 8px;
        padding-right: 8px;
        gap: 8px;
    }
}

/* модальное окно */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
}

.modal-overlay.modal-show {
    background: rgba(0, 0, 0, 0.6);
    opacity: 1;
}

.modal-container {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    margin: auto;
    display: flex;
    flex-direction: column;
    transform: scale(0.85) translateY(40px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}

.modal-overlay.modal-show .modal-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-close {
    position: sticky;
    top: 0;
    right: 0;
    float: right;
    background: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: none; /* Скрываем старую кнопку, используем кнопку в header */
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #586069;
    z-index: 10;
    margin: 16px 16px 0 0;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-close:hover {
    background: #f6f8fa;
    color: #d73a49;
}

.modal-content {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal-loader {
    text-align: center;
    padding: 60px 20px;
    color: #586069;
    font-size: 14px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-loader i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
    color: #0366d6;
}

/* скрываем header/nav в модальном окне */
.modal-content header,
.modal-content .container > h1:first-child,
.modal-content .card-title {
    display: none;
}

/* quick edit интерфейс */
.quick-edit-container {
    padding: 0;
    min-height: 400px;
}

.quick-edit-header {
    padding: 16px 20px;
    background: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
}

.quick-edit-title {
    font-size: 16px;
    font-weight: 600;
    color: #24292e;
    margin-bottom: 6px;
}

.quick-edit-title .text-muted {
    font-size: 13px;
    font-weight: 400;
    margin-left: 8px;
}

.quick-edit-location {
    font-size: 12px;
    color: #586069;
}

.quick-edit-location i {
    color: #0366d6;
}

.quick-edit-form {
    
}

.quick-edit-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.quick-edit-field {
    margin-bottom: 12px;
}

.quick-edit-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #6a737d;
    margin-bottom: 6px; 
    letter-spacing: 0.5px;
}

.quick-edit-field input[type="number"],
.quick-edit-field select,
.quick-edit-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    font-size: 16px;
    transition: all 0.2s;
}

.quick-edit-field input[type="number"] {
    position: relative;
    padding-right: 50px;
}

.quick-edit-unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6a737d;
    font-size: 14px;
    pointer-events: none;
}

.quick-edit-field input:focus,
.quick-edit-field select:focus,
.quick-edit-field textarea:focus {
    border-color: #0366d6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.quick-edit-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.quick-edit-photo {
    position: relative;
    aspect-ratio: 1;
    border-radius: 3px;
    overflow: visible;
    border: 1px solid #e1e4e8;
    transition: all 0.3s;
}

.quick-edit-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
    border-radius: 3px;
}

.quick-edit-photo img:hover {
    transform: scale(1.02);
}

.quick-edit-photo-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #d73a49;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    border: 2px solid #fff;
}

.quick-edit-photo-delete:hover {
    background: #cb2431;
    transform: scale(1.1);
}

.quick-edit-photo-delete input {
    display: none;
}

.quick-edit-file {
    padding: 8px 0;
    font-size: 14px;
}

.quick-edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e1e4e8;
}

.quick-edit-actions .btn {
    flex: 1;
    min-height: 44px;
    font-size: 15px;
}

@media (max-width: 600px) {
    .quick-edit-main {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        border-radius: 0;
    }
}

@media (max-width: 768px) {
    .modal-container {
        max-width: 95%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        margin: 0;
    }
    
    .modal-overlay {
        padding: 0;
        align-items: flex-start;
    }
    
    /* Fullscreen модалка на мобильных */
    .modal-mobile-fullscreen {
        max-width: 100% !important;
        width: 100% !important;
        height: 100vh !important;
        height: -webkit-fill-available !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: -webkit-fill-available !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        animation: expandFromCard 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    }
    
    /* Анимация раскрытия из позиции карточки */
    @keyframes expandFromCard {
        0% {
            transform: translate(
                calc(var(--card-x, 0px) - 50vw + var(--card-width, 0px) / 2),
                var(--card-y, 0px)
            ) scale(0.1);
            opacity: 0;
            border-radius: 12px;
        }
        100% {
            transform: translate(0, 0) scale(1);
            opacity: 1;
            border-radius: 0;
        }
    }
    
    /* Кнопка закрытия на мобильных всегда слева */
    .modal-mobile-fullscreen .quick-edit-close,
    .modal-mobile-fullscreen .modal-close {
        position: fixed !important;
        top: 8px !important;
        right: 8px !important;
        left: auto !important;
        float: none !important;
        margin: 0 !important;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    }
    
    /* Фиксированный заголовок на мобильных */
    .modal-mobile-fullscreen .quick-edit-header {
        position: sticky;
        top: 0;
        z-index: 999;
        background: #fff;
        padding-top: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
}
а
/* grid layouts */
.grid-3col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* flex layouts */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.flex-gap-sm {
    display: flex;
    gap: 4px;
}

/* form actions layout */
#location-form-actions,
#location-edit-actions,
#item-form-actions,
#item-edit-actions,
#storage-form-actions,
#storage-edit-actions {
    display: flex;
    gap: 8px;
}

#location-form-actions .btn-secondary,
#location-edit-actions .btn-secondary,
#item-form-actions .btn-secondary,
#item-edit-actions .btn-secondary,
#storage-form-actions .btn-secondary,
#storage-edit-actions .btn-secondary {
    flex: 0 0 25%;
    text-align: center;
    min-height: 40px;
}

#location-form-actions .btn-primary,
#location-edit-actions .btn-primary,
#item-form-actions .btn-primary,
#item-edit-actions .btn-primary,
#storage-form-actions .btn-primary,
#storage-edit-actions .btn-primary {
    flex: 0 0 calc(75% - 8px);
    text-align: center;
    min-height: 40px;
}

/* text styles */
.text-center {
    text-align: center;
}

.text-muted {
    color: #586069;
}

.text-sm {
    font-size: 11px;
}

.text-xs {
    font-size: 10px;
}

/* spacing */
.mb-0 {
    margin-bottom: 0;
}

.mb-sm {
    margin-bottom: 6px;
}

.mb-md {
    margin-bottom: 10px;
}

.mt-sm {
    margin-top: 6px;
}

.mt-md {
    margin-top: 8px;
}

/* module cards */
.module-card {
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    display: block;
    /* Блокировка двойного тапа для зума на iOS */
    touch-action: manipulation;
}

.module-card-icon {
    font-size: 32px;
    margin-bottom: 6px;
    display: block;
}

.module-card h3 {
    font-size: 13px;
    margin-bottom: 3px;
}

.module-card p {
    color: #586069;
    font-size: 11px;
    margin: 0;
}

.module-card.primary {
    border: 2px solid #0366d6;
}

.module-card.primary .module-card-icon {
    color: #0366d6;
}

.module-card.success {
    border: 2px solid #28a745;
}

.module-card.success .module-card-icon {
    color: #28a745;
}

.module-card.warning {
    border: 2px solid #f9826c;
}

.module-card.warning .module-card-icon {
    color: #f9826c;
}

/* empty state */
.empty-state {
    text-align: center;
    color: #586069;
    padding: 30px 0;
}

.empty-state-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 12px;
}

/* form max width */
.form-container {
    max-width: 600px;
    margin: 0 auto;
}

/* custom confirm dialog */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10103;
    opacity: 0;
    transition: opacity 0.2s;
}

.confirm-overlay.active {
    opacity: 1;
}

.confirm-dialog {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.2s;
}

.confirm-overlay.active .confirm-dialog {
    transform: scale(1);
}

.confirm-content {
    padding: 20px;
}

.confirm-message {
    font-size: 14px;
    color: #24292e;
    margin-bottom: 20px;
    line-height: 1.5;
}

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

.confirm-actions .btn-secondary {
    flex: 0 0 35%;
    text-align: center;
    min-height: 40px;
}

.confirm-actions .btn-danger {
    flex: 0 0 calc(65% - 8px);
    text-align: center;
    min-height: 40px;
}

/* utils */
small {
    font-size: 11px;
    color: #586069;
}

strong {
    font-weight: 600;
}

/* table wrapper для скролла на мобильных */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* actions column */
td .btn-sm {
    margin-right: 2px;
}

td .btn-sm:last-child {
    margin-right: 0;
}

/* скрываем колонки на мобильных */
@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }
}

/* responsive */
@media (max-width: 768px) {
    .container {
        padding: 8px;
    }
    .add-storage-new-form {
        margin-left: -20px;
  margin-right: -20px;
  margin: -20px;
    }
    table {
        font-size: 11px;
        min-width: 100%;
    }
    
    th, td {
        padding: 4px 6px;
        white-space: nowrap;
    }
    
    .btn {
        padding: 5px 10px;
        font-size: 14px;
        min-height: 48px;font-weight: 500;
    }
    
    .btn-sm {
        padding: 3px 6px;
        font-size: 10px;
        min-height: auto;
    }
    
    header h1 {
        font-size: 14px;
    }
    
    nav a {
        padding: 3px 8px;
        font-size: 11px;
    }
    
    .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .flex-between .btn {
        width: 100%;
        text-align: center;
    }
    
    /* fix zoom на iPhone при фокусе на input */
    input, select, textarea {
        font-size: 16px;
    }
    
    /* form actions на мобильных */
    #location-form-actions .btn,
    #location-edit-actions .btn,
    #item-form-actions .btn,
    #item-edit-actions .btn,
    #storage-form-actions .btn,
    #storage-edit-actions .btn,
    .confirm-actions .btn {
        padding: 12px;
        font-size: 14px;
        min-height: 48px;
    }
}

/* ===== QUICK EDIT MODAL ===== */

.quick-edit-container {
    background: white;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.quick-edit-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.quick-edit-header h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #24292e;
}

.quick-edit-header h3 .text-muted {
    font-weight: 400;
    font-size: 14px;
    color: #6a737d;
    margin-left: 8px;
}

.quick-edit-location {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #586069;
    font-size: 14px;
    margin-top: 4px;
}

.quick-edit-location i {
    color: #0366d6;
}

.quick-edit-location-description {
    margin-top: 4px;
    font-size: 12px;
    color: #6a737d;
    line-height: 1.4;
}

.quick-edit-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #586069;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.quick-edit-close:hover {
    background: #f6f8fa;
    color: #24292e;
}

.quick-edit-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.quick-edit-body {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
}

.quick-edit-field {
    margin-bottom: 16px;
}

.quick-edit-field label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #24292e;
    margin-bottom: 6px;
}

/* Количество с кнопками +/- */
.quick-edit-quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-edit-qty-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    background: #f6f8fa;
    color: #586069;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.quick-edit-qty-btn:hover {
    background: #fff;
    border-color: #0366d6;
    color: #0366d6;
}

.quick-edit-qty-btn:active {
    background: #f0f6fc;
}

#quick-edit-quantity {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
    font-weight: 600;
}

.quick-edit-unit,
.quick-edit-unit2 {
    color: #6a737d;
    font-size: 14px;
    margin-left: 4px;
}

.quick-edit-select,
.quick-edit-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.quick-edit-textarea {
    resize: vertical;
    min-height: 60px;
}

/* Фото */
.quick-edit-photos,
.quick-edit-item-photo {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.quick-edit-photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e1e4e8;
    transition: all 0.2s ease;
    cursor: pointer;
}

.quick-edit-photo-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.quick-edit-photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    background: rgba(220, 53, 69, 0.9);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.quick-edit-photo-item:hover .quick-edit-photo-delete {
    opacity: 1;
}

.quick-edit-photo-item.marked-for-delete {
    opacity: 0.4;
    filter: grayscale(100%);
    border-color: #d73a49;
}

.quick-edit-photo-item.marked-for-delete .quick-edit-photo-delete {
    opacity: 1;
    background: #d73a49;
}

.quick-edit-photo-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(3, 102, 214, 0.9);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 3px;
}

.quick-edit-hint {
    margin-top: 8px;
    font-size: 14px;
    color: #6a737d;
    line-height: 1.4;
}

/* Добавить фото */
.quick-edit-photo-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-edit-photo-buttons {
    display: flex;
    gap: 8px;
}

.quick-edit-photo-btn {
    padding: 10px 16px;
    background: #f6f8fa;
    border: 2px dashed #e1e4e8;
    border-radius: 6px;
    color: #586069;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: all 0.15s ease;
    flex: 1;
}

.quick-edit-photo-btn:hover {
    background: #fff;
    border-color: #0366d6;
    color: #0366d6;
}

/* Скрываем кнопку камеры на десктопе */
@media (min-width: 769px) {
    .quick-edit-photo-btn:last-child {
        display: none;
    }
    
    .quick-edit-photo-btn:first-child {
        flex: none;
        width: auto;
    }
}

.quick-edit-photo-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.quick-edit-photo-preview-item {
    position: relative;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
    background: #f6f8fa;
}

.quick-edit-photo-preview-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.quick-edit-photo-preview-name {
    padding: 4px 8px;
    font-size: 11px;
    color: #6a737d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-edit-photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(220, 53, 69, 0.9);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.2s;
}

.quick-edit-photo-remove:hover {
    background: #dc3545;
}

/* Footer */
.quick-edit-footer {
    padding: 16px 24px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid #e1e4e8;
    background: white;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
}

/* Мобильные адаптации */
@media (max-width: 768px) {
    .quick-edit-container {
        max-height: 100vh;
        max-height: 100dvh;
    }
    
    .quick-edit-header {
        padding: 16px;
    }
    
    .quick-edit-body {
        padding: 16px;
        padding-bottom: 80px;
    }
    
    .quick-edit-footer {
        position: sticky;
        bottom: 0;
        flex-direction: row;
        gap: 8px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 20px));
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        z-index: 10;
        justify-content: space-between;
    }
    
    .quick-edit-footer .btn-danger {
        flex: 0 0 auto;
        min-height: 44px;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .quick-edit-footer > div {
        flex: 1;
        display: flex;
        gap: 8px;
    }
    
    .quick-edit-footer .btn-primary {
        flex: 1;
        min-height: 44px;
    }
    
    .quick-edit-footer .btn-secondary {
        display: none;
    }
    
    .quick-edit-photo-btn {
        font-size: 13px;
        padding: 12px 10px;
        min-height: 44px;
    }
    
    .quick-edit-qty-btn {
        width: 44px;
        height: 44px;
    }
}

/* ===== PHOTO VIEWER ===== */

.photo-clickable {
    cursor: pointer;
    transition: opacity 0.2s;
}

.photo-clickable:hover {
    opacity: 0.85;
}

.photo-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10102;
}

.photo-viewer-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-viewer-image {
    width: 90vw;
    height: 90vh;
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.photo-viewer-close,
.photo-viewer-rotate,
.photo-viewer-save {
    position: absolute;
    top: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #24292e;
    transition: all 0.2s;
    z-index: 10001;
}

.photo-viewer-close {
    right: 20px;
}

.photo-viewer-close:hover {
    background: #fff;
    color: #d73a49;
    transform: scale(1.1);
}

.photo-viewer-rotate {
    right: 80px;
}

.photo-viewer-rotate:hover {
    background: #fff;
    color: #0366d6;
    transform: scale(1.1) rotate(90deg);
}

.photo-viewer-save {
    right: 140px;
    background: rgba(3, 102, 214, 0.9);
    color: white;
}

.photo-viewer-save:hover {
    background: #0366d6;
    transform: scale(1.1);
}

.photo-viewer-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Кнопки навигации между фото */
.photo-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
}

.photo-viewer-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.photo-viewer-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.photo-viewer-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.photo-viewer-nav:disabled:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%);
}

.photo-viewer-prev {
    left: 20px;
}

.photo-viewer-next {
    right: 20px;
}

/* Счетчик фото */
.photo-viewer-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10001;
}

@media (max-width: 768px) {
    .photo-viewer-close,
    .photo-viewer-rotate,
    .photo-viewer-save {
        width: 40px;
        height: 40px;
        font-size: 16px;
        top: 10px;
    }
    
    .photo-viewer-close {
        right: 10px;
    }
    
    .photo-viewer-rotate {
        right: 60px;
    }
    
    .photo-viewer-save {
        right: 110px;
    }
    
    /* Мобильные кнопки навигации */
    .photo-viewer-nav {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .photo-viewer-prev {
        left: 10px;
    }
    
    .photo-viewer-next {
        right: 10px;
    }
    
    .photo-viewer-counter {
        bottom: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* qr scanner */
#qr-demo-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 12px;
}

#qr-demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
}

#qr-demo-header h1 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

/* настройки */
#qr-settings {
    margin-bottom: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
}

#qr-settings-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.qr-setting-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qr-setting-group label {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    text-transform: uppercase;
}

#current-size-label {
    font-size: 11px;
    font-weight: 500;
    color: #0366d6;
    text-transform: none;
    margin-left: 4px;
}

.qr-size-buttons {
    display: flex;
    gap: 6px;
}

.qr-size-btn {
    flex: 1;
    padding: 8px 6px;
    background: #f3f4f6;
    color: #586069;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    touch-action: manipulation;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}

.qr-size-btn small {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.8;
    margin-top: 2px;
}

.qr-size-btn:hover {
    background: #e1e4e8;
    color: #1a1a1a;
}

.qr-size-btn.qr-active {
    background: #0366d6;
    color: #fff;
    border-color: #0366d6;
    font-weight: 600;
}

.qr-size-btn.qr-active small {
    opacity: 1;
}

.qr-select {
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    font-size: 12px;
    background: #fff;
    color: #1a1a1a;
    touch-action: manipulation;
}

.qr-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #6a737d;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 3px;
}

.qr-hint i {
    color: #0366d6;
}

/* подсказки */
#qr-tips {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 3px;
}

.qr-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #856404;
}

.qr-tip i {
    color: #ffc107;
    font-size: 14px;
    flex-shrink: 0;
}

.qr-tip-important {
    background: #fff3cd;
    border: 1px solid #ffc107;
    font-weight: 600;
    padding: 8px;
}

.qr-tip-important i {
    font-size: 16px;
}

.qr-btn-primary {
    background: #0366d6;
    color: #fff;
    padding: 8px 16px;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
    touch-action: manipulation;
}

.qr-btn-primary:hover {
    background: #0256c7;
}

.qr-btn-primary.qr-btn-active {
    background: #d73a49;
}

.qr-btn-primary.qr-btn-active:hover {
    background: #cb2431;
}

.qr-btn-secondary {
    background: #6a737d;
    color: #fff;
    padding: 8px 16px;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
    touch-action: manipulation;
}

.qr-btn-secondary:hover {
    background: #586069;
}

.qr-btn-small {
    background: #f3f4f6;
    color: #586069;
    padding: 4px 8px;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
    touch-action: manipulation;
}

.qr-btn-small:hover {
    background: #e1e4e8;
    color: #1a1a1a;
}

#qr-scanner-container {
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    padding: 12px;
}

#qr-reader {
    width: 100%;
    border-radius: 3px;
    overflow: hidden;
}

#qr-reader video {
    border-radius: 3px;
}

#qr-instructions {
    margin-top: 12px;
}

.qr-instruction-box {
    background: #e7f3ff;
    border: 2px solid #0366d6;
    border-radius: 3px;
    padding: 12px;
}

.qr-instruction-box h4 {
    font-size: 13px;
    font-weight: 600;
    color: #0366d6;
    margin: 0 0 8px 0;
}

.qr-instruction-box ol {
    margin: 0;
    padding-left: 20px;
    font-size: 12px;
    color: #1a1a1a;
    line-height: 1.6;
}

.qr-instruction-box li {
    margin-bottom: 6px;
    line-height: 1.5;
}

.qr-instruction-box ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: circle;
}

.qr-instruction-box strong {
    color: #0366d6;
    font-weight: 600;
}

#qr-results {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    padding: 12px;
    transition: border 0.3s ease;
}

#qr-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e1e4e8;
}

#qr-results-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

#qr-results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qr-result-item {
    padding: 10px;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    background: #f8f9fa;
    font-size: 12px;
}

.qr-result-item.qr-result-valid {
    border-left: 3px solid #28a745;
    background: #f0fff4;
}

.qr-result-item.qr-result-invalid {
    border-left: 3px solid #ffa500;
    background: #fff9f0;
}

.qr-result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.qr-result-valid .qr-result-header i {
    color: #28a745;
}

.qr-result-invalid .qr-result-header i {
    color: #ffa500;
}

.qr-result-type {
    font-weight: 600;
    color: #1a1a1a;
    text-transform: uppercase;
    font-size: 11px;
}

.qr-result-time {
    margin-left: auto;
    color: #6a737d;
    font-size: 11px;
}

.qr-result-code {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #1a1a1a;
    margin-bottom: 4px;
    word-break: break-all;
}

.qr-result-id {
    font-size: 11px;
    color: #6a737d;
}

/* log */
#qr-log {
    margin-top: 16px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    padding: 12px;
}

#qr-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e1e4e8;
}

#qr-log-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

#qr-log-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.qr-log-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 3px;
    font-size: 11px;
    background: #f8f9fa;
}

.qr-log-time {
    font-family: 'Courier New', monospace;
    color: #6a737d;
    font-size: 10px;
    min-width: 60px;
}

.qr-log-message {
    flex: 1;
    color: #1a1a1a;
}

.qr-log-item i {
    font-size: 12px;
}

.qr-log-info {
    background: #f0f6ff;
    border-left: 2px solid #0366d6;
}

.qr-log-info i {
    color: #0366d6;
}

.qr-log-success {
    background: #f0fff4;
    border-left: 2px solid #28a745;
}

.qr-log-success i {
    color: #28a745;
}

.qr-log-warning {
    background: #fff9f0;
    border-left: 2px solid #ffa500;
}

.qr-log-warning i {
    color: #ffa500;
}

.qr-log-error {
    background: #fff0f0;
    border-left: 2px solid #d73a49;
}

.qr-log-error i {
    color: #d73a49;
}

/* mobile */
@media (max-width: 768px) {
    #qr-demo-page {
        padding: 8px;
    }

    #qr-demo-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
        padding: 10px;
    }

    #qr-demo-header h1 {
        text-align: center;
    }

    .qr-btn-primary,
    .qr-btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
        min-height: 44px;
    }

    #qr-settings {
        padding: 10px;
    }

    .qr-size-buttons {
        flex-wrap: wrap;
    }

    .qr-size-btn {
        flex: 1 1 calc(33.333% - 4px);
        min-width: 0;
        padding: 8px 4px;
        min-height: 50px;
        font-size: 11px;
    }
    
    .qr-size-btn small {
        font-size: 9px;
    }
    
    #qr-instructions {
        margin-top: 8px;
    }
    
    .qr-instruction-box {
        padding: 10px;
    }
    
    .qr-instruction-box h4 {
        font-size: 12px;
    }
    
    .qr-instruction-box ol {
        font-size: 11px;
        padding-left: 18px;
    }
    
    .qr-instruction-box li {
        margin-bottom: 5px;
    }

    #qr-tips {
        padding: 10px;
    }

    .qr-tip {
        font-size: 11px;
    }

    #qr-scanner-container {
        padding: 8px;
    }

    #qr-results {
        padding: 8px;
    }

    #qr-results-header {
        padding-bottom: 6px;
    }

    .qr-result-item {
        padding: 8px;
    }

    #qr-log {
        margin-top: 12px;
        padding: 8px;
    }

    #qr-log-header {
        padding-bottom: 6px;
    }

    #qr-log-list {
        max-height: 200px;
    }

    .qr-log-item {
        padding: 4px 6px;
        font-size: 10px;
    }

    .qr-log-time {
        min-width: 55px;
        font-size: 9px;
    }
}

/* iOS PWA специфичные правила */
@supports (-webkit-touch-callout: none) {
    /* все iOS устройства */
    html {
        height: 100%;
        height: -webkit-fill-available;
    }
    
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
        min-height: 100dvh;
    }
    
    .container-fluid {
        height: 100vh;
        height: -webkit-fill-available;
        height: 100dvh;
    }
}

/* iOS PWA standalone mode - убираем bounce эффект */
@media all and (display-mode: standalone) {
    html {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    body {
        overflow-y: scroll;
        position: relative;
        -webkit-overflow-scrolling: touch;
    }
}

