/* NexusCRM — app shell.
   Uses CSS logical properties (inline-start/end) so the layout mirrors automatically for RTL (Arabic). */

:root {
  --app-sidebar-width: 240px;
  --app-topbar-height: 56px;
  --app-sidebar-bg: #14213d;
  --app-sidebar-fg: rgba(255, 255, 255, .72);
  --app-sidebar-active: #fca311;
  --app-content-bg: #f5f6f8;
  --bs-primary: #1d4ed8;
  --bs-primary-rgb: 29, 78, 216;
  --bs-link-color: #1d4ed8;
  --bs-link-color-rgb: 29, 78, 216;
}

body.area-platform { --app-sidebar-bg: #2b2d42; }

html { font-size: 14px; }
@media (min-width: 1200px) { html { font-size: 15px; } }

body { background: var(--app-content-bg); }

.btn-primary { --bs-btn-bg: #1d4ed8; --bs-btn-border-color: #1d4ed8; --bs-btn-hover-bg: #1e40af; --bs-btn-hover-border-color: #1e40af; --bs-btn-active-bg: #1e3a8a; }

/* ---------- shell ---------- */
.app { min-height: 100vh; }

.app-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--app-sidebar-width);
  background: var(--app-sidebar-bg);
  color: var(--app-sidebar-fg);
  overflow-y: auto;
  z-index: 1040;
  transition: transform .2s ease;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  height: var(--app-topbar-height);
  padding-inline: 1.25rem;
  color: #fff;
  font-weight: 600;
  font-size: 1.15rem;
  text-decoration: none;
  border-block-end: 1px solid rgba(255, 255, 255, .08);
}
.app-brand .bi { color: var(--app-sidebar-active); }
.app-brand:hover { color: #fff; }

.app-nav { padding: .75rem .5rem; }
.app-nav-heading {
  padding: 1rem .75rem .35rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255, 255, 255, .45);
}
.app-nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .75rem;
  margin-block-end: 2px;
  border-radius: .375rem;
  color: var(--app-sidebar-fg);
  text-decoration: none;
}
.app-nav-link .bi { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.app-nav-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.app-nav-link.active { color: #fff; background: rgba(255, 255, 255, .1); box-shadow: inset 3px 0 0 var(--app-sidebar-active); }
[dir="rtl"] .app-nav-link.active { box-shadow: inset -3px 0 0 var(--app-sidebar-active); }

.app-main { margin-inline-start: var(--app-sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: .5rem;
  height: var(--app-topbar-height);
  padding-inline: 1rem;
  background: #fff;
  border-block-end: 1px solid #e5e7eb;
}
.app-context { font-weight: 500; color: #374151; }
.app-user { color: #374151; text-decoration: none; }
.app-user .bi { font-size: 1.25rem; vertical-align: middle; }
.app-sidebar-toggle { display: none; color: #374151; font-size: 1.5rem; padding: 0 .25rem; }

.app-content { padding: 1.5rem; flex: 1; }

.app-backdrop { display: none; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  [dir="rtl"] .app-sidebar { transform: translateX(100%); }
  .app.sidebar-open .app-sidebar { transform: none; }
  .app.sidebar-open .app-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 1030; }
  .app-main { margin-inline-start: 0; }
  .app-sidebar-toggle { display: inline-block; }
  .app-content { padding: 1rem; }
}

/* ---------- page parts ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-block-end: 1.25rem; }
.page-header h1 { font-size: 1.4rem; margin: 0; }
.page-header .breadcrumb { margin: 0 0 .25rem; font-size: .85rem; }

.card { border-color: #e5e7eb; }
.card-header { background: #fff; font-weight: 600; }

.stat-card .stat-value { font-size: 1.75rem; font-weight: 600; line-height: 1.2; }
.stat-card .stat-label { color: #6b7280; font-size: .85rem; }
.stat-card .stat-icon { font-size: 1.6rem; opacity: .35; }

.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; font-weight: 600; background: #f9fafb; }

.form-label { font-weight: 500; font-size: .9rem; }
.form-section-title { font-size: 1rem; font-weight: 600; margin-block: .5rem 1rem; padding-block-end: .5rem; border-block-end: 1px solid #e5e7eb; }
.field-validation-error, .validation-summary-errors { color: var(--bs-danger); font-size: .85rem; }
.validation-summary-errors ul { margin: 0; padding-inline-start: 1.1rem; }
.input-validation-error { border-color: var(--bs-danger); }

dl.details dt { color: #6b7280; font-weight: 500; font-size: .85rem; }
dl.details dd { margin-block-end: .9rem; }

/* Icons that point in a direction must mirror in RTL. */
[dir="rtl"] .flip-rtl { display: inline-block; transform: scaleX(-1); }

/* ---------- sign-in pages ---------- */
.auth-body { background: linear-gradient(160deg, #14213d 0%, #1d4ed8 100%); min-height: 100vh; }
.auth-wrap { max-width: 420px; margin-inline: auto; padding: 8vh 1rem 2rem; }
.auth-brand { color: #fff; text-align: center; font-size: 1.6rem; font-weight: 600; margin-block-end: 1.25rem; }
.auth-brand .bi { color: #fca311; }
.auth-card { border: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.auth-footer { color: rgba(255, 255, 255, .6); text-align: center; font-size: .8rem; margin-block-start: 1.25rem; }

/* ---------- opportunity stage path ---------- */
.stage-path { display: flex; flex-wrap: wrap; gap: 4px; }
.stage-step-form { display: contents; }
.stage-step {
  flex: 1 1 auto;
  min-width: 110px;
  padding: .45rem .75rem;
  border: 0;
  border-radius: .25rem;
  background: #eef0f3;
  color: #4b5563;
  font-size: .85rem;
  text-align: center;
  white-space: nowrap;
}
button.stage-step:hover { background: #dbe4ff; color: #1d4ed8; }
.stage-step.past { background: #c7d7fe; color: #1e3a8a; }
.stage-step.current { background: #1d4ed8; color: #fff; font-weight: 600; }
.stage-step.won { background: #15803d; color: #fff; font-weight: 600; }
.stage-step.lost { background: #6b7280; color: #fff; font-weight: 600; }

/* Tom Select inside small form controls */
.ts-wrapper.form-select-sm .ts-control { min-height: calc(1.5em + .5rem + 2px); padding: .2rem .5rem; font-size: .875rem; }

/* Report catalogue */
.report-card { transition: border-color .15s, box-shadow .15s; }
.report-card:hover { border-color: var(--bs-primary); box-shadow: 0 .25rem .75rem rgba(29, 78, 216, .08); }
