/* Traffic Digital Marketing — رنگ‌ها از لوگو */
:root {
  --brand: #013334;
  --brand-2: #0b4a4a;
  --brand-soft: #e6eeee;
  --accent: #ff6600;
  --accent-dark: #e05a00;
  --accent-soft: #fff0e6;
  --bg: #f3f5f5;
  --card: #ffffff;
  --ink: #1b2a2a;
  --muted: #6b7878;
  --line: #dde4e4;
  --ok: #1b8a5a;
  --ok-soft: #e4f4ec;
  --bad: #c0392b;
  --bad-soft: #fbe9e7;
  --warn: #b26a00;
  --warn-soft: #fff4dc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(1, 51, 52, .06), 0 4px 16px rgba(1, 51, 52, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Vazirmatn, Tahoma, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.8; }
a { color: var(--brand-2); }
code { background: var(--brand-soft); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
h1, h2, h3 { color: var(--brand); line-height: 1.5; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; margin: 1.4rem 0 .6rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 700; color: var(--ink); text-decoration: none; }
.nowrap { white-space: nowrap; }
.inline { display: inline; margin: 0; }
.pre { white-space: pre-wrap; }
[hidden] { display: none !important; }

/* top bar */
.topbar { background: var(--brand); position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; font-weight: 700; }
.brand img { height: 46px; width: auto; display: block; }
.brand span { font-size: .95rem; opacity: .92; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav > a:not(.btn) { color: #d6e4e4; text-decoration: none; padding: 6px 12px; border-radius: 10px; font-size: .92rem; }
.nav > a:not(.btn):hover { background: rgba(255,255,255,.08); color: #fff; }
.nav > a.on:not(.btn) { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 -2px 0 var(--accent); }
.nav-exit { background: none; border: 0; color: #9fb6b6; font: inherit; font-size: .88rem; cursor: pointer; padding: 6px 10px; }
.nav-exit:hover { color: #fff; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; border: 1px solid #e8eeee; }
.card.narrow { max-width: 760px; margin-inline: auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 8px 16px; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-sm { padding: 5px 12px; font-size: .85rem; }
.btn-xs { padding: 2px 10px; font-size: .78rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); }
.btn-danger-ghost { background: #fff; color: var(--bad); border-color: #f0c9c4; }
.btn-danger-ghost:hover { background: var(--bad-soft); }
.btn.done { background: var(--ok) !important; color: #fff !important; border-color: var(--ok) !important; }
.topbar .btn-accent.on { box-shadow: 0 0 0 2px rgba(255,255,255,.4); }

/* flash */
.flash { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: .92rem; }
.flash-ok { background: var(--ok-soft); color: #0f5f3c; }
.flash-bad { background: var(--bad-soft); color: #8f2a1f; }
.flash-warn { background: var(--warn-soft); color: #7a4a00; }
.callout { background: var(--accent-soft); border: 1px dashed #ffc199; border-radius: 12px; padding: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
ul.plain { margin: 0; padding-right: 18px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); border: 1px solid #e8eeee; border-top: 3px solid var(--brand); }
.stat b { display: block; font-size: 1.6rem; color: var(--brand); line-height: 1.3; }
.stat span { font-size: .85rem; color: var(--muted); }
.stat-wait { border-top-color: #2f8fbf; }
.stat-ok { border-top-color: var(--ok); }
.stat-bad { border-top-color: var(--bad); }
.stat-accent { background: var(--brand); border-top-color: var(--accent); }
.stat-accent b { color: var(--accent); }
.stat-accent span { color: #cfe0e0; }

/* filters & table */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 102, 0, .15); }
.filters input, .filters select { width: auto; min-width: 150px; padding: 6px 10px; font-size: .88rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: right; font-weight: 600; color: var(--muted); font-size: .82rem; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid #edf1f1; vertical-align: top; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #f7fafa; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.badge-lg { font-size: .9rem; padding: 4px 14px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-wait { background: #e3f1f8; color: #1f6f97; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.empty p { margin: 0 0 12px; }

/* forms */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; color: var(--brand); }
.form input, .form select, .form textarea { font-weight: 400; color: var(--ink); }
.form label > span .muted { font-weight: 400; font-size: .85rem; }
.form label small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }
textarea { resize: vertical; line-height: 1.8; }
[dir="ltr"] { text-align: left; }

/* login */
.login-body { background: radial-gradient(1200px 600px at 80% -10%, #0b4a4a 0%, var(--brand) 55%, #00211f 100%); min-height: 100vh; }
.login-body .wrap { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { background: #fff; border-radius: 20px; padding: 28px 26px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.3); text-align: center; border-bottom: 4px solid var(--accent); }
.login-logo { width: 200px; max-width: 70%; height: auto; margin: -4px auto 6px; display: block; }
.login-card h1 { font-size: 1.15rem; margin: 6px 0 0; }
.login-card form { display: grid; gap: 12px; margin-top: 16px; }

/* job page */
.job-head { display: grid; gap: 12px; }
.job-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.job-title h1 { font-size: 1.35rem; margin: 0; flex: 1 1 300px; }
.back { font-size: .85rem; color: var(--muted); text-decoration: none; flex-basis: 100%; }
.back:hover { color: var(--accent); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.facts dt { font-size: .78rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.facts.stack { display: grid; gap: 12px; margin-bottom: 16px; }
.facts.stack dd { font-weight: 400; word-break: break-word; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.progress { display: flex; gap: 18px; align-items: center; border-right: 4px solid #2f8fbf; }
.progress h2 { margin-bottom: 4px; }
.progress p { margin: 0; }
.timer b { color: var(--accent); font-variant-numeric: tabular-nums; }
.spinner { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-card { border-right: 4px solid var(--bad); }
.error-card h2 { color: var(--bad); }
.error-msg { font-weight: 600; }
.error-card pre { background: #fafafa; border: 1px solid var(--line); padding: 10px; border-radius: 8px; max-height: 320px; overflow: auto; white-space: pre-wrap; font-size: .8rem; }
details summary { cursor: pointer; color: var(--brand); font-weight: 600; margin-bottom: 10px; }

.copybar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; background: linear-gradient(90deg, #fff, var(--accent-soft)); }
.copy-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.copy-label { font-size: .85rem; color: var(--muted); margin-left: 4px; }
.src { display: none; }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin: -4px -4px 16px; overflow-x: auto; }
.tab { background: none; border: 0; font: inherit; font-size: .92rem; color: var(--muted); padding: 8px 14px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); font-weight: 700; border-bottom-color: var(--accent); }
.count { font-style: normal; background: var(--brand-soft); color: var(--brand); font-size: .72rem; border-radius: 999px; padding: 0 7px; }
.count-warn { background: var(--warn-soft); color: var(--warn); }
.panel-tools { display: flex; justify-content: flex-end; margin-bottom: 8px; gap: 6px; }

.preview { width: 100%; min-height: 600px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.code { background: #0d2223; color: #d8ecec; padding: 14px; border-radius: 10px; overflow: auto; max-height: 600px; font-size: .8rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Menlo, Consolas, monospace; }
.plain-text { background: #fbfcfc; border: 1px solid var(--line); padding: 16px; border-radius: 10px; white-space: pre-wrap; font-family: inherit; font-size: .95rem; line-height: 2; max-height: 600px; overflow: auto; margin: 0; }

.meta-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.meta-text { flex: 1; }
.chars { font-size: .78rem; font-weight: 700; border-radius: 6px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.chars-ok { background: var(--ok-soft); color: var(--ok); }
.chars-bad { background: var(--warn-soft); color: var(--warn); }

.image-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.image-target { font-weight: 700; color: var(--brand); border-right: 3px solid var(--accent); padding-right: 8px; }
.prompt { background: #f7f9f9; padding: 8px 12px; border-radius: 8px; font-size: .88rem; margin: 8px 0; }
.alt { margin: 0 0 8px; font-size: .9rem; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.qa-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.qa-summary div { background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; }
.qa-summary b { display: block; font-size: 1.25rem; color: var(--brand); }
.qa-summary span { font-size: .8rem; color: var(--muted); }
.qa-summary .warn { background: var(--warn-soft); }
.qa-summary .warn b { color: var(--warn); }
.warn-line { color: var(--warn); }
.fix-line { color: var(--ok); }

.sources { padding: 0; list-style: none; margin: 0; }
.sources li { display: grid; padding: 8px 0; border-bottom: 1px solid #edf1f1; }
.inputs summary { margin: 0; }
.inputs[open] summary { margin-bottom: 12px; }

.account-list { display: grid; gap: 10px; }
.account { display: flex; justify-content: space-between; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; flex-wrap: wrap; }
.account:hover { border-color: #c7d4d4; }
.account-main { display: grid; gap: 2px; min-width: 0; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-accent { grid-column: span 2; }
  .two-col { grid-template-columns: 1fr; }
  .qa-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.show-sm { display: none; }
@media (max-width: 600px) {
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .brand span { display: none; }
  .brand img { height: 38px; }
  .grid-2 { grid-template-columns: 1fr; }
  .filters input, .filters select { flex: 1 1 100%; }
  .card { padding: 14px; }
  .progress { flex-direction: column; text-align: center; }
}
