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

:root {
  --green: #16A34A; --green-2: #22C55E; --green-soft: #E8F6EC; --bg: #F5F6F2; --card: #FFFFFF;
  --text: #1F2937; --muted: #6B7280; --line: #E5E7EB; --red: #DC2626; --red-soft: #FDECEC;
  --amber: #B45309; --amber-soft: #FEF3C7; --blue: #2563EB; --blue-soft: #E7EEFD;
  --radius: 18px; --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
}
* { 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; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.5; margin: 0 0 12px; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; direction: ltr; unicode-bidi: embed; font-size: 13px; background: #F1F2EE; padding: 1px 6px; border-radius: 6px; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; background: var(--card); border-left: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin: 0 6px 20px; color: var(--text); }
.brand img { width: 34px; height: 34px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; color: var(--text); margin-bottom: 2px; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.active { background: var(--green-soft); color: var(--green); font-weight: 500; }
.nav .group { color: var(--muted); font-size: 12px; margin: 14px 12px 4px; }
.main { flex: 1; padding: 28px; max-width: 1180px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; border-left: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .nav { display: flex; overflow-x: auto; gap: 4px; }
  .nav a { white-space: nowrap; }
  .nav .group { display: none; }
  .main { padding: 16px; }
}

/* Cards & grids */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid.stats { grid-template-columns: repeat(2, 1fr); } }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat .num { font-size: 28px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 13px; }

/* Forms */
label { display: block; font-weight: 500; margin: 12px 0 6px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=tel], input[type=email], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-soft); border-color: var(--green); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.switch { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-weight: 500; }
.switch input { width: 20px; height: 20px; accent-color: var(--green); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 10px 18px; font: inherit; font-weight: 500; cursor: pointer; background: var(--green); color: #fff; }
.btn:hover { background: #15803D; text-decoration: none; }
.btn.secondary { background: var(--green-soft); color: var(--green); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; }

/* Badges & alerts */
.badge { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 500; background: #F1F2EE; color: var(--muted); }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.bad { background: var(--red-soft); color: var(--red); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.info { background: var(--blue-soft); color: var(--blue); }
.alert { border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; }
.alert.ok { background: var(--green-soft); color: #166534; }
.alert.bad { background: var(--red-soft); color: #991B1B; }
.alert.warn { background: var(--amber-soft); color: #92400E; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.filters > * { width: auto; }
.filters input, .filters select { min-width: 160px; }

/* Auth pages */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth { width: 100%; max-width: 420px; }
.auth .logo { display: block; width: 64px; height: 64px; margin: 0 auto 12px; }
.auth h1 { text-align: center; }

/* Landing */
.site { max-width: 1040px; margin: 0 auto; padding: 16px; }
.site header { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 24px; }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; padding: 24px 0 48px; }
.hero h1 { font-size: 36px; }
.hero p { color: var(--muted); font-size: 17px; }
.phone { background: linear-gradient(160deg, var(--green), var(--green-2)); border-radius: 36px; padding: 28px; color: #fff; box-shadow: var(--shadow); min-height: 340px; display: flex; flex-direction: column; gap: 12px; }
.phone .bubble { background: rgba(255, 255, 255, .95); color: var(--text); border-radius: 16px; padding: 12px 14px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.site footer { color: var(--muted); font-size: 13px; text-align: center; padding: 32px 0; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hero h1 { font-size: 28px; } }
