@font-face {
  font-family: 'Speda';
  src: url('fonts/Speda.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Speda', 'Segoe UI', Tahoma, sans-serif;
}

body {
  background-color: #f1f5f9;
  color: #1e293b;
  padding: 15px;
  direction: rtl;
}

.no-print {
  display: block;
}

.admin-panel {
  max-width: 880px;
  margin: 0 auto 20px auto;
  background: #ffffff;
  padding: 18px 22px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.admin-panel h2 {
  font-size: 18px;
  margin-bottom: 12px;
  color: #0f172a;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 13px;
  margin-bottom: 4px;
  font-weight: bold;
}

.form-group input, .form-group select {
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 13px;
  outline: none;
}

.actions-btn {
  margin-top: 15px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  padding: 9px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 13px;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-save { background: #15803d; color: #fff; }
.btn-primary { background: #1d4ed8; color: #fff; }
.btn-archive { background: #475569; color: #fff; }
.btn-dashboard { background: #0284c7; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; padding: 4px 8px; font-size: 11px; }
.btn-edit { background: #ea580c; color: #fff; padding: 4px 8px; font-size: 11px; }
.btn:hover { opacity: 0.9; }

/* لاپەڕەی فەرمی A4 */
.print-page {
  width: 210mm;
  height: 297mm;
  max-height: 297mm;
  margin: 0 auto;
  background: #ffffff;
  padding: 6mm 10mm;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.receipt-card {
  border: 2px solid #0f172a;
  border-radius: 6px;
  padding: 10px 14px;
  position: relative;
  height: 132mm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
}

.watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.05;
  z-index: 0;
  pointer-events: none;
}

.watermark img { width: 220px; }

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #0f172a;
  padding-bottom: 5px;
  z-index: 1;
}

.header-right h3 { font-size: 16px; color: #0f172a; }
.header-right h4 { font-size: 12px; color: #475569; margin-bottom: 2px; }
.badge-title {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}

.header-center .logo { height: 50px; }

.meta-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  min-width: 140px;
}

.meta-row { display: flex; justify-content: space-between; line-height: 1.35; }
.meta-box span { color: #64748b; }
.meta-box b { color: #0f172a; }

.receipt-grid-container {
  display: grid;
  grid-template-columns: 1fr 2fr 1.8fr;
  gap: 4px;
  margin: 6px 0;
  z-index: 1;
}

.grid-cell {
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cell-label { color: #080808; font-weight: bold; white-space: nowrap; }
.cell-val { color: #0f172a; }
.cell-val.bold { font-weight: bold; }

.cell-type { grid-column: span 1; }
.cell-name { grid-column: span 1; }
.cell-location { grid-column: span 1; }
.cell-purpose { grid-column: span 2; }
.cell-badges { grid-column: span 1; }
.cell-amount { grid-column: span 1; background: #f8fafc; border: 1.5px solid #0f172a; }
.cell-words { grid-column: span 2; background: #f8fafc; border: 1.5px solid #0f172a; }

.price-val { color: #600716; font-weight: bold; font-size: 12px; }
.badge-highlight { color: #b91c1c; font-weight: bold; font-size: 13.5px; font-family: monospace; }

.receipt-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid #cbd5e1;
  padding-top: 4px;
  z-index: 1;
}

.sig-box { text-align: center; font-size: 12px; font-weight: bold; }
.sig-space { height: 25px; }

.stamp-circle {
  border: 1.5px dashed #94a3b8;
  color: #94a3b8;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.cut-line {
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  letter-spacing: 2px;
  margin: 2mm 0;
}

/* لاپەڕەی ئەرشیف و مۆدال */
.archive-page-container {
  max-width: 1100px;
  margin: 20px auto;
  background: #fff;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.building-grid-detailed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}

.b-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px;
}

.b-card-title {
  font-size: 15px;
  font-weight: bold;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.b-stat-line { font-size: 12px; display: flex; justify-content: space-between; margin-bottom: 4px; }
.text-green { color: #15803d; font-weight: bold; }
.text-red { color: #b91c1c; font-weight: bold; }

.progress-bar { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: #2563eb; }

.stats-cards { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.stat-card { background: #e0f2fe; padding: 10px; border-radius: 5px; font-size: 14px; flex: 1; min-width: 200px; }

.archive-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
.archive-table th, .archive-table td { border: 1px solid #cbd5e1; padding: 6px; text-align: center; }
.archive-table th { background: #f1f5f9; }

/* دیزاینی پەنجەرەی دەستکاریکردن (Modal) */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-card {
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 15px;
}

@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { width: 210mm; height: 297mm; margin: 0 !important; padding: 0 !important; background: #ffffff; overflow: hidden; }
  .no-print { display: none !important; }
  .print-page { width: 210mm; height: 297mm; max-height: 297mm; padding: 6mm 10mm; margin: 0; box-shadow: none; box-sizing: border-box; page-break-after: avoid; page-break-inside: avoid; }
}

.cell-val u {
    text-decoration: none;
}