@font-face {
  font-family: "IRANYekanX";
  src: url("/IRANYekanXVF.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #07101b;
  --surface: #0c1826;
  --surface-2: #102133;
  --line: #23384c;
  --text: #eef7fb;
  --muted: #8ca3b5;
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.12);
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  font-family: "IRANYekanX", Tahoma, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { width: 100%; overflow-x: hidden; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(34, 211, 238, 0.09), transparent 28rem),
    linear-gradient(180deg, #07101b 0%, #091421 100%);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

button { font: inherit; }

.shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 32px 48px; }

.topbar {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.25; letter-spacing: -0.04em; }
h2 { font-size: 1.2rem; line-height: 1.4; }

.eyebrow {
  margin-bottom: 4px;
  color: var(--cyan);
  text-align: right;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
}

.phase-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.phase-chip span {
  padding: 7px 12px;
  border: 1px solid rgba(34, 211, 238, 0.4);
  border-radius: 999px;
  color: var(--cyan);
  background: var(--cyan-soft);
}

main { display: grid; gap: 24px; padding-top: 28px; }
main, section, article, .metric-grid, .source-grid, .lower-grid { min-width: 0; }
.overview, .workspace, .articles-workspace, .panel, .crawl-callout { border: 1px solid var(--line); background: rgba(12, 24, 38, 0.9); }
.overview, .workspace, .articles-workspace { padding: 24px; }

.section-heading, .panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.button {
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, .text-button:focus-visible { outline: 3px solid rgba(34, 211, 238, 0.35); outline-offset: 2px; }
.button.primary { background: var(--cyan); color: #03212a; font-weight: 700; }
.button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
.button.disabled { background: #152333; color: #61778a; border-color: #26384a; cursor: not-allowed; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric { min-height: 142px; padding: 18px; display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--bg); }
.metric.accent { border-color: rgba(34, 211, 238, 0.45); background: linear-gradient(145deg, rgba(34, 211, 238, 0.13), #081522 70%); }
.metric-label { color: var(--muted); font-size: 0.88rem; }
.metric strong { margin: auto 0 10px; font-size: 2rem; font-weight: 700; line-height: 1; }
.status-line { color: var(--muted); font-size: 0.8rem; display: flex; align-items: center; gap: 8px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(140, 163, 181, 0.08); }
.dot.ready { background: var(--green); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1); }
.dot.failed { background: var(--red); box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.1); }
.dot.pending { background: var(--amber); }

.source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.source-card, .loading-card { min-height: 178px; padding: 18px; border: 1px solid var(--line); background: var(--bg); }
.source-card { display: flex; flex-direction: column; }
.source-head { display: flex; justify-content: space-between; gap: 16px; }
.source-card h3 { margin: 0; font-size: 1rem; }
.scope { margin-top: 5px; color: var(--muted); font-size: 0.75rem; }
.probe-state { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.probe-state.reachable { color: var(--green); }
.probe-state.blocked { color: var(--amber); }
.probe-state.failed { color: var(--red); }
.source-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: auto 0 14px; color: var(--muted); font-size: 0.82rem; }
.source-meta b { display: block; color: var(--text); font-size: 0.95rem; font-weight: 600; }
.checkpoint { margin: 0 0 12px; color: var(--muted); font-size: 0.78rem; }
.checkpoint b { color: #c7d6df; font-weight: 500; }
.source-card .button { width: 100%; }

.database-badge { color: var(--green); font-size: 0.82rem; border: 1px solid rgba(52, 211, 153, 0.28); padding: 6px 10px; border-radius: 999px; }
.article-tools { display: flex; align-items: center; gap: 10px; }
.search-box input { width: min(310px, 45vw); min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); padding: 8px 13px; font: inherit; }
.search-box input:focus { outline: 3px solid rgba(34, 211, 238, 0.2); border-color: var(--cyan); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.article-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.article-card { min-width: 0; display: grid; grid-template-columns: 180px minmax(0, 1fr); border: 1px solid var(--line); background: var(--bg); overflow: hidden; }
.article-image { width: 100%; height: 100%; min-height: 225px; object-fit: cover; background: var(--surface-2); }
.article-image.placeholder { display: grid; place-items: center; color: var(--muted); padding: 20px; font-size: 0.82rem; }
.article-content { min-width: 0; padding: 18px; display: flex; flex-direction: column; }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 9px; color: var(--cyan); font-size: 0.78rem; line-height: 1.5; }
.article-card h3 { margin: 0; font-size: 1rem; line-height: 1.7; }
.article-lead { margin: 9px 0 14px; color: #a9bdca; font-size: 0.88rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.article-body { color: var(--muted); font-size: 0.86rem; }
.article-body summary { color: var(--text); cursor: pointer; margin-bottom: 8px; }
.article-body p { white-space: pre-wrap; max-height: 230px; overflow: auto; padding-left: 8px; }
.article-link { margin-top: auto; padding-top: 14px; color: var(--cyan); text-decoration: none; font-size: 0.84rem; }
.article-link:hover { text-decoration: underline; }
.load-more-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; color: var(--muted); font-size: 0.84rem; }

.lower-grid { display: grid; grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr); gap: 24px; }
.panel { min-height: 300px; padding: 24px; }
.pipeline { list-style: none; margin: 0; padding: 0; }
.pipeline li { position: relative; padding: 4px 34px 22px 0; color: var(--muted); }
.pipeline li::before { content: ""; position: absolute; right: 4px; top: 8px; width: 10px; height: 10px; border: 2px solid var(--line); border-radius: 50%; background: var(--surface); }
.pipeline li:not(:last-child)::after { content: ""; position: absolute; right: 9px; top: 22px; width: 1px; height: calc(100% - 10px); background: var(--line); }
.pipeline li.done::before { border-color: var(--green); background: var(--green); }
.pipeline li.active::before { border-color: var(--cyan); box-shadow: 0 0 0 5px var(--cyan-soft); }
.pipeline b, .pipeline span { display: block; }
.pipeline b { color: var(--text); font-size: 0.95rem; }
.pipeline span { font-size: 0.82rem; }

.text-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.console { height: 205px; overflow: auto; border: 1px solid var(--line); background: #050b12; padding: 12px 14px; font-size: 0.78rem; line-height: 1.8; }
.console p { display: grid; grid-template-columns: 82px 1fr; gap: 12px; color: #b9c9d5; }
.console time { color: #557086; }

.crawl-callout { padding: 24px; display: flex; justify-content: space-between; align-items: center; gap: 24px; border-right: 4px solid var(--cyan); }
.crawl-callout p:not(.eyebrow) { max-width: 760px; margin-top: 7px; color: var(--muted); }
.crawl-actions { display: flex; gap: 10px; flex-shrink: 0; }

@media (max-width: 960px) {
  .metric-grid, .source-grid { grid-template-columns: repeat(2, 1fr); }
  .article-grid { grid-template-columns: 1fr; }
  .lower-grid { grid-template-columns: 1fr; }
  .crawl-callout { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 620px) {
  .shell { padding: 0 16px 32px; }
  .topbar { min-height: 96px; }
  .phase-chip { display: none; }
  .overview, .workspace, .articles-workspace, .panel { padding: 18px; }
  .metric-grid, .source-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-wrap: wrap; }
  .section-heading > *, .source-head > * { min-width: 0; }
  .source-card, .metric { overflow: hidden; }
  .article-card { grid-template-columns: 1fr; }
  .article-image { height: 210px; min-height: 0; }
  .article-tools { width: 100%; align-items: stretch; flex-direction: column; }
  .search-box input { width: 100%; }
  .database-badge { align-self: flex-start; }
  .source-grid .loading-card { min-height: 100px; }
  .crawl-actions { width: 100%; flex-direction: column; }
  .crawl-actions .button { width: 100%; }
}
