:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #e3e6eb;
  --accent: #0f6e5a;
  --accent-soft: #e6f3ef;
  --warn: #a15c00;
  --danger: #b42318;
  --ok: #1a7f37;
  --radius: 10px;
  font-family: "Vazirmatn", "Vazir", "IRANSans", Tahoma, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.8; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.ok { color: var(--ok); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
.ltr { direction: ltr; text-align: left; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.brand span { font-weight: 400; font-size: .85rem; color: var(--muted); margin-inline-start: .5rem; }
.logout { display: flex; align-items: center; gap: .6rem; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.sidebar { background: var(--surface); border-inline-end: 1px solid var(--border); padding: 1rem .75rem; }
.sidebar a { display: block; padding: .45rem .75rem; border-radius: 8px; color: var(--text); }
.sidebar a.active, .sidebar a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
main { padding: 1.5rem; min-width: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.panel { margin-bottom: 1rem; }
.card h2 { font-size: .9rem; color: var(--muted); font-weight: 500; }
.big { font-size: 1.9rem; font-weight: 700; margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid2 .panel { margin: 0; }
.counts { list-style: none; margin: 0; padding: 0; }
.counts li { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px dashed var(--border); }
.counts li:last-child { border-bottom: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
th { font-weight: 600; font-size: .85rem; color: var(--muted); white-space: nowrap; background: #fafbfc; }
tbody tr:hover { background: #fafbfc; }

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-bottom: 1rem; }
.filters label, .stack label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: .2rem; }
.stack { display: grid; gap: .75rem; max-width: 560px; }
.stack label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); }
input, select, textarea {
  font: inherit; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); min-width: 0;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  font: inherit; display: inline-block; padding: .4rem .9rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.small { padding: .15rem .6rem; font-size: .85rem; }
form.inline { display: inline; }

.notice { background: var(--accent-soft); border: 1px solid #b9ddd2; padding: .6rem .9rem; border-radius: 8px; }
.error { color: var(--danger); }
.errors { color: var(--danger); }
.gate { border: 1px solid #f2d3a8; background: #fff8ee; border-radius: 8px; padding: .5rem 1rem; }
.gate h3 { margin-top: .25rem; color: var(--warn); }
.article .lead { font-weight: 600; }
.article img { max-width: 100%; border-radius: 8px; margin-top: .5rem; }
.review, .queue-item { border-bottom: 1px solid var(--border); padding: .5rem 0 .75rem; }
.queue-item:last-child, .review:last-child { border-bottom: 0; }
.decide { display: flex; flex-wrap: wrap; gap: .5rem; }
.decide input { flex: 1 1 260px; }
.pager { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: min(380px, 100%); }
.login-card form { display: grid; gap: .9rem; }
.login-card label { display: grid; gap: .25rem; font-size: .9rem; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; gap: .25rem; border-inline-end: 0; border-bottom: 1px solid var(--border); padding: .5rem; }
  .sidebar a { white-space: nowrap; }
  main { padding: 1rem; }
}
