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

html {
    scroll-behavior: smooth;
}

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;
    -webkit-tap-highlight-color: transparent;
}

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;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.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--tz {
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.login-tagline {
    text-align: center;
    font-size: 13px;
    color: #64748b;
    line-height: 1.45;
    margin: -18px 0 22px;
    font-weight: 500;
}

.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;
}

.msg {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.msg.success {
    background: #f0fdf4;
    color: #166534;
    border-left: 4px solid #22c55e;
}
.msg.error {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

.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;
}

.header-nav-burger {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, transform 0.15s;
}

.header-nav-burger:hover {
    background: rgba(255, 255, 255, 0.32);
}

.header-nav-burger[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.38);
}

.header-help-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s, transform 0.15s;
}

.header-help-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(1.06);
}

.nav-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
}

.nav-drawer-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: min(320px, 92vw);
    max-height: 100vh;
    max-height: 100dvh;
    background: #fff;
    z-index: 2001;
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.18);
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
}

.nav-drawer.is-open {
    transform: translateX(0);
}

.nav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
}

.nav-drawer-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #475569;
}

.nav-drawer-close:hover {
    background: #e2e8f0;
}

.nav-drawer-links {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
}

.nav-drawer-links a {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: #334155;
    font-weight: 500;
    font-size: 15px;
    transition: background 0.15s;
}

.nav-drawer-links a:hover {
    background: #f1f5f9;
    color: #4f46e5;
}

.help-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.help-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.help-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 420px;
    width: 100%;
    padding: 22px 24px 20px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
    transform: scale(0.96);
    transition: transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.help-modal-overlay.is-open .help-modal {
    transform: scale(1);
}

.help-modal h2 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: #0f172a;
}

.help-modal p {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.55;
    color: #475569;
}

.help-modal .btn {
    width: 100%;
}

.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: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border-radius: 50px;
    padding: 10px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    border: 1px solid #e5e7eb;
}

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

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

.role-footer-item--center {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.role-footer-icon-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 6px;
}

.role-footer-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.role-footer-item:hover .role-footer-icon {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

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

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

.role-footer-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    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: 50%;
    border: 2px solid #fff;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.page-title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    color: #333;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.page-title-count {
    color: #64748b;
    font-weight: 500;
}

/* Сетки и карточки */
.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;
}

.finance-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 640px) {
    .finance-kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.finance-kpi {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.finance-kpi-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.finance-kpi strong {
    font-size: 1.25rem;
    color: #0f172a;
    font-weight: 700;
}

.text-muted-dashboard {
    color: #64748b;
    font-size: 14px;
    margin: 0;
}

.dashboard-notes-list {
    margin: 0;
    padding-left: 1.25rem;
    line-height: 1.55;
}

.dashboard-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
}

.dashboard-quick-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: #0f172a;
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.dashboard-quick-tile:hover {
    border-color: #a5b4fc;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
    color: #312e81;
}

.dashboard-quick-title {
    font-weight: 700;
    font-size: 15px;
}

.dashboard-quick-hint {
    font-size: 12px;
    color: #64748b;
    line-height: 1.35;
}

.data-table.dashboard-batches {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table.dashboard-batches th,
.data-table.dashboard-batches td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table.dashboard-batches thead th {
    background: #f1f5f9;
    font-weight: 600;
    color: #475569;
}

.stage-pill {
    display: inline-block;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
}

.stage-growing {
    background: #dbeafe;
    color: #1e40af;
}

.stage-slaughter {
    background: #fee2e2;
    color: #991b1b;
}

.stage-cutting {
    background: #fef3c7;
    color: #92400e;
}

.stage-ready {
    background: #d1fae5;
    color: #065f46;
}

.stage-closed {
    background: #e2e8f0;
    color: #475569;
}

.dashboard-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.menu-settings-lead {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
    max-width: 720px;
    margin: 0 0 16px;
}

.menu-settings-card .form-hint {
    font-size: 13px;
    color: #64748b;
    margin: 6px 0 0;
}

.menu-settings-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
}

.menu-settings-fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px 12px;
    margin: 16px 0;
    background: #fafafa;
}

.menu-settings-legend {
    font-weight: 700;
    font-size: 14px;
    color: #334155;
    padding: 0 8px;
}

.menu-settings-group-hint {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 10px;
}

.menu-settings-check {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    cursor: pointer;
    font-size: 14px;
}

.menu-settings-key {
    margin-left: auto;
    color: #94a3b8;
}

.menu-settings-submit {
    margin-top: 8px;
}

/* Настройки меню: порядок как у вкладки «Порядок разделов» в админ-настройках */
.admin-panel-order-item.menu-settings-order-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    cursor: grab;
}

.menu-settings-order-text {
    flex: 1 1 200px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-settings-order-key {
    font-size: 12px;
    color: #64748b;
    font-weight: 400;
}

.menu-settings-row-hide {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.menu-settings-row-hide input {
    cursor: pointer;
}

.admin-panel-order-item.menu-settings-order-item .admin-panel-order-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.menu-settings-order-hint {
    margin: 0 0 12px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.45;
}

.menu-settings-order-groups.menu-settings-visibility-groups {
    margin-top: 24px;
}

.menu-settings-visibility-section .menu-settings-visibility-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #64748b;
    line-height: 1.45;
}

ul.menu-settings-visibility-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-settings-visibility-list--legend .menu-settings-visibility-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.menu-settings-visibility-list--legend .menu-settings-visibility-row:last-child {
    border-bottom: none;
}

.menu-settings-visibility-text {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    color: #334155;
}

.menu-settings-visibility-code {
    font-size: 12px;
    color: #94a3b8;
}

.menu-settings-legend-note {
    margin: 14px 0 0;
    font-size: 13px;
    line-height: 1.45;
}

.menu-settings-saved-banner {
    margin: 0 0 16px;
    padding: 12px 14px;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    color: #065f46;
}

.menu-settings-row-pinned {
    margin: 0 8px 0 12px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    user-select: none;
}

.menu-quick-links {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.menu-quick-group-title {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 8px;
}

.menu-quick-group-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Структура экранов по пунктам ТЗ */
.tz-module-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.tz-module-lead {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 20px;
    max-width: 900px;
}

.tz-module-header {
    margin: 0;
}

.tz-module-page-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
}

.tz-module-page-heading-text {
    flex: 1 1 auto;
    min-width: 0;
    order: 0;
}

.tz-module-page-heading .chicken-help-details--module {
    flex-shrink: 0;
    order: -1;
}

.chicken-help-details--module .chicken-help-summary {
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-size: 15px;
}

.chicken-heading-with-help {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
}

.chicken-heading-with-help > span {
    flex: 1 1 auto;
    min-width: 0;
    order: 0;
}

.chicken-heading-with-help .chicken-help-details--inline {
    flex-shrink: 0;
    order: -1;
}

.tz-nav-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    list-style: none;
}

.tz-nav-toc a {
    font-size: 13px;
    font-weight: 600;
    color: #4f46e5;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
}

.tz-nav-toc a:hover {
    background: #eef2ff;
    text-decoration: none;
}

.tz-block {
    margin-bottom: 8px;
}

.tz-block-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #64748b;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e2e8f0;
}

.tz-block-title span {
    color: #94a3b8;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

h2.tz-block-title.tz-block-title--with-help {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 10px;
}

h2.tz-block-title.tz-block-title--with-help .tz-block-title-text {
    flex: 1 1 auto;
    min-width: 0;
    order: 0;
}

h2.tz-block-title.tz-block-title--with-help .chicken-help-details--inline {
    flex-shrink: 0;
    align-self: center;
    order: -1;
}

h3.farm-subcard-title-with-help,
h3.agent-subcard-title-with-help {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    font-size: 1rem;
    margin: 0 0 10px;
    font-weight: 700;
    color: #0f172a;
}

h3.farm-subcard-title-with-help > span,
h3.agent-subcard-title-with-help > span {
    flex: 1 1 auto;
    min-width: 0;
    order: 0;
}

h3.farm-subcard-title-with-help .chicken-help-details--inline,
h3.agent-subcard-title-with-help .chicken-help-details--inline {
    flex-shrink: 0;
    order: -1;
}

.tz-hero-card {
    border: 2px solid #c7d2fe;
    background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.12);
}

.farm-schedule-grid {
    display: grid;
    gap: 14px;
}

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

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

.farm-schedule-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.farm-schedule-card.is-empty {
    border-style: dashed;
    background: #fafafa;
}

.farm-schedule-card h3 {
    margin: 0 0 8px;
    font-size: 15px;
    color: #0f172a;
}

.farm-schedule-meta {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 10px;
}

.farm-week-feed-days {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.farm-week-feed-day {
    display: grid;
    grid-template-columns: minmax(120px, 140px) 1fr;
    gap: 8px 12px;
    align-items: start;
}

@media (max-width: 520px) {
    .farm-week-feed-day {
        grid-template-columns: 1fr;
    }
}

.farm-week-feed-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    padding-top: 6px;
}

.farm-week-feed-dayname {
    color: #334155;
}

.farm-week-feed-date {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
}

.farm-week-feed-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.4;
    resize: vertical;
    min-height: 44px;
}

.farm-week-feed-textarea:focus {
    outline: none;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Календарная сетка: расписание кормления по дням недели */
.farm-feed-week-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: #f1f5f9;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.farm-feed-week-toolbar__range {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.farm-feed-week-toolbar__hint {
    font-size: 12px;
    color: #64748b;
    font-weight: 400;
}

.farm-feed-week-toolbar__today {
    margin-left: auto;
}

@media (max-width: 640px) {
    .farm-feed-week-toolbar__today {
        margin-left: 0;
        flex: 1 1 100%;
        text-align: center;
    }
}

.farm-feed-cal-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.farm-feed-cal-inner {
    min-width: min(100%, 960px);
}

@media (max-width: 900px) {
    .farm-feed-cal-inner {
        min-width: 640px;
    }
}

.farm-feed-cal-head {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
}

.farm-feed-cal-head-cell {
    text-align: center;
    padding: 10px 4px 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 10px 10px 0 0;
    border-bottom: none;
}

.farm-feed-cal-head-cell--weekend {
    background: linear-gradient(180deg, #faf5ff 0%, #f5f3ff 100%);
}

.farm-feed-cal-head-cell--today {
    border-color: #818cf8;
    box-shadow: inset 0 -3px 0 #6366f1;
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
}

.farm-feed-cal-head-abbr {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #64748b;
}

.farm-feed-cal-head-cell--today .farm-feed-cal-head-abbr {
    color: #4338ca;
}

.farm-feed-cal-head-date {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.15;
    color: #0f172a;
}

.farm-feed-cal-head-month {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
    text-transform: lowercase;
}

.farm-feed-cal-batches {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.farm-feed-batch-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.farm-feed-batch-bar__title {
    margin: 0;
    font-size: 16px;
    color: #0f172a;
}

.farm-feed-batch-bar__meta {
    font-size: 12px;
    color: #64748b;
}

.farm-feed-cal-row {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.farm-feed-cal-cell {
    min-width: 0;
}

.farm-feed-cal-cell--weekend .farm-feed-cal-textarea {
    background: #fafafa;
}

.farm-feed-cal-cell--today .farm-feed-cal-textarea {
    border-color: #a5b4fc;
    background: #f8faff;
}

.farm-feed-cal-textarea {
    min-height: 76px;
    font-size: 12px;
    line-height: 1.35;
    border-radius: 0 0 8px 8px;
    margin: 0;
}

.farm-feed-cal-save {
    width: 100%;
    margin-top: 12px;
}

.farm-schedule-card--calendar {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 14px 16px;
    background: #fff;
}

.tech-cards-detail {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tech-cards-detail th,
.tech-cards-detail td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.tech-cards-detail th {
    background: #f1f5f9;
    font-weight: 600;
}

.tech-per-bird {
    font-weight: 700;
    color: #4f46e5;
    white-space: nowrap;
}

.farm-stock-select-table input[type="number"] {
    width: 100%;
    max-width: 120px;
    box-sizing: border-box;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.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-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

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

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

/* Кнопки Excel: скачивание шаблона, выгрузка отчёта — единый стиль по всему приложению */
.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;
}

/* Панель «Заказы на складе» — поиск и кнопки */
.available-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}
.available-search-form #clientPhoneInput,
.available-search-form input[type="text"][name="search"] {
    padding: 8px 12px;
    border: 2px solid #c4b5fd;
    border-radius: 6px;
    min-width: 180px;
    flex: 1;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s, border-color 0.2s;
}
.available-search-form #clientPhoneInput:focus,
.available-search-form input[type="text"][name="search"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}
.available-toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Кнопка «Найти товары» — такой же размер, как «Выгрузить в Excel» */
.available-toolbar .btn-toolbar-equal {
    height: 38px;
    padding: 0 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.available-toolbar a.btn-toolbar-equal {
    text-decoration: none;
    min-height: 38px;
}

/* Период в статистике: одна высота для полей дат, кнопки «Применить» и «Выгрузить» */
.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;
}

/* Автодополнение продукта (списание, закуп, приём закупа, меню) */
.product-autocomplete-wrap { position: relative; display: inline-block; min-width: 200px; }
.product-autocomplete-wrap .product-autocomplete { width: 100%; min-width: 180px; box-sizing: border-box; }
.product-autocomplete-list { position: absolute; left: 0; top: 100%; z-index: 10; background: #fff; border: 1px solid #cbd5e1; border-top: none; border-radius: 0 0 6px 6px; max-height: 200px; overflow-y: auto; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); min-width: 100%; display: none; }
.product-autocomplete-list.show { display: block; }
.product-autocomplete-list [role="option"] { padding: 0.4rem 0.6rem; cursor: pointer; }
.product-autocomplete-list [role="option"]:hover, .product-autocomplete-list [role="option"].highlight { background: #f1f5f9; }
.product-autocomplete-wrap .product-unit-display { display: none; color: #475569; margin-left: 0.25rem; }
.product-autocomplete-wrap.product-selected .product-unit-display { display: inline; }

/* Подсказки адрес/склад (create order): список при первом фокусе */
.suggest-datalist-wrap { position: relative; display: block; width: 100%; }
.suggest-datalist-wrap > input[type="text"] { width: 100%; box-sizing: border-box; }
.suggest-datalist-list { position: absolute; left: 0; top: 100%; z-index: 20; background: #fff; border: 1px solid #cbd5e1; border-radius: 0 0 6px 6px; max-height: 220px; overflow-y: auto; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); min-width: 100%; box-sizing: border-box; display: none; }
.suggest-datalist-list.show { display: block; }
.suggest-datalist-list [role="option"] { padding: 0.45rem 0.65rem; cursor: pointer; font-size: 0.95rem; }
.suggest-datalist-list [role="option"]:hover, .suggest-datalist-list [role="option"].highlight { background: #f1f5f9; }

.form-hint { font-size: 0.9rem; color: #64748b; margin-bottom: 0.75rem; }

/* Модальное окно уведомлений (успех/ошибка) — единый стиль по проекту */
.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;
}

/* Модальное окно для просмотра фото */
.photo-modal-overlay {
    background: rgba(0, 0, 0, 0.92) !important;
    cursor: pointer;
    justify-content: center;
    align-items: center;
}
.photo-modal-overlay .photo-modal-inner {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 95vw;
    max-height: 95vh;
    cursor: default;
}
.photo-modal-overlay .photo-modal-inner img {
    max-width: 95vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 8px;
}
.photo-modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.photo-modal-close:hover,
.photo-modal-close:active {
    background: rgba(255, 255, 255, 0.25);
}

.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-content.modal-form {
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-form .modal-title {
    font-size: 1.25rem;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

/* Модальное окно редактирования — желтоватый фон, чтобы отличать от добавления */
.modal-form-edit {
    background: #fffbeb;
    border: 1px solid #fde68a;
    box-shadow: 0 10px 40px rgba(251, 191, 36, 0.15);
}

.modal-form-edit .modal-title {
    border-bottom-color: #fde68a;
}

/* Кнопки действий в таблице расходов — как в разделах Пользователи, Cargo */
.expense-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

.expense-actions .btn-edit {
    padding: 8px 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

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

.expense-actions .btn-delete {
    padding: 8px 14px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

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

/* Кнопка редактирования в таблице сотрудников */
.staff-btn-edit {
    padding: 8px 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

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

.staff-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}

.staff-btn-add {
    padding: 8px 14px;
    font-size: 13px;
}

/* Бонус/штраф — форма, причина в конце строки */
.bonus-penalty-form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.bonus-reason-cell {
    flex: 1 1 200px;
    min-width: 200px;
}

/* Бонусы и штрафы — панель фильтров (как расходы: блок «Найдено» с новой строки) */
.bp-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
}
.bp-filter-form {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}
.bp-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}
.bp-filter-item {
    flex: 0 0 auto;
}
.bp-filter-item label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #555;
}
.bp-filter-item select,
.bp-filter-item input {
    padding: 8px 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}
.bp-search-cell {
    flex: 1;
    min-width: 160px;
}
.bp-search-cell input {
    width: 100%;
    min-width: 160px;
    box-sizing: border-box;
}
.bp-buttons-cell {
    flex: 0 0 auto;
}
.bp-buttons {
    display: flex;
    gap: 8px;
}
.bp-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid #e8ecf1;
    box-sizing: border-box;
}
.bp-bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 0;
}

/* Кнопка удаления в таблице бонусов/штрафов — как в Расходах, Пользователях */
.bp-delete-one {
    padding: 8px 14px;
    background: #dc3545 !important;
    color: white !important;
    border: none !important;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.bp-delete-one:hover {
    background: #c82333 !important;
}

.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;
    }
    .modal-confirm-buttons {
        flex-direction: column;
    }
}

.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;
}

/* Финансовый учёт — выбор периода */
.finance-period-form {
    margin: 0;
}
.finance-period-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}
.finance-period-fields .form-group {
    margin: 0;
    flex: 0 0 auto;
}
.finance-period-fields .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
}
.finance-period-fields .form-group input[type="date"] {
    min-width: 172px;
    width: 172px;
    padding: 10px 12px;
    padding-right: 44px; /* место для иконки календаря */
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}
.finance-period-fields .form-group input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
}
.finance-period-submit {
    flex: 0 0 auto;
}
.finance-period-info {
    margin: 12px 0 0 0;
    color: #64748b;
    font-size: 0.9rem;
}
.finance-summary-card {
    transition: border-color 0.2s, background-color 0.2s;
}
.finance-summary-card:hover {
    border-color: #667eea !important;
    background-color: #f8fafc;
}
.finance-summary-card-active {
    border-color: #667eea !important;
    background-color: #eef2ff;
}

/* Цвета статуса оплаты */
.payment-status.payment-full { color: #16a34a; font-weight: 600; }
.payment-status.payment-partial { color: #ca8a04; font-weight: 600; }
.payment-status.payment-free { color: #6366f1; font-weight: 600; }
.payment-status.payment-discount { color: #d97706; font-weight: 600; }

/* Цвета статуса заказа в пути */
.order-status-transit.status-loaded { color: #2563eb; font-weight: 600; }
.order-status-transit.status-sent { color: #6366f1; font-weight: 600; }
.order-status-transit.status-arrived { color: #059669; font-weight: 600; }
.order-status-transit.status-on_delivery { color: #d97706; font-weight: 600; }

/* Индикаторная лампа статуса заказа (поиск и др.) */
.order-status-light { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.order-status-light .status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.order-status-light.status-new .status-dot { background: #3b82f6; }
.order-status-light.status-loaded .status-dot { background: #2563eb; }
.order-status-light.status-sent .status-dot { background: #6366f1; }
.order-status-light.status-arrived .status-dot { background: #059669; }
.order-status-light.status-on_delivery .status-dot { background: #d97706; }
.order-status-light.status-delivered .status-dot { background: #16a34a; }
@media (max-width: 480px) {
    .finance-period-fields .form-group input[type="date"] {
        min-width: 152px;
        width: 152px;
        padding-right: 40px;
    }
}

/* Расходы — форма добавления */
.expense-add-form {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.expense-add-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    align-items: end;
    width: 100%;
    box-sizing: border-box;
}
.expense-add-currency .expense-currency-select,
.expense-add-currency select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    box-sizing: border-box;
}
.expense-add-category {
    min-width: 0;
    width: 100%;
    position: relative;
    box-sizing: border-box;
}
.expense-add-category input {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    box-sizing: border-box;
}
.expense-add-amount input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}
.expense-add-date input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}
.expense-add-comment textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px 14px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 5px;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}
.expense-add-comment textarea:focus {
    outline: none;
    border-color: #667eea;
}
.expense-edit-form {
    max-width: 560px;
}
.expense-edit-form .expense-add-category input {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    box-sizing: border-box;
}
@media (max-width: 600px) {
    .expense-add-row {
        grid-template-columns: 1fr 1fr;
    }
    .expense-add-category {
        grid-column: 1 / -1;
    }
}
/* Кнопки формы в модальном окне — по центру */
.expense-modal-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Расходы: «Итого» внутри формы, второй ряд — не в одну линию с кнопками */
.expenses-toolbar {
    margin-bottom: 16px;
}
.expenses-toolbar .expenses-filter-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.expenses-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}
.expenses-filter-item {
    flex: 0 0 auto;
}
.expenses-filter-item label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #555;
}
.expenses-filter-item select,
.expenses-filter-item input {
    padding: 8px 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}
.expenses-filter-item select:focus,
.expenses-filter-item input:focus {
    outline: none;
    border-color: #667eea;
}
.expenses-filter-item input[type="date"] {
    min-width: 110px;
}
.expenses-search-cell {
    flex: 1 1 auto;
    min-width: 90px;
}
.expenses-search-cell input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.expenses-buttons-cell {
    flex: 0 0 auto;
    white-space: nowrap;
}
.expenses-buttons {
    display: flex;
    gap: 8px;
}
.expenses-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    padding-top: 10px;
    margin-top: 2px;
    border-top: 1px solid #e8ecf1;
    box-sizing: border-box;
}
.expenses-total {
    font-weight: 600;
    font-size: 1.1rem;
}
@media (max-width: 768px) {
    .expenses-filter-row {
        width: 100%;
    }
    .expenses-search-cell {
        flex: 1 1 auto;
        min-width: 90px;
    }
}

/* Создание заказа — секции и сетка */
.create-order-form {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
.create-order-form .form-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid #eee;
}
.create-order-form .form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.form-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #667eea;
    margin: 0 0 1rem;
    letter-spacing: 0.02em;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 1.5rem;
}
@media (min-width: 560px) {
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}
.form-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}
.create-order-form .btn-submit {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
}
.form-hint {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-top: 6px;
}

/* Телефоны: несколько номеров с кнопками + и × в одной строке */
.phone-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.phone-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.phone-row input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
}
.phone-add-inline {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f8fafc;
    color: #64748b;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.phone-add-inline:hover {
    background: #e2e8f0;
    color: #334155;
}
.phone-remove {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #64748b;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.phone-remove:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}
/* Скрыть крестик, когда остаётся только одно поле */
.phone-rows .phone-row:only-of-type .phone-remove {
    display: none;
}
.form-row-phones .form-group {
    min-width: 0;
}

/* Статус оплаты — кнопки в одну строку на всю ширину */
.payment-status-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
}
.payment-status-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font-size: 0.9rem;
    cursor: pointer;
}
.payment-status-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.payment-status-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

/* Выбор счёта для зачисления — кликабельные карточки с фото */
.account-select-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}
.account-select-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.account-select-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.account-select-card.active {
    border-color: #667eea;
    background: #f5f3ff;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}
.account-select-card-img {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    flex-shrink: 0;
}
.account-select-card-img img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}
.account-select-card-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    text-align: center;
    line-height: 1.2;
}
.account-select-card.active .account-select-card-name {
    color: #667eea;
}

.create-order-form .file-input {
    padding: 8px;
    font-size: 0.9rem;
}

.payment-notice-required {
    color: #dc2626;
}
.payment-notice-optional {
    font-size: 0.85em;
    color: #888;
    font-weight: normal;
}
.debt-display {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
}
.debt-display.debt-amount {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}
.debt-display.debt-zero {
    background: #f0fdf4;
    color: #166534;
    border-left: 4px solid #22c55e;
}
.debt-display.debt-overpaid {
    background: #eff6ff;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* Превью фото груза */
.photo-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}
.photo-preview-card {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    background: #f0f0f0;
}
.photo-preview-card img,
.photo-preview-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-preview-card-video {
    width: 140px;
    height: 100px;
}
.photo-preview-card video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.photo-preview-card img {
    width: 100%;
    height: 100%;
}
.photo-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.photo-preview-remove:hover {
    background: rgba(220, 38, 38, 0.9);
}

/* Загрузить в машину — раскрывающиеся строки (как в Cargo) */
.load-orders-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.load-order-item {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow 0.3s;
    background: #f8f9fa;
}
.load-order-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.load-order-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 15px;
    padding: 15px;
    align-items: center;
    cursor: pointer;
}
.load-order-check-wrap {
    margin: 0;
    display: flex;
    align-items: center;
    cursor: pointer;
}
.load-order-check-wrap input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}
.load-order-summary {
    display: flex;
    gap: 20px;
    font-size: 14px;
    flex-wrap: wrap;
    align-items: center;
}
.load-order-summary span {
    white-space: nowrap;
}
.load-order-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}
.btn-load-row {
    padding: 8px 16px;
    font-size: 14px;
}
.btn-expand-row {
    background: #6c757d;
    color: white;
    min-width: 40px;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.3s;
}
.btn-expand-row:hover {
    background: #5a6268;
}
.load-order-item.expanded .btn-expand-row,
.order-row-expandable.expanded .btn-expand-row {
    background: #495057;
}
.load-order-item.expanded .btn-expand-row:hover,
.order-row-expandable.expanded .btn-expand-row:hover {
    background: #3d4146;
}
.load-order-details {
    display: none;
    padding: 15px;
    border-top: 1px solid #ddd;
    background: white;
}
.load-order-details.active {
    display: block;
}
.load-order-details-content {
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.load-order-details-content p {
    margin: 6px 0;
}
.load-order-inputs {
    margin-bottom: 0;
    padding: 12px;
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 5px;
}
.load-order-inputs .form-group {
    margin-bottom: 12px;
}
.load-order-inputs .form-group:last-child {
    margin-bottom: 0;
}
.load-order-highlight {
    background: #fef9c3 !important;
    border-color: #facc15 !important;
}
.load-order-highlight:focus {
    background: #fef08a !important;
    border-color: #eab308 !important;
}
.load-form-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}
.card-await-send {
    background: #fffbeb;
    border: 1px solid #fde68a;
    box-shadow: 0 2px 10px rgba(251, 191, 36, 0.15);
}
.card-await-send h2 {
    color: #b45309;
    border-bottom-color: #facc15;
}
.await-send-block {
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(254, 249, 195, 0.6);
    border-radius: 8px;
    border: 1px solid #fde68a;
}
.await-send-block p {
    margin: 0 0 8px;
    word-break: break-word;
}
.await-send-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.await-send-collapsible .await-send-header {
    cursor: pointer;
}
.await-send-collapsible .await-send-header strong {
    flex: 1;
}
.await-send-body {
    margin-top: 0.5rem;
}
.await-send-collapsible.order-card-collapsed .await-send-body.order-card-body {
    display: none;
}
.await-send-collapsible.order-card-expanded .await-send-body.order-card-body {
    display: block;
}
.await-send-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}
.await-send-form {
    display: inline-block;
}
@media (max-width: 480px) {
    .await-send-block {
        padding: 12px;
    }
    .await-send-form {
        display: block;
    }
    .await-send-form .btn {
        width: 100%;
    }
}

/* Отправленные посылки — вложенные заказы (двойное раскрытие) */
.sent-orders-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sent-order-item {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    background: #f8fafc;
}
.sent-order-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
}
.sent-order-header:hover {
    background: #f1f5f9;
}
.sent-order-header strong {
    color: #1e293b;
    font-weight: 700;
}
.sent-order-expand {
    flex-shrink: 0;
    font-size: 12px;
    color: #64748b;
}
.sent-order-item.expanded .sent-order-expand {
    color: #667eea;
}
.sent-order-details {
    display: none;
    padding: 12px 12px 12px 28px;
    border-top: 1px solid #e2e8f0;
    background: white;
    font-size: 0.9rem;
}
.sent-order-details.active {
    display: block;
}
.sent-order-details p {
    margin: 4px 0;
}

.load-orders-select-all {
    margin-bottom: 12px;
}
.load-orders-select-all label {
    cursor: pointer;
    font-size: 14px;
}
.bulk-actions {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.bulk-actions.show {
    display: flex;
}
.btn-bulk-load {
    padding: 10px 20px;
}
.btn-bulk-delete {
    background: #dc3545;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}
.btn-bulk-delete:hover {
    background: #c82333;
}
.btn-delete-row {
    background: #dc3545;
    color: white;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}
.btn-delete-row:hover {
    background: #c82333;
}
.btn-delete-row svg {
    flex-shrink: 0;
}
.modal-confirm .modal-confirm-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
.modal-btn-cancel {
    flex: 1;
    padding: 12px;
    background: #e5e7eb;
    color: #374151;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}
.modal-btn-cancel:hover {
    background: #d1d5db;
}
.modal-btn-ok {
    flex: 1;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.modal-btn-ok:hover {
    background: #5568d3;
}
@media (max-width: 768px) {
    .load-order-header {
        grid-template-columns: auto 1fr;
        gap: 10px;
    }
    .load-order-actions {
        grid-column: 1 / -1;
    }
    .load-order-summary {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Загрузка в машину — мобильная: колонки в столбик, кнопки компактно */
@media (max-width: 576px) {
    .load-order-header {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .load-order-check-wrap {
        order: 1;
    }
    .load-order-summary {
        order: 2;
    }
    .load-order-actions {
        order: 3;
        flex-wrap: wrap;
        gap: 8px;
    }
    .load-order-summary span {
        white-space: normal;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .bulk-actions .btn {
        width: 100%;
    }
    .load-order-inputs .form-group input {
        font-size: 16px;
    }
}

/* Обёртка и кнопка показа пароля (иконка внутри поля) — не для ряда «поле + глаз + кнопки» */
.page-container .password-wrapper:not(.password-wrapper--with-side-actions) {
    position: relative;
    display: block;
}

.page-container .password-wrapper:not(.password-wrapper--with-side-actions) input {
    padding-right: 44px;
    box-sizing: border-box;
}

.page-container .password-wrapper:not(.password-wrapper--with-side-actions) .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-wrapper:not(.password-wrapper--with-side-actions) .password-toggle:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.08);
}

/* Ряд: пароль + показать + сгенерировать (настройки пользователей) */
.page-container .password-wrapper--with-side-actions {
    position: relative;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    width: 100%;
}

.page-container .password-wrapper--with-side-actions input[type="password"],
.page-container .password-wrapper--with-side-actions input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 10px;
    box-sizing: border-box;
}

.page-container .password-wrapper--with-side-actions .password-toggle,
.page-container .password-wrapper--with-side-actions .btn-gen {
    position: static;
    transform: none;
    flex-shrink: 0;
    width: 34px;
    min-width: 34px;
    margin: 0;
    padding: 0;
    height: auto;
    align-self: stretch;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f1f5f9;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: #334155;
    box-sizing: border-box;
}

.page-container .password-wrapper--with-side-actions .password-toggle span,
.page-container .password-wrapper--with-side-actions .password-toggle-icon {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-container .password-wrapper--with-side-actions .password-toggle:hover,
.page-container .password-wrapper--with-side-actions .btn-gen:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #4338ca;
}

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

/* В iframe кабинета не форсируем min-width таблиц (убирает лишний горизонтальный скролл) */
body.administrator-embed-body .table-wrapper > table {
    min-width: 0 !important;
}

/* Новые заказы — колонка «Действия»: кнопки столбиком, без вылезания за экран */
.orders-new-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
}
.orders-new-table .orders-new-actions-col {
    width: 1%;
    max-width: 220px;
    white-space: normal;
    vertical-align: top;
}
.orders-new-actions-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    min-width: 0;
}
.orders-new-actions-inner .orders-new-action-form {
    margin: 0;
}
.orders-new-actions-inner .btn {
    width: 100%;
    box-sizing: border-box;
    white-space: normal;
    line-height: 1.25;
    padding: 8px 10px;
    font-size: 12px;
    text-align: center;
}
.orders-new-actions-inner .btn.btn-primary {
    font-size: 11px;
}

.card[style*="overflow-x"] {
    -webkit-overflow-scrolling: touch;
}

/* Столы и 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);
}
@media (max-width: 480px) {
    table {
        min-width: 400px;
    }
    .table-wrapper table {
        min-width: 360px;
        font-size: 13px;
    }
    .table-wrapper th,
    .table-wrapper td {
        padding: 8px 6px;
    }
}

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(min(100%, 250px), 1fr));
    gap: 16px;
    margin-top: 20px;
}
@media (max-width: 480px) {
    .dashboard {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.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;
}

/* Плитки меню разделов на hub (dashboard.php): чуть компактнее полного logistics, но читабельно */
.dashboard.dashboard--compact-nav {
    margin-top: 14px;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
}

.dashboard.dashboard--compact-nav .dashboard-card {
    padding: 20px 14px;
}

.dashboard.dashboard--compact-nav .dashboard-card .icon {
    font-size: 34px;
    margin-bottom: 10px;
}

.dashboard.dashboard--compact-nav .dashboard-card h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
    line-height: 1.3;
}

@media (max-width: 1024px) {
    .dashboard.dashboard--compact-nav {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr));
        gap: 10px;
    }

    .dashboard.dashboard--compact-nav .dashboard-card {
        padding: 16px 12px;
    }
}

@media (max-width: 768px) {
    .dashboard.dashboard--compact-nav {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
    .dashboard.dashboard--compact-nav .dashboard-card .icon {
        font-size: 30px;
    }

    .dashboard.dashboard--compact-nav .dashboard-card h2 {
        font-size: 15px;
    }
}

.dashboard-card-count.pending {
    color: #dc2626;
    font-weight: 700;
}

/* Плитки-якоря внутри модулей (ферма, агент, склад, …) */
.chicken-module-tiles {
    margin-bottom: 18px;
}

.dashboard.dashboard--module-subnav {
    margin-top: 0;
    margin-bottom: 0;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 118px), 1fr));
}

.dashboard.dashboard--module-subnav .dashboard-card {
    padding: 14px 10px;
    min-height: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dashboard.dashboard--module-subnav .dashboard-card .icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.dashboard.dashboard--module-subnav .dashboard-card h2 {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    line-height: 1.25;
    color: #667eea;
}

/* Модули: выбранная плитка раздела (hash + одна панель) */
.chicken-module-page-nav .dashboard-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.chicken-module-page-nav .dashboard-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.18);
}

.chicken-module-page-nav .dashboard-card.is-active {
    border-color: #4f46e5;
    background: linear-gradient(145deg, #eef2ff 0%, #e0e7ff 100%);
    box-shadow: 0 4px 18px rgba(79, 70, 229, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.chicken-module-page-nav .dashboard-card.is-active .icon {
    filter: drop-shadow(0 1px 2px rgba(79, 70, 229, 0.35));
}

.chicken-module-page-nav .dashboard-card.is-active h2 {
    color: #312e81;
    font-weight: 700;
}

@media (max-width: 520px) {
    .dashboard.dashboard--module-subnav {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard.dashboard--module-subnav .dashboard-card h2 {
        font-size: 12px;
    }
}

section[id^="tz-"],
section.chicken-module-section {
    scroll-margin-top: 16px;
}

/* Карточки модулей: единый вид */
.chicken-module-section.card {
    border: 1px solid #e8e8e8;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.chicken-module-section.card > h2:first-child,
.chicken-module-section.card .tz-block-title:first-child {
    margin-top: 0;
}

.page-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.page-title-row .page-title {
    margin: 0;
}
.page-title-row .btn-read-inline {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* 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);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.page-container .card p {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* 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;
}

/* Блюда и рецептура — карточки меню с фото (адаптивная сетка) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.menu-dishes-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 560px) {
    .menu-dishes-section {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 900px) {
    .menu-dishes-section {
        grid-template-columns: repeat(3, 1fr);
    }
}

.dish-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    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-photo-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f1f5f9;
    overflow: hidden;
}

.dish-card-photo-wrap .dish-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dish-photo-replace {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    text-align: center;
}

.dish-photo-change-btn {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: #fff;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.dish-photo-change-btn:hover {
    background: rgba(255,255,255,0.35);
}

.dish-card-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
}

.dish-photo-upload {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dish-photo-add-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    cursor: pointer;
    color: #64748b;
    font-size: 0.9rem;
    text-align: center;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    margin: 0.75rem;
    transition: border-color 0.2s, color 0.2s;
}
.dish-photo-add-label:hover {
    border-color: #667eea;
    color: #667eea;
}

.dish-photo-add-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.dish-card-body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.dish-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.dish-card-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.3;
    display: block;
    width: 100%;
}

.dish-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    font-size: 0.8rem;
    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-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;
}

.cooking-order-table-label {
    color: #64748b;
    font-weight: 600;
}

.cooking-order-card {
    background: #fef2f2;
    border-color: #fca5a5;
}

.done-order-card {
    background: #f0fdf4;
    border-color: #86efac;
}

/* Collapsible order cards (waiter & cook) */
.order-card-collapsible {
    cursor: pointer;
}
.order-card-collapsible > strong {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.order-card-body {
    margin-top: 0.35rem;
}
.order-card-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: auto;
    border-radius: 999px;
    border: 1px solid #cbd5f5;
    background: #eef2ff;
    box-shadow: 0 1px 2px rgba(15,23,42,0.08);
    font-size: 0.9rem;
    color: #4f46e5;
    vertical-align: middle;
    flex-shrink: 0;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.order-card-collapsible:hover .order-card-toggle-icon {
    background: #e0e7ff;
    border-color: #818cf8;
    box-shadow: 0 2px 4px rgba(15,23,42,0.15);
}
.order-card-collapsed .order-card-body {
    display: none;
}
.order-card-expanded .order-card-body {
    display: block;
}
.order-card-expanded table.order-card-body {
    display: table !important;
}
.order-card-collapsed .order-card-toggle-icon {
    transform: rotate(-90deg);
}
.order-card-expanded .order-card-toggle-icon {
    transform: rotate(0deg);
}

.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;
}

/* Форма «Добавить блюдо»: десктоп — поле блюда на всю ширину строки; мобильная — 2 строки (блюдо сверху, остальное снизу) */
.waiter-add-dish-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
.waiter-add-dish-form input[type="hidden"] {
    flex: 0 0 0;
    width: 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
.waiter-add-dish-cell {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-sizing: border-box;
}
.waiter-add-dish-cell-label {
    font-size: 0.875rem;
    color: #475569;
    white-space: nowrap;
}
.waiter-add-dish-cell .input-cafe,
.waiter-add-dish-cell .waiter-add-dish-btn {
    width: 100%;
    min-width: 0;
    height: 38px;
    box-sizing: border-box;
}
.waiter-add-dish-cell-btn .waiter-add-dish-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
/* Десктоп: форма в одну строку на всю ширину, поле блюда тянется до конца строки */
@media (min-width: 640px) {
    .waiter-add-dish-form {
        flex-wrap: nowrap;
    }
    .waiter-add-dish-cell-dish {
        flex: 1 1 0%;
        min-width: 0;
        max-width: none;
    }
    .waiter-add-dish-cell-dish .input-cafe {
        width: 100%;
        max-width: 100%;
    }
    .waiter-add-dish-form .waiter-add-dish-cell:not(.waiter-add-dish-cell-dish) {
        flex: 0 0 120px;
    }
}
/* Мобильная: строго 2 строки — 1) поле блюда на всю ширину, 2) кол-во, порция, кнопка */
@media (max-width: 639px) {
    .waiter-add-dish-form {
        flex-wrap: wrap;
    }
    .waiter-add-dish-cell-dish {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
    }
    .waiter-add-dish-form .waiter-add-dish-cell:not(.waiter-add-dish-cell-dish) {
        flex: 1 1 0;
        min-width: 80px;
    }
}

/* Блок: форма добавления блюда + строка поиска; на мобильной поиск сверху */
.waiter-add-dish-block {
    display: flex;
    flex-direction: column;
}

/* Строка поиска: на десктопе «Или поиск», на мобильной «Поиск» и строка выше выбора блюда */
.waiter-dish-search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.waiter-search-label-mobile {
    display: none;
}
.waiter-search-label-desktop {
    display: inline;
}
.waiter-dish-search-input {
    flex: 1 1 200px;
    min-width: 0;
}
.waiter-dish-search-info {
    color: #64748b;
}
@media (min-width: 640px) {
    .waiter-dish-search-input {
        flex: 1 1 320px;
        max-width: 420px;
    }
}
@media (max-width: 639px) {
    .waiter-add-dish-block .waiter-dish-search-row {
        order: -1;
        margin-top: 0;
        margin-bottom: 0.75rem;
    }
    .waiter-search-label-mobile {
        display: inline;
    }
    .waiter-search-label-desktop {
        display: none;
    }
    .waiter-dish-search-input {
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
    }
}

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

/* Cook orders status highlighting */
.cook-order-card {
    border-width: 2px;
    border-style: solid;
    border-radius: 10px;
}
.cook-order-card--new {
    background: #fef2f2; /* light red */
    border-color: #fecaca;
}
.cook-order-card--in-progress {
    background: #fffbeb; /* light yellow */
    border-color: #facc15;
}
.cook-order-card--done {
    background: #ecfdf3; /* light green */
    border-color: #4ade80;
}

/* 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;
}

@media (max-width: 640px) {
    .report-form-one-row {
        flex-wrap: wrap;
    }
    .report-form-inline .report-type-cell,
    .report-form-inline .report-date-cell,
    .report-form-inline .report-export-cell {
        width: 100%;
    }
    .report-form-inline .input-cafe,
    .report-form-inline .report-select {
        min-width: 0;
        width: 100%;
    }
    .stats-period-nav {
        flex-wrap: wrap;
        gap: 10px;
    }
}

.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;
}

.stats-balance-tooltip {
    cursor: help;
    margin-left: 2px;
    opacity: 0.85;
}

/* Блок «Закрыть кассу» и «Передать деньги» — центрирование каждой строки */
.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 {
        bottom: max(16px, 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;
    }
}

/* ========== Адаптивность: курьеры РФ и КР ========== */
@media (max-width: 768px) {
    .page-toolbar,
    .available-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .available-search-form {
        flex-direction: column;
        flex: 1 1 100%;
        width: 100%;
    }
    .available-search-form #clientPhoneInput,
    .available-search-form input[type="text"][name="search"] {
        width: 100%;
        min-width: 0;
    }
    .available-toolbar-buttons {
        width: 100%;
        display: flex;
        gap: 8px;
    }
    .sent-shipment-item .load-order-summary span,
    .load-order-item .load-order-summary span {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .sent-order-header span:last-child {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .load-order-actions {
        flex-wrap: wrap;
        gap: 6px;
    }
    .modal-confirm .modal-comment-block textarea {
        max-width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 576px) {
    .page-container {
        padding: 12px;
    }
    .card {
        padding: 14px;
    }
    .card h2 {
        font-size: 1.1rem;
    }
    .page-title {
        font-size: 1.1rem;
    }
    .page-toolbar .btn,
    .page-toolbar a.btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
        box-sizing: border-box;
    }
    /* Кнопки Искать и Выгрузить в Excel — одинаковая ширина на мобильных */
    .available-toolbar-buttons .btn,
    .available-toolbar-buttons a.btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
        min-height: 44px;
        box-sizing: border-box;
    }
    .load-order-inputs .form-group input {
        width: 100%;
        max-width: none;
        font-size: 16px;
    }
    .load-order-details-content p,
    .sent-order-details p {
        word-break: break-word;
    }
    .form-actions .btn {
        width: 100%;
    }
    .card form .form-group input,
    .card form .form-group select,
    .card form .form-group textarea {
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }
    .dashboard-card h2 {
        font-size: 0.95rem;
        line-height: 1.3;
    }
    .dashboard-card-count {
        display: inline-block;
    }
}

@media (max-width: 400px) {
    .header-button {
        padding: 6px 6px;
        font-size: 11px;
    }
    .header-button-icon {
        font-size: 12px;
    }
}

/* ========== Адаптивность: администратор, бухгалтер, notebook ========== */
@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .main-content {
        padding: 0 16px;
    }
    .page-container {
        padding: 20px;
    }
    .card {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .finance-period-fields {
        flex-direction: column;
        align-items: stretch;
    }
    .finance-period-fields .form-group {
        flex: 1 1 100%;
    }
    .finance-period-fields .form-group input[type="date"] {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
    .bp-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    .bp-filter-item input,
    .bp-filter-item select {
        width: 100%;
        min-width: 0;
    }
    .bp-search-cell {
        min-width: 0;
    }
    .stats-cards,
    .finance-summary {
        grid-template-columns: 1fr;
    }
    .stats-card,
    .finance-summary-card {
        min-width: 0;
    }
    .order-details-content {
        grid-template-columns: 1fr !important;
    }
    .order-details-content p {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .bulk-actions .btn {
        width: 100%;
        justify-content: center;
    }
    .role-filters {
        flex-wrap: wrap;
        gap: 8px;
    }
    .role-filter-btn {
        flex: 1 1 45%;
        min-width: 0;
        text-align: center;
        padding: 10px 8px;
    }
    .btn-expand-row {
        min-width: 36px;
        padding: 6px 10px;
    }
    .table-wrapper table {
        font-size: 13px;
    }
    .table-wrapper th,
    .table-wrapper td {
        padding: 8px 6px;
    }
}

@media (max-width: 576px) {
    .search-page .search-form {
        flex-direction: column;
    }
    .search-page .search-form input {
        width: 100%;
        min-width: 0;
    }
    .search-page .search-form .btn {
        width: 100%;
    }
}

/* Клиент: таблица на малых экранах */
@media (max-width: 640px) {
    .client-order-table {
        font-size: 13px;
    }
}

/* Модальные окна: адаптивность на узких экранах */
@media (max-width: 480px) {
    .modal-content {
        max-width: calc(100vw - 24px);
        margin: 0 12px;
    }
    .modal-form .form-group input,
    .modal-form .form-group select,
    .modal-form .form-group textarea {
        width: 100%;
        max-width: none;
    }
    .modal-form-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Администратор: встроенные страницы (iframe) без второй шапки */
body.administrator-embed-body {
    margin: 0;
    background: #f1f5f9;
}

.main-content.main-content-admin-embed {
    max-width: none;
    margin: 0 auto;
    padding: 12px 16px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Настройки птицефабрики (вкладки) */
.chicken-settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.chicken-settings-tabs a {
    padding: 8px 16px;
    border-radius: 8px;
    background: #e2e8f0;
    color: #334155;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.05s, color 0.05s, transform 0.05s;
}
.chicken-settings-tabs a:hover {
    background: #cbd5e1;
    text-decoration: none;
}
.chicken-settings-tabs a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.35);
}

.chicken-settings-card-title-with-help {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 0;
}

.chicken-settings-card-title-with-help > span {
    flex: 1 1 auto;
    min-width: 0;
    order: 0;
}

.chicken-settings-card-title-with-help .chicken-help-details {
    order: -1;
    flex-shrink: 0;
}

/* Настройки → порядок плиток панели /admin/ (блоки ТЗ + drag-and-drop) */
.admin-panel-order-groups {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 20px;
}

@media (min-width: 880px) {
    .admin-panel-order-groups {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.admin-panel-order-section-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.admin-panel-order-section-head {
    margin: 0;
    padding: 11px 14px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    line-height: 1.35;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.admin-panel-order-list {
    list-style: none;
    margin: 0;
    padding: 10px;
    min-height: 48px;
    border-radius: 0 0 10px 10px;
    transition: background 0.15s ease;
}

.admin-panel-order-item {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.admin-panel-order-item:last-child {
    margin-bottom: 0;
}

.admin-panel-order-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.admin-panel-order-item.is-dragging {
    opacity: 0.65;
    cursor: grabbing;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.admin-panel-order-grip {
    color: #94a3b8;
    font-size: 14px;
    line-height: 1;
    letter-spacing: -2px;
    cursor: grab;
}

.admin-panel-order-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.admin-panel-order-label {
    min-width: 0;
    font-weight: 600;
    color: #1e293b;
}

.admin-panel-order-actions {
    display: flex;
    gap: 6px;
    justify-self: end;
}

.admin-panel-order-actions .btn {
    padding: 4px 10px;
    font-size: 14px;
    line-height: 1.2;
    min-width: 36px;
    cursor: pointer;
}

.admin-panel-order-item--with-hide {
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
}

.admin-panel-order-row-hide {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.admin-panel-order-row-hide input {
    cursor: pointer;
}

.admin-panel-order-pinned {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    margin: 0 4px;
}

.admin-panel-order-submit-wrap {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    padding-top: 4px;
}

.admin-panel-order-modal-title {
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    color: #1e293b;
}

.chicken-help-details {
    position: relative;
    display: inline-block;
}
.chicken-help-summary {
    list-style: none;
    cursor: help;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    user-select: none;
}
.chicken-help-summary::-webkit-details-marker {
    display: none;
}
.chicken-help-summary::marker {
    content: '';
}
.chicken-help-details[open] .chicken-help-summary {
    background: #cbd5e1;
    color: #1e293b;
}

/* Тело подсказки: координаты у иконки выставляет common.js (fixed + clamp к окну) */
.chicken-help-body {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    font-size: 13px;
    font-weight: 400;
    color: #334155;
    line-height: 1.45;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.chicken-help-details[open] .chicken-help-body {
    position: fixed;
    z-index: 2600;
    width: min(420px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    min-width: 0;
    max-height: min(78vh, 560px);
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    -webkit-overflow-scrolling: touch;
}

@supports (padding: max(0px)) {
    .chicken-help-details[open] .chicken-help-body {
        --chicken-help-hpad: max(24px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px));
        width: min(420px, calc(100vw - var(--chicken-help-hpad)));
        max-width: calc(100vw - var(--chicken-help-hpad));
    }
}
.chicken-help-body p {
    margin: 0 0 10px;
}
.chicken-help-body p:last-child {
    margin-bottom: 0;
}
.chicken-help-keymap-title {
    font-weight: 600;
    margin-top: 4px !important;
}
.chicken-help-keymap {
    margin: 6px 0 0;
    padding-left: 18px;
}
.chicken-help-keymap li {
    margin-bottom: 4px;
}
.chicken-help-keymap-ru {
    font-weight: 500;
}

.settings-two-col {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.settings-col-form {
    flex: 0 1 320px;
    min-width: 260px;
}
.settings-col-list {
    flex: 1 1 400px;
    min-width: 0;
}
@media (max-width: 768px) {
    .settings-two-col {
        flex-direction: column;
    }
    .settings-col-form,
    .settings-col-list {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* Роль admin: без глобальной шапки */
body.admin-no-header {
    margin: 0;
    background: #eef2f7;
}

.admin-minimal-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 14px rgba(102, 126, 234, 0.22);
    position: sticky;
    top: 0;
    z-index: 900;
}

.admin-minimal-bar__link {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
}

.admin-minimal-bar__link:hover {
    text-decoration: underline;
    color: #f8fafc;
}

.admin-minimal-bar__logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #dc2626;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(220, 38, 38, 0.35);
}

.admin-minimal-bar__logout:hover {
    background: #b91c1c;
    color: #fff;
}

body.admin-no-header--panel .main-content.main-content-admin-no-header:has(> .admin-dashboard-shell) {
    padding: 8px 12px 12px;
    min-height: 100dvh;
    box-sizing: border-box;
}

body.admin-no-header--panel .admin-dashboard-shell {
    height: calc(100dvh - 28px);
    max-height: calc(100dvh - 24px);
    min-height: 320px;
}

body.admin-no-header:not(.admin-no-header--panel) .main-content.main-content-admin-no-header {
    padding: 16px 16px 24px;
    min-height: calc(100dvh - 56px);
    box-sizing: border-box;
}

.admin-sidebar-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 10px 10px 12px;
    border-top: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.admin-sidebar-logout {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: #fff;
    background: #dc2626;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    transition: background 0.12s ease, box-shadow 0.12s ease;
}

.admin-sidebar-logout:hover {
    background: #b91c1c;
    color: #fff;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.admin-sidebar-logout:focus-visible {
    outline: 2px solid #fca5a5;
    outline-offset: 2px;
}

/* Главная администратора: слева список разделов, справа контент */
.main-content:has(> .admin-dashboard-shell) {
    max-width: none;
    margin: 0 auto;
    padding: 12px 16px 16px;
    width: 100%;
    box-sizing: border-box;
}

.admin-dashboard-shell {
    display: flex;
    align-items: stretch;
    gap: 14px;
    height: calc(100vh - 88px);
    min-height: 420px;
    max-height: calc(100vh - 72px);
    overflow: hidden;
    position: relative;
}

/* Мобильная полоса и drawer — только ≤960px */
.admin-dashboard-mobile-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 0 0 10px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.admin-dashboard-mobile-bar-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.admin-dashboard-mobile-title {
    font-weight: 700;
    font-size: 15px;
    color: #1e3a5f;
    line-height: 1.2;
}

.admin-dashboard-mobile-sub {
    font-size: 12px;
    color: #64748b;
}

.admin-sidebar-toggle {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #334155;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.admin-sidebar-toggle:hover {
    border-color: #c7d2fe;
    background: #f8fafc;
}

.admin-sidebar-toggle-icon {
    display: block;
    margin-top: -2px;
}

.admin-sidebar-overlay {
    display: none;
}

.admin-sidebar-drawer-head {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.06) 100%);
    flex-shrink: 0;
}

.admin-sidebar-drawer-title {
    font-weight: 700;
    font-size: 15px;
    color: #4338ca;
}

.admin-sidebar-close {
    width: 40px;
    height: 40px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.admin-sidebar-close:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #c7d2fe;
}

body.admin-sidebar-drawer-open {
    overflow: hidden;
}

.admin-dashboard-sidebar {
    flex: 0 0 24%;
    max-width: 288px;
    min-width: 210px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(102, 126, 234, 0.1), 0 1px 4px rgba(15, 23, 42, 0.06);
}

.admin-dashboard-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 6px 0 12px;
    scrollbar-color: rgba(102, 126, 234, 0.35) #f1f5f9;
}

.admin-dashboard-nav::-webkit-scrollbar {
    width: 6px;
}

.admin-dashboard-nav::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.35);
    border-radius: 4px;
}

.admin-nav-section {
    margin-bottom: 4px;
}

.admin-nav-section:last-child {
    margin-bottom: 0;
}

.admin-nav-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0;
    padding: 12px 14px 5px;
    line-height: 1.3;
    user-select: none;
}

.admin-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-nav-list li {
    margin: 0;
    padding: 0;
}

.admin-nav-item {
    display: block;
    box-sizing: border-box;
    text-align: left;
    padding: 10px 14px 10px 16px;
    margin: 0 8px;
    width: calc(100% - 16px);
    border: none;
    border-radius: 8px;
    border-left: 3px solid transparent;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    line-height: 1.35;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.admin-nav-item:hover {
    background: #f1f5ff;
    color: #4338ca;
}

.admin-nav-item:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 1px;
}

.admin-nav-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-left-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.35);
}

.admin-nav-item.active:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b4298 100%);
    color: #fff;
}

.admin-dashboard-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

/* Несколько iframe: кэш разделов — повторное переключение без перезагрузки */
.admin-iframe-stack {
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    position: relative;
    background: #fff;
}

.admin-iframe-pane {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

.admin-iframe-pane.is-active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

.admin-dashboard-iframe {
    border: none;
    background: #fff;
}

@media (max-width: 960px) {
    .main-content:has(> .admin-dashboard-shell) {
        padding-top: 8px;
    }

    .admin-dashboard-mobile-bar {
        display: flex;
    }

    .admin-sidebar-drawer-head {
        display: flex;
    }

    .admin-dashboard-shell {
        flex-direction: column;
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
        gap: 0;
    }

    .admin-sidebar-overlay.is-visible {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 2100;
        background: rgba(15, 23, 42, 0.45);
        -webkit-tap-highlight-color: transparent;
    }

    .admin-dashboard-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(90vw, 300px);
        max-width: none;
        min-width: 0;
        flex: none;
        z-index: 2110;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        box-shadow: 4px 0 28px rgba(102, 126, 234, 0.2), 8px 0 32px rgba(15, 23, 42, 0.12);
        background: #fff;
        border: none;
        border-right: 1px solid #e2e8f0;
        padding: 0;
        max-height: none !important;
        border-radius: 0 12px 12px 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .admin-dashboard-sidebar.is-open {
        transform: translateX(0);
    }

    .admin-dashboard-nav {
        height: auto;
        max-height: none;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-dashboard-main {
        min-height: min(72vh, 640px);
        flex: 1 1 auto;
        width: 100%;
    }

    body.admin-no-header--panel .main-content.main-content-admin-no-header:has(> .admin-dashboard-shell) {
        min-height: 100dvh;
        padding-top: 6px;
    }

    body.admin-no-header--panel .admin-dashboard-shell {
        min-height: calc(100dvh - 20px);
        height: auto;
        max-height: none;
    }

    body.admin-no-header--panel .admin-dashboard-main {
        min-height: min(65dvh, 560px);
    }
}

@media (min-width: 961px) {
    .admin-dashboard-mobile-bar,
    .admin-sidebar-drawer-head {
        display: none !important;
    }

    .admin-sidebar-overlay {
        display: none !important;
        pointer-events: none;
    }

    .admin-dashboard-sidebar {
        position: static;
        transform: none !important;
        box-shadow: 0 2px 16px rgba(102, 126, 234, 0.1), 0 1px 4px rgba(15, 23, 42, 0.06);
        border-radius: 12px;
        padding: 0;
        overflow: hidden;
    }

    .admin-dashboard-sidebar.is-open {
        transform: none !important;
    }
}

/* Отчёт склад: панель выгрузки и фильтры по колонкам */
.report-stock-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.report-stock-toolbar__hint {
    font-size: 13px;
    color: #475569;
    max-width: 460px;
    line-height: 1.5;
}

.report-stock-filters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 14px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

@media (max-width: 900px) {
    .report-stock-filters {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .report-stock-filters {
        grid-template-columns: 1fr;
    }
}

.report-stock-filters label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.report-stock-filters input[type="search"] {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    width: 100%;
    box-sizing: border-box;
}

.table-stock-report {
    width: 100%;
    border-collapse: collapse;
}

.table-stock-report thead tr.data-head th {
    padding: 10px 8px;
    text-align: left;
    background: #f1f5f9;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px;
    color: #1e293b;
}

.table-stock-report tbody td {
    padding: 9px 8px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

.proc-fieldset-muted {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 12px 0;
    background: #fafafa;
}

.proc-fieldset-muted legend {
    font-weight: 600;
    font-size: 14px;
    padding: 0 6px;
    color: #334155;
}

.cutting-radio-label {
    display: block;
    margin: 8px 0;
    font-weight: 400;
    font-size: 14px;
    cursor: pointer;
}

.msg-hint-banner {
    border-left: 4px solid #3b82f6;
    background: #eff6ff;
}

.msg-hint-banner--warn {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

/* Ферма: шаблон кормления и отклонения на неделю */
.farm-feed-template-section .farm-template-card {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.farm-feed-template-section .farm-template-card:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.farm-feed-template-row-head {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.farm-feed-template-head-cell {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.farm-feed-template-inputs {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

@media (max-width: 1100px) {
    .farm-feed-template-inputs,
    .farm-feed-template-row-head {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 640px) {
    .farm-feed-template-inputs,
    .farm-feed-template-row-head {
        grid-template-columns: 1fr;
    }
}

.farm-feed-template-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}

.farm-feed-week-subhint {
    margin: 0 0 14px;
    font-size: 13px;
}

.farm-feed-cal-cell--from-template {
    border-bottom: 2px dashed #cbd5e1;
}

.farm-feed-cell-hint {
    display: block;
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.farm-feed-override-tag {
    color: #b45309;
    font-weight: 600;
}

.farm-warehouse-callout {
    margin: 0 0 16px;
    padding: 12px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    color: #1e3a5f;
}

.farm-wh-subtitle {
    font-size: 1rem;
    margin: 0 0 10px;
    font-weight: 600;
    color: #334155;
}

.farm-tech-form-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    align-items: end;
}

.farm-tech-saved-title {
    font-size: 1rem;
    margin: 16px 0 8px;
    font-weight: 600;
    color: #334155;
}

/* Настройки: склад / начальные остатки (в стиле остального приложения) */
.settings-initial-balances-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-initial-balances-page > .card {
    margin-bottom: 0;
}

.settings-initial-balances-page > .card > h2:first-child {
    margin-top: 0;
}

.settings-ib-lead {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.5;
}

.settings-ib-upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 24px;
}

.settings-ib-upload-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.settings-ib-file-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.settings-ib-csv-hint {
    margin: 12px 0 0;
    font-size: 13px;
    line-height: 1.5;
}

.settings-ib-search-wrap,
.settings-initial-balances-page .balances-search-wrap {
    margin-bottom: 12px;
}

.settings-ib-search {
    width: 100%;
    max-width: 480px;
    padding: 8px 12px;
    border: 2px solid #c4b5fd;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-ib-search:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.22);
}

.settings-ib-search::placeholder {
    color: #64748b;
}

.settings-ib-table-wrap {
    margin-bottom: 16px;
}

.settings-ib-table th,
.settings-ib-table td {
    vertical-align: middle;
}

.settings-initial-balances-page .balances-list .settings-ib-table thead tr {
    background: #f1f5f9;
}

.settings-initial-balances-page .balances-list .settings-ib-table th {
    padding: 8px 10px;
    font-weight: 600;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
}

.settings-initial-balances-page .balances-list .settings-ib-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
}

.settings-ib-qty-input {
    min-width: 100px;
    padding: 8px 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
}

.settings-ib-save-btn {
    margin-top: 4px;
}

.settings-initial-balances-page .initial-balances-upload-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
}

.settings-initial-balances-page .upload-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.settings-initial-balances-page .upload-form .form-group {
    margin-bottom: 0;
}

.settings-initial-balances-page .upload-form .form-group label {
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.settings-initial-balances-page .upload-form input[type="file"] {
    max-width: 260px;
    padding: 6px 0;
    font-size: 14px;
}

.settings-initial-balances-page .upload-form .btn {
    height: 38px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.settings-initial-balances-page .balance-form-row.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 96px;
    gap: 12px 16px;
    align-items: end;
}

.settings-initial-balances-page .balance-form-row .form-group {
    margin-bottom: 0;
}

.settings-initial-balances-page .balance-form-row .form-group label {
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #555;
}

.settings-initial-balances-page .balance-form-row .form-group input {
    padding: 10px 12px;
    font-size: 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
}

.settings-initial-balances-page .balance-form-row .form-group input:focus {
    border-color: #667eea;
    outline: none;
}

.settings-initial-balances-page .balance-actions-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: transparent;
    user-select: none;
}

.settings-initial-balances-page .autocomplete-container {
    position: relative;
}

.settings-initial-balances-page .autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.settings-initial-balances-page .autocomplete-suggestions.show {
    display: block;
}

.settings-initial-balances-page .autocomplete-item {
    padding: 0.45rem 0.65rem;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.95rem;
}

.settings-initial-balances-page .autocomplete-item:hover {
    background: #f1f5f9;
}

.settings-initial-balances-page .initial-balance-actions {
    margin-top: 16px;
    padding-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.settings-initial-balances-page .balance-add-remove-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.settings-initial-balances-page .balance-add-row-btn,
.settings-initial-balances-page .balance-remove-row-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.25rem;
    line-height: 1;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.settings-initial-balances-page .balance-add-row-btn {
    background: #667eea;
    color: #fff;
}

.settings-initial-balances-page .balance-add-row-btn:hover {
    background: #5568d3;
}

.settings-initial-balances-page .balance-remove-row-btn {
    font-size: 1.1rem;
    background: #dc3545;
    color: #fff;
}

.settings-initial-balances-page .balance-remove-row-btn:hover {
    background: #c82333;
}

.settings-initial-balances-page .balances-bulk-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}

.settings-initial-balances-page .balances-select-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #475569;
}

.settings-initial-balances-page .btn-delete-balances {
    display: none;
    align-items: center;
    justify-content: center;
}

.settings-initial-balances-page .btn-delete-balances:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.settings-initial-balances-page .balance-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.settings-initial-balances-page .balance-row-actions .btn-sm {
    margin-right: 0;
}

.settings-initial-balances-page .balance-name-input,
.settings-initial-balances-page .balance-qty-input,
.settings-initial-balances-page .balance-unit-input,
.settings-initial-balances-page .balance-category-select {
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.settings-initial-balances-page .balance-name-input:focus,
.settings-initial-balances-page .balance-qty-input:focus,
.settings-initial-balances-page .balance-unit-input:focus,
.settings-initial-balances-page .balance-category-select:focus {
    outline: none;
    border-color: #667eea;
}

.settings-initial-balances-page .balance-qty-input {
    max-width: 120px;
}

.settings-initial-balances-page .balance-unit-input {
    max-width: 100px;
}

.settings-initial-balances-page .balance-category-select {
    max-width: 180px;
}

@media (max-width: 720px) {
    .settings-initial-balances-page .balance-form-row.form-row {
        grid-template-columns: 1fr;
    }
}

/* Ферма: хаб «Календарь и кормление» (вкладки) */
.farm-feed-hub .farm-feed-hub-head {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.farm-feed-hub-title {
    margin: 0 0 14px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #0f172a;
}

.farm-feed-hub-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.farm-feed-hub-tab {
    margin: 0;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.farm-feed-hub-tab:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.farm-feed-hub-tab.is-active {
    color: #1e3a8a;
    background: linear-gradient(180deg, #e0e7ff 0%, #c7d2fe 100%);
    border-color: #6366f1;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.22);
}

.farm-feed-hub-panel[hidden] {
    display: none !important;
}

.farm-feed-hub-panel[id^="tz-"] {
    scroll-margin-top: 16px;
}

.farm-feed-schedule-panel.tz-hero-card {
    margin-top: 4px;
    padding: 14px 16px 18px;
    border-radius: 12px;
}

/* Календарь кормления на год */
.farm-feed-year-section .farm-feed-year-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.farm-feed-year-toolbar-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
}

.farm-feed-year-year-label {
    font-weight: 600;
    font-size: 14px;
    color: #334155;
}

.farm-feed-year-select {
    margin-left: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 14px;
}

.farm-feed-year-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 13px;
    color: #64748b;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
}

.farm-feed-year-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.farm-feed-year-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.farm-feed-year-dot--template {
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
}

.farm-feed-year-dot--custom {
    background: #c7d2fe;
    border: 1px solid #818cf8;
}

.farm-feed-year-dot--current {
    background: #fef3c7;
    border: 1px solid #f59e0b;
}

.farm-feed-year-dot--today {
    background: #0ea5e9;
    border: 1px solid #0369a1;
}

.farm-batches-subnav {
    margin: -4px 0 16px;
    font-size: 14px;
}

.farm-batches-subnav__link {
    font-weight: 600;
    color: #4f46e5;
    text-decoration: none;
}

.farm-batches-subnav__link:hover {
    text-decoration: underline;
    color: #4338ca;
}

/* Ферма: новая партия цыплят */
.farm-batch-create {
    margin-bottom: 22px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 56px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.farm-batch-create__summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.farm-batch-create__summary::-webkit-details-marker {
    display: none;
}

.farm-batch-create__summary::marker {
    content: '';
}

.farm-batch-create__summary-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 20px;
    line-height: 40px;
    text-align: center;
    font-weight: 300;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

.farm-batch-create__summary-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
}

.farm-batch-create__summary-title {
    font-weight: 700;
    font-size: 16px;
    color: #1e293b;
    letter-spacing: -0.01em;
}

.farm-batch-create__summary-hint {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    line-height: 1.3;
}

.farm-batch-create__chevron {
    width: 9px;
    height: 9px;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    transform: rotate(45deg);
    flex-shrink: 0;
    margin-right: 8px;
    margin-top: -4px;
    transition: transform 0.2s ease;
}

.farm-batch-create[open] .farm-batch-create__chevron {
    transform: rotate(-135deg);
    margin-top: 4px;
}

.farm-batch-create__body {
    padding: 16px 16px 20px;
    border-top: 1px solid #e8ecf1;
    background: #fff;
}

.farm-batch-create__alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    margin: 0 0 14px;
}

.farm-batch-create__alert--success {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.farm-batch-create__alert--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.farm-batch-create__lead {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.55;
}

.farm-batch-create__code-sample {
    font-size: 13px;
    padding: 2px 7px;
    background: #f1f5f9;
    border-radius: 4px;
    color: #0f172a;
    font-weight: 600;
}

.farm-batch-create__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px 22px;
}

.farm-batch-create__field label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #334155;
    margin-bottom: 6px;
}

.farm-batch-create__field input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
}

.farm-batch-create__field input:focus {
    outline: 2px solid #a5b4fc;
    outline-offset: 1px;
    border-color: #818cf8;
}

.farm-batch-create__field-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.farm-batch-create__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
}

.farm-batch-create__collapse {
    border: none;
    background: none;
    padding: 8px 4px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.farm-batch-create__collapse:hover {
    color: #4338ca;
}

@media (max-width: 520px) {
    .farm-batch-create__summary {
        padding: 12px 12px 12px 14px;
        gap: 10px;
    }

    .farm-batch-create__summary-icon {
        width: 36px;
        height: 36px;
        line-height: 36px;
        font-size: 18px;
    }

    .farm-batch-create__body {
        padding: 14px 14px 18px;
    }
}

/* Единая рамка для календарных блоков (год + неделя) */
.farm-cal-panel {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.farm-cal-panel--week {
    padding: 12px 14px 16px;
}

.farm-cal-panel--week .farm-feed-cal-inner {
    border-radius: 12px;
    overflow: hidden;
}

/* Календарь года: сворачиваемая сетка и подсветка дней */
.farm-year-cal-toolbar-note {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.45;
}

.farm-year-cal-details {
    margin-bottom: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.farm-year-cal-details__summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.farm-year-cal-details__summary::-webkit-details-marker {
    display: none;
}

.farm-year-cal-details__summary::marker {
    content: '';
}

.farm-year-cal-details__summary-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #fff;
    font-size: 14px;
    line-height: 36px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

.farm-year-cal-details[open] .farm-year-cal-details__summary-icon {
    transform: rotate(90deg);
}

.farm-year-cal-details__summary-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
}

.farm-year-cal-details__summary-title {
    font-weight: 700;
    font-size: 15px;
    color: #1e293b;
}

.farm-year-cal-details__summary-hint {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    line-height: 1.35;
}

.farm-year-cal-details__body {
    padding: 14px 16px 18px;
    border-top: 1px solid #e8ecf1;
    background: #fafbfc;
}

.farm-year-cal-day-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.farm-year-cal-day-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.farm-year-cal-day-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgba(15, 23, 42, 0.12);
}

.farm-year-cal-day-swatch--template {
    background: #d1fae5;
}

.farm-year-cal-day-swatch--override {
    background: #fda4af;
    border-color: #e11d48;
}

.farm-year-cal-legend-batches {
    margin-bottom: 10px;
    font-size: 13px;
}

.farm-year-cal-direct-link {
    margin: 0 0 14px;
    font-size: 12px;
}

.farm-year-cal-direct-link__a {
    font-weight: 600;
    color: #4f46e5;
    text-decoration: none;
}

.farm-year-cal-direct-link__a:hover {
    text-decoration: underline;
    color: #4338ca;
}

@media (max-width: 520px) {
    .farm-year-cal-details__summary {
        padding: 12px 14px;
    }

    .farm-year-cal-details__body {
        padding: 12px 12px 16px;
    }
}

/* Календарь года: сетка месяцев */
.farm-year-cal-legend-batches .farm-year-cal-batch-key {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 14px;
    font-weight: 500;
    color: #334155;
}

.farm-year-cal-batch-key-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.farm-year-cal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

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

.farm-year-cal-month {
    padding: 14px 14px 16px;
    min-width: 0;
}

.farm-year-cal-month-title {
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.farm-year-cal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
}

.farm-year-cal-th {
    padding: 6px 4px;
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.farm-year-cal-td {
    border: 1px solid #e8ecf1;
    vertical-align: top;
    padding: 6px 4px 8px;
    min-height: 52px;
    background: #fafbfc;
}

.farm-year-cal-td--outside {
    background: #f1f5f9;
    opacity: 0.72;
}

.farm-year-cal-td--weekend:not(.farm-year-cal-td--outside) {
    background: #f8fafc;
}

.farm-year-cal-td--today {
    outline: 2px solid #0ea5e9;
    outline-offset: -2px;
    background: #f0f9ff;
}

.farm-year-cal-week--selected .farm-year-cal-td {
    background: #fffbeb;
}

.farm-year-cal-week--selected.farm-year-cal-week--has-today .farm-year-cal-td--today {
    background: #fef3c7;
    outline-color: #d97706;
}

.farm-year-cal-week--has-today:not(.farm-year-cal-week--selected) .farm-year-cal-td {
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.35);
}

/* Подсветка дня: все партии по шаблону vs есть отличие (после weekend/selected — выше специфичность) */
.farm-year-cal-td--feed-all-template:not(.farm-year-cal-td--outside) {
    background: #ecfdf5;
}

.farm-year-cal-td--feed-has-override:not(.farm-year-cal-td--outside) {
    background: #ffe4e6;
    box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.45);
}

.farm-year-cal-td--feed-all-template.farm-year-cal-td--weekend:not(.farm-year-cal-td--outside) {
    background: #d1fae5;
}

.farm-year-cal-td--feed-has-override.farm-year-cal-td--weekend:not(.farm-year-cal-td--outside) {
    background: #fecdd3;
    box-shadow: inset 0 0 0 1px rgba(190, 18, 60, 0.5);
}

.farm-year-cal-td--feed-all-template.farm-year-cal-td--today {
    background: #d1fae5;
}

.farm-year-cal-td--feed-has-override.farm-year-cal-td--today {
    background: #fda4af;
    box-shadow: inset 0 0 0 1px #e11d48;
}

.farm-year-cal-week--selected .farm-year-cal-td--feed-all-template:not(.farm-year-cal-td--outside) {
    background: #bbf7d0;
}

.farm-year-cal-week--selected .farm-year-cal-td--feed-has-override:not(.farm-year-cal-td--outside) {
    background: #fb7185;
    box-shadow: inset 0 0 0 1px rgba(136, 19, 55, 0.55);
}

.farm-year-cal-week--selected .farm-year-cal-td--feed-all-template.farm-year-cal-td--today {
    background: #86efac;
}

.farm-year-cal-week--selected .farm-year-cal-td--feed-has-override.farm-year-cal-td--today {
    background: #f43f5e;
    box-shadow: inset 0 0 0 2px #881337;
}

.farm-year-cal-week--selected.farm-year-cal-week--has-today .farm-year-cal-td--feed-all-template.farm-year-cal-td--today {
    outline-color: #059669;
}

.farm-year-cal-week--selected.farm-year-cal-week--has-today .farm-year-cal-td--feed-has-override.farm-year-cal-td--today {
    outline-color: #881337;
}

.farm-year-cal-td--feed-has-override:not(.farm-year-cal-td--outside) .farm-year-cal-day-num {
    color: #881337;
    font-weight: 700;
}

.farm-year-cal-week--selected .farm-year-cal-td--feed-has-override.farm-year-cal-td--today .farm-year-cal-day-num {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.farm-year-cal-day-link {
    display: block;
    text-align: center;
    text-decoration: none;
    color: #0f172a;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
    padding: 2px 0;
    border-radius: 6px;
}

.farm-year-cal-day-link:hover {
    background: #e0f2fe;
    color: #0369a1;
}

.farm-year-cal-day-num {
    display: block;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #334155;
    padding: 2px 0;
}

.farm-year-cal-day-num--muted {
    color: #94a3b8;
    font-weight: 500;
}

/* Пустая ячейка в сетке месяца (дни до/после месяца — без номера, без дат других лет/месяцев) */
.farm-year-cal-day-placeholder {
    display: block;
    min-height: 1.25em;
}

.farm-year-cal-week-foot {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #cbd5e1;
    text-align: center;
}

.farm-year-cal-week-link {
    font-size: 10px;
    font-weight: 700;
    color: #2563eb;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.farm-year-cal-week-link:hover {
    text-decoration: underline;
}

.farm-year-cal-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 5px;
}

.farm-year-cal-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--batch-dot, #94a3b8);
}

.farm-year-cal-dot--template {
    opacity: 0.38;
}

.farm-year-cal-dot--custom {
    opacity: 1;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.farm-feed-compare-row {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
}

.farm-feed-compare-title {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.farm-feed-compare-cells {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

@media (max-width: 900px) {
    .farm-feed-compare-cells {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 520px) {
    .farm-feed-compare-cells {
        grid-template-columns: 1fr;
    }
}

.farm-feed-compare-cell {
    font-size: 11px;
    line-height: 1.35;
    color: #334155;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 8px;
    min-height: 3.2em;
}

.farm-feed-compare-abbr {
    display: block;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 4px;
}

.farm-feed-compare-text {
    display: block;
    word-break: break-word;
}
