@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;800&display=swap');
* { box-sizing: border-box; margin: 0; padding: 0; }
body { margin: 0; font-family: 'Vazirmatn', Tahoma, sans-serif; background: #F3F5F2; }
.app {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: #F3F5F2;
  color: #17251F;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 172px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas: "top top" "rail main";
}
.loading { display:flex; align-items:center; justify-content:center; }
.loader { color:#6B7A72; font-size:15px; padding: 40px; }

.topbar {
  grid-area: top;
  background: #123528;
  color: #EAF3EE;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.brand { display:flex; align-items:center; gap:10px; }
.brand-mark {
  background:#1F7A52; color:#fff; font-weight:800; font-size:14px;
  padding:4px 10px; border-radius:8px; letter-spacing:1px;
}
.brand-name { font-weight:600; font-size:15px; }
.topbar-right { display:flex; align-items:center; gap:14px; }
.save-state { font-size:12px; color:#9FBFAF; }
.save-state.err { color:#F2B8B0; }
.topbar-link {
  color:#CFE3D8; text-decoration:none; font-size:16px; opacity:.85;
  display:inline-flex; align-items:center; justify-content:center;
  width:28px; height:28px; border-radius:8px;
}
.topbar-link:hover { background:#1A4535; opacity:1; }

.rail {
  grid-area: rail;
  background:#fff;
  border-left:1px solid #E2E7E1;
  padding:16px 10px;
  display:flex; flex-direction:column; gap:4px;
}
.tab {
  display:flex; align-items:center; gap:10px;
  background:none; border:none; cursor:pointer;
  font-family:inherit; font-size:14px; color:#4A5A51;
  padding:10px 12px; border-radius:10px; text-align:right;
  transition: background .15s;
  position:relative;
  width:100%;
}
.tab:hover { background:#F0F4EF; }
.tab.active { background:#123528; color:#fff; font-weight:600; }
.tab-icon { font-size:15px; width:18px; text-align:center; }
.badge {
  background:#C97B1B; color:#fff; font-size:11px; font-weight:700;
  border-radius:10px; padding:1px 7px; margin-right:auto;
}
.tab.active .badge { background:#E8A94B; color:#123528; }

.main { grid-area: main; padding: 28px 32px 60px; max-width: none; width: 100%; }

.page-title { font-size:24px; font-weight:800; }
.page-sub { color:#6B7A72; font-size:13px; margin-top:4px; margin-bottom:20px; }
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }

.card {
  background:#fff; border:1px solid #E2E7E1; border-radius:14px;
  padding:16px 18px; margin-bottom:12px;
}
.card-title { font-size:14px; font-weight:700; margin-bottom:10px; color:#123528; }

.btn {
  background:#1F7A52; color:#fff; border:none; cursor:pointer;
  font-family:inherit; font-size:14px; font-weight:600;
  padding:9px 18px; border-radius:10px;
  transition: background .15s;
}
.btn:hover { background:#16694F; }
.btn.ghost { background:#E3F0EA; color:#16694F; }
.btn.ghost:hover { background:#D2E6DC; }
.btn.xs { padding:6px 12px; font-size:12px; }
.btn.danger-ghost { background:none; color:#B3261E; border:1px solid #EBC5C1; margin-top:12px; }
.btn.danger-ghost:hover { background:#FBF0EF; }
.btn:disabled { opacity:.5; cursor:default; }
.link-btn { background:none; border:none; color:#9AA8A0; cursor:pointer; font-family:inherit; font-size:12px; }
.link-btn:hover { color:#B3261E; }

.input {
  font-family:inherit; font-size:14px;
  border:1px solid #D5DCD4; border-radius:10px;
  padding:9px 12px; background:#FBFCFA; color:#17251F;
  outline:none;
}
.input:focus { border-color:#1F7A52; box-shadow:0 0 0 3px #1F7A5222; }
.input.sm { padding:7px 10px; font-size:13px; }
.input.xs { padding:5px 9px; font-size:12px; }
.input.num { width:70px; text-align:center; }
.input.grow { flex:1; }
.input.wide { grid-column: 1 / -1; }

.row { display:flex; gap:8px; align-items:center; margin-top:8px; flex-wrap:wrap; }
.form-card { border-color:#1F7A5255; }
.form-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:10px; margin-bottom:12px; }
.filter-row { display:flex; gap:8px; margin-bottom:14px; flex-wrap:wrap; }

.stat-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:12px; margin-bottom:20px; }
.stat {
  background:#fff; border:1px solid #E2E7E1; border-radius:14px;
  padding:16px; text-align:right; cursor:pointer; font-family:inherit;
  transition: transform .12s, box-shadow .12s;
}
.stat:hover { transform:translateY(-2px); box-shadow:0 4px 14px #12352814; }
.stat-num { font-size:28px; font-weight:800; color:#123528; }
.stat-label { font-size:12px; color:#6B7A72; margin-top:2px; }
.stat.hot { border-color:#C97B1B; background:#FDF7EE; }
.stat.hot .stat-num { color:#C97B1B; }
.stat.danger { border-color:#C2402A; background:#FCF1EF; }
.stat.danger .stat-num { color:#C2402A; }

.dash-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:12px; }
.mini-row { display:flex; flex-direction:column; padding:8px 0; border-bottom:1px dashed #EAEEE9; }
.mini-row:last-child { border-bottom:none; }
.mini-main { font-size:13px; font-weight:600; }
.mini-meta { font-size:12px; color:#6B7A72; margin-top:2px; }
.mini-row.due .mini-main { color:#B3261E; }
.down-text { color:#C2402A; }
.empty { color:#9AA8A0; font-size:13px; padding:6px 0; }
.empty.big { text-align:center; padding:36px 16px; }

.project-head { display:flex; justify-content:space-between; align-items:center; cursor:pointer; }
.project-name { font-size:16px; font-weight:700; }
.project-meta { display:flex; gap:14px; flex-wrap:wrap; font-size:12px; color:#6B7A72; margin-top:4px; }
.site { color:#2B5FA8; }
.expander { color:#9AA8A0; font-size:18px; }
.project-card.clickable { display:block; width:100%; text-align:right; font-family:inherit; cursor:pointer; transition:border-color .15s, transform .12s; }
.project-card.clickable:hover { border-color:#1F7A52; transform:translateY(-1px); }
.goal { background:#F0F6F2; border-radius:10px; padding:9px 12px; font-size:13px; margin-bottom:14px; }
.kw-list { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:6px; }
.kw-chip {
  display:inline-flex; align-items:center; gap:6px;
  background:#EDF2EC; border-radius:8px; padding:4px 10px; font-size:13px;
}
.kw-rank { color:#1F7A52; font-size:11px; }
.kw-x { background:none; border:none; cursor:pointer; color:#9AA8A0; font-size:14px; padding:0; }
.kw-x:hover { color:#B3261E; }

/* --- میز کار پروژه --- */
.back-btn {
  background:none; border:none; font-family:inherit; cursor:pointer;
  font-size:13px; font-weight:700; color:#1F7A52; padding:0; margin-bottom:12px;
}
.back-btn:hover { text-decoration:underline; }
.section-card { margin-bottom:14px; }
.count-hint { font-size:11px; font-weight:500; color:#9AA8A0; margin-right:6px; }
.status-group { margin-top:14px; }
.status-group-head {
  font-size:11.5px; font-weight:800; padding:3px 10px; border-radius:7px;
  display:inline-block; margin-bottom:6px;
}
.sg-todo { background:#EDF0EC; color:#6B7A72; }
.sg-doing { background:#E7EEF8; color:#2B5FA8; }
.sg-review { background:#FAF0DF; color:#C97B1B; }
.sg-done { background:#E7F3EC; color:#1F7A52; }
.detail-task-row {
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  padding:9px 2px; border-bottom:1px dashed #EAEEE9;
}
.detail-task-row:last-child { border-bottom:none; }
.dt-title { font-size:13px; font-weight:600; flex:1; min-width:140px; }
.dt-meta { font-size:11.5px; color:#6B7A72; white-space:nowrap; }

/* --- نمای کامل داشبورد --- */
.overview-card { margin-bottom:14px; }
.ov-table { overflow-x:auto; }
.ov-row {
  display:grid; grid-template-columns: 1.4fr .8fr 44px 44px 48px 1.6fr;
  gap:10px; align-items:center; padding:9px 2px;
  border-bottom:1px solid #EFF2EE; font-size:13px;
  min-width:520px;
}
.ov-row:last-child { border-bottom:none; }
.ov-row.head { font-size:11px; font-weight:700; color:#6B7A72; }
.ov-name { font-weight:700; }
.ov-owner { color:#6B7A72; font-size:12px; }
.ov-bad { color:#C2402A; font-weight:800; }
.ov-warn { color:#C97B1B; font-weight:800; }
.ov-dim { color:#C3CCC2; }
.ov-plan { font-size:12px; color:#4A5A51; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.done-text { text-decoration:line-through; color:#9AA8A0; }
.pill { background:#EDF2EC; border-radius:6px; padding:2px 8px; font-size:11px; font-weight:600; color:#4A5A51; }
.overdue { color:#B3261E; font-weight:700; }
.label-chip { font-size:11px; font-weight:700; border:1px solid; border-radius:6px; padding:1px 8px; }

/* --- بورد کانبان --- */
.board { display:flex; gap:12px; align-items:flex-start; overflow-x:auto; padding-bottom:16px; }
.col {
  flex:1; min-width:230px; background:#EAEEE8; border-radius:14px;
  padding:10px; border:2px dashed transparent;
  transition: border-color .15s, background .15s;
}
.col-hover { border-color:#1F7A52; background:#E0EDE5; }
.col-head {
  display:flex; justify-content:space-between; align-items:center;
  font-size:13px; font-weight:800; color:#123528;
  padding:2px 6px 8px; margin-bottom:8px;
}
.col-todo .col-head { border-bottom:3px solid #C3CCC2; }
.col-doing .col-head { border-bottom:3px solid #2B5FA8; }
.col-review .col-head { border-bottom:3px solid #C97B1B; }
.col-done .col-head { border-bottom:3px solid #1F7A52; }
.col-count { background:#fff; border-radius:8px; padding:0 8px; font-size:11px; color:#6B7A72; font-weight:600; }
.col-empty {
  border:1.5px dashed #C3CCC2; border-radius:10px; padding:18px 10px;
  text-align:center; font-size:12px; color:#9AA8A0;
}
.tcard {
  background:#fff; border:1px solid #E2E7E1; border-radius:12px;
  padding:10px 12px; margin-bottom:8px;
  box-shadow:0 1px 2px #12352808;
}
.tcard-lifting { opacity:.35; }
.tcard-top { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.drag-handle {
  margin-inline-start:auto; cursor:grab; touch-action:none; user-select:none;
  color:#9AA8A0; font-size:17px; line-height:1; padding:2px 6px; border-radius:6px;
}
.drag-handle:hover { background:#F0F4EF; color:#123528; }
.drag-handle:active { cursor:grabbing; }
.tcard-title { font-size:13px; font-weight:700; margin-bottom:6px; }
.tcard-meta { display:flex; gap:8px; flex-wrap:wrap; align-items:center; font-size:11px; color:#6B7A72; margin-bottom:4px; }
.tcard-criteria { font-size:11px; color:#16694F; background:#F0F6F2; border-radius:8px; padding:5px 8px; margin:6px 0 4px; }
.tcard-foot { display:flex; justify-content:space-between; align-items:center; margin-top:6px; }
.drag-ghost {
  position:fixed; z-index:999; pointer-events:none;
  transform:translate(-50%,-60%) rotate(-2deg);
  background:#123528; color:#fff; font-size:13px; font-weight:600;
  padding:9px 16px; border-radius:10px; max-width:230px;
  box-shadow:0 10px 28px #12352855;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.table-card { padding:6px 18px; }
.rank-row {
  display:grid; grid-template-columns: 1fr 80px 70px 70px 150px;
  gap:10px; align-items:center; padding:11px 0;
  border-bottom:1px solid #EFF2EE; font-size:13px;
}
.rank-row:last-child { border-bottom:none; }
.rank-row.head { font-size:11px; font-weight:700; color:#6B7A72; }
.rank-kw { font-weight:600; }
.rank-current { font-size:16px; font-weight:800; color:#123528; }
.rank-input-wrap { display:flex; gap:6px; align-items:center; }
.delta { font-size:12px; font-weight:700; }
.delta.up { color:#1F7A52; }
.delta.down { color:#C2402A; }
.delta.flat { color:#9AA8A0; }
.spark { display:block; }
.spark-empty { color:#C9D2CB; }

.reminder-card { display:flex; align-items:center; gap:12px; padding:12px 16px; }
.reminder-main { display:flex; align-items:center; gap:10px; flex:1; font-size:14px; cursor:pointer; }
.reminder-main input { width:16px; height:16px; accent-color:#1F7A52; cursor:pointer; }
.reminder-date { font-size:12px; color:#6B7A72; }
.done-card { opacity:.55; }

/* --- مشاور هوشمند (غیرفعال) --- */
.ai-disabled { text-align:center; padding:40px 16px; color:#6B7A72; }
.ai-disabled .lock { font-size:26px; display:block; margin-bottom:10px; }

/* --- صفحه ورود --- */
.login-body {
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:#F3F5F2; font-family:'Vazirmatn', Tahoma, sans-serif;
}
.login-box {
  background:#fff; border:1px solid #E2E7E1; border-radius:16px;
  padding:32px 28px; width:100%; max-width:340px;
  display:flex; flex-direction:column; gap:12px;
  box-shadow:0 8px 30px #12352814;
}
.login-brand { display:flex; align-items:center; gap:10px; justify-content:center; margin-bottom:10px; }
.login-error { background:#FCF1EF; color:#B3261E; border:1px solid #EBC5C1; border-radius:8px; padding:8px 12px; font-size:13px; }
.login-msg { background:#F0F6F2; color:#16694F; border:1px solid #BFE0CE; border-radius:8px; padding:8px 12px; font-size:13px; }

/* --- صفحه تنظیمات --- */
.settings-wrap { max-width:420px; margin:40px auto; padding:0 16px; }
.settings-back { display:inline-block; margin-bottom:14px; font-size:13px; color:#1F7A52; text-decoration:none; font-weight:700; }

@media (max-width: 720px) {
  .app { grid-template-columns:1fr; grid-template-rows:56px auto 1fr; grid-template-areas:"top" "rail" "main"; }
  .rail { flex-direction:row; overflow-x:auto; border-left:none; border-bottom:1px solid #E2E7E1; padding:8px 10px; }
  .tab { white-space:nowrap; width:auto; }
  .main { padding:18px 14px 60px; }
  .col { min-width:78vw; }
  .rank-row { grid-template-columns: 1fr 60px 55px; }
  .rank-row .spark, .rank-row.head span:nth-child(4) { display:none; }
  .rank-input-wrap { grid-column: 1 / -1; }
  .rank-row.head span:nth-child(5) { display:none; }
}
