/* =========================================================
   نظام استقطاع الأراضي — شركة نفط الوسط
   Corporate oil identity: deep navy + muted gold
   ========================================================= */

:root {
  --navy-950: #061426;
  --navy-900: #0b1f3a;
  --navy-800: #123156;
  --navy-700: #1a4470;
  --navy-600: #24598f;
  --gold-500: #b8956c;
  --gold-400: #c9a87e;
  --gold-300: #dcc09a;
  --gold-100: #f3eadc;
  --ink: #152238;
  --muted: #5c6b7e;
  --line: rgba(18, 49, 86, 0.12);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --danger: #b42318;
  --success: #0f7a4c;
  --warning: #b54708;
  --info: #175cd3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(6, 20, 38, 0.08);
  --shadow-lg: 0 22px 50px rgba(6, 20, 38, 0.16);
  --font: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --fs-base: 13.5px; /* حجم خط النظام (كان ~16px) */
  --transition: 220ms ease;
  --sidebar-width: 280px;
  --topbar-height: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: var(--fs-base);
}

body.app-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(184, 149, 108, 0.18), transparent 55%),
    radial-gradient(900px 420px at -10% 0%, rgba(26, 68, 112, 0.14), transparent 50%),
    linear-gradient(180deg, #eef3f8 0%, #e6edf5 45%, #f7f9fc 100%);
  background-attachment: fixed;
}

a {
  text-decoration: none;
}

/* ---------- App shell: sidebar layout ---------- */
body.has-sidebar {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-width);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(184, 149, 108, 0.22), transparent 60%),
    linear-gradient(180deg, #07182d 0%, #0b1f3a 45%, #123156 100%);
  color: #fff;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 8px 0 28px rgba(6, 20, 38, 0.18);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.15rem 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.35;
}

.sidebar-brand small {
  display: block;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
  margin-top: 0.1rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(145deg, var(--gold-300), var(--gold-500));
  color: var(--navy-950);
  box-shadow: 0 8px 18px rgba(184, 149, 108, 0.35);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0.9rem 0.35rem;
  padding: 0.85rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(184, 149, 108, 0.22);
  color: var(--gold-300);
}

.sidebar-user-meta strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
}

.sidebar-user-meta span {
  display: block;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem 0.75rem 1rem;
}

.sidebar-section {
  margin: 1rem 0.55rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.72rem 0.9rem;
  margin-bottom: 0.28rem;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 700;
  font-size: 0.94rem;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.sidebar-link i {
  width: 1.25rem;
  text-align: center;
  opacity: 0.9;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(-2px);
}

.sidebar-link.active {
  background: linear-gradient(120deg, rgba(184, 149, 108, 0.28), rgba(184, 149, 108, 0.12));
  color: var(--gold-300);
  box-shadow: inset 3px 0 0 var(--gold-500);
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-link.logout {
  color: #ffb4a9;
  background: rgba(180, 35, 24, 0.12);
}

.sidebar-link.logout:hover {
  background: rgba(180, 35, 24, 0.22);
  color: #fff;
}

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

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0 1.1rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(6, 20, 38, 0.05);
}

.sidebar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--navy-800);
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: var(--gold-100);
}

.topbar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-title strong {
  color: var(--navy-900);
  font-size: 1rem;
}

.topbar-title small {
  color: var(--muted);
  font-size: 0.78rem;
}

.topbar-meta {
  margin-inline-start: auto;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--navy-800);
  background: var(--gold-100);
  border: 1px solid rgba(184, 149, 108, 0.35);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
}

.app-main {
  padding: 1.35rem 1.25rem 2rem;
  flex: 1;
  min-height: calc(100vh - var(--topbar-height) - 90px);
}

.app-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: auto;
}

.sidebar-overlay {
  display: none;
}

/* ---------- Typography helpers ---------- */
.page-title {
  font-weight: 800;
  color: var(--navy-900);
  letter-spacing: 0.01em;
  margin-bottom: 0.25rem;
  font-size: 1.35rem;
}

.page-subtitle {
  color: var(--muted);
  margin-bottom: 0;
  font-size: 0.9rem;
}

.section-title {
  font-weight: 800;
  color: var(--navy-800);
  font-size: 0.98rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--gold-100);
}

/* ---------- Surfaces ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel-body {
  padding: 1.25rem 1.35rem;
}

.stat-tile {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.25rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-tile::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--gold-400), var(--navy-700));
}

.stat-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-tile .stat-label {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.stat-tile .stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--navy-900);
  line-height: 1.2;
}

.stat-tile .stat-icon {
  position: absolute;
  inset-inline-end: 1rem;
  top: 1rem;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--gold-100);
  color: var(--navy-800);
}

.stat-tile.tone-primary .stat-value { color: var(--navy-700); }
.stat-tile.tone-success .stat-value { color: var(--success); }
.stat-tile.tone-warning .stat-value { color: var(--warning); }
.stat-tile.tone-danger .stat-value { color: var(--danger); }
.stat-tile.tone-danger .stat-icon { background: rgba(180, 35, 24, 0.12); color: var(--danger); }
.stat-tile.tone-success .stat-icon { background: rgba(15, 122, 76, 0.12); color: var(--success); }
.stat-tile.tone-warning .stat-icon { background: rgba(181, 71, 8, 0.12); color: var(--warning); }

a.stat-tile {
  color: inherit;
}

/* ---------- Forms ---------- */
.form-label {
  font-weight: 700;
  color: var(--navy-800);
  font-size: 0.85rem;
}

.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border-color: rgba(18, 49, 86, 0.18);
  padding: 0.5rem 0.7rem;
  background: #fff;
  font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 0.2rem rgba(184, 149, 108, 0.22);
}

.filter-bar {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 992px) {
  .filter-bar.cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .filter-bar.cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .filter-bar.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: 999px;
  font-weight: 700;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  --bs-btn-bg: var(--navy-800);
  --bs-btn-border-color: var(--navy-800);
  --bs-btn-hover-bg: var(--navy-950);
  --bs-btn-hover-border-color: var(--navy-950);
  --bs-btn-active-bg: var(--navy-950);
  --bs-btn-active-border-color: var(--navy-950);
  box-shadow: 0 8px 18px rgba(11, 31, 58, 0.22);
}

.btn-accent {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  border: none;
  color: var(--navy-950);
  box-shadow: 0 8px 18px rgba(184, 149, 108, 0.28);
}

.btn-accent:hover {
  background: linear-gradient(135deg, var(--gold-300), var(--gold-400));
  color: var(--navy-950);
}

.btn-outline-primary {
  --bs-btn-color: var(--navy-800);
  --bs-btn-border-color: var(--navy-700);
  --bs-btn-hover-bg: var(--navy-800);
  --bs-btn-hover-border-color: var(--navy-800);
  --bs-btn-hover-color: #fff;
}

.btn-outline-success {
  --bs-btn-color: var(--success);
  --bs-btn-border-color: var(--success);
  --bs-btn-hover-bg: var(--success);
  --bs-btn-hover-border-color: var(--success);
}

.btn-outline-dark {
  --bs-btn-color: var(--navy-900);
  --bs-btn-border-color: var(--navy-700);
  --bs-btn-hover-bg: var(--navy-900);
  --bs-btn-hover-border-color: var(--navy-900);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.btn-group-actions .btn {
  margin-inline: 0.15rem;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-solid);
}

.table-app {
  margin-bottom: 0;
  vertical-align: middle;
  font-size: 0.88rem;
}

.table-app thead th {
  background: linear-gradient(180deg, #123156, #0f2b4c);
  color: #fff;
  font-weight: 700;
  border: none;
  white-space: nowrap;
  padding: 0.7rem 0.7rem;
  font-size: 0.82rem;
}

.table-app tbody td {
  padding: 0.6rem 0.7rem;
  border-color: rgba(18, 49, 86, 0.08);
}

.table-app.table-hover tbody tr:hover {
  background: rgba(184, 149, 108, 0.08);
}

.badge-soft {
  display: inline-block;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--gold-100);
  color: var(--navy-800);
}

.badge-success-soft {
  background: rgba(15, 122, 76, 0.12);
  color: var(--success);
}

.badge-danger-soft {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.badge-info-soft {
  background: rgba(23, 92, 211, 0.12);
  color: var(--info);
}

/* ---------- Alerts ---------- */
.alert {
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
}

.alert-danger {
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.alert-success {
  background: rgba(15, 122, 76, 0.1);
  color: var(--success);
}

.alert-warning {
  background: rgba(181, 71, 8, 0.1);
  color: var(--warning);
}

/* ---------- Page toolbar ---------- */
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.55;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(135deg, rgba(6, 20, 38, 0.82), rgba(18, 49, 86, 0.72)),
    radial-gradient(900px 500px at 15% 20%, rgba(184, 149, 108, 0.35), transparent 55%),
    linear-gradient(160deg, #0b1f3a, #1a4470 50%, #0b1f3a);
  background-size: cover;
}

.login-shell {
  width: min(100%, 460px);
  animation: riseIn 480ms ease both;
}

.login-panel {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 22px;
  padding: 2.2rem 2rem 1.6rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.4);
  position: relative;
  overflow: hidden;
}

.login-panel::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300), var(--gold-500));
}

.login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-brand .mark {
  width: 68px;
  height: 68px;
  margin: 0 auto 0.85rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  color: var(--navy-950);
  background: linear-gradient(145deg, var(--gold-300), var(--gold-500));
  box-shadow: 0 12px 24px rgba(184, 149, 108, 0.35);
}

.login-brand h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--navy-900);
}

.login-brand p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- Misc ---------- */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

.pagination .page-link {
  border-radius: 999px !important;
  margin: 0 0.15rem;
  border: 1px solid var(--line);
  color: var(--navy-800);
  font-weight: 700;
}

.pagination .page-item.active .page-link {
  background: var(--navy-800);
  border-color: var(--navy-800);
}

.mode-tabs .nav-link {
  border-radius: 999px;
  font-weight: 700;
  color: var(--navy-800);
}

.mode-tabs .nav-link.active {
  background: var(--navy-800);
  color: #fff;
}

.detail-grid {
  display: grid;
  gap: 0.75rem 1rem;
}

@media (min-width: 768px) {
  .detail-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.detail-item strong {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.15rem;
}

.detail-item span {
  color: var(--ink);
  font-weight: 700;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   Responsive system — phones, tablets, desktops
   ========================================================= */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.app-body,
.login-body {
  overflow-x: hidden;
}

img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

.table-wrap {
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.table-app {
  min-width: 640px;
}

.btn-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.btn-group-actions .btn {
  margin-inline: 0;
}

.form-actions,
.form-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Large tablets / small desktops */
@media (max-width: 1199.98px) {
  .page-title {
    font-size: 1.45rem;
  }
  .stat-tile .stat-value {
    font-size: 1.65rem;
  }
}

/* Tablets and below: off-canvas sidebar */
@media (max-width: 991.98px) {
  .app-content {
    margin-inline-start: 0;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .app-sidebar {
    transform: translateX(110%);
    transition: transform 260ms ease;
    box-shadow: none;
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(6, 20, 38, 0.35);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(6, 20, 38, 0.45);
    z-index: 1035;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .app-main {
    padding: 1.1rem 0.95rem 1.5rem;
  }

  .panel-body {
    padding: 1rem;
  }

  .page-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions .btn {
    flex: 1 1 calc(50% - 0.35rem);
    text-align: center;
  }

  .stat-tile {
    padding: 1.1rem 1rem;
  }

  .stat-tile .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
}

/* Phones */
@media (max-width: 767.98px) {
  body.app-body {
    background-attachment: scroll;
  }

  .app-main.container,
  .container.app-main {
    padding-inline: 0.85rem;
  }

  .page-title {
    font-size: 1.25rem;
    line-height: 1.4;
  }

  .page-subtitle {
    font-size: 0.88rem;
  }

  .section-title {
    font-size: 0.98rem;
  }

  .stat-tile .stat-value {
    font-size: 1.35rem;
  }

  .stat-tile .stat-value small {
    font-size: 0.75rem;
  }

  .toolbar-actions .btn {
    flex: 1 1 100%;
  }

  .btn {
    padding: 0.6rem 1rem;
  }

  .btn-sm {
    padding: 0.42rem 0.7rem;
    font-size: 0.8rem;
  }

  .btn-group-actions {
    width: 100%;
  }

  .btn-group-actions .btn {
    flex: 1 1 calc(50% - 0.25rem);
    text-align: center;
  }

  .panel {
    border-radius: 12px;
  }

  .panel-body {
    padding: 0.9rem;
  }

  .table-app {
    min-width: 560px;
    font-size: 0.86rem;
  }

  .table-app thead th,
  .table-app tbody td {
    padding: 0.65rem 0.55rem;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center !important;
  }

  .pagination .page-link {
    min-width: 2.2rem;
    text-align: center;
    padding: 0.4rem 0.55rem;
    font-size: 0.85rem;
  }

  .login-body {
    padding: 1rem;
    align-items: flex-start;
    padding-top: 2rem;
  }

  .login-panel {
    padding: 1.5rem 1.15rem 1.25rem;
    border-radius: 16px;
  }

  .login-brand .mark {
    width: 56px;
    height: 56px;
    font-size: 1.35rem;
    border-radius: 14px;
  }

  .login-brand h1 {
    font-size: 1.4rem;
  }

  .detail-grid {
    grid-template-columns: 1fr !important;
  }

  .form-control,
  .form-select {
    font-size: 16px; /* يمنع تكبير iOS التلقائي */
  }

  /* صفوف النماذج تتكيف على الموبايل */
  .row.g-2 > [class*="col-md-1"],
  .row.g-2 > [class*="col-md-2"],
  .row.g-3 > [class*="col-md-1"],
  .row.g-3 > [class*="col-md-2"],
  .row.g-2 > [class*="col-md-3"],
  .row.g-2 > [class*="col-md-4"],
  .row.g-3 > [class*="col-md-3"],
  .row.g-3 > [class*="col-md-4"] {
    flex: 0 0 auto !important;
    width: 50% !important;
  }

  .row.g-2 > [class*="col-md-6"],
  .row.g-2 > [class*="col-md-8"],
  .row.g-2 > [class*="col-md-12"],
  .row.g-3 > [class*="col-md-6"],
  .row.g-3 > [class*="col-md-8"],
  .row.g-3 > [class*="col-md-12"],
  .row.g-2 > .col-12,
  .row.g-3 > .col-12 {
    flex: 0 0 auto !important;
    width: 100% !important;
  }

  .d-flex.gap-2,
  .d-flex.flex-wrap.gap-2,
  .d-flex.flex-wrap.gap-3 {
    width: 100%;
  }

  .select2-container {
    width: 100% !important;
  }
}

/* Very small phones */
@media (max-width: 575.98px) {
  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 0.85rem;
  }

  .topbar-title strong {
    font-size: 0.9rem;
  }

  .app-main {
    padding-inline: 0.7rem;
  }

  .row.g-2 > [class*="col-"],
  .row.g-3 > [class*="col-"] {
    flex: 0 0 auto !important;
    width: 100% !important;
  }

  .btn-group-actions .btn {
    flex: 1 1 100%;
  }

  .stat-tile .stat-icon {
    display: none;
  }

  .login-brand h1 {
    font-size: 1.25rem;
  }

  .table-app {
    min-width: 520px;
    font-size: 0.8rem;
  }
}

/* Print stays clean */
@media print {
  .app-sidebar,
  .app-topbar,
  .sidebar-overlay,
  .app-footer,
  .toolbar-actions,
  .page-toolbar .btn,
  .btn-group-actions {
    display: none !important;
  }
  .app-content {
    margin: 0 !important;
  }
  body.app-body {
    background: #fff;
  }
  .panel {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ---------- Welcome / login splash (5s) ---------- */
.welcome-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 0.95rem;
  color: #fff;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 85% 15%, rgba(184, 149, 108, 0.28), transparent 55%),
    radial-gradient(700px 420px at 10% 80%, rgba(36, 89, 143, 0.35), transparent 50%),
    linear-gradient(145deg, #061426 0%, #0b1f3a 45%, #123156 100%);
}

.welcome-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  position: relative;
}

.welcome-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  animation: welcomeFloat 5s ease-in-out infinite;
}

.welcome-orb-a {
  width: 220px;
  height: 220px;
  background: rgba(184, 149, 108, 0.22);
  inset-inline-start: 8%;
  top: 18%;
}

.welcome-orb-b {
  width: 160px;
  height: 160px;
  background: rgba(36, 89, 143, 0.35);
  inset-inline-end: 10%;
  bottom: 16%;
  animation-delay: 1.2s;
}

.welcome-card {
  position: relative;
  z-index: 2;
  width: min(100%, 440px);
  text-align: center;
  padding: 2.4rem 1.8rem 1.8rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  animation: welcomeRise 700ms ease both;
}

.welcome-mark {
  width: 74px;
  height: 74px;
  margin: 0 auto 1rem;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  color: var(--navy-950);
  background: linear-gradient(145deg, var(--gold-300), var(--gold-500));
  box-shadow: 0 14px 28px rgba(184, 149, 108, 0.35);
  animation: welcomePulse 1.8s ease-in-out infinite;
}

.welcome-ring {
  width: 86px;
  height: 86px;
  margin: -4.85rem auto 1.35rem;
  border-radius: 50%;
  position: relative;
}

.welcome-ring span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--gold-400);
  border-inline-end-color: rgba(184, 149, 108, 0.25);
  animation: welcomeSpin 1.1s linear infinite;
}

.welcome-card h1 {
  margin: 0.85rem 0 0.35rem;
  font-size: 1.55rem;
  font-weight: 800;
}

.welcome-role {
  display: inline-block;
  margin: 0 0 0.85rem;
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  background: rgba(184, 149, 108, 0.18);
  color: var(--gold-300);
  font-size: 0.82rem;
  font-weight: 700;
}

.welcome-text {
  margin: 0 0 1.35rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
}

.welcome-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.welcome-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300), var(--gold-500));
  background-size: 200% 100%;
  animation: welcomeShine 1.4s linear infinite;
  transition: width 80ms linear;
}

.welcome-timer {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}

.welcome-timer span {
  color: var(--gold-300);
  font-size: 1.05rem;
}

.welcome-exit .welcome-card {
  animation: welcomeFadeOut 360ms ease forwards;
}

@keyframes welcomeRise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes welcomeFadeOut {
  to { opacity: 0; transform: translateY(-10px) scale(0.98); }
}

@keyframes welcomeSpin {
  to { transform: rotate(360deg); }
}

@keyframes welcomePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes welcomeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

@keyframes welcomeShine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@media (max-width: 575.98px) {
  .welcome-card {
    padding: 2rem 1.2rem 1.4rem;
    border-radius: 18px;
  }
  .welcome-card h1 {
    font-size: 1.3rem;
  }
  .welcome-orb-a,
  .welcome-orb-b {
    opacity: 0.35;
  }
}

/* ---------- Employee cards grid ---------- */
.emp-cards-grid {
  align-items: stretch;
}

.emp-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}

.emp-card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--navy-700), var(--gold-400));
}

.emp-card.is-paid::before {
  background: linear-gradient(90deg, var(--success), #34a06d);
}

.emp-card.is-unpaid::before {
  background: linear-gradient(90deg, var(--danger), #e06a5c);
}

.emp-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.emp-card-top {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 0.9rem 0.75rem;
  background: linear-gradient(180deg, rgba(18, 49, 86, 0.05), transparent 85%);
}

.emp-card-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--gold-100);
}

.emp-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.emp-card-avatar-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--navy-800);
  font-size: 1.1rem;
}

.emp-card-head {
  min-width: 0;
  flex: 1;
}

.emp-card-name {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: #9a6b2f;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emp-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.emp-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.emp-card-badges .badge-soft,
.emp-card-badges .badge-info-soft,
.emp-card-badges .badge-success-soft,
.emp-card-badges .badge-danger-soft {
  font-size: 0.68rem;
  padding: 0.18rem 0.45rem;
}

.emp-card-body {
  padding: 0.35rem 0.9rem 0.75rem;
  flex: 1;
}

.emp-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.28rem 0;
  border-bottom: 1px dashed rgba(18, 49, 86, 0.08);
  font-size: 0.78rem;
}

.emp-card-row span {
  color: var(--muted);
  flex: 0 0 auto;
}

.emp-card-row strong {
  color: var(--ink);
  font-weight: 700;
  text-align: end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 62%;
}

.emp-card-row.muted {
  border-bottom: none;
  opacity: 0.92;
}

.emp-card-finance {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin: 0.65rem 0 0.4rem;
  padding: 0.55rem 0.4rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #f5f8fc, #eef3f8);
  border: 1px solid rgba(18, 49, 86, 0.08);
  text-align: center;
}

.emp-card-finance small {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.emp-card-finance strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--navy-900);
  line-height: 1.25;
}

.emp-card-progress {
  height: 5px;
  border-radius: 999px;
  background: rgba(18, 49, 86, 0.08);
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.emp-card-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--navy-700), var(--gold-400));
}

.emp-card.is-paid .emp-card-progress span {
  background: linear-gradient(90deg, var(--success), #5fc08f);
}

.emp-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem 0.8rem;
  border-top: 1px solid var(--line);
  background: rgba(247, 249, 252, 0.85);
}

.emp-card-actions .btn {
  flex: 1 1 auto;
  min-width: 2.2rem;
  padding: 0.35rem 0.45rem;
  border-radius: 10px;
  font-size: 0.78rem;
}

@media (max-width: 1399.98px) and (min-width: 1200px) {
  .emp-card-name { font-size: 0.9rem; }
  .emp-card-finance strong { font-size: 0.72rem; }
}

@media (max-width: 575.98px) {
  .emp-card-top {
    padding: 0.9rem 0.85rem 0.65rem;
  }
  .emp-card-actions .btn {
    flex: 1 1 calc(33.33% - 0.35rem);
  }
}

/* ---------- Edit employee form ---------- */
.edit-emp-form .req {
  color: var(--danger);
}

.form-section {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
}

.form-section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, rgba(18, 49, 86, 0.05), transparent);
  border-bottom: 1px solid var(--line);
}

.form-section-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy-900);
}

.form-section-head p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.form-section-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(26, 68, 112, 0.1);
  color: var(--navy-800);
  flex: 0 0 42px;
}

.form-section-icon.tone-gold {
  background: var(--gold-100);
  color: #8a6a3d;
}

.form-section-icon.tone-navy {
  background: rgba(18, 49, 86, 0.12);
  color: var(--navy-700);
}

.form-section-body {
  padding: 1rem 1.1rem 1.15rem;
}

.field-hint {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.input-with-suffix {
  display: flex;
  align-items: stretch;
}

.input-with-suffix .form-control {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.input-with-suffix span {
  display: grid;
  place-items: center;
  min-width: 3rem;
  padding: 0 0.65rem;
  background: #eef3f8;
  border: 1px solid rgba(18, 49, 86, 0.18);
  border-inline-start: 0;
  border-start-end-radius: var(--radius-sm);
  border-end-end-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.form-save-bar {
  position: sticky;
  bottom: 0.75rem;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  margin-bottom: 0.5rem;
}

.edit-side-card {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.15rem;
}

.sticky-side {
  position: sticky;
  top: calc(var(--topbar-height) + 0.85rem);
}

.edit-side-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 220px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(160deg, #eef3f8, var(--gold-100));
  border: 1px solid var(--line);
  margin-bottom: 0;
  position: relative;
  display: block;
  padding: 0;
  cursor: pointer;
}

.edit-side-photo-wrap {
  margin-bottom: 0.9rem;
}

.edit-photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.edit-side-photo-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: rgba(6, 20, 38, 0.55);
  color: #fff;
  opacity: 0;
  transition: opacity var(--transition);
  font-style: normal;
}

.edit-side-photo-overlay i {
  font-size: 1.35rem;
}

.edit-side-photo-overlay em {
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 700;
}

.edit-side-photo:hover .edit-side-photo-overlay,
.edit-side-photo:focus .edit-side-photo-overlay {
  opacity: 1;
}

.edit-side-photo-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.55rem;
}

.edit-side-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.edit-side-photo-empty {
  width: 100%;
  height: 100%;
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.4rem;
  color: var(--muted);
}

.edit-side-photo-empty i {
  font-size: 2rem;
  color: var(--navy-700);
}

.edit-side-name {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-900);
  line-height: 1.4;
}

.edit-side-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.edit-side-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.edit-side-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed rgba(18, 49, 86, 0.1);
  font-size: 0.82rem;
}

.edit-side-list span {
  color: var(--muted);
}

.edit-side-list strong {
  color: var(--ink);
  text-align: end;
  font-weight: 700;
}

.edit-side-hint {
  margin: 0.85rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.current-attach {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

@media (max-width: 991.98px) {
  .sticky-side {
    position: static;
  }
  .form-save-bar {
    position: sticky;
    bottom: 0.5rem;
    flex-direction: column;
    align-items: stretch;
  }
  .form-save-bar .d-flex {
    width: 100%;
  }
  .form-save-bar .btn {
    flex: 1;
  }
}

/* ---------- Deductions report ---------- */
.deduc-filters .deduc-filter-group {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px dashed rgba(18, 49, 86, 0.12);
}

.deduc-filters .deduc-filter-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.deduc-filters h3 {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--navy-800);
}

.deduc-table-panel {
  overflow: hidden;
}

.deduc-emp-name {
  color: #9a6b2f;
  font-weight: 800;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.deduc-emp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.deduc-amount {
  color: var(--success);
  font-weight: 800;
  white-space: nowrap;
}

.deduc-date {
  font-weight: 700;
  color: var(--navy-800);
}

.deduc-notes {
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.78rem;
  color: var(--muted);
}

.deduc-table tfoot td {
  background: #f5f8fc;
  border-top: 2px solid var(--line);
  padding: 0.85rem;
}

.deduc-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}

.deduc-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.7rem;
}

.deduc-card-amount {
  flex: 0 0 auto;
  font-weight: 800;
  color: var(--success);
  font-size: 0.95rem;
  background: rgba(15, 122, 76, 0.08);
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
}

.deduc-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.55rem;
}

.deduc-card-grid span {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 700;
}

.deduc-card-grid strong {
  font-size: 0.8rem;
  color: var(--ink);
  font-weight: 700;
}

.deduc-card-notes {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: #f7f9fc;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
}

.deduc-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border-top: 1px solid var(--line);
  padding-top: 0.65rem;
}

.deduc-cards-total {
  text-align: center;
  padding: 0.75rem;
  background: #f5f8fc;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ---------- Add payment page ---------- */
.file-drop {
  background: var(--gold-100);
  border: 1px dashed var(--gold-500);
  padding: 0.9rem;
  border-radius: 12px;
}

.pay-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.pay-mode-card {
  margin: 0;
  cursor: pointer;
}

.pay-mode-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pay-mode-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100%;
  padding: 0.85rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.pay-mode-body i {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(18, 49, 86, 0.08);
  color: var(--navy-800);
  margin-bottom: 0.25rem;
}

.pay-mode-body strong {
  font-size: 0.9rem;
  color: var(--navy-900);
}

.pay-mode-body small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.pay-mode-input:checked + .pay-mode-body {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(184, 149, 108, 0.22);
  background: linear-gradient(180deg, #fffaf2, #fff);
}

.pay-mode-card:hover .pay-mode-body {
  transform: translateY(-2px);
}

.pay-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.pay-type-card {
  margin: 0;
  cursor: pointer;
}

.pay-type-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pay-type-card span {
  display: block;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.pay-type-card strong {
  display: block;
  color: var(--navy-900);
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.pay-type-card small {
  color: var(--muted);
  font-size: 0.72rem;
}

.pay-type-card input:checked + span {
  border-color: var(--navy-700);
  box-shadow: 0 0 0 3px rgba(18, 49, 86, 0.12);
  background: #f4f8fc;
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  border: 1px solid rgba(18, 49, 86, 0.18) !important;
  min-height: 42px;
  border-radius: 10px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 40px !important;
  padding-inline: 0.75rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px !important;
}

@media (max-width: 575.98px) {
  .pay-mode-grid,
  .pay-type-grid {
    grid-template-columns: 1fr;
  }
}
