/* پرتال بازاریابی A1: یک رنگ تأکیدی، روشن با پشتیبانی حالت تیره */

@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/vazirmatn-arabic-wght-normal.woff2") format("woff2-variations"),
       url("fonts/vazirmatn-arabic-wght-normal.woff2") format("woff2");
  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-wght-normal.woff2") format("woff2-variations"),
       url("fonts/vazirmatn-latin-wght-normal.woff2") format("woff2");
  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 {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #1a1e23;
  --muted: #545d68;
  --border: #d5dae0;
  --accent: #0a6b63;
  --accent-hover: #08574f;
  --accent-soft: #e2f1ef;
  --on-accent: #ffffff;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --warn-text: #6b4300;
  --warn-soft: #fff4d6;
  --ok: #17663a;
  --focus: #0a6b63;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 1px 3px rgba(16, 24, 32, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --surface: #181c21;
    --surface-2: #20262c;
    --text: #e8ebee;
    --muted: #a6afb9;
    --border: #323a43;
    --accent: #5cc6ba;
    --accent-hover: #7dd5cb;
    --accent-soft: #163632;
    --on-accent: #062320;
    --danger: #ff9a90;
    --danger-soft: #3a1714;
    --warn-text: #f4cf7a;
    --warn-soft: #33290f;
    --ok: #7fd6a0;
    --focus: #7dd5cb;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  font-feature-settings: "ss01";
}
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.4; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.125rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { justify-content: center; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 1.5rem; padding-bottom: 3rem; outline: none; }

.skip {
  position: absolute; inset-inline-start: 8px; top: -60px;
  background: var(--accent); color: var(--on-accent); padding: .5rem 1rem; border-radius: 8px; z-index: 10;
}
.skip:focus { top: 8px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; }
.brand { font-weight: 700; color: var(--accent); white-space: nowrap; }
.who { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.who-name { color: var(--muted); font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45vw; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.card.narrow { max-width: 420px; margin: 1rem auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1rem 0; }
.grid .card { margin: 0; }
.stat-label { color: var(--muted); font-size: .875rem; margin: 0 0 .25rem; }
.stat-value { font-size: 1.375rem; font-weight: 700; margin: 0; }
.stat-value.small { font-size: 1rem; font-weight: 600; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--danger); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: 1rem 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* دکمه‌ها */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .5rem 1.25rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.block { width: 100%; }
.btn[disabled], .btn-text[disabled] { opacity: .55; cursor: not-allowed; }
.btn-text {
  font: inherit; cursor: pointer; background: none; border: 0; color: var(--accent);
  padding: .25rem .25rem; min-height: 44px; text-decoration: underline; text-underline-offset: 3px;
}
.btn-text.back { margin-bottom: .25rem; padding-inline: 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }

/* فرم‌ها */
.field { margin: 0 0 1rem; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: .35rem; }
.field.sub { border: 1px dashed var(--border); border-radius: 10px; padding: 1rem; }
.field.sub legend { padding: 0 .35rem; }
input[type="text"], input[type="tel"], select, textarea {
  font: inherit; width: 100%; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: .55rem .75rem; min-height: 44px;
}
input[dir="ltr"] { text-align: left; }
textarea { resize: vertical; min-height: 6rem; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.hint { color: var(--muted); font-size: .875rem; margin: .3rem 0 0; }
.counter { font-variant-numeric: tabular-nums; }
.radios { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.radio { display: inline-flex !important; align-items: center; gap: .4rem; font-weight: 500 !important; min-height: 44px; cursor: pointer; }
.radio input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); margin: 0; }

.error { color: var(--danger); background: var(--danger-soft); border-radius: 10px; padding: .6rem .85rem; margin: .75rem 0; }
.notice { border-radius: 10px; padding: .75rem 1rem; margin: 0 0 1rem; }
.notice.warn { background: var(--warn-soft); color: var(--warn-text); }
.notice.ok { background: var(--accent-soft); color: var(--text); }

.status { display: flex; align-items: center; gap: .6rem; margin: .75rem 0; color: var(--muted); }
.spinner {
  width: 1.1rem; height: 1.1rem; flex: none; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* زبانه‌ها */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: 1rem 0 0; }
.tabs [role="tab"] {
  font: inherit; font-weight: 600; cursor: pointer; background: none; color: var(--muted);
  border: 0; border-bottom: 3px solid transparent; padding: .6rem 1rem; min-height: 44px; margin-bottom: -1px;
}
.tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabpanel { border-start-start-radius: 0; border-start-end-radius: 0; border-top: 0; }

/* انتخابگرها و برچسب‌ها */
.pickers { display: grid; gap: 1rem; }
.pickers .field { margin: 0; }
.picker-row { display: flex; gap: .5rem; }
.picker-row > :first-child { flex: 1; min-width: 0; }
.picker-row .btn { flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .25rem 0 .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .25rem; max-width: 100%;
  background: var(--accent-soft); color: var(--text); border-radius: 999px; padding: .15rem .35rem .15rem .75rem;
  font-size: .9rem;
}
.chip-text { overflow-wrap: anywhere; }
.chip-key { color: var(--muted); }
.chip button {
  font: inherit; cursor: pointer; border: 0; background: none; color: var(--text);
  width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
}
.chip button:hover { background: var(--surface-2); }
.chip.exclude { background: var(--danger-soft); }

.out:empty { display: none; }
.out { margin-top: .75rem; }
.result { border-top: 1px solid var(--border); padding-top: .75rem; }
.nums { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: .25rem 0 .75rem; }
.num-label { color: var(--muted); font-size: .875rem; display: block; }
.num-value { font-size: 1.35rem; font-weight: 700; }
ul.plain { margin: .25rem 0 .75rem; padding-inline-start: 1.25rem; }

/* فهرست کمپین‌ها */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
.item-name { font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: .8rem; font-weight: 600; padding: .1rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.badge.wait { background: var(--warn-soft); color: var(--warn-text); }
.badge.run { background: var(--accent-soft); color: var(--text); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.meta { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; color: var(--muted); font-size: .875rem; margin: .35rem 0; }
dl.summary { display: grid; grid-template-columns: auto auto; justify-content: start; gap: .1rem 1rem; margin: .5rem 0 0; font-size: .9rem; }
dl.summary dt { color: var(--muted); }
dl.summary dd { margin: 0; font-weight: 600; }

@media (max-width: 480px) {
  h1 { font-size: 1.3rem; }
  .card { padding: 1rem; }
  .actions .btn { flex: 1 1 auto; }
}
