/* ==========================================================================
   Admin · Supplier management (2026-12-02): Manage credential and Stock mapping.
   List, filters and form reuse employee-list.css (.ev-*), manage-access.css (.ma-*, .mu-*)
   and manage-employee.css (.me-locked); this file adds the credential fields, the one-row
   stock mapping form, the column tick boxes, the status switch and the remarks dialog.
   ========================================================================== */

/* ---- Manage credential: three fields in a row (product · type · supplier) ---- */
.sp-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.sp-creds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sp-empty { margin: 0; padding: 16px; border: 1px dashed var(--tb-border-strong); border-radius: var(--tb-radius-control); font-size: 13px; color: var(--tb-text-muted); }
.sp-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: var(--tb-radius-control); background: var(--tb-ice); font-size: 13px; color: var(--tb-text-neutral); }
.sp-note .ic { flex-shrink: 0; margin-top: 1px; color: var(--tb-primary); }
.sp-note p { margin: 0; }
.sp-note b { color: var(--tb-text-strong); font-weight: 600; }
.sp-ver { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--tb-text-muted); }
.sp-ver--ok { color: var(--tb-success); font-weight: 600; }
.sp-ver .ic { width: 14px; height: 14px; }

/* Codes are typed in capitals (6E,SG,AI) */
html body .sp .sp-codes { text-transform: uppercase; }
html body .sp .sp-codes::placeholder { text-transform: none; }

/* ---- Stock mapping form: one row as live (Supplier · Booking type · Airline · Create / Clear) — 2026-12-03 ---- */
html body .sp .sp-mapform { padding: 28px 32px; }
.sp-mapform__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.sp-maprow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 16px; align-items: start; }
.sp-maprow .tb-field { margin: 0; min-width: 0; }
.sp-maprow .tb-hint { margin-top: 4px; }
.sp-maprow__actions { display: flex; gap: 8px; padding-top: 26px; }

/* ---- Stock mapping list ---- */
.ma-filters__grid.sp-filters { grid-template-columns: minmax(0, 320px) 1fr; }
html body .sp .sp-filters .ma-filters__actions { justify-content: flex-start; }
.sp-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
.sp-chip { padding: 1px 7px; border-radius: 6px; background: var(--tb-ice); font-size: 12px; font-weight: 600; color: var(--tb-primary); }
.sp-remark { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body .sp .ev-table tr.is-inactive td:not(.sp-c-act) { color: var(--tb-text-muted); }

/* Show columns (live tick boxes above the grid) */
.sp-cols { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 16px; margin: 0 0 12px; padding: 0; border: 0; }
.sp-cols__lbl { float: left; margin: 0 4px 0 0; padding: 0; font-size: 12.5px; font-weight: 600; color: var(--tb-text-muted); }
.sp-cols__opt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--tb-text-neutral); cursor: pointer; }
.sp-cols__opt input { width: 16px; height: 16px; margin: 0; accent-color: var(--tb-primary); cursor: pointer; }

/* Optional columns stay hidden until ticked */
.sp-map .sp-c-cd, .sp-map .sp-c-cb, .sp-map .sp-c-ud, .sp-map .sp-c-ub, .sp-map .sp-c-ed { display: none; }
.sp-map.show-cd .sp-c-cd, .sp-map.show-cb .sp-c-cb, .sp-map.show-ud .sp-c-ud, .sp-map.show-ub .sp-c-ub, .sp-map.show-ed .sp-c-ed { display: table-cell; }
/* No sticky first / last column here: Edit and the optional columns come and go */
html body .sp .sp-map th, html body .sp .sp-map td { position: static; box-shadow: none; }
.sp-map td.sp-c-act { width: 1%; white-space: nowrap; }

/* Edit / Delete as text links, as live */
.sp-link { padding: 0; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--tb-royal); text-decoration: none; cursor: pointer; }
.sp-link:hover { text-decoration: underline; }
.sp-link:focus-visible { outline: 2px solid var(--tb-royal); outline-offset: 2px; border-radius: 2px; }
.sp-link--danger { color: var(--tb-danger-ink); }

/* Status switch in the row (opens the remarks window) */
.sp-status { display: inline-flex; align-items: center; gap: 10px; }
.sp-status__txt { font-size: 13px; font-weight: 600; color: var(--tb-text-neutral); }
html body .sp button.sp-switch { padding: 0; border: 0; background: none; cursor: pointer; }
.sp-switch[aria-checked="true"] .tb-switch__track { background: var(--tb-success); }
.sp-switch[aria-checked="true"] .tb-switch__knob { transform: translateX(18px); }
.sp-switch:focus-visible .tb-switch__track { outline: 3px solid rgba(22, 119, 232, .45); outline-offset: 2px; }

/* ---- Dialogs ---- */
.sp-dialog { max-width: 480px; }
.sp-dialog .tb-field { margin-top: 16px; }
.sp-dialog textarea { resize: vertical; }

@media (max-width: 1099px) {
    .sp-maprow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sp-maprow__actions { grid-column: 1 / -1; padding-top: 4px; }
}
@media (max-width: 900px) {
    .sp-row3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .sp-creds, .sp-maprow { grid-template-columns: minmax(0, 1fr); }
    .ma-filters__grid.sp-filters { grid-template-columns: minmax(0, 1fr); }
    html body .sp .sp-mapform { padding: 24px 20px; }
    .sp-mapform__head { flex-wrap: wrap; }
    .sp-cols { justify-content: flex-start; }
    .sp-cols__lbl { width: 100%; }
}
/* Phone cards: Edit / Delete go to the end of each card, side by side */
@container evtable (max-width: 640px) {
    .sp-map.show-ed td.sp-c-ed { display: block; order: 10; }
    .sp-map.show-ed td.sp-c-ed:first-child { grid-column: 1; }
}

/* ---- List-first (2026-12-03): Stock mapping's one-row form inside the side panel ---- */
html body .sp .lf-drawer .sp-mapform { padding: 0; }
.lf-drawer .sp-mapform__head { position: sticky; top: 0; z-index: 3; margin: 0; padding: 22px 20px 18px 28px; border-bottom: 1px solid var(--tb-border); background: var(--tb-surface); }
.lf-drawer .sp-mapform__head .lf-drawer__close { margin-left: auto; }
.lf-drawer .sp-mapform .ma-form__alert { margin: 20px 28px 0; }
html body .sp .lf-drawer .sp-maprow { display: flex; flex-direction: column; align-items: stretch; flex: 1; gap: 18px; padding: 22px 28px 0; }
html body .sp .lf-drawer .sp-maprow__actions { position: sticky; bottom: 0; margin: auto -28px 0; padding: 14px 28px; border-top: 1px solid var(--tb-border); background: var(--tb-surface); justify-content: flex-end; gap: 10px; }
html body .sp .lf-drawer .sp-maprow__actions .js-lf-clear { order: 0; margin-right: auto; }
html body .sp .lf-drawer .sp-maprow__actions .js-lf-close { order: 1; }
html body .sp .lf-drawer .sp-maprow__actions [type="submit"] { order: 2; }
@media (max-width: 640px) {
    .lf-drawer .sp-mapform__head { padding: 18px 12px 14px 20px; }
    .lf-drawer .sp-mapform .ma-form__alert { margin: 16px 20px 0; }
    html body .sp .lf-drawer .sp-maprow { padding: 20px 20px 0; }
    html body .sp .lf-drawer .sp-maprow__actions { margin: auto -20px 0; padding: 12px 20px; }
}
