/* ===========================================================
   افریقہ وقف قربانی — Design System v3
   Local Mehr Nastaliq forced everywhere • Bigger fonts
   =========================================================== */

@font-face {
    font-family: 'Mehr Nastaliq Web';
    src: url('../fonts/MehrNastaliqWeb.woff') format('woff'),
         url('../fonts/MehrNastaliqWeb.ttf')  format('truetype');
    font-display: swap;
    font-weight: normal;
    font-style: normal;
}

:root {
    --brand:        #0F766E;
    --brand-700:    #0D5F58;
    --brand-800:    #0B4F49;
    --brand-50:     #F0FDFA;
    --brand-100:    #CCFBF1;
    --brand-200:    #99F6E4;

    --bg:           #F7F4EE;
    --bg-2:         #FBF8F2;
    --surface:      #FFFFFF;
    --surface-2:    #FBF9F4;
    --ink:          #1C1917;
    --ink-2:        #44403C;
    --muted:        #78716C;
    --border:       #E7E5E0;
    --border-2:     #D6D3CE;

    --green:        #059669;
    --green-50:     #ECFDF5;
    --red:          #DC2626;
    --red-50:       #FEF2F2;
    --amber:        #D97706;
    --amber-50:     #FFFBEB;
    --blue:         #2563EB;
    --blue-50:      #EFF6FF;

    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;

    --shadow-xs: 0 1px 2px rgba(28, 25, 23, .04);
    --shadow-sm: 0 2px 4px rgba(28, 25, 23, .04), 0 1px 2px rgba(28, 25, 23, .03);
    --shadow:    0 4px 12px rgba(28, 25, 23, .06), 0 1px 2px rgba(28, 25, 23, .04);
    --shadow-lg: 0 12px 28px rgba(28, 25, 23, .08), 0 2px 4px rgba(28, 25, 23, .04);

    --font-urdu:  'Mehr Nastaliq Web', 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
    --font-latin: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

/*  Force Mehr Nastaliq on every element by default.
    Latin numerals/inputs override below via .ltr / .num / type=number etc. */
html, body, h1, h2, h3, h4, h5, h6, p, span, div, a, button, label, input, select, textarea, option, li, th, td, strong, em {
    font-family: var(--font-urdu);
}

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--ink);
    line-height: 2.1;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
body { min-height: 100vh; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-700); }

/* Numbers / Latin text — always Inter */
.num, .ltr, .receipt-no,
table.data td.num, table.data th.num,
.stat .value, [data-total], [data-total-words],
.user-chip .avatar, .sidebar .brand .crest, .sidebar .brand .subtitle,
.field input[type=number], .field input[type=tel],
.field input[type=email], .field input[type=password],
.field input[type=date], .field input[type=file],
input.ltr, .topbar .crumbs, .footer-note,
code, pre, .hint {
    font-family: var(--font-latin) !important;
    font-feature-settings: "tnum" 1;
}

.ltr, input.ltr, .num { direction: ltr; }
table.data td.num, table.data th.num { text-align: left; }

/* ---- Layout shell ---- */
.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-left: 1px solid var(--border);
    padding: 24px 16px;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 10px 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.sidebar .brand .crest {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--brand);
    display: grid; place-items: center; color: #fff; font-size: 22px;
    flex-shrink: 0; font-weight: 700;
}
.sidebar .brand .title { font-size: 22px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.sidebar .brand .subtitle { font-size: 12px; color: var(--muted); line-height: 1.2; font-weight: 500; letter-spacing: .04em; }

.sidebar .menu { list-style: none; padding: 0; margin: 4px 0 0; }
.sidebar .menu li { margin: 2px 0; }
.sidebar .menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    color: var(--ink-2); font-size: 18px; font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
    line-height: 1.6;
}
.sidebar .menu a:hover { background: var(--brand-50); color: var(--brand); }
.sidebar .menu a.active { background: var(--brand); color: #fff; }
.sidebar .menu a .ic {
    width: 22px; height: 22px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    opacity: .85;
}
.sidebar .menu a.active .ic { opacity: 1; }
.sidebar .menu .section-title {
    font-size: 11px; color: var(--muted); padding: 16px 14px 6px;
    text-transform: uppercase; letter-spacing: .1em;
    font-family: var(--font-latin) !important; font-weight: 600;
}

.main {
    min-width: 0; padding: 28px 32px 60px;
}

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 26px;
    flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar .page-title { font-size: 28px; font-weight: 600; margin: 0; line-height: 1.4; }
.topbar .user-chip {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 14px 6px 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.topbar .user-chip .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--brand);
    color: #fff; display: grid; place-items: center; font-weight: 600;
    font-size: 14px;
}
.topbar .user-chip .meta .name { font-size: 16px; line-height: 1.3; font-weight: 500; }
.topbar .user-chip .meta .role { font-size: 12px; line-height: 1.2; color: var(--muted); }

.mobile-trigger {
    display: none;
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    width: 42px; height: 42px; place-items: center; cursor: pointer;
    color: var(--ink-2);
}
.mobile-trigger:hover { color: var(--brand); }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 24px;
}
.card-pad-sm { padding: 16px; }
.card-title {
    display: flex; align-items: center; justify-content: space-between;
    margin: 0 0 18px;
}
.card-title h3 { margin: 0; font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.card-title .actions { display: flex; gap: 8px; }

/* ---- Stat tiles ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    transition: border-color .15s, transform .15s;
}
.stat:hover { border-color: var(--border-2); transform: translateY(-1px); }
.stat .ic {
    width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--brand-50); color: var(--brand);
    margin-bottom: 14px;
}
.stat.green  .ic { background: var(--green-50);  color: var(--green); }
.stat.amber  .ic { background: var(--amber-50);  color: var(--amber); }
.stat.blue   .ic { background: var(--blue-50);   color: var(--blue); }
.stat.red    .ic { background: var(--red-50);    color: var(--red); }
.stat .label { color: var(--muted); font-size: 15px; line-height: 1.5; }
.stat .value {
    font-size: 30px; font-weight: 600; color: var(--ink); margin-top: 4px;
    line-height: 1.2;
}
.stat .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---- Forms ---- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 22px;
}
.form-grid.full > .field { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
    font-size: 16px; font-weight: 500; color: var(--ink-2); line-height: 1.5;
}
.field label .req { color: var(--brand); margin-inline-start: 3px; }
.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-2);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-size: 17px;
    line-height: 1.6;
    font-family: var(--font-urdu);
    transition: border-color .15s, box-shadow .15s;
}
.field select option { font-family: var(--font-urdu); padding: 6px; font-size: 16px; }
.field input[type=number],
.field input[type=tel],
.field input[type=email],
.field input[type=password],
.field input[type=date],
.field input[type=file],
input.ltr {
    font-family: var(--font-latin);
    direction: ltr; text-align: left;
    font-size: 16px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.field .hint { font-size: 13px; color: var(--muted); }
.field .receipt-status {
    font-size: 15px; min-height: 22px; line-height: 1.5;
    transition: color .15s;
}
input.is-valid {
    border-color: var(--green) !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, .15) !important;
}
input.is-invalid {
    border-color: var(--red) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .15) !important;
}
.receipt-status.ok    { color: var(--green); }
.receipt-status.error { color: var(--red); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px;
    border-radius: 10px;
    border: 1.5px solid transparent;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-urdu) !important;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-700); color: #fff; }
.btn-outline { background: #fff; border-color: var(--border-2); color: var(--ink-2); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--brand-50); color: var(--brand); }
.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---- Tables ---- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.table-tools {
    display: flex; flex-wrap: wrap; gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.table-tools .field { flex: 1 1 160px; min-width: 140px; gap: 0; }
.table-tools .field input,
.table-tools .field select {
    padding: 10px 14px; font-size: 15px; border-radius: 8px;
}
.table-scroll { overflow-x: auto; }
table.data {
    width: 100%; border-collapse: collapse; min-width: 720px;
}
table.data thead th {
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 15px;
    font-weight: 600;
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    line-height: 1.5;
}
table.data tbody td {
    padding: 14px 16px;
    font-size: 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--ink-2);
    line-height: 1.6;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--brand-50); }
table.data .row-actions {
    display: flex; gap: 4px; justify-content: flex-start;
}
table.data .row-actions a {
    width: 32px; height: 32px; display: grid; place-items: center;
    border-radius: 8px; color: var(--muted); background: transparent;
    transition: background .12s, color .12s;
}
table.data .row-actions a:hover { background: var(--brand-50); color: var(--brand); }
table.data .row-actions a.danger:hover { background: var(--red-50); color: var(--red); }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 14px; font-weight: 500;
    background: var(--surface-2); color: var(--ink-2);
    border: 1px solid var(--border);
    line-height: 1.5;
}
.badge.green  { background: var(--green-50);  color: var(--green);  border-color: #BBF7D0; }
.badge.red    { background: var(--red-50);    color: var(--red);    border-color: #FECACA; }
.badge.amber  { background: var(--amber-50);  color: var(--amber);  border-color: #FDE68A; }
.badge.blue   { background: var(--blue-50);   color: var(--blue);   border-color: #BFDBFE; }
.badge.brand  { background: var(--brand-50);  color: var(--brand);  border-color: var(--brand-100); }

/* ---- Progress ---- */
.progress {
    background: var(--surface-2);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.progress .bar {
    height: 100%;
    background: var(--brand);
    border-radius: 999px;
    transition: width .4s ease;
}

/* ---- Alerts ---- */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 16px;
    border: 1px solid;
    line-height: 1.8;
}
.alert.success { background: var(--green-50); border-color: #BBF7D0; color: #065F46; }
.alert.error   { background: var(--red-50);   border-color: #FECACA; color: #991B1B; }
.alert.warning { background: var(--amber-50); border-color: #FDE68A; color: #92400E; }

/* ---- Charts wrapper ---- */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.tall { height: 340px; }

/* ---- Grids ---- */
.grid-2   { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* ---- Page header ---- */
.page-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 22px;
}
.page-header h1 { margin: 0; font-size: 30px; font-weight: 600; line-height: 1.4; }
.page-header .right { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Auth (login) ---- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 480px;
    background: var(--bg);
}
.auth-shell .hero {
    padding: 60px;
    display: flex; flex-direction: column; justify-content: space-between;
    background: var(--brand);
    color: #fff;
    position: relative; overflow: hidden;
}
.auth-shell .hero::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(900px 600px at 80% -20%, rgba(255,255,255,.10), transparent 70%);
    pointer-events: none;
}
.auth-shell .hero .crest {
    width: 68px; height: 68px; border-radius: 16px;
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(8px);
    display: grid; place-items: center; color: #fff; font-size: 30px;
    border: 1px solid rgba(255,255,255,.2);
}
.auth-shell .hero h2 { font-size: 50px; margin: 22px 0 10px; line-height: 1.4; color: #fff; font-weight: 600; }
.auth-shell .hero p  { color: rgba(255,255,255,.88); max-width: 460px; font-size: 19px; line-height: 2; }
.auth-shell .form-panel {
    background: var(--surface);
    padding: 60px 50px;
    display: flex; align-items: center;
}
.auth-shell .form-panel .inner { width: 100%; max-width: 380px; margin: 0 auto; }
.auth-shell h3 { margin: 0; font-size: 30px; font-weight: 600; line-height: 1.4; }
.auth-shell .form-panel p { color: var(--muted); margin: 4px 0 26px; font-size: 17px; }

@media (max-width: 960px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-shell .hero { padding: 36px; }
    .auth-shell .hero h2 { font-size: 36px; }
    .auth-shell .form-panel { padding: 36px; }
}

/* ---- Receipt / print ---- */
.print-wrap { max-width: 720px; margin: 30px auto; padding: 36px;
    background: #fff; border: 1px solid var(--border); border-radius: 14px; }

@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main { padding: 0; }
    body { background: #fff; }
    .print-wrap { box-shadow: none; border: none; }
}

/* ---- Drawer (mobile sidebar) ---- */
@media (max-width: 1024px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; right: 0; top: 0; height: 100vh; width: 290px;
        z-index: 50;
        transform: translateX(100%); transition: transform .22s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .drawer-mask {
        display: none; position: fixed; inset: 0; background: rgba(28,25,23,.45); z-index: 49;
    }
    .drawer-mask.open { display: block; }
    .mobile-trigger { display: grid; }
    .main { padding: 18px; }
}

@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-1-1 { grid-template-columns: 1fr; }
    .topbar .page-title { font-size: 24px; }
    .stat .value { font-size: 26px; }
}

/* ---- Footer ---- */
.footer-note {
    text-align: center; color: var(--muted); margin: 36px 0 0;
    font-size: 13px;
}

/* ---- Empty state ---- */
.empty {
    text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty .ic {
    width: 60px; height: 60px; border-radius: 14px;
    background: var(--surface-2); color: var(--brand);
    display: grid; place-items: center; margin: 0 auto 14px;
}
.empty h4 { color: var(--ink-2); margin: 0; font-size: 19px; font-weight: 600; }
.empty p { margin: 8px 0 0; font-size: 15px; }

/* ---- Details (view page) ---- */
.detail-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: 0; }
.detail-row .k { color: var(--muted); font-size: 16px; }
.detail-row .v { font-size: 18px; font-weight: 500; }

/* ---- Form section dividers ---- */
.form-section-title {
    margin: 26px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 19px;
    font-weight: 600;
    color: var(--brand);
}
.form-section-title:first-child { margin-top: 0; }

/* ---- Total card on booking form ---- */
.total-card {
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    border-radius: 10px;
    padding: 12px 16px;
    justify-content: center;
}
.total-card label { color: var(--muted); font-size: 14px; }
.total-display {
    font-family: var(--font-latin);
    font-size: 28px;
    font-weight: 600;
    color: var(--brand);
    line-height: 1.2;
    display: flex; align-items: baseline; gap: 6px;
}
.total-display .unit { font-size: 16px; color: var(--muted); font-weight: 400; }

/* ---- Helpers ---- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-12 { margin-top: 12px; } .mt-20 { margin-top: 20px; } .mt-32 { margin-top: 32px; }
.mb-12 { margin-bottom: 12px; } .mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

input[type=number] { appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { appearance: none; }
