/* =========================================================
   ISMS Progress Report — Design Tokens (v2)
   پالت: Slate/Ink خنثی + Teal (اعتماد/امنیت) به‌عنوان رنگ اصلی
   تایپوگرافی: Vazirmatn برای همه‌جا (شامل اعداد فارسی با عرض یکنواخت)
   ========================================================= */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #16202b;
  --ink-muted: #5c6b7a;
  --ink-faint: #8c9aa8;
  --border: #e4e9ef;
  --border-strong: #cbd5e1;

  --accent: #0f766e;
  --accent-dark: #0b5a54;
  --accent-soft: #e3f5f3;
  --accent-ring: rgba(15, 118, 110, 0.18);

  --success: #17924f;
  --success-soft: #e3f7eb;
  --warning: #b5720a;
  --warning-soft: #fbf0da;
  --danger: #c0322a;
  --danger-soft: #fbe8e6;
  --neutral: #64748b;
  --neutral-soft: #eef1f5;
  --info: #275fcc;
  --info-soft: #e6edfc;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

  --font-body: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  --content-max: 100%;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-feature-settings:
    "tnum" 1,
    "ss01" 1;
  font-variant-numeric: tabular-nums;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}
p {
  margin: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
}
input,
select,
textarea {
  font-family: inherit;
}
::selection {
  background: var(--accent-ring);
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- Layout shells ---------- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ---------- Navbar بالایی (جایگزین سایدبار) ---------- */
.navbar {
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}
.navbar-inner {
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.navbar-brand .mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 15px;
  flex: none;
  overflow: hidden;
}
.navbar-brand .mark.has-logo {
  background: transparent;
  padding: 0;
}
.navbar-brand .mark.has-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.navbar-brand .name {
  font-weight: 700;
  font-size: 14px;
}
.navbar-brand .sub {
  font-size: 11px;
  color: #94a3b8;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.navbar-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  color: #c4cdd6;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.navbar-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.navbar-nav a.active {
  background: rgba(15, 118, 110, 0.35);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.4);
}
.navbar-nav .icon {
  font-size: 12px;
  opacity: 0.9;
}
.nav-badge {
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  line-height: 1.5;
}

.navbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  flex-wrap: nowrap;
}
.navbar-user {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s ease;
}
.navbar-user:hover {
  background: rgba(255, 255, 255, 0.16);
}
.navbar-user .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
}
.navbar-user .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.navbar-user .u-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.navbar .theme-toggle-btn {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: none;
}
.navbar .theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}
.navbar-logout {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 8px;
  background: rgba(192, 50, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffb4ad;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.navbar-logout:hover {
  background: rgba(192, 50, 42, 0.65);
  color: #fff;
}

/* عنوان صفحه زیر نوبار */
.nav-page-title {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
}
.nav-page-title h1 {
  font-size: 18px;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 15px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 {
  font-size: 18px;
}
.topbar .meta {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.topbar .who-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px 5px 6px;
  font-size: 12px;
}
.topbar .who-pill .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.content {
  padding: 22px 28px 60px;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* ---------- Sticky report bar (نوار ثابت نام پروژه هنگام اسکرول) ---------- */
.report-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 24px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.report-sticky-title {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.report-sticky-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #8fe3d6;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}
.report-sticky-back:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}
.report-sticky-logo {
  height: 24px;
  width: auto;
  max-width: 60px;
  object-fit: contain;
  border-radius: 5px;
}
.report-sticky-name {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.report-sticky-pct {
  margin-inline-start: auto;
  background: rgba(255, 255, 255, 0.14);
  color: #8fe3d6;
  font-weight: 800;
  font-size: 13px;
  border-radius: 999px;
  padding: 2px 12px;
}

/* ---------- نمودارهای داشبورد پروژه‌ها (select.php) ---------- */
.dash-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
  overflow-x: hidden;
  width: 100%;
}
@media (min-width: 1800px) {
  .dash-charts {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 900px) {
  .dash-charts {
    grid-template-columns: 1fr;
  }
}
.dash-chart-card .card-body {
  padding: 12px 10px;
}
.dash-charts .card-head h2 {
  font-size: 13.5px;
}

/* دونات وضعیت پروژه‌ها — وسط‌چین و فول‌کادر */
.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 10px !important;
}
.donut-box {
  position: relative;
  width: 160px;
  height: 160px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}
.donut-box svg {
  display: block;
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-legend {
  width: 100%;
}
.donut-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.donut-table th,
.donut-table td {
  text-align: center;
  padding: 4px 2px;
  font-size: 10.5px;
}
.donut-table th {
  color: var(--ink-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.donut-table th a,
.donut-table td a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.donut-table th a:hover,
.donut-table td a:hover {
  color: var(--accent-dark);
}
.donut-table td {
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
}
.donut-table td a {
  font-weight: 800;
  font-size: 13px;
}
.donut-table td:first-child,
.donut-table th:first-child {
  color: var(--ink-faint);
  font-weight: 600;
  font-size: 10px;
  white-space: nowrap;
  text-align: start;
  width: 72px;
}
.donut-table .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}

/* اسکرول رتبه‌بندی — حداکثر ۱۰ ردیف */
.rank-scroll {
  max-height: 340px;
  overflow-y: auto;
}
.rank-row {
  display: block;
  cursor: pointer;
  text-decoration: none;
  border-radius: 8px;
  padding: 2px;
  transition: background 0.15s ease;
}
.rank-row:hover {
  background: var(--surface-2);
}
.rank-scroll::-webkit-scrollbar {
  width: 6px;
}
.rank-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
}

/* تولتیپ نمودارها */
.chart-tooltip {
  position: fixed;
  z-index: 100000;
  background: #16202b;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  padding: 8px 13px;
  border-radius: 9px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
  max-width: 260px;
  white-space: normal;
}
.chart-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}
html.dark .chart-tooltip {
  background: #e7ecf1;
  color: #16202b;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}
.dash-chart-card svg [data-tip] {
  cursor: help;
}
.dash-chart-card .card-body {
  min-height: 0;
}

/* فیت کردن محتوای سه باکس نمودار به ارتفاع یکسان */
.dash-charts .dash-chart-card {
  display: flex;
  flex-direction: column;
}
.dash-charts .dash-chart-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.dash-charts .dash-chart-card .rank-scroll {
  flex: 1;
  max-height: 100%;
  overflow-y: auto;
}
.dash-charts .dash-chart-card .donut-wrap {
  flex: 1;
  justify-content: center;
}
.dash-charts .dash-chart-card .donut-box,
.dash-charts .dash-chart-card .donut-box svg {
  width: 150px;
  height: 150px;
}
.dash-charts .dash-chart-card svg[viewBox^="0 0 440"] {
  max-height: 200px;
}

/* کاهش ارتفاع کارت‌های نمودار */
.dash-charts .card .card-head {
  padding: 10px 18px;
}
.dash-charts .card .card-head h2 {
  font-size: 13px;
}
.dash-chart-card .card-body {
  padding: 12px 14px;
}
.dash-chart-card.dash-chart-card .card-body {
  padding: 12px 14px;
}

/* Public report shell */
.report-header {
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
  color: #fff;
  padding: 28px 28px 35px;
  text-align: center;
}
.report-header .inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.report-header .logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 14px;
}
.report-header .logos img {
  height: 52px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
  padding: 4px;
}
.report-header .eyebrow {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: #8fe3d6;
  font-weight: 700;
  text-transform: uppercase;
}
.report-header h1 {
  font-size: 26px;
  margin-top: 8px;
}
.report-header .org {
  color: #b9c6ce;
  font-size: 13px;
  margin-top: 6px;
}
.report-header .switch-link {
  margin-top: 14px;
  font-size: 12px;
  color: #9fe8df;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 999px;
}
.report-body {
  max-width: var(--content-max);
  margin: -26px auto 0;
  padding: 0 28px 60px;
  width: 100%;
}
.report-footer {
  text-align: center;
  padding: 18px 0 40px;
}
.report-footer a {
  font-size: 12px;
  color: var(--ink-faint);
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 2px;
}
.report-footer a:hover {
  color: var(--accent-dark);
  border-color: var(--accent);
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card .card-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card .card-head h2 {
  font-size: 15px;
}
.card .card-body {
  padding: 22px;
}
.card-2col {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1100px) {
  .card-2col {
    grid-template-columns: 1fr;
  }
}

/* ---------- Weight Ledger ---------- */
.ledger {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.ledger-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ledger-title {
  font-size: 12.5px;
  color: var(--ink-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.ledger-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
}
.ledger-value small {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
}
.ledger-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.ledger-stat {
  text-align: center;
}
.ledger-stat .n {
  font-size: 17px;
  font-weight: 700;
}
.ledger-stat .l {
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.ledger-track {
  position: relative;
  height: 22px;
  border-radius: 999px;
  background: var(--neutral-soft);
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border);
}
.ledger-seg {
  height: 100%;
  position: relative;
  transition: width 0.4s ease;
}
.ledger-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 11.5px;
  color: var(--ink-muted);
}
.ledger-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-inline-end: 5px;
}

/* ---------- KPI grid ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 1300px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 880px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 9px 14px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 86px;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}
.kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.kpi:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.kpi:hover::before {
  opacity: 1;
}
.kpi-ic {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  margin: 0 auto 4px;
  flex: none;
}
.kpi-anim {
  opacity: 0;
  animation: kpiIn 0.5s ease forwards;
}
@keyframes kpiIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.kpi .lbl {
  font-size: 10.5px;
  color: var(--ink-muted);
  font-weight: 600;
  line-height: 1.4;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.kpi .val {
  font-size: 17px;
  font-weight: 700;
  margin-top: 2px;
  line-height: 1.3;
}
.kpi .sub {
  font-size: 10px;
  color: var(--ink-faint);
  margin-top: 2px;
  line-height: 1.4;
}
.kpi.accent .val {
  color: var(--accent-dark);
}

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-not-started {
  background: var(--neutral-soft);
  color: var(--neutral);
}
.status-not-started .dot {
  background: var(--neutral);
}
.status-in-progress {
  background: var(--info-soft);
  color: var(--info);
}
.status-in-progress .dot {
  background: var(--info);
}
.status-at-risk {
  background: var(--warning-soft);
  color: var(--warning);
}
.status-at-risk .dot {
  background: var(--warning);
}
.status-delayed {
  background: var(--danger-soft);
  color: var(--danger);
}
.status-delayed .dot {
  background: var(--danger);
}
.status-completed {
  background: var(--success-soft);
  color: var(--success);
}
.status-completed .dot {
  background: var(--success);
}

/* ---------- Progress bars ---------- */
.pbar {
  height: 9px;
  border-radius: 999px;
  background: var(--neutral-soft);
  overflow: hidden;
  position: relative;
}
.pbar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.pbar.thick {
  height: 14px;
}
.pbar.st-not-started > span {
  background: var(--neutral);
}
.pbar.st-in-progress > span {
  background: var(--info);
}
.pbar.st-at-risk > span {
  background: var(--warning);
}
.pbar.st-delayed > span {
  background: var(--danger);
}
.pbar.st-completed > span {
  background: var(--success);
}

/* ---------- Gantt-like rows ---------- */
.gantt-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--surface);
}
.gantt-l1 {
  display: grid;
  grid-template-columns: 34px 1.7fr 84px 168px 1.1fr 128px 26px;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  background: var(--surface-2);
}
.gantt-l1:hover {
  background: #f0f3f6;
}
.gantt-l1 .num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}
.gantt-l1 .title {
  font-weight: 700;
  font-size: 14px;
}
.gantt-l1 .title .code {
  color: var(--ink-faint);
  font-size: 11.5px;
  margin-inline-end: 6px;
}
.gantt-l1 .sub {
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 3px;
  font-weight: 400;
}
.gantt-l1 .weight {
  font-size: 13px;
  text-align: center;
  color: var(--ink-muted);
}
.gantt-l1 .dates {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
}
.gantt-l1 .progress-col {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gantt-l1 .progress-col .pct {
  font-weight: 700;
  font-size: 12.5px;
  width: 40px;
}
.gantt-l1 .chev {
  transition: transform 0.2s ease;
  color: var(--ink-faint);
  text-align: center;
}
.gantt-row.open .chev {
  transform: rotate(90deg);
}

.gantt-children {
  display: none;
  padding: 4px 18px 14px;
  background: var(--surface);
}
.gantt-row.open .gantt-children {
  display: block;
}
.gantt-l2 {
  display: grid;
  grid-template-columns: 34px 1.7fr 84px 168px 1.1fr 128px 26px;
  gap: 14px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px dashed var(--border);
}
.gantt-l2:first-child {
  border-top: none;
}
.gantt-l2 .num {
  font-size: 11.5px;
  color: var(--ink-faint);
  text-align: center;
}
.gantt-l2 .title {
  font-size: 13px;
  font-weight: 600;
}
.gantt-l2 .title .code {
  color: var(--ink-faint);
  font-size: 11px;
  margin-inline-end: 6px;
}
.gantt-l2 .weight {
  font-size: 12.5px;
  text-align: center;
  color: var(--ink-muted);
}
.gantt-l2 .dates {
  font-size: 11.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}
.gantt-l2 .progress-col {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gantt-l2 .progress-col .pct {
  font-weight: 700;
  font-size: 12px;
  width: 40px;
}

.gantt-head-row {
  display: grid;
  grid-template-columns: 34px 1.7fr 84px 168px 1.1fr 128px 26px;
  gap: 14px;
  padding: 0 18px 8px;
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ---------- SVG progress gauge ---------- */
.gauge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.gauge svg {
  position: absolute;
  inset: 0;
}
.gauge-label {
  position: relative;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

/* ---------- Compare bars (cross-project comparison) ---------- */
.compare-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.compare-row:last-child {
  border-bottom: none;
}
.compare-row .name {
  flex: 0 0 180px;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compare-row .bar-wrap {
  flex: 1;
}
.compare-row .pct {
  flex: 0 0 46px;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
}
.struct-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 14px;
}
.struct-head h2 {
  font-size: 16px;
}
.struct-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
.struct-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  background: var(--surface-2);
  flex-wrap: wrap;
}
.struct-card-head:hover {
  background: #f0f3f6;
}
.struct-num {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  flex: none;
}
.struct-title {
  font-weight: 700;
  font-size: 14.5px;
  flex: 1 1 220px;
  min-width: 180px;
}
.struct-title .code {
  color: var(--ink-faint);
  font-size: 11.5px;
  margin-inline-end: 6px;
  font-weight: 600;
}
.struct-title .sub {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 400;
  margin-top: 3px;
}
.struct-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.struct-actions {
  display: flex;
  gap: 6px;
}
.struct-chev {
  color: var(--ink-faint);
  transition: transform 0.2s ease;
}

/* درختواره ساختار شکست سطح دو */
.tree-root {
  padding: 14px 18px 4px;
}
.tree-parent {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: 4px;
}
.tree-node-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.tree-children {
  position: relative;
  padding-inline-start: 24px;
  display: flex;
  flex-direction: column;
}
.tree-head {
  display: grid;
  grid-template-columns: 2fr 1fr 1.6fr 1.3fr 130px;
  gap: 12px;
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--border);
  margin-inline-start: 42px;
}
.tree-child {
  position: relative;
  display: flex;
  margin-bottom: 8px;
}
.tree-child-line {
  position: relative;
  width: 18px;
  flex: none;
  margin-top: 18px;
}
.tree-child-line::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 9px;
  width: 2px;
  background: var(--border-strong);
}
.tree-child-line::after {
  content: "";
  position: absolute;
  top: 18px;
  inset-inline-start: 4px;
  width: 14px;
  height: 2px;
  background: var(--border-strong);
}
.tree-child-card {
  flex: 1;
  display: grid;
  grid-template-columns: 2fr 1fr 1.6fr 1.3fr 130px;
  gap: 12px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  min-width: 0;
}
.tree-child-card:hover {
  border-color: var(--accent);
}
.tree-child-title {
  grid-column: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 13px;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  line-height: 1.6;
}
.tree-child-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 10.5px;
  font-weight: 700;
  margin-inline-end: 6px;
  flex: none;
}
.tree-child-meta {
  display: contents;
}
.tree-cell {
  min-width: 0;
}
.tree-child-meta .weight-pill {
  grid-column: 2;
  justify-self: center;
}
.tree-child-meta .nowrap {
  grid-column: 3;
  white-space: normal;
  overflow-wrap: anywhere;
}
.tree-child-meta .badge {
  grid-column: 4;
  white-space: normal;
  text-align: center;
  justify-self: start;
}
.tree-child-actions {
  grid-column: 5;
  display: flex;
  gap: 6px;
  align-items: center;
  flex: none;
}
@media (max-width: 900px) {
  .tree-head {
    display: none;
  }
  .tree-child-card {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .tree-child-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .tree-child-actions {
    justify-content: flex-end;
  }
}
.struct-card.open .struct-chev {
  transform: rotate(90deg);
}
.struct-card-body {
  display: none;
  border-top: 1px solid var(--border);
}
.struct-card.open .struct-card-body {
  display: block;
}
.struct-context {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--accent-soft);
  font-size: 12.5px;
  color: var(--accent-dark);
  border-bottom: 1px solid var(--border);
}
.struct-context b {
  font-weight: 700;
}
table.dt {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.dt th {
  text-align: start;
  font-size: 11.5px;
  color: var(--ink-muted);
  font-weight: 700;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.dt td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.dt tr:last-child td {
  border-bottom: none;
}
table.dt tr:hover td {
  background: var(--surface-2);
}
table.dt .actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.nowrap {
  white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.4;
}
.btn:hover {
  border-color: var(--ink-faint);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}
.btn-danger {
  background: var(--danger-soft);
  border-color: var(--danger-soft);
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-success {
  background: var(--success-soft);
  border-color: var(--success-soft);
  color: var(--success);
}
.btn-success:hover {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--ink-muted);
}
.btn-ghost:hover {
  background: var(--border);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 7px;
}
.btn-lg {
  padding: 12px 22px;
  font-size: 14px;
  border-radius: 10px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Forms ---------- */
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.field .hint {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 4px;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field textarea,
.field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.field textarea {
  resize: vertical;
  min-height: 70px;
}
.field input[type="file"] {
  width: 100%;
  font-size: 12.5px;
}
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
@media (max-width: 720px) {
  .row-2,
  .row-3 {
    grid-template-columns: 1fr;
  }
}

/* تقویم شمسی جدید — گروه شامل input + فیلدهای مخفی + popup */
.jdate-group {
  position: relative;
}
.jdate-group select {
  width: 100%;
  padding: 9px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.logo-preview img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  padding: 4px;
}
.logo-preview .empty {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 11px;
}

/* ---------- Toast notifications (bottom-right, clear of sidebar; top on mobile) ---------- */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  max-width: 360px;
  animation:
    toastIn 0.3s ease,
    toastOut 0.3s ease 2.7s forwards;
}
@media (max-width: 980px) {
  .toast {
    top: 14px;
    bottom: auto;
    right: 14px;
    left: 14px;
    max-width: none;
  }
}
.toast-ic {
  font-size: 15px;
  flex: none;
}
.toast-success {
  background: #15321f;
}
.toast-success .toast-ic {
  color: var(--success);
}
.toast-error {
  background: #3a1a18;
}
.toast-error .toast-ic {
  color: #f87171;
}
.toast-warn {
  background: #3a2a0f;
}
.toast-warn .toast-ic {
  color: #fbbf24;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}
@media (max-width: 480px) {
  .toast {
    right: 14px;
    left: 14px;
    max-width: none;
  }
}
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success {
  background: var(--success-soft);
  color: var(--success);
}
.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
}
.alert-warn {
  background: var(--warning-soft);
  color: var(--warning);
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(1px);
}
.modal-backdrop.open {
  display: flex;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: auto;
}
.modal.wide {
  max-width: 760px;
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 {
  font-size: 15.5px;
}
.modal-body {
  padding: 20px 22px;
}
.modal-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Project cards (select screen / overview) ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (min-width: 2000px) {
  .project-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 800px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 500px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease;
}
.project-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.project-card .head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.project-card .logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px;
  flex: none;
}
.project-card .logo-fallback {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex: none;
}
.project-card h3 {
  font-size: 15px;
}
.project-card .org {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.project-card .stats {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* ---------- Misc ---------- */
.text-muted {
  color: var(--ink-muted);
}
.text-faint {
  color: var(--ink-faint);
}
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--ink-muted);
}
.empty-state .ic {
  font-size: 30px;
  margin-bottom: 10px;
}
.weight-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  white-space: nowrap;
}
.weight-pill.over {
  background: var(--danger-soft);
  color: var(--danger);
}
.role-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.role-pill.admin {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.role-pill.supervisor {
  background: var(--warning-soft);
  color: var(--warning);
}
.role-pill.viewer {
  background: var(--neutral-soft);
  color: var(--neutral);
}
.log-action {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  white-space: nowrap;
}
.filters-bar {
  display: flex;
  gap: 22px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters-bar .field {
  margin-bottom: 0;
  min-width: 150px;
  padding-inline-end: 22px;
  border-inline-end: 1px solid var(--border);
}
.filters-bar .field:last-of-type {
  border-inline-end: none;
  padding-inline-end: 0;
}

/* گرید ۴ کارت تمام‌عرض */
.kpi-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 1000px) {
  .kpi-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- کاربران (users.php) ---------- */
.users-search-bar {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 14px;
  align-items: end;
}
.users-search-bar .field {
  margin-bottom: 0;
}
@media (max-width: 700px) {
  .users-search-bar {
    grid-template-columns: 1fr;
  }
}

/* مودال مدرن کاربر */
.user-modal {
  max-width: 720px !important;
  max-height: calc(100vh - 20px) !important;
  overflow-y: hidden !important;
}
.user-modal-head {
  background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px !important;
}
.user-modal-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-modal-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex: none;
}
.user-modal-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 2px;
}
.user-modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 18px;
}
.user-modal-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 0;
  background: var(--surface-2);
}
.user-section-basic {
  grid-column: 1 / -1;
}
.user-section-security {
  grid-column: 1;
  grid-row: 2;
}
.user-section-avatar {
  grid-column: 2;
  grid-row: 2;
}
.user-modal-section#u_projects_wrap {
  grid-column: 1 / -1;
  grid-row: 3;
}
.user-modal-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.user-modal-section-title span {
  font-size: 13px;
}
.user-proj-count {
  margin-inline-start: auto;
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.role-desc {
  font-size: 10.5px;
  color: var(--ink-faint);
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--neutral-soft);
}
.user-modal-section .field {
  margin-bottom: 8px;
}
.user-modal-section .field:last-child {
  margin-bottom: 0;
}
.user-modal-section .row-2 {
  gap: 8px;
}
.user-modal-section input,
.user-modal-section select {
  padding: 7px 10px !important;
  font-size: 13px !important;
}
.user-modal-section label {
  font-size: 11.5px !important;
  margin-bottom: 4px !important;
}
.user-modal-section .user-avatar-upload {
  width: 56px;
  height: 56px;
  margin: 0 auto;
}
.user-modal-section .user-avatar-placeholder {
  font-size: 22px;
}
.user-modal-section .status-toggle {
  margin-top: 4px;
  gap: 10px;
  justify-content: center;
}
.user-modal-section .status-toggle-label {
  font-size: 11.5px;
}
.user-modal-foot {
  padding: 10px 18px !important;
}
.user-modal-foot-hint {
  font-size: 10.5px;
}
.user-projects-list {
  max-height: 180px;
}
.role-desc.role-admin {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.role-desc.role-supervisor {
  background: var(--warning-soft);
  color: var(--warning);
}
.role-desc.role-viewer {
  background: var(--info-soft);
  color: var(--info);
}

.user-avatar-upload {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px dashed var(--border-strong);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s;
  flex: none;
}
.user-avatar-upload:hover {
  border-color: var(--accent);
}
.user-avatar-placeholder {
  font-size: 20px;
  opacity: 0.5;
  pointer-events: none;
}
.user-avatar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar-hint {
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 500;
}
.user-avatar-status-row {
  align-items: end;
}
.user-avatar-status-row .field {
  margin-bottom: 0;
}
.user-avatar-spacer {
  margin-bottom: 22px;
}
.user-projects-field {
  margin-top: 4px;
}
@media (max-width: 720px) {
  .user-avatar-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
.user-avatar-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 0;
}
.user-avatar-upload img {
  position: relative;
  z-index: 1;
}
.user-avatar-placeholder {
  position: relative;
  z-index: 1;
}
.user-avatar-upload img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* تاگل وضعیت حساب */
.status-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
  margin-top: 6px;
  position: relative;
  z-index: 5;
}
/* سوییچ وضعیت حساب — چینش به سمت چپ (در RTL) */
.status-toggle-right {
  justify-content: flex-start;
  flex-direction: row;
  gap: 10px;
}
.status-toggle-right .status-toggle-track {
  order: 2;
}
.status-toggle-right .status-toggle-label {
  order: 1;
}
.status-toggle input {
  display: none;
}
.status-toggle-track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--neutral-soft);
  border: 1px solid var(--border-strong);
  position: relative;
  transition:
    background 0.3s,
    border-color 0.3s;
  flex: none;
}
.status-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: right 0.3s;
}
.status-toggle input:checked + .status-toggle-track {
  background: var(--success);
  border-color: var(--success);
}
.status-toggle input:checked + .status-toggle-track::after {
  right: calc(100% - 20px);
}
.status-toggle-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

/* چک‌باکس پروژه‌ها */
.user-projects-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
}

/* جدول فشرده انتخاب پروژه‌ها (شبیه اکسل) */
.user-projects-table-scroll {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.user-projects-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.user-projects-table th {
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-muted);
}
.user-projects-table td {
  padding: 5px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.user-projects-table tr:last-child td {
  border-bottom: none;
}
.user-projects-table tr:hover td {
  background: var(--surface-2);
}
.project-check-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: 22px;
  height: 22px;
}
.project-check-cell input {
  display: none;
}
.project-check-box-sm {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: transparent;
  transition: all 0.15s ease;
  background: var(--surface);
}
.project-check-cell input:checked + .project-check-box-sm {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.user-projects-table-scroll::-webkit-scrollbar {
  width: 6px;
}
.user-projects-table-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
}
@media (max-width: 600px) {
  .user-projects-table {
    font-size: 12px;
  }
}
.project-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
  font-size: 13px;
  font-weight: 600;
}
.project-check-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.project-check-item input {
  display: none;
}
.project-check-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: transparent;
  transition: all 0.2s;
  flex: none;
}
.project-check-item input:checked + .project-check-box {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.project-check-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.user-modal-foot-hint {
  font-size: 11.5px;
  color: var(--ink-faint);
}
@media (max-width: 600px) {
  .user-modal-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .user-projects-list {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 500px) {
  .user-modal-body .row-2 {
    grid-template-columns: 1fr;
  }
}
.users-table-scroll {
  overflow-y: auto;
  overflow-x: auto;
  max-height: 480px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.users-table-scroll table.dt {
  min-width: 700px;
}
.users-table-scroll::-webkit-scrollbar {
  width: 7px;
}
.users-table-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
}
.users-table-scroll table.dt th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 5;
}
.users-table-scroll table.dt thead th {
  box-shadow: 0 1px 0 var(--border);
}
html.dark .users-table-scroll table.dt th {
  background: var(--surface-2);
}

/* ---------- صفحه درباره سامانه (about.php) ---------- */
.about-body {
  max-width: 100%;
}
.about-card {
  margin-bottom: 16px;
}
.about-card .card-head h2 {
  font-size: 15px;
}
.about-card-intro .card-body {
  padding: 24px 28px;
}
.about-grid-intro {
  display: flex;
  align-items: center;
  gap: 24px;
}
.about-intro-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  flex: none;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.3);
}
.about-intro-text h2 {
  font-size: 17px;
  color: var(--accent-dark);
  margin-bottom: 8px;
}
.about-intro-text p {
  margin-bottom: 10px;
  color: var(--ink-muted);
  line-height: 2;
  font-size: 14px;
}
.about-intro-text p:last-child {
  margin-bottom: 0;
}
.about-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.about-feature {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}
.about-feature:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.about-feature-ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  margin-bottom: 10px;
}
.about-feature h3 {
  font-size: 13.5px;
  margin-bottom: 6px;
}
.about-feature p {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.8;
}
.about-roles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.about-role {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 12px;
  padding: 16px;
}
.about-role-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.about-role-ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex: none;
}
.about-role-head h3 {
  font-size: 14px;
}
.about-role-badge {
  display: inline-block;
  margin-top: 3px;
}
.about-role ul {
  margin: 0;
  padding-inline-start: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.about-role li {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.7;
}
.about-standards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.about-standard {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.about-standard-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex: none;
}
.about-standard h3 {
  font-size: 13.5px;
}
.about-standard p {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.8;
}
.about-stack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.about-stack {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}
.about-stack:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.about-stack-ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 6px;
}
.about-stack h3 {
  font-size: 13.5px;
}
.about-stack p {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.8;
}
.about-security-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.about-security {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}
.about-security:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.about-security-ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 6px;
}
.about-security h3 {
  font-size: 13.5px;
}
.about-security p {
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.8;
}
@media (max-width: 1100px) {
  .about-security-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  .about-security-grid {
    grid-template-columns: 1fr;
  }
}
.about-more p {
  margin-bottom: 12px;
  color: var(--ink-muted);
  line-height: 2.1;
  font-size: 14px;
}
.about-more p:last-child {
  margin-bottom: 0;
}
.about-more b {
  color: var(--accent-dark);
}
@media (max-width: 1100px) {
  .about-stack-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  .about-stack-grid {
    grid-template-columns: 1fr;
  }
}
.about-benefits {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.about-benefit {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--ink-muted);
}
.about-benefit-ic {
  font-size: 20px;
  flex: none;
}
.about-card-author {
  background: linear-gradient(
    135deg,
    var(--surface) 0%,
    var(--accent-soft) 100%
  );
}
.about-author-ic {
  font-size: 32px;
}
@media (max-width: 1100px) {
  .about-features-grid,
  .about-roles-grid,
  .about-standards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  .about-features-grid,
  .about-roles-grid,
  .about-standards-grid {
    grid-template-columns: 1fr;
  }
  .about-grid-intro {
    flex-direction: column;
    text-align: center;
  }
}

/* ---------- Organization Settings (organization.php) ---------- */
.org-card .card-body {
  padding: 24px;
}
.org-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 980px) {
  .org-grid {
    grid-template-columns: 1fr;
  }
}
.org-form {
  min-width: 0;
}
.org-form .field:last-child {
  margin-bottom: 0;
}
.org-upload-area {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.org-logo-current {
  width: 110px;
  height: 110px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  flex: none;
}
.org-logo-current img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 6px;
}
.org-logo-current.empty {
  border-style: dashed;
}
.org-logo-placeholder {
  font-size: 34px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  justify-content: center;
}
.org-logo-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.org-logo-current.empty .org-logo-badge {
  background: var(--neutral);
}
.org-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.org-preview-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  text-align: center;
  padding: 8px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.org-preview-header {
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
  padding: 16px 18px;
}
.org-preview-header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.org-preview-logo {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: none;
}
.org-preview-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.org-preview-login {
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--surface);
}
.org-preview-login-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.org-preview-login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}
.org-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.org-upload-area .file-name {
  font-size: 11px;
  color: var(--accent);
  margin-top: 6px;
  text-align: center;
  width: 100%;
}

/* ---------- نوار ابزار استاندارد انتخاب پروژه (structure / project_edit) ---------- */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.pt-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.pt-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}
.pt-current {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pt-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pt-tools label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
}
.pt-tools select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-family: inherit;
  min-width: 160px;
  max-width: 240px;
  cursor: pointer;
}
.pe-hero-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
html.dark .page-toolbar {
  background: var(--surface);
  border-color: var(--border);
}
html.dark .pt-current {
  color: var(--ink);
}
html.dark .pt-tools select {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
html.dark .pt-tools select option {
  background: var(--surface);
  color: var(--ink);
}

/* ---------- Structure page (structure.php) — استایل اختصاصی st-* ---------- */
.st-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
  color: #fff;
  padding: 22px 26px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.st-hero-glow {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(
      ellipse 500px 400px at 20% 20%,
      rgba(20, 184, 166, 0.22),
      transparent 55%
    ),
    radial-gradient(
      ellipse 400px 350px at 85% 80%,
      rgba(37, 99, 235, 0.12),
      transparent 55%
    );
  pointer-events: none;
}
.st-hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.st-hero-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.st-hero-logo {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #8fe3d6;
  overflow: hidden;
  flex: none;
}
.st-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}
.st-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #8fe3d6;
  font-weight: 700;
  margin-bottom: 2px;
}
.st-title {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin: 0;
  overflow-wrap: anywhere;
}
.st-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: #b9c6ce;
  font-size: 12px;
}
.st-sep {
  opacity: 0.5;
}
.st-hero-stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: center;
}
.st-hero-stat {
  text-align: center;
  min-width: 70px;
}
.st-hero-stat b {
  display: block;
  font-size: 19px;
  font-weight: 800;
  color: #fff;
}
.st-hero-stat span {
  font-size: 10.5px;
  color: #b9c6ce;
  margin-top: 2px;
  display: block;
}

/* نوار توزیع وزن */
.st-ledger {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 22px;
  margin-bottom: 14px;
}
.st-ledger-head {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.st-ledger-right {
  flex: none;
}
.st-ledger-main {
  flex: 1;
  min-width: 220px;
}
.st-ledger-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 10px;
}
.st-ledger-track {
  height: 16px;
}
.st-ledger-remain {
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    var(--border) 0,
    var(--border) 4px,
    transparent 4px,
    transparent 8px
  );
  border-radius: 0 999px 999px 0;
}
.st-ledger-scale {
  position: relative;
  height: 14px;
  margin-top: 6px;
}
.st-ledger-scale span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 9.5px;
  color: var(--ink-faint);
  font-weight: 600;
}
.st-ledger-scale span:first-child {
  transform: none;
}
.st-ledger-scale span:last-child {
  transform: translateX(-100%);
}
.st-alert {
  display: inline-block;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  margin-top: 8px;
}

/* دونات توزیع وزن */
.st-donut {
  position: relative;
  width: 92px;
  height: 92px;
  flex: none;
}
.st-donut svg {
  display: block;
  transform: rotate(0deg);
}
.st-donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.st-donut-label b {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}
.st-donut-label small {
  font-size: 9px;
  color: var(--ink-faint);
  margin-top: 2px;
}

/* لجند رنگی مراحل */
.st-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.st-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--ink-muted);
}
.st-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--border-strong);
}
.st-legend-name {
  font-weight: 600;
}
.st-legend-w {
  font-weight: 800;
  color: var(--ink);
  margin-inline-start: 2px;
}
.st-legend-remain .st-legend-dot {
  background: repeating-linear-gradient(
    45deg,
    var(--border-strong) 0,
    var(--border-strong) 2px,
    transparent 2px,
    transparent 4px
  );
}
.st-legend-remain .st-legend-name,
.st-legend-remain .st-legend-w {
  color: var(--ink-faint);
}

/* کارت هر مرحله */
.st-card {
  position: relative;
}
.st-card-topline {
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.st-card .struct-card-head {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.st-card.open .struct-card-head {
  border-radius: 0;
}
.st-progress-mini {
  width: 90px;
  height: 7px;
  border-radius: 999px;
  background: var(--neutral-soft);
  overflow: hidden;
  flex: none;
}
.st-progress-mini span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--st-color, var(--accent));
}
.st-context-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.st-context-chip b {
  color: var(--ink);
}
.st-add-child-bar {
  padding: 12px 18px;
  border-top: 1px dashed var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.st-add-bar {
  margin-top: 16px;
}

/* بخش‌بندی مودال‌ها */
.st-modal-sec {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 6px 12px;
  margin: 14px 0 12px;
}
.st-modal-sec:first-child {
  margin-top: 0;
}

/* ---------- Project Info page (project_edit.php) — استایل اختصاصی pe-* (فشرده) ---------- */
.pe-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
  color: #fff;
  padding: 18px 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.pe-hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.pe-hero-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.pe-hero-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #8fe3d6;
  overflow: hidden;
  flex: none;
}
.pe-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}
.pe-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #8fe3d6;
  font-weight: 700;
  margin-bottom: 2px;
}
.pe-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin: 0;
  overflow-wrap: anywhere;
}
.pe-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: #b9c6ce;
  font-size: 12px;
}
.pe-sep {
  opacity: 0.5;
}
.pe-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}
.pe-pill-ok {
  background: rgba(23, 146, 79, 0.25);
  color: #7ee2a8;
}
.pe-pill-warn {
  background: rgba(181, 114, 10, 0.3);
  color: #fcd34d;
}
.pe-pill-danger {
  background: rgba(192, 50, 42, 0.3);
  color: #fbbf24;
}
.pe-hero-left {
  flex: none;
}
.pe-hero-pct {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  min-width: 110px;
}
.pe-hero-pct b {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}
.pe-hero-pct-track {
  width: 110px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.pe-hero-pct-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

/* جدول مشخصات */
.pe-table-card {
  margin-bottom: 14px;
}
.pe-table-card .card-head {
  padding: 10px 18px;
}
.pe-table-card .card-head h2 {
  font-size: 13.5px;
}
.pe-table-body {
  padding: 4px 18px !important;
}
.pe-info-table {
  width: 100%;
  border-collapse: collapse;
}
.pe-info-table th,
.pe-info-table td {
  padding: 7px 10px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: middle;
}
.pe-info-table tr:last-child th,
.pe-info-table tr:last-child td {
  border-bottom: none;
}
.pe-info-table th {
  width: 140px;
  color: var(--ink-muted);
  font-weight: 700;
  font-size: 11.5px;
  white-space: nowrap;
  background: var(--surface-2);
}
.pe-info-table th:first-child {
  border-radius: 0 0 0 0;
}
.pe-cell-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
}
.pe-cell-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--neutral-soft);
  overflow: hidden;
}
.pe-cell-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

/* فرم فشرده */
/* داشبورد مشخصات و آمار پروژه — کارت‌های KPI جذاب */
.pe-dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.pe-dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 68px;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}
.pe-dash-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.pe-dash-main {
  grid-column: span 2;
  background: linear-gradient(
    135deg,
    var(--surface) 0%,
    var(--accent-soft) 100%
  );
}
.pe-dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pe-dash-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-muted);
}
.pe-dash-ic {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex: none;
}
.pe-dash-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}
.pe-dash-sub {
  font-size: 10px;
  color: var(--ink-faint);
  font-weight: 600;
}
.pe-dash-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  flex: none;
}
.pe-dash-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--neutral-soft);
  overflow: hidden;
  margin-top: 3px;
}
.pe-dash-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}
@media (max-width: 1100px) {
  .pe-dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .pe-dash-main {
    grid-column: span 2;
  }
}
@media (max-width: 600px) {
  .pe-dash-grid {
    grid-template-columns: 1fr;
  }
  .pe-dash-main {
    grid-column: span 1;
  }
}

.pe-form-card {
  margin-bottom: 14px;
}
.pe-form-card .card-head {
  padding: 10px 18px;
}
.pe-form-card .card-head h2 {
  font-size: 13.5px;
}
.pe-form-card .card-body {
  padding: 14px 18px;
}
.pe-form-card .field {
  margin-bottom: 10px;
}
.pe-form-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 1000px) {
  .pe-form-grid {
    grid-template-columns: 1fr;
  }
}
.pe-logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.pe-logo-box {
  width: 72px;
  height: 72px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface-2);
  flex: none;
}
.pe-logo-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 5px;
}
.pe-logo-box span {
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 600;
}
.pe-logo-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pe-file-btn {
  margin: 0;
}
.pe-remove-logo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--danger);
  font-weight: 600;
  cursor: pointer;
}
.pe-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ---------- Approvals page (approvals.php) — استایل اختصاصی apv-* ---------- */
.apv-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
  color: #fff;
  padding: 22px 26px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.apv-hero-glow {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(
      ellipse 500px 400px at 20% 20%,
      rgba(20, 184, 166, 0.22),
      transparent 55%
    ),
    radial-gradient(
      ellipse 400px 350px at 85% 80%,
      rgba(37, 99, 235, 0.12),
      transparent 55%
    );
  pointer-events: none;
}
.apv-hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.apv-hero-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.apv-hero-logo {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #8fe3d6;
  overflow: hidden;
  flex: none;
}
.apv-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #8fe3d6;
  font-weight: 700;
  margin-bottom: 2px;
}
.apv-title {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin: 0;
}
.apv-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: #b9c6ce;
  font-size: 12px;
}
.apv-hero-stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: center;
}
.apv-hero-stat {
  text-align: center;
  min-width: 64px;
}
.apv-hero-stat b {
  display: block;
  font-size: 19px;
  font-weight: 800;
  color: #fff;
}
.apv-hero-stat span {
  font-size: 10.5px;
  color: #b9c6ce;
  margin-top: 2px;
  display: block;
}
.apv-table-card {
  margin-bottom: 14px;
}
.apv-table-card .card-head {
  padding: 12px 18px;
}
.apv-table-card .card-head h2 {
  font-size: 14px;
}
.apv-table-scroll {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.apv-table-scroll table.dt {
  min-width: 900px;
}

/* ---------- Projects page (projects.php) — استایل اختصاصی pj-* ---------- */
.pj-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
  color: #fff;
  padding: 22px 26px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.pj-hero-glow {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(
      ellipse 500px 400px at 20% 20%,
      rgba(20, 184, 166, 0.22),
      transparent 55%
    ),
    radial-gradient(
      ellipse 400px 350px at 85% 80%,
      rgba(37, 99, 235, 0.12),
      transparent 55%
    );
  pointer-events: none;
}
.pj-hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.pj-hero-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.pj-hero-logo {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #8fe3d6;
  overflow: hidden;
  flex: none;
}
.pj-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}
.pj-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #8fe3d6;
  font-weight: 700;
  margin-bottom: 2px;
}
.pj-title {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin: 0;
}
.pj-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: #b9c6ce;
  font-size: 12px;
}
.pj-sep {
  opacity: 0.5;
}
.pj-hero-stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: center;
}
.pj-hero-stat {
  text-align: center;
  min-width: 70px;
}
.pj-hero-stat b {
  display: block;
  font-size: 19px;
  font-weight: 800;
  color: #fff;
}
.pj-hero-stat span {
  font-size: 10.5px;
  color: #b9c6ce;
  margin-top: 2px;
  display: block;
}

/* جدول پروژه‌ها */
.pj-table-card {
  margin-bottom: 14px;
}
.pj-table-card .card-head {
  padding: 12px 18px;
}
.pj-table-card .card-head h2 {
  font-size: 14px;
}
.pj-table-scroll {
  overflow-x: auto;
}
.pj-table-scroll table.dt {
  min-width: 860px;
}
.pj-proj-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}
.pj-proj-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 9px;
  border: 1px solid var(--border);
  flex: none;
}
.pj-proj-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 13px;
  border: none;
}
.pj-proj-name {
  font-weight: 700;
  font-size: 13.5px;
}
.pj-proj-dates {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
  white-space: nowrap;
}
.pj-progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pj-pct {
  font-weight: 800;
  font-size: 12.5px;
  width: 44px;
  text-align: left;
}
.pj-num-cell {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* ---------- Workbench (کارتابل راهبری) — استایل مدرن ---------- */
.wb-table-scroll {
  overflow-x: auto;
  border-radius: var(--radius-md);
}
.wb-table {
  min-width: 960px;
}
.wb-table thead th {
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 5;
}
.wb-table-num {
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
}
.wb-progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 90px;
}
.wb-progress-cell .pbar {
  height: 8px;
}
.wb-pct {
  font-weight: 800;
  font-size: 12px;
  width: 42px;
  text-align: left;
}
.wb-notes-input {
  width: 180px;
  min-width: 150px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
  min-height: 32px;
}
.wb-notes-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.wb-l1head {
  display: grid;
  grid-template-columns: 150px 150px minmax(140px, 1fr) minmax(200px, 1.4fr);
  gap: 0;
  padding: 8px 14px;
  background: var(--neutral-soft);
  border-bottom: 1px solid var(--border);
}
.wb-l1head span {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  text-align: center;
}
.wb-l1row {
  display: grid;
  grid-template-columns: 150px 150px minmax(140px, 1fr) minmax(200px, 1.4fr);
  gap: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.wb-head-toggle {
  cursor: pointer;
}
.wb-head-toggle:hover {
  background: #f0f3f6;
}
.wb-card-chev {
  flex: none;
  color: var(--ink-faint);
  font-size: 14px;
  transition: transform 0.2s ease;
}
.wb-card.closed .wb-card-chev {
  transform: rotate(-90deg);
}
.wb-card.closed .wb-card-body {
  display: none;
}
.wb-l1head + .wb-l1row {
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.wb-l1row-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 12px 14px;
  border-inline-end: 1px solid var(--border);
}
.wb-l1row-field:last-child {
  border-inline-end: none;
}
.wb-l1row-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
}
.wb-l1row-val {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  font-weight: 800;
  font-size: 14px;
  text-align: center;
  box-sizing: border-box;
}
.wb-l1row .wb-progress-input {
  width: 100%;
  height: 36px;
  box-sizing: border-box;
}
.wb-l1row .wb-notes-input {
  width: 100%;
  min-width: 0;
}
.wb-l1row .wb-file-input {
  height: 36px;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 0 8px;
  box-sizing: border-box;
  width: 100%;
}
@media (max-width: 900px) {
  .wb-l1row {
    grid-template-columns: repeat(2, 1fr);
  }
  .wb-l1row-field:nth-child(2) {
    border-inline-end: none;
  }
  .wb-l1row-field:nth-child(1),
  .wb-l1row-field:nth-child(2) {
    border-bottom: 1px solid var(--border);
  }
}
@media (max-width: 480px) {
  .wb-l1row {
    grid-template-columns: 1fr;
  }
  .wb-l1row-field {
    border-inline-end: none !important;
    border-bottom: 1px solid var(--border);
  }
  .wb-l1row-field:last-child {
    border-bottom: none;
  }
}
html.dark .wb-l1row {
  background: var(--surface-2);
}
html.dark .wb-l1row-val {
  background: var(--surface);
  border-color: var(--border-strong);
}
.wb-card {
  overflow: hidden;
}
.wb-card .card-head {
  padding: 14px 18px;
  flex-wrap: wrap;
}
html.dark .wb-notes-input {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
html.dark .wb-l1row {
  background: var(--surface-2);
}
.wb-notes-view {
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  white-space: normal;
  max-width: 280px;
}

/* ---------- Workbench (کارتابل راهبری) — legacy ---------- */
.wb-header {
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
  color: #fff;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.wb-header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.wb-header h1 {
  font-size: 20px;
  color: #fff;
}
.wb-header .meta {
  font-size: 12.5px;
  color: #b9c6ce;
  margin-top: 3px;
}
.wb-header .who-pill {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--ink);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  box-sizing: border-box;
}
.wb-header .who-pill .avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
html.dark .wb-header .who-pill {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}
html.dark .wb-header .who-pill .avatar {
  background: var(--accent);
  color: #04211e;
}
html.dark .wb-header {
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
}
.wb-progress-input {
  width: 110px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  text-align: center;
  font-weight: 700;
  background: var(--surface);
  color: var(--ink);
}
.wb-progress-input::placeholder {
  font-weight: 400;
  color: var(--ink-faint);
  font-size: 12px;
}
.wb-file-input {
  font-size: 11.5px;
  color: var(--ink-muted);
  max-width: 180px;
}
.wb-file-input::file-selector-button {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink-muted);
  cursor: pointer;
}
.wb-file-input::file-selector-button:hover {
  background: var(--border);
  color: var(--ink);
}
.wb-file-name {
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 3px;
}
.wb-file-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
  box-sizing: border-box;
  width: 100%;
}
.wb-file-picker:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.wb-file-picker input[type="file"] {
  display: none;
}
html.dark .wb-file-picker {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border-strong);
}
html.dark .wb-file-picker:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* ---------- Pagination (ریسپانسیو، بالاتر از تسکبار ویندوز) ---------- */
.pagination-wrap {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 0 8px 24px;
}
.pagination-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 30px;
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  user-select: none;
}

/* اسکرول داخلی جدول لاگ‌ها */
.logs-table-scroll {
  overflow-y: auto;
  overflow-x: auto;
  max-height: 500px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.logs-table-scroll table.dt {
  min-width: 720px;
}
.logs-table-scroll::-webkit-scrollbar {
  width: 7px;
}
.logs-table-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
}
.logs-table-scroll table.dt th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 5;
}
.logs-table-scroll table.dt thead th {
  box-shadow: 0 1px 0 var(--border);
}
html.dark .logs-table-scroll table.dt th {
  background: var(--surface-2);
}

/* ---------- Logs: فیلترها (یک ردیف تمام‌عرض) ---------- */
.logs-filter-grid {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr 0.75fr 1fr auto;
  gap: 14px;
  align-items: end;
  width: 100%;
}
.logs-filter-grid .field {
  margin-bottom: 0;
  min-width: 0;
}
.logs-filter-grid .jdate-group {
  width: 100%;
}
.logs-filter-grid .logs-filter-actions > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
@media (max-width: 1200px) {
  .logs-filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .logs-filter-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Logs: دو نمودار توزیع کنار هم تمام‌عرض ---------- */
.logs-dist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: 100%;
}
@media (max-width: 980px) {
  .logs-dist-grid {
    grid-template-columns: 1fr;
  }
}
.dist-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  min-width: 0;
  background: var(--surface-2);
}
.dist-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 12px;
  text-align: center;
}

@media (max-width: 600px) {
  .pagination-wrap .btn {
    flex: 0 0 auto;
    min-width: 34px;
    justify-content: center;
    padding: 6px 9px;
  }
}

/* ---------- Return reason ---------- */
.return-reason {
  margin-top: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--warning-soft);
  border: 1px solid var(--border);
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}
.return-reason-input {
  font-family: inherit;
  font-size: 11.5px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  resize: vertical;
}

/* =========================================================
   تم تاریک (Dark Mode)
   ========================================================= */
html.dark {
  --bg: #0f1720;
  --surface: #1a2430;
  --surface-2: #202c3a;
  --ink: #ffffff;
  --ink-muted: #cbd5e1;
  --ink-faint: #94a3b8;
  --border: #2d3a4a;
  --border-strong: #3d4d61;

  --accent: #14b8a6;
  --accent-dark: #0f766e;
  --accent-soft: #123a37;
  --accent-ring: rgba(20, 184, 166, 0.22);

  --success: #22c55e;
  --success-soft: #163221;
  --warning: #f59e0b;
  --warning-soft: #3a2c12;
  --danger: #ef4444;
  --danger-soft: #3d1f1e;
  --neutral: #94a3b8;
  --neutral-soft: #263242;
  --info: #60a5fa;
  --info-soft: #1d2c4d;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
}
html.dark .navbar {
  background: linear-gradient(135deg, #0f1720 0%, #101820 60%, #0b3d37 130%);
}
html.dark .nav-page-title {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
html.dark .card,
html.dark .ledger,
html.dark .kpi,
html.dark .project-card,
html.dark .gantt-row,
html.dark .struct-card {
  background: var(--surface);
}
html.dark .gantt-l1,
html.dark .struct-card-head {
  background: var(--surface-2);
}
html.dark table.dt tr:hover td {
  background: var(--surface-2);
}
html.dark .modal {
  background: var(--surface);
}
html.dark .btn-ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--ink-muted);
}
html.dark .btn {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}
html.dark .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04211e;
}
html.dark .toast {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
}
html.dark .login-scene {
  background:
    radial-gradient(1200px 800px at 20% 15%, #123a35 0%, transparent 60%),
    radial-gradient(1000px 700px at 85% 80%, #0b2a3d 0%, transparent 60%),
    linear-gradient(135deg, #0f1720 0%, #142822 55%, #0f1720 100%);
}
html.dark .report-sticky-bar {
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
}
html.dark .ledger-track,
html.dark .pbar {
  background: var(--neutral-soft);
}
html.dark .jdate-input,
html.dark .jdate-popup,
html.dark .jcal-day,
html.dark .jcal-head select {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
html.dark .jcal-day:hover {
  background: var(--accent-soft);
}

/* =========================================================
   دکمه تغییر تم (مینیمال — دایره‌ای + نسخه شناور)
   ========================================================= */
.theme-toggle-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.theme-toggle-btn:hover {
  background: var(--surface-2);
  transform: scale(1.08);
}
/* وقتی دکمه روی پس‌زمینه تیره/گرادیانی است (navbar/کارتابل/گزارش) */
.wb-header .theme-toggle-btn,
.report-sticky-bar .theme-toggle-btn {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: none;
}
.wb-header .theme-toggle-btn:hover,
.report-sticky-bar .theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}
html.dark .theme-toggle-btn {
  border-color: var(--border-strong);
}
html.dark .wb-header .theme-toggle-btn,
html.dark .report-sticky-bar .theme-toggle-btn {
  border-color: rgba(255, 255, 255, 0.15);
}
.theme-float {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(15, 23, 32, 0.85);
  color: #fff;
}
/* دکمه شناور ثابت در صفحات عمومی */
.theme-float {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 9999;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.theme-toggle-icon {
  font-size: 15px;
  line-height: 1;
}

/* =========================================================
   چشم نمایش رمز عبور
   ========================================================= */
.pw-wrap {
  position: relative;
  display: block;
}
.pw-wrap input {
  padding-inline-end: 40px !important;
}
.pw-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-end: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  color: var(--ink-muted);
  font-family: inherit;
  z-index: 10;
}

/* =========================================================
   تقویم شمسی Pop-up
   ========================================================= */
.jdate-group {
  position: relative;
}
.jdate-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
}
.jdate-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.jdate-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  width: 256px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  font-family: inherit;
}
.jcal-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}
.jcal-head select {
  flex: 1;
  padding: 4px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
}
.jcal-nav {
  width: 22px;
  height: 22px;
  flex: none;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.jcal-nav:hover {
  background: var(--border);
}
.jcal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-faint);
  margin-bottom: 3px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.jcal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.jcal-day {
  aspect-ratio: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.jcal-day:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.jcal-day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.jcal-day.is-selected {
  background: var(--accent);
  color: #fff;
}
.jcal-empty {
  aspect-ratio: 1;
}
.jcal-foot {
  display: flex;
  justify-content: center;
  margin-top: 5px;
}
.jcal-today {
  border: none;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.jcal-today:hover {
  background: var(--accent);
  color: #fff;
}

/* =========================================================
   گرادیان پروگرس: قرمز -> زرد -> سبز بر اساس درصد
   ========================================================= */
.pbar-gradient > span {
  background: linear-gradient(
    90deg,
    #c0322a 0%,
    #d5760a 25%,
    #e0a800 50%,
    #7bbf2a 75%,
    #17924f 100%
  ) !important;
}
html.dark .pbar-gradient > span {
  background: linear-gradient(
    90deg,
    #ef4444 0%,
    #f59e0b 50%,
    #22c55e 100%
  ) !important;
}

/* =========================================================
   لاگین — تار عنکبوت تعاملی
   ========================================================= */
.login-scene {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    ellipse at 50% 30%,
    #142333 0%,
    #0b111c 55%,
    #070d16 100%
  );
}
.login-scene::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(
      ellipse 600px 500px at 22% 18%,
      rgba(15, 118, 110, 0.28),
      transparent 55%
    ),
    radial-gradient(
      ellipse 500px 450px at 78% 82%,
      rgba(20, 184, 166, 0.18),
      transparent 55%
    ),
    radial-gradient(
      ellipse 400px 400px at 55% 50%,
      rgba(37, 99, 235, 0.1),
      transparent 55%
    );
  animation: sceneGlow 14s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes sceneGlow {
  0% {
    transform: translate(0%, 0%) scale(1);
  }
  50% {
    transform: translate(3%, -4%) scale(1.05);
  }
  100% {
    transform: translate(-2%, 3%) scale(0.97);
  }
}

/* بوم تار عنکبوت — روی همه‌چیز و تمام صفحه */
#webCanvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  display: block;
}

/* در حالت تیره پس‌زمینه کم‌رنگ‌تر شود */
html.dark .login-scene {
  background: radial-gradient(
    ellipse at 50% 30%,
    #16222f 0%,
    #0d141d 55%,
    #080d14 100%
  );
}
html.dark .login-scene::before {
  background:
    radial-gradient(
      ellipse 600px 500px at 22% 18%,
      rgba(18, 58, 53, 0.45),
      transparent 55%
    ),
    radial-gradient(
      ellipse 500px 450px at 78% 82%,
      rgba(11, 42, 61, 0.4),
      transparent 55%
    ),
    radial-gradient(
      ellipse 400px 400px at 55% 50%,
      rgba(37, 99, 235, 0.12),
      transparent 55%
    );
}

/* کارت ورود */
.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  margin: 20px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  padding: 32px 28px 24px;
  animation: cardIn 0.5s ease;
}
html.dark .login-card {
  background: #1a2430;
  border-color: rgba(255, 255, 255, 0.1);
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.login-logo {
  height: 42px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}
.login-heading {
  font-size: 18px;
  text-align: center;
  margin: 0 0 4px;
}
.login-sub {
  font-size: 12.5px;
  color: #7c8a96;
  text-align: center;
  margin: 0 0 20px;
}
.login-error {
  background: #fbe8e6;
  color: #c0322a;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
html.dark .login-error {
  background: #3d1f1e;
  color: #f87171;
}
.login-form .login-field {
  margin-bottom: 14px;
}
.login-form .login-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #5c6b7a;
  margin-bottom: 5px;
}
.login-form .login-field input {
  width: 100%;
  padding: 6px 12px;
  border: 1px solid #d4dbe3;
  border-radius: 9px;
  background: #f8fafc;
  color: #16202b;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  text-align: center;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.login-form .login-field input:focus {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
html.dark .login-form .login-field input {
  background: #202c3a;
  border-color: #3d4d61;
  color: #fff;
}
.login-form .login-field input::placeholder {
  color: #94a3b8;
  text-align: center;
}
.login-form .login-field input:focus {
  text-align: center;
}
.login-form .login-field input::-webkit-input-placeholder {
  text-align: center;
}
.login-form .login-field input:-moz-placeholder {
  text-align: center;
}
.login-form .pw-wrap {
  position: relative;
}
.login-form .pw-wrap input {
  padding-inline-end: 40px;
}
.login-form .pw-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-end: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
  color: #94a3b8;
  line-height: 1;
}
.login-form .pw-toggle:hover {
  color: #5c6b7a;
}
.login-btn {
  width: 100%;
  padding: 11px 16px;
  margin-top: 4px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.32);
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}
.login-btn:hover {
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.42);
  transform: translateY(-1px);
}
.login-btn:active {
  transform: translateY(0);
}
html.dark .login-btn {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #04211e;
}
.login-foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #e4e9ef;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
}
html.dark .login-foot {
  border-color: #2d3a4a;
}

/* =========================================================
   مودال حرفه‌ای‌تر (افزودن/ویرایش مراحل)
   ========================================================= */
.modal {
  border-radius: 16px;
  overflow: hidden;
}
.modal-head {
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: #fff;
  padding: 18px 22px;
}
.modal-head h3 {
  color: #fff;
}
.modal-head .btn {
  background: rgba(255, 255, 255, 0.15);
  border-color: transparent;
  color: #fff;
}
.modal-head .btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
.modal .field label {
  color: var(--ink);
  font-weight: 700;
}
.modal .field input[type="text"],
.modal .field input[type="number"],
.modal .field textarea,
.modal .field select,
.modal .field .jdate-input {
  border-radius: 10px;
  padding: 10px 12px;
}
.modal-foot {
  background: var(--surface-2);
}
.modal .row-2 {
  gap: 14px;
}
.modal .jdate-group {
  display: block;
}
.modal .jdate-input {
  width: 100%;
}
.jdate-group .jdate-popup {
  right: auto;
  left: 0;
}
html.dark .modal-head {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}
html.dark .modal .field label {
  color: var(--ink);
}

/* =========================================================
   کارتابل راهبری — تضمین تمام‌عرض بودن (فقط صفحات دارای wb-header)
   ========================================================= */
.wb-header-inner,
.wb-header + .content {
  max-width: 100%;
  width: 100%;
}
.wb-card,
.wb-card .card-head,
.wb-card .card-body,
.wb-card .wb-table-scroll {
  width: 100%;
}
.wb-card .card-head {
  box-sizing: border-box;
}

/* نشانگر موارد جدید و ارزیابینشده (فقط کارتابل راهبری) */
.wb-new-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  flex: none;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.4);
  white-space: nowrap;
}

/* ---------- دکمه‌های هدر کارتابل — هم‌سایز بودن ---------- */
.wb-header-btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* ---------- دایره‌های شمارنده روی دکمه «جدیدها و اصلاح‌ها» ---------- */
.btn-with-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wb-badge-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  flex: none;
}
.wb-badge-new {
  background: #ef4444;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.45);
}
.wb-badge-return {
  background: #f59e0b;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.45);
}
html.dark .wb-badge-new {
  background: #ef4444;
}
html.dark .wb-badge-return {
  background: #f59e0b;
}
html.dark .wb-new-badge {
  background: #ef4444;
  color: #fff;
}

/* نشانگر موارد بازگشتخورده برای اصلاح توسط مدیر (فقط کارتابل راهبری) */
/* صفحه وضعیت (status.php) — استایل اختصاصی */
.wb-status-proj {
  margin-bottom: 14px;
  overflow: hidden;
}
.wb-status-list {
  padding: 8px 14px !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wb-status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  flex-wrap: wrap;
  transition: background 0.15s ease;
}
.wb-status-item:hover {
  background: var(--surface);
  border-color: var(--accent);
}
.wb-status-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  flex: none;
}
.wb-status-badge.is-new {
  background: #ef4444;
}
.wb-status-badge.is-returned {
  background: #f59e0b;
}
.wb-status-type {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  background: var(--neutral-soft);
  border-radius: 999px;
  padding: 1px 8px;
  flex: none;
}
.wb-status-parent {
  font-size: 11.5px;
  color: var(--ink-muted);
}
.wb-status-title {
  font-weight: 700;
  font-size: 13px;
}
.wb-status-reason {
  font-size: 11.5px;
  color: var(--warning);
  background: var(--warning-soft);
  border-radius: 6px;
  padding: 2px 8px;
}

.wb-return-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f59e0b;
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  flex: none;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.4);
  white-space: nowrap;
}
html.dark .wb-return-badge {
  background: #f59e0b;
  color: #fff;
}

/* ۴ کارت KPI کارتابل — تقسیم برابر در تمام عرض (فقط صفحه کارتابل) */
.wb-header + .content .kpi-grid {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 1300px) {
  .wb-header + .content .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 880px) {
  .wb-header + .content .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .wb-header + .content .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   پروفایل کاربری (profile.php) — استایل اختصاصی pf-*
   ========================================================= */
.pf-hero {
  background: linear-gradient(135deg, #0f1720 0%, #16342f 60%, #0f766e 130%);
  color: #fff;
  padding: 18px 28px;
}
.pf-hero-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.pf-hero-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 40px;
}
.pf-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #8fe3d6;
  overflow: hidden;
  flex: none;
}
.pf-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pf-eyebrow {
  display: none;
}
.pf-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: #fff;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.pf-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: #b9c6ce;
  font-size: 10.5px;
  margin-top: 2px;
}
.pf-role {
  background: rgba(20, 184, 166, 0.25);
  color: #8fe3d6;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
}
.pf-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pf-hero-actions .btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
}
.pf-hero-actions .theme-toggle-btn {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
/* آمار */
.pf-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 700px) {
  .pf-stats {
    grid-template-columns: 1fr;
  }
}
.pf-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pf-stat-ic {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--neutral-soft);
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex: none;
}
.pf-stat-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}
.pf-stat-lbl {
  font-size: 10.5px;
  color: var(--ink-muted);
  margin-top: 3px;
}
/* فرم */
.pf-card .card-body {
  padding: 24px;
}
.pf-form-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
}
@media (max-width: 760px) {
  .pf-form-grid {
    grid-template-columns: 1fr;
  }
}
.pf-col-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.pf-avatar-large {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 800;
  color: var(--accent-dark);
  overflow: hidden;
}
.pf-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pf-avatar-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-dark);
  cursor: pointer;
  transition: all 0.15s ease;
}
.pf-avatar-picker:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.pf-avatar-picker input[type="file"] {
  display: none;
}
.pf-col-info {
  min-width: 0;
}
.pf-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}
.pf-sect-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 14px;
  padding-inline-start: 10px;
  border-inline-start: 3px solid var(--accent);
}
.pf-pw-row {
  padding: 16px;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.pf-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

/* =========================================================
   ریسپانسیو موبایل — نوار بالا (هَمبِرگر) و اصلاحات کلی
   (فقط در عرض‌های کوچک اعمال می‌شود؛ چیدمان دسکتاپ بدون تغییر)
   ========================================================= */

/* دکمهٔ هَمبِرگر (در دسکتاپ مخفی است) */
.navbar-toggle {
  display: none;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.navbar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 900px) {
  .navbar-toggle { display: flex; }

  .navbar-inner { gap: 10px; }

  .navbar-brand { flex: 1 1 auto; min-width: 0; }
  .navbar-brand .brand-text { min-width: 0; }
  .navbar-brand .name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .navbar-brand .sub { display: none; }

  /* منو به‌صورت کشویی عمودی زیر نوار قرار می‌گیرد */
  .navbar-nav {
    display: none;
    flex: none;
    order: 30;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }
  .navbar.open .navbar-nav { display: flex; }
  .navbar-nav a {
    padding: 11px 12px;
    font-size: 13.5px;
    border-radius: 8px;
  }

  /* ابزار سمت چپ: آواتار (بدون نام) + تم + خروج */
  .navbar-tools { margin-inline-start: auto; }
  .navbar-user .u-name { display: none; }
  .navbar-user { padding: 4px 8px; }
  .navbar-logout { padding: 7px 10px; }

  /* تبدیل آیکن هَمبِرگر به ضربدر */
  .navbar.open .navbar-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .navbar.open .navbar-toggle span:nth-child(2) { opacity: 0; }
  .navbar.open .navbar-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

/* ---------- اصلاحات عمومی موبایل ---------- */
@media (max-width: 600px) {
  .content { padding: 16px 14px 48px; }
  .nav-page-title { padding: 14px 16px; }
  .nav-page-title h1 { font-size: 16px; }

  .report-header { padding: 20px 16px 28px; }
  .report-header h1 { font-size: 20px; }
  .report-body { padding: 0 14px 48px; }

  .report-sticky-bar { padding: 8px 14px; }
  .report-sticky-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
  }

  .card .card-head { flex-wrap: wrap; gap: 8px; }
  .card .card-body { padding: 14px; }

  .page-toolbar { padding: 10px 12px; }
  .pt-tools select { max-width: 100%; }
}

/* هدر کارتابل راهبر (workbench) — شکستن سطر در موبایل */
@media (max-width: 700px) {
  .wb-header { padding: 14px 16px; }
  .wb-header-inner { flex-direction: column; align-items: stretch; gap: 10px; }
  .wb-header-inner > div { flex-wrap: wrap !important; white-space: normal !important; }
  .wb-header .who-pill > span:not(.wb-role-badge) { display: none; }
  .wb-header h1 { font-size: 17px; }
}
