:root {
  --brand: #2c5cc5;
  --brand-dark: #1e3f8f;
  --sidebar-bg: #101f36;
  --sidebar-hover: #1a2f52;
  --content-bg: #f4f6fb;
}

body { background: var(--content-bg); font-family: "Segoe UI", Roboto, Arial, sans-serif; color: #263043; }

/* ---------- Auth pages ---------- */
.auth-body { min-height: 100vh; background: linear-gradient(135deg, #1e3f8f, #2c5cc5 60%, #4d7ee8); }
.auth-card { width: 100%; max-width: 420px; border-radius: 16px; }
.auth-logo { font-size: 2.5rem; color: var(--brand); }

/* ---------- App shell ---------- */
.app-wrapper { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 260px; flex-shrink: 0; background: var(--sidebar-bg); color: #cfd8e8;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1030;
}
.sidebar-brand { color: #fff; font-weight: 700; padding: 1.1rem 1.2rem; font-size: 1.05rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-nav { padding: .6rem 0; }
.sidebar-nav .nav-link, .sidebar-nav .nav-parent { color: #b7c2da; padding: .55rem 1.2rem; display: flex; align-items: center; gap: .6rem; font-size: .92rem; border-radius: 0; }
.sidebar-nav .nav-link:hover, .sidebar-nav .nav-parent:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; }
.sidebar-nav .nav-sublink { display: block; color: #9fabc7; padding: .4rem 1.2rem .4rem 2.6rem; font-size: .86rem; text-decoration: none; }
.sidebar-nav .nav-sublink:hover { color: #fff; background: var(--sidebar-hover); }

.app-main { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.app-topbar { background: #fff; border-bottom: 1px solid #e7ebf3; padding: .6rem 1.2rem; position: sticky; top: 0; z-index: 1020; }
.app-content { padding: 1.4rem; flex-grow: 1; }
.app-footer { background: #fff; border-top: 1px solid #e7ebf3; }

.avatar-circle {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .9rem;
}

/* ---------- Cards / widgets ---------- */
.stat-card { border: none; border-radius: 14px; box-shadow: 0 2px 10px rgba(30,50,100,.06); }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-card-link { cursor: pointer; color: #263043; text-decoration: none; display: block; transition: transform .18s ease, box-shadow .18s ease; }
.stat-card-link:hover, .stat-card-link:focus-visible { transform: translateY(-4px); box-shadow: 0 4px 8px rgba(20,30,60,.10), 0 20px 34px -10px rgba(20,30,60,.26); color: #263043; text-decoration: none; }
.card { border-radius: 12px; border: 1px solid #eaedf5; }
.card-header { background: #fbfcfe; font-weight: 600; }

.progress { border-radius: 10px; background: #eef1f8; }

.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6c7690; border-bottom-width: 1px; }
.badge { font-weight: 500; }

.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: #e2e7f2; }
.timeline-item { position: relative; padding-bottom: 1.3rem; }
.timeline-item::before { content: ''; position: absolute; left: -28px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 2px #d7e0f8; }

@media (max-width: 991.98px) {
  .app-sidebar { position: fixed; left: -260px; transition: left .2s ease; }
  .app-sidebar.show { left: 0; }
}

.kanban-col { background: #eef1f8; border-radius: 10px; padding: .7rem; min-height: 200px; }
.kanban-card { cursor: grab; }
.kanban-card.dragging { opacity: .5; }

/* Terms & Conditions auto font-switching (English 13pt / Urdu Jameel Noori Nastaleeq 18pt).
   The @font-face below only resolves if a licensed JameelNooriNastaleeq.ttf/.woff file has
   been placed in assets/fonts/ (see assets/fonts/README.md) - otherwise the browser falls
   back to Noto Nastaliq Urdu / serif, which still renders Urdu correctly, just not in that
   exact typeface. */
@font-face {
  font-family: 'Jameel Noori Nastaleeq';
  src: url('../fonts/JameelNooriNastaleeq.woff') format('woff'),
       url('../fonts/JameelNooriNastaleeq.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
.terms-input.terms-english,
.terms-text.terms-english { font-family: Helvetica, Arial, sans-serif; font-size: 13pt; line-height: 1.6; }
.terms-input.terms-urdu,
.terms-text.terms-urdu { font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif; font-size: 18pt; line-height: 2.1; }

/* Document thumbnail previews (Client -> Documents): 3x3in tiles - the maximum size any
   thumbnail/preview in the system is allowed to reach. Image files show a real thumbnail,
   other file types show a labeled icon of the same size. Every sizing rule carries
   !important so nothing (a theme override, a stray Bootstrap img class, a cached stylesheet
   from an older deploy) can make the preview render at its full uploaded resolution instead
   of the fixed 3x3in tile - if you're still seeing an oversized/full-size preview after
   updating, it's almost always a stale cached style.css; hard-refresh (Ctrl/Cmd+Shift+R) or
   clear the browser cache, since assets are now served with a ?v=<file-modified-time>
   query string specifically so future updates aren't silently served from cache.
   The card also gets a subtle raised/"3D" look - layered shadow + a gentle hover lift. */
.doc-thumb-grid { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.doc-thumb-card {
  width: 3.2in !important; max-width: 3.2in !important; border: 1px solid #e6eaf3; border-radius: 12px;
  background: #fff; overflow: hidden;
  box-shadow: 0 1px 2px rgba(20,30,60,.06), 0 10px 24px -8px rgba(20,30,60,.18);
  transition: transform .18s ease, box-shadow .18s ease;
}
.doc-thumb-card:hover { transform: translateY(-4px); box-shadow: 0 4px 8px rgba(20,30,60,.10), 0 20px 34px -10px rgba(20,30,60,.26); }
.doc-thumb-link {
  display: block !important; width: 3in !important; height: 3in !important; max-width: 3in !important; max-height: 3in !important;
  margin: .1in auto 0; background: #f5f7fb; border-radius: 8px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(20,30,60,.06);
}
.doc-thumb-img { width: 3in !important; height: 3in !important; max-width: 3in !important; max-height: 3in !important; object-fit: cover !important; display: block; }
.doc-thumb-icon { width: 3in !important; height: 3in !important; max-width: 3in !important; max-height: 3in !important; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; background: linear-gradient(160deg,#f8faff,#eef1fa); }
.doc-thumb-icon i { font-size: 3.2rem; filter: drop-shadow(0 3px 3px rgba(20,30,60,.15)); }
.doc-thumb-ext { font-size: .75rem; font-weight: 700; color: #6c7690; letter-spacing: .04em; }
.doc-thumb-body { padding: .6rem; }

/* Compact inline thumbnail used inside data tables (Payables ledger, Assets list) so an
   attachment's image is visible at a glance without leaving the row. Same hard-capped sizing
   + a light raised shadow so it reads as a distinct tile rather than a flat inline image. */
.thumb-sm-link {
  display: inline-block !important; width: 44px !important; height: 44px !important; max-width: 44px !important; max-height: 44px !important;
  border-radius: 6px; overflow: hidden; background: #f5f7fb; border: 1px solid #e2e7f2; vertical-align: middle;
  box-shadow: 0 2px 5px rgba(20,30,60,.14); transition: transform .15s ease, box-shadow .15s ease;
}
.thumb-sm-link:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 6px 12px rgba(20,30,60,.22); }
.thumb-sm-img { width: 44px !important; height: 44px !important; max-width: 44px !important; max-height: 44px !important; object-fit: cover !important; display: block; }
.thumb-sm-icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.thumb-sm-icon i { font-size: 1.3rem; }

/* Small View/Download/Share action row that sits next to an inline (thumb-sm) thumbnail
   in a data table - keeps the row compact while still giving every attachment its own
   download + share controls, not just "click to view". */
.thumb-actions { display: inline-flex; gap: .25rem; vertical-align: middle; margin-left: .4rem; }
.thumb-actions .btn { padding: .15rem .4rem; font-size: .78rem; line-height: 1.3; }

/* Payments section - dedicated "uploaded files" preview area shown below each payment row.
   2x2in tiles, same image/icon/3D-card pattern as the document thumbnails, capped so they
   never exceed 2in (well under the 3in system-wide maximum). */
.pay-thumb-grid { display: flex; flex-wrap: wrap; gap: .85rem; }
.pay-thumb-card {
  width: 2.2in !important; max-width: 2.2in !important; border: 1px solid #e6eaf3; border-radius: 10px;
  background: #fff; overflow: hidden;
  box-shadow: 0 1px 2px rgba(20,30,60,.06), 0 8px 18px -6px rgba(20,30,60,.18);
  transition: transform .18s ease, box-shadow .18s ease;
}
.pay-thumb-card:hover { transform: translateY(-3px); box-shadow: 0 3px 6px rgba(20,30,60,.10), 0 16px 26px -8px rgba(20,30,60,.24); }
.pay-thumb-link {
  display: block !important; width: 2in !important; height: 2in !important; max-width: 2in !important; max-height: 2in !important;
  margin: .1in auto 0; background: #f5f7fb; border-radius: 8px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(20,30,60,.06);
}
.pay-thumb-img { width: 2in !important; height: 2in !important; max-width: 2in !important; max-height: 2in !important; object-fit: cover !important; display: block; }
.pay-thumb-icon { width: 2in !important; height: 2in !important; max-width: 2in !important; max-height: 2in !important; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; background: linear-gradient(160deg,#f8faff,#eef1fa); }
.pay-thumb-icon i { font-size: 2.2rem; filter: drop-shadow(0 3px 3px rgba(20,30,60,.15)); }
.pay-thumb-body { padding: .5rem; }
.pay-files-cell { background: #fafbfd; border-top: none !important; padding-top: .25rem !important; }

/* Toast used by shareFile() in app.js when the browser has no native share sheet and we
   fall back to copying the file link to the clipboard. */
.app-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: #2c3444; color: #fff; padding: .6rem 1.1rem; border-radius: 8px; font-size: .85rem;
  opacity: 0; transition: opacity .25s ease, transform .25s ease; z-index: 2000;
  box-shadow: 0 4px 14px rgba(0,0,0,.2); pointer-events: none; }
.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Agreement preview (Agreements module): fixed 10x10in 3D card, the largest/most
   prominent preview in the system - agreements are few-per-client important legal
   documents, unlike the dense document/attachment grids elsewhere, so a big clear
   preview is worth the space. PDF agreements get a live embedded PDF viewer (an
   <iframe> onto the protected serve.php URL - the browser's own PDF viewer renders
   inside it); image agreements (JPG/JPEG) get a real cropped photo preview. Clicking
   anywhere on the tile still opens the full document in a new tab via its native viewer.*/
.agreement-thumb-grid { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.agreement-thumb-card {
  width: 10.4in !important; max-width: 100%; border: 1px solid #e6eaf3; border-radius: 14px;
  background: #fff; overflow: hidden;
  box-shadow: 0 2px 4px rgba(20,30,60,.07), 0 14px 30px -10px rgba(20,30,60,.22);
  transition: transform .18s ease, box-shadow .18s ease;
}
.agreement-thumb-card:hover { transform: translateY(-4px); box-shadow: 0 6px 12px rgba(20,30,60,.12), 0 26px 42px -12px rgba(20,30,60,.30); }
.agreement-thumb-link {
  display: block !important; width: 10in !important; height: 10in !important; max-width: 100% !important; max-height: 10in !important;
  margin: .2in auto 0; background: #f5f7fb; border-radius: 10px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(20,30,60,.06); position: relative;
}
.agreement-thumb-img { width: 10in !important; height: 10in !important; max-width: 100% !important; max-height: 10in !important; object-fit: cover !important; display: block; }
.agreement-thumb-frame { width: 100% !important; height: 10in !important; max-height: 10in !important; border: 0; display: block; background: #525659; pointer-events: none; }
.agreement-thumb-icon { width: 10in !important; height: 10in !important; max-width: 100% !important; max-height: 10in !important; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; background: linear-gradient(160deg,#f8faff,#eef1fa); }
.agreement-thumb-icon i { font-size: 6rem; filter: drop-shadow(0 4px 5px rgba(20,30,60,.16)); }
.agreement-thumb-body { padding: .9rem 1.1rem; }
.agreement-thumb-open { position: absolute; inset: 0; z-index: 2; } /* transparent tap target over the iframe, since iframes swallow clicks */

/* Case Status progress bar + step list, shared by the admin "Case Status" tab
   (modules/clients/view.php) and the public Client Case Status portal. */
.case-progress-wrap { background: #eef1f8; border-radius: 999px; height: 22px; overflow: hidden; position: relative; }
.case-progress-fill { height: 100%; background: linear-gradient(90deg,#2c5cc5,#17a673); border-radius: 999px; transition: width .4s ease; }
.case-progress-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: #1e2a44; }
.case-step-row { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border: 1px solid #e6eaf3; border-radius: 10px; background: #fff; margin-bottom: .6rem;
  box-shadow: 0 1px 2px rgba(20,30,60,.05); }
.case-step-emoji { font-size: 1.4rem; width: 2rem; text-align: center; flex-shrink: 0; }
.case-step-name { font-weight: 600; }

/* Payables & Receivables transaction attachments: fixed 3x3in preview shown directly
   below each transaction row (not just a thumbnail) - images render as an image,
   PDFs get a live embedded viewer, video gets a native player with controls, and
   audio/voice notes get an embedded audio player. Same fixed-size + !important
   sizing + raised "3D" card convention as the rest of the system's preview tiles
   (see .doc-thumb-* above), so it never grows to the uploaded file's full size. */
.file-preview-row > td { background: #fafbfd; border-top: none !important; padding: .5rem .75rem 1rem !important; }
.file-preview-wrap { display: inline-block; vertical-align: top; }
.file-preview-box {
  width: 3in !important; height: 3in !important; max-width: 3in !important; max-height: 3in !important;
  border: 1px solid #e6eaf3; border-radius: 12px; background: #f5f7fb; overflow: hidden;
  display: flex; align-items: center; justify-content: center; position: relative;
  box-shadow: 0 1px 2px rgba(20,30,60,.06), 0 10px 24px -8px rgba(20,30,60,.18);
  transition: transform .18s ease, box-shadow .18s ease;
}
.file-preview-box:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(20,30,60,.10), 0 18px 30px -10px rgba(20,30,60,.24); }
.file-preview-box img,
.file-preview-box video { width: 100% !important; height: 100% !important; object-fit: contain !important; display: block; background: #10151f; }
.file-preview-box iframe { width: 100% !important; height: 100% !important; border: 0; display: block; background: #525659; }
.file-preview-audio { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  background: linear-gradient(160deg,#f8faff,#eef1fa); padding: 0 .3in; }
.file-preview-audio i { font-size: 3.4rem; color: var(--brand); filter: drop-shadow(0 3px 3px rgba(20,30,60,.15)); }
.file-preview-audio audio { width: 100%; }
.file-preview-generic { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  background: linear-gradient(160deg,#f8faff,#eef1fa); padding: 0 .25in; text-align: center; }
.file-preview-generic i { font-size: 3.2rem; filter: drop-shadow(0 3px 3px rgba(20,30,60,.15)); }
.file-preview-generic span { font-size: .8rem; color: #6c7690; word-break: break-word; }
.file-preview-meta { width: 3in; display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .4rem; }
.file-preview-name { font-size: .82rem; color: #4a5573; }
.file-preview-actions { display: inline-flex; gap: .3rem; flex-shrink: 0; }
.file-preview-actions .btn { padding: .18rem .45rem; font-size: .8rem; }

/* Payables & Receivables "Add Proof" gallery (modules/payables/view.php) - a grid of
   profile-level evidence/supporting-document files, each rendered with the same
   3x3in .file-preview-box above plus its code/date/description and a password-gated
   Delete action underneath. */
.proof-grid { display: flex; flex-wrap: wrap; gap: 1.4rem; }
.proof-item { width: 3in; }
.proof-item-meta { margin-top: .35rem; }

/* Standalone public-facing pages (Client Case Status portal, login) that intentionally
   don't use the staff app shell (no sidebar/topbar). */
.portal-body { min-height: 100vh; background: linear-gradient(160deg,#f4f6fb,#e9edf6); padding: 2.5rem 1rem; }
.portal-wrap { max-width: 760px; margin: 0 auto; }
.portal-card { background: #fff; border-radius: 16px; box-shadow: 0 10px 30px rgba(20,30,60,.10); padding: 2rem; }
