/* فونت مَحور - هویت بصری */
@font-face {
    font-family: 'Mahoor';
    src: url('../fonts/mahoor.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #5b6cff;
    --primary-dark: #3f4de6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #0f172a;
    --light: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f7f9fd;
    --border: #e6eaf2;
    --text: #1e293b;
    --text-muted: #64748b;
    --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.1);
}

body {
    font-family: 'Mahoor', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
    transition: background-color .25s ease, color .25s ease;
}

/* Panel Layout + Sidebar (منو سایدبار سمت راست) */
.panel-layout {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
}

.sidebar {
    width: 244px;
    flex-shrink: 0;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
}

.sidebar-header {
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    color: var(--primary);
    font-size: 1.1em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-user {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 0.85em;
}

.sidebar-user-line {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.sidebar-user-identity {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
    max-width: 140px;
}

.sidebar-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 0;
    padding: 5px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.84em;
    width: auto;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
}
.sidebar-logout:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.sidebar-nav {
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.sidebar-link {
    padding: 10px 12px;
    font-size: 0.95em;
    text-decoration: none;
    color: var(--text);
    border-radius: 12px;
    transition: all 0.2s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    position: relative;
}

.brand-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.menu-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.inline-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.stat-icon-svg {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.sidebar-link:hover {
    background: var(--surface-soft);
    color: var(--primary);
    transform: translateX(-1px);
}

.sidebar-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 8px 18px rgba(91, 108, 255, 0.28);
}

/* آیکن منوی فعال در حالت روشن باید با متن سفید هماهنگ باشد */
.sidebar-link.active .menu-icon {
    filter: brightness(0) invert(1);
}

.sidebar-link.active:hover {
    color: #fff;
}

.sidebar-link.active:hover .menu-icon {
    filter: brightness(0) invert(1);
}

.sidebar-link.active::before {
    content: "";
    position: absolute;
    right: -10px;
    top: 9px;
    width: 3px;
    height: calc(100% - 18px);
    border-radius: 999px;
    background: var(--primary);
}

.sidebar-link span {
    display: inline-flex;
    align-items: center;
    line-height: 1.35;
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding-top: 24px;
    padding-bottom: 0;
}

.panel-toolbar {
    padding: 0 24px 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    direction: ltr;
    gap: 8px;
}

.panel-toolbar-label {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1;
}

/* جداکننده‌ی گروه‌های سایدبار (UX بدون تغییر مسیرها) */
.sidebar-nav .section-start {
    margin-top: 8px;
}

.sidebar-nav .section-start::after {
    content: "";
    position: absolute;
    top: -6px;
    right: 10px;
    left: 10px;
    height: 1px;
    background: var(--border);
}

/* Container */
.container {
    max-width: none;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px 34px;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 2em;
    color: var(--dark);
    margin-bottom: 5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.page-header p {
    color: var(--text-muted);
}

/* Stats — داشبورد و صفحات مشابه (فشرده، ردیف آخر پر می‌شود) */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 158px;
    min-width: 140px;
    max-width: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.stat-card.active .stat-icon {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.stat-card.pending .stat-icon {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
}

.stat-card.orders .stat-icon {
    background: linear-gradient(135deg, var(--info) 0%, #2563eb 100%);
}

.stat-card.accepted .stat-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.stat-card.completed .stat-icon {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.stat-content {
    min-width: 0;
    flex: 1 1 auto;
}

.stat-content h3 {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 2px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.stat-content p {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.25;
    margin: 0;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 1.3em;
    color: var(--dark);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.btn-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.3s;
}

.btn-link:hover {
    color: var(--primary-dark);
}

.card-body {
    padding: 20px;
}

/* Categories List */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--light);
    border-radius: 8px;
}

.category-name {
    font-weight: 600;
    color: var(--dark);
}

.category-count {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
}

.data-table thead {
    background: var(--surface-soft);
}

.data-table th {
    padding: 12px 14px;
    text-align: right;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9em;
    border: 1px solid var(--border);
}

.data-table td {
    padding: 12px 14px;
    text-align: right;
    border: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--surface-soft);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge.active {
    background: #d1fae5;
    color: #065f46;
}

.badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.badge.pending_review {
    background: #e0e7ff;
    color: #3730a3;
}

.badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.badge.sent {
    background: #dbeafe;
    color: #1e40af;
}

.badge.accepted {
    background: #e9d5ff;
    color: #6b21a8;
}

.badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.badge.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.badge.cancelled {
    background: #f3f4f6;
    color: #374151;
}

.badge.delivered {
    background: #d1fae5;
    color: #065f46;
}

.badge.changed {
    background: #fef3c7;
    color: #92400e;
}

.badge.category {
    background: #e0e7ff;
    color: #3730a3;
}

/* Links */
.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

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

.text-muted {
    color: var(--text-muted);
    font-size: 0.9em;
}

.text-warning {
    color: #b8860b;
    font-size: 0.9em;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 50px;
    padding: 20px 0;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    text-align: center;
    color: var(--text-muted);
}

/* Filters */
.filters {
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    min-height: 42px;
}

.filter-search,
.filter-select {
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-size: 0.95em;
    font-family: inherit;
    box-sizing: border-box;
}

.filter-search {
    min-width: 220px;
    flex: 1;
    max-width: 320px;
}

.filter-select {
    min-width: 180px;
}

.btn-primary, .btn-secondary {
    height: 42px;
    padding: 0 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.btn-primary img,
.btn-secondary img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.theme-toggle {
    height: 34px;
    width: 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s ease;
}

.theme-toggle:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.theme-icon {
    width: 18px;
    height: 18px;
    display: none;
}

body:not(.theme-dark) .theme-icon-dark { display: block; }
body.theme-dark .theme-icon-light { display: block; }

/* تم تاریک: پس‌زمینه خنثی (کروم/مشکی) بدون ته رنگ بنفش */
body.theme-dark {
    color-scheme: dark;
    --primary: #60a5fa;
    --primary-dark: #3b82f6;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #38bdf8;
    --dark: #fafafa;
    --light: #09090b;
    --surface: #18181b;
    --surface-soft: #27272a;
    --border: #3f3f46;
    --text: #f4f4f5;
    --text-muted: #a1a1aa;
    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.55);
}

body.theme-dark .menu-icon,
body.theme-dark .inline-icon,
body.theme-dark .brand-icon,
body.theme-dark .theme-icon {
    filter: brightness(0) invert(1);
}

body.theme-dark .stat-icon-svg {
    filter: brightness(0) invert(1);
}

/* فیلدها و سلکت: متن و پس‌زمینه صریح (جلوگیری از متن مشکی سیستم‌عامل) */
body.theme-dark .filter-search,
body.theme-dark .filter-select,
body.theme-dark .pagination-select,
body.theme-dark select,
body.theme-dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="file"]),
body.theme-dark textarea {
    color: var(--text);
    background-color: var(--surface-soft);
    border-color: var(--border);
    caret-color: var(--text);
}

body.theme-dark .filter-search::placeholder,
body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

body.theme-dark select option {
    background-color: var(--surface);
    color: var(--text);
}

body.theme-dark .btn-secondary:hover {
    background: #3f3f46;
    color: var(--text);
}

body.theme-dark .sidebar-link:hover {
    background: var(--surface-soft);
    color: var(--text);
}

body.theme-dark .sidebar-link.active {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

body.theme-dark .data-table td {
    color: var(--text);
}

body.theme-dark .data-table th {
    color: var(--dark);
}

.btn-small {
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85em;
    transition: background 0.3s;
}

.btn-small:hover {
    background: var(--primary-dark);
}

.btn-small.btn-outline {
    background: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-small.btn-outline:hover {
    background: var(--border);
}

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

.btn-small.btn-success:hover {
    filter: brightness(1.06);
}

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

.btn-small.btn-danger:hover {
    filter: brightness(1.06);
}

.btn-back {
    display: inline-block;
    margin-bottom: 15px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.btn-back:hover {
    text-decoration: underline;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }

.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

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

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

.info-label {
    font-weight: 600;
    color: var(--text-muted);
}

.info-value {
    color: var(--dark);
    text-align: left;
}

.full-width {
    width: 100%;
    overflow-x: auto;
}

/* جدول بزرگ‌تر و کارت لیست سفارشات */
.card-table .card-body {
    padding: 16px;
}

.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.card-table .data-table {
    font-size: 0.95em;
}

.card-table .data-table th,
.card-table .data-table td {
    padding: 10px 12px;
    white-space: nowrap;
}

.card-table .data-table td.product-cell {
    white-space: nowrap;
    max-width: 150px;
    vertical-align: middle;
}

.card-table .data-table td.category-cell {
    white-space: normal;
    max-width: 200px;
    width: 200px;
    min-width: 160px;
    color: var(--text-muted);
    font-size: 0.9em;
    vertical-align: middle;
    overflow: hidden;
}

.category-cell-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 6px;
    width: 100%;
    max-width: 100%;
}

.category-cell-badge {
    display: block;
    font-size: 0.78em;
    padding: 2px 6px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.order-category-more-btn {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 2px 8px !important;
    font-size: 0.78em !important;
    height: auto !important;
    min-height: 0 !important;
    line-height: 1.3;
    max-width: 100%;
}

.order-list-cell-text,
.category-cell-text {
    display: inline-block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.order-list-modal-btn,
.order-categories-btn {
    padding: 4px 10px;
    font-size: 0.82em;
    white-space: nowrap;
    max-width: 100%;
}

.order-list-modal-items,
.order-categories-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(60vh, 420px);
    overflow-y: auto;
}

.order-list-modal-items li,
.order-categories-list li {
    margin: 0;
    line-height: 1.45;
    word-break: break-word;
}

.order-list-modal-items .badge.category,
.order-categories-list .badge.category {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    text-align: right;
    line-height: 1.4;
}

.panel-modal__dialog--wide {
    max-width: 640px;
}

.category-cell-text {
    max-width: 130px;
}

/* مودال عمومی پنل */
.panel-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.panel-modal[hidden] {
    display: none !important;
}

.panel-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

body.theme-dark .panel-modal__backdrop {
    background: rgba(0, 0, 0, 0.72);
}

.panel-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: min(90vh, 640px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
}

.panel-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-modal__header h2 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--dark);
}

.panel-modal__close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.panel-modal__close:hover {
    color: var(--text);
    border-color: var(--primary);
}

.panel-modal__body {
    padding: 20px;
}

.panel-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* صفحه‌بندی */
.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.95em;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-page {
    font-size: 0.95em;
    color: var(--text);
}

.filter-form .pagination-select {
    min-width: 120px;
}

/* Responsive */
@media (max-width: 768px) {
    .panel-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        padding-bottom: 12px;
    }
    
    .sidebar-header {
        width: 100%;
    }
    
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
    }
    
    .sidebar-link {
        flex: 1 1 auto;
        min-width: 140px;
    }
    
    .stats-grid {
        flex-direction: column;
    }

    .stat-card {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 15px 30px;
    }

    .panel-toolbar {
        padding: 0 15px 10px;
    }
    
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select {
        width: 100%;
    }
}

/* ——— جزئیات سفارش ——— */
.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.order-detail-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: none;
}

.order-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    grid-auto-flow: column;
    gap: 20px;
    align-items: start;
}

@media (max-width: 768px) {
    .order-detail-grid {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        grid-auto-flow: row;
    }
}

.order-detail-grid .order-detail-info-grid {
    grid-template-columns: 1fr;
}

.order-detail-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.order-detail-card--items .card-body {
    padding-top: 0;
}

.order-detail-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 24px;
}

@media (max-width: 640px) {
    .order-detail-info-grid {
        grid-template-columns: 1fr;
    }
}

.order-detail-info-grid .info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.order-detail-info-grid .info-value {
    text-align: right;
    width: 100%;
}

.order-detail-block {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.order-detail-block__title {
    margin: 0 0 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

.order-detail-block__text {
    margin: 0;
    line-height: 1.6;
    color: var(--dark);
}

.order-detail-form-block {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.order-detail-form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.order-detail-form-row .filter-select {
    flex: 1;
    min-width: 180px;
}

.order-detail-textarea {
    width: 100%;
    min-height: 88px;
    margin-top: 8px;
    margin-bottom: 10px;
}

.order-detail-address {
    line-height: 1.6;
    max-width: 100%;
}

.order-detail-card--compact .card-body {
    padding-top: 8px;
}

.order-detail-info-grid--dates .info-row {
    padding: 8px 0;
}

.order-detail-alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.order-detail-alert {
    margin: 0;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.order-detail-alert--ok {
    background: #d1fae5;
    color: #065f46;
}

.order-detail-alert--err {
    background: #fee2e2;
    color: #991b1b;
}

body.theme-dark .order-detail-alert--ok {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}

body.theme-dark .order-detail-alert--err {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.order-detail-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px 24px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.order-detail-hero-main {
    flex: 1 1 200px;
    min-width: 0;
}

.order-detail-hero-label {
    margin: 0 0 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.order-detail-hero-number {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.2;
}

.order-detail-hero-meta {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.order-detail-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.order-detail-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 28px;
    margin: 0;
    padding: 0;
    list-style: none;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.order-detail-hero-stats > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-detail-hero-stats dt,
.order-detail-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.order-detail-hero-stats dd,
.order-detail-stat-value {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.order-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: 18px;
    align-items: start;
}

.order-detail-main,
.order-detail-aside {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.order-detail-card--primary {
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.order-detail-card--primary .card-header {
    background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}

.order-detail-pill {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 999px;
}

.card-body--flush {
    padding: 0;
}

.card-body--flush .order-lines-table-wrap {
    padding: 0;
}

.card-body--flush .data-table {
    border: none;
    border-radius: 0;
}

.info-dl {
    margin: 0;
}

.info-dl-row {
    display: grid;
    grid-template-columns: minmax(110px, 140px) minmax(0, 1fr);
    gap: 8px 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    align-items: start;
}

.info-dl-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-dl-row:first-child {
    padding-top: 0;
}

.info-dl-row dt {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0;
}

.info-dl-row dd {
    margin: 0;
    color: var(--text);
    text-align: right;
    line-height: 1.45;
}

.info-dl--compact .info-dl-row {
    padding: 8px 0;
}

.info-dl-row--block dd {
    white-space: pre-wrap;
    word-break: break-word;
}

.order-detail-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.order-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.order-detail-form-block {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-detail-form-block:first-child {
    padding-top: 0;
}

.order-detail-form-block:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.form-group-label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0;
}

.order-detail-field {
    width: 100%;
    min-width: 0;
    max-width: none;
}

.order-detail-textarea {
    min-height: 88px;
    padding: 10px 14px;
    resize: vertical;
}

.order-detail-btn-full {
    width: 100%;
    margin-top: 4px;
}

.order-detail-empty {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.order-lines-table-wrap {
    overflow-x: auto;
}

.order-lines-table code {
    font-size: 0.85em;
    background: var(--surface-soft);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.order-lines-props {
    max-width: 280px;
    white-space: normal;
    line-height: 1.4;
}

@media (max-width: 1024px) {
    .order-detail-layout {
        grid-template-columns: 1fr;
    }

    .order-detail-aside {
        order: 2;
    }
}

@media (max-width: 768px) {
    .order-detail-hero {
        padding: 14px 16px;
    }

    .info-dl-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

.bulk-actions-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface-soft, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
}

.bulk-actions-label {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.bulk-check-col {
    width: 40px;
    text-align: center;
}

.bulk-status-hint {
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.order-slices-table .order-slice-actions {
    min-width: 200px;
}

.order-slice-status-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.filter-select--compact {
    min-width: 140px;
    padding: 4px 8px;
    font-size: 0.85rem;
}
