@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #f5f6f8; --card: #fff; --text: #1f2933; --muted: #6b7280; --line: #e3e6ea;
  --primary: #1f5f8b; --primary-d: #174a6c; --ok: #1b7f4b; --ok-bg: #e7f6ee; --err: #b42318; --err-bg: #fdecea;
  --warn-bg: #fff6e0; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Vazirmatn, Tahoma, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.8; direction: rtl; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: var(--primary); color: #fff; }
.topbar .in { max-width: 1200px; margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topbar .brand { font-weight: 700; font-size: 16px; color: #fff; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.topbar nav a { color: #e6eef5; padding: 4px 10px; border-radius: 6px; }
.topbar nav a:hover, .topbar nav a.on { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.topbar .end a { color: #e6eef5; }

main { max-width: 1200px; margin: 0 auto; padding: 22px 18px 60px; }
main.narrow { max-width: 460px; }
main.medium { max-width: 900px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
.note { background: var(--warn-bg); border-radius: 8px; padding: 10px 14px; font-size: 14px; }

label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 14px; }
label .req { color: var(--err); }
input[type=text], input[type=number], input[type=password], input[type=tel], input:not([type]), select, textarea {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #cfd5dc; border-radius: 8px; background: #fff; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b9d3e6; border-color: var(--primary); }
textarea { min-height: 70px; resize: vertical; }
input.ltr { direction: ltr; text-align: right; }
.help { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.err { color: var(--err); font-size: 12.5px; margin-top: 2px; }
.has-err input, .has-err select, .has-err textarea { border-color: var(--err); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px 18px; }
.grid .wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 14px 18px 18px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 8px; color: var(--primary-d); }

.btn { display: inline-block; font: inherit; font-weight: 500; border: 0; border-radius: 8px; padding: 8px 18px; cursor: pointer;
  background: var(--primary); color: #fff; text-decoration: none; }
.btn:hover { background: var(--primary-d); text-decoration: none; }
.btn.light { background: #e8eef3; color: var(--primary-d); }
.btn.light:hover { background: #dbe5ec; }
.btn.danger { background: #fff; color: var(--err); border: 1px solid #f1b8b3; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
.actions { position: sticky; bottom: 0; background: rgba(245,246,248,.95); padding: 12px 0; display: flex; gap: 10px; }

table.t { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: right; vertical-align: middle; }
table.t th { background: #f0f3f6; font-weight: 500; position: sticky; top: 0; }
table.t tr:hover td { background: #fafbfc; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
td.c, th.c { text-align: center; }
.tag { display: inline-block; font-size: 12px; padding: 0 8px; border-radius: 20px; background: #eef2f6; color: #44505c; }
.tag.g { background: var(--ok-bg); color: var(--ok); }
.tag.r { background: var(--err-bg); color: var(--err); }
.tag.y { background: var(--warn-bg); color: #8a5a00; }
.score { font-weight: 700; }
.s-hi { color: var(--ok); } .s-mid { color: #8a5a00; } .s-lo { color: var(--err); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.stat b { display: block; font-size: 24px; color: var(--primary-d); }
.pager { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.pager a, .pager span { padding: 2px 10px; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
.pager span { background: var(--primary); color: #fff; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #c8d6e2; border-top-color: var(--primary); border-radius: 50%; animation: s 1s linear infinite; vertical-align: middle; }
@keyframes s { to { transform: rotate(360deg); } }
.toc { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.toc a { font-size: 13px; background: #fff; border: 1px solid var(--line); padding: 2px 10px; border-radius: 20px; }

@media (max-width: 600px) {
  main { padding: 14px 10px 60px; }
  .grid { grid-template-columns: 1fr; }
  h1 { font-size: 19px; }
}

.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 2px solid var(--line); }
.tabs a { padding: 6px 16px; border-radius: 8px 8px 0 0; color: var(--text); margin-bottom: -2px; border-bottom: 2px solid transparent; }
.tabs a.on { border-bottom-color: var(--primary); color: var(--primary-d); font-weight: 700; }
.tabs a:hover { text-decoration: none; background: #eef2f6; }
.bulkbar { position: sticky; bottom: 0; box-shadow: 0 -2px 8px rgba(0,0,0,.06); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 10px 16px; }
.bulkbar label { margin: 0; font-weight: 400; }
.scope { margin-bottom: 12px; }
.scope > label { font-weight: 400; margin-bottom: 2px; }

/* photos */
.photo-row { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.photo-box { width: 180px; height: 220px; border-radius: var(--radius); overflow: hidden; background: #eef2f6; border: 1px solid var(--line); flex: none; }
.photo-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.photo-ctl { flex: 1; min-width: 240px; }
input[type=file] { font: inherit; max-width: 100%; }

/* suggested cases */
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.case { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.case.locked { background: #fafbfc; }
.case-head { display: flex; align-items: center; gap: 10px; }
.case-head .rk { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.case-photo { width: 100%; height: 230px; object-fit: cover; border-radius: 8px; background: #eef2f6; }
.case-lock { height: 120px; border-radius: 8px; background: repeating-linear-gradient(45deg, #f0f3f6, #f0f3f6 10px, #e8edf2 10px, #e8edf2 20px); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
dl.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 500; }
.testbanner { background: #fff3cd; color: #7a5200; border: 1px dashed #e0b84c; border-radius: 8px; padding: 8px 14px; margin-bottom: 14px; font-size: 14px; }
.price { font-weight: 700; color: var(--primary-d); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 14px; }
.checks label { font-weight: 400; margin: 0; }
.flaglist { margin: 6px 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.flaglist li { font-size: 13px; padding: 3px 10px; border-radius: 6px; }
.flaglist li.ai { background: var(--err-bg); color: var(--err); }
.flaglist li.edit { background: var(--warn-bg); color: #8a5a00; }
.terms { background: #f5f7f9; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin-top: 8px; }
.case-photo-wrap { position: relative; }
.vbadge { position: absolute; bottom: 8px; right: 8px; background: rgba(27,127,75,.92); color: #fff; font-size: 12.5px; padding: 2px 10px; border-radius: 20px; }
table.t.two td.c, table.t.two th.c { width: 110px; }
