@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080B12;
  --surface: #0E1320;
  --surface2: #141C2E;
  --surface3: #1A2338;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --text: #F0F4FF;
  --muted: #5A6A8A;
  --muted2: #7A8AAA;
  --accent: #4F7EFF;
  --accent-glow: rgba(79,126,255,0.15);
  --accent-dim: rgba(79,126,255,0.08);
  --green: #2DD4A0;
  --green-dim: rgba(45,212,160,0.08);
  --red: #FF5C5C;
  --radius: 10px;
  --radius-lg: 16px;
  --font: 'Vazirmatn', sans-serif;
  --mono: 'Vazirmatn', sans-serif;
}

/* اعداد لاتین */
* { font-variant-numeric: lining-nums; }
.num, .dash-value, .summary-pill, .report-chip strong,
input[type="number"], .year-badge, .time-sel { font-family: var(--mono); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-feature-settings: "tnum";
  direction: rtl;
}

/* ===== دروازه رمز عبور ===== */
.gate-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.gate-card {
  width: 100%; max-width: 360px;
  text-align: center;
  animation: fadeUp 0.5s ease both;
}

.gate-logo {
  width: 48px; height: 48px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  letter-spacing: 0.05em;
}

.gate-title {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 6px;
  letter-spacing: 0;
}

.gate-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
  font-family: var(--font);
}

.gate-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  direction: ltr;
}

.gate-input-wrap input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 13px 16px;
  outline: none;
  transition: border-color 0.2s;
  text-align: center;
  direction: ltr;
  letter-spacing: 0.1em;
}

.gate-input-wrap input:focus { border-color: var(--accent); }

.gate-input-wrap button {
  width: 48px; height: 48px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.gate-input-wrap button:hover { opacity: 0.9; transform: translateX(2px); }

.gate-error {
  font-size: 12px;
  color: var(--red);
  min-height: 18px;
  font-family: var(--font);
}

/* ===== چیدمان ===== */
.container { width: 100%; max-width: 480px; }

.header {
  text-align: center; margin-bottom: 36px;
  opacity: 0; animation: fadeUp 0.5s ease forwards;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.logo {
  width: 36px; height: 36px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.05em;
}

.header h1 {
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 0;
  color: var(--muted2);
}
.header h1 span { color: var(--text); font-weight: 600; }

/* ===== داشبورد ===== */
.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
  animation: fadeUp 0.5s ease 0.08s both;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 12px 14px;
  transition: border-color 0.2s, background 0.2s;
}
.dash-card:hover { border-color: var(--border-hover); background: var(--surface2); }
.accent-card { border-color: rgba(79,126,255,0.2); background: var(--accent-dim); }
.accent-card:hover { border-color: rgba(79,126,255,0.4); }

.dash-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 8px;
}

.dash-value {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  min-height: 20px;
  display: flex;
  align-items: center;
}
.accent-card .dash-value { color: var(--accent); }

/* ===== دکمه‌های سریع ===== */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeUp 0.5s ease 0.16s both;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

/* ===== نوار پیشرفت ===== */
.progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 40px;
}

.prog-step {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  transition: all 0.25s;
  flex-shrink: 0;
}
.prog-step.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.prog-step.done { border-color: var(--green); background: var(--green-dim); color: var(--green); }
.prog-line {
  flex: 1; height: 1px;
  background: var(--border);
  max-width: 48px;
}

/* ===== مراحل ===== */
.step { display: none; opacity: 0; animation: fadeUp 0.35s ease forwards; }
.step.active { display: block; }
.step-label { font-size: 10px; letter-spacing: 0; color: var(--muted); text-transform: none; margin-bottom: 16px; font-family: var(--mono); }
.step-title { font-size: 20px; font-weight: 400; margin-bottom: 28px; letter-spacing: 0; }

/* ===== ردیف تاریخ ===== */
.date-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 20px;
}
.year-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  line-height: 1;
}
.field { flex: 1; display: flex; flex-direction: column; gap: 6px; }
label { font-size: 11px; color: var(--muted); letter-spacing: 0; text-transform: none; }

/* ===== ورودی‌ها ===== */
select, input, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 11px 13px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  direction: rtl;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--accent);
  background: var(--surface3);
}
select option { background: var(--surface3); color: var(--text); }

.select-wrap { position: relative; }
.select-wrap::after {
  content: '▾';
  position: absolute;
  left: 11px; right: auto; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
}

textarea { resize: none; height: 80px; font-size: 13px; cursor: text; direction: rtl; }

/* ===== انتخابگر زمان ===== */
.time-picker-group { display: flex; gap: 10px; margin-bottom: 18px; }
.time-field { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.time-selects {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
  direction: ltr;
}
.time-selects:focus-within { border-color: var(--accent); }

.time-sel {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  padding: 11px 4px;
  text-align: center;
  direction: ltr;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  width: auto;
  border-radius: 0;
}
.time-sel:focus { background: var(--accent-dim); color: var(--accent); }
.time-sel option { background: var(--surface3); color: var(--text); }
.time-sep { color: var(--muted); font-size: 16px; font-weight: 300; padding: 0 2px; user-select: none; pointer-events: none; font-family: var(--mono); }

/* ===== لیست وظایف ===== */
.task-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; max-height: 280px; overflow-y: auto; }
.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: space-between;
}
.task-item:hover { border-color: var(--border-hover); background: var(--surface2); }
.task-item.selected { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

.check {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--border); transition: all 0.15s; flex-shrink: 0;
}
.task-item.selected .check { background: var(--accent); border-color: var(--accent); }

.no-task {
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  cursor: pointer; font-size: 13px; color: var(--muted);
  transition: all 0.15s; display: flex; align-items: center; gap: 10px;
}
.no-task:hover { border-color: var(--muted2); color: var(--text); }
.no-task.selected { border-color: var(--accent); color: var(--accent); }

.task-list::-webkit-scrollbar { width: 3px; }
.task-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.btn-add-task {
  width: 100%; padding: 10px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 14px;
  letter-spacing: 0;
}
.btn-add-task:hover { border-color: var(--accent); color: var(--accent); }

/* ===== دکمه‌ها ===== */
.btn {
  width: 100%; padding: 13px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-family: var(--font); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; margin-top: 8px;
  letter-spacing: 0;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #6090FF; transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--muted2); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-hover); background: var(--surface2); }
.btn-big { padding: 16px !important; font-size: 15px !important; }
.btn-action { margin-top: 0; }
.btn-small { width: auto; padding: 9px 14px; font-size: 12px; margin-top: 0; }

/* ===== موفقیت ===== */
.success-box { text-align: center; padding: 36px 0; }
.success-icon {
  width: 52px; height: 52px;
  background: var(--green-dim);
  border: 1px solid var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--green);
  margin: 0 auto 20px;
}
.success-box h2 { font-size: 20px; font-weight: 400; margin-bottom: 6px; letter-spacing: 0; }
.success-box p { color: var(--muted2); font-size: 13px; margin-bottom: 20px; font-family: var(--mono); }
.summary-pill {
  display: inline-flex; align-items: center;
  background: var(--accent-dim); border: 1px solid rgba(79,126,255,0.25);
  border-radius: 100px; padding: 7px 16px;
  font-size: 12px; color: var(--accent); margin-bottom: 28px;
  font-family: var(--mono); direction: ltr;
}

/* ===== لودینگ / اسپینر ===== */
.loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: var(--muted); font-size: 13px; }
.spinner { width: 14px; height: 14px; border: 1.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner-sm { display: inline-block; width: 12px; height: 12px; border: 1.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
.error-msg { color: var(--red); font-size: 12px; padding: 12px 0; font-family: var(--font); }

/* ===== توست ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface3); border: 1px solid var(--border);
  color: var(--text); padding: 10px 20px;
  border-radius: 100px; font-size: 12px; font-family: var(--font);
  transition: transform 0.3s ease; z-index: 999; white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--red); color: var(--red); }

/* ===== مودال ===== */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center; justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; animation: fadeIn 0.2s ease; }
.modal {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%; max-width: 380px;
  animation: fadeUp 0.22s ease;
  direction: rtl;
}
.modal h3 { font-size: 15px; font-weight: 500; margin-bottom: 16px; letter-spacing: 0; }
.modal input, .modal select, .modal textarea { margin-bottom: 12px; }
.modal label { font-size: 10px; color: var(--muted); letter-spacing: 0; text-transform: none; display: block; margin-bottom: 4px; }
.modal-actions { display: flex; gap: 8px; margin-top: 4px; }
.modal-actions .btn { margin-top: 0; }
.confirm-modal { max-width: 320px; text-align: center; }
.confirm-modal .modal-actions { justify-content: center; }
.muted-text { color: var(--muted2); font-size: 13px; margin-bottom: 14px; }

.task-manager-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; max-height: 200px; overflow-y: auto; }
.task-manager-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px;
}
.task-manager-row span { color: var(--text); font-size: 13px; }
.task-mini-actions, .table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-btn {
  border: 1px solid var(--border); background: transparent; color: var(--muted2);
  border-radius: 6px; padding: 5px 8px; font-size: 11px; cursor: pointer; font-family: var(--font);
  transition: all 0.15s;
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.mini-btn.danger { color: var(--red); border-color: rgba(255,92,92,0.2); }
.mini-btn.danger:hover { border-color: var(--red); }

/* ===== صفحه گزارش ===== */
.report-page { max-width: 1000px; }
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 8px;
  margin-bottom: 16px;
  justify-content: start;
}
.filter-grid .field { width: auto; min-width: 0; }
.filter-grid .select-wrap select { white-space: nowrap; min-width: max-content; padding-left: 28px; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.report-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.report-eyebrow { font-size: 10px; letter-spacing: 0; color: var(--muted); text-transform: none; margin-bottom: 4px; font-family: var(--mono); }
.report-title { font-size: 17px; font-weight: 500; letter-spacing: 0; }
.report-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; direction: rtl; }
.report-chip {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 11px; font-size: 12px; color: var(--muted2); direction: rtl;
}
.report-chip strong { color: var(--text); font-family: var(--mono); font-weight: 500; direction: ltr; display: inline-block; }
.table-wrap { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-table th, .report-table td { padding: 9px 8px; border-bottom: 1px solid var(--border); text-align: right; }
.report-table th { color: var(--muted); font-weight: 400; font-size: 10px; text-transform: none; letter-spacing: 0; }
.report-table td { color: var(--text); font-family: var(--mono); }
.report-table td:first-child, .report-table td:nth-child(2), .report-table td:last-child { font-family: var(--font); }
.report-table th:last-child, .report-table td:last-child { text-align: center; }
.empty-state { color: var(--muted); padding: 24px 0; font-family: var(--font); font-size: 13px; text-align: center; }

@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }