@font-face {
  font-family: "Vazirmatn";
  src: url("https://sourena.pro/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6fbf9;
  --surface: #ffffff;
  --surface-2: #eef7f4;
  --surface-3: #f7fcfa;
  --ink: #17211f;
  --muted: #65736f;
  --line: #d7e3df;
  --teal: #0f766e;
  --teal-soft: #dff4f0;
  --rose: #e94f64;
  --amber: #d58b00;
  --blue: #2563eb;
  --green: #15803d;
  --shadow: 0 18px 50px rgba(15, 118, 110, .12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(246,251,249,.92)),
    repeating-linear-gradient(135deg, rgba(15,118,110,.035) 0 1px, transparent 1px 18px);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, "Segoe UI", Arial, sans-serif;
  line-height: 1.7;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 10px;
  z-index: 20;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--green));
  font-weight: 900;
  flex: 0 0 auto;
}

h1 {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.3;
}

h2 {
  font-size: 18px;
  font-weight: 900;
}

h3 {
  font-size: 15px;
  font-weight: 900;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
}

.top-actions,
.action-row,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 800;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.btn:hover {
  border-color: var(--teal);
  background: #e7f7f3;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.btn.rose {
  color: #fff;
  background: var(--rose);
  border-color: var(--rose);
}

.btn.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.workspace,
.content-grid,
.split-grid,
.two-col,
.three-col,
.four-col,
.tool-grid,
.tile-grid,
.checklist {
  display: grid;
  gap: 12px;
}

.workspace {
  grid-template-columns: 280px minmax(0, 1fr);
  margin-top: 14px;
}

.content-grid {
  min-width: 0;
}

.split-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.four-col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sidebar,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 12px;
}

.panel {
  padding: 14px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.nav-list,
.stack {
  display: grid;
  gap: 8px;
}

.nav-item,
.tile-button {
  width: 100%;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: right;
  color: var(--ink);
}

.nav-item:hover,
.tile-button:hover,
.nav-item.active,
.tile-button.active {
  background: var(--teal-soft);
  border-color: #b7ded7;
}

.nav-icon,
.tile-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--teal);
  color: #fff;
  font-weight: 900;
}

.module-card,
.tile-card,
.stat,
.note-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.module-card,
.tile-card {
  display: grid;
  gap: 8px;
  align-content: start;
}

.module-card strong,
.tile-card strong {
  display: block;
  font-size: 14px;
}

.module-card span,
.tile-card span {
  color: var(--muted);
  font-size: 12px;
}

.module-tag,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
}

.module-tag.blue {
  color: #1d4ed8;
  background: #e6efff;
}

.module-tag.warn {
  color: #7c4d00;
  background: #fff1ce;
}

.module-tag.rose {
  color: #9f1239;
  background: #ffe4ea;
}

.field {
  display: grid;
  gap: 4px;
}

label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,118,110,.12);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-number {
  font-size: 24px;
  font-weight: 900;
  color: var(--teal);
  line-height: 1.2;
}

.report-box,
.output-box,
.plan-box {
  min-height: 220px;
  max-height: 560px;
  overflow: auto;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-3);
  white-space: pre-wrap;
}

.output-box {
  direction: ltr;
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.report-box {
  direction: rtl;
  text-align: right;
}

.mini-list,
.risk-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.mini-list li,
.risk-list li {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 12px;
}

.checklist {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 12px;
}

.check-item input {
  width: auto;
  min-height: 0;
  margin-top: 5px;
  accent-color: var(--teal);
}

.progress-rail {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #dce8e4;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--green));
}

.warning {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid #f6cdd4;
  background: #fff1f4;
  color: #831843;
  font-size: 12px;
}

.footerbar {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: min(360px, calc(100% - 32px));
  padding: 12px;
  border-radius: var(--radius);
  background: #10201d;
  color: #fff;
  box-shadow: 0 18px 44px rgba(0,0,0,.28);
  transform: translateY(120%);
  transition: transform .2s ease;
  z-index: 80;
  font-size: 13px;
}

.toast.show {
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .workspace,
  .split-grid,
  .two-col,
  .three-col,
  .four-col,
  .stats,
  .checklist {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
    position: static;
  }

  h1 {
    font-size: 19px;
  }
}
