/* ATLAS-1: «الخارطة» tab. Uses the console tokens of app.css (light and dark). */
.atlas .at-card { margin-top: 12px; }
.atlas .at-head .at-meta { margin: 4px 0 8px; }
.atlas .ltr { direction: ltr; unicode-bidi: isolate; font-family: var(--mono); font-size: 12.5px; }
.atlas .ltr.strong, .atlas .strong { font-weight: 600; }
.atlas .hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.atlas .at-msg { padding: 10px 12px; border-radius: var(--r-ctrl); background: var(--warn-soft); color: var(--warn); margin: 8px 0; font-size: 13px; }
.atlas .at-msg.bad, .atlas .state-line.bad { background: var(--bad-soft); color: var(--bad); }

.atlas .at-subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.atlas .at-subtab { border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); border-radius: var(--r-pill); padding: 6px 12px; font: 500 13px var(--sans); cursor: pointer; min-height: 34px; }
.atlas .at-subtab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.atlas .at-back { border: 0; background: none; color: var(--accent-ink); font: 600 14px var(--sans); cursor: pointer; padding: 4px 0 10px; }
.atlas .at-small { font-size: 12.5px; margin-top: 8px; }

.atlas .at-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.atlas .at-kpi { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface-2); position: relative; min-height: 96px; }
.atlas .at-kpi .v { font: 700 24px var(--sans); color: var(--ink); direction: ltr; text-align: end; }
.atlas .at-kpi .l { font: 600 13px var(--sans); color: var(--ink); margin-top: 2px; }
.atlas .at-kpi .s { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.atlas .at-kpi .at-svg { width: 100%; height: 26px; margin-top: 6px; }
.atlas .at-kpi.ok { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.atlas .at-kpi.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-soft); }
.atlas .at-kpi.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: var(--bad-soft); }
.atlas .at-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.atlas .at-bar { fill: var(--accent); }
.atlas .at-svg { display: block; width: 100%; max-height: 110px; }

.atlas .at-stack { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: var(--surface-3); margin: 8px 0; direction: ltr; }
.atlas .at-stack .seg { height: 100%; }
.atlas .at-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.atlas .at-legend .item { display: inline-flex; align-items: center; gap: 6px; }
.atlas .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.atlas .c0 { background: #2563EB; } .atlas .c1 { background: #0F766E; } .atlas .c2 { background: #D97706; } .atlas .c3 { background: #7C3AED; }
.atlas .c4 { background: #DB2777; } .atlas .c5 { background: #0891B2; } .atlas .c6 { background: #65A30D; } .atlas .c7 { background: #64748B; }

.atlas .at-grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.atlas .at-grade { border-radius: 12px; padding: 10px; text-align: center; border: 1px solid var(--line); }
.atlas .at-grade b { display: block; font: 700 22px var(--sans); }
.atlas .gA { color: var(--ok); } .atlas .gB { color: var(--accent-ink); } .atlas .gC { color: var(--warn); } .atlas .gD { color: var(--bad); }

.atlas .at-badge { display: inline-block; border-radius: 999px; padding: 1px 8px; font: 600 11.5px var(--sans); background: var(--surface-3); color: var(--muted); margin-inline-end: 6px; white-space: nowrap; }
.atlas .at-badge.ok { background: var(--ok-soft); color: var(--ok); }
.atlas .at-badge.warn { background: var(--warn-soft); color: var(--warn); }
.atlas .at-badge.bad { background: var(--bad-soft); color: var(--bad); }
.atlas .at-badge.gA { background: var(--ok-soft); } .atlas .at-badge.gB { background: var(--accent-soft); }
.atlas .at-badge.gC { background: var(--warn-soft); } .atlas .at-badge.gD { background: var(--bad-soft); }
.atlas .at-badge.m-GET { background: var(--accent-soft); color: var(--accent-ink); }
.atlas .at-badge.m-POST, .atlas .at-badge.m-PUT, .atlas .at-badge.m-PATCH { background: var(--warn-soft); color: var(--warn); }
.atlas .at-badge.m-DELETE { background: var(--bad-soft); color: var(--bad); }
.atlas .at-badge.k-controller, .atlas .at-badge.k-route, .atlas .at-badge.k-handler { background: var(--accent-soft); color: var(--accent-ink); }
.atlas .at-badge.k-entity, .atlas .at-badge.k-table { background: var(--ok-soft); color: var(--ok); }

.atlas .at-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 6px; }
.atlas .at-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.atlas .at-table th { text-align: start; color: var(--muted); font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.atlas .at-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.atlas .at-table .num { text-align: end; direction: ltr; font-variant-numeric: tabular-nums; }
.atlas .at-table th.sortable { cursor: pointer; }
.atlas .at-table th.asc::after { content: ' ▲'; } .atlas .at-table th.desc::after { content: ' ▼'; }
.atlas .at-table tr.clickable { cursor: pointer; }
.atlas .at-table tr.clickable:hover td { background: var(--surface-2); }

.atlas .at-input { width: 100%; min-height: 44px; border: 1px solid var(--line-2); border-radius: var(--r-ctrl); padding: 8px 12px; background: var(--surface); color: var(--ink); font: 400 14px var(--sans); box-sizing: border-box; }
.atlas .at-input:focus { outline: 2px solid var(--accent-glow); border-color: var(--accent); }
.atlas .at-searchrow { display: flex; gap: 8px; margin: 10px 0; }
.atlas .at-searchrow .at-kind { width: 170px; flex: none; }
.atlas .at-hit { border-bottom: 1px solid var(--line); padding: 10px 2px; }
.atlas .at-hit .top { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.atlas .at-hit .meta, .atlas .meta { color: var(--muted); font-size: 12px; margin-inline-start: 8px; }
.atlas .at-hit .doc { color: var(--muted); font-size: 12.5px; margin-top: 4px; line-height: 1.6; }
.atlas .link { color: var(--accent-ink); cursor: pointer; text-decoration: none; font-weight: 600; }

.atlas .at-purpose { line-height: 1.7; margin: 6px 0 10px; }
.atlas .at-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.atlas .chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; background: var(--surface-2); }
.atlas .chip b { font-variant-numeric: tabular-nums; }
.atlas .at-healthparts .row { display: grid; grid-template-columns: 100px 1fr 54px; gap: 8px; align-items: center; margin: 4px 0; font-size: 12.5px; }
.atlas .at-meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.atlas .at-meter .fill { height: 100%; background: var(--accent); }
.atlas .at-healthparts .v { direction: ltr; text-align: end; color: var(--muted); }

.atlas .at-file { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin: 6px 0; }
.atlas .at-file summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.atlas .at-file .path { font-weight: 600; }
.atlas .at-syms { list-style: none; padding-inline-start: 4px; margin: 8px 0 0; }
.atlas .at-syms li { margin: 4px 0; }
.atlas .at-syms ul { list-style: none; padding-inline-start: 18px; margin: 4px 0; }
.atlas .at-syms li.hot > .ltr { color: var(--warn); }
.atlas .at-entity { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 8px 0; }
.atlas .at-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.atlas h4 { margin: 14px 0 6px; font-size: 14px; }

.atlas .at-md h2, .atlas .at-md h3, .atlas .at-md h4 { margin: 18px 0 6px; }
.atlas .at-md p, .atlas .at-md li { line-height: 1.8; }
.atlas .at-md pre { background: var(--surface-3); border-radius: 10px; padding: 10px 12px; overflow-x: auto; font: 12.5px var(--mono); }
.atlas .at-md .code { background: var(--surface-3); border-radius: 6px; padding: 1px 5px; }
.atlas .at-md .row { white-space: pre; overflow-x: auto; font-size: 12px; }

/* WORKSHOP-1: «الورشة» */
.atlas .at-open { margin: 6px 0; font-size: 12.5px; }
.atlas .chip .ltr { margin: 0 4px; }
.atlas a.link.ltr { font-family: var(--mono); font-size: 12.5px; }
.atlas .ws-recent { margin-top: 10px; align-items: center; }
.atlas .ws-recent .chip { cursor: pointer; border: 1px solid var(--line-2); background: var(--surface-2); }
.atlas .ws-title { gap: 8px; flex-wrap: wrap; }
.atlas .ws-title .strong { font-size: 14px; word-break: break-all; }
.atlas .ws-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.atlas .ws-deep { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.atlas .b2.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.atlas .ws-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; align-items: start; margin-top: 12px; }
.atlas .ws-side { max-height: 78vh; overflow: auto; padding: 12px; position: sticky; top: 8px; }
.atlas .ws-side h4 { margin: 10px 0 6px; font-size: 13px; }
.atlas .ws-outline, .atlas .ws-files, .atlas .ws-hits { list-style: none; margin: 0; padding: 0; }
.atlas .ws-sym, .atlas .ws-files li, .atlas .ws-hits li { padding: 5px 6px; border-radius: 8px; cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.atlas .ws-sym:hover, .atlas .ws-files li:hover, .atlas .ws-hits li:hover { background: var(--surface-3); }
.atlas .ws-sym .name { font-weight: 600; word-break: break-all; }
.atlas .ws-sym .meta, .atlas .ws-hits .meta { color: var(--muted); font-size: 11.5px; }
.atlas .ws-files li { color: var(--accent-ink); word-break: break-all; }
.atlas .ws-hits li { flex-direction: column; align-items: flex-start; border-bottom: 1px solid var(--line); border-radius: 0; }
.atlas .ws-hits .code { white-space: pre-wrap; word-break: break-word; }
.atlas .ws-main { padding: 0; overflow: hidden; }
.atlas .ws-selbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; z-index: 2; min-height: 48px; }
.atlas .ws-code { max-height: 72vh; overflow: auto; font: 12.5px/1.65 var(--mono); direction: ltr; text-align: left; background: var(--surface-2); tab-size: 2; }
.atlas .ws-ln { display: flex; white-space: pre; }
.atlas .ws-ln.sel { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.atlas .ws-no { flex: 0 0 auto; width: 52px; text-align: right; padding-right: 10px; color: var(--muted); user-select: none; cursor: pointer; border-right: 1px solid var(--line); margin-right: 8px; }
.atlas .ws-no:hover { color: var(--accent-ink); }
.atlas .ws-tx { flex: 1 1 auto; padding-right: 12px; }
.atlas .tk-k { color: #7c3aed; font-weight: 600; }
.atlas .tk-s { color: #0f7b3e; }
.atlas .tk-c { color: #8a8f98; font-style: italic; }
.atlas .tk-n { color: #b45309; }
.atlas .tk-d { color: #c026d3; }
.atlas .tk-t { color: #0369a1; cursor: pointer; }
.atlas .tk-i { cursor: pointer; }
.atlas .tk-t:hover, .atlas .tk-i:hover { text-decoration: underline dotted; }
.atlas .ws-out .at-card { margin-top: 12px; }
/* WORKSHOP-4: ask an agent, agent work on a file */
.atlas .ws-askgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0; }
.atlas .ws-askgrid label { display: flex; flex-direction: column; gap: 4px; }
.atlas .ws-words { width: 100%; min-height: 76px; resize: vertical; font: 14px/1.6 var(--sans); }
.atlas .ws-task { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; background: var(--surface-2); }
.atlas .ws-taskhd { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.atlas .ws-taskhd .meta { color: var(--muted); font-size: 12px; }
.atlas .ws-report, .atlas .ws-notes { margin-top: 8px; }
.atlas .ws-report summary, .atlas .ws-notes summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--accent-ink); }
.atlas .ws-note { border-top: 1px dashed var(--line); padding: 6px 0; font-size: 13px; }
.atlas .ws-pair { border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 14px; padding: 10px; margin: 8px 0; }
.atlas .ws-paircols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.atlas .at-badge.st-in_progress, .atlas .at-badge.st-assigned { background: var(--warn-soft); color: var(--warn); }
.atlas .at-badge.st-report_ready, .atlas .at-badge.st-done { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.atlas .at-badge.st-blocked { background: var(--bad-soft); color: var(--bad); }
.atlas .ws-ask { margin: 12px 0 8px; }
/* WORKSHOP-3: sandbox */
.atlas .sb-panel { margin-top: 12px; }
.atlas .sb-panel:empty { display: none; }
.atlas .sb-panel h4 { margin: 4px 0; }
.atlas .sb-text { width: 100%; min-height: 60vh; font: 12.5px/1.6 var(--mono); direction: ltr; text-align: left; tab-size: 2; white-space: pre; overflow: auto; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); color: var(--ink); resize: vertical; }
.atlas .sb-status { margin: 8px 0; font-size: 13px; }
.atlas .sb-ok { color: var(--ok); font-weight: 600; }
.atlas .sb-errs { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.7; }
.atlas .sb-diff { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; overflow: auto; max-height: 50vh; font: 12px/1.55 var(--mono); text-align: left; }
.atlas .sb-diff .add { color: #15803d; background: color-mix(in srgb, #22c55e 12%, transparent); display: block; }
.atlas .sb-diff .del { color: #b91c1c; background: color-mix(in srgb, #ef4444 12%, transparent); display: block; }
.atlas .sb-diff .hunk { color: var(--accent-ink); display: block; }
.atlas .sb-suggest { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.atlas .sb-handin { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.atlas .sb-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
/* WORKSHOP-2: learning mode */
.atlas .ln-progress { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 8px 0 4px; }
.atlas .ln-progress .fill { height: 100%; background: var(--accent); border-radius: 99px; }
.atlas .ln-list { display: grid; gap: 8px; margin: 12px 0; }
.atlas .ln-item { display: flex; gap: 12px; align-items: center; text-align: start; width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 12px; cursor: pointer; font: 14px var(--sans); color: var(--ink); }
.atlas .ln-item:hover { border-color: var(--accent); }
.atlas .ln-item.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.atlas .ln-n { flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-weight: 700; }
.atlas .ln-item.done .ln-n { background: var(--ok); color: #fff; }
.atlas .ln-txt { display: flex; flex-direction: column; gap: 2px; }
.atlas .ln-gloss { display: grid; gap: 6px; margin-top: 8px; }
.atlas .ln-term { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; line-height: 1.7; }
.atlas .ln-mini { font-size: 12px; padding: 2px 10px; min-height: 28px; }
.atlas .ln-chip { cursor: pointer; }
.atlas .ln-ex, .atlas .ln-exercise { border-top: 1px solid var(--line); padding: 10px 0; }
.atlas .ln-exhd { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.atlas .ln-exhd .meta { color: var(--muted); font-size: 12px; }
.atlas .ln-q { font-weight: 600; line-height: 1.7; margin: 0 0 6px; }
.atlas .ln-result { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.atlas .ln-foot { margin: 12px 0 24px; }
/* ATLAS-DB-1: database map */
.atlas .db-bar { flex-wrap: wrap; align-items: center; }
.atlas .db-canvas { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); overflow: hidden; height: 68vh; touch-action: none; }
.atlas .db-svg { width: 100%; height: 100%; cursor: grab; user-select: none; display: block; }
.atlas .db-svg:active { cursor: grabbing; }
.atlas .db-edge { stroke: var(--line-2); stroke-width: 1.2; opacity: .7; }
.atlas .db-edge.fk { stroke-dasharray: 4 3; }
.atlas .db-edge.on { stroke: var(--accent); stroke-width: 2.4; opacity: 1; }
.atlas .db-node { cursor: pointer; }
.atlas .db-node rect { stroke: color-mix(in srgb, var(--ink) 25%, transparent); stroke-width: 1; }
.atlas .db-node text { font: 600 11px var(--mono); fill: #1f2937; pointer-events: none; }
.atlas .db-node.noent text { fill: var(--muted); }
.atlas .db-node.on rect { stroke: var(--accent); stroke-width: 3; }
.atlas .db-node.hit rect { stroke: #f59e0b; stroke-width: 3; }
.atlas .db-node:hover rect { stroke-width: 2.2; }
.atlas .db-zoom { display: flex; gap: 6px; margin: 6px 0; }
.atlas .db-title { font-size: 16px; }
.atlas .db-explain { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.atlas .db-routes { font-size: 11.5px; line-height: 1.8; }
.atlas .ws-wait { animation: wsPulse 1.4s ease-in-out infinite; }
@keyframes wsPulse { 50% { opacity: .45; } }
@media (prefers-color-scheme: dark) {
  .atlas .tk-k { color: #c4b5fd; } .atlas .tk-s { color: #86efac; } .atlas .tk-n { color: #fdba74; } .atlas .tk-d { color: #f0abfc; } .atlas .tk-t { color: #7dd3fc; }
}
@media (max-width: 760px) {
  .atlas .ws-grid { grid-template-columns: 1fr; }
  .atlas .ws-side { position: static; max-height: 40vh; }
  .atlas .ws-code { max-height: 65vh; font-size: 12px; }
  .atlas .ws-no { width: 40px; }
  .atlas .ws-askgrid, .atlas .ws-paircols { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .atlas .at-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atlas .at-split { grid-template-columns: 1fr; }
  .atlas .at-searchrow { flex-direction: column; }
  .atlas .at-searchrow .at-kind { width: 100%; }
  .atlas .at-grades { grid-template-columns: repeat(2, 1fr); }
  .atlas .at-kpi .v { font-size: 20px; }
}

/* ATLAS-2: «الأداء والأدوات» (public/ops.js) */
.atlas .op-probe { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.atlas .op-ptop { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.atlas .op-url { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.atlas .op-pstats { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.atlas .op-pstats .strong.ok { color: var(--ok); } .atlas .op-pstats .strong.warn { color: var(--warn); } .atlas .op-pstats .strong.bad { color: var(--bad); }
.atlas .op-spark { width: 240px; max-width: 100%; height: 32px; }
.atlas .op-spark .op-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.atlas .op-spark .op-err { stroke: var(--bad); stroke-width: 1; vector-effect: non-scaling-stroke; }
.atlas .op-label { margin-top: 10px; font-size: 13px; }
.atlas .op-meter { position: relative; height: 18px; border-radius: 9px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.atlas .op-fill { height: 100%; border-radius: 9px; }
.atlas .op-fill.ok { background: var(--ok-soft); } .atlas .op-fill.warn { background: var(--warn-soft); } .atlas .op-fill.bad { background: var(--bad-soft); }
.atlas .op-mlabel { position: absolute; inset-inline-start: 8px; top: 0; line-height: 18px; font-size: 12px; direction: ltr; }
.atlas .op-q { width: 100%; margin: 8px 0 4px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: inherit; font: inherit; }
.atlas .op-list { font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.atlas .op-cmd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.atlas .op-wf { padding: 10px 0; border-top: 1px solid var(--line); }
.atlas .op-steps { margin: 6px 0 0; padding-inline-start: 22px; font-size: 13px; color: var(--muted); }
