@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/vazirmatn-arabic-variable.woff2") format("woff2-variations");
  unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;
}

@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/vazirmatn-latin-variable.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --bg: #f7f6fb;
  --paper: #ffffff;
  --ink: #2d3436;
  --muted: #747381;
  --line: #e5e2f0;
  --brand: #6c5ce7;
  --brand-dark: #5647cf;
  --brand-mid: #a29bfe;
  --brand2: #f0edff;
  --success: #159a70;
  --success-soft: #e9fbf4;
  --warning: #8a6400;
  --warning-soft: #fff8df;
  --danger: #b33a31;
  --danger-soft: #fff0ee;
  --shadow: 0 16px 46px rgba(64, 52, 130, .08);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 14px;
  font-weight: 400;
}
button, input, textarea, select { font: inherit; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
aside {
  background: #282733;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.logo { color: #fff; text-decoration: none; padding: 4px 8px 24px; border-bottom: 1px solid #ffffff1c; }
.logo b { font-size: 23px; display: block; font-weight: 850; }
.logo span { font-size: 11px; color: #b9b5cf; }
nav { display: grid; gap: 8px; margin-top: 22px; }
nav a {
  color: #c4c0d3;
  text-decoration: none;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 600;
  transition: .18s ease;
}
nav a:hover { background: #ffffff0b; color: #fff; }
nav a.active { background: #fff; color: var(--ink); box-shadow: 0 12px 28px #0d0b1c52; }
.aside-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #aaa5bd; font-size: 12px; padding: 14px 8px; }
.aside-foot .logout-link {
  color: #fff;
  background: var(--brand);
  border: 1px solid #8d80f4;
  border-radius: 9px;
  padding: 7px 13px;
  text-decoration: none;
  font-weight: 750;
  box-shadow: 0 7px 18px #0d0b1c66;
  transition: .16s ease;
}
.aside-foot .logout-link:hover { background: #7b6bef; border-color: #a79df8; transform: translateY(-1px); }
main { padding: 28px clamp(18px, 3vw, 42px) 60px; max-width: 1400px; width: 100%; margin: auto; }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
h1 { font-size: 24px; margin: 0; font-weight: 820; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 7px; font-weight: 780; }
h3 { font-size: 14px; margin: 0; font-weight: 750; }
.muted { color: var(--muted); line-height: 1.9; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.grid { display: grid; gap: 15px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { grid-template-columns: repeat(3, 1fr); }
.stat strong { display: block; font-size: 28px; margin-top: 8px; }
.field label { display: block; font-size: 12px; color: #666575; margin-bottom: 7px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid #d7d3e5;
  border-radius: 11px;
  padding: 11px 12px;
  background: #fcfbff;
  color: var(--ink);
  outline: none;
  transition: .16s ease;
}
.field textarea { min-height: 105px; resize: vertical; line-height: 1.9; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px #6c5ce71c;
  background: #fff;
}
.ltr { direction: ltr; text-align: left; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c9c2ee;
  border-radius: 10px;
  background: #fff;
  color: var(--brand-dark);
  text-decoration: none;
  padding: 10px 16px;
  min-height: 40px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 4px 12px #6c5ce70c;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--brand2); border-color: var(--brand-mid); }
.btn.primary {
  background: linear-gradient(135deg, #7868ee, var(--brand));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 9px 22px #6c5ce738;
}
.btn.primary:hover { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); box-shadow: 0 12px 27px #6c5ce74a; }
.btn.danger { color: var(--danger); border-color: #edc9c5; box-shadow: none; }
.btn.danger.filled { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.filled:hover { background: #962d26; border-color: #962d26; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.section { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 22px; }
.section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.section-title { margin-bottom: 14px; }
.section-title p { margin: 5px 0 0; }
.alert { border-radius: 11px; padding: 12px 14px; margin-bottom: 16px; }
.alert.success { background: var(--success-soft); color: #176843; }
.alert.error { background: var(--danger-soft); color: #9f2d25; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; background: var(--brand2); color: var(--brand); font-size: 11px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; font-weight: 650; background: #faf9fd; }
tbody tr:hover { background: #fcfbff; }
.empty { text-align: center; padding: 38px; color: var(--muted); }
.repeat-list { display: grid; gap: 10px; }
.repeat-row { display: grid; grid-template-columns: 1fr 1.35fr 1.35fr auto; gap: 9px; }
.repeat-row input { border: 1px solid #d7d3e5; border-radius: 10px; padding: 10px 12px; font: inherit; }
.login { max-width: 440px; margin: 10vh auto; border-top: 4px solid var(--brand); }
.login .logo-dark { font-size: 26px; font-weight: 850; color: var(--brand); margin-bottom: 8px; }
.hint { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.8; }
.key-state { padding: 10px 12px; border-radius: 10px; background: #f4f2fb; color: #5d596f; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs a { padding: 9px 12px; border-radius: 9px; text-decoration: none; color: var(--muted); }
.tabs a.active { background: var(--brand2); color: var(--brand); font-weight: 700; }
.review-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.status-badge, .protocol-lock { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.status-badge.success { color: #176843; background: var(--success-soft); }
.status-badge.warning { color: var(--warning); background: var(--warning-soft); }
.status-badge.error { color: var(--danger); background: var(--danger-soft); }
.protocol-lock { color: var(--brand-dark); background: var(--brand2); border: 1px solid #d7d0ff; }
.content-editor { min-height: 520px !important; direction: rtl; line-height: 2.05 !important; background: #fff !important; }
.content-editor.locked-output { background: #fbfaff !important; user-select: none; }
.approval-grid { display: grid; grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); gap: 16px; align-items: start; }
.approval-card { border-top: 4px solid var(--success); }
.rejection-card { border-top: 4px solid var(--danger); }
.approval-card .btn, .rejection-card .btn { margin-top: 12px; }
.review-feedback { white-space: pre-wrap; line-height: 2; background: #fff8f7; border: 1px solid #f0d0cc; border-radius: 11px; padding: 14px; margin: 14px 0; }
.approved-export { border-top: 4px solid var(--success); }
.copy-state { color: var(--success); font-size: 12px; margin-right: 10px; }
.revision-history { padding: 0; overflow: hidden; }
.revision-history summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 20px; list-style: none; }
.revision-history summary::-webkit-details-marker { display: none; }
.revision-history summary span { color: var(--muted); font-size: 12px; }
.workflow-steps { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.workflow-step { border: 1px solid var(--line); border-radius: 12px; padding: 13px; background: #fcfbff; }
.workflow-step b { color: var(--brand); display: block; margin-bottom: 5px; }

@media (max-width: 850px) {
  .shell { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  .aside-foot { margin-top: 15px; }
  .g2, .g3, .stats { grid-template-columns: 1fr; }
  .repeat-row { grid-template-columns: 1fr; }
  .approval-grid, .workflow-steps { grid-template-columns: 1fr; }
  main { padding: 16px; }
}
