/* =====================================================================
   GOE Patsanstha Portal — Agent App Theme  (v2 · 2026-09-03)
   ---------------------------------------------------------------------
   "Modern clean light" · brand = सहकार/वित्त teal-green
   - सर्व रंग :root variables मधून. रंग बदलायचा असेल तर फक्त हा block बदला.
   - जुन्या class नावं (app-header, stat-card, borrower-card, bottom-nav…) तशीच
     ठेवली आहेत — pages मध्ये markup बदल लागत नाही.
   - Page-level <style> मधले brand रंग var(--brand) ने बदलले आहेत (tools/recolor).
   ===================================================================== */

:root {
    /* ---- Brand (teal-green) ---- */
    --brand:          #0f766e;   /* teal-700 — primary buttons, active, links */
    --brand-dark:     #134e4a;   /* teal-900 — gradients, headers */
    --brand-accent:   #14b8a6;   /* teal-500 — highlights */
    --brand-soft:     #ccfbf1;   /* teal-100 — soft backgrounds */
    --brand-soft-2:   #99f6e4;   /* teal-200 — borders on soft bg */
    --brand-rgb:      15,118,110;
    --brand-grad:     linear-gradient(135deg, #0f766e 0%, #134e4a 100%);

    /* ---- Neutrals ---- */
    --bg:        #f4f7f6;   /* app background (हिरवट-पांढरा) */
    --surface:   #ffffff;
    --surface-2: #f8fafc;
    --border:    #e2e8f0;
    --border-2:  #cbd5e1;
    --ink:       #0f172a;
    --ink-2:     #334155;
    --muted:     #64748b;
    --muted-2:   #94a3b8;

    /* ---- Semantic ---- */
    --ok:      #16a34a;  --ok-bg:   #dcfce7;  --ok-ink:   #166534;
    --warn:    #f59e0b;  --warn-bg: #fef3c7;  --warn-ink: #92400e;
    --danger:  #dc2626;  --danger-bg:#fee2e2; --danger-ink:#991b1b;
    --info:    #0284c7;  --info-bg: #e0f2fe;  --info-ink: #075985;
    --ai:      #7c3aed;  /* AI call (OmniDim) accent — जांभळा तसाच */

    /* ---- Shape / depth / type ---- */
    --r-sm: 10px; --r: 16px; --r-lg: 22px; --r-pill: 999px;
    --sh-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --sh:    0 4px 16px rgba(15,23,42,.06);
    --sh-lg: 0 12px 32px -8px rgba(15,23,42,.18);
    --sh-brand: 0 8px 20px -6px rgba(var(--brand-rgb),.45);
    --font: 'Inter', 'Noto Sans Devanagari', 'Segoe UI', Roboto, system-ui, sans-serif;
    --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ==================== BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    padding-bottom: calc(80px + var(--safe-b));
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; }
::selection { background: var(--brand-soft); }

/* Mobile Container */
.mobile-container {
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg);
    min-height: 100vh;
    position: relative;
}

/* ==================== HEADER ==================== */
.app-header {
    background: var(--brand-grad);
    color: #fff;
    padding: 18px 16px 28px;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    margin-bottom: 18px;
    box-shadow: var(--sh-brand);
    position: relative;
    overflow: hidden;
}
.app-header::after {            /* सूक्ष्म decorative glow */
    content: ""; position: absolute; right: -40px; top: -60px;
    width: 180px; height: 180px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%);
    pointer-events: none;
}
.header-top { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1; }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar {
    width: 46px; height: 46px; background: rgba(255,255,255,.18);
    border: 1.5px solid rgba(255,255,255,.35);
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.user-text h3 { font-size: .78rem; font-weight: 500; opacity: .85; }
.user-text h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.date-badge {
    background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25);
    padding: 6px 12px; border-radius: var(--r-pill); font-size: .7rem; font-weight: 600;
}
.notification-bell {
    position: relative; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25);
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .2s;
}
.notification-bell:active { transform: scale(.94); }
.notification-bell .badge {
    position: absolute; top: -5px; right: -5px; background: var(--danger); color: #fff;
    font-size: .6rem; font-weight: 700; width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; border: 2px solid var(--brand-dark);
}

/* ==================== NOTIFICATION DROPDOWN ==================== */
.notification-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(2px); z-index: 998; display: none; }
.notification-dropdown {
    position: fixed; top: 70px; left: 10px; right: 10px; max-width: 460px; margin: 0 auto;
    background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-lg);
    z-index: 999; display: none; max-height: 75vh; overflow-y: auto;
}
.notification-dropdown.active { display: block; }
.dropdown-header {
    display: flex; justify-content: space-between; align-items: center; padding: 14px 16px;
    border-bottom: 1px solid var(--border); background: var(--surface-2);
    border-radius: var(--r-lg) var(--r-lg) 0 0; position: sticky; top: 0;
}
.dropdown-header h4 { margin: 0; font-size: .95rem; color: var(--ink); font-weight: 800; }
.close-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); padding: 5px; }
.dropdown-body { padding: 12px; }
.followup-card { background: var(--warn-bg); padding: 14px; border-radius: var(--r-sm); margin-bottom: 12px; border-left: 4px solid var(--warn); }
.followup-name { font-weight: 700; color: var(--ink); margin-bottom: 8px; font-size: .95rem; }
.followup-details { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: 5px; color: var(--ink-2); }
.followup-remark { font-size: .75rem; color: var(--muted); margin-top: 8px; padding-top: 6px; border-top: 1px solid #fde68a; }
.followup-actions { display: flex; gap: 8px; margin-top: 10px; }
.followup-btn {
    flex: 1; padding: 8px; border-radius: var(--r-sm); font-size: .75rem; font-weight: 600; text-align: center;
    text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}

/* ==================== CONTAINER & STATS ==================== */
.container { padding: 0 16px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.stat-card {
    background: var(--surface); padding: 16px 18px; border-radius: var(--r);
    box-shadow: var(--sh-sm); border: 1px solid var(--border); border-top: 3px solid var(--brand);
}
.stat-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.stat-value { font-size: 1.35rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.btn-map {
    background: var(--surface); padding: 14px; border-radius: var(--r); display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: var(--brand); font-weight: 700; margin-bottom: 18px;
    box-shadow: var(--sh-sm); border: 1px solid var(--border);
}

/* ==================== SEARCH SECTION ==================== */
.search-section { background: var(--surface); padding: 18px; border-radius: var(--r); margin-bottom: 22px; box-shadow: var(--sh-sm); border: 1px solid var(--border); }
.section-title { font-size: .85rem; font-weight: 800; color: var(--ink-2); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.search-input {
    width: 100%; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: var(--r-sm); font-size: .95rem;
    margin-bottom: 12px; outline: none; background: var(--surface-2); transition: .2s;
}
.search-input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.14); }
.filter-row { display: flex; gap: 8px; margin-bottom: 12px; }
.filter-select, .filter-date { flex: 1; padding: 10px; border: 1.5px solid var(--border); border-radius: var(--r-sm); font-size: .8rem; background: #fff; }
.search-btn {
    width: 100%; background: var(--brand); color: #fff; border: none; padding: 13px; border-radius: var(--r-sm);
    font-size: .95rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
    box-shadow: var(--sh-brand); transition: .15s;
}
.search-btn:active { transform: translateY(1px); }
.clear-filter-btn { display: block; text-align: center; margin-top: 12px; color: var(--muted-2); font-size: .8rem; text-decoration: none; padding: 6px; }

/* ==================== BORROWER CARD ==================== */
.borrower-card { background: var(--surface); border-radius: var(--r); margin-bottom: 14px; overflow: hidden; box-shadow: var(--sh-sm); border: 1px solid var(--border); }
.card-header { padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.borrower-name { font-size: 1rem; font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.borrower-name i { color: var(--brand); }
.status-badge { width: 32px; height: 32px; border-radius: 50%; background: var(--danger-bg); color: var(--danger); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .7rem; }
.card-body { padding: 16px; }
.info-row { display: flex; justify-content: space-between; margin-bottom: 8px; padding: 4px 0; }
.info-label { color: var(--muted); font-weight: 500; font-size: .85rem; }
.info-value { font-weight: 700; color: var(--ink); font-size: .85rem; }
.amt-due { color: var(--danger); font-size: 1rem; font-weight: 800; }
.address-box { display: flex; gap: 8px; margin: 12px 0; padding: 8px 0; font-size: .8rem; color: var(--ink-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.address-box i { margin-top: 2px; color: var(--muted); }

/* ==================== BUTTONS ==================== */
.button-container { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.button-row { display: flex; gap: 12px; }
.btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px;
    border-radius: var(--r-sm); font-size: .9rem; font-weight: 700; text-decoration: none; transition: all .15s; cursor: pointer; border: none;
}
.btn:active { transform: scale(.98); }
.btn-call    { background: var(--brand); color: #fff; flex: 1; }
.btn-call:active { background: var(--brand-dark); }
.btn-call.disabled { background: var(--muted-2); cursor: not-allowed; opacity: .6; }
.btn-visit   { background: var(--ok); color: #fff; flex: 1; }
.btn-visit:active { background: #15803d; }
.btn-history {
    background: var(--ai); color: #fff; width: 100%; padding: 12px; border-radius: var(--r-sm);
    text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: .9rem;
}
.btn-history:active { background: #6d28d9; }
/* सामायिक primary/secondary (नवीन pages साठी) */
.btn-primary, .btn-main {
    width: 100%; padding: 14px; border: none; border-radius: var(--r); font-weight: 800; font-size: 1rem; color: #fff;
    background: var(--brand-grad); box-shadow: var(--sh-brand); cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px; transition: .15s;
}
.btn-primary:active, .btn-main:active { transform: translateY(1px); }
.btn-secondary, .btn-soft {
    padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
    font-weight: 700; font-size: .85rem; color: var(--ink-2); cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px;
}

/* ==================== SHARED PAGE COMPONENTS ====================
   (agent_leave / agent_support इ. pages ह्याच class नावं वापरतात —
    page-level <style> असल्यास तो जिंकतो; नसल्यास हे defaults लागू) */
.app-container { max-width: 600px; margin: 0 auto; padding: 16px 16px 90px; }
.hero-card {
    background: var(--brand-grad); border-radius: var(--r-lg); padding: 20px 24px; color: #fff;
    box-shadow: var(--sh-brand); margin-bottom: 20px;
}
.hero-card h1 { font-size: 1.2rem; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 10px; }
.hero-card p { margin: 4px 0 0; opacity: .88; font-size: .85rem; }
.card-box { background: var(--surface); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-sm); border: 1px solid var(--border); margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.inp, .sel, .txt {
    width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--r-sm); font-size: .95rem;
    background: var(--surface-2); transition: .2s;
    min-width: 0; /* [2026-09-27] flex/grid मध्ये input आकुंचित होऊ शकेल — date input चे ~170px intrinsic रुंदीमुळे फोनवर आडवे scroll नको */
}
.inp:focus, .sel:focus, .txt:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.14); }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
/* [2026-09-27] .row2 ची मुले min-width:0 — अनेक पानांत local ".row2 {1fr 1fr}" copy आहे; 1fr = minmax(auto,1fr) असल्याने
   date input (~172px) कॉलम रुंद करत होता → 375px फोनवर पान 393px, WebView आडवे scroll. हा नियम त्या local copies लाही लागू होतो. */
.row2 > * { min-width: 0; }
.hrm-list { width: 100%; border-collapse: separate; border-spacing: 0; }
.hrm-list th { text-align: left; font-size: .72rem; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px; border-bottom: 2px solid var(--border); }
.hrm-list td { padding: 12px 8px; border-bottom: 1px solid var(--border); font-size: .85rem; vertical-align: middle; }
.pill { display: inline-block; padding: 4px 11px; border-radius: var(--r-pill); font-size: .72rem; font-weight: 700; white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.ok   { background: var(--ok-bg);   color: var(--ok-ink); }
.pill.no   { background: var(--danger-bg); color: var(--danger-ink); }
.pill.info { background: var(--brand-soft); color: var(--brand-dark); }
.alertbox { padding: 12px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: .9rem; margin-bottom: 16px; }
.alertbox.ok   { background: var(--ok-bg); color: var(--ok-ink); }
.alertbox.err  { background: var(--danger-bg); color: var(--danger-ink); }
.alertbox.warn { background: var(--warn-bg); color: var(--warn-ink); }
.empty { text-align: center; color: var(--muted); padding: 22px; font-size: .9rem; }

/* ==================== FORM UX (js/agent-ux.js) ==================== */
.is-invalid, .inp.is-invalid, .sel.is-invalid, .txt.is-invalid, .form-control-custom.is-invalid {
    border-color: var(--danger) !important; background: #fff7f7 !important; box-shadow: 0 0 0 3px rgba(220,38,38,.12) !important;
}
.field-error { color: var(--danger-ink); font-size: .75rem; font-weight: 600; margin: 4px 0 0 2px; }
.draft-bar {
    display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--warn-bg); color: var(--warn-ink); border: 1px solid #fde68a; border-radius: var(--r-sm);
    padding: 10px 14px; margin-bottom: 14px; font-size: .82rem; font-weight: 600;
}
.draft-actions { display: flex; gap: 6px; }
.draft-btn { border: none; border-radius: var(--r-pill); padding: 6px 12px; font-size: .75rem; font-weight: 700; cursor: pointer; }
.draft-btn.ok { background: var(--brand); color: #fff; }
.draft-btn.no { background: #fff; color: var(--warn-ink); border: 1px solid #fde68a; }
button[disabled], .btn-main[disabled], .btn-primary[disabled] { opacity: .65; cursor: not-allowed; }

/* ==================== BOTTOM NAVIGATION ==================== */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
    display: flex; justify-content: space-around; padding: 8px 0 calc(12px + var(--safe-b));
    box-shadow: 0 -4px 20px rgba(15,23,42,.06); border-top: 1px solid var(--border); z-index: 100;
    max-width: 480px; margin: 0 auto;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none;
    font-size: .62rem; color: var(--muted-2); font-weight: 700; padding: 4px 10px; border-radius: var(--r-sm); transition: .15s;
}
.nav-item i { font-size: 1.25rem; }
.nav-item.active { color: var(--brand); }
.nav-item.active i { transform: translateY(-1px); }
.nav-item:active { transform: scale(.94); }

/* ==================== LOADING & EMPTY ==================== */
.loading-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(2px); display: none; justify-content: center; align-items: center; z-index: 2000; }
.spinner { width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted-2); }
.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: .5; }

/* ==================== UTILITIES (Bootstrap-सदृश, pages मध्ये वापरले जातात) ==================== */
.text-primary { color: var(--brand) !important; }
.text-success { color: var(--ok) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warn) !important; }
.text-muted, .text-secondary { color: var(--muted) !important; }
.text-dark { color: var(--ink) !important; }
.fw-bold { font-weight: 700 !important; }
.small { font-size: .8rem; }
.d-flex { display: flex; } .align-items-center { align-items: center; } .justify-content-between { justify-content: space-between; }
.w-100 { width: 100%; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; }
.me-1 { margin-right: 4px; } .me-2 { margin-right: 8px; }
.rounded-pill { border-radius: var(--r-pill); }
.shadow-sm { box-shadow: var(--sh-sm); }

/* ==================== DESKTOP WIDTH (≥900px) ====================
   [2026-09-22 user] desktop वर एजंटची सर्व पानं agent_loan_ledger.php सारखी पूर्ण रुंदीची.
   Pages चा inline .app-container { max-width:600px } mobile साठी आहे; .mobile-container .xxx (जास्त specificity)
   ने इथून सर्व wrappers पूर्ण रुंद होतात — पानात वेगळं काही लिहायची गरज नाही. (.wide आता वेगळं नाही; जुन्या markup साठी ठेवलं.)
   wrappers: .app-container (बहुतेक पानं) · .dash (index.php) · .content-area (nearby.php) · .visit-container (add_visit.php)
             · .page-container (agent_generate_nach_mandate.php) · .arp (agent_reports_lib.php) */
@media (min-width: 900px) {
    .mobile-container .app-container, .mobile-container .app-container.wide, .mobile-container .arp,
    .mobile-container .dash, .mobile-container .content-area, .mobile-container .visit-container, .mobile-container .page-container {
        max-width: none !important; width: 100%; margin: 0; padding-left: 28px; padding-right: 28px; box-sizing: border-box;
    }
    .mobile-container .app-container, .mobile-container .arp { padding-top: 22px; padding-bottom: 60px; }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
    .btn { padding: 10px 12px; font-size: .85rem; }
    .stat-value { font-size: 1.15rem; }
    .borrower-name { font-size: .9rem; }
    .notification-dropdown { top: 65px; left: 8px; right: 8px; }
}

/* ==================== FLASH (PRG संदेश) — [2026-09-27] ====================
   save_visit.php / add_visit.php → index.php वर $_SESSION['flash_ok'|'flash_err']; index.php रेंडर करतं. */
.goe-flash { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); font-size: .86rem; font-weight: 700; margin: 0 0 14px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); box-shadow: var(--sh-sm); }
.goe-flash i { font-size: 1.05rem; }
.goe-flash.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok); }
.goe-flash.err { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger); }
/* nearby.php — Leaflet रंगीत divIcon marker (बाह्य image नाही) */
.goe-pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(15,23,42,.35); background: var(--danger); }
.goe-pin.g { background: var(--warn); } .goe-pin.v { background: var(--ai); } .goe-pin.me { background: var(--info); border-radius: 50%; transform: none; }
.goe-pin-wrap { background: transparent !important; border: 0 !important; }
