/* ============================================================
   HNC INVOICE SYSTEM — PREMIUM UI STYLESHEET v9
   Dark Navy + Gold Luxury Theme | RTL Arabic
   ============================================================ */

/* ── RESET ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── ROOT VARIABLES ── */
:root {
    --gold:         #d4af37;
    --gold-light:   #f0d060;
    --gold-dark:    #a07820;
    --navy:         #0f172a;
    --navy-mid:     #1e293b;
    --navy-light:   #334155;
    --surface:      rgba(15, 23, 42, 0.75);
    --surface-2:    rgba(30, 41, 59, 0.6);
    --border-gold:  rgba(212, 175, 55, 0.25);
    --text-primary: #f1f5f9;
    --text-muted:   #94a3b8;
    --radius-sm:    8px;
    --radius-md:    14px;
    --radius-lg:    22px;
    --radius-xl:    28px;
    --shadow-card:  0 25px 60px -12px rgba(0,0,0,.55), 0 8px 20px rgba(0,0,0,.3);
    --shadow-btn:   0 4px 14px -2px rgba(0,0,0,.4);
    --transition:   all .25s cubic-bezier(.4,0,.2,1);
}

/* ── BODY ── */
body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, #020617 0%, #0c1225 50%, #0f172a 100%);
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

/* subtle animated stars */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(212,175,55,.15) 0%, transparent 100%),
        radial-gradient(1px 1px at 80% 10%, rgba(212,175,55,.1) 0%, transparent 100%),
        radial-gradient(1px 1px at 50% 80%, rgba(212,175,55,.08) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* ── CONTAINER ── */
.container {
    width: 100%;
    max-width: 1300px;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* ──────────────────────────────────────────────────
   CONTROL PANEL  (Home Screen Card)
───────────────────────────────────────────────── */
.control-panel {
    background: rgba(15, 23, 42, 0.72) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid var(--border-gold) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-card), 0 0 0 1px rgba(255,255,255,.03) !important;
    padding: 60px 68px !important;
    width: 100%;
    max-width: 1200px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 36px;
}

/* top accent line */
.control-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ── SYSTEM TITLE ── */
.system-title {
    background: linear-gradient(135deg, #fbf8cc 0%, var(--gold) 50%, #fbf8cc 100%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    font-size: 2.5rem !important;
    font-weight: 900 !important;
    letter-spacing: -0.5px !important;
    text-align: center !important;
    line-height: 1.3 !important;
    margin-bottom: 0 !important;
    font-family: 'Tajawal', 'Arial Black', sans-serif !important;
}

/* ── CONTROL BUTTONS GRID ── */
.control-buttons {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)) !important;
    gap: 16px !important;
    width: 100% !important;
    justify-items: stretch !important;
}

/* ──────────────────────────────────────────────────
   BUTTONS  — Base
───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 700;
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
    cursor: pointer;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,.3);
    box-shadow: var(--shadow-btn);
    transition: var(--transition);
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
    letter-spacing: 0.2px;
}

.btn:hover {
    transform: translateY(-3px);
    filter: brightness(1.12);
    box-shadow: 0 8px 24px -4px rgba(0,0,0,.5);
}

.btn:active {
    transform: translateY(-1px);
    filter: brightness(0.95);
}

/* Control panel buttons specifically */
.control-buttons .btn {
    padding: 17px 22px !important;
    font-size: 15px !important;
    border-radius: 14px !important;
    background: rgba(30, 41, 59, 0.5) !important;
    border: 1px solid rgba(212, 175, 55, 0.35) !important;
    color: var(--gold-light) !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px !important;
    text-shadow: none !important;
    box-shadow: 0 2px 12px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.05) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    backdrop-filter: blur(6px) !important;
    min-height: 60px !important;
}

.control-buttons .btn:hover {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%) !important;
    color: #0f172a !important;
    border-color: var(--gold) !important;
    box-shadow: 0 8px 24px -4px rgba(212,175,55,.45) !important;
    transform: translateY(-3px) !important;
}

/* ── BUTTON VARIANTS ── */
.btn-primary   { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.btn-primary:hover   { background: linear-gradient(135deg, #2563eb, #1d4ed8); }

.btn-success   { background: linear-gradient(135deg, #10b981, #059669); }
.btn-success:hover   { background: linear-gradient(135deg, #059669, #047857); }

.btn-info      { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.btn-info:hover      { background: linear-gradient(135deg, #0284c7, #0369a1); }

.btn-warning   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.btn-warning:hover   { background: linear-gradient(135deg, #d97706, #b45309); }

.btn-danger    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-danger:hover    { background: linear-gradient(135deg, #dc2626, #b91c1c); }

.btn-cancel    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-cancel:hover    { background: linear-gradient(135deg, #dc2626, #b91c1c); }

.btn-purple    { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.btn-purple:hover    { background: linear-gradient(135deg, #7c3aed, #6d28d9); }

.btn-cyan      { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.btn-cyan:hover      { background: linear-gradient(135deg, #0891b2, #0e7490); }

.btn-blue-dark { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.btn-blue-dark:hover { background: linear-gradient(135deg, #2563eb, #1e3a8a); }

.btn-green-dark{ background: linear-gradient(135deg, #22c55e, #15803d); }
.btn-green-dark:hover{ background: linear-gradient(135deg, #16a34a, #14532d); }

.btn-currency  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.btn-currency.dinar-mode { background: linear-gradient(135deg, #10b981, #059669); }

.btn-nav {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    color: white;
    border-radius: 50px;
    padding: 9px 20px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-nav:hover {
    background: rgba(212,175,55,.3);
    border-color: var(--gold);
}

.btn-full { width: 100%; }
.btn-sm   { padding: 5px 12px !important; font-size: 12px !important; }

/* ──────────────────────────────────────────────────
   UTILITIES
───────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ──────────────────────────────────────────────────
   NAVIGATION PANEL  (Floating bottom pill)
───────────────────────────────────────────────── */
.navigation-panel {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-gold);
    padding: 12px 28px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.04);
    z-index: 999;
}

.navigation-panel.hidden { display: none; }

.invoice-counter {
    color: var(--gold);
    font-weight: 800;
    font-size: 16px;
    min-width: 80px;
    text-align: center;
    background: rgba(212,175,55,.1);
    border: 1px solid rgba(212,175,55,.2);
    padding: 6px 14px;
    border-radius: 30px;
    letter-spacing: 0.5px;
}

/* ──────────────────────────────────────────────────
   MODAL OVERLAY + CONTENT
───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.82);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.hidden { display: none; }

.modal-content {
    background: #ffffff !important;
    color: #1e293b !important;
    padding: 30px !important;
    border-radius: var(--radius-lg) !important;
    max-width: 960px !important;
    width: 97% !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
    box-shadow: 0 30px 70px rgba(0,0,0,.45) !important;
    border: none !important;
    position: relative;
}

/* scrollbar inside modals */
.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 3px; }
.modal-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.modal-form { display: flex; flex-direction: column; gap: 18px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 700; color: #1e3a8a; font-size: 13px; }
.form-group input,
.form-group select {
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: #1e293b;
    background: #f8fafc;
    transition: var(--transition);
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.form-row { display: flex; gap: 14px; }
.form-group.half { flex: 1; }

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.modal-buttons .btn { padding: 12px 22px; font-size: 14px; }

/* ──────────────────────────────────────────────────
   TOOLBAR  (inside modals)
───────────────────────────────────────────────── */
.toolbar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 14px 20px !important;
    background: #ffffff !important;
    border-bottom: 2px solid #e2e8f0 !important;
    margin-bottom: 20px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.print-btn, .close-btn {
    padding: 9px 20px !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    color: white !important;
    transition: var(--transition) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 90px !important;
}
.print-btn { background: #3b82f6 !important; }
.print-btn:hover { background: #2563eb !important; }
.close-btn { background: #ef4444 !important; }
.close-btn:hover { background: #dc2626 !important; }

/* ──────────────────────────────────────────────────
   HISTORY TABLE  (invoice log)
───────────────────────────────────────────────── */
.history-stats {
    display: flex;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-box {
    flex: 1;
    min-width: 120px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.stat-box.blue   { background: linear-gradient(135deg, #e0f2fe, #bfdbfe); }
.stat-box.yellow { background: linear-gradient(135deg, #fef9c3, #fef08a); }
.stat-label { font-size: 12.5px; color: #4b5563; font-weight: 700; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 800; color: #1e3a8a; }

/* List container */
.history-list-container {
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    background: #fff;
    max-height: 56vh;
    overflow-y: auto;
    overflow-x: auto;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    direction: ltr;
}
.history-list-container::-webkit-scrollbar { width: 5px; height: 5px; }
.history-list-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* History Table */
.history-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
    direction: rtl;
}

.history-table th {
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
    color: #fff;
    padding: 12px 10px;
    border: 1px solid #1d4ed8;
    position: sticky;
    top: 0;
    z-index: 10;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.history-table td {
    padding: 10px 10px;
    border-bottom: 1px solid #f1f5f9;
    border-left: 1px solid #f1f5f9;
    color: #1e293b;
    font-weight: 600;
    vertical-align: middle;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Balanced column widths ── */
.history-table th:nth-child(1),
.history-table td:nth-child(1) { width: 72px; }

.history-table th:nth-child(2),
.history-table td:nth-child(2) { width: 110px; }

.history-table th:nth-child(3),
.history-table td:nth-child(3) {
    width: auto;
    min-width: 180px;
    text-align: right;
    padding-right: 14px;
    white-space: normal;
}

.history-table th:nth-child(4),
.history-table td:nth-child(4) { width: 155px; }

.history-table th:nth-child(5),
.history-table td:nth-child(5) { width: 260px; min-width: 260px; }

/* row striping + hover */
.history-table tbody tr { transition: background .12s ease; }
.history-table tbody tr:nth-child(odd)  { background: #f8fafc; }
.history-table tbody tr:nth-child(even) { background: #ffffff; }
.history-table tbody tr:hover td {
    background: #dbeafe !important;
}

/* History filters bar */
.history-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px;
    background: #f8fafc;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
}
.history-filters input,
.history-filters select {
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #1e293b;
    transition: var(--transition);
}
.history-filters input:focus { outline: none; border-color: #3b82f6; }

/* ──────────────────────────────────────────────────
   DATA PANEL  (side/modal panel for managing data)
───────────────────────────────────────────────── */
.data-panel {
    background: #ffffff;
    padding: 28px;
    box-shadow: 0 30px 60px rgba(0,0,0,.45);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    max-width: 820px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 3000;
    border-radius: var(--radius-lg);
    border: 1px solid #e2e8f0;
    color: #1e293b;
}

.data-panel.hidden { display: none !important; }

.data-panel h2 {
    text-align: center;
    color: #1e3a8a;
    font-size: 1.4rem;
    font-weight: 900;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.data-section {
    margin-bottom: 28px;
}

.data-section h3 {
    color: #1e3a8a;
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 14px;
    padding-right: 12px;
    border-right: 4px solid var(--gold);
    line-height: 1;
    padding-top: 2px;
    padding-bottom: 2px;
}

/* Input groups */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.input-group input,
.input-row input,
.input-row select {
    flex: 1;
    padding: 10px 13px;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    color: #1e293b;
    background: #f8fafc;
    transition: var(--transition);
}
.input-group input:focus,
.input-row input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

.input-row { display: flex; gap: 10px; margin-bottom: 8px; }
.input-wide { width: 100%; }

.product-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
    margin-bottom: 14px;
}

/* Data list */
.data-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 8px;
    background: #fafafa;
}
.data-list::-webkit-scrollbar { width: 4px; }
.data-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    margin-bottom: 5px;
    background: #ffffff;
    border-radius: var(--radius-sm);
    font-size: 13px;
    border: 1px solid #f1f5f9;
    transition: background .14s ease;
    color: #1e293b;
}
.data-item:hover { background: #f0f9ff; border-color: #bae6fd; }
.data-item:last-child { margin-bottom: 0; }

.product-details { display: flex; flex-direction: column; gap: 3px; width: 100%; }
.product-item { flex-direction: column; align-items: flex-start !important; }
.product-name { font-weight: 700; color: #1e3a8a; font-size: 13.5px; }
.product-info { font-size: 11.5px; color: #64748b; }

.delete-btn {
    padding: 5px 13px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: 8px;
}
.delete-btn:hover { background: #dc2626; }

.bulk-actions {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
    align-items: center;
}

.file-input-label { cursor: pointer; }

.import-help {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: #f0f9ff;
    border-radius: var(--radius-sm);
    border-right: 3px solid #3b82f6;
}

/* ──────────────────────────────────────────────────
   INVOICE CONTAINER  (printable area layout)
───────────────────────────────────────────────── */
.invoice-container {
    background: white;
    padding: 20px;
    font-weight: bold;
    color: #000 !important;
}

/* Company Header */
.company-header {
    text-align: center;
    border: 3px solid #1e3a8a;
    border-radius: 24px;
    padding: 18px;
    margin-bottom: 18px;
    background: #fff;
}

.company-name {
    font-size: 52px;
    font-weight: 900;
    font-family: 'Arial Black', 'Arial', sans-serif;
    color: #1a365d;
    margin-bottom: 6px;
}

.company-subtitle {
    font-size: 22px;
    color: #333;
    margin-bottom: 6px;
    font-weight: 700;
}

.company-address, .company-contact {
    font-size: 16px;
    color: #333;
    font-weight: 700;
    margin-top: 3px;
}

/* Invoice Info grid */
.invoice-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 14px;
}

.info-row { display: flex; gap: 8px; margin-bottom: 4px; }
.info-label { font-weight: 900; color: #333; min-width: 80px; }
.info-value  { color: #000; font-weight: 700; }

/* ── Invoice Table ── */
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
    table-layout: fixed;
}

.invoice-table thead { background: #a8c5e8; }

.invoice-table th {
    padding: 8px 4px;
    border: 2px solid #000;
    font-weight: 900;
    color: #000;
    font-size: 13px;
    text-align: center;
    background: #a8c5e8;
}

/* Balanced column widths for invoice table */
.invoice-table th:nth-child(1), .invoice-table td:nth-child(1) { width: 38px; }   /* ت */
.invoice-table th:nth-child(2), .invoice-table td:nth-child(2) { width: auto; }    /* اسم المادة */
.invoice-table th:nth-child(3), .invoice-table td:nth-child(3) { width: 68px; }   /* عدد الكارتون */
.invoice-table th:nth-child(4), .invoice-table td:nth-child(4) { width: 68px; }   /* عدد التعبئة */
.invoice-table th:nth-child(5), .invoice-table td:nth-child(5) { width: 108px; }  /* سعر قطعة */
.invoice-table th:nth-child(6), .invoice-table td:nth-child(6) { width: 108px; }  /* سعر الكارتون */
.invoice-table th:nth-child(7), .invoice-table td:nth-child(7) { width: 138px; }  /* سعر الكلي */

.invoice-table td {
    padding: 3px 4px;
    border: 2px solid #000;
    text-align: center;
    font-size: 12.5px;
    font-weight: 900;
    color: #000;
}

.invoice-table tbody tr:last-child td { border-bottom: 2px solid #000; }

/* Totals footer */
.totals-footer td { border: none; padding: 7px 4px; }

.footer-label { font-weight: 900; font-size: 14px; text-align: center; color: #000; }

.total-cell {
    border: 2px solid #000 !important;
    font-weight: 900;
    font-size: 15px;
    padding: 7px 4px !important;
    text-align: center;
    color: #000;
}
.total-cell.blue   { background: #bfdbfe; }
.total-cell.yellow { background: #fef08a; }

.totals-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    direction: ltr;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 14px;
}

.total-box {
    padding: 7px 18px;
    border: 2px solid #000;
    font-weight: 900;
    font-size: 15px;
    text-align: center;
    min-width: 50px;
    color: #000;
}
.total-box.yellow { background: #fef08a; }
.total-box.blue   { background: #bfdbfe; }
.total-text { font-weight: bold; font-size: 12px; color: #000; }

/* Bottom section (payment + signatures) */
.bottom-section {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    direction: ltr;
    margin-bottom: 14px;
    margin-top: 24px;
    padding-right: 16px;
}

.payment-box { display: flex; flex-direction: column; border: none; padding: 0; }

.payment-row { display: flex; align-items: center; gap: 10px; }

.payment-value {
    width: 110px;
    padding: 5px 0;
    text-align: center;
    border: 1px solid #000;
    font-weight: 900;
    font-size: 13px;
    color: #000;
}
.payment-row:not(:first-child) .payment-value { border-top: none; }

.payment-label { font-weight: 900; font-size: 13px; color: #000; min-width: 80px; }

.bg-red  { background-color: #fca5a5; }
.bg-blue { background-color: #93c5fd; }

.signature-row {
    display: flex;
    justify-content: flex-start;
    gap: 70px;
    font-size: 13px;
    direction: rtl;
    padding-top: 10px;
}
.signature-text { font-weight: 900; }

/* ──────────────────────────────────────────────────
   UNIFIED INVOICE STYLE  (system invoice modal)
───────────────────────────────────────────────── */
.unified-invoice-style .modal-content {
    width: 210mm;
    min-height: auto;
    padding: 20px !important;
    background: white;
    margin: 20px auto;
    position: relative;
    overflow-y: auto;
    max-height: 94vh;
    color: #000 !important;
}

.unified-invoice-style,
.unified-invoice-style * {
    color: #000000 !important;
    text-shadow: none !important;
}

.unified-invoice-style .toolbar {
    text-align: center;
    margin-bottom: 18px;
    position: sticky;
    top: 0;
    background: white;
    padding: 10px;
    border-bottom: 2px solid #eee;
    z-index: 10;
    border-radius: 0;
}

.unified-invoice-style .company-header-styled {
    text-align: center;
    border: 3px solid #1e3a8a;
    border-radius: 20px;
    padding: 14px;
    margin-bottom: 18px;
    background: #fff;
}

.unified-invoice-style .company-name-styled {
    font-size: 36px;
    font-weight: 900;
    font-family: 'Arial Black', sans-serif;
    color: #1a365d;
    margin-bottom: 4px;
}

.unified-invoice-style .company-subtitle-styled {
    font-size: 18px;
    color: #333;
    margin-bottom: 4px;
    font-weight: 700;
}

.unified-invoice-style .company-details-styled {
    font-size: 13px;
    color: #333;
    font-weight: 900;
    margin-top: 4px;
}

.unified-invoice-style .invoice-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 14px;
    font-size: 13.5px;
}

.unified-invoice-style .info-row-flex { display: flex; gap: 8px; margin-bottom: 4px; }
.unified-invoice-style .info-label-fixed { font-weight: 900; min-width: 85px; }
.unified-invoice-style .info-value-bold  { font-weight: 700; color: #000; }

/* Styled invoice table inside unified modal */
.unified-invoice-style .invoice-table-styled {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 18px;
    table-layout: fixed;
}

.unified-invoice-style .invoice-th-styled {
    background: #a8c5e8;
    padding: 8px 5px;
    border: 2px solid #000;
    font-size: 13px;
    font-weight: 900;
    text-align: center;
    color: #000;
}

.unified-invoice-style .invoice-td-styled {
    border: 2px solid #000;
    text-align: center;
    font-weight: 900;
    font-size: 12.5px;
    padding: 3px 4px;
    color: #000;
}

.unified-invoice-style .total-cell-styled {
    background: #fef08a;
    padding: 6px;
    border: 2px solid #000;
    font-weight: 900;
    text-align: center;
    color: #000;
}

.unified-invoice-style .total-label-styled {
    border: none !important;
    font-weight: 900;
    text-align: left;
    padding-left: 8px;
}

.no-border { border: none !important; }

.bottom-section-styled {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    direction: ltr;
    margin-top: 18px;
    padding-right: 16px;
}

.payment-box-styled {
    display: flex;
    flex-direction: column;
    width: 240px;
}

.payment-row-flex {
    display: flex;
    align-items: center;
    direction: ltr;
    gap: 10px;
    justify-content: flex-start;
}

.payment-value-styled {
    font-weight: 900;
    width: 128px;
    text-align: center;
    border: 1px solid #000;
    padding: 5px 0;
    font-size: 13px;
    color: #000;
}

.payment-value-styled.no-top-border { border-top: none; }

.bg-red-styled  { background-color: #fca5a5 !important; }
.bg-blue-styled { background-color: #93c5fd !important; }

.payment-label-styled {
    font-weight: 900;
    font-size: 13px;
    color: #000;
    min-width: 90px;
    text-align: right;
}

.signature-row-styled {
    display: flex;
    justify-content: space-between;
    gap: 80px;
    font-size: 13px;
    direction: rtl;
    width: 100%;
    margin-top: 16px;
}

.signature-text-styled { font-weight: 900; }

/* ──────────────────────────────────────────────────
   MANUAL INVOICE MODAL  (manualModal)
───────────────────────────────────────────────── */
#manualModal .modal-content,
#systemInvoiceModal .modal-content {
    max-width: 1000px !important;
}

/* Manual items table */
#manualItemsList td,
#manualItemsList th {
    padding: 8px 10px;
    font-size: 13px;
    vertical-align: middle;
}

/* ──────────────────────────────────────────────────
   INFO BOX
───────────────────────────────────────────────── */
.info-box {
    background: linear-gradient(135deg, #e0f2fe, #dbeafe);
    padding: 18px;
    border-radius: var(--radius-md);
    border-right: 4px solid #1e3a8a;
}
.info-box p {
    margin: 6px 0;
    color: #1e40af;
    font-size: 13.5px;
}

/* ──────────────────────────────────────────────────
   ACCORDION  (item detail expand)
───────────────────────────────────────────────── */
.accordion-item {
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    margin-bottom: 7px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.accordion-header {
    width: 100%;
    background: #f8fafc;
    padding: 12px 15px;
    text-align: right;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    transition: background .18s;
}
.accordion-header:hover   { background: #f1f5f9; }
.accordion-header.active  { background: #e0f2fe; color: #0369a1; }

.accordion-content { display: none; padding: 10px 14px; background: #fff; border-top: 1px solid #e2e8f0; }
.accordion-content.show { display: block; }

.detail-mini-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.detail-mini-table th { color: #64748b; font-weight: 600; font-size: 12px; padding-bottom: 4px; border-bottom: 2px solid #f1f5f9; }
.detail-mini-table td { padding: 7px 4px; border-bottom: 1px solid #f8fafc; color: #334155; }

/* ──────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────── */
@media (max-width: 860px) {
    body { padding: 12px; }

    .control-panel { padding: 28px 20px !important; }

    .control-buttons {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
        gap: 10px !important;
    }

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

    .bottom-section { flex-direction: column; gap: 14px; }

    .data-panel { width: 98%; padding: 18px; }

    .navigation-panel { padding: 10px 18px; gap: 10px; }

    .history-table { min-width: 700px; }
}

@media (max-width: 560px) {
    .system-title { font-size: 1.5rem !important; }
    .control-buttons { grid-template-columns: 1fr 1fr !important; }
    .modal-content { padding: 18px !important; }
}

/* ──────────────────────────────────────────────────
   PRINT STYLES
───────────────────────────────────────────────── */
@media print {
    @page { size: A4; margin: 0; }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .no-print,
    .toolbar,
    .close-btn,
    .print-btn,
    .control-panel,
    .navigation-panel,
    .data-panel { display: none !important; }

    body {
        background: white !important;
        padding: 0 !important;
        margin: 1cm !important;
        color: #000 !important;
    }

    .container { max-width: 100% !important; margin: 0 !important; }

    .unified-invoice-style:not(.hidden) {
        display: block !important;
        position: absolute !important;
        inset: 0;
        background: white !important;
        z-index: 99999 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .unified-invoice-style .modal-content {
        width: auto !important;
        max-width: 190mm !important;
        margin: 0 auto !important;
        padding: 5mm !important;
        border: none !important;
        box-shadow: none !important;
        background: white !important;
        max-height: none !important;
        overflow: visible !important;
        transform: scale(0.96);
        transform-origin: top center;
    }

    .company-name-styled,
    .system-title {
        background: none !important;
        -webkit-text-fill-color: #000 !important;
        color: #000 !important;
    }

    .invoice-table-styled th { background-color: #a8c5e8 !important; color: #000 !important; }
    .total-cell-styled        { background-color: #fef08a !important; color: #000 !important; }

    .invoice-table th  { background: #a8c5e8 !important; }
    .total-cell.yellow { background: #fef08a !important; }
    .total-cell.blue   { background: #bfdbfe !important; }

    .bottom-section,
    .bottom-section-styled {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: flex-end !important;
        direction: ltr !important;
        width: 100% !important;
        margin-top: 16px !important;
        page-break-inside: avoid !important;
    }

    .bg-red,  .bg-red-styled  { background-color: #fca5a5 !important; }
    .bg-blue, .bg-blue-styled { background-color: #93c5fd !important; }

    .invoice-page { page-break-after: always; display: block; width: 100%; }
    .invoice-page:last-child  { page-break-after: auto; }

    tr { page-break-inside: avoid; }

    h1,h2,h3,h4,p,span,div,label,td,th,li { color: #000 !important; }
}
