/* Pieces the kit does not have, for the core screens: ภาพรวม (S-201), หลักสูตร (S-202/203),
   รอบอบรม (S-204), วิทยากร (S-205), ตั้งค่าการชำระเงิน (S-209) and ทีม (S-222). Built only on the
   kit's tokens (--ink, --muted, --line, --bg, --paper, --soft, --green, --blue, --gold, --danger)
   and classes, like admin-screens.css. Load after admin-screens.css. */

/* ---- Shared ---- */
/* .field / .formgrid set display, so the hidden attribute needs saying again (kit note). */
.rn-form [hidden],
.ce-fields [hidden],
#tm-pass[hidden] {
  display: none !important;
}
.ce-row > input,
.tag-add input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #7a8f8f;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}
html[data-theme="dark"] .ce-row > input,
html[data-theme="dark"] .tag-add input {
  border-color: #5f7f80;
}
/* Kit icon buttons are 42px on the desktop; these sit in dense rows, so keep 44px targets. */
.ed-tools .iconbtn,
.ps-bank .iconbtn {
  height: 44px;
  min-width: 44px;
}
.sp-dialog .tag-chip-x,
.ps-rules .tag-chip-x {
  width: 44px;
  height: 44px;
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ce-rep,
.ce-lock,
.ce-prices,
.ps-set,
.ps-wht,
.rn-price,
.sp-tagset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.ce-rep > legend,
.ps-set > legend,
.rn-price > legend {
  margin-bottom: 10px;
  padding: 0;
  font-weight: 600;
  font-size: 0.95rem;
}
.ps-set + .ps-set {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.ce-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
}
.ce-file > svg {
  color: var(--green);
}
.ce-file .grow {
  display: grid;
  flex: 1 1 200px;
  min-width: 0;
}
.ce-file-name {
  overflow-wrap: anywhere;
}
.savebar {
  display: flex;
  justify-content: flex-end;
}
#confirm-dialog.rn-confirm {
  max-width: 720px;
}
#modal.sp-dialog,
#modal.tm-dialog {
  max-width: 640px;
}

/* ---- Seat bar (S-204) ---- */
.seat {
  display: grid;
  gap: 5px;
  min-width: 120px;
}
.seat-text {
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.seat-bar {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}
.seat-bar > span {
  display: block;
  width: calc(var(--fill, 0) * 1%);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}
.seat.is-low .seat-bar > span {
  background: var(--gold);
}
.seat.is-full .seat-bar > span {
  background: var(--danger);
}

/* ---- ภาพรวม (S-201) ---- */
.db-avatar {
  width: 58px;
  height: 58px;
  font-size: 1.4rem;
}
/* The kit's ringed avatar holds a drawn figure; with no photo here it holds the initial. */
.db-initial {
  background-color: #0f3a3d; /* behind the gradient, so the initial stays readable */
  place-items: center;
  font-weight: 700;
  line-height: 1;
}
.db .m-section a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.s-activity .m-avatar {
  width: 36px;
  height: 36px;
  font-size: 0.9rem;
}
.db-more {
  min-height: 44px;
  color: var(--green);
  font-size: 0.88rem;
}
.db .m-section {
  margin-top: 26px;
}
.db .m-hello + .db-grid .m-section:first-child,
.db-grid > div > section:first-child .m-section {
  margin-top: 6px;
}
@media (min-width: 1200px) {
  .db-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
    gap: 0 28px;
    align-items: start;
  }
}

/* ---- หลักสูตร: รายการ (S-202) ---- */
.cs-name {
  min-width: 240px;
}
.cs-name a {
  overflow-wrap: anywhere;
}
.cs-next {
  min-width: 150px;
}

/* ---- รอบอบรม (S-204) ---- */
.rn-month .panel-head {
  flex-wrap: wrap;
}
.rn-month .panel-head h2 {
  font-size: 1.05rem;
}
.rn-date {
  white-space: nowrap;
}
.rn-cancelled td,
.rn-cancelled th {
  color: var(--muted);
}
.rn-gap .panel-body {
  gap: 10px;
}
.rn-gap-line {
  flex-wrap: wrap;
}
.rn-gap-line .grow {
  flex: 1 1 220px;
  min-width: 0;
}
.rn-gap:focus {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.rn-foot {
  margin: 0 2px 22px;
}
.rn-sheet-sum {
  margin: 0 0 8px;
  padding: 0 4px;
}
.rn-sheet-none {
  margin: 8px 4px 12px;
}
.rn-log {
  margin: 12px 4px 4px;
  font-size: 0.88rem;
}
.rn-log summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--blue);
  cursor: pointer;
}
.rn-due {
  margin: 0;
}
.rn-tiers {
  margin-top: 10px;
}

/* ---- หลักสูตร: ตัวแก้ (S-203) ---- */
.ce-tabbar .tabs {
  margin-bottom: 22px;
  padding: 0;
}
.ce-tabbar .tabs .tab.active {
  border-bottom-color: var(--green);
  color: var(--green);
  font-weight: 600;
}
.ce-tabbar .tabs .tab:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.ce-fields {
  min-width: 0;
}
.ce-sk-title {
  height: 56px;
  margin-bottom: 18px;
  border-radius: 8px;
}
.ce-cover {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.ce-art {
  width: 160px;
  height: 90px;
  flex: none;
}
.ce-art-bg {
  fill: var(--soft);
}
.ce-art-a {
  fill: var(--green);
  opacity: 0.35;
}
.ce-art-b {
  fill: var(--green);
  opacity: 0.6;
}
.ce-cover-info {
  display: grid;
  flex: 1 1 200px;
  gap: 6px;
  justify-items: start;
  min-width: 0;
}
.ce-cover-field label {
  margin-top: 6px;
}
.ce-list {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}
.ce-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ce-row > input {
  flex: 1 1 220px;
  width: auto;
  min-width: 0;
}
.ce-row .ed-tools {
  margin-left: 0;
}
.ce-slot {
  align-items: flex-end;
}
.ce-slot .field {
  gap: 4px;
}
.ce-time {
  flex: 0 0 104px;
}
.ce-topic {
  flex: 1 1 220px;
  min-width: 0;
}
.ce-day .ce-list {
  margin-bottom: 0;
}
.ce-day-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ce-rep > .field-err:not(:empty) {
  display: block;
  margin: 0 0 8px;
}
.ce-rep .ed-item:last-of-type {
  margin-bottom: 10px;
}
.ce-price-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.ce-fee {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}
.ce-wht {
  max-width: 360px;
}
.tablewrap .ce-fee-table {
  min-width: 560px;
}
.ce-fee-table caption {
  padding: 0 0 8px;
  font-weight: 600;
  text-align: left;
}
.ce-fee-table th,
.ce-fee-table td {
  padding: 10px 14px;
}
.ce-fee-table th[scope="row"] {
  background: none;
  color: var(--ink);
  font-weight: 500;
}
.ce-fee-table th.num {
  text-align: right;
}
/* Phones: the six money columns scroll sideways inside their own box; the row name stays put. */
@media (max-width: 1023px) {
  .ce-fee-table th[scope="row"],
  .ce-fee-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--paper);
    box-shadow: 1px 0 0 var(--line);
  }
}
.ce-speakers {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.ce-sp {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ce-sp-main {
  display: grid;
  flex: 1 1 200px;
  gap: 2px;
  min-width: 0;
}
.ce-sp .ed-tools {
  margin-left: auto;
}
.ce-sp-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}
.ce-sp-add .field {
  flex: 1 1 220px;
}
.ce-serp {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  overflow-wrap: anywhere;
}
.ce-serp figcaption {
  margin-bottom: 6px;
}
.ce-serp-url {
  color: var(--muted);
  font-size: 0.8rem;
}
.ce-serp-title {
  color: var(--blue);
  font-size: 1.05rem;
}
.ce-serp-desc {
  color: var(--ink);
  font-size: 0.86rem;
}
.ce-versions {
  display: grid;
  gap: 0;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.ce-versions li {
  display: grid;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.ce-versions li:last-child {
  border-bottom: 0;
}
.ce-v-main {
  display: grid;
  gap: 2px;
  font-size: 0.86rem;
}
.editor-layout aside .field {
  margin-bottom: 10px;
}
@media (max-width: 1100px) {
  .ce-price-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .ce-price-grid {
    grid-template-columns: 1fr 1fr;
  }
  .ce-time {
    flex-basis: 88px;
  }
}

/* ---- วิทยากร (S-205) ---- */
.sp-who {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}
.sp-who > div {
  display: grid;
  min-width: 0;
}
.sp-tags,
.sp-uses,
.sp-block {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 260px;
}
.sp-uses {
  display: grid;
  gap: 2px;
  font-size: 0.84rem;
}
.sp-uses a,
.sp-block a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}
.sp-block {
  display: grid;
  gap: 4px;
}
.sheet .sp-uses {
  padding: 0 4px 8px;
}

/* ---- ตั้งค่าการชำระเงิน (S-209) ---- */
.ps-lead,
.ps-sod {
  margin: 0 0 12px;
}
.ps-sod {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 0;
}
.ps-banks {
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ps-bank {
  flex-wrap: wrap;
}
.ps-bank .grow {
  flex: 1 1 220px;
  min-width: 0;
}
.ps-bank .actions {
  flex-wrap: wrap;
  gap: 6px;
}
.ps-bank.is-off strong,
.ps-bank.is-off .ps-acct {
  color: var(--muted);
}
.ps-order {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 600;
}
.ps-acct {
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}
.ps-qr {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px;
}
.ps-qr .ld-facts {
  flex: 1 1 240px;
}
.ps-qr-frame {
  display: grid;
  gap: 6px;
  justify-items: center;
  margin: 0;
}
.ps-qr-art {
  display: block;
  width: 150px;
  height: 150px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
/* A QR is always dark on white, in both themes. */
.ps-qr-bg {
  fill: #fff;
}
.ps-qr-fg {
  fill: #0f3a3d;
}
.ps-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}
.ps-wht {
  margin-top: 14px;
}
.ps-wht > .field-err:not(:empty),
.ps-set > .field-err:not(:empty) {
  display: block;
}
.ps-example {
  margin: 12px 0 8px;
}
.ps-add {
  margin: 10px 0 6px;
}
.ps-add input {
  flex: 1 1 auto;
}
.ps-changes {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 1.3em;
}
.ps-rules .savebar {
  padding-top: 6px;
}
@media (max-width: 1023px) {
  /* Above the tab bar and the prototype strip, like the slip buttons. */
  .ps-rules .savebar {
    bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--proto-h, 0px));
  }
}

/* ---- ทีม (S-222) ---- */
.tm-line .grow {
  flex: 1 1 220px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.tm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tablewrap .tm-roles {
  min-width: 0;
}
.tm-roles th,
.tm-roles td {
  padding: 10px 12px;
  white-space: normal;
  vertical-align: top;
}
.tm-roles th[scope="row"] {
  background: none;
  color: var(--ink);
  font-weight: 600;
}
.tm-summary {
  margin: 0;
}
#tm-caps.is-off .role-option {
  opacity: 0.6;
}
