:root {
  --navy: #12253c;
  --navy-2: #1b3454;
  --accent: #2f6fed;
  --accent-soft: #eaf1ff;
  --bg: #f4f7fb;
  --card: #fff;
  --text: #1f2d3d;
  --muted: #6d7c8f;
  --line: #e3e9f0;
  --green: #18864b;
  --red: #c9403c;
  --amber: #b7791f;
  --radius: 12px;
  --shadow: 0 6px 22px rgba(18, 37, 60, .07);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Vazir, "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; }

/* ---------- ورود ---------- */
.login-screen { min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--navy), #24486f); padding: 20px; }
.login-card { width: min(400px, 100%); background: #fff; border-radius: 16px;
  padding: 30px; box-shadow: 0 24px 70px rgba(0, 0, 0, .3); display: flex;
  flex-direction: column; gap: 14px; }
.login-logo { font-size: 42px; text-align: center; }
.login-logo-img { display: block; width: 88px; height: 88px; object-fit: contain;
  margin: 0 auto 4px; border-radius: 14px; background: #f4f7fb; padding: 6px; }
.login-card h1 { margin: 0; text-align: center; font-size: 21px; }
.login-card > p { margin: -8px 0 6px; text-align: center; color: var(--muted); }
.login-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.login-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card small { color: var(--muted); text-align: center; line-height: 1.7; }
.login-error { color: var(--red); font-size: 12px; min-height: 16px; text-align: center; }

/* ---------- چیدمان ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex: 0 0 250px; background: linear-gradient(180deg, var(--navy), var(--navy-2));
  color: #e8eef7; display: flex; flex-direction: column; padding: 18px 10px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .1); margin-bottom: 10px; }
.brand-icon { font-size: 28px; }
.brand-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 10px;
  background: rgba(255,255,255,.92); padding: 3px; flex: 0 0 44px; }
.brand strong { display: block; font-size: 15px; line-height: 1.35; }
.brand small { display: block; color: #9fb2cb; margin-top: 2px; font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent;
  color: #cbd7e6; padding: 8px 10px; border-radius: 9px; cursor: pointer; text-align: right; }
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(47, 111, 237, .35); }
.nav-item .ni { width: 22px; text-align: center; font-size: 16px; }
.nav-item .no { margin-right: auto; font-size: 10px; color: #8aa0bb; }
.nav-item.active .no { color: #dce8ff; }
.nav-group { border-bottom: 1px solid rgba(255, 255, 255, .08); padding-bottom: 5px; }
.nav-group-head { display: flex; align-items: center; gap: 9px; width: 100%; border: 0;
  background: transparent; color: #edf3fb; padding: 8px 10px; border-radius: 9px;
  cursor: pointer; text-align: right; font-size: 12px; font-weight: 600; }
.nav-group-head:hover { background: rgba(255, 255, 255, .08); }
.nav-group-head .ni { width: 22px; text-align: center; font-size: 15px; }
.nav-group-head .chev { margin-right: auto; font-size: 10px; transition: transform .15s; }
.nav-group:not(.open) .chev { transform: rotate(-90deg); }
.nav-group-items { display: none; padding-right: 15px; }
.nav-group.open .nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.nav-group-items .nav-item { font-size: 12px; padding: 6px 9px; }
.sidebar-footer { margin-top: auto; padding: 12px 10px 2px; color: #8197b2; font-size: 11px;
  border-top: 1px solid rgba(255, 255, 255, .1); display: flex; justify-content: space-between; align-items: center; }
.logout-btn { background: transparent; border: 1px solid rgba(255, 255, 255, .2); color: #d7e2f0;
  border-radius: 7px; padding: 4px 10px; cursor: pointer; font-size: 11px; }
.logout-btn:hover { background: rgba(255, 255, 255, .12); }

.main { flex: 1; min-width: 0; padding: 0 26px 34px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 0 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 21px; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.global-search { position: relative; }
.global-search input { width: 240px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; }
.search-results { position: absolute; top: 42px; right: 0; width: 330px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 30;
  max-height: 360px; overflow: auto; padding: 6px; }
.search-group { font-size: 11px; color: var(--muted); padding: 8px 10px 4px; }
.search-item { display: block; width: 100%; border: 0; background: transparent; text-align: right;
  padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.search-item:hover { background: var(--accent-soft); }
.bell { position: relative; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 7px 10px; cursor: pointer; font-size: 16px; }
.bell span { position: absolute; top: -5px; left: -5px; background: var(--red); color: #fff;
  border-radius: 20px; padding: 1px 5px; font-size: 10px; }
.user-chip { background: var(--accent-soft); color: var(--accent); border-radius: 20px;
  padding: 7px 12px; font-size: 12px; white-space: nowrap; }

/* ---------- عمومی ---------- */
.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.panel-head { padding: 13px 16px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h3 { margin: 0; font-size: 14px; }
.panel-body { padding: 14px 16px; }
.table-wrap { padding: 0; overflow-x: auto; }
.hint { color: var(--muted); font-size: 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; display: flex; align-items: center; gap: 11px; }
.card-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 10px; display: grid;
  place-items: center; font-size: 19px; background: var(--accent-soft); }
.card:nth-child(3n+2) .card-icon { background: #e7f7ee; }
.card:nth-child(3n+3) .card-icon { background: #fff4e2; }
.card-label { color: var(--muted); font-size: 11px; }
.card-value { font-size: 19px; font-weight: 700; margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.search input { min-width: 240px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; }
.btn { border: 1px solid transparent; border-radius: 8px; padding: 8px 13px; cursor: pointer; }
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn.danger { background: #fdecec; color: var(--red); border-color: #f6d4d3; }
.btn.small { padding: 5px 9px; font-size: 12px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 7px 14px;
  cursor: pointer; color: var(--muted); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th { background: #f8fafc; color: var(--muted); font-weight: 600; text-align: right;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 9px 12px; border-bottom: 1px solid #eef2f7; }
.data-table tbody tr:hover { background: #fafcff; }
.data-table td.actions { white-space: nowrap; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 3px 5px; border-radius: 6px; font-size: 16px; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn.danger:hover { background: #fdecec; color: var(--red); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 11px;
  background: #eef2f7; color: var(--muted); white-space: nowrap; }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.badge.green { background: #e7f7ee; color: var(--green); }
.badge.red { background: #fdecec; color: var(--red); }
.badge.amber { background: #fff4e2; color: var(--amber); }
.badge.gray { background: #eef2f7; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 14px; }
.empty .big { font-size: 28px; display: block; margin-bottom: 8px; }

.bars { display: flex; align-items: flex-end; gap: 7px; height: 140px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.bar-pair { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bar { width: 16px; border-radius: 4px 4px 0 0; min-height: 3px; }
.bar.income { background: var(--accent); }
.bar.expense { background: #f0a35e; }
.bar-group small { color: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 11px; color: var(--muted); margin-top: 8px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 4px; }
.dot.income { background: var(--accent); }
.dot.expense { background: #f0a35e; }
.status-list { display: flex; flex-wrap: wrap; gap: 9px; }
.status-chip { background: #f8fafc; border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; min-width: 120px; }
.status-chip strong { display: block; font-size: 17px; margin-top: 3px; }

/* ---------- مودالها و فرمها ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(12, 24, 40, .55); display: grid;
  place-items: center; padding: 18px; z-index: 50; }
.modal { background: #fff; width: min(720px, 100%); max-height: 90vh; overflow: auto;
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.detail-modal { width: min(900px, 100%); }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex;
  justify-content: flex-end; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--muted); }
.field .req { color: var(--red); }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; background: #fff; width: 100%; }
.field textarea { min-height: 70px; resize: vertical; }
.field input[type=checkbox] { width: auto; }
.date-wrap { display: flex; gap: 6px; align-items: stretch; }
.date-wrap .date-input { flex: 1; }
.date-pick { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer; padding: 0 10px; }
.fa-calendar { position: fixed; z-index: 120; width: 250px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .2);
  padding: 10px; font-size: 12px; }
.fa-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fa-cal-head button, .fa-today { border: 1px solid var(--line); background: #fff;
  border-radius: 7px; cursor: pointer; padding: 3px 9px; }
.fa-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.fa-weekday, .fa-day { height: 28px; display: grid; place-items: center; }
.fa-weekday { font-size: 10px; color: var(--muted); }
.fa-day { border: 0; background: transparent; border-radius: 7px; cursor: pointer; }
.fa-day:hover { background: var(--accent-soft); }
.fa-day.today { box-shadow: inset 0 0 0 1px var(--accent); }
.fa-day.selected { background: var(--accent); color: #fff; }
.fa-today { width: 100%; margin-top: 7px; }
.field:focus-within input, .field:focus-within select, .field:focus-within textarea {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.detail-item { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.detail-item span { display: block; color: var(--muted); font-size: 11px; }
.detail-item strong { display: block; margin-top: 3px; word-break: break-word; }
.detail-section h4 { margin: 16px 0 8px; font-size: 13px; }

/* ---------- تنظیمات و اعلانها ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-grid .field { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.sync-panel { border: 2px solid var(--accent); margin-bottom: 18px; }
.sync-status-box { background: #f0f7f4; border: 1px solid #b8d8c9; border-radius: 9px;
  padding: 10px 14px; font-size: 12.5px; color: #173a2b; }
.sync-actions-foot { flex-wrap: wrap; }
.topbar-title-wrap { display: flex; align-items: center; gap: 10px; }
.mobile-menu-btn { display: none; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; padding: 6px 11px; font-size: 18px; cursor: pointer; }
.sync-top-btn { white-space: nowrap; }
.backup-row { display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-bottom: 1px solid var(--line); }
.notice-item { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex;
  justify-content: space-between; gap: 10px; align-items: center; }
.notice-item.unread { background: var(--accent-soft); }

#toast-area { position: fixed; bottom: 18px; left: 18px; z-index: 100; display: flex;
  flex-direction: column; gap: 8px; }
.toast { background: #173a2b; color: #fff; padding: 10px 15px; border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 380px; }
.toast.error { background: #8b2f2c; }

@media (max-width: 1000px) {
  .layout { flex-direction: column; }
  .mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar { width: 100%; flex: none; display: none; }
  .sidebar.mobile-open { display: flex; }
  .nav { max-height: 360px; }
  .nav-item { width: 100%; }
  .main { padding: 0 12px 24px; }
  .grid-2, .grid-3, .form-grid, .settings-grid, .detail-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .topbar-tools { flex-wrap: wrap; justify-content: space-between; }
  .global-search { flex: 1 1 100%; }
  .global-search input { width: 100%; }
}
@media print {
  .sidebar, .topbar, .toolbar, .tabs, .modal-overlay, #toast-area, .btn { display: none !important; }
  .main { padding: 0; }
  .view, .tab-pane { display: none !important; }
  .view.active, .tab-pane.active { display: block !important; }
  .panel { box-shadow: none; border: 1px solid #bbb; }
}

/* ---------- لیست کارهای روزانه ---------- */
.daily-task-item { border: 1px solid var(--line); border-radius: 10px; padding: 11px; margin-bottom: 10px; background: #fff; }
.daily-task-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.daily-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.daily-check input { width: 18px; height: 18px; }
.daily-check span.done { text-decoration: line-through; color: var(--muted); }
.daily-summary { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
