@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/vazirmatn/Vazirmatn-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #eef2f7;
  --bg-accent: #e8eef8;
  --card-bg: #ffffff;
  --border: #d8e0ea;
  --text: #1a2332;
  --text-muted: #6b7a90;
  --primary: #1d4ed8;
  --primary-soft: #eff4ff;
  --primary-hover: #1e40af;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --warning: #b45309;
  --danger: #b91c1c;
  --shadow: 0 2px 8px rgba(26, 35, 50, 0.06);
  --shadow-lg: 0 12px 32px rgba(26, 35, 50, 0.1);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse 80% 50% at 100% -20%, #dbe7ff 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at -10% 100%, #e8f0ff 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.7;
}

.app-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.95rem 0;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.app-brand:hover {
  color: var(--primary);
}

.app-main {
  padding-bottom: 2.5rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.dev-card,
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}

.dev-card:hover {
  box-shadow: var(--shadow-lg);
}

.dev-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dev-card-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 40px;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.55rem;
  background: var(--bg-accent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.task-item:hover {
  border-color: #b8c9e6;
  background: #f7faff;
}

.task-item:active {
  cursor: grabbing;
}

.task-item.sortable-ghost {
  opacity: 0.4;
}

.task-handle {
  color: var(--text-muted);
  font-size: 1.15rem;
  user-select: none;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.task-header-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.task-project-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.82rem;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #c7d7fe;
  border-radius: 999px;
  padding: 0.12rem 0.65rem;
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-project-badge:hover {
  background: #dbe7ff;
  color: var(--primary-hover);
}

.task-attachment-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.task-title-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 1;
  background: none;
  border: none;
  padding: 0;
  text-align: right;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
}

.task-title-toggle:hover .task-title {
  color: var(--primary);
}

.task-title {
  font-weight: 700;
  font-size: 1.02rem;
}

.task-toggle-icon {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.task-details {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border);
}

.task-no-files {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.task-upload-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem;
}

.developer-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.developer-checkboxes .form-check {
  margin-bottom: 0;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background: var(--bg-accent);
}

.task-completed {
  opacity: 0.8;
  background: var(--success-soft);
  border-color: #bbf7d0;
}

.task-badge-completed {
  font-size: 0.78rem;
  color: var(--success);
  background: #dcfce7;
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  white-space: nowrap;
  font-weight: 700;
}

.task-description {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.task-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.task-attachment-link {
  font-size: 0.88rem;
  color: var(--primary);
  text-decoration: none;
  background: var(--primary-soft);
  border: 1px solid #c7d7fe;
  border-radius: 8px;
  padding: 0.25rem 0.55rem;
}

.task-attachment-link:hover {
  background: #dbe7ff;
  text-decoration: none;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.task-project-link {
  display: block;
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: 0.15rem;
}

.task-project-link:hover {
  color: var(--primary);
}

.task-empty {
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 1rem 0.5rem;
  list-style: none;
  text-align: center;
}

.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 2rem);
  padding: 1.5rem;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
}

.login-title {
  font-size: 1.65rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  text-align: center;
}

.login-subtitle {
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 1.75rem;
  font-size: 1rem;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.project-category-badge,
.project-date-badge {
  display: inline-block;
  font-size: 0.88rem;
  color: var(--text-muted);
  background: var(--bg-accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

.project-table {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.project-table thead {
  background: var(--bg-accent);
}

.project-table th {
  font-weight: 700;
  border-bottom-color: var(--border);
  white-space: nowrap;
}

.project-table td {
  vertical-align: middle;
}

.project-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.project-search {
  max-width: 360px;
  border-radius: 999px;
  padding-inline: 1rem;
}

.project-search-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.project-handle-col {
  width: 2.5rem;
  text-align: center;
}

.project-handle {
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
  font-size: 1.15rem;
}

.project-handle:active {
  cursor: grabbing;
}

.project-row.sortable-ghost {
  opacity: 0.4;
}

.project-row.sortable-fallback {
  opacity: 0.9;
  background: var(--primary-soft) !important;
  display: table;
  table-layout: fixed;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.project-row-hidden {
  display: none;
}

.project-search-empty {
  margin-top: 1rem;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1.5rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  font-family: inherit;
  padding: 0.55rem 0.8rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #93b4fd;
  box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.12);
}

.form-label {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.btn {
  font-family: inherit;
  font-weight: 700;
  border-radius: 10px;
  padding: 0.45rem 0.95rem;
}

.btn-sm {
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: #93b4fd;
  background: var(--primary-soft);
}

.btn-outline-primary:hover {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-outline-secondary {
  border-color: var(--border);
  color: var(--text-muted);
  background: #fff;
}

.btn-outline-secondary:hover {
  background: var(--bg-accent);
  border-color: #b8c5d6;
  color: var(--text);
}

.btn-outline-danger {
  color: var(--danger);
  border-color: #fecaca;
  background: #fef2f2;
}

.btn-outline-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
}

.btn-warning {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-family: inherit;
}

.modal-header {
  border-bottom-color: var(--border);
}

.modal-footer {
  border-top-color: var(--border);
}

.modal-title {
  font-weight: 700;
}

.alert {
  border-radius: var(--radius-sm);
  font-family: inherit;
}

.alert-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.app-nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.app-nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
}

.app-nav-link:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.finance-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  height: 100%;
  overflow: hidden;
}

.finance-stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.finance-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.finance-stat-unit {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.finance-stat-pair {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.finance-stat-pair-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.finance-stat-pair-row span {
  color: var(--text-muted);
  flex-shrink: 0;
}

.finance-stat-pair-row strong {
  font-weight: 700;
  text-align: left;
  direction: ltr;
}

.finance-stat-muted {
  color: var(--text);
  font-size: 0.88rem;
}

.finance-stat-debt {
  font-size: 0.82rem;
  line-height: 1.45;
  font-weight: 600;
}

.finance-stat-sub {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.money-figure {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  white-space: nowrap;
}

/* فقط روی span/div داخل کارت — نه روی td که جدول را می‌ترکاند */
span.money-figure,
div.money-figure,
strong.money-figure,
.finance-stat-value.money-figure {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.finance-stat-value.money-figure {
  display: block;
  font-size: clamp(0.75rem, 1.6vw, 0.98rem);
}

.finance-money-table {
  font-size: 0.82rem;
  width: 100%;
  table-layout: auto;
}

.finance-money-table th,
.finance-money-table td {
  text-align: right;
  vertical-align: middle;
}

.finance-money-table th {
  white-space: nowrap;
  font-size: 0.78rem;
}

.finance-money-table td.money-figure {
  display: table-cell;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: right;
  font-size: 0.78rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.finance-money-table td:first-child {
  text-align: right;
  white-space: normal;
  direction: rtl;
}

.finance-dual-table .finance-project-cell {
  vertical-align: middle;
  border-inline-start: 3px solid var(--primary);
  background: #fafbfd;
}

.finance-dual-table .finance-project-name {
  font-weight: 700;
}

.finance-dual-table .finance-actions-cell {
  vertical-align: middle;
}

.finance-dual-table tr.finance-row-plan td {
  border-bottom-style: dashed;
}

.finance-dual-table tr.finance-row-actual {
  background: #f7fbf7;
}

.finance-type-cell {
  white-space: nowrap;
  vertical-align: middle;
}

.finance-row-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  white-space: nowrap;
}

.finance-row-tag-plan {
  background: #eef2f7;
  color: #44556a;
}

.finance-row-tag-actual {
  background: #e7f6ea;
  color: #1f6b3a;
}

.finance-table-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.finance-mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.finance-mini-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.finance-mini-list li:last-child {
  border-bottom: none;
}

.finance-mini-list strong {
  color: var(--text);
}

.finance-mini-list small {
  color: var(--text-muted);
}

.finance-stat-highlight {
  border-color: #93b4fd;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

.finance-story .finance-stat-card {
  min-height: 108px;
}

.searchable-select .form-select {
  width: 100%;
}

.searchable-select-list {
  height: auto;
  max-height: 220px;
}

.ss-dropdown {
  position: relative;
}

.ss-dropdown-toggle {
  text-align: right !important;
  cursor: pointer;
  background: #fff;
}

.ss-dropdown-toggle.is-placeholder {
  color: #6c757d;
}

.ss-dropdown-toggle::after {
  content: "";
  float: left;
  margin-top: 0.55rem;
  border-top: 0.35rem solid;
  border-right: 0.3rem solid transparent;
  border-left: 0.3rem solid transparent;
  opacity: 0.65;
}

.ss-dropdown-panel {
  position: absolute;
  z-index: 1080;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 0.5rem;
}

.ss-dropdown-search {
  margin-bottom: 0.4rem;
}

.ss-dropdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}

.ss-dropdown-item {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

.ss-dropdown-item:hover,
.ss-dropdown-item.is-selected {
  background: var(--primary-soft);
  color: var(--primary);
}

.money-input {
  direction: ltr;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.finance-tx-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.finance-tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow);
}

.finance-tx-main {
  min-width: 0;
  flex: 1;
}

.finance-tx-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.finance-tx-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.finance-tx-title {
  font-weight: 700;
  font-size: 0.98rem;
}

.finance-tx-note {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.finance-tx-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.finance-tx-amount {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
}

.finance-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
}

.finance-tag-manual {
  background: #eef2f7;
  color: #44556a;
}

.finance-tag-project {
  background: #e8f1ff;
  color: #1d4f91;
}

@media (max-width: 576px) {
  .finance-tx-item {
    flex-direction: column;
    align-items: stretch;
  }

  .finance-tx-side {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.project-search-box .form-select[size] {
  height: auto;
  max-height: 180px;
}

.datepicker-plot-area,
.datepicker-plot-area * {
  font-family: var(--font) !important;
}

.jalali-datepicker {
  cursor: pointer;
  background: #fff;
}
