/* =====================================================================
   forms-modern.css  —  shared look for all converted Nintex forms.
   Design system: same as Workflows / Quality Notifications.
   Prefix: fm-   (do not add page-level <style> blocks; extend here)
   ===================================================================== */

:root {
    --fm-primary: #12478b;
    --fm-primary-hover: #0e3a72;
    --fm-text: #1a202c;
    --fm-text-2: #4a5568;
    --fm-text-3: #718096;
    --fm-line: #e2e8f0;
    --fm-surface: #ffffff;
    --fm-surface-2: #f7fafc;
    --fm-chip: #edf2f7;
    --fm-ok-bg: #c6f6d5;
    --fm-ok-fg: #22543d;
    --fm-warn-bg: #fefcbf;
    --fm-warn-fg: #744210;
    --fm-err-bg: #fed7d7;
    --fm-err-fg: #9b2c2c;
    --fm-radius: 6px;
    --fm-font: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* ---- page frame ---------------------------------------------------- */
.fm-page {
    font-family: var(--fm-font);
    color: var(--fm-text);
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
    padding: 20px 24px 40px;
    font-size: 14px;
    line-height: 1.45;
}

.fm-breadcrumb {
    margin-bottom: 14px;
}

.fm-back-link {
    font-size: 13px;
    color: var(--fm-primary);
    text-decoration: none;
    font-weight: 500;
}

    .fm-back-link:hover {
        text-decoration: underline;
    }

.fm-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.fm-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--fm-text-3);
    margin-bottom: 4px;
}

.fm-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--fm-text);
    margin: 0 0 10px;
    line-height: 1.25;
}

.fm-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.fm-meta-chip {
    background: var(--fm-chip);
    color: var(--fm-text-2);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
}

/* ---- sections ------------------------------------------------------ */
.fm-section {
    background: var(--fm-surface);
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius);
    padding: 18px 20px 20px;
    margin-bottom: 18px;
}

.fm-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--fm-text);
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--fm-primary);
}

.fm-help {
    color: var(--fm-text-2);
    margin: 0 0 14px;
    max-width: 80ch;
}

.fm-muted {
    color: var(--fm-text-3);
    font-size: 13px;
}

/* ---- rows / grids -------------------------------------------------- */
.fm-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.fm-row-between {
    justify-content: space-between;
}

.fm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px 20px;
}

.fm-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fm-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--fm-text-2);
}

    .fm-label .fm-req {
        color: var(--fm-err-fg);
        margin-left: 3px;
    }

/* ---- inputs -------------------------------------------------------- */
.fm-input, .fm-select, .fm-textarea, .fm-paste {
    font-family: var(--fm-font);
    font-size: 14px;
    color: var(--fm-text);
    background: var(--fm-surface);
    border: 1px solid #cbd5e0;
    border-radius: var(--fm-radius);
    padding: 7px 10px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}

    .fm-input:focus, .fm-select:focus, .fm-textarea:focus, .fm-paste:focus {
        border-color: var(--fm-primary);
        box-shadow: 0 0 0 3px rgba(18, 71, 139, .15);
    }

    .fm-input[disabled], .fm-select[disabled], .fm-textarea[disabled] {
        background: var(--fm-surface-2);
        color: var(--fm-text-3);
    }

.fm-paste {
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    white-space: pre;
    overflow: auto;
    resize: vertical;
    min-height: 180px;
}

    .fm-input.invalid, .fm-select.invalid, .fm-textarea.invalid, .fm-paste.invalid {
        border-color: var(--fm-err-fg);
    }

.validation-message {
    color: var(--fm-err-fg);
    font-size: 12px;
    margin-top: 4px;
}

/* ---- buttons ------------------------------------------------------- */
.fm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--fm-font);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--fm-radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    transition: background-color .12s, border-color .12s;
}

    .fm-btn:focus-visible {
        outline: 2px solid var(--fm-primary);
        outline-offset: 2px;
    }

    .fm-btn[disabled] {
        opacity: .5;
        cursor: not-allowed;
    }

.fm-btn-primary {
    background: var(--fm-primary);
    color: #fff;
}

    .fm-btn-primary:not([disabled]):hover {
        background: var(--fm-primary-hover);
    }

.fm-btn-secondary {
    background: var(--fm-surface);
    color: var(--fm-primary);
    border-color: var(--fm-primary);
}

    .fm-btn-secondary:not([disabled]):hover {
        background: #ebf2fb;
    }

.fm-btn-danger {
    background: var(--fm-surface);
    color: var(--fm-err-fg);
    border-color: var(--fm-err-fg);
}

    .fm-btn-danger:not([disabled]):hover {
        background: var(--fm-err-bg);
    }

.fm-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 6px;
}

/* ---- alerts / badges / toast --------------------------------------- */
.fm-alert {
    border-radius: var(--fm-radius);
    padding: 10px 14px;
    margin-bottom: 14px;
    font-weight: 500;
}

.fm-alert-ok {
    background: var(--fm-ok-bg);
    color: var(--fm-ok-fg);
}

.fm-alert-warn {
    background: var(--fm-warn-bg);
    color: var(--fm-warn-fg);
}

.fm-alert-error {
    background: var(--fm-err-bg);
    color: var(--fm-err-fg);
}

.fm-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.fm-badge-ok {
    background: var(--fm-ok-bg);
    color: var(--fm-ok-fg);
}

.fm-badge-error {
    background: var(--fm-err-bg);
    color: var(--fm-err-fg);
}

.fm-badge-neutral {
    background: var(--fm-chip);
    color: var(--fm-text-2);
}

.fm-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    background: var(--fm-text);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--fm-radius);
    font-size: 13px;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
}

/* ---- preview tables ------------------------------------------------ */
.fm-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius);
}

.fm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 900px;
}

    .fm-table th {
        text-align: left;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .04em;
        text-transform: uppercase;
        color: var(--fm-text-3);
        background: var(--fm-surface-2);
        padding: 8px 10px;
        border-bottom: 1px solid var(--fm-line);
        white-space: nowrap;
    }

    .fm-table td {
        padding: 7px 10px;
        border-bottom: 1px solid var(--fm-line);
        vertical-align: top;
    }

    .fm-table tbody tr:hover td {
        background: var(--fm-surface-2);
    }

    .fm-table .fm-num {
        text-align: right;
    }

.fm-ellipsis {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-row-error td {
    background: #fff5f5;
}

.fm-row-error-detail td {
    background: #fff5f5;
    padding-top: 0;
}

.fm-error-list {
    margin: 0 0 6px 18px;
    padding: 0;
    color: var(--fm-err-fg);
}

/* ---- checkboxes / inline link buttons (added for Bill of Material Detail) ---- */
.fm-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--fm-text);
    cursor: pointer;
    padding-top: 22px;
}

    .fm-check input[type=checkbox] {
        width: 16px;
        height: 16px;
        accent-color: var(--fm-primary);
        cursor: pointer;
        margin: 0;
    }

        .fm-check input[type=checkbox][disabled] {
            cursor: not-allowed;
        }

.fm-link-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--fm-primary);
    text-decoration: underline;
    cursor: pointer;
}

    .fm-link-btn:focus-visible {
        outline: 2px solid var(--fm-primary);
        outline-offset: 2px;
    }

/* ---- claim state (added for Claim Task) ------------------------------ */
.fm-badge-warn {
    background: var(--fm-warn-bg);
    color: var(--fm-warn-fg);
}

.fm-check-solo {
    padding-top: 0;
}
/* a checkbox that is not aligned next to labelled inputs */

/* ---- Bill of Material Change: type-driven sub-panels, checkbox list, read-only list (additive) ---- */
.fm-subhead {
    font-size: 13px;
    font-weight: 700;
    color: var(--fm-primary);
    margin: 16px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e2e8f0;
}

.fm-check-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    padding: 6px 0 2px;
}

.fm-readonly-list {
    margin: 4px 0 0;
    padding: 8px 12px;
    list-style: none;
    border: 1px solid #e2e8f0;
    border-radius: var(--fm-radius);
    background: var(--fm-surface-2);
    max-height: 180px;
    overflow: auto;
}

    .fm-readonly-list li {
        font-size: 13px;
        color: var(--fm-text);
        padding: 3px 0;
        border-bottom: 1px dashed #e2e8f0;
    }

        .fm-readonly-list li:last-child {
            border-bottom: none;
        }

/* ---- popup mode: tighter frame ------------------------------------- */
.popup-root .fm-page {
    padding: 14px 16px 28px;
}

@media (max-width: 640px) {
    .fm-page {
        padding: 14px 12px 28px;
    }

    .fm-title {
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fm-btn, .fm-input, .fm-select, .fm-textarea, .fm-paste {
        transition: none;
    }
}

/* =====================================================================
   App shell (layouts, sidebar, hub, launch/close pages)
   ===================================================================== */

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--fm-font);
    font-size: 14px;
    color: var(--fm-text);
    background: var(--fm-surface);
}

a {
    color: var(--fm-primary);
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* ---- main layout --------------------------------------------------- */
.layout-root {
    display: flex;
    min-height: 100vh;
}

.layout-sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--fm-primary);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.layout-main {
    margin-left: 230px;
    flex: 1;
    min-height: 100vh;
    background: var(--fm-surface);
}

.nav-brand {
    padding: 18px 20px 14px;
}

.nav-brand-logo {
    display: block;
    height: 40px;
    width: auto;
}

.nav-user {
    padding: 10px 24px;
    font-size: 12px;
    color: rgba(255,255,255,.72);
    border-top: 1px solid rgba(255,255,255,.15);
    border-bottom: 1px solid rgba(255,255,255,.15);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
}

.nav-group-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,.45);
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: 14px 20px 5px;
}

.nav-item {
    display: block;
    padding: 7px 20px 7px 24px;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255,255,255,.72);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: color .15s, background .15s;
}

    .nav-item:hover {
        color: #fff;
        background: rgba(255,255,255,.08);
        text-decoration: none;
    }

    .nav-item.active {
        color: #fff;
        background: rgba(255,255,255,.25);
        border-left-color: #fff;
        font-weight: 600;
    }

    .nav-item:focus-visible {
        outline: 2px solid #fff;
        outline-offset: -2px;
    }

.nav-footer {
    margin-top: auto;
    padding: 14px 24px;
    font-size: 11px;
    color: rgba(255,255,255,.4);
}

/* ---- popup / minimal layouts --------------------------------------- */
.popup-root {
    padding: 0;
    margin: 0;
}

.minimal-root {
    padding: 8px;
}

/* ---- Blazor error UI ----------------------------------------------- */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--fm-err-bg);
    color: var(--fm-err-fg);
    padding: 8px 16px;
    font-size: 13px;
}

    #blazor-error-ui .reload {
        color: var(--fm-err-fg);
        margin-left: 8px;
    }

    #blazor-error-ui .dismiss {
        color: var(--fm-err-fg);
        cursor: pointer;
        float: right;
        text-decoration: none;
    }

/* ---- Forms Hub (Index) --------------------------------------------- */
.hub-category {
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius);
    margin-bottom: 14px;
    overflow: hidden;
}

.hub-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    color: var(--fm-text);
    text-align: left;
    background: var(--fm-surface-2);
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 12px 16px;
    cursor: pointer;
    transition: background .12s;
}

    .hub-category-header:hover {
        background: #edf2f7;
    }

    .hub-category-header[aria-expanded="true"] {
        background: #ebf2fb;
        border-bottom-color: var(--fm-primary);
        color: var(--fm-primary);
    }

    .hub-category-header:focus-visible {
        outline: 2px solid var(--fm-primary);
        outline-offset: -2px;
    }

.hub-chevron {
    font-size: 10px;
    color: var(--fm-primary);
    transition: transform .2s;
    display: inline-block;
}

.hub-category-header[aria-expanded="true"] .hub-chevron {
    transform: rotate(90deg);
}

.hub-category-title {
    flex: 1;
}

.hub-params {
    display: grid;
    gap: 6px;
    min-width: 300px;
}

.hub-param {
    display: grid;
    grid-template-columns: 130px 1fr;
    align-items: center;
    gap: 8px;
}

    .hub-param .fm-input {
        padding: 5px 8px;
        font-size: 13px;
    }

.hub-url {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    word-break: break-all;
    color: var(--fm-text-2);
}

.hub-url-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--fm-text-3);
    margin-right: 6px;
}

.hub-open {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hub-empty {
    padding: 16px;
    color: var(--fm-text-3);
}

/* ---- launch / close pages ------------------------------------------ */
.launch-root, .close-root {
    padding: 20px 24px;
    max-width: 520px;
}

    .launch-root h1, .close-root h1 {
        font-size: 18px;
        font-weight: 700;
        margin: 0 0 8px;
    }

    .launch-root p, .close-root p {
        margin: 0 0 8px;
        color: var(--fm-text-2);
    }

@media (max-width: 900px) {
    .layout-sidebar {
        position: static;
        width: 100%;
        bottom: auto;
    }

    .layout-root {
        flex-direction: column;
    }

    .layout-main {
        margin-left: 0;
    }

    .hub-param {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hub-chevron, .hub-category-header, .nav-item {
        transition: none;
    }
}

/* ---- Bill of Material (additive; also used by CMIR's task table) ------------------------------------ */
.fm-field-wide {
    grid-column: 1 / -1;
}

.fm-tasks td, .fm-tasks th {
    vertical-align: middle;
}

.fm-tasks .fm-select {
    min-width: 190px;
}

.fm-task-name {
    width: 100%;
}
