/* ============================================================
   Wholesale Store Manager - style.css
   Clean, professional, simple. White + light gray + dark text.
============================================================ */

:root {
    --primary: #1a56db;
    --primary-dark: #1e429f;
    --primary-light: #e8f0fe;
    --success: #0e9f6e;
    --danger: #dc2626;
    --warning: #b45309;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f3f4f6;
    --card: #ffffff;
    --sidebar-bg: #111827;
    --sidebar-text: #d1d5db;
    --sidebar-active: #1a56db;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- Layout ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 230px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.2s ease;
}
.main { margin-left: 230px; min-height: 100vh; }
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 90;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 18px; font-weight: 600; }
.content { padding: 20px; max-width: 1300px; margin: 0 auto; }

.sidebar-brand {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 17px;
    font-weight: 600;
    color: #fff;
}
.brand-icon { font-size: 22px; }
.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--sidebar-text);
    font-size: 15px;
    border-inline-start: 3px solid transparent;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; border-inline-start-color: #fff; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.08); }

.icon-btn {
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: var(--text); padding: 6px;
    border-radius: 6px;
}
.icon-btn:hover { background: var(--bg); }

.user-chip { font-size: 14px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.lang-select {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}

#menuToggle { display: none; }
.overlay { display: none; }

/* ---------- Cards & Sections ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 18px;
}
.card-head { margin-bottom: 14px; }
.card-head h3 { font-size: 16px; font-weight: 600; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.section-title { margin: 18px 0 10px; font-size: 15px; font-weight: 600; }

.loading { padding: 40px; text-align: center; color: var(--text-muted); }
.empty { text-align: center; color: var(--text-muted); padding: 24px; }
.muted { color: var(--text-muted); }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-grid.sm { grid-template-columns: repeat(4, 1fr); }
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
}
.stat-icon { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-value { font-size: 20px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12.5px; color: var(--text-muted); }
.stat-blue .stat-icon { background: #e8f0fe; color: var(--primary); }
.stat-green .stat-icon { background: #e6f9f0; color: var(--success); }
.stat-red .stat-icon { background: #fee2e2; color: var(--danger); }
.stat-orange .stat-icon { background: #ffedd5; color: #c2410c; }
.stat-yellow .stat-icon { background: #fef9c3; color: var(--warning); }
.stat-gray .stat-icon { background: #f3f4f6; color: var(--text-muted); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 600px; }
.table th {
    text-align: start;
    padding: 10px 12px;
    background: #f9fafb;
    border-bottom: 2px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 600;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table tbody tr:hover { background: #f9fafb; }
.row-actions { white-space: nowrap; text-align: end; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-green { background: #e6f9f0; color: var(--success); }
.badge-red { background: #fee2e2; color: var(--danger); }
.badge-yellow { background: #fef9c3; color: var(--warning); }
.badge-gray { background: #f3f4f6; color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { opacity: 0.92; }
.btn:active { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: #fff; color: var(--text); border-color: var(--border); }
.btn-warning-light { background: #fffbeb; color: var(--warning); border: 1px solid #fde68a; }
.btn-success-light { background: #e6f9f0; color: var(--success); border: 1px solid #a7f3d0; }
.btn-danger-light { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.btn-secondary { background: #f3f4f6; color: var(--text); border-color: var(--border); }
.btn-lg { padding: 13px 22px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn-xs { padding: 5px 9px; font-size: 13px; border-radius: 6px; }
.link-btn { background: none; border: none; color: var(--primary); font-size: 13.5px; cursor: pointer; padding: 4px 0; display: inline-block; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.export-btns { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13.5px; font-weight: 600; margin: 12px 0 5px; color: var(--text); }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14.5px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
}
.form-control:focus { outline: 2px solid var(--primary-light); border-color: var(--primary); }
.form-control.inline { width: 100px; display: inline-block; padding: 6px 8px; }
textarea.form-control { resize: vertical; }
select.form-control { cursor: pointer; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.span-2 { grid-column: span 2; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters .form-control { max-width: 280px; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 500; margin: 0; }

/* ---------- Modals ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,0.5);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 30px 16px;
    overflow-y: auto;
    z-index: 200;
}
.modal-backdrop.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 520px;
    animation: modalIn 0.15s ease;
}
.modal-lg { max-width: 820px; }
.modal-sm { max-width: 420px; }
@keyframes modalIn { from { transform: translateY(10px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 16px 20px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
body.modal-open { overflow: hidden; }

/* ---------- Confirmation modal ---------- */
#confirmModal .modal-sm { max-width: 380px; }
#confirmModal.show { display: flex; }

/* ---------- Prompts ---------- */
#promptModal .modal-body { padding-top: 6px; }

/* ---------- Toasts ---------- */
.toast-wrap {
    position: fixed;
    top: 16px;
    inset-inline-end: 16px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: #1f2937;
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    font-size: 14px;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s ease;
    max-width: 340px;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { background: var(--success); }
.toast.danger { background: var(--danger); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; font-size: 14px; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-success { background: #e6f9f0; color: #065f46; }
.alert-info { background: #e8f0fe; color: #1e429f; }

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e429f 0%, #111827 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-logo { font-size: 44px; }
.login-card h1 { font-size: 22px; margin-top: 8px; color: var(--text); }
.login-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 18px; }
.login-form { text-align: start; }
.login-form h3 { text-align: center; margin-bottom: 6px; font-size: 16px; }
.login-form .btn { margin-top: 14px; }
.login-card .lang-select { position: static; margin: 0 auto 10px; display: block; }

/* ---------- Sale layout ---------- */
.sale-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sale-product-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 6px;
}
.sale-product-item {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 14px;
}
.sale-product-item:hover { background: var(--primary-light); }
.sale-cart { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); margin: 8px 0; }
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
}
.sale-cart .empty { padding: 16px; }
.qty { width: 70px; }
.cart-info { flex: 1; }
.cart-total { font-weight: 600; white-space: nowrap; }
.sale-totals { border-top: 1px solid var(--border); padding-top: 10px; }
.sale-total-row { display: flex; justify-content: space-between; align-items: center; margin: 5px 0; font-size: 14.5px; }
.sale-total-row.total { font-size: 17px; font-weight: 700; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }

/* ---------- Invoice ---------- */
.invoice-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.invoice-totals { max-width: 320px; margin-inline-start: auto; margin-top: 10px; }
.invoice-totals div { display: flex; justify-content: space-between; margin: 4px 0; font-size: 14px; }
.invoice-totals .total { font-weight: 700; font-size: 16px; border-top: 1px solid var(--border); padding-top: 6px; }

/* ---------- Reports tabs ---------- */
.report-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 20px;
    font-size: 13.5px;
    cursor: pointer;
    color: var(--text);
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Import ---------- */
.import-types { display: flex; gap: 10px; margin: 10px 0; }
.radio-card {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.hint { font-size: 12.5px; color: var(--text-muted); margin-top: 10px; }

/* ---------- Text helpers ---------- */
.text-danger { color: var(--danger); }
.bold { font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-grid.sm { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
    .sale-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    body.sidebar-open .sidebar { transform: none; }
    .main { margin-left: 0; }
    #menuToggle { display: block; }
    .overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 90; }
    body.sidebar-open .overlay { display: block; }
    .content { padding: 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
    .user-chip span { display: none; }
    .page-title { font-size: 16px; }
}
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-value { font-size: 17px; }
    .stat-icon { width: 38px; height: 38px; font-size: 16px; }
    .btn { width: 100%; justify-content: center; }
    .row-actions .btn { width: auto; }
    .modal-backdrop { padding: 12px; }
}
/* ============================================================
   2026 UI REFRESH — simple, premium, operational
   This section intentionally overrides the legacy visual layer
   without changing the application structure.
============================================================ */
:root {
    --primary: #3558e8;
    --primary-dark: #2236a8;
    --primary-light: #eef1ff;
    --success: #14805e;
    --danger: #d33a4a;
    --warning: #b96b13;
    --text: #182033;
    --text-muted: #778096;
    --border: #e7eaf2;
    --bg: #f6f7fb;
    --card: #ffffff;
    --sidebar-bg: #10162a;
    --sidebar-text: #aeb7cf;
    --sidebar-active: rgba(255,255,255,.11);
    --radius: 12px;
    --radius-lg: 18px;
    --shadow: 0 8px 28px rgba(25, 34, 61, .055);
    --shadow-hover: 0 14px 36px rgba(25, 34, 61, .09);
    --sidebar-width: 248px;
}

body {
    background:
        radial-gradient(circle at 72% -10%, rgba(83, 111, 255, .08), transparent 28rem),
        var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
}

.sidebar {
    width: var(--sidebar-width);
    background:
        radial-gradient(circle at 15% 0%, rgba(84, 107, 255, .26), transparent 15rem),
        linear-gradient(180deg, #11182e 0%, #0d1324 100%);
    border-inline-end: 1px solid rgba(255,255,255,.04);
    padding: 14px 12px;
}
.main { margin-left: var(--sidebar-width); }
.sidebar-brand {
    min-height: 72px;
    padding: 10px 8px 18px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    gap: 12px;
}
.brand-mark {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(145deg, #6d84ff, #3856df);
    box-shadow: 0 10px 26px rgba(63, 86, 227, .3);
    flex: 0 0 auto;
}
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
    color: #fff;
    font-weight: 750;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}
.brand-copy small {
    color: rgba(216,224,246,.52);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-top: 1px;
}
.sidebar-nav { padding: 14px 0; }
.nav-item {
    min-height: 44px;
    margin: 3px 0;
    padding: 10px 12px;
    border: 0;
    border-radius: 11px;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 550;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}
.nav-item i {
    width: 22px;
    font-size: 14px;
    opacity: .9;
}
.nav-item:hover {
    background: rgba(255,255,255,.065);
    color: #f6f8ff;
    transform: translateX(2px);
}
.nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.055);
}
.nav-item.active i { color: #8ea2ff; }
.sidebar-footer {
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.topbar {
    min-height: 68px;
    padding: 12px 26px;
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(225,229,239,.9);
}
.page-title {
    font-size: 19px;
    font-weight: 750;
    letter-spacing: -.02em;
}
.topbar-right { margin-left: auto; gap: 10px; }
.user-chip {
    min-height: 38px;
    padding: 7px 10px;
    border-radius: 11px;
    background: #f7f8fc;
    color: #576177;
    border: 1px solid var(--border);
    font-weight: 600;
}
.user-chip i { color: var(--primary); font-size: 17px; }
.lang-select {
    height: 38px;
    border-radius: 11px;
    padding: 0 10px;
    background: #fff;
    border-color: var(--border);
    font-weight: 650;
    cursor: pointer;
}
.content { padding: 26px; max-width: 1440px; }

.card {
    border: 1px solid rgba(225,229,239,.92);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card-head { margin-bottom: 16px; }
.card-head h3 {
    font-size: 15px;
    font-weight: 750;
    letter-spacing: -.01em;
}

.stat-grid { gap: 16px; margin-bottom: 20px; }
.stat-card {
    min-height: 104px;
    border-radius: 17px;
    border: 1px solid rgba(225,229,239,.92);
    box-shadow: var(--shadow);
    padding: 18px;
    transition: transform .18s ease, box-shadow .18s ease;
    overflow: hidden;
    position: relative;
}
.stat-card::after {
    content: "";
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    inset-inline-end: -28px;
    top: -30px;
    background: currentColor;
    opacity: .035;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
}
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.025em; }
.stat-label { font-size: 12px; font-weight: 600; margin-top: 2px; }

.table-wrap {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}
.table { min-width: 680px; }
.table th {
    padding: 11px 13px;
    background: #f8f9fc;
    border-bottom: 1px solid var(--border);
    color: #7b8498;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .035em;
}
.table td {
    padding: 12px 13px;
    border-bottom: 1px solid #eef0f5;
    font-size: 13.5px;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfe; }

.btn {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 700;
    transition: transform .12s ease, box-shadow .16s ease, opacity .16s ease, background .16s ease;
}
.btn:not(:disabled):hover { opacity: 1; transform: translateY(-1px); }
.btn:not(:disabled):active { transform: translateY(0); }
.btn-primary {
    background: linear-gradient(135deg, #4564ef, #3453dd);
    box-shadow: 0 7px 17px rgba(53,88,232,.18);
}
.btn-success { box-shadow: 0 7px 17px rgba(20,128,94,.15); }
.btn-light, .btn-secondary {
    background: #fff;
    border-color: #e3e6ef;
    color: #3b455b;
    box-shadow: 0 1px 2px rgba(25,34,61,.025);
}
.btn-light:hover, .btn-secondary:hover { background: #f7f8fb; }
.btn-danger-light { background: #fff4f5; border-color: #ffdadd; }
.btn-xs { min-height: 32px; padding: 5px 9px; border-radius: 9px; }
.icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}
.icon-btn:hover { background: #f1f3f8; }

.form-control {
    min-height: 40px;
    padding: 8px 11px;
    border-radius: 10px;
    border-color: #dfe3ed;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.form-control:hover { border-color: #cfd5e3; }
.form-control:focus {
    outline: none;
    border-color: #8295ef;
    box-shadow: 0 0 0 4px rgba(53,88,232,.09);
}
label { font-size: 12.5px; color: #4e586e; margin-bottom: 6px; }
.filters {
    padding: 12px;
    background: #fafbfe;
    border: 1px solid var(--border);
    border-radius: 13px;
}
.filters .form-control { background: #fff; }

.modal-backdrop {
    background: rgba(15,22,41,.56);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 34px 16px;
}
.modal {
    border-radius: 19px;
    border: 1px solid rgba(255,255,255,.8);
    box-shadow: 0 26px 80px rgba(10,17,34,.24);
    overflow: hidden;
}
.modal-head {
    padding: 16px 20px;
    background: #fbfcfe;
}
.modal-head h3 { font-size: 16px; font-weight: 780; }
.modal-body { padding: 18px 20px 22px; }
.modal-actions {
    padding-top: 14px;
    margin-top: 18px;
    border-top: 1px solid #edf0f5;
}
#confirmModal .modal { padding: 18px; }
#confirmModal #confirmTitle { margin-bottom: 8px; }
#confirmModal #confirmText { color: var(--text-muted); }

.badge {
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 750;
}
.loading { min-height: 180px; display: grid; place-items: center; }
.empty { color: #9aa2b3; }

.sale-layout { gap: 20px; }
.sale-product-list, .sale-cart {
    border-radius: 13px;
    border-color: var(--border);
}
.sale-product-item { padding: 11px 12px; }
.sale-product-item:hover { background: #f1f4ff; }
.cart-item { padding: 11px 12px; }
.sale-total-row.total { color: #1f2d66; }

.report-tabs {
    padding: 5px;
    background: #f5f6fa;
    border-radius: 12px;
    width: fit-content;
}
.tab-btn { border: 0; background: transparent; border-radius: 9px; font-weight: 650; }
.tab-btn.active { background: #fff; color: var(--primary); box-shadow: 0 2px 9px rgba(25,34,61,.08); }

.toast {
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(18,25,44,.2);
}

/* Login */
.login-body {
    background:
        radial-gradient(circle at 18% 18%, rgba(95,118,255,.35), transparent 23rem),
        radial-gradient(circle at 85% 80%, rgba(76,103,239,.18), transparent 25rem),
        #0e1427;
}
.login-card {
    max-width: 420px;
    border-radius: 22px;
    padding: 36px;
    box-shadow: 0 34px 90px rgba(0,0,0,.34);
    border: 1px solid rgba(255,255,255,.8);
}
.login-logo { display: flex; justify-content: center; }
.login-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(145deg, #6d84ff, #3453dd);
    font-size: 22px;
    font-weight: 850;
    box-shadow: 0 14px 30px rgba(53,88,232,.3);
}
.login-card h1 { margin-top: 14px; font-weight: 800; letter-spacing: -.025em; }
.login-sub { margin-top: 4px; margin-bottom: 22px; }
.login-form input,
.login-form select {
    width: 100%;
    min-height: 42px;
    padding: 8px 11px;
    border: 1px solid #dfe3ed;
    border-radius: 10px;
    font: inherit;
}
.login-form input:focus,
.login-form select:focus { outline: none; border-color: #8295ef; box-shadow: 0 0 0 4px rgba(53,88,232,.09); }

/* Correct desktop RTL geometry */
[dir="rtl"] .sidebar { left: auto; right: 0; }
[dir="rtl"] .main { margin-left: 0; margin-right: var(--sidebar-width); }
[dir="rtl"] .topbar-right { margin-left: 0; margin-right: auto; }
[dir="rtl"] .nav-item:hover { transform: translateX(-2px); }

@media (max-width: 768px) {
    .sidebar { width: min(84vw, 290px); }
    .main, [dir="rtl"] .main { margin-left: 0; margin-right: 0; }
    .topbar { min-height: 62px; padding: 10px 14px; }
    .content { padding: 14px; }
    .card { padding: 15px; border-radius: 15px; }
    .stat-grid, .stat-grid.sm { gap: 10px; }
    .stat-card { min-height: 92px; padding: 13px; }
    .table-wrap { border-radius: 12px; }
    .filters { padding: 10px; }
    [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(100%); }
    body.sidebar-open [dir="rtl"] .sidebar,
    [dir="rtl"] body.sidebar-open .sidebar { transform: none; }
}

@media (max-width: 480px) {
    .stat-grid, .stat-grid.sm { grid-template-columns: 1fr; }
    .stat-card { min-height: 80px; }
    .topbar-right { gap: 6px; }
    .lang-select { width: 60px; }
    .modal-backdrop { padding: 10px; align-items: flex-start; }
    .modal { border-radius: 16px; }
    .btn-group { width: 100%; }
    .btn-group .btn { flex: 1 1 auto; }
}

/* ============================================================
   SAAS V2 — Multi-store retail workspace
   Visual language aligned with the existing RIVANA SaaS reference:
   navy navigation, light workspace, blue accents, compact premium cards.
============================================================ */
:root{
    --primary:#2563eb;
    --primary-dark:#1d4ed8;
    --primary-light:#eff6ff;
    --sidebar-bg:#0f172a;
    --sidebar-text:#cbd5e1;
    --sidebar-active:rgba(37,99,235,.22);
    --primary-soft:rgba(37,99,235,.20);
    --primary-ring:rgba(37,99,235,.10);
    --bg:#f8fafc;
    --border:#e2e8f0;
    --text:#0f172a;
    --text-muted:#64748b;
    --radius:10px;
    --radius-lg:14px;
    --shadow:0 1px 2px rgba(15,23,42,.03);
    --shadow-hover:0 12px 28px rgba(15,23,42,.08);
    --sidebar-width:276px;
}
body{background:var(--bg);font-size:14px;letter-spacing:-.005em}
.sidebar{
    width:var(--sidebar-width);
    padding:0;
    background:var(--sidebar-bg);
    border-inline-end:0;
}
.main{margin-left:var(--sidebar-width)}
.sidebar-brand{min-height:76px;padding:15px 16px;background:var(--sidebar-bg)}
.brand-mark,.store-logo-shell{width:42px;height:42px;border-radius:12px;background:#1e3a8a;box-shadow:none;overflow:hidden}
.store-logo-img{width:100%;height:100%;display:block;object-fit:contain;background:#fff}
.brand-name{max-width:170px;font-size:15px;font-weight:800}
.brand-copy small{font-size:10px;text-transform:none;letter-spacing:.025em;color:#94a3b8}
.sidebar-nav{padding:12px 10px}
.nav-item{min-height:42px;margin:2px 0;padding:9px 12px;border-radius:9px;font-weight:600;color:#cbd5e1}
.nav-item:hover{background:rgba(255,255,255,.06);transform:none}
.nav-item.active{background:var(--primary-soft);color:#dbeafe;box-shadow:inset 3px 0 0 var(--primary)}
[dir="rtl"] .nav-item.active{box-shadow:inset -3px 0 0 var(--primary)}
.nav-item.active i{color:#93c5fd}
.sidebar-footer{padding:8px 10px 10px;background:var(--sidebar-bg)}

.topbar{min-height:64px;padding:0 22px;background:rgba(255,255,255,.96);border-bottom:1px solid var(--border);backdrop-filter:blur(10px)}
.page-title{font-size:18px;font-weight:800}
.topbar-right{gap:8px}
.store-context{display:flex;align-items:center;gap:9px;min-height:42px;padding:5px 7px 5px 6px;border:1px solid var(--border);border-radius:12px;background:#fff}
.top-store-logo{width:30px;height:30px;border-radius:8px;background:#eff6ff;color:var(--primary);display:grid;place-items:center;overflow:hidden;flex:0 0 auto}
.store-context-copy{display:flex;flex-direction:column;min-width:88px;line-height:1.15}
.store-context-copy small{font-size:9.5px;color:var(--text-muted)}
.store-context-copy strong{font-size:12.5px;max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.store-switch{max-width:150px;height:30px;border:0;border-inline-start:1px solid var(--border);padding-inline-start:8px;background:#fff;color:var(--text);font-weight:700;outline:0;cursor:pointer}
.lang-select{height:42px;border-radius:11px}
.content{max-width:1480px;padding:24px}

.card{padding:0;border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow);overflow:hidden;background:#fff}
.card-head{margin:0;padding:14px 16px;border-bottom:1px solid var(--border)}
.card-head h3{font-size:14px;font-weight:800}
.card-subtitle,.modal-subtitle{margin-top:3px;color:var(--text-muted);font-size:11.5px;font-weight:500}
.card>.table-wrap,.card>.filters,.card>form,.card>p,.card>.settings-store-profile,.card>.store-cards,.card>.settings-list-grid,.card>.password-form{margin:0}
.card>.filters{border:0;border-bottom:1px solid var(--border);border-radius:0;background:#fff;padding:12px 16px}
.card>.table-wrap{padding:0}
.table th{background:#f8fafc;color:#64748b;font-size:10.5px;text-transform:uppercase;letter-spacing:.045em;padding:10px 12px;border-bottom:1px solid var(--border)}
.table td{padding:10px 12px;font-size:13px;border-bottom:1px solid #edf2f7}
.table tbody tr:last-child td{border-bottom:0}
.table tbody tr:hover{background:#fbfdff}

.btn{border-radius:9px;font-size:13px;font-weight:750;padding:8px 11px;box-shadow:none;transition:background .14s ease,border-color .14s ease,transform .14s ease}
.btn-primary{background:var(--primary);box-shadow:none}
.btn-primary:hover{background:var(--primary-dark)}
.btn-light,.btn-secondary{background:#fff;border-color:var(--border)}
.btn-xs{min-height:30px;padding:5px 8px;border-radius:8px;font-size:12px}
.icon-btn{width:32px;height:32px;border-radius:8px;font-size:14px}
.form-control{min-height:39px;border-radius:9px;border-color:#dbe2ea;font-size:13.5px}
.form-control:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-ring)}
.form-control.inline{min-height:34px}
.payment-inline{width:150px!important;max-width:150px}
label{font-size:12px;font-weight:700;color:#334155}
.modal{border-radius:16px;border:1px solid rgba(255,255,255,.8)}
.modal-head{background:#fff;padding:14px 18px}
.modal-body{padding:16px 18px 18px}
.modal-actions{padding-top:12px;margin-top:16px}

.stat-grid{gap:12px;margin-bottom:16px}
.stat-card{min-height:96px;padding:15px;border-radius:13px;box-shadow:none;border:1px solid var(--border)}
.stat-card:hover{transform:none;box-shadow:var(--shadow-hover)}
.stat-icon{width:40px;height:40px;border-radius:10px;font-size:17px}
.stat-value{font-size:20px;font-weight:850}
.stat-label{font-size:11.5px}

.page-head-pro{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:16px;flex-wrap:wrap}
.page-head-pro h2{font-size:22px;line-height:1.1;margin:2px 0 3px;font-weight:850;letter-spacing:-.025em}
.page-head-pro p{color:var(--text-muted);font-size:12.5px}
.eyebrow{display:block;font-size:10px;line-height:1;text-transform:uppercase;letter-spacing:.08em;font-weight:800;color:var(--primary)}

.cash-status{display:flex;align-items:center;gap:11px;padding:12px 14px;border-radius:13px;border:1px solid var(--border);background:#fff;margin-bottom:14px}
.cash-status-icon{width:36px;height:36px;border-radius:10px;display:grid;place-items:center;flex:0 0 auto}
.cash-status.is-open{border-color:#bbf7d0;background:#f0fdf4}.cash-status.is-open .cash-status-icon{background:#dcfce7;color:#15803d}
.cash-status.is-closed{border-color:#e2e8f0;background:#fff}.cash-status.is-closed .cash-status-icon{background:#f1f5f9;color:#64748b}
.cash-status strong{display:block;font-size:13px}.cash-status span{display:block;color:var(--text-muted);font-size:11.5px;margin-top:2px}
.cash-kpis .stat-card{min-height:88px}
.text-success{color:var(--success)!important}
.bold{font-weight:800!important}

.settings-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(300px,.75fr);gap:16px;align-items:start}
.settings-main{grid-row:span 2}
.settings-lists{grid-column:1/-1}
.settings-store-profile{padding:18px}
.logo-editor{display:flex;align-items:center;gap:14px;padding:14px;border:1px solid var(--border);border-radius:13px;background:#f8fafc;margin-bottom:16px}
.logo-preview{width:76px;height:76px;border-radius:16px;background:#fff;border:1px solid var(--border);display:grid;place-items:center;overflow:hidden;flex:0 0 auto;color:var(--primary);font-size:26px}
.logo-preview img{width:100%;height:100%;object-fit:contain}
.logo-editor strong{display:block;font-size:13px}.logo-editor p{font-size:11.5px;color:var(--text-muted);margin:2px 0 9px}
.settings-form{padding:0}
.settings-form .form-grid{gap:0 14px}
.color-control{padding:5px;height:39px;cursor:pointer}
.store-cards{display:grid;gap:8px;padding:14px}
.store-card{width:100%;display:flex;align-items:center;gap:10px;text-align:start;border:1px solid var(--border);background:#fff;border-radius:11px;padding:9px 10px;color:var(--text);cursor:pointer}
.store-card:hover{border-color:#bfdbfe;background:#f8fbff}
.store-card.active{border-color:#93c5fd;background:#eff6ff}
.mini-store-logo{width:34px;height:34px;border-radius:9px;background:#f1f5f9;color:var(--primary);display:grid;place-items:center;overflow:hidden;flex:0 0 auto}
.mini-store-logo img{width:100%;height:100%;object-fit:contain;background:#fff}
.store-card>span:nth-child(2){min-width:0;flex:1}.store-card strong{display:block;font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.store-card small{display:block;color:var(--text-muted);font-size:10.5px;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.store-check{color:var(--primary)}.store-arrow{color:#94a3b8}
.settings-list-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:14px}
.settings-list-card{border:1px solid var(--border);border-radius:12px;overflow:hidden;background:#fff}
.settings-list-head{min-height:44px;display:flex;align-items:center;justify-content:space-between;padding:8px 10px;background:#f8fafc;border-bottom:1px solid var(--border)}
.settings-list-head strong{font-size:12.5px}.add-mini{background:#fff;border:1px solid var(--border);color:var(--primary)}
.settings-items{max-height:260px;overflow:auto}
.settings-item{min-height:42px;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 9px;border-bottom:1px solid #f1f5f9;font-size:12.5px}
.settings-item:last-child{border-bottom:0}.settings-item>span:first-child{min-width:0;overflow-wrap:anywhere}
.mini-actions{display:flex;align-items:center;gap:3px;flex:0 0 auto}.danger-icon{color:var(--danger)}
.muted-item{opacity:.48}.cash-tag{display:inline-flex;margin-inline-start:6px;padding:2px 5px;border-radius:99px;background:#dcfce7;color:#15803d;font-size:9px;font-weight:800}
.empty-mini{padding:18px;text-align:center;color:var(--text-muted);font-size:11.5px}
.switch-mini{width:32px;height:18px;border:0;border-radius:99px;background:#cbd5e1;padding:2px;display:flex;align-items:center;cursor:pointer}
.switch-mini span{width:14px;height:14px;border-radius:50%;background:#fff;display:block;transition:.15s}.switch-mini.on{background:var(--primary)}.switch-mini.on span{transform:translateX(14px)}
[dir="rtl"] .switch-mini.on span{transform:translateX(-14px)}
.check-row{display:flex;align-items:flex-start;gap:9px;padding:11px;border:1px solid var(--border);border-radius:10px;background:#f8fafc;margin-top:12px;cursor:pointer}
.check-row input{margin-top:2px}.check-row strong{display:block;font-size:12.5px}.check-row small{display:block;color:var(--text-muted);font-size:10.5px;margin-top:2px;line-height:1.35}
.password-form{padding:16px}.three-cols{grid-template-columns:repeat(3,minmax(0,1fr))}

@media(max-width:1100px){.settings-grid{grid-template-columns:1fr}.settings-main,.settings-lists{grid-column:auto;grid-row:auto}.settings-list-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:768px){
    :root{--sidebar-width:276px}
    .store-context-copy{display:none}.store-switch{max-width:120px;border-inline-start:0;padding:0 4px}.store-context{padding:5px}
    .settings-list-grid{grid-template-columns:1fr}.three-cols{grid-template-columns:1fr}.page-head-pro{align-items:flex-start}.cash-kpis{grid-template-columns:1fr 1fr}
}
@media(max-width:480px){
    .topbar{padding:0 10px}.page-title{max-width:105px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.top-store-logo{display:none}.store-switch{max-width:102px;font-size:11px}.store-context{min-height:38px}
    .cash-kpis{grid-template-columns:1fr}.settings-store-profile{padding:12px}.logo-editor{align-items:flex-start}.logo-preview{width:62px;height:62px}.settings-list-grid{padding:10px}.store-cards{padding:10px}
}
[dir="rtl"] .main{margin-left:0;margin-right:var(--sidebar-width)}
@media(max-width:768px){[dir="rtl"] .main{margin-right:0}}

/* ============================================================
   ENGINEERING UX PASS — safer actions + clearer mobile operation
============================================================ */
.btn:focus-visible,.icon-btn:focus-visible,.nav-item:focus-visible,.store-card:focus-visible,.switch-mini:focus-visible{
    outline:3px solid var(--primary-ring);
    outline-offset:2px;
}
.btn:disabled,.icon-btn:disabled{
    cursor:not-allowed;
    opacity:.55;
    transform:none!important;
}
form[data-busy="1"]{pointer-events:none;opacity:.92}
form[data-busy="1"] input,form[data-busy="1"] select,form[data-busy="1"] textarea{background:#f8fafc}
.row-actions{display:flex;justify-content:flex-end;align-items:center;gap:5px}
.row-actions .btn{min-width:32px;justify-content:center}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.alert{border-radius:10px}
.table-wrap{scrollbar-width:thin;overscroll-behavior-inline:contain}
.filters .form-control{flex:1 1 180px}

@media(max-width:768px){
    .content{padding:12px}
    .page-head-pro{margin-bottom:12px}
    .card-head{padding:12px 13px}
    .card>.filters{padding:10px 12px}
    .filters .form-control{max-width:none;flex:1 1 100%}
    .table th,.table td{padding:9px 10px}
    .modal-backdrop{padding:8px;align-items:flex-end}
    .modal{max-height:94vh;overflow:auto;border-radius:18px 18px 10px 10px}
    .modal-head{position:sticky;top:0;z-index:2;border-bottom:1px solid var(--border)}
    .modal-actions{position:sticky;bottom:-1px;z-index:2;background:#fff;border-top:1px solid var(--border);padding:10px 0 2px;margin-top:14px}
    .modal-actions .btn{min-height:42px}
    .row-actions{justify-content:flex-start}
}

@media(max-width:480px){
    .btn{min-height:40px}
    .btn-xs{min-height:34px;min-width:34px;padding:6px 8px}
    .head-row>.btn{width:100%;justify-content:center}
    .modal-actions{display:grid;grid-template-columns:1fr 1fr}
    .modal-actions .btn:only-child{grid-column:1/-1}
    .form-grid,.form-grid.three-cols{grid-template-columns:1fr}
    .span-2{grid-column:auto}
}

/* ============================================================
   v2.2 RESPONSIVE + ACCOUNTANT WORKSPACE
============================================================ */
[hidden]{display:none!important}
:root{
    --sidebar-width:238px;
    --card-shadow:0 8px 28px rgba(15,23,42,.06);
}
body{min-width:320px}
.sidebar{width:var(--sidebar-width);box-shadow:8px 0 30px rgba(15,23,42,.08)}
.main{margin-left:var(--sidebar-width)}
[dir="rtl"] .main{margin-left:0;margin-right:var(--sidebar-width)}
.content{width:100%;max-width:1440px;padding:22px clamp(14px,2vw,28px) 36px}
.card{box-shadow:var(--card-shadow);border-color:#e8edf4}
.topbar{min-height:64px;padding-inline:clamp(12px,2vw,24px);box-shadow:0 1px 0 rgba(15,23,42,.03)}
.page-title{font-size:17px;letter-spacing:-.01em}
.nav-item{min-height:44px;border-radius:0 8px 8px 0;margin:2px 8px;padding:10px 12px}
[dir="rtl"] .nav-item{border-radius:8px 0 0 8px}
.sidebar-brand{min-height:70px;padding-inline:18px}
.btn{min-height:40px;justify-content:center}
.form-control{min-height:42px}
.table-wrap{border-radius:10px}
.table{background:#fff}

.workspace-hero{
    min-height:142px;
    display:flex;align-items:center;justify-content:space-between;gap:24px;
    margin-bottom:18px;padding:24px clamp(18px,3vw,32px);
    border:1px solid #dbeafe;border-radius:18px;
    background:linear-gradient(135deg,#ffffff 0%,var(--primary-light) 100%);
    overflow:hidden;position:relative;
}
.workspace-hero h2{font-size:clamp(21px,2vw,28px);margin:4px 0 6px;display:flex;align-items:center;gap:10px}
.workspace-hero p{max-width:700px;color:var(--text-muted);font-size:14px}
.workspace-hero-icon{width:78px;height:78px;border-radius:22px;display:grid;place-items:center;flex:0 0 auto;background:#fff;color:#15803d;border:1px solid #dcfce7;box-shadow:var(--card-shadow);font-size:34px}
.accounting-layout{display:grid;grid-template-columns:minmax(280px,360px) minmax(0,1fr);gap:18px;align-items:start}
.upload-card{position:sticky;top:82px}
.file-drop{margin:0 0 14px;min-height:175px;border:1.5px dashed #9ca3af;border-radius:14px;background:#f8fafc;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:20px;cursor:pointer;transition:.18s ease}
.file-drop:hover{border-color:var(--primary);background:var(--primary-light)}
.file-drop>i{font-size:28px;color:var(--primary);margin-bottom:9px}
.file-drop strong{font-size:14px}
.file-drop small{font-weight:400;color:var(--text-muted);margin-top:3px}
.file-drop input{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px}
.file-drop span{max-width:100%;margin-top:12px;padding:5px 9px;border-radius:7px;background:#fff;border:1px solid var(--border);font-size:11.5px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.upload-card .btn{margin-top:14px}
.accounting-files-card{min-width:0}
.file-list{display:flex;flex-direction:column;gap:8px}
.file-row{display:grid;grid-template-columns:48px minmax(0,1fr) auto;align-items:center;gap:12px;padding:11px;border:1px solid var(--border);border-radius:12px;background:#fff;transition:.15s ease}
.file-row:hover{border-color:#cbd5e1;background:#fbfdff}
.file-type-icon{width:46px;height:46px;border-radius:11px;display:grid;place-items:center;background:#ecfdf5;color:#047857;border:1px solid #d1fae5;font-size:10px;font-weight:800}
.file-main{min-width:0}.file-main strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13.5px}.file-main span{display:block;color:var(--text-muted);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}.file-main small{display:block;color:#94a3b8;font-size:10.5px;margin-top:4px}
.file-actions{display:flex;align-items:center;gap:6px}
.empty-state-pro{min-height:260px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:var(--text-muted);padding:24px}
.empty-state-pro i{font-size:34px;color:#cbd5e1;margin-bottom:12px}.empty-state-pro strong{color:var(--text);font-size:14px}.empty-state-pro span{font-size:12px;max-width:380px;margin-top:4px}
.accountant-card{border-top:3px solid var(--primary)}
.accountant-card .card-head h3{display:flex;align-items:center;gap:8px}
.accountant-form{padding-top:2px}
.accountant-access-note{display:flex;gap:10px;align-items:flex-start;margin-top:14px;padding:11px 12px;border-radius:10px;background:#f8fafc;border:1px solid var(--border);color:var(--text-muted);font-size:12px}
.accountant-access-note i{color:var(--primary);margin-top:2px}

@media (min-width:769px) and (max-width:1100px){
    :root{--sidebar-width:210px}
    .sidebar-brand{padding-inline:12px}.nav-item{font-size:14px;margin-inline:5px}
    .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .two-col{grid-template-columns:1fr}
}
@media (max-width:768px){
    .sidebar{width:min(84vw,292px);transform:translateX(-105%);box-shadow:18px 0 45px rgba(15,23,42,.2)}
    [dir="rtl"] .sidebar{transform:translateX(105%)}
    body.sidebar-open .sidebar,[dir="rtl"] body.sidebar-open .sidebar{transform:translateX(0)}
    .main,[dir="rtl"] .main{margin:0}
    #menuToggle{display:inline-flex;min-width:42px;min-height:42px;align-items:center;justify-content:center}
    .topbar{min-height:58px;padding:8px 10px;gap:8px}
    .topbar-right{gap:6px}.lang-select{min-height:38px}
    .content{padding:12px 10px 28px}
    .stat-grid,.stat-grid.sm{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
    .stat-card{padding:12px;gap:9px}.stat-icon{width:38px;height:38px;font-size:17px}.stat-value{font-size:17px}
    .two-col,.accounting-layout{grid-template-columns:1fr;gap:12px}
    .upload-card{position:static}
    .workspace-hero{min-height:auto;padding:17px;margin-bottom:12px;border-radius:14px}.workspace-hero-icon{width:54px;height:54px;border-radius:15px;font-size:24px}.workspace-hero p{font-size:12.5px}
    .card{padding:14px;margin-bottom:12px;border-radius:12px}
    .file-row{grid-template-columns:42px minmax(0,1fr);gap:10px}.file-type-icon{width:42px;height:42px}.file-actions{grid-column:1/-1;justify-content:flex-end;border-top:1px solid #f1f5f9;padding-top:8px}.file-actions .btn{flex:1}
    .table{min-width:680px}
}
@media (max-width:480px){
    .page-title{max-width:42vw;font-size:15px}
    .stat-grid,.stat-grid.sm{grid-template-columns:1fr 1fr}
    .stat-card{min-width:0}.stat-label{font-size:11px}.stat-value{font-size:15px;overflow-wrap:anywhere}
    .workspace-hero-icon{display:none}.workspace-hero h2{font-size:20px}
    .file-drop{min-height:145px}
    .file-actions .btn span{display:none}
    .file-actions .btn{min-width:44px}
    .accountant-card .form-grid{grid-template-columns:1fr}
    .head-row{align-items:stretch}.head-row>.btn{width:100%}
}

/* ============================================================
   V3 FINAL RESPONSIVE POLISH — desktop / tablet / phone
============================================================ */
.sidebar-user{display:flex;align-items:center;gap:10px;padding:12px 14px;margin:8px;border-radius:12px;background:rgba(255,255,255,.055);min-width:0}
.sidebar-user-icon{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:rgba(255,255,255,.09);color:#fff;flex:0 0 auto}
.sidebar-user-copy{display:flex;flex-direction:column;min-width:0;line-height:1.2}
.sidebar-user-copy strong{font-size:12.5px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sidebar-user-copy small{font-size:10.5px;color:#9aa6bf;margin-top:2px}

.content,.card,.table-wrap,.settings-main,.settings-lists{min-width:0}
.table-wrap{-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain}
.table td,.table th{max-width:340px}
.table td{overflow-wrap:anywhere}
.form-control,button,.btn{touch-action:manipulation}
input,select,textarea,button{font:inherit}

/* Keep dense operational pages readable on medium screens. */
@media (min-width:769px) and (max-width:1180px){
    .content{padding-inline:16px}
    .store-context-copy strong{max-width:105px}
    .store-switch{max-width:120px}
    .table th,.table td{padding-inline:9px}
}

@media (max-width:768px){
    html,body{overflow-x:hidden}
    .topbar{position:sticky;top:0;z-index:95}
    .sidebar-nav{padding-bottom:8px}
    .sidebar-footer{padding-bottom:max(6px,env(safe-area-inset-bottom))}
    .content{max-width:none}
    .form-control,select.form-control,input.form-control,textarea.form-control{font-size:16px}
    .btn{min-height:44px}
    .icon-btn{min-width:42px;min-height:42px;display:inline-grid;place-items:center}
    .filters{display:grid;grid-template-columns:1fr;gap:8px}
    .filters .btn,.filters .form-control{width:100%;max-width:none}
    .modal-body{padding-bottom:max(10px,env(safe-area-inset-bottom))}
    .sidebar-user{margin:7px}
}

@media (max-width:520px){
    .topbar-right{min-width:0}
    .store-context{max-width:42vw;min-width:0}
    .store-switch{width:100%;max-width:100%;text-overflow:ellipsis}
    .lang-select{width:48px;padding-inline:6px}
    .page-title{max-width:30vw}
    .content{padding-inline:9px}
    .card{padding:12px}
    .card-head{margin-bottom:10px}
    .table{min-width:640px}
    .workspace-hero{padding:15px}
    .workspace-hero h2{font-size:19px}
    .file-row{padding:10px}
    .file-main strong{font-size:13px}
    .file-main small{line-height:1.4}
}
   RIVANA SAAS CLASSIC UI — reference layout
   Desktop: fixed navy sidebar + white topbar + compact panels.
   Mobile: off-canvas sidebar + fluid task layout.
============================================================ */
:root{
  --primary:#10ad8f;
  --primary-dark:#0b947a;
  --primary-soft:#e9faf6;
  --primary-ring:rgba(16,173,143,.15);
  --sidebar-bg:#2d4255;
  --sidebar-bg-deep:#24384a;
  --sidebar-text:#c7d3df;
  --sidebar-active:#203547;
  --border:#dfe4e8;
  --bg:#f1f3f5;
  --card:#fff;
  --text:#5c6369;
  --text-muted:#7d858c;
  --radius:2px;
  --shadow:none;
  --sidebar-width:198px;
}
html,body{min-height:100%;}
body{font-family:"Segoe UI",Arial,sans-serif;background:var(--bg);color:var(--text);font-size:13px;}
.sidebar{width:var(--sidebar-width);background:var(--sidebar-bg);box-shadow:none;border:0;}
.main{margin-left:var(--sidebar-width);background:var(--bg);min-height:100vh;}
.sidebar-brand{min-height:109px;padding:14px 15px;gap:10px;background:linear-gradient(135deg,#263b4e,#213548);border-bottom:1px solid rgba(255,255,255,.035);align-items:flex-start;flex-wrap:wrap;}
.brand-mark{width:48px!important;height:48px!important;min-width:48px;border-radius:50%!important;border:2px solid rgba(255,255,255,.72)!important;background:transparent!important;color:#18b59a!important;display:grid!important;place-items:center!important;overflow:hidden;}
.brand-mark .store-logo-img{width:100%;height:100%;object-fit:contain;background:#fff;}
.brand-mark i{font-size:21px;}
.brand-copy{min-width:0;flex:1;padding-top:5px;}
.brand-name{display:block;color:#eaf3f8;font-size:15px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.brand-copy small{display:block;color:#8fa5b7;font-size:8px;line-height:1.2;margin-top:2px;text-transform:uppercase;letter-spacing:.02em;}
.sidebar-nav{padding:0;}
.nav-item{min-height:41px;padding:0 18px;color:#b8c8d7;font-size:12px;border-inline-start:4px solid transparent;gap:10px;transition:background .12s ease,color .12s ease,border-color .12s ease;}
.nav-item i{font-size:12px;width:14px;color:#9db1c4;}
.nav-item:hover{background:rgba(0,0,0,.08);color:#fff;}
.nav-item.active{background:var(--sidebar-active);color:#fff;border-inline-start-color:var(--primary);box-shadow:none;}
.nav-item.active i{color:#fff;}
.sidebar-footer{border-top:1px solid rgba(255,255,255,.05);background:var(--sidebar-bg-deep);padding:0;}
.topbar{height:54px;min-height:54px;padding:0 22px;background:#fff;border-bottom:1px solid #e3e6e8;box-shadow:none;position:sticky;top:0;}
#menuToggle{display:inline-grid!important;place-items:center;width:34px;height:28px;background:var(--primary);color:#fff;border-radius:3px;padding:0;}
#menuToggle:hover{background:var(--primary-dark);}
.page-title{font-size:14px;font-weight:600;color:#697078;}
.topbar-right{margin-left:auto;gap:9px;}
.store-context{height:34px;min-height:34px;border:0;border-radius:0;background:transparent;padding:0;gap:6px;}
.top-store-logo{width:28px;height:28px;border-radius:50%;background:#eef8f6;color:var(--primary);}
.store-context-copy small{display:none;}
.store-context-copy strong{font-size:11.5px;font-weight:600;color:#7a8187;max-width:140px;}
.store-switch{height:31px;min-width:130px;max-width:210px;border:1px solid #d9dee2;border-radius:2px;padding:0 25px 0 8px;font-size:11px;color:#60686f;background:#fff;}
.lang-select{height:31px;border-radius:2px;border-color:#d9dee2;padding:0 7px;font-size:11px;}
.content{max-width:none;margin:0;padding:18px 22px 28px;}
.page-head-pro{margin:0 0 12px;align-items:center;}
.page-head-pro h2{font-size:16px;font-weight:600;letter-spacing:0;color:#626970;margin:0;}
.page-head-pro p,.page-head-pro .eyebrow{display:none;}
.card{border:1px solid #e1e4e7;border-top:3px solid #e4e7e9;border-radius:0;background:#fff;margin-bottom:18px;overflow:visible;box-shadow:none;}
.card-head{min-height:42px;padding:10px 12px;border-bottom:1px solid #e4e7e9;background:#fff;display:flex;align-items:center;}
.card-head h3{font-size:13px;font-weight:600;color:#656c72;}
.card-subtitle{font-size:10.5px;color:#92989d;}
.card>.filters{padding:10px 12px;border-bottom:1px solid #e6e9eb;background:#fff;}
.stat-grid{gap:12px;}
.stat-card{border-radius:0;border:1px solid #e1e4e7;min-height:82px;padding:12px;background:#fff;}
.stat-icon{width:36px;height:36px;border-radius:2px;font-size:15px;}
.stat-value{font-size:18px;color:#596168;}
.stat-label{font-size:10.5px;}
.table-wrap{width:100%;overflow:auto;}
.table{min-width:680px;border-collapse:collapse;}
.table th{background:#f4f5f6;color:#6d747a;border:1px solid #dfe3e6;padding:8px 9px;font-size:10.5px;text-transform:none;letter-spacing:0;font-weight:600;}
.table td{border:1px solid #e1e4e6;padding:7px 9px;font-size:11.5px;color:#686f75;}
.table tbody tr:hover{background:#fafcfc;}
.btn{min-height:31px;padding:6px 10px;border-radius:2px;font-size:11.5px;font-weight:600;box-shadow:none;}
.btn-primary,.btn-success{background:var(--primary);border-color:var(--primary);color:#fff;}
.btn-primary:hover,.btn-success:hover{background:var(--primary-dark);border-color:var(--primary-dark);}
.btn-light,.btn-secondary{background:#fff;border:1px solid #d9dee2;color:#687079;}
.btn-danger{background:#f05b6e;border-color:#f05b6e;}
.btn-danger-light{color:#ed5565;border-color:#f3c9ce;background:#fff5f6;}
.btn-xs{min-height:24px;padding:3px 6px;font-size:10px;}
.icon-btn{width:28px;height:28px;border-radius:2px;}
.form-control,.login-form input,.login-form select{min-height:34px;height:34px;border-radius:0;border:1px solid #d9dee2;background:#fff;color:#626970;font-size:12px;padding:6px 8px;box-shadow:none;}
textarea.form-control{height:auto;min-height:70px;}
.form-control:focus,.login-form input:focus,.login-form select:focus{outline:0;border-color:#7fd2c1;box-shadow:0 0 0 2px rgba(16,173,143,.08);}
label{font-size:11px;font-weight:600;color:#6d747a;}
.modal{border-radius:2px;border:1px solid #dfe3e6;box-shadow:0 8px 24px rgba(0,0,0,.14);}
.modal-head{padding:10px 13px;background:#fff;border-bottom:1px solid #e4e7e9;}
.modal-body{padding:14px;}
.modal-actions{margin-top:12px;padding-top:10px;}

/* Settings: compact SaaS control-panel structure */
.settings-grid{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(270px,.75fr);gap:18px;align-items:start;}
.settings-main{grid-row:auto;}
.settings-lists{grid-column:1/-1;}
.settings-store-profile{padding:13px;}
.logo-editor{margin:0 0 14px;padding:10px;border:1px solid #e0e4e7;border-radius:0;background:#f8f9fa;}
.logo-preview{width:64px;height:64px;border-radius:2px;border:1px solid #dce2e6;background:#fff;color:var(--primary);}
.logo-editor p{font-size:10px;}
.settings-form{padding:0 13px 13px;}
.settings-form .form-grid{gap:10px 12px;}
.store-cards{display:block;padding:0;max-height:350px;overflow-y:auto;}
.store-card{border:0;border-bottom:1px solid #edf0f2;border-radius:0;padding:9px 11px;min-height:49px;}
.store-card:last-child{border-bottom:0;}
.store-card:hover{background:#f8fbfb;}
.store-card.active{background:#edf9f6;border-color:#d7efea;}
.mini-store-logo{width:30px;height:30px;border-radius:50%;background:#f0f3f5;color:var(--primary);}
.settings-list-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:12px;}
.settings-list-card{border-radius:0;border:1px solid #e1e4e6;}
.settings-list-head{border-radius:0;background:#f6f7f8;min-height:39px;padding:7px 9px;}
.settings-items{max-height:230px;}
.settings-item{min-height:36px;padding:6px 8px;font-size:11px;}
.password-form{padding:12px;}

/* Login — clean SaaS sign-in, same visual system */
.login-body{min-height:100vh;display:grid;place-items:center;background:#eef1f3;padding:20px;position:relative;}
.login-body:before{content:"";position:fixed;left:0;top:0;bottom:0;width:34%;max-width:430px;background:linear-gradient(160deg,#24394b,#2d465a);z-index:0;}
.login-card{position:relative;z-index:1;width:min(430px,100%);background:#fff;border:1px solid #dfe3e6;border-top:4px solid var(--primary);border-radius:0;padding:30px 34px 32px;box-shadow:0 12px 34px rgba(34,52,68,.10);}
.login-logo{display:flex;justify-content:center;margin-bottom:12px;}
.login-mark{width:58px;height:58px;border-radius:50%;display:grid;place-items:center;background:#263d50;color:#19b89b;font-size:26px;font-weight:800;border:3px solid #dce6ec;}
.login-card h1{text-align:center;color:#344a5d;font-size:21px;margin:0 0 3px;font-weight:700;}
.login-sub{text-align:center;color:#90979d;font-size:11px;margin-bottom:22px;}
.login-form{display:grid;gap:7px;}
.login-form h3{font-size:14px;color:#5f666c;margin:4px 0 7px;}
.login-form label{margin-top:5px;}
.login-form .btn-block{margin-top:10px;min-height:36px;}
.alert{border-radius:0;font-size:11.5px;}

/* desktop collapsed sidebar */
body.sidebar-collapsed .sidebar{transform:translateX(calc(-1 * var(--sidebar-width)));}
body.sidebar-collapsed .main{margin-left:0;}
[dir="rtl"] body.sidebar-collapsed .sidebar{transform:translateX(var(--sidebar-width));}
[dir="rtl"] body.sidebar-collapsed .main{margin-right:0;}

@media(max-width:1100px){
  .settings-grid{grid-template-columns:1fr;}
  .settings-lists{grid-column:auto;}
  .settings-list-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:768px){
  :root{--sidebar-width:260px;}
  .sidebar{transform:translateX(-100%);z-index:220;box-shadow:5px 0 20px rgba(0,0,0,.18);}
  .sidebar.open{transform:translateX(0);}
  .main{margin-left:0!important;margin-right:0!important;}
  [dir="rtl"] .sidebar{left:auto;right:0;transform:translateX(100%);}
  [dir="rtl"] .sidebar.open{transform:translateX(0);}
  .overlay.show{display:block;position:fixed;inset:0;background:rgba(23,35,45,.44);z-index:210;}
  .topbar{height:52px;min-height:52px;padding:0 10px;gap:8px;}
  .page-title{font-size:12px;max-width:110px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .store-context-copy{display:none;}
  .store-switch{min-width:0;width:112px;max-width:112px;font-size:10px;}
  .lang-select{width:47px;}
  .content{padding:12px;}
  .card{margin-bottom:12px;}
  .stat-grid,.stat-grid.sm{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
  .stat-card{min-height:74px;padding:9px;}
  .stat-icon{width:31px;height:31px;font-size:13px;}
  .stat-value{font-size:15px;}
  .two-col{grid-template-columns:1fr!important;gap:12px;}
  .form-grid,.form-grid.three-cols{grid-template-columns:1fr!important;}
  .form-grid .span-2{grid-column:auto!important;}
  .settings-list-grid{grid-template-columns:1fr;}
  .modal{width:calc(100vw - 20px)!important;max-width:none!important;max-height:calc(100vh - 20px);overflow:auto;}
  .modal-actions{display:flex;gap:7px;}
  .modal-actions .btn{flex:1;}
  .btn-group{gap:5px;flex-wrap:wrap;}
  .page-head-pro{align-items:flex-start;}
  .login-body{display:flex;align-items:center;justify-content:center;padding:14px;background:#eef1f3;}
  .login-body:before{width:100%;height:155px;bottom:auto;max-width:none;}
  .login-card{padding:24px 20px;width:100%;max-width:390px;}
}
@media(max-width:430px){
  .top-store-logo{display:none;}
  .store-switch{width:96px;max-width:96px;}
  .stat-grid,.stat-grid.sm{grid-template-columns:1fr;}
  .stat-card{min-height:66px;}
  .table{min-width:620px;}
  .content{padding:10px 8px 18px;}
  .card-head{padding:9px 10px;}
  .card>.filters{padding:8px 10px;}
  .btn{min-height:34px;}
  .settings-store-profile,.settings-form,.password-form{padding:10px;}
  .logo-editor{align-items:center;}
  .logo-preview{width:54px;height:54px;}
}
[dir="rtl"] .main{margin-left:0;margin-right:var(--sidebar-width);}
[dir="rtl"] .sidebar{left:auto;right:0;}
[dir="rtl"] .topbar-right{margin-left:0;margin-right:auto;}
.brand-fallback-letter{font-size:22px;font-weight:800;color:#19b89b;line-height:1;}
@media(max-width:768px){
  body.sidebar-open .sidebar{transform:translateX(0)!important;}
  body.sidebar-open .overlay{display:block!important;position:fixed;inset:0;background:rgba(23,35,45,.44);z-index:210;}
  [dir="rtl"] body.sidebar-open .sidebar{transform:translateX(0)!important;}
}

.permission-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:8px;margin:10px 0 18px}.permission-check{border:1px solid var(--border,#dde3e8);padding:10px 12px;border-radius:8px;background:#fff;display:flex;gap:8px;align-items:center}.user-access-list{display:grid;gap:8px}@media(max-width:600px){.permission-grid{grid-template-columns:1fr}}
