/* ===== Adham Accounts – design ===== */
:root {
  --brand: #0f766e;
  --brand-600: #0d6560;
  --brand-50: #ecfdf8;
  --brand-100: #ccfbef;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e5e7eb;
  --bg: #f4f6f8;
  --card: #ffffff;
  --red: #dc2626;
  --red-50: #fef2f2;
  --amber: #b45309;
  --amber-50: #fffbeb;
  --blue: #1d4ed8;
  --blue-50: #eff6ff;
  --green: #15803d;
  --green-50: #f0fdf4;
  --radius: 14px;
  --bs-primary: var(--brand);
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 15, 118, 110;
  --bs-link-hover-color: var(--brand-600);
  --bs-body-font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
}

body { background: var(--bg); font-size: 15px; -webkit-font-smoothing: antialiased; }
.num, .money, td.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.min-w-0 { min-width: 0; }
a { text-decoration: none; }

/* Buttons */
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand); }
.btn-icon { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 1.25rem; }
.btn-soft { background: var(--brand-50); color: var(--brand); border: 1px solid var(--brand-100); }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-600); }
.form-control, .form-select { border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(15,118,110,.15); }
.form-label { font-weight: 500; font-size: .9rem; color: #334155; margin-bottom: .35rem; }
.form-text { font-size: .8rem; }
.btn-check:checked + .btn-outline-primary { background: var(--brand); border-color: var(--brand); }

/* Password show/hide */
.pw-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.pw-wrap input { padding-left: 44px; }
.pw-eye { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.pw-eye:hover { color: var(--brand); background: var(--brand-50); }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex-shrink: 0; background: #fff; border-left: 1px solid var(--line); flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 24px 28px 40px; max-width: 1280px; width: 100%; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; margin-bottom: 18px; padding: 0 4px; }
.brand-name { font-size: 1rem; line-height: 1.2; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--brand), #14b8a6); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.brand-logo.lg { width: 60px; height: 60px; border-radius: 16px; font-size: 1.8rem; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #334155; font-weight: 500; }
.side-nav a i { font-size: 1.15rem; color: var(--muted); }
.side-nav a:hover { background: #f1f5f9; }
.side-nav a.active { background: var(--brand-50); color: var(--brand); }
.side-nav a.active i { color: var(--brand); }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 10px 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.side-user a { color: var(--muted); font-size: 1.15rem; }
.side-user a:hover { color: var(--red); }
.topbar { position: sticky; top: 0; z-index: 1020; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); }
.topbar .brand { margin: 0; }

/* Bottom nav (mobile) */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: space-around; align-items: center; height: 64px; padding-bottom: env(safe-area-inset-bottom); box-sizing: content-box; }
.bottom-nav > a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: .72rem; font-weight: 500; }
.bottom-nav > a i { font-size: 1.3rem; }
.bottom-nav > a.active { color: var(--brand); }
.fab-wrap { flex: 1; display: flex; justify-content: center; }
.fab { width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 1.6rem; margin-top: -26px; box-shadow: 0 6px 18px rgba(15,118,110,.35); }
@media (max-width: 991.98px) {
  .content { padding: 16px 14px 100px; }
}

/* Page head */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cards */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: 14px 18px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-body { padding: 18px; }
.section-title { font-size: 1rem; font-weight: 700; margin: 0; }

/* KPI tiles */
.kpi { padding: 18px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); height: 100%; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi-label { color: var(--muted); font-size: .85rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.5px; }
.kpi-foot { font-size: .8rem; color: var(--muted); }
.kpi .kpi-icon { position: absolute; left: 14px; top: 14px; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; }
.kpi.green .kpi-icon { background: var(--green-50); color: var(--green); }
.kpi.red .kpi-icon { background: var(--red-50); color: var(--red); }
.kpi.amber .kpi-icon { background: var(--amber-50); color: var(--amber); }
.kpi.blue .kpi-icon { background: var(--blue-50); color: var(--blue); }
.kpi:has(.kpi-icon) .kpi-label { padding-inline-end: 46px; min-height: 38px; }
@media (max-width: 575.98px) {
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.3rem; }
  .kpi .kpi-icon { width: 32px; height: 32px; font-size: 1rem; left: 10px; top: 10px; }
  .kpi:has(.kpi-icon) .kpi-label { padding-inline-end: 36px; min-height: 32px; font-size: .8rem; }
}
a.kpi { color: inherit; transition: border-color .15s, transform .15s; }
a.kpi:hover { border-color: var(--brand); }

/* Balance chips */
.bal { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.bal-lg { font-size: 1rem; padding: 6px 14px; }
.bal-zero { background: var(--green-50); color: var(--green); }
.bal-owes-us { background: var(--amber-50); color: var(--amber); }
.bal-we-owe { background: var(--red-50); color: var(--red); }
.bal-credit { background: var(--blue-50); color: var(--blue); }

/* Party list */
.list-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: inherit; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #f8fafc; }
.avatar { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; font-size: 1.05rem; }
.avatar.supplier { background: #f1f5f9; color: #475569; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { color: var(--muted); font-size: .82rem; }
.list-end { text-align: left; flex-shrink: 0; }

/* Tables */
.table { --bs-table-hover-bg: #f8fafc; margin: 0; }
.table > :not(caption) > * > * { padding: 12px 14px; vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: none; color: var(--muted); font-weight: 600; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td.num, .table th.num { text-align: left; }
.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-card .table-responsive { margin: 0; }
tr.clickable { cursor: pointer; }
.type-pill { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 8px; white-space: nowrap; }
.type-invoice { background: #fef3c7; color: #92400e; }
.type-payment { background: #dcfce7; color: #166534; }
.amt-in { color: var(--green); }
.amt-out { color: var(--red); }

/* Party header */
.party-hero { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.party-hero .avatar { width: 56px; height: 56px; font-size: 1.4rem; border-radius: 16px; }
.party-name { font-size: 1.35rem; font-weight: 700; margin: 0; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 18px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 500; font-size: .88rem; transition: all .15s; }
.qa i { font-size: 1.4rem; color: var(--brand); }
.qa:hover { border-color: var(--brand); background: var(--brand-50); color: var(--ink); }
.qa.wa i { color: #16a34a; }

/* Segmented control */
.seg { display: inline-flex; background: #eef2f5; padding: 4px; border-radius: 12px; gap: 4px; }
.seg a, .seg label { padding: 7px 16px; border-radius: 9px; color: #475569; font-weight: 500; font-size: .9rem; cursor: pointer; }
.seg a.active, .seg input:checked + label { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg input { display: none; }

/* Search */
.search-box { position: relative; }
.search-box i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-right: 40px; height: 44px; }

/* Forms */
.form-card { max-width: 760px; }
.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-toggle input { display: none; }
.type-toggle label { border: 2px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; cursor: pointer; font-weight: 600; background: #fff; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.type-toggle label i { font-size: 1.5rem; }
.type-toggle label small { font-weight: 400; color: var(--muted); font-size: .78rem; }
.type-toggle input:checked + label { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.amount-input { font-size: 1.5rem; font-weight: 700; height: 56px; }
.dropzone { border: 2px dashed #cbd5e1; border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; background: #fafbfc; transition: all .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.dropzone i { font-size: 2rem; display: block; margin-bottom: 6px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb { width: 96px; height: 96px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; position: relative; background: #f8fafc; display: flex; align-items: center; justify-content: center; flex-direction: column; font-size: .7rem; color: var(--muted); text-align: center; padding: 4px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.thumb i.bi-file-earmark-pdf { font-size: 2rem; color: var(--red); }
.thumb .rm { position: absolute; top: 4px; left: 4px; z-index: 2; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: .8rem; display: flex; align-items: center; justify-content: center; }
.thumb.removed { opacity: .35; }
.cheque-row { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; position: relative; }
.party-picker { position: relative; }
.party-results { position: absolute; top: 100%; right: 0; left: 0; z-index: 1050; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.1); max-height: 320px; overflow: auto; margin-top: 4px; display: none; }
.party-results.show { display: block; }
.party-results button { display: flex; width: 100%; border: 0; background: none; text-align: right; padding: 10px 14px; gap: 10px; align-items: center; border-bottom: 1px solid #f1f5f9; }
.party-results button:hover, .party-results button.hl { background: var(--brand-50); }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 16px 0 8px; z-index: 5; }
@media (max-width: 991.98px) { .sticky-actions { bottom: 64px; } }

/* Detail list */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 500; font-size: .88rem; }
.dl dd { margin: 0; font-weight: 500; }
@media (max-width: 575.98px) { .dl { grid-template-columns: 110px 1fr; } }

/* Empty state */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty i { font-size: 2.6rem; display: block; margin-bottom: 8px; opacity: .5; }

/* Auth */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; background: radial-gradient(circle at top, var(--brand-50), var(--bg) 60%); }
.auth-card { width: 100%; max-width: 420px; border-radius: 20px; }

/* Misc */
.text-brand { color: var(--brand) !important; }
.badge-soft { background: #f1f5f9; color: #475569; font-weight: 500; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.gallery a { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: #f8fafc; flex-direction: column; color: var(--muted); font-size: .8rem; gap: 4px; padding: 6px; text-align: center; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery i { font-size: 2.2rem; color: var(--red); }
.status-pending { background: var(--amber-50); color: var(--amber); }
.status-cleared { background: var(--green-50); color: var(--green); }
.status-bounced { background: var(--red-50); color: var(--red); }
.status-cancelled { background: #f1f5f9; color: #64748b; }
.due-soon { color: var(--amber); font-weight: 600; }
.overdue { color: var(--red); font-weight: 600; }
.alert { border-radius: 12px; }
.dropdown-menu { border-radius: 12px; border-color: var(--line); padding: 6px; }
.dropdown-item { border-radius: 8px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; }
.pagination { --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-color: var(--brand); }
.bar-row { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 10px; align-items: center; font-size: .82rem; margin-bottom: 8px; }
.bar { height: 10px; border-radius: 6px; background: #eef2f5; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 6px; }
