html {
    direction: rtl;
    text-align: right;
}

:root {
    --bg: #f5f7fb;
    --page-bg: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #24507a;
    --primary-600: #1f3f63;
    --accent: #7aa6b1;
    --border: #e6e9f0;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.08);
    --danger: #c0392b;
    --danger-600: #e74c3c;
    --secondary-bg: #eef2f6;
    --secondary-text: #1f2937;
    --secondary-border: #d8dde6;
    --btn-shadow: 0 8px 18px rgba(36, 80, 122, 0.18);
    --header-bg: linear-gradient(135deg, #ffffff 0%, #f3f7fd 100%);
    --header-border: #dbe3ef;
    --sidebar-bg: linear-gradient(180deg, #ffffff 0%, #f7f9fd 100%);
    --sidebar-border: #dfe6f0;
    --surface-soft: #f4f7fb;
    --surface-input: #fbfcfe;
    --surface-chip: #f9fbff;
    --surface-chip-hover: #eef4ff;
    --surface-chip-border-hover: #d7deea;
    --heading-bg: linear-gradient(135deg, #ffffff 0%, #f3f6fb 100%);
    --heading-line: #5aa3d6;
    --table-head-bg: #f4f7fb;
    --table-head-text: #344054;
    --table-row-hover: #eef4ff;
    --table-row-even: #fafcff;
    --table-row-border-dark: var(--border);
    --badge-bg: #eaf1f0;
    --badge-text: #256f60;
    --status-approved-bg: #ecfdf3;
    --status-approved-text: #15803d;
    --status-rejected-bg: #fff1f2;
    --status-rejected-text: #be123c;
    --status-pending-bg: #eff6ff;
    --status-pending-text: #1e3a8a;
    --info-soft-bg: #f8fbff;
    --neutral-badge-bg: #eef2f7;
    --neutral-badge-text: #334155;
    --warning-text: #b45309;
    --stat-up-bg: linear-gradient(135deg, #ffffff 0%, #eefbf2 100%);
    --stat-up-border: #16a34a;
    --stat-down-bg: linear-gradient(135deg, #ffffff 0%, #fff1f2 100%);
    --stat-down-border: #dc2626;
    --stat-medium-bg: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
    --stat-medium-border: #d97706;
    --panel-top-border: #dbeafe;
    --alert-base-bg: #fff4e5;
    --alert-base-border: #f5c87a;
    --alert-base-text: #8a4b00;
    --alert-base-edge: #f59e0b;
    --alert-danger-bg: #fff1f2;
    --alert-danger-border: #fecaca;
    --alert-danger-text: #9f1239;
    --alert-danger-edge: #e11d48;
    --alert-success-bg: #ecfdf3;
    --alert-success-border: #bbf7d0;
    --alert-success-text: #166534;
    --alert-success-edge: #16a34a;
    --alert-info-bg: #eff6ff;
    --alert-info-border: #bfdbfe;
    --alert-info-text: #1e3a8a;
    --alert-info-edge: #2563eb;
    --radius: 14px;
}

:root[data-theme="dark"] {
    --bg: #0b1220;
    --page-bg: linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
    --card: #0f172a;
    --text: #e5e7eb;
    --muted: #9aa4b2;
    --primary: #4f8cff;
    --primary-600: #76a7ff;
    --accent: #22c55e;
    --border: #1f2a3a;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    --danger: #b91c1c;
    --danger-600: #ef4444;
    --secondary-bg: #0f1a2b;
    --secondary-text: #e5e7eb;
    --secondary-border: #1f2a3a;
    --btn-shadow: 0 10px 20px rgba(79, 140, 255, 0.18);
    --header-bg: linear-gradient(135deg, #0f172a 0%, #111c30 100%);
    --header-border: #1f2a3a;
    --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #0b1324 100%);
    --sidebar-border: #1f2a3a;
    --surface-soft: #0f1a2b;
    --surface-input: #0f1a2b;
    --surface-chip: #0b1220;
    --surface-chip-hover: #111a2b;
    --surface-chip-border-hover: #223247;
    --heading-bg: linear-gradient(135deg, #0f172a 0%, #111c30 100%);
    --heading-line: #76a7ff;
    --table-head-bg: #0f1a2b;
    --table-head-text: #cbd5e1;
    --table-row-hover: #101b30;
    --table-row-even: #0d1728;
    --table-row-border-dark: #1f2a3a;
    --badge-bg: #0f2a24;
    --badge-text: #6ee7b7;
    --status-approved-bg: #0f2b1c;
    --status-approved-text: #86efac;
    --status-rejected-bg: #2a1015;
    --status-rejected-text: #fda4af;
    --status-pending-bg: #11233f;
    --status-pending-text: #bfdbfe;
    --info-soft-bg: #0f1a2b;
    --neutral-badge-bg: #1f2937;
    --neutral-badge-text: #cbd5e1;
    --warning-text: #fbbf24;
    --stat-up-bg: linear-gradient(135deg, #0f172a 0%, #0f2b1c 100%);
    --stat-up-border: #22c55e;
    --stat-down-bg: linear-gradient(135deg, #0f172a 0%, #2a1015 100%);
    --stat-down-border: #ef4444;
    --stat-medium-bg: linear-gradient(135deg, #0f172a 0%, #2a1d0f 100%);
    --stat-medium-border: #f59e0b;
    --panel-top-border: #1d3557;
    --alert-base-bg: #1a1307;
    --alert-base-border: #5a3b12;
    --alert-base-text: #f7d39a;
    --alert-base-edge: #d97706;
    --alert-danger-bg: #2a0f14;
    --alert-danger-border: #5f1d2a;
    --alert-danger-text: #fecdd3;
    --alert-danger-edge: #be123c;
    --alert-success-bg: #0f1f16;
    --alert-success-border: #134e2a;
    --alert-success-text: #bbf7d0;
    --alert-success-edge: #16a34a;
    --alert-info-bg: #0f1b2e;
    --alert-info-border: #1e3a8a;
    --alert-info-text: #bfdbfe;
    --alert-info-edge: #2563eb;
}

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
}

.print-only-page {
    background: #ffffff;
}

.print-only-wrapper {
    max-width: 100%;
}

.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 18px;
    align-items: start;
}

.container {
    max-width: 1180px;
    margin: 28px auto;
    padding: 0 18px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

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

.logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-600);
}

.brand-sub {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.global-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 260px;
}

.global-search-input {
    min-width: 220px;
}

.mobile-toggle {
    display: none;
}

.topbar-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.topbar-clock {
    font-weight: 700;
    color: var(--primary-600);
    font-size: 14px;
}

.topbar-date {
    font-size: 12px;
    color: var(--muted);
}

.topbar-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sidebar {
    position: sticky;
    top: 92px;
    height: fit-content;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    margin-right: 18px;
}

.sidebar-title {
    font-weight: 700;
    color: var(--primary-600);
    margin-bottom: 12px;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-links a {
    text-decoration: none;
    color: var(--text);
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--surface-chip);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.nav-icon {
    display: inline-block;
    width: 28px;
    text-align: center;
    color: var(--muted);
}

.sidebar-links a:hover {
    background: var(--surface-chip-hover);
    border-color: var(--surface-chip-border-hover);
}

.sidebar-links hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 8px 0;
}

.content {
    min-height: calc(100vh - 120px);
}

.muted {
    color: var(--muted);
    margin-right: 6px;
}

h1 {
    margin: 0 0 16px 0;
    font-size: 24px;
    font-weight: 800;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--heading-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
}

h1::after {
    content: "";
    position: absolute;
    right: 12px;
    bottom: 8px;
    width: 52px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--heading-line));
    border-radius: 999px;
}

h2 {
    font-size: 18px;
    margin: 16px 0 8px;
    color: var(--primary-600);
}

h3 {
    font-size: 16px;
    margin: 12px 0 8px;
    color: var(--primary-600);
}

h2,
h3 {
    font-weight: 700;
    letter-spacing: 0.2px;
}

table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 14px;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

.table-filter {
    margin-top: 8px;
}

.table-search {
    max-width: 320px;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 14px 12px;
    vertical-align: middle;
}

th {
    background: var(--table-head-bg);
    text-align: right;
    font-weight: 700;
    color: var(--table-head-text);
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: inset 0 -2px 0 var(--border);
}

td {
    border-bottom-color: var(--table-row-border-dark);
}

tr:hover td {
    background: var(--table-row-hover);
}

tr:nth-child(even) td {
    background: var(--table-row-even);
}

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

form {
    margin: 10px 0;
}

input,
select,
textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    background: var(--surface-input);
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.item-search {
    margin-bottom: 6px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 93, 138, 0.12);
}

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

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 26px;
}

.checkbox-field input {
    width: auto;
}

.card {
    background: var(--card);
    padding: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.card a {
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    display: block;
}

.badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--badge-bg);
    color: var(--badge-text);
    font-size: 12px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}

.status-approved {
    background: var(--status-approved-bg);
    color: var(--status-approved-text);
}

.status-rejected {
    background: var(--status-rejected-bg);
    color: var(--status-rejected-text);
}

.status-pending {
    background: var(--status-pending-bg);
    color: var(--status-pending-text);
}

.approval-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.approval-badge.ok {
    background: var(--status-approved-bg);
    color: var(--status-approved-text);
}

.approval-badge.pending {
    background: var(--status-pending-bg);
    color: var(--status-pending-text);
}

.approval-badge.na {
    background: var(--surface-soft);
    color: var(--muted);
}

.row-in td {
    background: var(--status-approved-bg);
}

.row-out td {
    background: var(--status-rejected-bg);
}

.approval-group summary {
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
    color: white;
    border: 1px solid transparent;
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    min-height: 40px;
    min-width: 110px;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease, border-color 0.2s ease;
    box-shadow: var(--btn-shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    filter: brightness(1.03);
}

.btn:active {
    transform: translateY(0);
    filter: brightness(0.98);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.25);
}

.btn.danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-600) 100%);
    box-shadow: 0 8px 18px rgba(185, 28, 28, 0.2);
}

.btn.secondary {
    background: var(--secondary-bg);
    color: var(--secondary-text);
    border: 1px solid var(--secondary-border);
    box-shadow: none;
}

.theme-toggle-btn {
    min-width: 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 18px;
    border-radius: 999px;
    line-height: 1;
}

:root[data-theme="dark"] .btn.secondary {
    background: var(--secondary-bg);
    color: var(--secondary-text);
    border-color: var(--secondary-border);
}

.btn.print {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
}

.alert {
    background: var(--alert-base-bg);
    border: 1px solid var(--alert-base-border);
    color: var(--alert-base-text);
    padding: 10px 12px;
    border-radius: 10px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    border-right: 4px solid var(--alert-base-edge);
}

.alert::before {
    content: "⚠️";
}

.alert.danger {
    background: var(--alert-danger-bg);
    border: 1px solid var(--alert-danger-border);
    color: var(--alert-danger-text);
    border-right-color: var(--alert-danger-edge);
}

.alert.danger::before {
    content: "⛔";
}

.alert.success {
    background: var(--alert-success-bg);
    border: 1px solid var(--alert-success-border);
    color: var(--alert-success-text);
    border-right-color: var(--alert-success-edge);
}

.alert.success::before {
    content: "✅";
}

.alert.info {
    background: var(--alert-info-bg);
    border: 1px solid var(--alert-info-border);
    color: var(--alert-info-text);
    border-right-color: var(--alert-info-edge);
}

.alert.info::before {
    content: "ℹ️";
}

.report-filters {
    position: sticky;
    top: 86px;
    z-index: 2;
    background: var(--card);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    backdrop-filter: blur(4px);
}

@media (min-width: 1100px) {
    .report-filters .grid {
        grid-template-columns: repeat(4, minmax(220px, 1fr));
        gap: 12px;
    }
}

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

.inline-form input {
    max-width: 240px;
}

.inline-form select {
    min-width: 260px;
    flex: 0 0 260px;
}

.inline-form {
    align-items: stretch;
}

.multi-select {
    width: 260px;
    min-width: 260px;
    max-width: 320px;
    height: auto;
}

.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: end;
    padding-top: 4px;
}

.toolbar .btn {
    min-height: 42px;
}

.live-feed-toolbar {
    justify-content: space-between;
    align-items: center;
}

.live-feed-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--info-soft-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 10px;
}

.live-feed-interval {
    width: 90px;
}

.feed-action-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
}

.feed-action-badge.neutral {
    background: var(--neutral-badge-bg);
    color: var(--neutral-badge-text);
}

.feed-action-badge.ok {
    background: #dcfce7;
    color: #166534;
}

.feed-action-badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.feed-action-badge.info {
    background: #dbeafe;
    color: #1d4ed8;
}

.executive-toolbar {
    justify-content: flex-start;
    gap: 10px;
}

.executive-days-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--info-soft-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 10px;
    font-weight: 600;
}

.executive-days-input {
    width: 120px;
}

.executive-kpi-value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
}

.executive-kpi-card {
    border-top: 3px solid var(--border);
}

.executive-kpi-card.risk-low {
    border-top-color: var(--stat-up-border);
    background: var(--stat-up-bg);
}

.executive-kpi-card.risk-medium {
    border-top-color: var(--stat-medium-border);
    background: var(--stat-medium-bg);
}

.executive-kpi-card.risk-high {
    border-top-color: var(--stat-down-border);
    background: var(--stat-down-bg);
}

.executive-chart-card,
.executive-top-projects-card,
.executive-recent-feed-card,
.live-feed-table-card,
.live-feed-toolbar-card {
    border-top: 3px solid var(--panel-top-border);
}

.transfer-reports-link {
    margin-right: auto;
    font-weight: 700;
    border-width: 2px;
}

.back-top {
    position: fixed;
    bottom: 18px;
    left: 18px;
    border: none;
    border-radius: 999px;
    padding: 10px 12px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 20;
}

.back-top.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.details-panel {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    display: none;
}

.details-panel.open {
    display: block;
}

.stock-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

.stock-hint.low {
    color: var(--warning-text);
}

.stock-hint.danger {
    color: var(--danger);
    font-weight: 600;
}

.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.stat-card {
    background: var(--card);
    border-radius: 16px;
    padding: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card.up {
    border-right: 4px solid var(--stat-up-border);
    background: var(--stat-up-bg);
}

.stat-card.down {
    border-right: 4px solid var(--stat-down-border);
    background: var(--stat-down-bg);
}

.stat-title {
    font-weight: 800;
    margin-bottom: 12px;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.04);
}

.stat-card.up .stat-title {
    background: rgba(22, 163, 74, 0.1);
    color: #166534;
}

.stat-card.down .stat-title {
    background: rgba(220, 38, 38, 0.1);
    color: #991b1b;
}

.mini-table {
    margin-top: 8px;
    box-shadow: none;
}

.mini-table th,
.mini-table td {
    padding: 8px;
    font-size: 13px;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
}

.rank-badge.up {
    background: var(--status-approved-bg);
    color: var(--status-approved-text);
}

.rank-badge.down {
    background: var(--status-rejected-bg);
    color: var(--status-rejected-text);
}

.qty-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    display: inline-block;
}

.qty-badge.up {
    background: var(--status-approved-bg);
    color: var(--status-approved-text);
}

.qty-badge.down {
    background: var(--status-rejected-bg);
    color: var(--status-rejected-text);
}

.pagination {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.page-link {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    background: var(--card);
}

.page-link.active-page {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.review-card {
    margin-top: 12px;
}

.review-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: grid;
    gap: 6px;
}

.review-list li {
    display: flex;
    gap: 8px;
    align-items: center;
}

.print-area {
    background: white;
    padding: 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.doc-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.doc-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.doc-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-600);
}

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

.doc-table th,
.doc-table td {
    padding: 10px;
    border: 1px solid var(--border);
}

.doc-header {
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.doc-header .brand-title {
    font-size: 18px;
    font-weight: 800;
}

.doc-header .brand-sub {
    font-size: 12px;
    color: var(--muted);
}

.doc-title {
    font-size: 20px;
    font-weight: 800;
    text-align: center;
}

.print-area .doc-table {
    margin-top: 10px;
}

.print-area .doc-table th {
    background: #f1f5f9;
    font-weight: 700;
}

.print-area .doc-table td,
.print-area .doc-table th {
    padding: 8px 10px;
}

.print-area .footer-note {
    text-align: left;
}

.doc-meta-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.doc-meta-item {
    font-size: 12px;
    color: var(--muted);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px 10px;
}

.doc-meta-item b {
    color: var(--text);
    margin-inline-start: 4px;
}

.official-signatures {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 18px;
}

.sig-box {
    border: 1px dashed var(--border);
    border-radius: 10px;
    min-height: 64px;
    padding: 8px 10px;
}

.sig-title {
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 20px;
}

.sig-line {
    border-bottom: 1px solid var(--border);
    height: 1px;
}

.official-print-footer {
    display: none;
}

.print-only {
    display: none;
}

.footer-note {
    color: var(--muted);
    font-size: 12px;
    margin-top: 8px;
}

@media print {
    @page {
        size: A4;
        margin: 14mm 10mm 18mm 10mm;
    }
    html,
    body {
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    *,
    *::before,
    *::after {
        box-shadow: none !important;
        text-shadow: none !important;
        filter: none !important;
        background-image: none !important;
    }
    .no-print {
        display: none;
    }
    .print-only {
        display: block;
    }
    .sidebar,
    .topbar {
        display: none;
    }
    body {
        background: #ffffff !important;
    }
    .layout,
    .content,
    .container {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    .print-area {
        border: none !important;
        box-shadow: none;
        padding-bottom: 2mm;
        margin-bottom: 2mm;
        padding: 0;
        box-sizing: border-box;
        background: #fff !important;
    }
    .card {
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #fff !important;
    }
    .topbar {
        box-shadow: none;
    }
    table {
        page-break-inside: auto;
        margin-top: 0 !important;
        border-radius: 0 !important;
        border: 1px solid #64748b !important;
        background: #fff !important;
    }
    .print-area table,
    .print-area .doc-table {
        border: 1px solid #64748b !important;
    }
    thead {
        display: table-header-group;
    }
    tfoot {
        display: table-footer-group;
    }
    tr,
    td,
    th {
        break-inside: avoid-page;
        page-break-inside: avoid;
        border-color: #64748b !important;
    }
    th {
        position: static;
        box-shadow: none;
    }
    .official-signatures {
        page-break-inside: avoid;
        margin-top: 14px;
    }
    .official-print-footer {
        display: flex;
        position: static;
        margin-top: 3mm;
        padding: 2mm 0;
        border-top: 1px solid #94a3b8;
        background: #ffffff;
        color: #475569;
        font-size: 11px;
        justify-content: space-between;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        min-height: 6mm;
    }
    .official-page-number::after {
        content: "صفحة " counter(page);
    }
    .print-in td {
        background: #dcfce7;
        color: #166534;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .print-out td {
        background: #fee2e2;
        color: #991b1b;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

@media (max-width: 980px) {
    .report-filters {
        position: static;
        top: auto;
        z-index: 1;
    }
    .layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .sidebar {
        position: static;
        margin-right: 0;
        display: none;
    }
    .sidebar.open {
        display: block;
    }
    .mobile-toggle {
        display: inline-flex;
    }
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }
    .topbar-stats {
        width: 100%;
        justify-content: flex-start;
    }
    .global-search-form {
        width: 100%;
        min-width: 0;
    }
    .global-search-input {
        flex: 1;
        min-width: 0;
    }
    .container {
        margin: 18px auto;
        padding: 0 12px;
    }
    .logo {
        width: 48px;
        height: 48px;
    }
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }
    th,
    td {
        white-space: nowrap;
        padding: 10px 10px;
    }
    .toolbar {
        width: 100%;
    }
    .toolbar .btn {
        min-width: 140px;
    }
    .transfer-reports-link {
        margin-right: 0;
    }
    .live-feed-toolbar,
    .executive-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .live-feed-control,
    .executive-days-control {
        width: 100%;
        justify-content: space-between;
        box-sizing: border-box;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 20px;
        padding: 8px 10px;
    }
    .brand-title {
        font-size: 16px;
    }
    .brand-sub {
        font-size: 11px;
    }
    .topbar {
        padding: 10px 12px;
        gap: 8px;
    }
    .topbar-meta {
        padding: 4px 8px;
    }
    .topbar-clock {
        font-size: 12px;
    }
    .topbar-date {
        font-size: 11px;
    }
    .grid {
        grid-template-columns: 1fr;
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }
    .card {
        padding: 14px;
        border-radius: 12px;
    }
    .topbar {
        padding: 12px 14px;
    }
    .sidebar {
        border-radius: 12px;
    }
    .grid {
        gap: 10px;
    }
    .sidebar-links a {
        font-size: 14px;
    }
    .table-search {
        max-width: 100%;
    }
    th,
    td {
        font-size: 13px;
        padding: 9px 8px;
    }
    .topbar-meta {
        width: 100%;
    }
    .topbar-stats {
        width: 100%;
        flex-wrap: wrap;
    }
    .global-search-form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .official-signatures {
        grid-template-columns: 1fr;
    }
    .btn,
    .btn.secondary,
    .btn.danger {
        min-width: 100%;
        min-height: 42px;
    }
}
