/* ===== Reset و پایه ===== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  background: #f4f6f8;
  color: #2c3e50;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

body {
  padding-bottom: 80px; /* جا برای bottom-nav */
}

/* ===== هدر ===== */
.app-header {
  background: #2c3e50;
  color: #fff;
  padding: 16px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.app-header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

/* ===== صفحات ===== */
.page {
  display: none;
  padding: 12px;
}

.page.active {
  display: block;
}

/* ===== کارت ===== */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.section-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #2c3e50;
  border-right: 3px solid #3498db;
  padding-right: 8px;
}

/* ===== فرم ===== */
form label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #34495e;
}

form label:first-of-type {
  margin-top: 0;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1.5px solid #d5dbe1;
  border-radius: 8px;
  background: #fafbfc;
  transition: border-color .15s;
  font-family: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #3498db;
  background: #fff;
}

/* ===== رادیو ===== */
.radio-group {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.radio-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1.5px solid #d5dbe1;
  border-radius: 8px;
  background: #fafbfc;
  cursor: pointer;
  font-weight: 500;
  transition: all .15s;
}

.radio-item input {
  accent-color: #3498db;
}

.radio-item:has(input:checked) {
  border-color: #3498db;
  background: #eaf4fc;
  color: #2980b9;
}

/* ===== پیش‌نمایش سود ===== */
.profit-preview {
  margin-top: 16px;
  padding: 12px;
  background: #eafaf1;
  border-radius: 8px;
  text-align: center;
  color: #27ae60;
  font-size: 0.95rem;
}

.profit-preview strong {
  font-size: 1.1rem;
}

.profit-preview.negative {
  background: #fdecea;
  color: #c0392b;
}

/* ===== دکمه اصلی ===== */
.btn-primary {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: #3498db;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
  font-family: inherit;
}

.btn-primary:active {
  background: #2980b9;
}

/* ===== لیست آخرین فروش‌ها ===== */
.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.recent-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eef1f4;
  font-size: 0.9rem;
}

.recent-list li:last-child {
  border-bottom: none;
}

.recent-list .item-info {
  flex: 1;
  min-width: 0;
}

.recent-list .item-name {
  font-weight: 600;
  color: #2c3e50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-list .item-meta {
  font-size: 0.78rem;
  color: #7f8c8d;
  margin-top: 2px;
}

.recent-list .item-profit {
  color: #27ae60;
  font-weight: 700;
  margin-right: 10px;
  white-space: nowrap;
}

.recent-list .btn-delete {
  background: none;
  border: none;
  color: #e74c3c;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  margin-right: 4px;
}

.recent-list .empty {
  text-align: center;
  color: #95a5a6;
  padding: 20px;
  font-size: 0.9rem;
}

/* ===== گزارش ===== */
.report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 0.95rem;
}

.report-row strong {
  color: #27ae60;
  font-size: 1.15rem;
}

.report-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid #eef1f4;
  font-size: 0.82rem;
  color: #7f8c8d;
}

.report-sub b {
  color: #2c3e50;
}

/* ===== ناوبری پایین ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid #e0e5ea;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
  z-index: 20;
}

.nav-btn {
  flex: 1;
  padding: 10px 4px 12px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  color: #95a5a6;
  font-family: inherit;
  transition: color .15s;
}

.nav-btn.active {
  color: #3498db;
}

.nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #2c3e50;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 30;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: #27ae60;
}

.toast.error {
  background: #c0392b;
}

/* ===== اسکرول‌بار نازک ===== */
.recent-list::-webkit-scrollbar {
  width: 4px;
}

.recent-list::-webkit-scrollbar-thumb {
  background: #d5dbe1;
  border-radius: 2px;
}
/* ===== فیلتر سال/ماه ===== */
.filter-card {
  padding: 12px 16px;
}

.filter-row {
  display: flex;
  gap: 10px;
}

.filter-col {
  flex: 1;
}

.filter-col label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #34495e;
}

.filter-col select {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  border: 1.5px solid #d5dbe1;
  border-radius: 8px;
  background: #fafbfc;
  font-family: inherit;
  color: #2c3e50;
  cursor: pointer;
}

.filter-col select:focus {
  outline: none;
  border-color: #3498db;
  background: #fff;
}

/* ===== کارت خلاصه ===== */
.summary-card {
  padding: 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  background: #f8fafc;
  border-radius: 8px;
  text-align: center;
}

.summary-label {
  font-size: 0.72rem;
  color: #7f8c8d;
  margin-bottom: 4px;
}

.summary-item strong {
  font-size: 0.95rem;
  color: #2c3e50;
  font-weight: 700;
}

.summary-item:nth-child(3) strong {
  color: #27ae60;
}

.summary-item:nth-child(4) strong {
  color: #2980b9;
}

.summary-item:nth-child(5) strong {
  color: #8e44ad;
}

/* ===== لیست فروش‌ها ===== */
.sales-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.sales-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eef1f4;
  font-size: 0.9rem;
}

.sales-list li:last-child {
  border-bottom: none;
}

.sales-list .item-info {
  flex: 1;
  min-width: 0;
}

.sales-list .item-name {
  font-weight: 600;
  color: #2c3e50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sales-list .item-meta {
  font-size: 0.75rem;
  color: #7f8c8d;
  margin-top: 2px;
}

.sales-list .item-nums {
  text-align: left;
  margin-left: 8px;
  white-space: nowrap;
}

.sales-list .item-profit {
  color: #27ae60;
  font-weight: 700;
  font-size: 0.95rem;
}

.sales-list .item-revenue {
  font-size: 0.72rem;
  color: #95a5a6;
}

.sales-list .item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-right: 6px;
}

.sales-list .btn-mini {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 4px;
}

.sales-list .btn-edit { color: #3498db; }
.sales-list .btn-del  { color: #e74c3c; }

.sales-list .empty {
  text-align: center;
  color: #95a5a6;
  padding: 24px;
  font-size: 0.9rem;
}

/* ===== نوار ناوبری با ۳ دکمه ===== */
.nav-btn {
  font-size: 0.72rem;
}

/* ===== مودال ویرایش ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px;
}

.modal h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: #2c3e50;
}

.modal label {
  display: block;
  margin: 10px 0 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #34495e;
}

.modal input[type="text"],
.modal input[type="number"] {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  border: 1.5px solid #d5dbe1;
  border-radius: 8px;
  background: #fafbfc;
  font-family: inherit;
}

.modal .radio-group {
  margin-top: 4px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-cancel {
  background: #ecf0f1;
  color: #2c3e50;
}

.btn-save {
  background: #3498db;
  color: #fff;
}