/* ESASOFT Business Manager - web report styling
   Urdu labels use Noto Nastaliq Urdu, numbers stay in a Latin face so digits
   line up in columns. */

@font-face {
    font-family: 'Noto Nastaliq Urdu';
    src: url('fonts/NotoNastaliqUrdu-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Noto Nastaliq Urdu';
    src: url('fonts/NotoNastaliqUrdu-Bold.ttf') format('truetype');
    font-weight: 700;
    font-display: swap;
}

:root {
    --ink:        #1a2230;
    --muted:      #64748b;
    --line:       #e3e8ef;
    --bg:         #f4f6fa;
    --card:       #ffffff;
    --green:      #1b5e20;
    --green-soft: #e8f5e9;
    --blue:       #1565c0;
    --blue-soft:  #e3f2fd;
    --orange:     #bf360c;
    --orange-soft:#fff3e0;
    --purple:     #4a148c;
    --purple-soft:#ede7f6;
    --red:        #b71c1c;
    --radius:     12px;
    --shadow:     0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Segoe UI', Roboto, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
}

.urdu {
    font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;
    direction: rtl;
    line-height: 2.1;
}

.num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: embed;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 16px; }

/* ── Header ───────────────────────────────────────────────────────────── */
.topbar {
    background: linear-gradient(135deg, #1b5e20, #2e7d32);
    color: #fff;
    padding: 16px 0;
    box-shadow: var(--shadow);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 0; padding-bottom: 0; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: .2px; }
.topbar .sub { margin: 0; font-size: 13px; opacity: .85; }
.topbar .spacer { flex: 1; }
.topbar a {
    color: #fff; text-decoration: none; font-size: 13px;
    border: 1px solid rgba(255,255,255,.45);
    padding: 6px 14px; border-radius: 999px; white-space: nowrap;
}
.topbar a:hover { background: rgba(255,255,255,.15); }

/* ── Cards ────────────────────────────────────────────────────────────── */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin: 18px 0;
}
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--blue);
}
.card .label { font-size: 20px; color: var(--muted); margin-bottom: 2px; }
.card .value { font-size: 22px; font-weight: 700; color: var(--ink); }
.card .note  { font-size: 12px; color: var(--muted); margin-top: 4px; }
.card.pos .value { color: var(--green); }
.card.neg .value { color: var(--red); }
.card.pos { border-top-color: var(--green); }
.card.neg { border-top-color: var(--red); }

/* ── Filter bar ───────────────────────────────────────────────────────── */
.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
input[type=date], input[type=text], input[type=password], select {
    font: inherit;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    min-width: 150px;
}
input:focus, select:focus { outline: 2px solid #2e7d32; outline-offset: 1px; border-color: #2e7d32; }

.btn {
    font: inherit; font-weight: 600;
    padding: 10px 20px;
    border: 0; border-radius: 8px;
    background: #2e7d32; color: #fff;
    cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #1b5e20; }
.btn.ghost { background: #eef2f7; color: var(--ink); }
.btn.ghost:hover { background: #e2e8f0; }

.quick-links { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.quick-links a {
    font-size: 13px; text-decoration: none;
    color: var(--blue); background: var(--blue-soft);
    padding: 5px 12px; border-radius: 999px;
}
.quick-links a:hover { background: #d0e4fb; }

/* ── Statement table ──────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.statement {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    min-width: 480px;
}
table.statement th {
    background: #263238; color: #fff;
    text-align: right; padding: 12px 14px;
    font-size: 18px; font-weight: 600;
}
table.statement th.ltr, table.statement td.ltr { text-align: right; }
table.statement th:first-child, table.statement td:first-child { text-align: right; }
table.statement td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
}
table.statement tr:last-child td { border-bottom: 0; }

tr.r-profit  td { background: var(--green-soft);  color: var(--green);  font-weight: 700; font-size: 16px; }
tr.r-deposit td { background: var(--blue-soft);   color: var(--blue); }
tr.r-withdraw td{ background: var(--orange-soft); color: var(--orange); }
tr.r-net     td { background: var(--purple-soft); color: var(--purple); font-weight: 700; font-size: 17px; }
tr.r-net.neg td { color: var(--red); }
tr.r-sep td { padding: 0; height: 6px; background: #eceff1; }

.empty {
    padding: 40px 20px; text-align: center;
    color: var(--muted); background: var(--card);
    border: 1px dashed var(--line); border-radius: var(--radius);
}

.footnote { color: var(--muted); font-size: 12px; margin: 14px 0 30px; text-align: center; }

/* ── Login ────────────────────────────────────────────────────────────── */
.login-shell {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center; padding: 20px;
}
.login-box {
    background: var(--card); width: 100%; max-width: 380px;
    border-radius: 16px; padding: 32px 28px;
    box-shadow: 0 10px 40px rgba(16,24,40,.12);
    border-top: 4px solid #2e7d32;
}
.login-box h1 { margin: 0 0 4px; font-size: 21px; }
.login-box p.sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.login-box .field { margin-bottom: 14px; }
.login-box input { width: 100%; }
.login-box .btn { width: 100%; padding: 12px; margin-top: 6px; }
.alert {
    background: #fdecea; color: #b71c1c;
    border: 1px solid #f5c6c2; border-radius: 8px;
    padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}

/* ── Print ────────────────────────────────────────────────────────────── */
@media print {
    body { background: #fff; }
    .topbar, .panel, .quick-links, .no-print { display: none !important; }
    .card, table.statement { box-shadow: none; border: 1px solid #999; }
    .wrap { max-width: none; padding: 0; }
    .print-head { display: block !important; }
}
.print-head { display: none; text-align: center; margin-bottom: 14px; }
.print-head h2 { margin: 0 0 2px; }
.print-head p { margin: 0; color: #555; font-size: 13px; }

/* ── Small screens ────────────────────────────────────────────────────── */
@media (max-width: 560px) {
    .wrap { padding: 12px; }
    .topbar h1 { font-size: 17px; }
    .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .card .value { font-size: 19px; }
    .field, input[type=date] { width: 100%; }
    .field { flex: 1 1 100%; }
    .btn { width: 100%; }
}

/* ── Admin panel ──────────────────────────────────────────────────────── */
.alert.ok {
    background: #e8f5e9; color: #1b5e20; border-color: #a5d6a7;
}

.pill {
    font-size: 11px; font-weight: 700; letter-spacing: .4px;
    padding: 3px 10px; border-radius: 999px;
}
.pill.on  { background: var(--green-soft);  color: var(--green); }
.pill.off { background: #fdecea;            color: var(--red); }

table.mini {
    width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px;
}
table.mini td {
    padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--ink);
}
table.mini td:nth-child(odd) { color: var(--muted); width: 1%; white-space: nowrap; }
table.mini tr:last-child td  { border-bottom: 0; }

.keybox {
    margin-top: 14px; padding: 12px;
    background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
}
.keybox label { font-size: 12px; color: var(--ink); font-weight: 600; display: block; margin-bottom: 6px; }
code.key {
    display: block; word-break: break-all;
    font-family: 'Consolas', 'Courier New', monospace; font-size: 13px;
    background: #fff; border: 1px solid #cbd5e1; border-radius: 6px;
    padding: 9px 11px; color: #0f172a; user-select: all;
}
code.key.masked { color: var(--muted); }
.keybox details { margin-top: 6px; }
.keybox summary { cursor: pointer; font-size: 12px; color: var(--blue); }
.keybox .warn {
    font-size: 12px; color: var(--orange); margin: 6px 0 0; font-weight: 600;
}

.panel h3 { font-size: 16px; }
