/*
 * سامانهٔ رفاهی فولاد سبا — جهت بصری «باغ ایرانی».
 * فیروزه‌ای عمیق و زعفرانی روی زمینهٔ کرم. همهٔ رنگ‌ها و قلم‌ها فقط از همین توکن‌ها
 * خوانده می‌شوند. لوگو: static/img/logo.png (کامل) و static/img/mark.png (نشان).
 */
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Variable.woff2") format("woff2-variations"), url("../fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Lalezar";
  src: url("../fonts/Lalezar-Arabic.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  /* برند: فیروزه‌ای و زعفرانی */
  --brand: #0f4c4a;
  --brand-strong: #0a3836;
  --brand-soft: #e2efeb;
  --brand-ink: #fbf7ee;
  --saffron: #e8b03a;
  --saffron-strong: #c4861a;
  --saffron-soft: #fbeccb;
  --saffron-ink: #7d5208;

  /* وضعیت‌ها (جدا از رنگ برند) */
  --ok: #1f8a5b;     --ok-soft: #e1f2e8;    --ok-ink: #145e3d;
  --warn: #c4861a;   --warn-soft: #fbeccb;  --warn-ink: #7d5208;
  --err: #b8443a;    --err-soft: #f8e4e0;   --err-ink: #8a2e26;

  /* خنثی‌ها: کرم و کاهگلی با ته‌رنگ فیروزه‌ای در متن */
  --ink: #16302e;
  --muted: #677874;
  --line: #e9dfc8;
  --surface: #fffdf8;
  --surface-2: #f5eedf;
  --bg: #f7f2e7;
  --queue: #ece2cb;

  --font: "Vazirmatn", Tahoma, sans-serif;
  --display: "Lalezar", "Vazirmatn", Tahoma, sans-serif;
  --r-sm: 10px;
  --r: 18px;
  --r-lg: 24px;
  --shadow: 0 1px 2px rgba(22, 48, 46, .06), 0 14px 32px -20px rgba(15, 76, 74, .45);
  --nav-h: 64px;

  /* نقش کاشی: ستاره‌های هشت‌پر محو */
  --tile: radial-gradient(circle at 0 0, transparent 14px, rgba(232, 176, 58, .12) 15px, transparent 16.5px),
          radial-gradient(circle at 100% 100%, transparent 14px, rgba(232, 176, 58, .12) 15px, transparent 16.5px),
          radial-gradient(circle at 50% 50%, rgba(251, 247, 238, .07) 0 4px, transparent 5px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.8;
  color: var(--ink); background: var(--bg);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { line-height: 1.4; text-wrap: balance; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .75em; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; }
code { font-size: .9em; background: var(--surface-2); padding: 0 6px; border-radius: 6px; direction: ltr; unicode-bidi: embed; }

/* ---------- سربرگ ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .inner { max-width: 1080px; margin: 0 auto; padding-inline: 16px; min-height: 60px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 800; font-size: 1.02rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .logo-full { height: 44px; width: auto; }
.brand .logo-mark { display: none; height: 36px; width: 36px; }
.brand .sys { padding-inline-start: 12px; border-inline-start: 2px solid var(--saffron); line-height: 1.3; }
.brand .sys small { display: block; color: var(--muted); font-weight: 500; font-size: .72rem; }
@media (max-width: 720px) {
  .brand .logo-full { display: none; }
  .brand .logo-mark { display: block; }
}
.top-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top-nav a { color: var(--muted); padding: 6px 12px; border-radius: 99px; font-weight: 500; }
.top-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.top-nav a.on { background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; }
.spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; font-weight: 800; flex: none; }
.who .name { color: var(--muted); font-size: .9rem; }

/* ناوبری پایین برای موبایل متقاضی */
.bottom-nav { display: none; }
@media (max-width: 720px) {
  .site-header .top-nav, .who .name { display: none; }
  body.applicant main { padding-bottom: calc(var(--nav-h) + 32px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav {
    display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 10;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bottom-nav a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 8px 0 10px; color: var(--muted); font-size: .75rem; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a.on { color: var(--brand); font-weight: 700; }
  .bottom-nav svg { width: 22px; height: 22px; }
  /* مدیران روی موبایل: نوار بالایی افقی قابل پیمایش */
  body.staff .site-header .top-nav { display: flex; flex-wrap: nowrap; overflow-x: auto; order: 5; width: 100%; padding-bottom: 8px; }
  body.staff .site-header .inner { flex-wrap: wrap; }
}

main { max-width: 1080px; margin: 0 auto; padding-inline: 16px; padding-block: 24px 48px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { margin: 0; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { color: var(--muted); font-size: .85rem; }

/* ---------- اجزای پایه ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; min-width: 0; }
.card > :last-child { margin-bottom: 0; }
.card.narrow { max-width: 560px; margin-inline: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.stack { display: grid; gap: 12px; }
.muted { color: var(--muted); font-size: .9em; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 12px; }
.section-title h3 { margin: 0; }

.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand);
  border-radius: 12px; padding: 8px 18px; min-height: 42px;
  font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover, button:hover { background: var(--brand-strong); border-color: var(--brand-strong); text-decoration: none; color: var(--brand-ink); }
.btn.secondary, button.secondary { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn.secondary:hover, button.secondary:hover { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand-strong); }
button.danger, .btn.danger { background: var(--surface); color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--surface)); }
button.danger:hover, .btn.danger:hover { background: var(--err); color: #fff; border-color: var(--err); }
.btn.block, button.block { width: 100%; }
.inline { display: inline; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.badge { display: inline-block; padding: 1px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.badge.ok, .badge.s-published, .badge.s-open, .badge.s-invited, .badge.s-approved, .badge.s-active { background: var(--ok-soft); color: var(--ok-ink); }
.badge.warn, .badge.s-pending_payment, .badge.s-drawn, .badge.s-awaiting { background: var(--warn-soft); color: var(--warn-ink); }
.badge.err, .badge.s-cancelled, .badge.s-expired, .badge.s-withdrawn { background: var(--err-soft); color: var(--err-ink); }
.badge.brand, .badge.s-completed, .badge.s-finished { background: var(--brand-soft); color: var(--brand-strong); }

.stat { font-size: 1.9rem; font-weight: 800; line-height: 1.25; }
.stat-label { color: var(--muted); font-size: .85rem; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.messages li { padding: 10px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); }
.messages li.success { background: var(--ok-soft); color: var(--ok-ink); }
.messages li.error { background: var(--err-soft); color: var(--err-ink); }
.messages li.warning { background: var(--warn-soft); color: var(--warn-ink); }

.callout { display: flex; gap: 12px; align-items: flex-start; background: var(--brand-soft); color: var(--brand-strong); border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px; }
.callout svg { flex: none; width: 22px; height: 22px; margin-top: 3px; }
.callout p { margin: 0; }

/* ---------- فرم‌ها ---------- */
form p { margin: 0 0 14px; }
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-height: 44px;
  width: 100%; max-width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--brand); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.helptext { display: block; color: var(--muted); font-size: .82rem; }
.errorlist { list-style: none; padding: 0; margin: 0 0 6px; color: var(--err); font-size: .88rem; }
.search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input { flex: 1; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
details summary { cursor: pointer; color: var(--brand); font-weight: 600; margin: 8px 0; }

/* ---------- جدول ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 14px; text-align: right; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.mine td { background: var(--brand-soft); font-weight: 700; }
td form { display: inline-flex; gap: 6px; flex-wrap: wrap; margin: 2px 0; }
td input { min-height: 36px; width: 160px; }
td button { min-height: 36px; padding: 4px 12px; }

/* ---------- جایگاه متقاضی ---------- */
.hello { margin-bottom: 18px; }
.hello h2 { margin: 0; }
.standing { display: grid; gap: 12px; margin-bottom: 16px; }
.tiles { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }
@media (max-width: 520px) { .tiles { gap: 8px; } .tile { padding: 12px; } .tile .v { font-size: 1.45rem; } .tile .l { font-size: .75rem; } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tile .v { font-size: 2rem; font-weight: 800; line-height: 1.25; }
.tile .v small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.tile .l { color: var(--muted); font-size: .85rem; }
.tile.hl { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tile.hl .l { color: color-mix(in srgb, var(--brand-ink) 75%, var(--brand)); }

.queue { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.queue .t { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-weight: 700; margin-bottom: 12px; }
.queue .t .good { color: var(--ok); }
.queue .t .far { color: var(--warn-ink); }
.queue .bar { position: relative; height: 14px; border-radius: 99px; background: var(--queue); overflow: visible; }
.queue .bar .cap { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px; background: var(--ok); }
.queue .bar .me { position: absolute; top: -6px; bottom: -6px; width: 4px; margin-inline-start: -2px; border-radius: 4px; background: var(--brand); box-shadow: 0 0 0 3px var(--surface); }
.queue .scale { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; margin-top: 8px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* ---------- ویلا و دوره ---------- */
.villa-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.villa-card .ph { aspect-ratio: 2 / 1; max-width: 100%; background: linear-gradient(160deg, #cfe2f8 0%, #f3e7cf 62%, #e2c99a 100%); position: relative; }
.villa-card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.villa-card .ph .roof { position: absolute; inset-inline-end: 18%; bottom: 22%; width: 26%; aspect-ratio: 5 / 3; background: var(--surface); opacity: .9; clip-path: polygon(0 42%, 50% 0, 100% 42%, 100% 100%, 0 100%); }
.villa-card .body { padding: 14px 16px 16px; display: grid; gap: 6px; flex: 1; }
.villa-card h3 { margin: 0; }
.villa-card h3 a { color: var(--ink); }
.villa-card .price { font-weight: 700; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .88rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.period-card { display: grid; gap: 10px; }
.period-card .when { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.period-card .when div { background: var(--surface-2); border-radius: 12px; padding: 8px 12px; }
.period-card .when b { display: block; font-size: .95rem; }
.period-card .when span { color: var(--muted); font-size: .8rem; }

.app-list { display: grid; gap: 10px; }
.app-item { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; color: var(--ink); }
.app-item:hover { border-color: var(--brand); text-decoration: none; }
.app-item .main { flex: 1; min-width: 0; }
.app-item .main b { display: block; }
.app-item .chev { color: var(--muted); flex: none; }
.app-item .badges { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; flex: none; }

.gallery { display: flex; gap: 10px; overflow-x: auto; margin-bottom: 16px; scroll-snap-type: x mandatory; }
.gallery img { height: 220px; border-radius: var(--r); scroll-snap-align: start; }

/* ---------- ورود ---------- */
.auth { max-width: 420px; margin: 32px auto; }
.auth .logo { width: 56px; height: 56px; margin-bottom: 12px; }
.auth .card { padding: 24px; box-shadow: var(--shadow); }

/* ---------- دعوت‌نامه ---------- */
.invite { max-width: 640px; margin-inline: auto; padding: 0; overflow: hidden; }
.invite .head { background: var(--brand); color: var(--brand-ink); padding: 20px 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.invite .head h2 { margin: 0; }
.invite .code { background: color-mix(in srgb, var(--brand-ink) 18%, var(--brand)); border-radius: 10px; padding: 4px 12px; font-weight: 800; letter-spacing: .08em; direction: ltr; }
.invite .content { padding: 20px 22px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ---------- باغ ایرانی ---------- */
.display, .tile .v, .stat, .hero h2 { font-family: var(--display); font-weight: 400; letter-spacing: 0; }

/* سربرگ فیروزه‌ای صفحه‌های متقاضی؛ کارت جایگاه رویش می‌نشیند */
.hero { background-color: var(--brand); background-image: var(--tile); background-size: 30px 30px; color: var(--brand-ink); }
.hero .inner { max-width: 1080px; margin: 0 auto; padding-inline: 16px; padding-block: 26px 70px; }
.hero h2 { font-size: 2rem; margin: 0; line-height: 1.35; }
.hero .eyebrow { color: color-mix(in srgb, var(--brand-ink) 78%, var(--brand)); }
.hero + main { padding-top: 0; }
.hero + main > .lift { margin-top: -52px; position: relative; }
.hero + main > .messages { margin-top: 16px; }
.hero + main > .messages + .lift { margin-top: 0; }
.hero .callout { background: color-mix(in srgb, var(--brand-ink) 12%, var(--brand)); color: var(--brand-ink); margin: 16px 0 0; flex-wrap: wrap; align-items: center; }
.hero .callout p { flex: 1 1 220px; }
.hero .callout .btn { flex: none; }
.hero a.callout.bot-link { text-decoration: none; cursor: pointer; transition: background .15s; }
.hero a.callout.bot-link:hover, .hero a.callout.bot-link:focus-visible { background: color-mix(in srgb, var(--brand-ink) 20%, var(--brand)); text-decoration: none; }
@media (max-width: 520px) { .hero .callout .btn { width: 100%; } }

.tile { box-shadow: var(--shadow); }
.tile .v { font-size: 2.3rem; line-height: 1.15; }
.tile .v small { font-family: var(--font); font-weight: 500; margin-inline-start: 4px; }
.tile.hl { background-color: var(--brand-strong); background-image: var(--tile); background-size: 30px 30px; }
.tile.gold .v { color: var(--saffron-strong); }

.queue { box-shadow: var(--shadow); }
.queue .bar .cap { background: linear-gradient(to left, var(--brand), var(--ok)); }
.queue .bar .me { background: var(--saffron); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--saffron-strong); width: 6px; margin-inline-start: -3px; }
.queue .t .good { color: var(--ok); }
.queue .t .far { color: var(--saffron-ink); }

.callout { background: var(--saffron-soft); color: var(--saffron-ink); }

.btn, button { border-radius: 14px; }
.btn.gold, button.gold { background: var(--saffron); border-color: var(--saffron); color: var(--ink); }
.btn.gold:hover, button.gold:hover { background: var(--saffron-strong); border-color: var(--saffron-strong); color: var(--ink); }

.section-title h3 { display: flex; align-items: center; gap: 10px; }
.section-title h3::before { content: ""; width: 10px; height: 10px; background: var(--saffron); transform: rotate(45deg); border-radius: 2px; flex: none; }

.card { box-shadow: 0 1px 0 rgba(22, 48, 46, .03); }
.period-card .when div { background: var(--surface-2); }

/* تصویر جایگزین ویلا: آسمان فیروزه‌ای، کوه و خانه با بام زعفرانی */
.villa-card .ph { background:
  radial-gradient(ellipse 70% 55% at 22% 100%, #3f6f52 98%, transparent 100%),
  radial-gradient(ellipse 80% 62% at 88% 108%, #6d9e7a 98%, transparent 100%),
  radial-gradient(circle at 78% 26%, var(--saffron-soft) 0 7%, transparent 7.5%),
  linear-gradient(180deg, #8cc6bd 0%, #dcefe9 100%); }
.villa-card .ph .roof { background: var(--surface); box-shadow: inset 0 -9px 0 var(--saffron-strong); opacity: 1; inset-inline-end: auto; inset-inline-start: 14%; bottom: 30%; width: 22%; }
.villa-card { transition: transform .2s, box-shadow .2s; }
.villa-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.app-item .avatar, .avatar { background: var(--saffron-soft); color: var(--saffron-ink); }

.auth { text-align: center; }
.auth .logo { width: auto; height: 64px; margin-bottom: 18px; }
.auth h1 { font-family: var(--display); font-weight: 400; font-size: 2rem; }
.auth .card { text-align: start; border-top: 4px solid var(--saffron); }
.auth-band { height: 10px; background-color: var(--brand); background-image: var(--tile); background-size: 30px 30px; }

.invite .head { background-color: var(--brand); background-image: var(--tile); background-size: 30px 30px; }
.invite .head h2 { font-family: var(--display); font-weight: 400; font-size: 1.8rem; }
.invite .code { background: var(--saffron); color: var(--ink); }
.invite .org { height: 34px; width: auto; background: var(--surface); padding: 4px 8px; border-radius: 10px; }

.bottom-nav a.on { color: var(--brand); }
.bottom-nav a.on svg { color: var(--saffron-strong); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  .site-header, .bottom-nav, .no-print { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .card, .invite { border: 1px solid #ccc; }
  .invite .head { background: #fff; color: #000; border-bottom: 2px solid #000; }
}
.mono, code { font-family: ui-monospace, Menlo, Consolas, monospace; direction: ltr; unicode-bidi: embed; }
textarea.mono { width: 100%; }
.up { color: var(--ok); } .down { color: var(--err); }
