/* ============ ٹیلر شاپ — ڈیزائن (ایمرلڈ + گولڈ VIP تھیم) ============ */
@font-face {
    font-family: 'JameelNooriNastaleeq';
    src: url('fonts/JameelNooriNastaleeq.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
:root {
    --emerald: #0b3d2e;
    --emerald2: #0f5c44;
    --emerald3: #147052;
    --gold: #d9a521;
    --gold2: #b8860b;
    --goldsoft: #f6e8c3;
    --bg: #faf7f0;
    --card: #ffffff;
    --ink: #222;
    --muted: #6b6b6b;
    --line: #e7dfcf;
    --green: #1e7e34;
    --red: #c0392b;
    --blue: #2471a3;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'JameelNooriNastaleeq', 'Noto Nastaliq Urdu', serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 1.008rem;
    line-height: 2;
    direction: rtl;
}
a { color: var(--emerald3); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- لے آؤٹ ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 210px; flex: 0 0 210px;
    background: linear-gradient(180deg, var(--emerald), var(--emerald2));
    color: #fff; position: sticky; top: 0; height: 100vh;
    overflow-y: auto; z-index: 60; border-left: 3px solid var(--gold2);
}
.brand { padding: 14px 12px; border-bottom: 1px solid rgba(255,255,255,.14); text-align: center; }
.brand .shop { font-size: 1.33rem; font-weight: 700; color: var(--gold); line-height: 2.2; }
.brand .sub { font-size: 0.868rem; color: #cfe3d8; }
.nav { padding: 8px; }
.nav a {
    display: block; color: #eef5f0; padding: 6px 10px; margin: 2px 0;
    border-radius: 6px; font-size: 1.008rem; line-height: 2.1;
}
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.active { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #20301f; font-weight: 700; }
.nav .nav-head { font-size: 0.868rem; color: #a9c6b6; padding: 8px 10px 2px; }
.install-btn {
    display: block; width: 100%; margin: 10px 0 4px; font-family: inherit;
    background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #20301f;
    border: 0; border-radius: 8px; padding: 8px; font-size: 1.05rem; font-weight: 700; cursor: pointer;
}
.install-note { font-size: 0.84rem; color: #cfe3d8; padding: 0 10px 10px; line-height: 1.9; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: linear-gradient(135deg, var(--emerald), var(--emerald2));
    color: #fff; border-bottom: 2px solid var(--gold2);
    padding: 8px 14px; display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 1.33rem; font-weight: 700; flex: 1; line-height: 2; color: #fff; }
.menu-btn { display: none; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: 4px 12px; font-size: 1.4rem; cursor: pointer; }
.user-chip { font-size: 0.952rem; color: #dcebe2; white-space: nowrap; }
.user-chip .logout { color: #ffd97a; font-size: 0.952rem; margin-right: 8px; }
.content { padding: 14px; max-width: 1200px; width: 100%; margin: 0 auto; }
.backdrop { display: none; }

/* ---------- کارڈز ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.card h3 { font-size: 1.19rem; margin-bottom: 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-card {
    background: linear-gradient(135deg, var(--emerald), var(--emerald3));
    color: #fff; border-radius: 10px; padding: 10px 12px; text-align: center;
    border: 1px solid rgba(217,165,33,.35);
}
.stat-card.g { background: linear-gradient(135deg, #1e7e34, #2ea84a); }
.stat-card.b { background: linear-gradient(135deg, #0f5c44, #1d8a63); }
.stat-card.o { background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #20301f; }
.stat-card.r { background: linear-gradient(135deg, #a93226, #d35450); }
.stat-card .num { font-size: 1.47rem; font-weight: 700; line-height: 2; }
.stat-card .lbl { font-size: 1.008rem; opacity: .93; }

/* ---------- فوری رسائی بٹن (ڈیش بورڈ) ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.quick-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 14px 8px; border-radius: 12px; color: #fff; text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.15); border: 1px solid rgba(255,255,255,.25);
    transition: transform .15s, box-shadow .15s;
}
.quick-btn:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,.22); color: #fff; }
.quick-btn .qi { font-size: 1.9rem; line-height: 1.4; }
.quick-btn .qt { font-size: 1.05rem; font-weight: 700; line-height: 2; }
.quick-btn .qs { font-size: 0.82rem; opacity: .9; line-height: 1.8; }
.quick-btn.q1 { background: linear-gradient(135deg, #0f5c44, #1d8a63); }
.quick-btn.q2 { background: linear-gradient(135deg, #b8860b, #d9a521); color: #20301f; }
.quick-btn.q2:hover { color: #20301f; }
.quick-btn.q3 { background: linear-gradient(135deg, #1e7e34, #2ea84a); }
.quick-btn.q4 { background: linear-gradient(135deg, #2471a3, #2e86c1); }

/* ---------- ٹیبل ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.98rem; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 5px 8px; text-align: right; line-height: 2; }
.tbl th { background: #f3ecda; font-size: 0.98rem; }
.tbl tr:nth-child(even) td { background: #fdfbf5; }
.num-cell { text-align: left !important; font-variant-numeric: tabular-nums; }

/* ---------- فارم ---------- */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; }
.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.four { grid-template-columns: repeat(4, 1fr); }
.field { margin-bottom: 2px; }
.field label { display: block; font-size: 0.952rem; color: #444; margin-bottom: 0; }
.input, select.input, textarea.input {
    width: 100%; font-family: inherit; font-size: 1.008rem; line-height: 2;
    border: 1px solid #d8cfb8; border-radius: 6px; padding: 2px 10px; background: #fff; color: var(--ink);
}
.input:focus { outline: 2px solid #9fd0b6; border-color: var(--emerald3); }
.input[readonly] { background: #f2eee1; }
textarea.input { min-height: 60px; }
.section-head { font-size: 1.12rem; font-weight: 700; margin: 12px 0 6px; padding: 4px 10px; background: #efe7d2; border-radius: 6px; border-right: 3px solid var(--gold2); }

/* ---------- بٹن ---------- */
.btn {
    display: inline-block; font-family: inherit; font-size: 1.008rem; line-height: 2;
    padding: 2px 18px; border-radius: 6px; border: 1px solid transparent; cursor: pointer;
    background: #ece5d2; color: var(--ink); margin: 2px;
}
.btn:hover { text-decoration: none; filter: brightness(.96); }
.btn-primary { background: linear-gradient(135deg, var(--emerald2), var(--emerald)); color: #fff; }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #20301f; font-weight: 700; }
.btn-green { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 0 10px; font-size: 0.91rem; }
.page-actions { text-align: left; margin-bottom: 10px; }
.page-actions .btn { margin-right: 4px; }

/* ---------- متفرق ---------- */
.alert { padding: 6px 12px; border-radius: 6px; margin-bottom: 10px; font-size: 0.98rem; }
.alert-ok { background: #e6f4ea; border: 1px solid #a9d8b6; color: #1e7e34; }
.alert-err { background: #fdecea; border: 1px solid #f0b8b2; color: #a93226; }
.badge { display: inline-block; font-size: 0.952rem; background: var(--goldsoft); border: 1px solid #e3cd8d; border-radius: 10px; padding: 0 10px; color: #6b4e08; }
.badge.green { background: #e6f4ea; border-color: #a9d8b6; color: #1e7e34; }
.badge.red { background: #fdecea; border-color: #f0b8b2; color: #a93226; }
.search-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: flex-end; }
.search-row .field { flex: 1; min-width: 140px; }
.hint { font-size: 0.868rem; color: var(--muted); }
.rights-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.rights-box { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 0.952rem; }
.rights-box b { display: block; font-size: 1.008rem; margin-bottom: 2px; }
.rights-box label { margin-left: 10px; white-space: nowrap; }
.pager { text-align: center; margin-top: 10px; }
.pager a, .pager span { display: inline-block; padding: 0 10px; margin: 2px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 0.952rem; }
.pager span.cur { background: var(--emerald); color: #fff; border-color: var(--emerald); }

/* ---------- موڈل ---------- */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; align-items: flex-start; justify-content: center; padding: 30px 12px; }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 10px; width: 420px; max-width: 100%; max-height: 90vh; overflow-y: auto; }
.modal .m-head { background: linear-gradient(135deg, var(--emerald), var(--emerald2)); color: #fff; padding: 8px 14px; font-size: 1.19rem; border-radius: 10px 10px 0 0; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--gold2); }
.modal .m-body { padding: 12px 14px; }
.modal .m-foot { padding: 8px 14px; text-align: left; border-top: 1px solid var(--line); }
.m-close { background: none; border: 0; color: #fff; font-size: 1.54rem; cursor: pointer; }

/* ---------- VIP لاگ اِن ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #072a20 0%, var(--emerald) 55%, #0e5f47 100%);
    padding: 16px; position: relative; overflow: hidden;
}
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; pointer-events: none; }
.orb.o1 { width: 320px; height: 320px; background: #1d8a63; top: -80px; right: -60px; }
.orb.o2 { width: 260px; height: 260px; background: #d9a521; opacity: .28; bottom: -70px; left: -50px; }
.orb.o3 { width: 180px; height: 180px; background: #2ea84a; opacity: .35; bottom: 12%; right: 12%; }
.login-card { background: #fff; border-radius: 14px; width: 360px; max-width: 100%; overflow: hidden; position: relative; z-index: 2; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login-card .l-goldbar { height: 6px; background: linear-gradient(90deg, var(--gold2), var(--gold), var(--gold2)); }
.login-card .l-body { padding: 20px 22px 22px; text-align: center; }
.login-badge { width: 84px; height: 84px; margin: -52px auto 6px; border-radius: 50%; background: #fff; border: 3px solid var(--gold); box-shadow: 0 6px 18px rgba(0,0,0,.18); overflow: hidden; }
.login-badge img { width: 100%; height: 100%; object-fit: cover; }
.login-shop { font-size: 1.47rem; font-weight: 700; color: var(--emerald); }
.login-sub { font-size: 0.91rem; color: var(--muted); margin-bottom: 10px; }
.login-card .field { text-align: right; margin-bottom: 8px; }
.login-card .err { color: var(--red); font-size: 0.952rem; text-align: center; margin-bottom: 8px; }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--emerald3); font-size: 0.91rem; cursor: pointer; font-family: inherit; }
.btn-login {
    width: 100%; font-family: inherit; font-size: 1.19rem; font-weight: 700; line-height: 2.4;
    border: 0; border-radius: 8px; cursor: pointer; color: #fff; margin-top: 6px;
    background: linear-gradient(135deg, var(--emerald2), var(--emerald) 60%, #083626);
    box-shadow: 0 6px 16px rgba(11,61,46,.35);
}
.btn-login:hover { filter: brightness(1.08); }
.login-foot { text-align: center; font-size: 0.84rem; color: #dcebe2; margin-top: 12px; position: relative; z-index: 2; }

/* ---------- رسید (اسکرین) ---------- */
.receipt { background: #fff; border: 1px solid var(--line); border-radius: 8px; max-width: 560px; margin: 0 auto 12px; padding: 18px 20px; }
.receipt .r-shop { text-align: center; margin-bottom: 6px; }
.receipt .r-shop .nm { font-size: 1.47rem; font-weight: 700; color: var(--emerald); }
.receipt .r-shop .ad { font-size: 0.91rem; color: var(--muted); }
.receipt .r-title { text-align: center; font-size: 1.19rem; font-weight: 700; border-top: 1px dashed #999; border-bottom: 1px dashed #999; padding: 4px 0; margin: 8px 0; color: var(--emerald); }
.receipt table.rt { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.receipt table.rt td { padding: 3px 4px; border-bottom: 1px dotted #ddd; vertical-align: top; }
.receipt table.rt td.k { width: 42%; color: #444; }
.receipt .r-sign { display: flex; justify-content: space-between; margin-top: 26px; font-size: 0.952rem; }
.receipt .r-sign div { border-top: 1px solid #333; padding-top: 2px; min-width: 120px; text-align: center; }

/* ---------- نیچے ٹیب بار (موبائل ایپ) ---------- */
.tabbar { display: none; }

/* ---------- پرنٹ: A4 ---------- */
@media print {
    .no-print, .sidebar, .topbar .menu-btn, .backdrop, .tabbar { display: none !important; }
    body { background: #fff; font-size: 11pt; }
    .app { display: block; }
    .main { display: block; }
    .topbar { position: static; border: 0; padding: 0; }
    .content { padding: 0; max-width: none; }
    .card, .receipt { border: 0; margin: 0; max-width: none; }
    table.tbl { font-size: 10pt; }
    table.tbl th, table.tbl td { border: 1px solid #222 !important; padding: 4px 6px; }
    table.tbl th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .print-head { text-align: center; margin-bottom: 10px; border-bottom: 2px solid #222; padding-bottom: 8px; }
    .print-head .nm { font-size: 18pt; font-weight: 700; }
    .print-head .ad { font-size: 10pt; color: #333; }
    .print-head .ti { font-size: 13pt; font-weight: 700; margin-top: 4px; }
    .receipt table.rt td { border-bottom: 1px solid #222; font-size: 10pt; }
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    .stat-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.print-head { display: none; }
@media print { .print-head { display: block; } }

/* ---------- پرنٹ: تھرمل 80mm ---------- */
@page thermal { size: 80mm auto; margin: 2mm; }
body.thermal { background: #fff; font-size: 9pt; line-height: 1.9; }
body.thermal .no-print, body.thermal .sidebar, body.thermal .topbar, body.thermal .backdrop, body.thermal .tabbar { display: none !important; }
body.thermal .app { display: block; }
body.thermal .main, body.thermal .content { display: block; padding: 0; margin: 0; max-width: none; }
body.thermal .receipt { border: 0; margin: 0; padding: 0; max-width: 76mm; }
body.thermal .receipt .r-shop .nm { font-size: 12pt; }
body.thermal .receipt table.rt { font-size: 9pt; }
body.thermal .receipt table.rt td { border-bottom: 1px dashed #000; padding: 1px 2px; }
body.thermal table.tbl { font-size: 8pt; }
body.thermal table.tbl th, body.thermal table.tbl td { border: 1px solid #000; padding: 2px 3px; }
body.thermal .t-head { text-align: center; border-bottom: 1px solid #000; margin-bottom: 4px; padding-bottom: 4px; }
body.thermal .t-head .nm { font-size: 12pt; font-weight: 700; }
body.thermal .card { border: 0; padding: 0; margin: 0 0 6px; }
@media print {
    body.thermal { page: thermal; }
}

/* ---------- موبائل ---------- */
@media (max-width: 860px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid, .form-grid.two, .form-grid.four { grid-template-columns: repeat(2, 1fr); }
    .rights-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .sidebar { position: fixed; right: -230px; top: 0; transition: right .25s; height: 100vh; }
    body.nav-open .sidebar { right: 0; }
    body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; }
    .menu-btn { display: inline-block; }
    .content { padding: 10px 10px 76px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    .page-title { font-size: 1.19rem; }
    .user-chip .uname { display: none; }
    .btn { padding: 6px 20px; }
    /* نیچے ٹیب بار */
    .tabbar {
        display: flex; position: fixed; bottom: 0; right: 0; left: 0; z-index: 70;
        background: linear-gradient(180deg, var(--emerald2), var(--emerald));
        border-top: 2px solid var(--gold2);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .tabbar a, .tabbar button {
        flex: 1; background: none; border: 0; color: #eef5f0; font-family: inherit;
        display: flex; flex-direction: column; align-items: center; gap: 0;
        font-size: 0.868rem; line-height: 1.7; cursor: pointer; padding: 2px;
    }
    .tabbar a:hover, .tabbar button:hover { text-decoration: none; }
    .tabbar .ic { font-size: 1.61rem; line-height: 1.4; }
    .tabbar a.active, .tabbar button.active { color: var(--gold); font-weight: 700; }
}
