/* ==========================================================================
   RIALO AGENTPAY — MARKETPLACE (marketplace.html extra styles)

   Extends the shared AgentPay visual language (landing.css tokens,
   app.css layout, dashboard.css card anatomy). No second design system:
   every colour, radius, spacing step, and mono font comes from the
   existing token set.

   This file owns:
     - the task list rows + status pills
     - the owner create form (inputs, select, textarea, primary action)
     - the detail drawer's action lane
   ========================================================================== */

/* --------------------------------------------------------------------------
   OPEN TASK ROWS
   -------------------------------------------------------------------------- */
.mk-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.mk-row {
    display: flex;
    align-items: flex-start;
    gap: var(--s-4);
    padding: var(--s-4) var(--s-5);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
    cursor: pointer;
    transition:
        border-color var(--t-fast),
        background var(--t-fast),
        box-shadow var(--t-fast),
        transform var(--t-fast);
}

.mk-row:hover {
    border-color: var(--line-lime);
    background: var(--bg-raise);
    box-shadow: var(--glow-lime-soft);
    transform: translateY(-1px);
}

.mk-row:focus-visible {
    outline: 2px solid var(--lime);
    outline-offset: 2px;
    border-color: var(--line-lime);
}

.mk-row__main {
    flex: 1;
    min-width: 0;
}

.mk-row__title {
    margin: 0 0 var(--s-1);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.mk-row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-2) var(--s-3);
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.02em;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.mk-row__meta .mono {
    color: var(--text-2);
}

.mk-payout {
    flex-basis: 100%;
    color: var(--text-3);
    overflow-wrap: anywhere;
}

.mk-payout code {
    color: var(--lime);
    font-size: 10px;
}

.mk-row__reward {
    flex: none;
    color: var(--lime);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.mk-row__reward .unit {
    color: var(--text-3);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
}

/* --------------------------------------------------------------------------
   STATUS PILLS — tokens map to the task engine's status strings.
   -------------------------------------------------------------------------- */
.mk-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.5;
    text-transform: uppercase;
    white-space: nowrap;
}

.mk-pill--open,
.mk-pill--paid {
    color: var(--lime);
    border-color: rgba(var(--lime-rgb), 0.38);
}

.mk-pill--in-progress,
.mk-pill--submitted,
.mk-pill--under-review,
.mk-pill--revision-requested,
.mk-pill--payment-pending {
    color: var(--amber);
    border-color: rgba(251, 191, 36, 0.38);
}

.mk-pill--rejected,
.mk-pill--cancelled,
.mk-pill--payment-failed {
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.38);
}

/* --------------------------------------------------------------------------
   CREATE FORM — two-column desktop layout, one column on narrow screens.
   -------------------------------------------------------------------------- */
.mk-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4);
    align-items: start;
    margin: 0;
}

.mk-form .field {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    min-width: 0;
    margin: 0;
}

.mk-form .field--wide {
    grid-column: 1 / -1;
}

.mk-form .label {
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.16em;
    line-height: 1.4;
    text-transform: uppercase;
}

.mk-form .input {
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    outline: none;
    background: var(--bg-raise);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.45;
    transition:
        border-color var(--t-fast),
        box-shadow var(--t-fast),
        background var(--t-fast);
}

.mk-form textarea.input {
    min-height: 78px;
    resize: vertical;
}

.mk-form select.input {
    cursor: pointer;
}

.mk-form .input::placeholder {
    color: var(--text-3);
    letter-spacing: 0.02em;
}

.mk-form .input:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.mk-form .input:focus {
    border-color: var(--line-lime);
    background: var(--panel-2);
    box-shadow: 0 0 0 1px rgba(var(--lime-rgb), 0.16), var(--glow-lime-soft);
}

.mk-form .field-hint {
    margin-top: 0;
}

.mk-form > .wallet-btn {
    justify-self: start;
    align-self: end;
    min-height: 42px;
}

.mk-form__status {
    grid-column: 1 / -1;
    min-height: 17px;
    margin: 0;
    color: var(--text-3);
    white-space: pre-wrap;
}

.mk-form__status[role="alert"] {
    color: var(--red);
}

/* --------------------------------------------------------------------------
   DETAIL DRAWER + ACTION LANE
   -------------------------------------------------------------------------- */
.mk-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s-4);
}

.mk-detail-grid .label {
    display: block;
    margin-bottom: var(--s-1);
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.16em;
    line-height: 1.4;
    text-transform: uppercase;
}

.mk-detail-grid .field-hint {
    margin: 0;
}

.mk-actions {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: var(--s-3);
    margin-top: var(--s-4);
    padding-top: var(--s-4);
    border-top: 1px solid var(--line);
}

.mk-actions .input {
    flex: 1 1 220px;
    min-width: 0;
    min-height: 40px;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    outline: none;
    background: var(--bg-raise);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.mk-actions .input::placeholder {
    color: var(--text-3);
}

.mk-actions .input:focus {
    border-color: var(--line-lime);
    box-shadow: 0 0 0 1px rgba(var(--lime-rgb), 0.16), var(--glow-lime-soft);
}

.mk-actions .wallet-btn {
    flex: none;
}

.wallet-btn--danger {
    border-color: rgba(248, 113, 113, 0.38);
    background: rgba(248, 113, 113, 0.07);
    color: var(--red);
}

.wallet-btn--danger:hover:not(:disabled) {
    border-color: rgba(248, 113, 113, 0.65);
    background: rgba(248, 113, 113, 0.14);
    box-shadow: 0 0 22px -12px rgba(248, 113, 113, 0.5);
}

.mk-actions > .field-hint {
    flex-basis: 100%;
    margin: var(--s-1) 0 0;
}

/* --------------------------------------------------------------------------
   WORK SUBMISSION + EVIDENCE
   -------------------------------------------------------------------------- */
.mk-submit-form {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    width: 100%;
}

.mk-sub-field {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    min-width: 0;
}

.mk-sub-field .label {
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.16em;
    line-height: 1.4;
    text-transform: uppercase;
}

.mk-sub-field .input {
    width: 100%;
    box-sizing: border-box;
}

.mk-sub-field textarea.input {
    min-height: 72px;
    resize: vertical;
}

.mk-optional {
    color: var(--text-3);
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: none;
}

.mk-file-input {
    padding: 9px 10px;
    font-size: 11px;
}

.mk-file-input::file-selector-button {
    margin-right: var(--s-3);
    padding: 5px 8px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--panel-2);
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 10px;
    cursor: pointer;
}

.mk-file-input::file-selector-button:hover {
    border-color: var(--line-lime);
    color: var(--text);
}

.mk-sub-preview {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
}

.mk-file-preview {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    max-width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-raise);
}

.mk-file-preview img {
    width: 42px;
    height: 42px;
    flex: none;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}

.mk-file-preview__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    max-width: 240px;
}

.mk-file-preview__meta strong {
    overflow: hidden;
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mk-file-preview__meta small {
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 9px;
}

.mk-file-icon,
.mk-attachment__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.04em;
}

.mk-file-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: none;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
}

.mk-file-remove:hover {
    border-color: rgba(248, 113, 113, 0.6);
    color: var(--red);
}

.mk-submission {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    padding: var(--s-4);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(var(--lime-rgb), 0.025);
}

.mk-submission__notes {
    margin: 0;
    color: var(--text-2);
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.mk-attachments {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: var(--s-2);
}

.mk-attachment {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-raise);
    text-align: left;
    cursor: pointer;
}

.mk-attachment:hover {
    border-color: var(--line-lime);
}

.mk-attachment__thumb {
    width: 48px;
    height: 48px;
    flex: none;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.mk-attachment__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.mk-attachment__meta strong {
    overflow: hidden;
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mk-attachment__meta small {
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 9px;
}

.mk-attachment__download {
    flex: none;
    color: var(--lime);
    font-size: 14px;
}

/* --------------------------------------------------------------------------
   RESPONSIVE — one-column form and action lane on narrow screens.
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
    .mk-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .mk-row {
        padding: var(--s-3) var(--s-4);
    }

    .mk-actions .input,
    .mk-actions .wallet-btn {
        flex-basis: 100%;
        width: 100%;
    }
}

@media (max-width: 420px) {
    .mk-row {
        flex-direction: column;
        gap: var(--s-2);
    }
}

/* --------------------------------------------------------------------------
   OWNER REVIEW NOTIFICATION
   In-page, accessible notification; no backend push or secret material.
   -------------------------------------------------------------------------- */
.mk-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 80;
    display: flex;
    align-items: center;
    gap: var(--s-3);
    width: min(520px, calc(100vw - 32px));
    padding: 14px 16px;
    border: 1px solid #4d5a2a;
    border-radius: 12px;
    background: #12170d;
    box-shadow: 0 18px 50px #0009;
}

.mk-toast[hidden] {
    display: none;
}

.mk-toast__dot {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 0 4px #caf76a18;
}

.mk-toast__copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mk-toast__copy strong {
    color: var(--lime);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mk-toast__copy span {
    overflow: hidden;
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.45;
    text-overflow: ellipsis;
}

.mk-toast__close {
    flex: none;
    border: 0;
    background: transparent;
    color: var(--text-3);
    font: 20px/1 var(--font-mono);
    cursor: pointer;
    padding: 2px 4px;
}

.mk-toast__close:hover {
    color: var(--text-1);
}

@media (max-width: 760px) {
    .mk-toast {
        right: 16px;
        bottom: 16px;
        left: 16px;
        width: auto;
        flex-wrap: wrap;
    }

    .mk-toast__copy {
        flex-basis: calc(100% - 34px);
    }
}
