@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    --bg: #0b0c10;
    --bg-elev: #14161c;
    --surface: #191c23;
    --surface-2: #21242d;
    --border: rgba(255,255,255,0.07);
    --border-strong: rgba(255,255,255,0.14);
    --text: #eceef2;
    --text-dim: #9aa0ad;
    --text-faint: #676d7a;
    --gold: #d9b354;
    --gold-bright: #f0c96b;
    --gold-dim: rgba(217,179,84,0.14);
    --green: #4ade80;
    --red: #f87171;
    --blue: #60a5fa;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14.5px;
}

body {
    background-image:
        radial-gradient(1200px 500px at 10% -10%, rgba(217,179,84,0.06), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(96,165,250,0.05), transparent 55%);
}

a { color: inherit; text-decoration: none; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ---------- layout shell ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 236px;
    flex-shrink: 0;
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.brand-badge {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(145deg, #1c1f26, #0d0e12);
    border: 1px solid var(--border-strong);
    display: flex; align-items: center; justify-content: center;
    color: var(--gold-bright); font-weight: 800; font-size: 15px;
    box-shadow: inset 0 0 0 1px rgba(217,179,84,0.15);
}
.brand-text { line-height: 1.15; }
.brand-text .t1 { font-weight: 800; font-size: 14.5px; letter-spacing: 0.2px; }
.brand-text .t2 { font-size: 10.5px; color: var(--gold); text-transform: uppercase; letter-spacing: 1.4px; font-weight: 600; }

.nav-group { margin-top: 6px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--text-faint); padding: 14px 10px 6px; font-weight: 700; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--text-dim); font-weight: 500; font-size: 13.6px;
    margin-bottom: 2px; transition: background .12s, color .12s;
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { background: var(--gold-dim); color: var(--gold-bright); }
.nav-link.active svg { opacity: 1; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 8px 8px; border-radius: var(--radius-sm); }
.user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--surface-2); display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px; color: var(--gold-bright);
    border: 1px solid var(--border-strong);
}
.user-meta { line-height: 1.2; flex: 1; min-width: 0; }
.user-meta .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta .role { font-size: 11px; color: var(--text-faint); text-transform: capitalize; }
.logout-link { color: var(--text-faint); }
.logout-link:hover { color: var(--red); }

.main { flex: 1; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 28px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: rgba(11,12,16,0.85); backdrop-filter: blur(10px); z-index: 5;
}
.page-title { font-size: 19px; font-weight: 800; letter-spacing: -0.2px; }
.page-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
.content { padding: 24px 28px 60px; max-width: 1320px; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
    font-weight: 600; font-size: 13.5px; cursor: pointer; transition: all .12s;
}
.btn-gold { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: #1a1305; box-shadow: 0 4px 14px rgba(217,179,84,0.22); }
.btn-gold:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: rgba(248,113,113,0.12); color: var(--red); border-color: rgba(248,113,113,0.25); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- cards / stats ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat-card { position: relative; overflow: hidden; }
.stat-card .icon {
    width: 34px; height: 34px; border-radius: 9px; background: var(--gold-dim);
    display: flex; align-items: center; justify-content: center; color: var(--gold-bright); margin-bottom: 12px;
}
.stat-card .icon svg { width: 17px; height: 17px; }
.stat-label { font-size: 12px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 25px; font-weight: 800; margin-top: 5px; letter-spacing: -0.4px; }
.stat-delta { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.stat-delta.up { color: var(--green); }

.section-title { font-size: 14.5px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; }
.section-title .muted { font-size: 12px; color: var(--text-faint); font-weight: 500; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.015); }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 100px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.badge-green { background: rgba(74,222,128,0.12); color: var(--green); }
.badge-red { background: rgba(248,113,113,0.12); color: var(--red); }
.badge-gold { background: var(--gold-dim); color: var(--gold-bright); }
.badge-gray { background: var(--surface-2); color: var(--text-dim); }

/* ---------- forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin: 0 0 6px; }
input[type=text], input[type=number], input[type=email], input[type=password], input[type=tel], input[type=date], select, textarea {
    width: 100%; background: var(--bg-elev); border: 1px solid var(--border-strong); color: var(--text);
    padding: 10px 12px; border-radius: 9px; font-size: 13.8px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.field { margin-bottom: 16px; }
.field-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.req { color: var(--red); font-weight: 700; }
.vat-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; font-weight: 600; }
.vat-toggle input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--gold); cursor: pointer; }
.vat-badge-exempt { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(96,165,250,0.12); color: #60a5fa; display: inline-block; margin-top: 3px; }
.line-vat-toggle { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 11px; color: var(--text-faint); cursor: pointer; }
.line-vat-toggle input[type=checkbox] { width: 13px; height: 13px; accent-color: #60a5fa; cursor: pointer; }
.line-vat-toggle:has(input:checked) { color: #60a5fa; font-weight: 600; }
input[type=file] {
    width: 100%; background: var(--bg-elev); border: 1px dashed var(--border-strong); color: var(--text-dim);
    padding: 10px 12px; border-radius: 9px; font-size: 12.8px; font-family: inherit;
}
.addr-pane { padding-top: 2px; }
.doc-chip { display:inline-flex; align-items:center; gap:6px; font-size:12.5px; color: var(--gold-bright); border:1px solid var(--border-strong); border-radius:8px; padding:6px 11px; background: var(--gold-dim); }

/* ---------- login ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(900px 500px at 15% 10%, rgba(217,179,84,0.08), transparent 60%),
        radial-gradient(900px 600px at 90% 90%, rgba(96,165,250,0.06), transparent 55%),
        var(--bg);
    padding: 20px;
}
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 34px 30px; box-shadow: var(--shadow); }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-badge {
    width: 56px; height: 56px; border-radius: 16px;
    background: linear-gradient(145deg, #1c1f26, #0a0b0e);
    border: 1px solid rgba(217,179,84,0.3);
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(217,179,84,0.12), 0 8px 24px rgba(0,0,0,0.4);
}
.login-badge span { font-size: 22px; font-weight: 800; color: var(--gold-bright); }
.login-title { font-size: 18px; font-weight: 800; text-align: center; }
.login-sub { font-size: 12.5px; color: var(--text-faint); text-align: center; margin-top: 2px; }
.login-demo { margin-top: 18px; padding: 11px 13px; background: var(--bg-elev); border: 1px dashed var(--border-strong); border-radius: 10px; font-size: 11.8px; color: var(--text-dim); }
.login-demo b { color: var(--gold); }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--text-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.flash { padding: 10px 13px; border-radius: 9px; font-size: 13px; margin-bottom: 16px; font-weight: 500; }
.flash-error { background: rgba(248,113,113,0.1); color: #fca5a5; border: 1px solid rgba(248,113,113,0.25); }
.flash-success { background: rgba(74,222,128,0.1); color: #86efac; border: 1px solid rgba(74,222,128,0.25); }

/* ---------- POS / invoice builder ---------- */
.pos-grid { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
.pos-categories { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 6px 13px; border-radius: 100px; background: var(--surface); border: 1px solid var(--border-strong); font-size: 12.5px; font-weight: 600; color: var(--text-dim); cursor: pointer; }
.chip.active { background: var(--gold-dim); color: var(--gold-bright); border-color: rgba(217,179,84,0.35); }

.product-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.product-tile {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px;
    cursor: pointer; transition: border-color .12s, transform .12s;
}
.product-tile:hover { border-color: rgba(217,179,84,0.4); transform: translateY(-2px); }
.product-tile .pname { font-weight: 700; font-size: 13.3px; margin-bottom: 4px; }
.product-tile .pcat { font-size: 11px; color: var(--text-faint); margin-bottom: 10px; }
.product-tile .pprice { font-size: 15px; font-weight: 800; color: var(--gold-bright); }
.product-tile .pstock { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }

.cart-panel { position: sticky; top: 84px; }
.cart-items { max-height: 360px; overflow-y: auto; margin: 14px 0; }
.cart-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-row:last-child { border-bottom: none; }
.cart-row .cname { flex: 1; font-size: 13px; font-weight: 600; }
.cart-row .cprice { font-size: 11.5px; color: var(--text-faint); }
.qty-control { display: flex; align-items: center; gap: 6px; }
.qty-btn { width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text); cursor: pointer; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.qty-val { width: 22px; text-align: center; font-size: 12.5px; font-weight: 700; }
.cart-empty { text-align: center; padding: 30px 10px; color: var(--text-faint); font-size: 13px; }

.totals-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-dim); padding: 5px 0; }
.totals-row.grand { font-size: 17px; font-weight: 800; color: var(--text); border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; }
.totals-row.grand .val { color: var(--gold-bright); }

/* ---------- invoice detail / receipt ---------- */
.invoice-doc { background: #fff; color: #111; border-radius: var(--radius); padding: 34px 36px; max-width: 560px; margin: 0 auto; }
.invoice-doc .idoc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 16px; margin-bottom: 16px; }
.invoice-doc h1 { font-size: 17px; margin: 0 0 3px; }
.invoice-doc .idoc-meta { font-size: 11.5px; color: #555; line-height: 1.5; }
.invoice-doc .idoc-badge { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; background: #111; color: #d9b354; padding: 4px 9px; border-radius: 5px; }
.invoice-doc table { margin: 14px 0; }
.invoice-doc th { color: #777; border-bottom: 1px solid #ddd; font-size: 10px; }
.invoice-doc td { border-bottom: 1px solid #eee; font-size: 12.5px; padding: 8px 4px; color: #222; }
.invoice-doc .idoc-side { text-align: right; }
.invoice-doc .idoc-th-right { text-align: right; }
.invoice-doc .idoc-totals { margin-left: auto; width: 220px; }
.invoice-doc .idoc-totals .totals-row { color: #444; }
.invoice-doc .idoc-totals .grand { color: #111; border-top: 1px solid #111; }
.invoice-doc .idoc-totals .grand .val { color: #111; }
.idoc-qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 22px 0 6px; padding-top: 18px; border-top: 1px dashed #ccc; }
.idoc-qr-wrap img { width: 168px; height: 168px; image-rendering: pixelated; }
.idoc-qr-wrap .qr-label { font-size: 10.5px; color: #777; text-align: center; max-width: 320px; }
.idoc-foot { text-align: center; font-size: 10.5px; color: #999; margin-top: 14px; }

.detail-actions { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }

@media print {
    .sidebar, .topbar, .detail-actions, .no-print { display: none !important; }
    .main, .content { padding: 0; margin: 0; }
    body { background: #fff; }
    .invoice-doc { box-shadow: none; margin: 0; max-width: 100%; }
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.empty-state svg { width: 40px; height: 40px; opacity: .3; margin-bottom: 12px; }

@media (max-width: 980px) {
    .pos-grid { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .product-tiles { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- language switcher ---------- */
.lang-switch { display: flex; gap: 4px; background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: 9px; padding: 3px; margin-bottom: 10px; }
.lang-switch a { flex: 1; text-align: center; padding: 6px 4px; border-radius: 6px; font-size: 12px; font-weight: 700; color: var(--text-faint); }
.lang-switch a.active { background: var(--gold-dim); color: var(--gold-bright); }
.lang-switch a:hover:not(.active) { color: var(--text); }

/* ---------- RTL (Arabic) ---------- */
html[dir="rtl"] body { font-family: 'Tajawal', 'Inter', -apple-system, sans-serif; }
html[dir="rtl"] .mono { font-family: 'JetBrains Mono', 'Tajawal', monospace; }

/* Numbers/money stay LTR-aligned even inside RTL text — matches how Arabic
   retail/financial software conventionally displays Western-numeral amounts. */
html[dir="rtl"] .mono,
html[dir="rtl"] td.mono,
html[dir="rtl"] .stat-value,
html[dir="rtl"] .totals-row .mono {
    direction: ltr;
    unicode-bidi: isolate;
}

html[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
html[dir="rtl"] th { text-align: right; }
html[dir="rtl"] .nav-link.active { border-right: none; }
html[dir="rtl"] .invoice-doc .idoc-side { text-align: left; }
html[dir="rtl"] .invoice-doc .idoc-th-right { text-align: left; }
html[dir="rtl"] .invoice-doc .idoc-totals { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .login-wrap { direction: rtl; }
html[dir="rtl"] input[type=text], html[dir="rtl"] input[type=number], html[dir="rtl"] input[type=email],
html[dir="rtl"] input[type=password], html[dir="rtl"] input[type=tel], html[dir="rtl"] select, html[dir="rtl"] textarea {
    text-align: right;
}
html[dir="rtl"] .qty-control { direction: ltr; }
html[dir="rtl"] .cart-row .qty-control { direction: ltr; }

/* ===================== Accounting / Payables / Projects ===================== */
.muted { color: var(--text-faint); font-weight: 500; }
.status-select {
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
    border-radius: 9px; padding: 8px 12px; font-size: 13px; font-family: inherit; cursor: pointer;
}

.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kanban-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.kanban-col-head {
    padding: 12px 14px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
    color: var(--text-dim); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center;
}
.kanban-dropzone { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; flex: 1; transition: background .15s; }
.kanban-dropzone.drop-hover { background: var(--gold-dim); }
.kanban-card {
    background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px;
    cursor: grab;
}
.kanban-card.dragging { opacity: .4; }
.kanban-card-title { font-size: 13px; font-weight: 600; }
.kanban-card-meta { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.kanban-card-actions { display: flex; justify-content: flex-end; gap: 4px; margin-top: 8px; }
.task-move-form { display: inline; }
.kanban-move-btn {
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-dim);
    border-radius: 6px; width: 24px; height: 24px; font-size: 13px; cursor: pointer; line-height: 1;
}
.kanban-move-btn:hover { color: var(--gold-bright); border-color: var(--gold); }

@media (max-width: 900px) {
    .kanban { grid-template-columns: 1fr; }
}


/* MOBILE_V2_START */
.mobile-menu-btn,
.mobile-nav-overlay {
    display: none;
}

@media (max-width: 768px) {
    html, body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    .shell {
        display: block;
        width: 100%;
    }

    .sidebar {
        position: fixed;
        z-index: 1001;
        top: 0;
        left: 0;
        width: min(86vw, 310px);
        height: 100dvh;
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: 14px 0 35px rgba(0,0,0,.55);
    }

    body.mobile-nav-open .sidebar {
        transform: translateX(0);
    }

    html[dir="rtl"] .sidebar {
        left: auto;
        right: 0;
        transform: translateX(105%);
        border-left: none;
        border-right: 1px solid var(--border);
    }

    html[dir="rtl"] body.mobile-nav-open .sidebar {
        transform: translateX(0);
    }

    .mobile-nav-overlay {
        position: fixed;
        inset: 0;
        z-index: 1000;
        background: rgba(0,0,0,.62);
        backdrop-filter: blur(2px);
    }

    body.mobile-nav-open .mobile-nav-overlay {
        display: block;
    }

    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        padding: 0;
        border-radius: 10px;
        border: 1px solid var(--border-strong);
        background: var(--surface);
        color: var(--text);
        cursor: pointer;
    }

    .mobile-menu-btn svg {
        width: 21px;
        height: 21px;
    }

    .main {
        width: 100%;
        min-width: 0;
    }

    .topbar {
        padding: 10px 12px;
        gap: 9px;
        min-height: 62px;
    }

    .topbar > div:first-of-type {
        flex: 1;
        min-width: 0;
    }

    .page-title {
        font-size: 17px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .page-sub {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .content {
        padding: 16px 12px 42px;
        width: 100%;
        max-width: 100%;
    }

    .card {
        padding: 14px;
        border-radius: 12px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 22px;
    }

    .table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-wrap table {
        min-width: 650px;
    }

    th, td {
        white-space: nowrap;
    }

    input[type=text],
    input[type=number],
    input[type=email],
    input[type=password],
    input[type=tel],
    input[type=date],
    select,
    textarea {
        font-size: 16px;
        min-height: 44px;
    }

    .btn {
        min-height: 42px;
        justify-content: center;
    }

    .form-actions,
    .detail-actions {
        flex-wrap: wrap;
    }

    .form-actions .btn,
    .detail-actions .btn {
        flex: 1 1 auto;
    }

    .pos-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .cart-panel {
        position: static;
    }

    .product-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .product-tile {
        padding: 12px;
        min-width: 0;
    }

    .pos-categories {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .chip {
        flex: 0 0 auto;
    }

    .qty-btn {
        width: 34px;
        height: 34px;
    }

    .invoice-doc {
        width: 100%;
        max-width: 100%;
        padding: 18px 14px;
        border-radius: 10px;
        overflow-x: auto;
    }

    .invoice-doc .idoc-head {
        gap: 12px;
        flex-wrap: wrap;
    }

    .invoice-doc table {
        min-width: 460px;
    }

    .invoice-doc .idoc-totals {
        width: 100%;
        max-width: 270px;
    }

    .idoc-qr-wrap img {
        width: 150px;
        height: 150px;
    }

    .kanban {
        grid-template-columns: 1fr;
    }

    .login-wrap {
        padding: 14px;
        min-height: 100dvh;
    }

    .login-card {
        max-width: 100%;
        padding: 26px 18px;
        border-radius: 15px;
    }

    img {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 430px) {
    .product-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .topbar {
        padding-left: 10px;
        padding-right: 10px;
    }
}
/* MOBILE_V2_END */


/* COMPANY_SETTINGS_MOBILE_V4 */
@media (max-width: 768px) {

    /* All two-column forms/cards become one column */
    .content > .grid.grid-2,
    .content .grid.grid-2 {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 12px !important;
    }

    .content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px 10px 40px !important;
        overflow-x: hidden !important;
    }

    .card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 16px 14px !important;
    }

    .field {
        width: 100% !important;
        min-width: 0 !important;
    }

    .field input,
    .field select,
    .field textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        font-size: 16px !important;
    }

    input[type="file"] {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .form-actions {
        width: 100% !important;
    }

    .form-actions .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    .page-title {
        font-size: 20px !important;
    }

    .page-sub {
        font-size: 12px !important;
        white-space: normal !important;
        line-height: 1.4 !important;
    }
}

/* COMPANY_SETTINGS_FORCE_MOBILE_V5 */
@media screen and (max-width: 768px) {

  body .content .grid,
  body .content .grid.grid-2,
  body .content > .grid,
  body .content > .grid.grid-2 {
    display: block !important;
    width: 100% !important;
  }

  body .content .grid > .card,
  body .content > .grid > .card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 14px 0 !important;
  }

  body .card .grid,
  body .card .grid.grid-2 {
    display: block !important;
  }

  body .field {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 16px !important;
  }

  body input,
  body select,
  body textarea,
  body input[type="file"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body .content {
    padding: 12px !important;
    overflow-x: hidden !important;
  }

  body .card {
    padding: 16px !important;
  }
}


/* INVOICE_COMPANY_LOGO_FINAL */
.invoice-logo-wrap {
    display: block !important;
    margin-bottom: 10px !important;
}

.invoice-company-logo {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 190px !important;
    max-height: 90px !important;
    object-fit: contain !important;
}

@media print {
    .invoice-logo-wrap {
        display: block !important;
    }

    .invoice-company-logo {
        display: block !important;
        max-width: 170px !important;
        max-height: 80px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
