/* Karghah — dark workshop UI */
:root {
  --bg: #0b0b0e; --bg2: #101014; --card: #141419; --card2: #1a1a21;
  --line: #26262e; --line2: #32323c; --text: #ececf1; --muted: #9b9ba6; --dim: #6b6b76;
  --amber: #f5a623; --amber2: #ffbe4d; --green: #34d399; --red: #f87171; --blue: #60a5fa;
  --r: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, "Noto Sans", sans-serif; font-size: 15px; line-height: 1.65; }
html[dir="rtl"] body { font-family: Tahoma, "Vazirmatn", "Segoe UI", -apple-system, sans-serif; }

#app { max-width: 860px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

header { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  background: rgba(11,11,14,.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-badge { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 21px;
  background: linear-gradient(135deg, rgba(245,166,35,.16), rgba(245,166,35,.04)); border: 1px solid rgba(245,166,35,.4); border-radius: 13px; }
.brand-name { font-weight: 800; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 12px; }
.header-side { display: flex; align-items: center; gap: 8px; }
.status-chip { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line2); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status-chip.ok { color: var(--green); border-color: rgba(52,211,153,.4); }
.ghost-btn { background: var(--card); color: var(--text); border: 1px solid var(--line2); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 12.5px; cursor: pointer; }

main { flex: 1; padding: 18px 18px 40px; }
footer { padding: 10px 18px 22px; color: var(--dim); font-size: 12px; text-align: center; }

h2.section { font-size: 14px; color: var(--muted); font-weight: 800; margin: 6px 2px 12px; }

/* capability cards */
.cap-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .cap-grid { grid-template-columns: 1fr 1fr; } }
.cap-card { display: flex; gap: 13px; align-items: flex-start; text-align: start; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 15px; cursor: pointer; color: inherit; }
.cap-card:hover { border-color: rgba(245,166,35,.55); }
.cap-card .ic { font-size: 26px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  background: var(--card2); border: 1px solid var(--line2); border-radius: 14px; flex: 0 0 auto; }
.cap-card .t { font-weight: 800; font-size: 15.5px; margin-bottom: 2px; }
.cap-card .s { color: var(--muted); font-size: 12.5px; }
.cap-card .badge-line { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 10.5px; border-radius: 999px; padding: 1px 9px; border: 1px solid var(--line2); color: var(--muted); }
.badge.green { color: var(--green); border-color: rgba(52,211,153,.4); }
.badge.amber { color: var(--amber); border-color: rgba(245,166,35,.45); }

/* capability page */
.back-btn { background: none; border: none; color: var(--amber); font-size: 13.5px; font-weight: 700; cursor: pointer; padding: 4px 0; margin-bottom: 6px; }
.cap-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.cap-head .ic { font-size: 26px; }
.cap-head h1 { font-size: 20px; margin: 0; }
.cap-head .s { color: var(--muted); font-size: 13px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 15px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 14px; color: var(--text); }
.note { color: var(--muted); font-size: 12.5px; }

/* file dropzones */
.drop { border: 1.5px dashed var(--line2); border-radius: 14px; padding: 16px; text-align: center; cursor: pointer; background: var(--bg2); display: block; }
.drop:hover, .drop.has { border-color: rgba(245,166,35,.6); background: rgba(245,166,35,.04); }
.drop .lbl { font-weight: 700; font-size: 13.5px; }
.drop .hint { color: var(--dim); font-size: 12px; margin-top: 2px; }
.drop .picked { color: var(--green); font-size: 12.5px; margin-top: 6px; word-break: break-all; }
.field-block { margin-bottom: 12px; }
.field-block:last-child { margin-bottom: 0; }

/* radio choice cards */
.group-title { font-size: 13px; font-weight: 800; color: var(--muted); margin: 0 0 8px; }
.choices { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 640px) { .choices.two { grid-template-columns: 1fr 1fr; } }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line2); background: var(--bg2);
  border-radius: 13px; padding: 11px 12px; cursor: pointer; }
.choice:hover { border-color: rgba(245,166,35,.5); }
.choice.sel { border-color: var(--amber); background: rgba(245,166,35,.06); }
.choice .rad { width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--line2); flex: 0 0 auto; margin-top: 3px; position: relative; }
.choice.sel .rad { border-color: var(--amber); }
.choice.sel .rad::after { content: ''; position: absolute; inset: 3px; background: var(--amber); border-radius: 50%; }
.choice .ct { flex: 1; min-width: 0; }
.choice .cl { font-weight: 750; font-size: 13.5px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.choice .cd { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* start button + progress */
.start-btn { width: 100%; border: none; border-radius: 14px; padding: 14px; font-size: 15.5px; font-weight: 800;
  background: linear-gradient(135deg, var(--amber), #e09612); color: #141414; cursor: pointer; }
.start-btn:active { transform: scale(.99); }
.start-btn[disabled] { opacity: .5; cursor: not-allowed; }

.job-panel .bar { height: 10px; background: var(--card2); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.job-panel .bar > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--amber), var(--amber2)); transition: width .4s; }
.job-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.log-box { background: #0a0a0d; border: 1px solid var(--line); border-radius: 12px; padding: 10px; max-height: 220px; overflow: auto;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: #b9b9c3; direction: ltr; text-align: left; white-space: pre-wrap; }
details.logs summary { color: var(--muted); font-size: 12px; cursor: pointer; margin: 8px 0 6px; }
.err { color: var(--red); font-size: 13px; }

/* results */
.result-grid { display: grid; gap: 12px; }
.result-item { background: var(--bg2); border: 1px solid var(--line2); border-radius: 14px; padding: 12px; }
.result-item img, .result-item video { max-width: 100%; border-radius: 10px; display: block; background: #000; }
.result-item h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 700; }
.dl-btn { display: inline-block; margin-top: 9px; background: var(--card2); color: var(--text); border: 1px solid var(--line2);
  border-radius: 11px; padding: 8px 15px; font-weight: 700; font-size: 13px; text-decoration: none; }
.dl-btn:hover { border-color: var(--amber); color: var(--amber); }
.transcript { white-space: pre-wrap; font-size: 13.5px; max-height: 320px; overflow: auto; direction: auto; }

/* jobs list */
.jobs-list { display: flex; flex-direction: column; gap: 8px; }
.job-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 13px; padding: 10px 13px; cursor: pointer; }
.job-row:hover { border-color: rgba(245,166,35,.5); }
.job-row .jt { font-weight: 700; font-size: 13.5px; }
.job-row .jm { color: var(--dim); font-size: 11.5px; }
.st { font-size: 11px; border-radius: 999px; padding: 2px 10px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.st.done { color: var(--green); border-color: rgba(52,211,153,.4); }
.st.error { color: var(--red); border-color: rgba(248,113,113,.4); }
.st.running { color: var(--amber); border-color: rgba(245,166,35,.45); }

.empty { color: var(--dim); font-size: 13px; padding: 14px 4px; }

/* toast */
#toast-root { position: fixed; bottom: 22px; inset-inline: 0; display: flex; justify-content: center; pointer-events: none; z-index: 90; }
.toast { background: #23232b; border: 1px solid var(--line2); border-radius: 999px; padding: 9px 18px; font-size: 13px; box-shadow: 0 10px 34px rgba(0,0,0,.55); }

.center { text-align: center; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(245,166,35,.3); border-top-color: var(--amber);
  border-radius: 50%; animation: spin 0.9s linear infinite; vertical-align: -2px; margin-inline-end: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
