/* سامانه کلاس — طراحی تخته‌ای، راست‌به‌چپ، بدون وابستگی خارجی */
@font-face { font-family: "Vazirmatn"; src: local("Vazirmatn"), url("../fonts/Vazirmatn-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: local("Vazirmatn Bold"), url("../fonts/Vazirmatn-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --board: #1d3a34; --board-2: #274a42; --chalk: #f2f5f1; --yellow: #e8b931;
  --bg: #edf0ed; --card: #fff; --ink: #17211f; --muted: #5d6a66; --line: #d6ddd9;
  --ok: #2b7a58; --ok-bg: #e3f2ea; --err: #a93a2e; --err-bg: #fbe9e6; --warn-bg: #fdf3d7; --warn: #8a6a00;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif; line-height: 1.85; }
a { color: var(--board-2); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 18px; }
main.wrap { padding-top: 24px; padding-bottom: 60px; }

/* نوار بالا: تخته */
.top { background: var(--board); color: var(--chalk); border-bottom: 4px solid var(--yellow); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; flex-wrap: wrap; }
.brand { color: var(--chalk); font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: .2px; }
.top nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; }
.top nav a, .top nav .link { color: var(--chalk); text-decoration: none; font-size: .95rem; opacity: .9; }
.top nav a:hover, .top nav .link:hover { opacity: 1; text-decoration: underline; text-decoration-color: var(--yellow); text-underline-offset: 6px; }
.top .who { color: var(--yellow); font-size: .9rem; }
.top form { margin: 0; display: inline; }
.link { background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash ul { margin: 0; padding-inline-start: 20px; }
.flash.ok { background: var(--ok-bg); border-color: #b5dcc7; color: #17533a; }
.flash.err { background: var(--err-bg); border-color: #efc2bb; color: #7d251c; }
.flash.warn { background: var(--warn-bg); border-color: #ecd68b; color: var(--warn); }

h1 { font-size: 1.6rem; margin: 0 0 4px; line-height: 1.5; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: .92rem; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 18px; }
.card > h2 { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .g2, .g3 { grid-template-columns: 1fr; } }
.stat { text-align: center; }
.stat b { display: block; font-size: 2rem; line-height: 1.3; }

/* دکمه‌ها */
.btn { display: inline-block; border: 1px solid var(--board); background: var(--board); color: var(--chalk); padding: 8px 18px; border-radius: 7px; font: inherit; font-size: .95rem; cursor: pointer; text-decoration: none; line-height: 1.6; }
.btn:hover { background: var(--board-2); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, .link:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.btn.yellow { background: var(--yellow); border-color: var(--yellow); color: #231c00; font-weight: 700; }
.btn.yellow:hover { background: #f1c94d; }
.btn.ghost { background: transparent; color: var(--board); }
.btn.ghost:hover { background: #e4ebe7; }
.btn.danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn.danger:hover { background: var(--err-bg); }
.btn.sm { padding: 3px 12px; font-size: .85rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

/* فرم */
label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=time], select, textarea, input[type=file] {
  width: 100%; padding: 9px 12px; border: 1px solid #b9c4bf; border-radius: 7px; background: #fff; font: inherit; color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--board); vertical-align: middle; margin-inline-end: 6px; }
.field { margin-bottom: 14px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; margin-bottom: 8px; }
.check input { margin-top: 5px; flex: none; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 3px; }
.err-text { color: var(--err); font-size: .88rem; margin-top: 3px; }
.dt { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; direction: ltr; }
.dt input { direction: ltr; text-align: center; }
.ltr { direction: ltr; unicode-bidi: plaintext; }

/* جدول */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 700; background: #f6f8f6; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: .8rem; background: #e8ece9; color: #33423d; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: #17533a; }
.badge.err { background: var(--err-bg); color: #7d251c; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 3px 12px; font-size: .9rem; }
.code { font-family: Consolas, monospace; letter-spacing: 3px; font-size: 1.1rem; background: var(--board); color: var(--yellow); padding: 1px 12px; border-radius: 6px; direction: ltr; display: inline-block; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { direction: ltr; font-size: .85rem; }
.empty { color: var(--muted); padding: 10px 0; }

/* ورود */
.login { max-width: 880px; margin: 30px auto 0; }
.login .lead { font-size: 1.05rem; color: var(--muted); margin-bottom: 22px; }
.chalk-card { background: var(--board); color: var(--chalk); border-radius: 12px; padding: 26px; border: 1px solid #0f241f; }
.chalk-card label { color: var(--chalk); }
.chalk-card h2 { color: var(--yellow); }
.chalk-card input { border-color: transparent; }
.chalk-card .err-text { color: #ffb4a8; }
.chalk-card .hint { color: #b8c9c3; }
.chalk-card .code-input { text-transform: uppercase; letter-spacing: 4px; text-align: center; direction: ltr; font-size: 1.2rem; }

/* آزمون */
.q { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; background: #fcfdfc; }
.q-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; }
.opt { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt .tag { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #e8ece9; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; font-weight: 400; background: #fff; }
.choice:has(input:checked) { border-color: var(--board); background: #eaf1ee; }
.choice.right { border-color: var(--ok); background: var(--ok-bg); }
.choice.wrong { border-color: var(--err); background: var(--err-bg); }
.timer { position: sticky; top: 0; z-index: 5; background: var(--board); color: var(--yellow); border-radius: 0 0 10px 10px; padding: 8px 18px; text-align: center; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 16px; }
.timer.low { background: var(--err); color: #fff; }
.score { font-size: 2.4rem; font-weight: 700; line-height: 1.4; }

.star-line { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.star-line:last-child { border-bottom: 0; }
.star-line .ico { font-size: 1.4rem; line-height: 1.5; }

/* پیشرفت آپلود */
.upload-progress { display: none; margin-top: 10px; }
.upload-progress .bar-bg { height: 10px; background: #dfe6e2; border-radius: 99px; overflow: hidden; }
.upload-progress .bar-fg { height: 100%; width: 0; background: var(--yellow); transition: width .2s; }
.upload-progress .txt { font-size: .85rem; color: var(--muted); margin-top: 4px; }

@media print {
  .top, .actions, .btn, form, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
