/* موديول الحسابات — أنماط مشتركة */
.fin-form-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
  background-color: #f0f4f8;
  padding: 10px;
  direction: rtl;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  box-sizing: border-box;
}

.fin-form-header {
  background: linear-gradient(135deg, #0d9488 0%, #059669 50%, #10b981 100%);
  color: #fff;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 6px 6px 0 0;
  margin-bottom: 6px;
}

.fin-form-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.fin-form-header .fin-badge {
  font-size: 0.75rem;
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
}

.fin-form-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: #fff;
  padding: 6px;
  border: 1px solid #cbd5e0;
  margin-bottom: 8px;
  border-radius: 6px;
}

.fin-form-toolbar button {
  flex: 1 1 120px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid #94a3b8;
  background: #f8fafc;
  cursor: pointer;
  font-weight: 600;
  border-radius: 4px;
  font-size: 0.85rem;
}

.fin-form-toolbar button:hover {
  background: #e2e8f0;
}

.fin-form-toolbar button.fin-btn-primary {
  background: linear-gradient(135deg, #0d9488, #059669);
  color: #fff;
  border-color: #047857;
}

.fin-form-toolbar button.fin-btn-primary:hover {
  filter: brightness(1.05);
}

.fin-status-message {
  display: none;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
}

.fin-status-message.success {
  display: block;
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.fin-status-message.error {
  display: block;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.fin-form-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.fin-panel {
  background: #fff;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  padding: 12px;
}

.fin-section-title {
  background: linear-gradient(90deg, #0d9488, #14b8a6);
  color: #fff;
  padding: 6px 10px;
  text-align: center;
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 4px;
}

.fin-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.fin-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
}

@media (max-width: 900px) {
  .fin-grid-2,
  .fin-grid-3 {
    grid-template-columns: 1fr;
  }
}

.fin-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.fin-form-row label {
  width: 130px;
  min-width: 130px;
  font-size: 0.85rem;
  color: var(--text-primary, #334155);
  text-align: right;
}

.fin-form-row input,
.fin-form-row select,
.fin-form-row textarea {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border-color, #cbd5e0);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  background-color: var(--input-bg, #fff);
  color: var(--text-primary, #334155);
}

.fin-form-row input[readonly],
.fin-form-row input:read-only {
  background: #f1f5f9;
}

.fin-form-row textarea {
  resize: vertical;
  min-height: 56px;
}

.fin-table-wrap {
  overflow: auto;
  max-height: min(50vh, 420px);
  border: 1px solid #cbd5e0;
  border-radius: 4px;
}

.fin-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.fin-data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1e293b;
  color: #fff;
}

.fin-data-table th,
.fin-data-table td {
  padding: 6px 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  text-align: center;
  color: var(--text-primary, #334155);
}

.fin-data-table tbody td {
  background-color: var(--card-bg, #fff);
}

html.dark-mode .fin-form-container,
body.dark-mode .fin-form-container {
  background-color: var(--bg-body, #1a1f2e);
  color: var(--text-primary, #e8e8e8);
}

html.dark-mode .fin-panel,
html.dark-mode .fin-form-toolbar,
body.dark-mode .fin-panel,
body.dark-mode .fin-form-toolbar {
  background: var(--card-bg, #252a38);
  border-color: var(--border-color, rgba(255, 255, 255, 0.12));
  color: var(--text-primary, #e8e8e8);
}

html.dark-mode .fin-form-row label,
body.dark-mode .fin-form-row label {
  color: var(--text-primary, #e8e8e8);
}

html.dark-mode .fin-form-row input,
html.dark-mode .fin-form-row select,
html.dark-mode .fin-form-row textarea,
body.dark-mode .fin-form-row input,
body.dark-mode .fin-form-row select,
body.dark-mode .fin-form-row textarea {
  background: var(--input-bg, #1e2433);
  color: var(--text-primary, #e8e8e8);
  border-color: var(--border-color, rgba(255, 255, 255, 0.15));
}

html.dark-mode .fin-data-table tbody td,
body.dark-mode .fin-data-table tbody td {
  background-color: var(--card-bg, #252a38);
  color: var(--text-primary, #e8e8e8);
  border-color: var(--border-color, rgba(255, 255, 255, 0.12));
}

html.dark-mode .fin-data-table tbody tr:nth-child(even),
body.dark-mode .fin-data-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--card-bg, #252a38) 90%, var(--text-primary, #fff));
}

html.dark-mode .fin-data-table tbody tr:hover,
body.dark-mode .fin-data-table tbody tr:hover {
  background: rgba(16, 185, 129, 0.2);
}

.fin-data-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--card-bg, #fff) 92%, var(--text-primary, #000));
}

.fin-data-table tbody tr:hover {
  background: #ccfbf1;
}

.fin-data-table td.fin-num,
.fin-data-table th.fin-num {
  direction: ltr;
  text-align: left;
}

.fin-totals-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 4px;
  margin-top: 8px;
}

.fin-totals-bar span {
  font-weight: 600;
  font-size: 0.85rem;
}

.fin-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.fin-filter-row .fin-form-row {
  flex: 1 1 200px;
}
