/* Action Management shared styles.
   Global (not scoped) because these rules target markup rendered inside AntDesign
   components, which sits outside any scoped element of our own. */

/* Zoom picker table (ActionLookupZoomModal) */
.action-zoom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.action-zoom-table thead th {
    position: sticky;
    top: 0;
    background: #fafafa;
    text-align: left;
    font-weight: 600;
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.action-zoom-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #f5f5f5;
}

.action-zoom-table tbody tr {
    cursor: pointer;
}

.action-zoom-table tbody tr:hover {
    background: #f5f5f5;
}

.action-zoom-table tbody tr.is-selected {
    background: #fff3e8;
}

/* A search field that carries a magnifier button next to it, the way eSmart7 pairs a
   dropdown with its zoom. The control keeps the row height so labels stay aligned. */
.action-zoom-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-zoom-field > :first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.action-zoom-field .action-zoom-button {
    flex: 0 0 auto;
}

/*
   Customer customization blocks on the CAR form (Thai DNT, Thaiwah).

   eSmart7 renders each as a run of table rows under a bold heading. A migrated form loses that
   separation, so each part gets its own band and the whole block sits inside a tinted frame —
   this is customer-specific content and should read as distinct from the standard CAR fields.
*/
.action-customize-section {
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    padding: 0 16px 12px;
    margin-bottom: 16px;
    background: #fafafa;
}

.action-customize-band {
    margin: 0 -16px 12px;
    padding: 8px 16px;
    background: #f0f5ff;
    border-bottom: 1px solid #d6e4ff;
    font-weight: 600;
    color: #1d39c4;
}

.action-customize-band:not(:first-child) {
    margin-top: 16px;
    border-top: 1px solid #d6e4ff;
}

/*
   Section headers on the CAR form.

   eSmart7 separates its parts with a coloured band and bold dark text, which is what makes a
   form this long readable — the plain Ant collapse header lets the sections blur together.
*/
.action-section-title {
    font-weight: 600;
    font-size: 14px;
    color: #0050b3;
}

.ant-collapse > .ant-collapse-item > .ant-collapse-header:has(.action-section-title) {
    background: #e6f4ff;
    border-left: 3px solid #1677ff;
}

/* Readable name shown under the organization code, the way eSmart7 prints it beside the box. */
.action-field-hint {
    margin-top: 2px;
    font-size: 12px;
    color: #666;
}

/* Rendered view of a field eSmart7 stores as HTML from its rich-text popup. */
.action-rich-preview {
    margin-top: 6px;
    padding: 8px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    word-wrap: break-word;
}

/* The creator / created-date line eSmart7 prints at the foot of a section. */
.action-section-footer {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 8px 12px;
    margin-top: 8px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
}

/* The ISO clauses a CAR was raised against — eSmart7 prints them as a bulleted list. */
.action-clause-list {
    margin: 0;
    padding-left: 20px;
}

.action-clause-list li {
    color: #237804;
    margin-bottom: 2px;
}

/* eSmart7: <font size='1'><a style='color:gray'>[Detail]</a></font> after each clause. */
.action-clause-detail {
    margin-left: 6px;
    font-size: 11px;
    color: #8c8c8c;
}

.action-clause-detail:hover {
    color: #1677ff;
}

/* The pencil eSmart7 puts beside the clause list, which opens the picker. */
.action-clause-toolbar {
    margin-bottom: 6px;
}

/* module_audit/zoom_sub_clause_multi.aspx: selected clauses above, catalogue below. */
.action-clause-picker__block + .action-clause-picker__block {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.action-clause-picker__heading {
    font-weight: 600;
    color: #003a8c;
    margin-bottom: 8px;
}

.action-clause-picker__filters {
    margin-bottom: 10px;
}

.action-clause-picker__grid {
    max-height: 320px;
    overflow-y: auto;
}

.action-clause-picker__empty {
    color: #999;
    text-align: center;
    padding: 16px;
}

.action-clause-picker__added {
    color: #237804;
    font-size: 12px;
}

.action-clause-picker__pager {
    margin-top: 10px;
    text-align: right;
}

/* list_document_zoom.aspx: the copy-source picker. */
.action-copy-picker__filters {
    margin-bottom: 10px;
}

.action-copy-picker__grid {
    max-height: 380px;
    overflow-y: auto;
}

.action-copy-picker__empty {
    color: #999;
    text-align: center;
    padding: 16px;
}

.action-copy-picker__pager {
    margin-top: 10px;
    text-align: right;
}

/* document_reference_key_iframe.aspx: the reference list eSmart7 embeds under Parts 3 and 4.
   Kept inline rather than in an iframe, so it has to sit quietly inside the Part above it. */
.action-docref {
    margin: 12px 0 4px;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.action-docref__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

.action-docref__title {
    font-weight: 600;
    color: #003a8c;
}

.action-docref__count {
    margin-left: 6px;
    font-weight: 400;
    color: #8c8c8c;
}

.action-docref__empty {
    color: #999;
    text-align: center;
    padding: 12px;
}

/* Report and reference tables fill the page width; a wide one scrolls inside its own box
   rather than pushing the form sideways. */
.action-docref__grid {
    overflow-x: auto;
}

.action-docref__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.action-docref__table th,
.action-docref__table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: top;
}

.action-docref__table th {
    font-weight: 600;
    color: #595959;
    background: #fcfcfc;
    white-space: nowrap;
}

.action-docref-picker__section + .action-docref-picker__section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.action-docref-picker__section-title {
    font-weight: 600;
    color: #003a8c;
    margin-bottom: 8px;
}

.action-docref-picker__filters {
    margin-bottom: 10px;
}

.action-docref-picker__grid {
    max-height: 300px;
    overflow: auto;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
}

.action-docref-picker__actions {
    margin-top: 10px;
    text-align: right;
}

/* eSmart7 splits a Part into lettered sub-blocks (2A, 2B, 4B, 4C...). Each gets its own band so
   the two halves of a Part do not read as one long run of fields. */
.action-subsection {
    margin: 18px 0 10px;
    padding: 6px 10px;
    font-weight: 600;
    color: #003a8c;
    background: #f0f7ff;
    border-left: 3px solid #4096ff;
    border-radius: 2px;
}

/* GetFlowStamp's "Record by / Approve by / Verify by" lines. */
.action-flow-stamp {
    display: flex;
    gap: 8px;
    padding: 4px 0 4px 12px;
    font-size: 13px;
}

.action-flow-stamp__label {
    color: #595959;
    white-space: nowrap;
}

.action-flow-stamp__values {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.action-flow-stamp__user {
    color: #0000fe;
}

.action-flow-stamp__rejected {
    color: #cf1322;
    margin: 0 4px;
}

.action-flow-stamp__date {
    color: #ff0000;
}

/* ShowActionJob's cards — one per action_job row in a section. */
.action-job-list__add {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    font-size: 13px;
}

.action-job-list__empty {
    color: #999;
    padding: 8px 0;
    font-size: 13px;
}

.action-job-card {
    display: flex;
    gap: 12px;
    border: 2px solid #cfcfcf;
    border-radius: 3px;
    padding: 8px 10px;
    margin-bottom: 6px;
}

.action-job-card__detail {
    flex: 1 1 70%;
    border-right: 1px solid #d9d9d9;
    padding-right: 12px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.action-job-card__meta {
    flex: 0 0 30%;
    font-size: 13px;
}

.action-job-card__caption {
    color: #595959;
    white-space: nowrap;
}

.action-job-card__date-start {
    color: #008000;
}

.action-job-card__date-end {
    color: #ff0000;
}

.action-job-card__users {
    color: #0000fe;
    margin-bottom: 4px;
}

.action-job-card__none {
    color: #999;
}

.action-job-card__actions {
    flex: 0 0 auto;
}

/* The responsible-user picker on the job editor. */
.action-job-users__selected {
    margin-bottom: 8px;
    min-height: 24px;
}

.action-job-users__empty {
    color: #999;
    font-size: 13px;
}

.action-job-users__search {
    display: flex;
    gap: 8px;
    max-width: 520px;
}

.action-job-users__results {
    margin-top: 8px;
    max-width: 520px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #f0f0f0;
    border-radius: 3px;
}

.action-job-users__result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    border-bottom: 1px solid #f5f5f5;
}

.action-job-users__code {
    color: #999;
    font-size: 12px;
    margin-left: 6px;
}

/* eSmart7 puts its verification and closing boxes on rows of their own. */
.action-check-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 6px 0 10px 12px;
}

.action-job-users__list-label {
    margin-top: 10px;
    margin-bottom: 4px;
    font-size: 13px;
    color: #595959;
}

.action-job-users__count {
    color: #999;
    margin-left: 4px;
}

/* The root-cause row carries its analysis method and the Ishikawa diagram link side by side,
   the way eSmart7 lays that row out. */
.action-rootcause-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.action-fishbone-link {
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 4px;
    background: #3888ff;
    color: #fff;
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
}

.action-fishbone-link:hover,
.action-fishbone-link:focus {
    background: #1d6fe0;
    color: #fff;
    text-decoration: none;
}

/* A section row eSmart7 draws for its title + links, whose title eSmartX already shows in the
   panel header - keeps the HIDDEN_TD_ hook without drawing a second heading. */
.action-subsection--hook {
    display: none;
}

/* Design Mode row switch (eSmart7 HIDDEN_TD_ cells: yellow = shown, red = hidden at this step) */
.design-row-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 22px;
    margin-left: 6px;
    padding: 0 6px;
    border: 1px solid #d4b106;
    border-radius: 3px;
    background: #fffb8f;
    color: #614700;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .02em;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;
    white-space: nowrap;
}
.design-row-toggle:hover,
.design-row-toggle:focus-visible { outline: 2px solid #c41e3a; outline-offset: 1px; }
.design-row-toggle--hidden { background: #ff4d4f; border-color: #a8071a; color: #fff; }
.action-section-title .design-row-toggle { margin-left: 10px; }
.action-hidden-row-editor__code code { font-size: 14px; font-weight: 600; }
.action-hidden-row-editor__where { color: #6b7280; margin: 0 0 12px; }
.action-hidden-row-editor__check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.action-hidden-row-editor__note { margin: 12px 0 0; padding: 8px 10px; background: #fffbe6; border: 1px solid #ffe58f; border-radius: 4px; color: #614700; }

/* Thai DNT block — eSmart7 hint rows under the bands and the "files (attached) [x] Yes" rows */
.action-tdnt-hint { color: #595959; font-size: 12px; margin: -6px 0 10px; }
.action-tdnt-flag { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; padding-left: 10px; }
.action-tdnt-flag__label { font-weight: 500; }
.action-customize-band .design-row-toggle { margin-left: 10px; }

/* CAR rich-text columns: read-only content block + [Edit Content] [Attach Files] like eSmart7 (fck_content popup) */
.action-content-field { display: flex; flex-direction: column; gap: 6px; }
.action-content-field__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.action-content-field__view { min-height: 48px; padding: 6px 10px; border: 1px solid #f0f0f0; border-radius: 6px; background: #fff; line-height: 1.5; overflow-wrap: anywhere; }
.action-content-field__view--empty { background: #fafafa; }
.action-content-field__view img { max-width: 100%; height: auto; }
.action-content-field__view table { border-collapse: collapse; }
.action-content-field__view td, .action-content-field__view th { border: 1px solid #d9d9d9; padding: 2px 6px; }
.action-content-editor { display: flex; flex-direction: column; min-height: 100vh; padding: 12px 16px; box-sizing: border-box; background: #fff; }
.action-content-editor__state { display: flex; justify-content: center; padding: 48px; }
.action-content-editor__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.action-content-editor__doc { color: #6b7280; font-size: 12px; }
.action-content-editor__field { font-size: 16px; font-weight: 600; }
.action-content-editor__readonly { color: #c41e3a; font-size: 12px; }
.action-content-editor__body { flex: 1; }
.action-content-editor__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.action-content-editor__autosave { color: #6b7280; font-size: 12px; }
.action-content-editor__actions { display: flex; gap: 8px; }
.action-tdnt-jobs { margin: 0 0 12px; }
/* eSmart7 draws each Thai DNT caption as its own full-width row above the field (long bilingual texts) */
.action-tdnt-item .ant-form-item-label { text-align: left; white-space: normal; padding-bottom: 2px; }
.action-tdnt-item .ant-form-item-label > label { height: auto; white-space: normal; line-height: 1.4; }
.action-tdnt-item .ant-form-item-label > label::after { content: none; }

/* ==========================================================================
   List of document screens (list_document_status.aspx and siblings)
   ========================================================================== */
/* Search captions above each field, the eSmart7 resource keys */
.action-search-label { margin-bottom: 4px; font-size: 13px; color: #666; }

/* The ATSCategoryViewSplit band row: the grouped value (document status) in the first column */
.action-status-band { font-weight: 600; }

/* eSmart7 16_icon_login.png beside a private document's number */
.action-private-icon { margin-right: 4px; color: #8c8c8c; }

/* CCShowHolder badge: WAIT holders in the red box, otherwise the green COMPLETED box */
.action-holder-badge { box-sizing: border-box; padding: 1px 4px; font-size: 8pt; line-height: 1.4; }
.action-holder-badge--wait { border: 1px solid #ff0000; background: #ffddff; }
.action-holder-badge--completed { border: 1px solid #008800; background: #ccffcc; text-align: center; }
.action-holder-badge__line { white-space: nowrap; }

/* eSmart7 Category2 row on Report Sub Clause by ORG: the "Total :" line closing each organization. */
.ant-table-tbody > tr.action-subtotal-row > td {
    border-bottom: 1px solid #bdbdbd;
    background: #fafafa;
}

/* The organization beside its magnifier, printed the way eSmart7 ShowOrganize does: one line
   per level of the tree. It takes the look of a read-only box so it lines up with its row. */
.action-org-path {
    min-height: 32px;
    padding: 4px 11px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.88);
    line-height: 22px;
    overflow-wrap: anywhere;
}

.action-org-path .action-org-path-empty {
    color: rgba(0, 0, 0, 0.25);
}

/* The job editor window (eSmart7 fck_action_job.aspx): editor on the left, dates and the
   responsible users in a narrow column on the right, buttons along the bottom. */
.action-job-editor { display: flex; flex-direction: column; min-height: 100vh; padding: 12px 16px; box-sizing: border-box; background: #fff; }
.action-job-editor__body { display: flex; gap: 16px; align-items: flex-start; flex: 1 1 auto; }
.action-job-editor__detail { flex: 1 1 auto; min-width: 0; }
.action-job-editor__side { flex: 0 0 300px; }
.action-job-editor__field { margin-bottom: 12px; }
.action-job-editor__field > label { display: block; margin-bottom: 4px; color: #595959; }
.action-job-editor__foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; margin-top: 12px; border-top: 1px solid #f0f0f0; }

@media (max-width: 720px) {
    .action-job-editor__body { flex-direction: column; }
    .action-job-editor__side { flex: 1 1 auto; width: 100%; }
}

/* The responsible box: the chosen names one per line, beside the magnifier. */
.action-job-users { display: flex; gap: 6px; align-items: flex-start; }
.action-job-users__box { flex: 1 1 auto; min-width: 0; min-height: 32px; padding: 4px 11px; border: 1px solid #7f9db9; border-radius: 4px; background: #fff; line-height: 22px; overflow-wrap: anywhere; }

/* The picker behind the magnifier - eSmart7 WorkflowUserSelectRuntime.aspx: search on top,
   the directory on the left, the selection on the right. */
.action-user-picker__heading { font-weight: 600; margin-bottom: 6px; }
.action-user-picker__search { padding: 8px 10px; margin-bottom: 12px; background: #fafafa; border: 1px solid #f0f0f0; border-radius: 4px; }
.action-user-picker__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.action-user-picker__row:last-child { margin-bottom: 0; }
.action-user-picker__label { flex: 0 0 auto; }
.action-user-picker__org { flex: 1 1 220px; }
.action-user-picker__lists { display: flex; gap: 10px; align-items: stretch; }
.action-user-picker__column { flex: 1 1 0; min-width: 0; }
.action-user-picker__list { height: 320px; overflow-y: auto; border: 1px solid #7f9db9; border-radius: 4px; background: #fff; }
.action-user-picker__item { padding: 3px 8px; cursor: pointer; user-select: none; overflow-wrap: anywhere; }
.action-user-picker__item:hover { background: #f5f5f5; }
.action-user-picker__item--marked, .action-user-picker__item--marked:hover { background: #1677ff; color: #fff; }
.action-user-picker__moves { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.action-user-picker__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Workflow transition buttons on the CAR forms, lettered as on Document Control
   (.document-control-content .ant-btn in app.css): 0.8125rem, regular weight. The shared .wf-btn
   rule alone gives 14px / 600, which made the same buttons look larger here. */
.action-document-page .wf-btn.ant-btn {
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
    padding-inline: 15px;
}

/* SCG form: the lists under the reference rows and the customer picker, drawn as eSmart7 draws its
   reference table - a plain ruled grid with a shaded header. */
.action-scg-reference-table {
    width: 100%;
    margin: 4px 0 12px;
    border-collapse: collapse;
}
.action-scg-reference-table th,
.action-scg-reference-table td {
    padding: 4px 8px;
    border: 1px solid var(--app-border, #d9d9d9);
    text-align: left;
    vertical-align: top;
}
.action-scg-reference-table th {
    background: var(--app-surface-muted, #f5f5f5);
    font-weight: 600;
    white-space: nowrap;
}

/* eSmart7's "List of user" block on the standard CAR form: two columns of role rows, each a
   right-aligned caption, a bordered box of names and the picker's magnifier. */
.action-runtime-roles { display: flex; flex-wrap: wrap; gap: 4px 24px; align-items: flex-start; margin-bottom: 12px; }
.action-runtime-roles__column { flex: 1 1 360px; min-width: 0; }
.action-runtime-roles__row { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 4px; }
.action-runtime-roles__label { flex: 0 0 120px; text-align: right; line-height: 24px; }
.action-runtime-roles__header { flex: 0 1 220px; line-height: 24px; }
.action-runtime-roles__box { flex: 0 1 220px; min-height: 24px; padding: 1px 6px; border: 1px solid #7f9db9; background: #fff; }
.action-runtime-roles__user { white-space: nowrap; }

/* The other buttons on the CAR forms' workflow bar (Save, Delete, Print Page, Download PDF, Users in
   roles) and the insert-mode Insert button, lettered as the transition buttons beside them and as
   Document Control's (.document-control-content .ant-btn:not(.ant-btn-link) in app.css). Without
   this they keep Ant Design's 14px next to 0.8125rem transition buttons. */
.action-document-page .wf-right-zone .ant-btn:not(.ant-btn-link):not(.wf-btn),
.action-document-page .action-toolbar .ant-btn:not(.ant-btn-link) {
    height: 32px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
}
