/* Общие стили — адаптивная вёрстка, mobile-first */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    font-size: 16px;
    line-height: 1.5;
    color: #1a1a1a;
    overflow-x: hidden;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Страница входа — как в проекте cargo */
.login-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

.login-container h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
}

.login-container .error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #fcc;
}

.login-container .success {
    background: #efe;
    color: #3c3;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #cfc;
}

.login-container .form-group {
    margin-bottom: 20px;
}

.login-container label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.login-container .password-wrapper {
    position: relative;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.login-container .password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.login-container .password-toggle:hover {
    color: #667eea;
}

.login-container input[type="text"]:focus,
.login-container input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
}

.login-container button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.login-container button[type="submit"]:hover {
    background: #5568d3;
}

.login-container .password-reset-link {
    text-align: center;
    margin-top: 15px;
}

.login-container .password-reset-link a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}

.login-container .password-reset-link a:hover {
    text-decoration: underline;
}

.login-container .password-reset-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.login-container .password-reset-form a {
    display: block;
    text-align: center;
    margin-top: 10px;
    color: #667eea;
    text-decoration: none;
}

/* Шапка — как в проекте cargo, без переключателя языков */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

.header-left {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.header-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.header-button {
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    -webkit-appearance: none;
    appearance: none;
}

.header-button:hover {
    background: rgba(255,255,255,0.3);
    color: white;
}

.header-button-icon {
    font-size: 16px;
}

.notif-badge {
    background: #dc2626;
    color: #fff;
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.25rem;
}

/* Фиксированный футер для официанта и повара (не скроллится) */
.has-role-footer .main-content {
    padding-bottom: 80px;
}

.role-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

.role-footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #4b5563;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.role-footer-item:hover {
    background: #f3f4f6;
    color: #667eea;
}

.role-footer-item--center {
    position: relative;
}

.role-footer-icon {
    font-size: 22px;
    margin-bottom: 2px;
    display: block;
}

.role-footer-icon--bell {
    font-size: 24px;
}

.role-footer-label {
    line-height: 1.2;
}

.role-footer-badge {
    position: absolute;
    top: -2px;
    right: 50%;
    transform: translate(50%, -50%);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    border-radius: 10px;
    border: 2px solid #fff;
}

/* Контент */
.main-content {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

.page-title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    color: #333;
}

/* Сетки и карточки */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 30px;
    margin-bottom: 1rem;
}

.card h2 {
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 600px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Кнопки и формы */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: background 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-export-excel {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
    text-decoration: none;
    padding: 0 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    height: 38px;
    box-sizing: border-box;
    transition: background 0.3s, border-color 0.3s;
}

.btn-export-excel:hover {
    background: #28a745;
    color: #fff;
    border-color: #218838;
}

/* Период в статистике: одна высота для полей дат, кнопки «Применить» и «Выгрузить» */
.stats-period-nav .input-cafe {
    height: 38px;
    box-sizing: border-box;
}

.stats-period-nav .btn {
    height: 38px;
    box-sizing: border-box;
    padding: 0 1rem;
    display: inline-flex;
    align-items: center;
}

.btn-secondary {
    background: #e5e7eb;
    color: #1a1a1a;
}

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

.btn-danger {
    background: #dc3545;
    color: white;
}

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

/* Модальное окно уведомлений (успех/ошибка) — единый стиль по проекту */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 16px;
    box-sizing: border-box;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 24px 28px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    box-sizing: border-box;
}

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

.modal-message {
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.5;
    text-align: center;
}

.modal-success .modal-message {
    color: #155724;
}

.modal-error .modal-message {
    color: #721c24;
}

.modal-success .modal-content {
    border-top: 4px solid #28a745;
}

.modal-error .modal-content {
    border-top: 4px solid #dc3545;
}

.modal-ok-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.modal-ok-btn:hover {
    background: #5568d3;
}

/* Модальное окно подтверждения (две кнопки: Отмена / OK) */
.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 20px;
}

.modal-actions .modal-ok-btn {
    flex: 1;
}

.modal-actions .modal-cancel-btn {
    flex: 1;
    padding: 12px;
    background: #e5e7eb;
    color: #1a1a1a;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.modal-actions .modal-cancel-btn:hover {
    background: #d1d5db;
}

@media (max-width: 480px) {
    .modal-content {
        padding: 20px 24px;
        max-width: none;
        margin: 0 8px;
    }
    .modal-message {
        font-size: 15px;
        margin-bottom: 18px;
    }
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Обёртка и кнопка показа пароля в формах (управление пользователями и др.) */
.page-container .password-wrapper {
    position: relative;
    display: block;
}

.page-container .password-wrapper input {
    padding-right: 44px;
    box-sizing: border-box;
}

.page-container .password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 4px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.page-container .password-toggle:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.08);
}

/* Обёртка для горизонтального скролла таблиц на мобильных */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.5rem 0;
}

/* Столы и QR: форма добавления стола */
.table-add-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* Общий вид полей ввода (как на вкладке QR) */
.input-cafe {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.input-cafe:focus {
    outline: none;
    border-color: #667eea;
}

.input-cafe::placeholder {
    color: #94a3b8;
}

/* Ревизия: форма списания — поля в одну строку, фиксированная ширина */
.revision-writeoff-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.revision-writeoff-form .input-cafe[name="quantity"] {
    width: 7em;
    min-width: 7em;
    flex-shrink: 0;
}

.revision-writeoff-form .input-cafe[name="reason"] {
    flex: 1;
    min-width: 0;
}

.revision-writeoff-form .btn {
    flex-shrink: 0;
}

.table-add-form .table-name-input {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    min-width: 200px;
    max-width: 320px;
    transition: border-color 0.2s;
}

.table-add-form .table-name-input:focus {
    outline: none;
    border-color: #667eea;
}

.table-add-form .table-name-input::placeholder {
    color: #94a3b8;
}

/* Столы и QR: редактирование в строке таблицы */
.table-qr-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.table-qr-actions form.table-update-form {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.table-qr-actions .table-name-input {
    flex: 1;
    min-width: 0;
    max-width: none;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.table-qr-actions .table-name-input:focus {
    outline: none;
    border-color: #667eea;
}

.table-qr-actions .table-name-input::placeholder {
    color: #94a3b8;
}

.table-qr-actions .btn-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.table-qr-actions .btn-group form.table-delete-form {
    display: inline-flex;
    align-items: center;
}

/* «Сохранить» и «Печать QR» — одинаковая ширина и высота */
.table-qr-actions .btn-group .btn-secondary,
.table-qr-actions .btn-group a.btn-secondary {
    width: 8rem;
    min-width: 8rem;
    height: 36px;
    padding: 0 0.75rem;
    text-align: center;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.table-qr-actions .btn-group a.btn {
    text-decoration: none;
}

.table-qr-actions .btn {
    flex-shrink: 0;
}

.table-delete-form {
    display: inline-flex;
    align-items: center;
}

.btn-icon-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: #fee2e2;
    color: #dc2626;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-icon-delete:hover {
    background: #dc2626;
    color: white;
}

.btn-icon-delete svg {
    display: block;
}

/* Техническая карта (админ): аккуратные формы */
.tc-unit-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.tc-unit-form input[type="text"] {
    width: 400px;
    max-width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.tc-units-list {
    margin-top: 0.5rem;
    color: #64748b;
    font-size: 0.95rem;
}

.table-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
}

.table-inline-form input[type="text"],
.table-inline-form select {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    max-width: 260px;
}

.table-inline-form button {
    white-space: nowrap;
}

/* В таблицах: название тянется, селект + кнопка справа */
.table-inline-form input[type="text"] {
    flex: 1 1 320px;
    max-width: none;
}

.table-inline-form select {
    flex: 0 0 auto;
    margin-left: auto;
}

table {
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #667eea;
}

tr:hover {
    background: #f8f9fa;
}

/* Цены на блюда: широкая колонка «Блюдо», действия в конце строки */
.dish-prices-table .dish-prices-col-name {
    min-width: 280px;
    width: 45%;
}
.dish-prices-table .dish-prices-col-actions {
    text-align: right;
    white-space: nowrap;
}
.dish-prices-table .dish-prices-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    margin-left: auto;
}
.dish-prices-table .dish-prices-form .input-cafe {
    width: 100px;
    box-sizing: border-box;
}

/* Навигация по разделам */
.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #ddd;
    flex-wrap: wrap;
}

.nav-tabs a {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
}

.nav-tabs a:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.nav-tabs a.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

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

.dashboard-card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    text-decoration: none;
}

.dashboard-card h2 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 24px;
    line-height: 1.25;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-card.positive {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.stat-card.negative {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
}

.stat-card.warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
}

.stat-card h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    opacity: 0.9;
    font-weight: 500;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-card .sub-value {
    font-size: 14px;
    opacity: 0.8;
}

.stats-period-nav a {
    color: #2563eb;
    text-decoration: none;
}

.stats-period-nav a:hover {
    text-decoration: underline;
}

.stats-period-nav a.active {
    font-weight: 600;
    color: #667eea;
}

/* Page container */
.page-container {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #ddd;
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    color: #666;
}

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

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

/* Блюда и рецептура — карточки меню */
.menu-dishes-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dish-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.06);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.dish-card:hover {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.12);
    border-color: #c7d2fe;
}

.dish-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.dish-card-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: #334155;
}

.dish-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

.dish-card-meta .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dish-card-meta .badge-available {
    background: #d1fae5;
    color: #065f46;
}

.dish-card-meta .badge-unavailable {
    background: #fee2e2;
    color: #991b1b;
}

.dish-card-image {
    max-width: 72px;
    max-height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.dish-card-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.dish-card-form input[type="text"],
.dish-card-form input[type="number"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
}

.dish-card-form label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    color: #475569;
}

.dish-recipe-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

.dish-recipe-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.25rem;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 0.9rem;
}

.dish-recipe-item:hover {
    background: #e2e8f0;
}

.dish-recipe-item .remove-btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
    min-width: auto;
}

.dish-add-recipe-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e2e8f0;
}

.dish-add-recipe-form select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 120px;
}

.dish-add-recipe-form input[type="number"] {
    width: 80px;
    padding: 0.4rem 0.6rem;
}

.menu-add-form .form-group {
    display: grid;
    gap: 0.75rem;
    max-width: 360px;
}

.menu-hint {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.waiter-no-dishes-hint {
    font-size: 0.95rem;
    color: #b45309;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #fffbeb;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
}

.cook-orders-hint {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 1rem;
}

/* User management styles */
.user-item {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.user-item:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.user-info {
    flex: 1;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.user-info-item {
    font-size: 14px;
}

.user-info-item strong {
    color: #667eea;
    margin-right: 5px;
    font-weight: 600;
}

.user-actions {
    display: flex;
    gap: 10px;
}

.btn-edit {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
    font-size: 14px;
}

.btn-edit:hover {
    background: #5568d3;
}

.btn-delete {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
    font-size: 14px;
}

.btn-delete:hover {
    background: #c82333;
}

/* Report styles */
.report-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 5px;
}

.report-controls label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.report-controls input,
.report-controls select {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.report-table th,
.report-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.report-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #667eea;
}

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

/* Отчёты: форма с выбором вида и дат */
.report-controls-v2 {
    margin-bottom: 16px;
}

.report-form-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.report-form-inline label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.report-form-inline .report-label {
    font-weight: 500;
    color: #475569;
}

.report-form-inline .input-cafe,
.report-form-inline .report-select {
    height: 38px;
    box-sizing: border-box;
    min-width: 140px;
}

.report-form-inline .report-select {
    min-width: 160px;
}

.report-form-inline .btn {
    height: 38px;
    box-sizing: border-box;
    padding: 0 1rem;
    display: inline-flex;
    align-items: center;
}

/* Одна строка: вид отчёта растянут, даты и кнопка справа */
.report-form-one-row {
    flex-wrap: nowrap;
}
.report-form-one-row .report-type-cell {
    flex: 1;
    min-width: 0;
}
.report-form-one-row .report-type-cell .report-select {
    flex: 1;
    min-width: 120px;
    width: 100%;
}
.report-form-one-row .report-date-cell {
    flex-shrink: 0;
}

.report-form-one-row .report-export-cell {
    flex-shrink: 0;
}

.report-period-caption {
    margin: -8px 0 20px;
    color: #64748b;
    font-size: 0.95rem;
}

.report-description {
    margin: 0 0 16px;
    padding: 10px 14px;
    background: #f1f5f9;
    border-radius: 8px;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.45;
}

.cash-info-block {
    margin: 0 0 20px;
    padding: 12px 16px;
    background: #f1f5f9;
    border-radius: 8px;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.5;
}

.cash-balance-display {
    text-align: center;
    margin: 16px 0;
}

.cash-balance-amount {
    font-size: 2.5rem;
    font-weight: 700;
}

.cash-balance-amount.cash-balance-positive {
    color: #15803d;
}

.cash-balance-amount.cash-balance-negative {
    color: #b91c1c;
}

.cash-balance-meta {
    text-align: center;
    color: #64748b;
    font-size: 0.95rem;
    margin-top: 0;
}

/* Блок «Закрыть кассу» и «Передать деньги» — центрирование каждой строки */
.cash-actions-block {
    text-align: center;
    margin-top: 1rem;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

.cash-actions-block .cash-close-form {
    margin-bottom: 1.25rem;
}

.cash-actions-block .cash-close-form .btn {
    display: inline-block;
}

.cash-actions-block .cash-actions-title {
    margin: 0 0 1rem;
    text-align: center;
}

.cash-transfer-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

/* Строка = подпись + поле: общий левый край, блок по центру страницы */
.cash-transfer-form .cash-transfer-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    max-width: 320px;
}

.cash-transfer-form .cash-transfer-label-text {
    flex-shrink: 0;
    width: 82px;
    text-align: right;
}

.cash-transfer-form .cash-transfer-input-amount {
    width: 140px;
    box-sizing: border-box;
}

.cash-transfer-form .cash-transfer-input-desc {
    width: 220px;
    box-sizing: border-box;
}

.cash-transfer-form .cash-transfer-submit {
    margin-top: 0.25rem;
}

/* Блок «Касса закрыта» — центрирование */
.cash-open-block {
    text-align: center;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
}

.cash-open-block .cash-open-status {
    margin-bottom: 1rem;
}

.cash-open-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.cash-open-form .cash-open-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.cash-open-form .cash-open-label-text {
    min-width: 120px;
    text-align: right;
}

.cash-open-form .input-cafe {
    width: 140px;
    box-sizing: border-box;
}

.cash-open-form .cash-open-submit {
    margin-top: 0.25rem;
}

.report-extra-card {
    margin-top: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.report-orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.report-block {
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-accepted { background: #fff3cd; color: #856404; }
.status-sent { background: #d1ecf1; color: #0c5460; }
.status-customs_processed { background: #d4edda; color: #155724; }
.status-arrived_kg { background: #cfe2ff; color: #084298; }
.status-delivered { background: #d1e7dd; color: #0f5132; }

/* Mobile responsive */
@media (max-width: 768px) {
    .header {
        padding: 10px 12px;
        padding-top: max(10px, env(safe-area-inset-top));
    }

    .header-content {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: space-between;
    }

    .header-left,
    .header-right {
        flex: 0 0 auto;
        justify-content: flex-start;
        flex-wrap: nowrap;
    }

    .header-right {
        justify-content: flex-end;
    }

    .header-button {
        flex: 0 0 auto;
        text-align: center;
        min-width: 0;
        padding: 8px 10px;
        font-size: 13px;
    }

    .header-button-icon {
        font-size: 14px;
    }

    .main-content {
        padding: 0 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .has-role-footer .main-content {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    .page-container {
        padding: 15px;
    }

    .card {
        padding: 18px;
    }

    .nav-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        margin-bottom: 20px;
        padding-bottom: 4px;
        border-bottom: 2px solid #ddd;
    }

    .nav-tabs a {
        flex: 0 0 auto;
        padding: 8px 14px;
        font-size: 14px;
        white-space: nowrap;
    }

    .role-footer {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .user-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .user-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 8px 10px;
    }

    .header-button {
        padding: 6px 8px;
        font-size: 12px;
    }

    .header-button-icon {
        font-size: 12px;
    }

    .login-container {
        padding: 1.25rem;
    }

    .card {
        padding: 14px;
    }

    .page-container {
        padding: 12px;
    }

    .main-content {
        margin: 12px auto;
    }

    .stat-card .value {
        font-size: 24px;
    }

    .dashboard-card {
        padding: 20px;
    }

    .dashboard-card .icon {
        font-size: 40px;
    }

    .dashboard-card h2 {
        font-size: 18px;
    }

    th, td {
        padding: 10px 8px;
        font-size: 14px;
    }
}
