.wfm-portal {
    --wfm-page: #f4f7fb;
    --wfm-surface: #ffffff;
    --wfm-soft: #f8fafc;
    --wfm-border: #d9e1ec;
    --wfm-border-strong: #c6d1df;
    --wfm-text: #111827;
    --wfm-muted: #64748b;
    --wfm-primary: #2563eb;
    --wfm-primary-dark: #1d4ed8;
    --wfm-green: #0f766e;
    --wfm-amber: #b45309;
    --wfm-red: #b42318;
    --wfm-violet: #6d28d9;
    --wfm-shadow: 0 20px 48px rgba(15, 23, 42, 0.1);
    max-width: 1160px;
    margin: 0 auto;
    padding: 20px 18px 52px;
    color: var(--wfm-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.wfm-portal * {
    box-sizing: border-box;
}

.wfm-login-card,
.wfm-empty-state,
.wfm-section,
.wfm-instance-card,
.wfm-project-summary,
.wfm-account-bar,
.wfm-account-card {
    border: 1px solid var(--wfm-border);
    border-radius: 8px;
    background: var(--wfm-surface);
    box-shadow: var(--wfm-shadow);
}

.wfm-account-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 10px 12px;
}

.wfm-account-bar > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.wfm-account-email {
    min-width: 0;
    overflow: hidden;
    color: var(--wfm-text);
    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wfm-account-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    gap: 14px;
    align-items: center;
    padding: 20px;
}

.wfm-account-card span {
    display: block;
    margin-bottom: 6px;
    color: var(--wfm-muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.wfm-account-card strong {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--wfm-text);
    font-size: 18px;
}

.wfm-login-card {
    max-width: 460px;
    margin: 56px auto;
    padding: 30px;
}

.wfm-login-card::before {
    content: "Workflow Manager";
    display: inline-flex;
    margin-bottom: 18px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #075985;
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.wfm-login-card h1,
.wfm-portal-head h1 {
    margin: 0;
    color: var(--wfm-text);
    font-size: 34px;
    line-height: 1.08;
    font-weight: 850;
    letter-spacing: 0;
}

.wfm-login-card p,
.wfm-empty-state p,
.wfm-section-heading p {
    color: var(--wfm-muted);
}

.wfm-login-card label,
.wfm-field label {
    display: block;
    margin-bottom: 8px;
    color: #223047;
    font-size: 13px;
    font-weight: 850;
}

.wfm-login-card input[type="text"],
.wfm-login-card input[type="password"],
.wfm-field input[type="text"],
.wfm-field input[type="email"],
.wfm-field input[type="date"],
.wfm-field input[type="number"],
.wfm-field input[type="url"],
.wfm-field select,
.wfm-field textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 13px;
    border: 1px solid var(--wfm-border-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--wfm-text);
    font-size: 15px;
    line-height: 1.45;
    box-shadow: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.wfm-field select,
.wfm-compact-form select,
.wfm-staff-meta-grid select {
    appearance: none;
    padding-right: 42px;
    background-color: #fff;
    background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 13px) calc(50% - 3px);
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
}

.wfm-compact-form select[multiple],
.wfm-staff-meta-grid select[multiple] {
    min-height: 118px;
    padding-right: 12px;
    background-image: none;
}

.wfm-user-multiselect select {
    height: auto;
}

.wfm-login-card input:hover,
.wfm-field input:hover,
.wfm-field select:hover,
.wfm-field textarea:hover,
.wfm-compact-form input:hover,
.wfm-compact-form select:hover,
.wfm-staff-meta-grid input:hover,
.wfm-staff-meta-grid select:hover {
    border-color: #9fb0c4;
}

.wfm-field textarea {
    min-height: 118px;
    resize: vertical;
}

.wfm-login-card input:focus,
.wfm-field input:focus,
.wfm-field select:focus,
.wfm-field textarea:focus {
    border-color: var(--wfm-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
    outline: none;
}

.wfm-login-card input[type="submit"],
.wfm-portal-actions button {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 6px;
    background: var(--wfm-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 850;
    cursor: pointer;
    transition: background 0.16s ease, transform 0.16s ease;
}

.wfm-login-card input[type="submit"]:hover,
.wfm-portal-actions button:hover {
    background: var(--wfm-primary-dark);
}

.wfm-portal-actions button[type="button"] {
    background: #111827;
}

.wfm-portal-actions button[type="button"]:hover {
    background: #0f172a;
}

.wfm-portal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 22px;
    padding: 22px;
    border: 1px solid var(--wfm-border);
    border-radius: 8px;
    background: var(--wfm-surface);
    box-shadow: var(--wfm-shadow);
}

.wfm-portal-head span,
.wfm-card-kicker,
.wfm-project-summary span {
    display: block;
    margin-bottom: 7px;
    color: var(--wfm-muted);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0;
    text-transform: uppercase;
}

.wfm-portal-head a {
    display: inline-flex;
    align-items: center;
    margin-bottom: 10px;
    color: var(--wfm-primary);
    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
}

.wfm-portal-head a:hover {
    color: var(--wfm-primary-dark);
}

.wfm-portal-notice {
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid #bbf7d0;
    border-left-width: 4px;
    border-radius: 8px;
    background: #f0fdf4;
    color: #166534;
    font-weight: 800;
}

.wfm-instance-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.wfm-instance-card {
    display: grid;
    gap: 0;
    min-height: 210px;
    color: inherit;
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.wfm-instance-card:hover {
    transform: translateY(-2px);
    border-color: #93b4f8;
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.14);
}

.wfm-instance-card-main {
    display: grid;
    gap: 16px;
    padding: 22px;
    color: inherit;
    text-decoration: none;
}

.wfm-instance-card h2 {
    max-width: 720px;
    margin: 0;
    color: var(--wfm-text);
    font-size: 23px;
    line-height: 1.2;
    font-weight: 850;
    letter-spacing: 0;
}

.wfm-card-meta,
.wfm-project-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.wfm-card-meta {
    grid-template-columns: 1fr auto;
    color: var(--wfm-muted);
    font-weight: 700;
}

.wfm-project-summary {
    padding: 18px;
    margin-bottom: 12px;
}

.wfm-project-summary > div {
    min-width: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--wfm-soft);
}

.wfm-project-summary strong {
    display: block;
    color: var(--wfm-text);
    font-size: 22px;
    line-height: 1.1;
}

.wfm-status-pill,
.wfm-readonly-pill,
.wfm-section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
}

.wfm-status-pill {
    justify-self: start;
}

.wfm-status-completed {
    background: #dcfce7;
    color: #166534;
}

.wfm-status-waiting_client {
    background: #fef3c7;
    color: #92400e;
}

.wfm-status-review {
    background: #e0f2fe;
    color: #075985;
}

.wfm-status-paused {
    background: #f3f4f6;
    color: #4b5563;
}

.wfm-progress {
    overflow: hidden;
    height: 8px;
    border-radius: 999px;
    background: #e7edf5;
}

.wfm-large-progress {
    height: 10px;
    margin-bottom: 22px;
}

.wfm-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--wfm-primary), var(--wfm-green));
}

.wfm-section {
    overflow: hidden;
    margin-bottom: 16px;
}

.wfm-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--wfm-border);
    background: #fbfdff;
}

.wfm-section-title {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
}

.wfm-section-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #e0f2fe;
    color: #075985;
    font-size: 13px;
    font-weight: 900;
}

.wfm-section-heading h2 {
    margin: 0;
    color: var(--wfm-text);
    font-size: 20px;
    line-height: 1.2;
    font-weight: 850;
    letter-spacing: 0;
}

.wfm-section-heading p {
    margin: 4px 0 0;
}

.wfm-section-count {
    background: #eef2f7;
    color: #334155;
}

.wfm-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 4px 20px 20px;
}

.wfm-field {
    min-width: 0;
    padding: 16px 0;
    border-bottom: 1px solid #edf1f6;
}

.wfm-field:nth-child(odd) {
    padding-right: 16px;
}

.wfm-field:nth-child(even) {
    padding-left: 16px;
}

.wfm-field-textarea,
.wfm-field-readonly {
    grid-column: span 2;
    padding-right: 0 !important;
    padding-left: 0 !important;
}

.wfm-field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.wfm-field-head label {
    margin: 0;
}

.wfm-field-filled .wfm-field-label::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 8px;
    border-radius: 999px;
    background: var(--wfm-green);
    vertical-align: middle;
}

.wfm-required {
    color: var(--wfm-red);
}

.wfm-readonly-pill {
    background: #f1f5f9;
    color: #64748b;
}

.wfm-note-shell {
    margin-top: 8px;
}

.wfm-note-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--wfm-primary);
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.wfm-note-toggle::before {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #dbeafe;
    color: var(--wfm-primary-dark);
    font-weight: 900;
}

.wfm-note-shell.is-open .wfm-note-toggle::before {
    content: "-";
}

.wfm-note {
    display: none;
    margin-top: 8px;
    min-height: 72px !important;
    background: var(--wfm-soft) !important;
}

.wfm-note-shell.is-open .wfm-note {
    display: block;
}

.wfm-check {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    width: auto;
    min-height: 44px;
    margin: 0 !important;
    padding: 10px 13px;
    border: 1px solid var(--wfm-border-strong);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-weight: 850 !important;
}

.wfm-check input {
    width: 18px;
    height: 18px;
    margin: 0 2px 0 0;
    accent-color: var(--wfm-primary);
}

.wfm-checklist-groups {
    display: grid;
    gap: 14px;
    padding: 18px 20px 20px;
}

.wfm-checklist-group {
    padding: 14px;
    border: 1px solid var(--wfm-border);
    border-radius: 8px;
    background: #fbfdff;
}

.wfm-checklist-group h3 {
    margin: 0 0 10px;
    color: var(--wfm-text);
    font-size: 15px;
    font-weight: 850;
}

.wfm-checklist-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.wfm-checklist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    padding: 11px 12px;
    border: 1px solid var(--wfm-border-strong);
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.wfm-checklist-item.is-inactive {
    border-style: dashed;
    background: #f8fafc;
}

.wfm-checklist-item.is-checked {
    border-color: #99f6e4;
    background: #f0fdfa;
}

.wfm-checklist-item.is-actionable:not(.is-checked) {
    border-color: #bfdbfe;
    background: #f8fbff;
}

.wfm-checklist-item.is-info {
    border-color: #dbe4ef;
    background: #f8fafc;
}

.wfm-checklist-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.wfm-checklist-copy strong {
    color: var(--wfm-text);
    font-size: 14px;
    line-height: 1.3;
}

.wfm-checklist-copy span {
    color: var(--wfm-muted);
    font-size: 12px;
}

.wfm-checklist-details {
    display: grid;
    gap: 5px;
    margin-top: 4px;
}

.wfm-checklist-detail {
    display: grid;
    gap: 2px;
}

.wfm-checklist-detail em {
    color: var(--wfm-muted);
    font-size: 11px;
    font-style: normal;
    font-weight: 850;
    text-transform: uppercase;
}

.wfm-checklist-detail span {
    color: #334155;
    font-size: 13px;
    line-height: 1.35;
}

.wfm-checklist-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.wfm-checklist-item.is-readonly {
    opacity: 0.82;
    cursor: default;
}

.wfm-mini-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    margin: 0;
    padding: 0 10px;
    border: 1px solid var(--wfm-border-strong);
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 850;
}

.wfm-mini-toggle input {
    width: 16px;
    height: 16px;
    margin: 0 2px 0 0;
    accent-color: var(--wfm-primary);
}

.wfm-field-checklist-toggle {
    display: inline-flex !important;
    justify-content: center;
    flex-shrink: 0;
    width: auto !important;
    max-width: max-content;
    min-height: 44px;
    margin: 10px 0 10px !important;
    padding: 0 14px;
    white-space: nowrap;
}

.wfm-field-checklist-toggle input {
    flex: 0 0 auto;
}

.wfm-check + .wfm-field-checklist-toggle {
    margin-left: 10px !important;
}

.wfm-checklist-check {
    min-height: 34px;
    padding: 0 10px;
}

.wfm-checklist-info-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: var(--wfm-muted);
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.wfm-view-links {
    display: flex;
    justify-content: flex-end;
    margin: 12px 0;
}

.wfm-read-value {
    min-height: 46px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: var(--wfm-soft);
    color: #334155;
}

.wfm-read-note {
    margin-top: 8px;
    color: var(--wfm-muted);
}

.wfm-empty {
    color: #94a3b8;
}

.wfm-portal-actions {
    position: sticky;
    bottom: 18px;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--wfm-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(12px);
}

.wfm-empty-state {
    padding: 34px;
    text-align: center;
}

.wfm-empty-state h2 {
    margin: 0 0 8px;
    color: var(--wfm-text);
    font-size: 24px;
    font-weight: 850;
}

.wfm-portal-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.wfm-portal-side {
    position: sticky;
    top: 18px;
    display: grid;
    gap: 16px;
}

.wfm-side-panel {
    padding: 18px;
    border: 1px solid var(--wfm-border);
    border-radius: 8px;
    background: var(--wfm-surface);
    box-shadow: var(--wfm-shadow);
}

.wfm-side-panel h2 {
    margin: 0 0 14px;
    color: var(--wfm-text);
    font-size: 18px;
    line-height: 1.2;
    font-weight: 850;
}

.wfm-compact-form {
    display: grid;
    gap: 12px;
}

.wfm-compact-form label,
.wfm-staff-meta-grid label {
    display: block;
    color: #223047;
    font-size: 13px;
    font-weight: 850;
}

.wfm-compact-form input[type="text"],
.wfm-compact-form input[type="password"],
.wfm-compact-form input[type="date"],
.wfm-compact-form select,
.wfm-staff-meta-grid input[type="text"],
.wfm-staff-meta-grid input[type="date"],
.wfm-staff-meta-grid select {
    width: 100%;
    min-height: 42px;
    margin-top: 8px;
    padding: 9px 11px;
    border: 1px solid var(--wfm-border-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--wfm-text);
    font-size: 14px;
}

.wfm-compact-form button,
.wfm-secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: var(--wfm-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
    cursor: pointer;
}

.wfm-secondary-link {
    padding: 0 14px;
    background: #111827;
}

.wfm-logout-link {
    background: #fff5f5;
    color: var(--wfm-red);
    border: 1px solid #fecaca;
}

.wfm-logout-link:hover {
    background: #fee2e2;
    color: var(--wfm-red);
}

.wfm-inline-check {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.wfm-inline-check > input {
    flex: 0 0 auto;
    margin-right: 2px !important;
}

.wfm-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--wfm-border);
    background: #fbfdff;
}

.wfm-inline-delete {
    display: inline-flex;
    margin: 0;
}

.wfm-danger-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #fff5f5;
    color: var(--wfm-red);
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.wfm-client-list {
    display: grid;
    gap: 10px;
}

.wfm-client-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--wfm-border);
    border-radius: 8px;
    background: var(--wfm-soft);
}

.wfm-client-row strong,
.wfm-client-row span {
    display: block;
}

.wfm-client-row span {
    color: var(--wfm-muted);
    font-size: 12px;
}

.wfm-staff-meta-section {
    margin-bottom: 16px;
}

.wfm-staff-meta-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    padding: 18px 20px 22px;
}

.wfm-staff-meta-grid > label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    min-height: 94px;
    margin: 0;
    padding: 13px 14px;
    border: 1px solid #dfe7f1;
    border-radius: 8px;
    background: var(--wfm-soft);
}

.wfm-staff-meta-grid > label:nth-child(1) {
    grid-column: span 6;
}

.wfm-staff-meta-grid > label:nth-child(2),
.wfm-staff-meta-grid > label:nth-child(3) {
    grid-column: span 3;
}

.wfm-staff-meta-grid > label:nth-child(n+4) {
    grid-column: span 2;
}

.wfm-staff-meta-grid > label > input,
.wfm-staff-meta-grid > label > select {
    margin-top: 0;
}

.wfm-staff-meta-grid .wfm-user-multiselect select {
    min-height: 88px;
}

.wfm-muted {
    color: var(--wfm-muted);
}

@media (max-width: 760px) {
    .wfm-portal {
        padding: 120px 12px 36px;
    }

    .wfm-portal-head,
    .wfm-card-meta,
    .wfm-section-heading {
        display: block;
    }

    .wfm-instance-cards,
    .wfm-project-summary,
    .wfm-account-card,
    .wfm-field-grid,
    .wfm-checklist-items,
    .wfm-portal-actions,
    .wfm-portal-workspace,
    .wfm-staff-meta-grid {
        grid-template-columns: 1fr;
    }

    .wfm-portal-side {
        position: static;
    }

    .wfm-account-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .wfm-account-bar > div {
        justify-content: stretch;
    }

    .wfm-account-bar .wfm-secondary-link {
        flex: 1 1 auto;
    }

    .wfm-field,
    .wfm-field:nth-child(odd),
    .wfm-field:nth-child(even),
    .wfm-field-textarea,
    .wfm-field-readonly {
        grid-column: auto;
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    .wfm-section-count,
    .wfm-status-pill {
        margin-top: 12px;
    }

    .wfm-staff-meta-grid > label {
        grid-column: auto !important;
    }

    .wfm-portal-actions {
        position: static;
    }
}

@media print {
    header,
    footer,
    nav,
    .wfm-portal-actions,
    .wfm-portal-head a,
    .wfm-note-toggle {
        display: none !important;
    }

    .wfm-portal {
        max-width: none;
        padding: 0;
    }

    .wfm-section,
    .wfm-project-summary,
    .wfm-portal-head {
        box-shadow: none;
        break-inside: avoid;
    }

    .wfm-note {
        display: block;
    }
}
