:root {
  --bg: #f3eee4;
  --card: #fffdf8;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e0d4;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b45309;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Vazirmatn, Tahoma, sans-serif;
  background:
    radial-gradient(circle at 10% 0%, #fff7e8, transparent 40%),
    var(--bg);
  color: var(--ink);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { max-width: 1080px; margin: 0 auto; padding: 24px; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.brand { font-weight: 800; font-size: 1.15rem; }
nav { display: flex; gap: 14px; flex-wrap: wrap; }
nav a { color: var(--ink); }
nav a.active { color: var(--accent); font-weight: 700; }

.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.two { grid-template-columns: 1.1fr 0.9fr; align-items: start; }

.card, .stat, form.panel, table {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.card, form.panel { padding: 22px; }
.stat { padding: 18px; }
.stat strong { display: block; font-size: 1.8rem; margin-top: 6px; }

h1, h2 { margin: 0 0 10px; }
.muted { color: var(--muted); }

label { display: grid; gap: 6px; margin-bottom: 14px; font-size: 0.95rem; }
input, textarea, select, button {
  font: inherit;
  border-radius: 12px;
  padding: 11px 12px;
}
input, textarea, select {
  border: 1px solid var(--line);
  background: #fff;
  width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
button, .btn {
  border: 0;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-block;
  padding: 11px 16px;
  border-radius: 12px;
}
button:hover, .btn:hover { background: var(--accent-dark); text-decoration: none; }
button.secondary, .btn.secondary { background: #44403c; }
.export-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.export-form label { display: flex; align-items: center; gap: 8px; margin: 0; }
.export-form select { width: auto; }
button.small, .btn.small { padding: 6px 10px; font-size: 0.85rem; }
button.danger { background: #b45309; }
button.danger:hover { background: #92400e; }
.row-actions, .filter-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions form, .filter-actions form { margin: 0; }
form.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
form.filters label { margin-bottom: 0; }
form.filters .filter-actions { grid-column: 1 / -1; }

.pager {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}
.pager-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 auto;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(28, 25, 23, 0.05);
}
.pager-bar form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.pager-meta {
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}
.pager-meta strong { color: var(--ink); }
.pager-nav,
.pager-bar button.pager-go {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
  line-height: 1;
  text-decoration: none;
}
.pager-nav {
  background: transparent;
  color: var(--ink);
}
a.pager-nav:hover { background: #f3eee4; text-decoration: none; }
.pager-nav.is-disabled { opacity: 0.35; }
.pager-bar input[type="number"] {
  width: 4.2rem;
  padding: 8px 6px;
  border-radius: 999px;
  text-align: center;
}
.pager-bar button.pager-go { background: var(--accent); color: #fff; }
.pager-bar button.pager-go:hover { background: var(--accent-dark); }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}
.page-head h1 { margin-bottom: 6px; }
.page-head .muted { margin: 0; }

.cards { margin: 16px 0; }
.chart-card { margin-top: 8px; }
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.chart-head h2 { margin: 0; font-size: 1.05rem; }
.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
}
.bar {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.bar-value {
  height: 16px;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 16px;
}
.bar-track {
  width: 100%;
  max-width: 22px;
  height: calc(100% - 36px);
  display: flex;
  align-items: flex-end;
}
.bar-fill {
  width: 100%;
  min-height: 3px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(#2dd4bf, var(--accent));
}
.bar-fill.is-empty { background: #efe8dc; }
.bar-label {
  height: 18px;
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--muted);
}

dialog.guide {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(480px, calc(100vw - 32px));
}
dialog.guide::backdrop { background: rgba(28, 25, 23, 0.4); }
.guide-card { margin: 0; }
.guide-card h2 { margin-bottom: 14px; }
.steps {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 10px;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}
.steps span {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #ccfbf1;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.85rem;
}
.steps p { margin: 0; }
.guide-note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  background: #fff7ed;
  color: var(--danger);
}
.ok {
  background: #ecfdf5;
  color: #047857;
}

table { width: 100%; border-collapse: collapse; overflow: hidden; }
th, td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--line); font-size: 0.92rem; vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-wrap .card { width: min(420px, 100%); }

@media (max-width: 860px) {
  .two { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
  .page-head { flex-direction: column; }
  .pager-bar { flex-wrap: wrap; border-radius: 22px; max-width: 100%; }
}
