* { box-sizing: border-box; }
body {
  font-family: Vazirmatn, Tahoma, sans-serif;
  margin: 0; background: #f1f5f9; color: #0f172a;
  display: flex; flex-direction: column; min-height: 100vh;
}
header {
  background: #1e293b; color: #e2e8f0;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.2rem; height: 60px;
}
header .brand { font-weight: 700; font-size: 1.05rem; }
header .spacer { flex: 1; }
header .workdate {
  background: #334155; padding: .35rem .8rem; border-radius: 8px;
  font-size: .85rem; color: #cbd5e1; cursor: pointer;
}
header .workdate:hover { background: #475569; }
header .user { font-size: .9rem; color: #cbd5e1; }
header button {
  background: #ef4444; color: #fff; border: none;
  padding: .45rem .9rem; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: .85rem;
}
header button:hover { background: #dc2626; }
.badge-warn {
  background: #f97316; color: #fff; padding: .25rem .6rem;
  border-radius: 8px; font-size: .75rem;
}
.layout { display: flex; flex: 1; }
nav {
  width: 230px; background: #fff; border-left: 1px solid #e2e8f0;
  padding: 1rem .6rem;
}
nav a {
  display: block; padding: .65rem .8rem; margin-bottom: .25rem;
  border-radius: 8px; color: #334155; text-decoration: none;
  font-size: .92rem; cursor: pointer;
}
nav a:hover { background: #f1f5f9; }
nav a.active { background: #1e293b; color: #fff; }
nav a.disabled { color: #94a3b8; cursor: not-allowed; }
nav a.disabled::after {
  content: "به‌زودی"; float: left; font-size: .68rem;
  background: #e2e8f0; color: #64748b; padding: 0 .4rem;
  border-radius: 6px; line-height: 1.5rem;
}
nav a .nav-badge {
  float: left; font-size: .7rem; background: #ef4444; color: #fff;
  min-width: 1.2rem; text-align: center; padding: 0 .35rem;
  border-radius: 10px; line-height: 1.3rem;
}
main { flex: 1; padding: 2rem; }
.welcome, .card, .panel {
  background: #fff; border-radius: 14px; padding: 1.5rem;
  border: 1px solid #e2e8f0; margin-bottom: 1.2rem;
}
h2 { margin-top: 0; }
.muted { color: #64748b; font-size: .92rem; line-height: 1.9; }
button.primary {
  background: #2563eb; color: #fff; border: none; padding: .55rem 1.1rem;
  border-radius: 8px; cursor: pointer; font-family: inherit; font-size: .9rem;
}
button.primary:hover { background: #1d4ed8; }
button.ghost {
  background: #e2e8f0; color: #334155; border: none; padding: .45rem .9rem;
  border-radius: 8px; cursor: pointer; font-family: inherit; font-size: .85rem;
}
button.danger {
  background: #fee2e2; color: #b91c1c; border: none; padding: .35rem .7rem;
  border-radius: 8px; cursor: pointer; font-family: inherit; font-size: .8rem;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: .6rem .5rem; border-bottom: 1px solid #f1f5f9; font-size: .9rem; }
th { color: #64748b; font-weight: 600; }
input, select {
  font-family: inherit; padding: .45rem .6rem; border: 1px solid #cbd5e1;
  border-radius: 8px; font-size: .9rem;
}
.row-low { background: #fef9c3; }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 6px; font-size: .75rem; }
.tag.yes { background: #dcfce7; color: #166534; }
.tag.no { background: #fee2e2; color: #991b1b; }
.tag.off { background: #e2e8f0; color: #475569; }
/* jp-admin-ui look (ADMIN-1, D-452) — badge variants; one meaning = one colour. AQ-1. */
.adm-badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; white-space: nowrap; }
.adm-badge.is-ok { background: #dcfce7; color: #166534; }
.adm-badge.is-off { background: #f1f5f9; color: #475569; }
.adm-badge.is-bad { background: #fee2e2; color: #991b1b; }
.adm-badge.is-hand { background: #fef3c7; color: #92400e; }
.adm-badge.is-info { background: #dbeafe; color: #1e40af; }
.adm-badge.is-plain { background: transparent; color: #334155; border: 1px solid #e2e8f0; }

/* برد بررسی */
.issue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 1rem; }
.pages { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
.pg {
  width: 40px; height: 40px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; color: #fff; font-size: .85rem;
  font-weight: 600; position: relative;
}
.pg.pending { background: #3b82f6; }
.pg.in_review { background: #eab308; }
.pg.done { background: #22c55e; }
.pg.no_content { background: #94a3b8; }
.pg.dim { opacity: .45; }
.pg .spin {
  position: absolute; width: 14px; height: 14px; border: 2px solid #fff;
  border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* نشانگر «بدون لایه متن» — گوشه‌ی نارنجی */
.pg.notext::after {
  content: ""; position: absolute; top: 0; left: 0;
  border-top: 12px solid #f97316; border-right: 12px solid transparent;
  border-top-right-radius: 0; border-top-left-radius: 8px;
}

/* مربع‌های فشرده‌ی برد جدولی */
.pgrow { display: flex; flex-wrap: wrap; gap: 3px; max-width: 360px; }
.pg-sm {
  width: 22px; height: 22px; border-radius: 5px; display: flex;
  align-items: center; justify-content: center; color: #fff; font-size: .68rem;
  font-weight: 600; position: relative;
}
.pg-sm.pending { background: #3b82f6; }
.pg-sm.in_review { background: #eab308; }
.pg-sm.done { background: #22c55e; }
.pg-sm.no_content { background: #94a3b8; }
.pg-sm.dim { opacity: .4; }
/* FAB-2b.1 §2.8: آیتمی پس از بستنِ صفحه بی‌تیتر استخراج شد */
.pg-sm.needs-title::before {
  content: "!"; position: absolute; bottom: -4px; right: -4px; width: 12px; height: 12px;
  border-radius: 50%; background: #dc2626; color: #fff; font-size: .55rem; line-height: 12px;
  text-align: center;
}
.pg-sm.notext::after {
  content: ""; position: absolute; top: 0; left: 0;
  border-top: 8px solid #f97316; border-right: 8px solid transparent;
}

/* progress bar باریک */
.pbar { height: 5px; background: #e2e8f0; border-radius: 3px; margin-top: .25rem; overflow: hidden; }
.pbar > span { display: block; height: 100%; background: #22c55e; }
tr.issue-done { background: #f0fdf4; }

/* مودال */
.modal-back {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: #fff; border-radius: 14px; padding: 1.5rem; width: 420px;
  max-width: 90vw;
}
.modal label { display: block; margin: .8rem 0 .3rem; font-size: .85rem; color: #475569; }
.modal input, .modal select { width: 100%; }
.modal .actions { display: flex; gap: .6rem; justify-content: flex-start; margin-top: 1.2rem; }
.notice { padding: .6rem .9rem; border-radius: 8px; font-size: .85rem; margin: .6rem 0; }
.notice.ok { background: #dcfce7; color: #166534; }
.notice.err { background: #fee2e2; color: #991b1b; }
.notice.warn { background: #fef3c7; color: #92400e; }

/* فوتر ثابت پایین همه‌ی صفحات لاگین‌شده */
.app-footer {
  background: #1e293b; color: #94a3b8; text-align: center;
  padding: .6rem 1rem; font-size: .8rem; letter-spacing: .2px;
}

/* تاریخ‌گزین شمسی */
.datepicker {
  position: absolute; z-index: 200; background: #fff; color: #0f172a;
  border: 1px solid #e2e8f0; border-radius: 12px; padding: .8rem;
  box-shadow: 0 12px 30px rgba(15,23,42,.25); width: 250px;
}
.datepicker .dp-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem;
}
.datepicker .dp-title { font-weight: 700; font-size: .92rem; }
.datepicker .dp-nav {
  background: #f1f5f9; color: #334155; border: none; border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.datepicker .dp-nav:hover { background: #e2e8f0; }
.datepicker .dp-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; direction: rtl;
}
.datepicker .dp-wd { text-align: center; font-size: .72rem; color: #94a3b8; padding: .2rem 0; }
.datepicker .dp-cell {
  text-align: center; padding: .35rem 0; border-radius: 7px; cursor: pointer;
  font-size: .82rem;
}
.datepicker .dp-cell.empty { cursor: default; }
.datepicker .dp-cell:not(.empty):hover { background: #eff6ff; }
.datepicker .dp-cell.today { border: 1px solid #2563eb; }
.datepicker .dp-cell.sel { background: #2563eb; color: #fff; }
.datepicker .dp-quick {
  display: flex; gap: .5rem; margin-top: .7rem; border-top: 1px solid #f1f5f9; padding-top: .6rem;
}
.datepicker .dp-quick button {
  flex: 1; background: #e2e8f0; color: #334155; border: none; border-radius: 8px;
  padding: .4rem; cursor: pointer; font-family: inherit; font-size: .82rem;
}
.datepicker .dp-quick button:hover { background: #cbd5e1; }

/* FX1: نشانگر و کلیدِ انتخابِ سردبیری */
.ed-star { color: #d97706; font-size: .95rem; }
.ed-toggle {
  display: flex; align-items: center; gap: .4rem; margin: .5rem 0;
  font-size: .85rem; color: #334155; cursor: pointer;
}
.ed-toggle input { width: auto; margin: 0; }

/* Blueprint LC §۴: toastِ غیرمسدودکننده (پیامِ گاردِ ویرایشِ نشریه‌ی تکمیل‌شده). */
.app-toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: .7rem 1.1rem; border-radius: 10px;
  font-size: .88rem; line-height: 1.9; max-width: 90vw; z-index: 2000;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .35);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.app-toast.on { opacity: 1; }

/* Blueprint LC §۳/§۴: دکمه‌های وضعیتِ چرخه‌ی حیات (برد + بنرِ فقط‌خواندنیِ بررسی). */
button.btn-reopen {
  background: #dcfce7; color: #166534; border: none; padding: .45rem .9rem;
  border-radius: 8px; cursor: pointer; font-family: inherit; font-size: .85rem;
}
button.btn-reopen:hover { background: #bbf7d0; }
button.btn-unpublish {
  background: #fee2e2; color: #b91c1c; border: none; padding: .45rem .9rem;
  border-radius: 8px; cursor: pointer; font-family: inherit; font-size: .85rem;
}
button.btn-unpublish:hover { background: #fecaca; }
button.btn-republish {
  background: #16a34a; color: #fff; border: none; padding: .45rem .9rem;
  border-radius: 8px; cursor: pointer; font-family: inherit; font-size: .85rem;
}
button.btn-republish:hover { background: #15803d; }
