/* ==========================================================================
   Learn Accounting — practice exercises (loaded after tool.css)
   ========================================================================== */

.ap-card-wrap { padding: 18px; }

.ap-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--subtle);
  border: 1px solid var(--border);
}
.ap-tabs button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 9px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
}
.ap-tabs button strong { font-size: 0.86rem; }
.ap-tabs button small { font-size: 0.7rem; color: var(--text-faint); font-weight: 600; }
.ap-tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
.ap-tabs button[aria-selected="true"] small { color: var(--primary-dark); }
@media (max-width: 560px) {
  .ap-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.ap-card { display: flex; flex-direction: column; gap: 14px; }
.ap-q { font-size: 1.08rem; font-weight: 700; line-height: 1.5; color: var(--text-primary); }
.ap-q-big { font-size: 1.3rem; }
.ap-q-ne { margin-top: -8px; font-size: 0.92rem; color: var(--text-muted); }
.ap-q-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }

.ap-journal {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ap-jrow {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.ap-jrow + .ap-jrow { border-top: 1px solid var(--hairline); }
.ap-jside { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); }
.ap-jamt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 520px) {
  .ap-jrow { grid-template-columns: 1fr auto; }
  .ap-jrow .ap-select { grid-column: 1 / -1; grid-row: 2; }
}

.ap-select,
.ap-input {
  min-height: 42px;
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.ap-select:focus,
.ap-input:focus {
  outline: 2px solid var(--primary-border);
  outline-offset: 1px;
  border-color: var(--primary);
}
.ap-card > .btn { align-self: flex-start; }

.ap-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-opt { min-height: 40px; padding: 0 16px; font-size: 0.88rem; }
.ap-opt.is-right { background: #ecfdf5; border-color: #059669; color: #047857; }
.ap-opt.is-wrong { background: #fef2f2; border-color: #dc2626; color: #b91c1c; }

.ap-feedback {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: 0.9rem;
  line-height: 1.55;
}
.ap-feedback > strong:first-child { display: block; margin-bottom: 4px; font-size: 0.95rem; }
.ap-feedback p { margin: 0; }
.ap-feedback.is-right { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.ap-feedback.is-wrong { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.ap-entry {
  display: block;
  margin-bottom: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  color: var(--text-primary);
}
.ap-golden { display: block; margin-top: 6px; font-size: 0.84rem; opacity: 0.9; }
.ap-hint { font-size: 0.85rem; font-weight: 600; color: #b45309; }

.ap-taccount {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.86rem;
}
.ap-tcol + .ap-tcol { border-left: 2px solid var(--text-secondary); }
.ap-thead {
  padding: 8px 10px;
  background: var(--subtle);
  border-bottom: 2px solid var(--text-secondary);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.ap-trow { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; }
.ap-trow + .ap-trow { border-top: 1px solid var(--hairline); }
.ap-tamt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; }
@media (max-width: 520px) {
  .ap-taccount { grid-template-columns: 1fr; }
  .ap-tcol + .ap-tcol { border-left: 0; border-top: 2px solid var(--text-secondary); }
}

.ap-ledger-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ap-field { display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
@media (max-width: 520px) { .ap-ledger-form { grid-template-columns: 1fr; } }

.ap-trial { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; font-size: 0.86rem; }
.ap-trial-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 64px 64px;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
}
.ap-trial-row + .ap-trial-row { border-top: 1px solid var(--hairline); }
.ap-trial-head { background: var(--subtle); font-size: 0.74rem; font-weight: 700; color: var(--text-muted); }
.ap-trial-head span:nth-child(n+2) { text-align: center; }
.ap-trial-head span:nth-child(2) { text-align: right; }
.ap-trial-foot { background: var(--subtle); font-weight: 800; }
.ap-trial-foot .ap-tamt { font-size: 0.8rem; text-align: center; }
.ap-trial-row.is-wrong { background: #fef2f2; }
.ap-radio { display: flex; justify-content: center; }
.ap-radio input { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }
@media (max-width: 520px) {
  .ap-trial-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 46px 46px; padding: 7px 8px; gap: 4px; }
}

.ap-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}
.ap-count { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }

.ap-saved { margin-top: 16px; font-size: 0.78rem; color: var(--text-faint); }
.ap-reset {
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}

/* Learn → Practise structure */
.ap-mode { display: flex; flex-direction: column; gap: 14px; }
.ap-step {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  vertical-align: 2px;
}
.ap-step-practice { background: #047857; }
.ap-learn {
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
}
.ap-learn summary {
  padding: 12px 14px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  cursor: pointer;
}
.ap-learn-body {
  padding: 0 16px 16px;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
}
.ap-learn-body p { margin: 0 0 10px; }
.ap-learn-body ol,
.ap-learn-body ul { margin: 0 0 12px 20px; }
.ap-learn-body li { margin-bottom: 4px; }
.ap-rule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 12px; }
.ap-rule-grid div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.ap-rule-grid strong { color: var(--text-primary); font-size: 0.88rem; }
.ap-rule-grid span { font-size: 0.84rem; }
@media (max-width: 520px) { .ap-rule-grid { grid-template-columns: 1fr; } }
.ap-example-label { margin: 6px 0 6px !important; font-weight: 700; color: var(--text-primary); font-size: 0.86rem; }
.ap-example {
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-primary);
  overflow-x: auto;
  white-space: pre;
}
.ap-learn-table { width: 100%; border-collapse: collapse; margin: 4px 0 12px; font-size: 0.85rem; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; }
.ap-learn-table th, .ap-learn-table td { padding: 8px 10px; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; }
.ap-learn-table th { font-size: 0.74rem; color: var(--text-muted); background: var(--subtle); }
.ap-practice-h { margin: 6px 0 -2px; font-size: 1rem; color: var(--text-primary); }

/* ---- Language: text is written twice, the inactive one is hidden ---- */
html:not(.l-ne) [data-l="ne"],
html.l-ne [data-l="en"] { display: none !important; }

.la-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.la-lang {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.la-lang button {
  border: 0;
  border-radius: 999px;
  padding: 5px 12px;
  background: transparent;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}
.la-lang button[aria-pressed="true"] { background: var(--primary); color: #ffffff; }

.la-start { margin-top: 18px; }
.la-toc { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 4px 0 22px; }
.la-toc a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}
.la-toc a:hover { border-color: var(--primary-border); }
.la-toc b, .la-topic h2 b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.8rem;
  flex-shrink: 0;
}
@media (max-width: 640px) { .la-toc { grid-template-columns: 1fr 1fr; } }

.la-topic {
  scroll-margin-top: 84px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.la-topic h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 1.2rem; color: var(--text-primary); }
.la-topic p { margin: 0 0 10px; }
.la-topic ol, .la-topic ul { margin: 0 0 12px 20px; }
.la-topic li { margin-bottom: 4px; }
.la-practise {
  display: inline-flex;
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  font-weight: 700;
  font-size: 0.88rem;
}
.la-practise:hover { background: #d1fae5; }
.ap-lesson-link { margin: 0 0 -4px; font-size: 0.84rem; }
.ap-lesson-link a { color: var(--primary-dark); font-weight: 600; text-decoration: underline; }
.lede a { color: var(--primary-dark); text-decoration: underline; }
/* Buttons inside article content keep button styling (not link styling). */
.content .btn-primary,
.content .btn-primary:hover { color: #ffffff; text-decoration: none; }

/* Account types: radio list */
.ap-q-acc { color: var(--primary-dark); }
.ap-radio-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.ap-radio-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.ap-radio-opt:hover { border-color: var(--primary-border); }
.ap-radio-opt input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }
.ap-radio-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.ap-radio-text { display: flex; flex-direction: column; gap: 1px; }
.ap-radio-text strong { font-size: 0.92rem; color: var(--text-primary); }
.ap-radio-text small { font-size: 0.76rem; color: var(--text-muted); }
.ap-radio-list.is-done .ap-radio-opt { cursor: default; }
.ap-radio-list .ap-radio-opt.is-right { border-color: #059669; background: #ecfdf5; }
.ap-radio-opt.is-right strong { color: #047857; }
.ap-radio-list .ap-radio-opt.is-wrong { border-color: #dc2626; background: #fef2f2; }
.ap-radio-opt.is-wrong strong { color: #b91c1c; }
