/* Atom Accountant: the report panel (left) + the equation board / tiles (right) inside the practice shell's stage. */
.aa { position: absolute; inset: 0; display: grid; grid-template-columns: 286px minmax(0, 1fr); gap: 10px; padding: 10px 12px; }
.aa-side { display: flex; flex-direction: column; gap: 7px; min-height: 0; overflow-y: auto; padding: 10px 12px; border-radius: var(--tlg-radius-lg);
  border: var(--tlg-border-width) solid var(--tlg-border); background: var(--tlg-surface); }
.aa-k { margin: 2px 0 0; font-size: 16px; font-weight: var(--tlg-weight-bold); text-transform: uppercase; letter-spacing: var(--tlg-tracking-caps); color: var(--ps-accent); }
html[data-theme="dark"] .aa-k { color: var(--tlg-text-muted); }
.aa-msg { margin: 0; min-height: 1.2em; font-size: 16px; font-weight: 700; color: var(--tlg-danger, #b42318); }
html[data-theme="dark"] .aa-msg { color: #ffb4a8; }
.aa-keys { color: var(--tlg-text-muted); font-size: 16px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.aa-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.aa-main { position: relative; min-width: 0; min-height: 0; }

/* ── molecule cards (light "specimen plates" in both themes so the atoms read) ── */
.aa-card { all: unset; box-sizing: border-box; position: relative; width: 156px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 6px 6px;
  border-radius: 12px; background: #f7faf5; border: 2px solid #9db59a; color: #13241a; box-shadow: 0 2px 5px rgba(0, 0, 0, .14); font-family: var(--tlg-font); }
.aa-card--token { cursor: grab; }
.aa-card--token:focus-visible, .aa-tok:focus-visible, .aa-tag:focus-visible { outline: var(--tlg-focus-width) solid var(--tlg-focus); outline-offset: 3px; }
.aa-card--token.is-disabled { cursor: default; }
.aa-card-art { display: block; width: 144px; height: 92px; pointer-events: none; }
.aa-card-art .aa-mol { width: 100%; height: 100%; display: block; overflow: visible; }
.aa-card-coef { position: absolute; left: 8px; top: 2px; font: 800 26px/1.1 var(--tlg-font); color: #2f6b3a; }
.aa-card-name { display: grid; text-align: center; line-height: 1.15; pointer-events: none; }
.aa-card-name b { font-size: 18px; }
.aa-card-name span { font-size: 16px; color: #4b5b52; }
.aa-card-mark { position: absolute; right: -8px; top: -8px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; font-weight: 900; font-size: 16px; color: #fff; }
.aa-card-mark.is-ok { display: grid; background: #2e8b57; }
.aa-card-mark.is-bad { display: grid; background: #c0392b; }
.aa-card-mark.is-moved { display: grid; background: #b7791f; }
.aa-card[data-was]::before { content: attr(data-was); position: absolute; left: 8px; top: 32px; font-size: 16px; font-weight: 700; color: #b42318; text-decoration: line-through; }
.aa-card.is-giving { border-color: #c7cfc8; }
.aa-card.is-made { border-color: #2e8b57; box-shadow: 0 0 0 3px rgba(46, 139, 87, .28), 0 2px 5px rgba(0, 0, 0, .14); }
.aa-card--zone.is-wrong { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, .3); }
.aa-card-drop { position: absolute; right: 4px; bottom: 44px; }
.aa-tray-slot > .aa-card + .aa-card::after { content: "+"; position: absolute; top: -21px; left: 50%; transform: translateX(-50%); font: 800 22px/1 var(--tlg-font); color: var(--tlg-text); }
.aa-tray-slot:has(> :nth-child(3)) .aa-card { width: 112px; }
.aa-tray-slot:has(> :nth-child(3)) .aa-card-art { width: 96px; height: 60px; }

/* atoms inside the molecules */
.aa-atom { transition: opacity .25s ease; }
.aa-atom.aa-hide { opacity: 0; }
.aa-atom.aa-dim { opacity: .22; }
.aa-atom.aa-pop > circle:first-of-type { animation: aa-pop .5s ease-out; }
@keyframes aa-pop { from { filter: brightness(1.9) drop-shadow(0 0 6px #fff7b0); } to { filter: none; } }
.aa-atom.is-tagged > circle:first-of-type, .aa-flyatom.is-tagged > circle:first-of-type { stroke: #f5b800; stroke-width: 3.5; animation: aa-glow 1.1s ease-in-out infinite alternate; }
@keyframes aa-glow { from { filter: drop-shadow(0 0 3px #ffd400); } to { filter: drop-shadow(0 0 9px #ffb300) drop-shadow(0 0 3px #fff3a0); } }

/* ── the equation board ── */
.aa-board { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; }
.aa-eq { display: grid; grid-template-columns: minmax(0, 1fr) 128px minmax(0, 1fr); gap: 8px; align-items: stretch; }
.aa-tray, .aa-bin { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px 10px; border-radius: var(--tlg-radius-lg); border: 2px dashed var(--tlg-border-strong); background: var(--tlg-surface-2); }
.aa-tray-k { margin: 0; font-size: 16px; font-weight: 800; }
.aa-tray-slot, .aa-bin-slot { flex: 1; display: flex; flex-wrap: wrap; gap: 18px 10px; align-items: center; justify-content: center; min-height: 150px; }
.aa--sort .aa-tray { min-height: 196px; }
.aa-tray.is-over, .aa-bin.is-over { background: color-mix(in srgb, var(--ps-accent) 12%, var(--tlg-surface-2)); }
.aa-bin.is-empty .aa-bin-slot::before { content: "All cards sorted"; color: var(--tlg-text-muted); font-size: 16px; }
.aa-arrow { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--tlg-text); text-align: center; }
.aa-arrow-svg { width: 84px; height: 32px; color: #2f6b3a; }
html[data-theme="dark"] .aa-arrow-svg { color: #9bd39a; }
.aa-energy { display: block; padding: 3px 6px; border-radius: 10px; font-size: 16px; font-weight: 700; line-height: 1.2; border: 2px solid; }
.aa-energy.is-empty { border-style: dashed; border-color: var(--tlg-border-strong); color: var(--tlg-text-muted); }
.aa-energy--light { background: #fff6cc; border-color: #d9a400; color: #5a4300; }
.aa-energy--atp { background: #ffe8d6; border-color: #c8653a; color: #6a2a10; }
.aa-energy--bad { background: #f1e6f7; border-color: #8a5aa8; color: #47285a; }
.aa-arrow-org { display: grid; justify-items: center; font-size: 16px; font-weight: 700; }
.aa-arrow-org.is-empty { padding: 10px 4px; border: 2px dashed var(--tlg-border-strong); border-radius: 10px; color: var(--tlg-text-muted); }
.aa-org { display: block; width: 100%; height: auto; }
.aa-org--mini { width: 84px; }
.aa-org--tiny { width: 40px; display: inline-block; vertical-align: middle; }
.aa-energyzone { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 66px; padding: 8px 12px; border-radius: var(--tlg-radius-lg);
  border: 2px dashed #8a5aa8; background: color-mix(in srgb, #8a5aa8 8%, var(--tlg-surface)); font-size: 16px; font-weight: 700; }
.aa-energyzone small { font-size: 16px; font-weight: 400; color: var(--tlg-text-muted); }
.aa-energyzone.is-wrong { border-style: solid; border-color: #c0392b; }
.aa-fly { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 5; }

/* coefficient steppers (numeric-input key look) */
.aa-step { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.aa-card .pn-key.aa-step-btn { min-height: 40px; width: 40px; padding: 0; font-size: 24px; background: #fff; color: #13241a; border-color: #8aa088; }
.aa-card .pn-key.aa-step-btn:disabled { opacity: .3; }
.aa-step-val { min-width: 44px; height: 40px; display: grid; place-items: center; border-radius: var(--tlg-radius-sm); border: 2px solid #8aa088; background: #fff; font: 800 22px/1 var(--tlg-font); font-variant-numeric: tabular-nums; }
.aa-step-val:focus-visible { outline: var(--tlg-focus-width) solid var(--tlg-focus); outline-offset: 2px; }
.aa-step-lock { height: 40px; display: grid; place-items: center; padding: 0 10px; border-radius: var(--tlg-radius-sm); background: #e6eee4; font-size: 16px; font-weight: 700; }

/* ── the ledger ── */
.aa-ledger { width: 100%; border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; }
.aa-ledger caption { text-align: left; font-size: 16px; font-weight: var(--tlg-weight-bold); text-transform: uppercase; letter-spacing: var(--tlg-tracking-caps); color: var(--ps-accent); padding-bottom: 2px; }
html[data-theme="dark"] .aa-ledger caption { color: var(--tlg-text-muted); }
.aa-ledger th, .aa-ledger td { padding: 3px 4px; border-bottom: 1px solid var(--tlg-border); text-align: left; }
.aa-ledger tbody th { white-space: nowrap; }
.aa-ledger thead th { font-size: 16px; color: var(--tlg-text-muted); }
.aa-ledger .aa-n { text-align: center; font-weight: 800; font-size: 17px; width: 44px; }
.aa-lmark { width: 28px; text-align: center; font-weight: 900; font-size: 18px; }
.aa-ledger tr.is-ok .aa-lmark { color: #2e8b57; }
.aa-ledger tr.is-bad .aa-lmark { color: #c0392b; }
html[data-theme="dark"] .aa-ledger tr.is-ok .aa-lmark { color: #7ee2a8; }
html[data-theme="dark"] .aa-ledger tr.is-bad .aa-lmark { color: #ff9c8f; }
.aa-sw { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 16px; font-weight: 900; border: 1.5px solid; vertical-align: middle; }
.aa-sw--C { background: #3b4047; color: #fff; border-color: #1d2024; }
.aa-sw--H { background: #f7f7f5; color: #30343a; border-color: #8a8f96; }
.aa-sw--O { background: #d8402f; color: #fff; border-color: #8e2216; }

/* branch stamp + energy picker */
.aa-orgs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.aa-orgbtn { all: unset; box-sizing: border-box; position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--tlg-border-strong); background: var(--tlg-surface); color: var(--tlg-text); font: 700 16px/1.2 var(--tlg-font); min-height: 44px; }
.aa-orgbtn:focus-visible { outline: var(--tlg-focus-width) solid var(--tlg-focus); outline-offset: 2px; }
.aa-orgbtn[aria-checked="true"] { border: 3px solid var(--ps-accent); background: color-mix(in srgb, var(--ps-accent) 14%, var(--tlg-surface)); }
.aa-orgbtn[aria-checked="true"]::before { content: "●"; position: absolute; left: 6px; top: 3px; font-size: 16px; line-height: 1; color: var(--ps-accent); }
.aa-orgbtn:disabled { cursor: default; }
.aa-orgbtn .aa-org { width: 100px; }
.aa-orgbtn-mark, .aa-enbtn-mark { position: absolute; right: 4px; top: 2px; font-weight: 900; font-size: 18px; }
.aa-orgbtn.is-right, .aa-enbtn.is-right { border-color: #2e8b57; }
.aa-orgbtn.is-right .aa-orgbtn-mark, .aa-enbtn.is-right .aa-enbtn-mark { color: #2e8b57; }
.aa-orgbtn.is-wrong, .aa-enbtn.is-wrong { border-color: #c0392b; }
.aa-orgbtn.is-wrong .aa-orgbtn-mark, .aa-enbtn.is-wrong .aa-enbtn-mark { color: #c0392b; }
.aa-energies { display: grid; gap: 5px; }
.aa-enbtn { position: relative; min-height: 42px; padding: 4px 26px 4px 12px; border-radius: var(--tlg-radius-sm); font-size: 16px; line-height: 1.2; text-align: left; white-space: normal; }
.aa-enbtn.is-right .aa-enbtn-mark, .aa-enbtn.is-wrong .aa-enbtn-mark { color: inherit; }
.aa-branch { padding: 6px 8px; border-radius: var(--tlg-radius-sm); background: var(--tlg-surface-2); }
.aa-branch-eq { margin: 2px 0 0; font-size: 16px; font-weight: 700; }

/* tokens: tagged atom, dry mass, line item, glucose */
.aa-tokentray { display: flex; align-items: center; gap: 10px; min-height: 76px; padding: 6px; border-radius: var(--tlg-radius-sm); border: 2px dashed var(--tlg-border-strong); background: var(--tlg-surface-2); }
.aa-tokentray--big { flex-direction: column; align-items: stretch; }
.aa-tokentray.is-empty::before { content: "Placed →"; display: grid; place-items: center; min-width: 64px; min-height: 56px; font-size: 16px; font-weight: 700; color: var(--tlg-text-muted); }
.aa-tray-tip { margin: 0; font-size: 16px; line-height: 1.3; }
.aa-tag { all: unset; box-sizing: border-box; flex: none; display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; cursor: grab; position: relative;
  background: radial-gradient(circle at 40% 35%, #fffbe0, #ffe27a); border: 3px solid #e0a800; box-shadow: 0 0 12px 3px rgba(255, 196, 0, .65); animation: aa-tagpulse 1.1s ease-in-out infinite alternate; }
@keyframes aa-tagpulse { from { box-shadow: 0 0 6px 2px rgba(255, 196, 0, .5); } to { box-shadow: 0 0 16px 6px rgba(255, 196, 0, .8); } }
.aa-tag-atom { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font: 900 18px/1 Arial, sans-serif; border: 2px solid; }
.aa-tag-atom.aa-sw--C { background: #3b4047; color: #fff; border-color: #1d2024; }
.aa-tag-atom.aa-sw--O { background: #d8402f; color: #fff; border-color: #8e2216; }
.aa-tag-iso { position: absolute; bottom: -4px; right: -10px; padding: 0 5px; border-radius: 8px; background: #3a2c00; color: #ffe27a; font-size: 16px; font-weight: 800; }
.aa-card-drop .aa-tag { width: 40px; height: 40px; }
.aa-card-drop .aa-tag-atom { width: 28px; height: 28px; font-size: 16px; }
.aa-energyzone .aa-zone-slot .aa-tag { width: 46px; height: 46px; }
.aa-tok { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; cursor: grab;
  background: #f7faf5; color: #13241a; border: 3px solid var(--ps-accent); box-shadow: 0 3px 8px rgba(0, 0, 0, .22); font: 700 16px/1.25 var(--tlg-font); }
.aa-tok.is-disabled { cursor: default; }
.aa-tok--log .aa-log { width: 72px; height: 48px; flex: none; }
.aa-tok-mol { display: block; width: 70px; height: 50px; flex: none; }
.aa-tok-mol .aa-mol { width: 100%; height: 100%; display: block; overflow: visible; }
.aa-tok-mol--atp { width: 90px; height: 40px; color: #13241a; }
/* the ATP line item: the drawing on top (full width, so its "ATP" label reads at >= 16px), the line under it */
.aa-tok--line:has(.aa-tok-mol--atp) { flex-direction: column; align-items: stretch; }
.aa-tok--line > .aa-tok-mol--atp { width: 100%; max-width: 210px; height: auto; align-self: center; overflow: visible; }
.aa-tok-line { font-size: 16px; }

/* tiles: tree sources, stages, payouts */
.aa-treeboard, .aa-stageboard, .aa-yieldboard { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; }
.aa-plantbox { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; border-radius: var(--tlg-radius-lg);
  background: linear-gradient(#dff0fb, #eef7ea); border: var(--tlg-border-width) solid var(--tlg-border); padding: 6px; }
html[data-theme="dark"] .aa-plantbox { background: linear-gradient(#1f3446, #1d2d22); }
.aa-plant { flex: 1; min-height: 0; width: 100%; max-width: 280px; }
.aa-plant-name { margin: 0; font-weight: 800; }
.aa-tiles { display: grid; gap: 10px; }
.aa-tiles--2 { grid-template-columns: repeat(2, 1fr); }
.aa-tiles--3 { grid-template-columns: repeat(3, 1fr); }
.aa-tiles--4 { grid-template-columns: repeat(4, 1fr); }
.aa-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 120px; padding: 8px 8px 10px; border-radius: var(--tlg-radius-lg);
  border: 2px solid var(--tlg-border-strong); background: var(--tlg-surface); text-align: center; }
.aa-tile-art { display: block; width: 100%; max-width: 150px; }
.aa-tile-art svg { width: 100%; height: auto; display: block; }
.aa-tile-t { display: grid; font-size: 16px; font-weight: 700; line-height: 1.2; }
.aa-tile-t small { font-size: 16px; font-weight: 400; color: var(--tlg-text-muted); }
.aa-tile-icon svg { width: 40px; height: 40px; display: block; }
.aa-tile-mark { position: absolute; right: 8px; top: 4px; font-weight: 900; font-size: 22px; }
.aa-tile.is-right { border-color: #2e8b57; box-shadow: 0 0 0 3px rgba(46, 139, 87, .3); }
.aa-tile.is-right .aa-tile-mark { color: #2e8b57; }
.aa-tile.is-wrong { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, .3); }
.aa-tile.is-wrong .aa-tile-mark { color: #c0392b; }
html[data-theme="dark"] .aa-tile.is-right .aa-tile-mark { color: #7ee2a8; }
html[data-theme="dark"] .aa-tile.is-wrong .aa-tile-mark { color: #ff9c8f; }
.aa-zone-slot { display: flex; justify-content: center; }
.aa-tile .aa-zone-slot:empty { display: none; }
.aa-tile .aa-tok { padding: 3px 6px; gap: 4px; font-size: 16px; }
.aa-tile .aa-tok .aa-tok-line, .aa-tile .aa-tok > span:not(.aa-tok-mol) { display: none; }
.aa-tile .aa-tok--log .aa-log { width: 48px; height: 32px; }
.aa-tile .aa-tok-mol { width: 44px; height: 32px; }
.aa-stagegrp { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: var(--tlg-radius-lg); border: 2px dashed var(--tlg-border-strong); }
.aa-stagegrp--photo { background: color-mix(in srgb, #2f8f3a 8%, var(--tlg-surface-2)); }
.aa-stagegrp--resp { background: color-mix(in srgb, #c8653a 8%, var(--tlg-surface-2)); }
.aa-stagegrp-k { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; }
.aa-tile--stage { min-height: 112px; }
.aa-yieldboard .aa-tiles { flex: 1; align-content: center; }
.aa-tile--yield { min-height: 170px; justify-content: center; }
.aa-coins { width: 100%; height: auto; }

/* ── Briefing worked example ── */
.aa-ex { display: grid; gap: 10px; }
.aa-ex-eq { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.aa-ex-op { font: 800 24px/1 var(--tlg-font); display: grid; justify-items: center; }
.aa-ex-op small { font-size: 16px; font-weight: 700; color: var(--tlg-text-muted); }
.aa-ex .aa-card { width: 128px; }
.aa-ex .aa-card-art { width: 110px; height: 70px; }
.aa-ex .aa-card-coef.is-one { color: #2f6b3a; }
.aa-ex-ledger { max-width: 360px; margin: 0 auto; width: 100%; }
.ps-brief--drawer .aa-ex .aa-card { width: 92px; padding: 4px; }
.ps-brief--drawer .aa-ex .aa-card-art { width: 80px; height: 50px; }
.ps-brief--drawer .aa-ex .aa-card-name span { display: none; }
.ps-brief--drawer .aa-ex .aa-card-coef { font-size: 20px; }
.aa-start-art { width: 100%; height: auto; display: block; }

@media (max-width: 1100px) {
  .aa { grid-template-columns: 250px minmax(0, 1fr); }
  .aa-card { width: 128px; }
  .aa-card-art { width: 110px; height: 70px; }
  .aa-ledger th, .aa-ledger td { padding: 3px 2px; }
  .aa-orgbtn { padding: 6px 0; }
}
@media (max-width: 900px) {
  .aa { position: static; grid-template-columns: 1fr; }
  .aa-main { min-height: 560px; }
  .aa-tiles--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .aa-tag, .aa-atom.is-tagged > circle:first-of-type { animation: none; }
}
/* The assignment card's usual corner (bottom-right of the stage) covers the last source/zone tile: use the empty
   bottom of the customer column instead; the column gets room at its foot so long feedback can scroll out from under it. */
@media (min-width: 901px) {
  html.ps-locked:has(.aa) .lga-card { right: auto; left: 12px; }
  html.ps-locked:has(.aa):has(.lga-card) .ps-side { padding-bottom: 84px; }
}
