/* --------------------------------------------------
   1. DESIGN TOKENS
-------------------------------------------------- */
:root {
  /* Surfaces */
  --bg: #f8fafc;
  --card: #ffffff;

  /* Text & borders */
  --ink: #0f172a;
  --sub: #475569;
  --line: rgba(15, 23, 42, 0.08);
  --border-light: rgba(148, 163, 184, 0.6);

  /* Shadows & radii */
  --shadow: 0 18px 36px rgba(15, 23, 42, 0.07);
  --shadow-strong: 0 24px 48px rgba(15, 23, 42, 0.25);
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 10px;

  /* Brand colors – aligned with logo */
  --blue-main: #2a70e1;   /* primary blue */
  --blue-light: #4fa6ff;  /* lighter blue accent */
  --teal: #16b57f;        /* green/teal from logo */

  /* Page background */
  --bg-page: #f9fafb;
  --card-bg: #ffffff;

  /* Typography */
  --font: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}


/* --------------------------------------------------
   2. GLOBAL RESET & BASE
-------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

/* Utility text */
.sub {
  font-size: 13px;
  color: var(--sub);
}

/* Generic page wrapper (used only when needed) */
.page {
  padding: 16px;
}

/* Links */
a {
  color: inherit;
}

/* --------------------------------------------------
   3. SHARED COMPONENTS
-------------------------------------------------- */

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* Scrollable card wrapper (used instead of inline style) */
.scroll-card {
  overflow: auto;
  max-height: 340px;
}

/* Buttons */
.btn,
.btn-primary,
.btn-dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 0;
  padding: 10px 14px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn {
  background: #0f172a;
  color: #fff;
}

.btn.sec {
  background: var(--blue-main);
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue-light), var(--blue-main));
  color: #fff;
}

.btn-dark {
  background: #0f172a;
  color: #fff;
}

.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

/* Links that look like buttons */
.action-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--blue-main);
  margin-top: 12px;
}

/* Key-value grid (case detail) */
.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 10px;
  font-size: 14px;
  margin-top: 8px;
}

.kv .k {
  color: var(--sub);
}

/* Pills / tags */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e2e8f0;
  color: var(--ink);
  margin-right: 6px;
}

/* Generic titles */
.title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* Money helper */
.money {
  white-space: nowrap;
  font-weight: 700;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  color: var(--sub);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  padding: 10px 6px;
}

tbody td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  padding: 10px 6px;
  vertical-align: top;
}

/* Stackable tables (case detail) */
.stackable tbody tr {
  /* desktop/tablet default */
}

/* --------------------------------------------------
   4. LOGIN PAGE
-------------------------------------------------- */

.collector-login {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(96, 165, 250, 0.18) 0, rgba(96, 165, 250, 0) 55%),
    radial-gradient(circle at 80% 80%, rgba(20, 184, 166, 0.14) 0, rgba(20, 184, 166, 0) 55%),
    var(--bg-page);
  font-family: var(--font);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-wrapper {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}

.brand-logo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(96, 165, 250, 0.12), rgba(30, 64, 175, 0.11));
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.brand-logo img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
  transition: transform 0.4s ease;
}

.brand-logo:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(30, 64, 175, 0.35), inset 0 0 20px rgba(255, 255, 255, 0.5);
}

.brand-logo:hover img {
  transform: scale(1.08);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.input-group {
  width: 100%;
  margin-bottom: 14px;
}

.input-group label {
  display: block;
  font-size: 13px;
  color: var(--sub);
  margin-bottom: 4px;
}

.input-group input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}

.input-group input:focus {
  border-color: var(--blue-main);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.login-submit {
  width: 100%;
  margin-top: 8px;
}

.login-submit button {
  width: 100%;
}

.status {
  min-height: 18px;
  font-size: 13px;
  margin-top: 12px;
  color: var(--sub);
  text-align: center;
}

.status.error {
  color: #dc2626;
  font-weight: 500;
}

.footer-note {
  margin-top: 18px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

footer {
  margin-top: 24px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

.brandline {
  font-weight: 600;
  color: var(--blue-main);
}

/* --------------------------------------------------
   5. DASHBOARD (index + index_ar)
-------------------------------------------------- */

.collector-dashboard {
  background:
    radial-gradient(circle at 20% 20%, rgba(42, 112, 225, 0.20) 0, rgba(42, 112, 225, 0) 60%),
    radial-gradient(circle at 80% 80%, rgba(22, 181, 127, 0.16) 0, rgba(22, 181, 127, 0) 60%),
    var(--bg-page);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}

/* give dashboard logo a bit more breathing room below top bar */
.collector-dashboard .brand-block {
  margin-top: 48px;
}


.dashboard-main {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 40px;
}

/* --- Top metrics strip (overdue / today / completed) --- */

.metrics-strip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;     /* <-- add / adjust this */
}

.metric-row {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  font-size: 0.75rem;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease;
}

.metric-row:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}

.metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
  white-space: nowrap;
}

.metric-value {
  margin-top: 0.1rem;
  font-size: 1.35rem;
  font-weight: 800;
}

/* Colors */
.metric-overdue {
  color: #dc2626; /* red */
  border-color: rgba(220, 38, 38, 0.4);
  background: linear-gradient(
    135deg,
    rgba(248, 113, 113, 0.16),
    rgba(248, 113, 113, 0.02)
  );
}

.metric-today {
  color: #2a70e1; /* blue from logo */
  border-color: rgba(42, 112, 225, 0.5);
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.16),
    rgba(59, 130, 246, 0.02)
  );
}

.metric-completed {
  color: #16b57f; /* success / brand teal */
  border-color: rgba(22, 181, 127, 0.45);
  background: linear-gradient(
    135deg,
    rgba(45, 212, 191, 0.16),
    rgba(45, 212, 191, 0.02)
  );
}


/* metrics */
/*.metric-row {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.metric-row span {
  font-size: 20px;
}

.metric-sub {
  font-size: 13px;
  color: var(--sub);
}
*/
/* cases list container populated by JS */
.case-list {
  margin-top: 12px;
}

/* individual case rows (HTML injected by JS) */
.case-row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 12px;
}

.case-name-link {
  text-decoration: none;
  color: inherit;
}

.case-name {
  font-size: 16px;
  font-weight: 700;
}

.case-actions {
  width: 100%;
  margin-top: 8px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* footer */
.dashboard-footer {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

/* Modal: visit log / payment */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 380px;
  border-radius: 16px;
  box-shadow: var(--shadow-strong);
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 20px;
  font-family: var(--font);
  color: #0f172a;

  /* keep modal within viewport */
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 12px;
}

.modal-label {
  display: block;
  font-size: 13px;
  color: #475569;
  margin-bottom: 4px;
}

.modal-input,
.modal-select,
.modal-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: #0f172a;
  margin-bottom: 12px;
  outline: none;
  font-family: inherit;
}

.modal-textarea {
  min-height: 70px;
  resize: vertical;
}

.modal-help {
  margin-top: 8px;
  color: #e5e7eb;
  font-size: 13px;
  text-align: center;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* variant when we want left-aligned actions (no inline style) */
.modal-actions-start {
  justify-content: flex-start;
}

.modal-actions .btn {
  font-size: 14px;
}

.profile-divider {
  margin: 18px 0 12px;
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.5);
}

/* Photo preview area in visit modal
   (used by JS thumbnails, same classes as old HTML) */
.visit-photo-preview {
  display: flex;
  gap: 6px;
  margin: 4px 0 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

/* Thumbnail wrapper – used in dashboard modal + case detail visits strip */
.visit-photo-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: #f8fafc;
  cursor: pointer;
}

.visit-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Remove (X) button on each thumbnail in visit modal preview */
.visit-photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.75);
  color: #f9fafb;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visit-photo-remove:hover {
  background: rgba(220, 38, 38, 0.9);
}

/* --------------------------------------------------
   DASHBOARD TOP ICON BAR (language + logout)
-------------------------------------------------- */

/* dashboard top bar: user (left) + icons (right) */

.tasks-title-link {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.tasks-title-link:hover {
  color: var(--blue-main);
}

.top-bar {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 6px);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
}

/* container for language + logout icons */
.top-icons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.top-icons button {
  background: #ffffff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

/* user pill */

.top-user {
  background: #ffffff;
  border-radius: 999px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
}

.top-user-org {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

.top-user-name-btn {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  color: var(--blue-main);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* RTL: mirror layout (user pill goes to the right) */
[dir="rtl"] .top-bar {
  flex-direction: row-reverse;
}

[dir="rtl"] .top-icons {
  flex-direction: row-reverse;
}


/* --------------------------------------------------
   6. CASE DETAIL (EN + AR)
-------------------------------------------------- */

.collector-case-detail {
  background: var(--bg);
}

.case-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 16px;
  padding-top: calc(env(safe-area-inset-top) + 12px);
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  align-items: center;
}

.back {
  color: #1e3a8a;
  text-decoration: none;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.header-title {
  font-weight: 700;
}

.case-header .status {
  margin-left: auto;
  font-size: 12px;
  color: #64748b;
  text-align: right;
}

/* main layout */
.case-main {
  padding: 16px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .case-main {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.case-full-width {
  grid-column: 1 / -1;
}

/* CTA row (call/maps buttons) */
.cta {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* Visit type badges (Visit vs Call) */
.visit-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
}

.visit-type-visit {
  background: #dcfce7; /* light green */
  color: #166534;
}

.visit-type-call {
  background: #e0f2fe; /* light blue */
  color: #1d4ed8;
}

/* Filter tabs for visits/calls table */
.visit-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
}

.visit-filter-tab {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-light);
  background: #f8fafc;
  color: var(--sub);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.visit-filter-tab-active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

/* Visit thumbnails in visits table */
.visit-photo-strip {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

/* Fullscreen visit photo zoom overlay */
.visit-photo-zoom-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10000;
}

.visit-photo-zoom-inner {
  position: relative;
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.visit-photo-zoom-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.visit-photo-zoom-img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  border: 2px solid rgba(248, 250, 252, 0.9);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.visit-photo-zoom-caption {
  margin-top: 8px;
  color: #e5e7eb;
  font-size: 13px;
  text-align: center;
}

/* Sticky bottom CTA bar for main actions (visit / promise / payment) */
.case-cta-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px);
  background: linear-gradient(
    to top,
    rgba(248, 250, 252, 0.98),
    rgba(248, 250, 252, 0.92),
    transparent
  );
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  z-index: 11;
}

.case-cta-btn {
  flex: 1;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

.case-cta-btn.primary {
  background: #1e3a8a;
  color: #ffffff;
  border-color: transparent;
}

/* --------------------------------------------------
   7. RESPONSIVE TWEAKS
-------------------------------------------------- */

@media (max-width: 480px) {
  body {
    font-size: 15.5px;
  }

  .case-name {
    font-size: 17px;
  }

  .card {
    border-radius: 14px;
    padding: 14px;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }

  .kv .k {
    font-size: 13px;
  }

  .title {
    font-size: 17px;
  }

  .login-wrapper {
    padding: 0 4px;
  }

  .modal-card {
    padding: 16px;
  }


  .stackable tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 10px;
    background: #fff;
  }

  .stackable thead {
    display: none;
  }

  .stackable tbody td {
    display: flex;
    justify-content: space-between;
    border-bottom: 0;
    padding: 10px 12px;
  }

  .stackable tbody td::before {
    content: attr(data-label);
    color: var(--sub);
    margin-right: 12px;
    min-width: 38%;
    text-align: left;
    font-weight: 500;
  }
}

/* --------------------------------------------------
   8. RTL OVERRIDES (Arabic pages)
-------------------------------------------------- */

[dir="rtl"] body {
  direction: rtl;
}

[dir="rtl"] .case-header .status {
  margin-left: 0;
  margin-right: auto;
  text-align: left;
}

[dir="rtl"] .pill {
  margin-right: 0;
  margin-left: 6px;
}

[dir="rtl"] .case-actions {
  justify-content: flex-start;
}

[dir="rtl"] .kv {
  grid-template-columns: 1fr 140px;
}

[dir="rtl"] .stackable tbody td::before {
  margin-right: 0;
  margin-left: 12px;
  text-align: right;
}

/* Dashboard footer */
[dir="rtl"] .dashboard-footer {
  direction: rtl;
}

/* RTL sticky CTA order */
[dir="rtl"] .case-cta-bar {
  flex-direction: row-reverse;
}

/* RTL: thumbnail remove button & zoom close button */
[dir="rtl"] .visit-photo-remove {
  right: auto;
  left: 2px;
}

[dir="rtl"] .visit-photo-zoom-close {
  right: auto;
  left: 8px;
}

/* Neutral outline button used for "Log Call" / "تسجيل مكالمة" */
.btn-call {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--teal);                   /* use teal to differentiate */
}

.btn-call:hover {
  border-color: var(--teal);
  background: rgba(22, 181, 127, 0.06);
}
/* -------------------------------------------
   Dashboard task filters (Cases card)
------------------------------------------- */
.task-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  align-items: center;
  font-size: 13px;
  color: var(--sub);
}

.task-filter-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.task-filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
}

.task-filter-select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  padding: 6px 10px;
  font-size: 13px;
  background: #ffffff;              /* white dropdown background */
  color: var(--ink);
  outline: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.task-filter-select:focus {
  border-color: var(--blue-main);
  box-shadow: 0 0 0 1px rgba(42, 112, 225, 0.16);
}

/* Next task row under each case */

/* Top-right due date badge on each case card */
.case-row {
  position: relative; /* needed so the badge can be positioned */
}

.case-task-due-badge {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
}

/* Colors based on status */
.task-due-overdue {
  color: #b91c1c;              /* red */
  background-color: #fee2e2;
}

.task-due-today {
  color: var(--blue-main);     /* blue */
  background-color: #dbeafe;
}

.task-due-completed {
  color: #16b57f;              /* green / teal */
  background-color: #dcfce7;
}

.case-next-task {
  margin-top: 4px;
  font-size: 12px;
  color: var(--sub);
}

.case-next-task-title {
  font-weight: 600;
}

.case-next-task-date {
  opacity: 0.9;
}

.case-next-task-overdue {
  color: #b91c1c;
}

[dir="rtl"] .task-filters {
  justify-content: flex-start;
}

.cases-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-inline-start: 0.5rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e5e7eb;
  color: #111827;
  vertical-align: middle;
}

.case-actions .btn,
.case-actions .btn.dark,
.case-actions .btn-secondary,
.case-actions .btn-call {
  padding: 6px 10px;
  min-height: 32px;
  font-size: 13px;
  border-radius: 999px;

  background: #ffffff;                  /* white background */
  border: 1px solid var(--border-light);
  color: var(--blue-main);              /* brand blue text */
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04);
}

.case-actions .btn:hover,
.case-actions .btn.dark:hover,
.case-actions .btn-secondary:hover,
.case-actions .btn-call:hover {
  border-color: var(--blue-main);
  box-shadow: 0 4px 8px rgba(42, 112, 225, 0.18);
}

.case-actions .btn:active,
.case-actions .btn.dark:active,
.case-actions .btn-secondary:active,
.case-actions .btn-call:active {
  background: rgba(42, 112, 225, 0.06);
  box-shadow: none;
}

.metric-row {
  font-size: 16px;
}

.metric-row span {
  font-size: 18px;
}

.case-task-due-badge {
  position: absolute;
  top: 8px;
  right: 12px;    /* default LTR */
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Arabic RTL: shift badge to left side */
/* Move due-date badge to top-left on RTL pages */
[dir="rtl"] .case-task-due-badge {
  right: auto;
  left: 12px;
}

/* Leave a bit of space so the badge does NOT overlap the name on mobile */
.case-left {
  padding-top: 1.3rem;
}