/* Signature types and reusable document approval workflows */

.signature-workflow-workspace {
    display: grid;
    gap: 20px;
    height: auto !important;
    min-height: 420px;
}

.signature-workflow-workspace > section {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #dce7e2);
    border-radius: 18px;
    padding: 20px;
}

.workflow-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.workflow-section-title h3 {
    margin: 0 0 4px;
}

.workflow-section-title p {
    margin: 0;
    color: var(--muted, #6b7b75);
    font-size: 0.88rem;
}

.compact-table {
    width: 100%;
    border-collapse: collapse;
}

.compact-table th {
    padding: 12px;
    border-bottom: 1px solid var(--border, #e3ebe7);
    text-align: start;
}

.compact-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border, #e3ebe7);
    text-align: start;
}

.compact-table td small {
    display: block;
    color: var(--muted, #74817c);
}

.workflow-card-grid {
    display: grid;
    gap: 14px;
}

.workflow-card {
    border: 1px solid var(--border, #dce7e2);
    border-radius: 16px;
}

.workflow-card summary {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.workflow-card h4 {
    margin: 4px 0;
}

.workflow-card summary small {
    color: var(--muted, #6b7b75);
}

.workflow-card ol {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    display: grid;
    gap: 10px;
}

.workflow-card li {
    display: flex;
    gap: 10px;
    align-items: center;
}

.workflow-card li > b {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e4f4ed;
    color: #087e55;
}

.workflow-card li div {
    display: flex;
    flex-direction: column;
}

.workflow-card li small {
    color: var(--muted, #6b7b75);
}

.workflow-modal {
    width: min(920px, 94vw);
}

.workflow-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.workflow-step-editor {
    display: grid;
    grid-template-columns: 34px 1fr 1.5fr 1fr 42px;
    gap: 8px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border, #e3ebe7);
}

.workflow-step-editor > b {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e4f4ed;
    color: #087e55;
}

.workflow-step-editor input {
    min-width: 0;
}

.workflow-step-editor select {
    min-width: 0;
}

.workflow-editor-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
}

.workflow-editor-head .row-action {
    width: auto;
    padding-inline: 12px;
    gap: 6px;
}

.empty-state {
    padding: 30px;
    text-align: center;
    color: var(--muted, #6b7b75);
}

@media (max-width: 700px) {
    .workflow-meta {
        grid-template-columns: 1fr;
    }

    .workflow-step-editor {
        grid-template-columns: 30px 1fr 40px;
    }

    .workflow-step-editor input {
        grid-column: 2/4;
    }

    .workflow-step-editor select[data-field='action'] {
        grid-column: 2/4;
    }

    .workflow-section-title {
        align-items: flex-start;
        flex-direction: column;
    }
}

.signature-workflow-page {
    display: grid;
}

.signature-workflow-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px 28px;
    border-radius: 22px;
    color: #fff;
    background: linear-gradient(125deg, #0a563b, #15845d);
    box-shadow: 0 14px 35px #0b684326;
}

.signature-workflow-hero:after {
    content: '';
    position: absolute;
    inset-inline-start: -60px;
    top: -90px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: #fff1;
}

.signature-workflow-hero__icon {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    flex: 0 0 auto;
    border: 1px solid #fff4;
    border-radius: 18px;
    background: #fff2;
    font-size: 1.65rem;
}

.signature-workflow-hero span {
    font-size: 0.78rem;
    color: #c9f2df;
}

.signature-workflow-hero h2 {
    margin: 3px 0 5px;
    font-size: 1.55rem;
}

.signature-workflow-hero p {
    margin: 0;
    color: #e2f6ed;
}

.signature-workflow-toolbar {
    border: 1px solid #dce9e3;
    border-radius: 16px;
    background: #fff;
}

.signature-workflow-workspace {
    grid-template-columns: minmax(330px, 0.72fr) minmax(520px, 1.45fr);
    align-items: start;
}

.signature-workflow-workspace > section {
    box-shadow: 0 8px 24px #133c2b0b;
}

.signature-types-panel {
    position: sticky;
    top: 16px;
}

.workflow-section-title {
    padding-bottom: 14px;
    border-bottom: 1px solid #e2ebe6;
}

.workflow-section-title h3 {
    font-size: 1.05rem;
}

.compact-table thead th {
    padding-block: 10px;
    color: #708078;
    font-size: 0.75rem;
    font-weight: 700;
    background: #f5f9f7;
}

.compact-table tbody tr {
    transition: 0.18s ease;
}

.compact-table tbody tr:hover {
    background: #f6fbf8;
}

.compact-table code {
    padding: 4px 8px;
    border-radius: 7px;
    color: #076f4b;
    background: #e8f6ef;
}

.workflow-card-grid {
    grid-template-columns: 1fr;
}

.workflow-card {
    position: relative;
    padding: 18px 20px;
    border-color: #dbe8e2;
    background: linear-gradient(145deg, #fff, #f8fbf9);
    box-shadow: 0 6px 18px #123f2d0a;
}

.workflow-card:before {
    content: '';
    position: absolute;
    inset-block: 18px;
    inset-inline-start: 0;
    width: 4px;
    border-radius: 8px;
    background: #15956a;
}

.workflow-card summary {
    padding-bottom: 13px;
    border-bottom: 1px solid #e4ece8;
}

.workflow-card summary > div {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    align-items: center;
}

.workflow-card summary span {
    grid-row: 1/3;
    display: grid;
    place-items: center;
    min-width: 42px;
    height: 28px;
    padding-inline: 9px;
    border-radius: 8px;
    color: #087e55;
    background: #e8f6ef;
    font-weight: 800;
    text-transform: uppercase;
}

.workflow-card summary h4 {
    margin: 0;
    font-size: 1rem;
}

.workflow-card summary small {
    font-size: 0.72rem;
}

.workflow-card ol {
    position: relative;
    margin-inline-start: 12px;
}

.workflow-card ol:before {
    content: '';
    position: absolute;
    top: 15px;
    bottom: 15px;
    inset-inline-start: 15px;
    width: 2px;
    background: #d6e8df;
}

.workflow-card li {
    position: relative;
    min-height: 46px;
}

.workflow-card li > b {
    z-index: 1;
    box-shadow: 0 0 0 5px #f9fbfa;
}

.workflow-card li strong {
    font-size: 0.88rem;
}

.workflow-card li small {
    font-size: 0.74rem;
}

.workflow-modal .workflow-step-editor {
    padding: 12px;
    border: 1px solid #e1eae5;
    border-radius: 12px;
    margin-top: 8px;
    background: #fafcfb;
}

.workflow-modal .workflow-step-editor:hover {
    border-color: #a8cdbb;
}

.workflow-modal .workflow-step-editor input {
    height: 44px;
    border-radius: 10px;
}

.workflow-modal .workflow-step-editor select {
    height: 44px;
    border-radius: 10px;
}

html[data-theme='dark'] .signature-workflow-hero {
    background: linear-gradient(125deg, #123f31, #176b4e);
    box-shadow: 0 14px 36px #0006;
}

html[data-theme='dark'] .signature-workflow-toolbar {
    color: #edf7f2;
    border-color: #3b5148;
    background: #171f1c;
    box-shadow: 0 12px 28px #0004;
}

html[data-theme='dark'] .signature-workflow-workspace > section {
    color: #edf7f2;
    border-color: #3b5148;
    background: #171f1c;
    box-shadow: 0 12px 28px #0004;
}

html[data-theme='dark'] .workflow-section-title {
    border-color: #33483f;
}

html[data-theme='dark'] .workflow-section-title h3 {
    color: #eef7f3;
}

html[data-theme='dark'] .compact-table th {
    color: #eef7f3;
}

html[data-theme='dark'] .compact-table td {
    color: #eef7f3;
}

html[data-theme='dark'] .workflow-card h4 {
    color: #eef7f3;
}

html[data-theme='dark'] .workflow-card strong {
    color: #eef7f3;
}

html[data-theme='dark'] .workflow-section-title p {
    color: #a8bbb2;
}

html[data-theme='dark'] .compact-table td small {
    color: #a8bbb2;
}

html[data-theme='dark'] .workflow-card summary small {
    color: #a8bbb2;
}

html[data-theme='dark'] .workflow-card li small {
    color: #a8bbb2;
}

html[data-theme='dark'] .compact-table thead th {
    background: #202d27;
}

html[data-theme='dark'] .compact-table th {
    border-color: #35483f;
}

html[data-theme='dark'] .compact-table td {
    border-color: #35483f;
}

html[data-theme='dark'] .compact-table tbody tr:hover {
    background: #203028;
}

html[data-theme='dark'] .compact-table code {
    color: #79dab2;
    background: #173e30;
}

html[data-theme='dark'] .workflow-card summary span {
    color: #79dab2;
    background: #173e30;
}

html[data-theme='dark'] .workflow-card {
    color: #edf7f2;
    border-color: #3a5147;
    background: linear-gradient(145deg, #1c2823, #17211d);
    box-shadow: 0 8px 24px #0004;
}

html[data-theme='dark'] .workflow-card summary {
    border-color: #34483f;
}

html[data-theme='dark'] .workflow-card ol:before {
    background: #3c5a4d;
}

html[data-theme='dark'] .workflow-card li > b {
    color: #91e1bf;
    background: #18563f;
    box-shadow: 0 0 0 5px #1a2520;
}

html[data-theme='dark'] .workflow-modal .workflow-step-editor {
    color: #edf7f2;
    border-color: #3c5148;
    background: #1c2823;
}

html[data-theme='dark'] .workflow-modal .workflow-step-editor:hover {
    border-color: #63977f;
}

@media (max-width: 1100px) {
    .signature-workflow-workspace {
        grid-template-columns: 1fr;
    }

    .signature-types-panel {
        position: static;
    }
}

@media (max-width: 700px) {
    .signature-workflow-hero {
        align-items: flex-start;
        padding: 20px;
    }

    .signature-workflow-hero__icon {
        width: 48px;
        height: 48px;
    }

    .signature-workflow-hero h2 {
        font-size: 1.2rem;
    }

    .signature-workflow-toolbar {
        align-items: flex-start;
    }
}

.workflow-auto-code {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 78px;
    padding: 11px 14px;
    border: 1px dashed #9fc7b5;
    border-radius: 12px;
    background: #f2faf6;
}

.workflow-auto-code > span {
    color: #5f746a;
    font-size: 0.74rem;
}

.workflow-auto-code > strong {
    color: #087e55;
    font-size: 0.95rem;
}

.workflow-auto-code > small {
    margin-top: 2px;
    color: #7b8d84;
    font-size: 0.8rem;
}

html[data-theme='dark'] .workflow-auto-code {
    border-color: #466e5c;
    background: #172b22;
}

html[data-theme='dark'] .workflow-auto-code > span {
    color: #a7bbb1;
}

html[data-theme='dark'] .workflow-auto-code > small {
    color: #a7bbb1;
}

html[data-theme='dark'] .workflow-auto-code > strong {
    color: #86dfba;
}

.settings-modal .workflow-status-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 66px;
    margin-top: 4px;
    padding: 11px 14px;
    border: 1px solid #dce8e2;
    border-radius: 13px;
    background: #f7faf8;
}

.settings-modal .workflow-status-field > span:first-child {
    font-weight: 800;
    color: #284c3d;
}

.settings-modal .workflow-status-field .catalog-status-toggle {
    min-height: 40px;
    padding: 4px 10px;
    border-radius: 10px;
    background: #eaf5ef;
}

.settings-modal .workflow-status-field .catalog-status-toggle b {
    min-width: 48px;
    color: #176b43;
    font-size: 0.78rem;
}

html[data-theme='dark'] .settings-modal .workflow-status-field {
    border-color: #45594f;
    background: #1b2822;
}

html[data-theme='dark'] .settings-modal .workflow-status-field > span:first-child {
    color: #edf7f2;
}

html[data-theme='dark'] .settings-modal .workflow-status-field .catalog-status-toggle {
    background: #243a30;
}

html[data-theme='dark'] .settings-modal .workflow-status-field .catalog-status-toggle b {
    color: #91dfbd;
}

.workflow-fold-actions {
    display: flex;
    gap: 8px;
    margin-block-end: 10px;
}

.workflow-card summary {
    cursor: pointer;
    list-style: none;
    gap: 10px;
}

.workflow-card summary::-webkit-details-marker {
    display: none;
}

.workflow-card summary::after {
    content: '⌄';
    font-size: 20px;
}

.workflow-card[open] summary::after {
    transform: rotate(180deg);
}

.workflow-card:not([open]) summary {
    padding-bottom: 0;
    border-bottom: 0;
}

.workflow-card summary:focus-visible {
    outline: 2px solid #15956a;
    outline-offset: 4px;
}

.workflow-card:not([open]) {
    padding-block: 12px;
}

@media print {
    .workflow-card > ol {
        display: block !important;
    }

    .workflow-fold-actions {
        display: none;
    }
}

@media screen {
    #pageHost
        :is(
            .page-title,
            .page-heading,
            .dashboard-hero,
            .transactions-hero,
            .evaluation-header,
            .evaluation-hero,
            .evaluation-score-hero,
            .signature-workflow-hero,
            .record-editor-header
        ):not(:has(input:not([type='hidden']), select, textarea)):not(
            .modal *,
            [role='dialog'] *,
            .profile-hero *
        ) {
        display: none !important;
    }
}

.signature-workflow-page .signature-workflow-workspace {
    grid-template-columns: minmax(0, 1fr);
}

.workflow-grid-host {
    min-height: 320px;
}

.signature-workflow-page {
    gap: 0;
}

.signature-workflow-page > .signature-workflow-toolbar {
    margin-bottom: 16px;
    padding: 10px;
}

.workflow-group-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 100%;
    padding: 10px 16px;
    border: 0;
    background: var(--surface-soft);
    color: var(--text);
    text-align: start;
    cursor: pointer;
}

.workflow-group-row small {
    margin-inline-start: auto;
}

.workflow-step-row {
    opacity: 0.88;
}
