@font-face {
  font-family: Vazirmatn;
  src: url("fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url("fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url("fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

body,
input,
button,
select,
textarea {
  font-family: Vazirmatn, Tahoma, sans-serif;
}

body {
  margin: 0;
  background: #f4f5f7;
  color: #1c1c1c;
  line-height: 1.7;
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: #1f3b57;
  color: #fff;
  padding: 0.7rem 1.2rem;
}

.who {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.who form {
  margin: 0;
}

.layout {
  display: flex;
  min-height: calc(100vh - 3.2rem);
}

.menu {
  width: 16rem;
  background: #fff;
  border-left: 1px solid #ddd;
  padding: 0.4rem 0;
  flex-shrink: 0;
}

.menu a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  text-decoration: none;
}

.menu-badge {
  background: #b00020;
  color: #fff;
  border-radius: 999px;
  min-width: 1.3rem;
  padding: 0 0.35rem;
  text-align: center;
  font-size: 0.85rem;
}

.tabs {
  display: flex;
  gap: 1rem;
}

.tabs a.active {
  font-weight: 700;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin-bottom: 1rem;
}

.history {
  width: 100%;
  border-collapse: collapse;
}

.history th,
.history td {
  border-bottom: 1px solid #ddd;
  padding: 0.4rem;
  text-align: right;
  vertical-align: top;
}

.box-card details {
  margin-top: 0.4rem;
}

.menu a.sub {
  padding-right: 1.8rem;
  font-size: 0.92rem;
}

.menu a.active,
.menu a:hover {
  background: #e7eef5;
}

.settings table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  margin: 0.4rem 0 1rem;
}

.settings th,
.settings td {
  border-bottom: 1px solid #e4e4e4;
  padding: 0.4rem;
  text-align: right;
  vertical-align: top;
}

.settings input,
.settings select,
.settings textarea {
  width: auto;
  min-width: 6rem;
  max-width: 100%;
}

.settings input[type="checkbox"] {
  width: auto;
  min-width: 0;
}

.settings textarea {
  width: 14rem;
  min-height: 3.2rem;
}

.settings textarea.wide,
.settings pre.criteria {
  width: 100%;
  box-sizing: border-box;
}

.settings pre.criteria {
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid #ddd;
  padding: 0.6rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-end;
  margin: 0.3rem 0;
}

.inline-form label {
  margin: 0;
}

.field-error {
  color: #9b1c1c;
  display: block;
  font-size: 0.9rem;
}

.confirm-toggle {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  margin-top: 0.3rem;
}

.confirm-box {
  display: none;
  margin: 0.3rem 0;
  padding: 0.4rem 0.6rem;
  background: #fff4e5;
  border: 1px solid #e6c48a;
  border-radius: 6px;
}

.confirm-toggle:has(input:checked) + .confirm-box {
  display: block;
}

.remind {
  background: #fff8d8;
  border: 1px solid #e6d48a;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  margin: 0.4rem 0;
}

.diff del {
  background: #ffd6d6;
  text-decoration: line-through;
}

.diff ins {
  background: #d8f5d8;
  text-decoration: none;
}

.tree {
  list-style: disc;
}

.archived {
  color: #777;
}

.check-ok { color: #176b2a; }
.check-bad { color: #9b1c1c; }
.check-warn { color: #8a5a00; }

.content {
  flex: 1;
  padding: 1.2rem 1.4rem;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 1rem;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  min-width: 9rem;
}

.card strong {
  display: block;
  font-size: 1.7rem;
}

.hint {
  color: #555;
  font-size: 0.92rem;
}

.status {
  margin-top: 1.4rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  max-width: 52rem;
}

.status h2 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
}

.status ul {
  margin: 0;
  padding-right: 1.1rem;
}

.status li.stale {
  color: #9b1c1c;
  font-weight: 700;
}

.notice {
  background: #fff4e5;
  border: 1px solid #e6c48a;
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
}

button {
  font-size: inherit;
  background: #1f3b57;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.2rem 1.3rem 1.4rem;
  width: 100%;
  max-width: 24rem;
}

.login-card h1 {
  margin-bottom: 0.3rem;
}

label {
  display: block;
  margin-top: 0.8rem;
}

input,
select,
textarea {
  font-size: inherit;
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.5rem;
}

.login-card button {
  margin-top: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.filters label {
  margin: 0;
  min-width: 10rem;
}

.filters button {
  margin-bottom: 0.1rem;
}

.card {
  display: block;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0.6rem 0;
  color: inherit;
  text-decoration: none;
}

.card.stale {
  background: #fff4e5;
  border-color: #ef6c00;
}

.card h3 {
  margin: 0 0 0.3rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.85rem;
  color: #fff;
}

.tag-breaking { background: #c62828; }
.tag-follow { background: #1565c0; }
.tag-conflict { background: #ef6c00; }
.tag-irrelevant { background: #6a1b9a; }
.tag-duplicate { background: #455a64; }
.tag-progress { background: #00838f; }
.tag-rescued { background: #2e7d32; }

.soon {
  background: #eef3f8;
  border: 1px dashed #1f3b57;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}

button:disabled {
  background: #9aa7b2;
  cursor: not-allowed;
}

.warn,
.warn li {
  color: #8a5a00;
  background: #fff4e5;
}

.saved {
  color: #1b5e20;
}

.hint {
  color: #555;
  font-size: 0.9rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.6rem 0 1rem;
}

.actions form {
  margin: 0;
}

.dialog-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 1rem;
}

.dialog-back[hidden] {
  display: none;
}

.dialog {
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  width: 100%;
  max-width: 28rem;
}

.card form {
  margin-top: 0.4rem;
}

.review-columns {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.review-columns > section {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.8rem 1rem;
}

.sources {
  max-height: 80vh;
  overflow: auto;
}

.field {
  border-bottom: 1px solid #eee;
  padding: 0.6rem 0;
}

.field-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.3rem;
}

.field-head button,
.text-button {
  font-size: 0.85rem;
  text-decoration: none;
}

.article p,
.article h2 {
  margin: 0.4rem 0;
}

.draft-image img {
  max-width: 100%;
  height: auto;
}

.ltr {
  direction: ltr;
  text-align: left;
}

.source {
  border-top: 1px solid #eee;
  padding-top: 0.6rem;
}

.source-body {
  white-space: pre-wrap;
}

.explanations {
  list-style: none;
  padding: 0;
}

.explanations li {
  margin: 0.25rem 0;
}

.ai-review-admin {
  margin: 0.6rem 0;
  border: 1px solid #ddd;
  padding: 0.4rem 0.8rem;
}

.factor-table {
  border-collapse: collapse;
  margin: 0.6rem 0;
}

.factor-table th,
.factor-table td {
  border: 1px solid #ddd;
  padding: 0.3rem 0.6rem;
  text-align: right;
}

.settings-wide {
  overflow-x: auto;
}

.covered {
  color: #6b7280;
}

.tree-row {
  margin: 0.35rem 0;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline;
}

@media (max-width: 900px) {
  .review-columns {
    display: block;
  }

  .sources {
    max-height: none;
    margin-top: 1rem;
  }
}
