/* =========================================================================
   نظام پیشنهادات — هویت بصری «کارتابل رسمی»
   پالت: کاغذ کرم + جوهر سرمه‌ای + مهر طلایی
   ========================================================================= */

@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #16233d;
  --ink-2: #223454;
  --paper: #f6f3ec;
  --paper-2: #efe9db;
  --line: #ddd4bf;
  --seal: #b98b34;
  --seal-dark: #8f6a26;
  --success: #3f7d58;
  --success-bg: #e7f1ea;
  --danger: #b34b3e;
  --danger-bg: #f8e9e7;
  --warn: #a97a1f;
  --warn-bg: #fbf0dd;
  --muted: #6b6455;
  --text: #241f16;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 35, 61, 0.06), 0 1px 12px rgba(22, 35, 61, 0.05);
  --font-body: "Vazirmatn", "Tahoma", sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  direction: rtl;
  font-size: 15px;
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------------- */
/* چیدمان اصلی: نوار کناری راست + محتوا                                 */
/* ------------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--ink);
  color: #eee7d6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  padding: 22px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar__brand .brand-title {
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar__brand .brand-sub {
  font-size: 11.5px;
  color: #b7ad8f;
  margin-top: 3px;
  letter-spacing: .02em;
}

.sidebar__user {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 13px;
}
.sidebar__user .name { color: #fff; font-weight: 700; }
.sidebar__user .roles { color: #b7ad8f; margin-top: 2px; }

.nav-group {
  padding: 10px 10px;
  overflow-y: auto;
}
.nav-group + .nav-group { border-top: 1px solid rgba(255,255,255,0.08); }
.nav-label {
  font-size: 11px;
  color: #8b8267;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 10px 10px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #d9d2bd;
  font-size: 13.5px;
  margin: 1px 4px;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active { background: var(--seal); color: #241f16; font-weight: 700; }
.nav-link .badge-count {
  margin-inline-start: auto;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 10.5px;
  padding: 1px 7px;
}

.sidebar__footer {
  margin-top: auto;
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.logout-link { color: #d9a48a; font-size: 13px; }

.main {
  flex: 1;
  min-width: 0;
  padding: 26px 34px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.topbar h1 {
  font-size: 21px;
  margin: 0;
  color: var(--ink);
}
.topbar .crumb {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* ------------------------------------------------------------------- */
/* کارت‌ها، جدول‌ها، فرم‌ها                                              */
/* ------------------------------------------------------------------- */
.card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card h2, .card h3 { margin-top: 0; color: var(--ink); }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

.stat-card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card .num { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--ink); }
.stat-card .label { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: right;
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 700;
  padding: 9px 12px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:hover { background: #faf7ee; }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 6px; color: var(--ink-2); }
.form-row .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=tel],
input[type=date], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--seal);
  outline-offset: 1px;
  border-color: var(--seal);
}
input[type=file] { font-size: 13px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary { background: var(--seal); color: #241f16; }
.btn-primary:hover { background: var(--seal-dark); color: #fff; }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8e3a2f; }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; padding: 6px 10px; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.actions-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ------------------------------------------------------------------- */
/* عنصر شاخص: «مهر» وضعیت پیشنهاد                                       */
/* ------------------------------------------------------------------- */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid currentColor;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.stamp.gray   { color: #6b6455; }
.stamp.blue   { color: #2b5583; }
.stamp.gold   { color: var(--seal-dark); }
.stamp.green  { color: var(--success); }
.stamp.red    { color: var(--danger); }
.stamp.purple { color: #6a4a9c; }

.code-chip {
  font-family: var(--font-mono);
  background: var(--ink);
  color: #f6d98a;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 13px;
  letter-spacing: .03em;
}

/* ------------------------------------------------------------------- */
/* هشدارها و پیام‌های فلش                                               */
/* ------------------------------------------------------------------- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; }
.flash.success { background: var(--success-bg); color: var(--success); border: 1px solid #bcd9c6; }
.flash.error { background: var(--danger-bg); color: var(--danger); border: 1px solid #e3bdb6; }
.flash.warning { background: var(--warn-bg); color: var(--warn); border: 1px solid #ecd9ad; }
.flash.info { background: #e8eef7; color: #2b5583; border: 1px solid #c7d6ea; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .icon { font-size: 34px; margin-bottom: 10px; }

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.participant-row, .dynamic-row {
  display: grid;
  grid-template-columns: 1fr 1fr 90px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}
@media (max-width: 760px) {
  .participant-row, .dynamic-row { grid-template-columns: 1fr; }
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ink) 0%, #26395c 60%, var(--ink) 100%);
}
.login-card {
  width: 380px;
  background: var(--paper);
  border-radius: 14px;
  padding: 32px 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-card .brand-title { color: var(--ink); font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-card .brand-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 22px; }

.help-box {
  background: var(--paper-2);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.designer-credit {
  margin-top: 10px;
  font-size: 10.5px;
  color: #6b6455;
  opacity: .65;
}

input[data-personnel-name].lookup-found { color: var(--success); border-color: var(--success); font-weight: 700; }
input[data-personnel-name].lookup-notfound { color: var(--danger); border-color: var(--danger); }

/* ------------------------------------------------------------------- */
/* تایم‌لاین قیفی مراحل گردش‌کار                                         */
/* ------------------------------------------------------------------- */
.funnel-wrap { overflow-x: auto; padding-bottom: 8px; }
.funnel-row { display: flex; align-items: flex-start; gap: 0; min-width: max-content; }
.funnel-total {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; border-radius: 10px;
  padding: 14px 18px; min-width: 120px; text-align: center; margin-inline-end: 14px;
}
.funnel-total .num { font-family: var(--font-mono); font-size: 24px; font-weight: 700; }
.funnel-total .label { font-size: 11.5px; margin-top: 4px; color: #d9d2bd; }

.funnel-stage { display: flex; flex-direction: column; align-items: center; }
.funnel-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #f6dfb4, #eec988);
  border: 1px solid #cfa858;
  color: #4a3410;
  padding: 12px 22px 12px 14px;
  min-width: 118px;
  text-align: center;
  position: relative;
  font-weight: 700;
  transition: transform .12s;
}
.funnel-box:hover { transform: translateY(-2px); }
.funnel-box .num { font-family: var(--font-mono); font-size: 22px; }
.funnel-box .label { font-size: 11px; font-weight: 700; margin-top: 3px; line-height: 1.4; }
.funnel-arrow {
  width: 0; height: 0; align-self: center;
  border-top: 22px solid transparent; border-bottom: 22px solid transparent;
  border-inline-start: 16px solid #eec988;
  margin: 0 -1px;
}
.funnel-reject-link { text-decoration: none; }
.funnel-reject {
  margin-top: 8px;
  background: #f3c3bb;
  border: 1px solid #d99087;
  color: #6e2318;
  border-radius: 8px;
  padding: 6px 12px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  min-width: 90px;
}
.funnel-reject .num { font-family: var(--font-mono); font-size: 16px; display: block; }
.funnel-reject-arrow { font-size: 14px; color: #d99087; margin-top: 2px; }

.mobile-topbar { display: none; }

@media (max-width: 880px) {
  .app-shell { flex-direction: column; }
  .sidebar { position: fixed; inset-inline-end: 0; top: 0; height: 100vh; z-index: 50; transform: translateX(100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 80px 16px 40px; }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: fixed; top: 0; inset-inline-start: 0; inset-inline-end: 0;
    background: var(--ink); color: #fff; padding: 14px 18px; z-index: 40;
  }
}

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 6px 0; border-bottom: 1px dotted var(--line); font-size: 13.5px; }
.checklist li:last-child { border-bottom: none; }

.timeline { border-inline-start: 2px solid var(--line); padding-inline-start: 18px; }
.timeline .item { position: relative; padding-bottom: 18px; }
.timeline .item::before {
  content: "";
  position: absolute; inset-inline-start: -24px; top: 3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--seal); border: 2px solid #fffdf8;
}
.timeline .item .t-title { font-weight: 700; color: var(--ink); font-size: 13.5px; }
.timeline .item .t-meta { font-size: 12px; color: var(--muted); }
