/* =============================================================================
   DEX Portal - File requests (RM-161)

   The File request panel, the File requests card on a record, the files
   under an Activity entry, and Projects > File Requests. Tokens only; the
   file chips and their virus-check tags are the project attachment ones
   (invoices.css, .project-activity__file), so a received file looks the same
   wherever it is listed.
   ============================================================================= */

/* ---- Status pills: Open, Expired, Closed ------------------------------------ */

.file-request-status--open    { background: var(--status-success-tint); color: var(--status-success); }
.file-request-status--expired { background: var(--status-warning-tint); color: var(--status-warning-ink); }
.file-request-status--closed  { background: var(--status-neutral-tint); color: var(--status-neutral); }


/* ---- A list of received files ---------------------------------------------- */

.file-request-files {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* A long file name ellipsises inside its chip instead of widening the row. */
.file-request-files .project-activity__file {
    max-width: 100%;
    min-width: 0;
}

.file-request-files .project-activity__file-text { min-width: 0; }

.file-request-files .project-activity__file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-request-activity-files:empty { display: none; }
.file-request-activity-files { margin-top: 8px; }


/* ---- The card on a record ------------------------------------------------ */

/* The card sits inside its own host, so it is always that host's last child
   and loses the 16px every record section keeps below it. The host takes the
   gap instead, so the next card (Agent Meeko on a project) does not touch it. */
.file-requests-host:not(:last-child) {
    margin-bottom: 16px;
}


/* ---- The panel --------------------------------------------------------------- */

.file-request-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: var(--gutter);
}

.file-request-panel__intro {
    margin: 0;
    font-size: var(--font-size-small);
    line-height: 1.5;
    color: var(--text-secondary);
}

.file-request-panel__fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.file-request-panel__label {
    display: block;
    margin-bottom: 8px;
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--text-primary);
}

/* Four equal segments: on a phone they share the width, never overflow it. */
.file-request-panel__choices {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border: var(--divider-width) solid var(--border-default);
    border-radius: var(--radius-medium);
    background: var(--surface-subtle);
}

.file-request-panel__choice {
    min-width: 0;
    height: var(--control-height-small);
    padding: 0 6px;
    border: 0;
    border-radius: var(--radius-small);
    background: transparent;
    font: inherit;
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--duration-instant) var(--easing-standard),
                color var(--duration-instant) var(--easing-standard);
}

.file-request-panel__choice:hover:not(:disabled) { color: var(--text-primary); }

.file-request-panel__choice[aria-checked="true"] {
    background: var(--surface-panel);
    color: var(--accent);
    box-shadow: var(--shadow-card);
}

.file-request-panel__choice:disabled { cursor: default; }

.file-request-panel__choice:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.file-request-panel__facts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 12px 14px;
    list-style: none;
    border-radius: var(--radius-medium);
    background: var(--surface-subtle);
    font-size: var(--font-size-small);
    color: var(--text-secondary);
}

.file-request-panel__facts li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.file-request-panel__facts .icon {
    flex: none;
    margin-top: 2px;
    color: var(--text-muted);
}

.file-request-panel__ready {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-medium);
    background: var(--status-success-tint);
    color: var(--text-primary);
    font-size: var(--font-size-small);
}

.file-request-panel__ready[hidden] { display: none; }

.file-request-panel__ready-icon { flex: none; color: var(--status-success); }

.file-request-panel__ready-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* The link breaks anywhere rather than pushing the panel sideways on a phone. */
.file-request-panel__link {
    margin-top: 4px;
    font-family: var(--font-monospace);
    font-size: var(--font-size-tiny);
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}


/* ---- The File requests card on a record ------------------------------------- */

.file-requests-card__new { margin-left: auto; }

.file-requests-card__description {
    margin: -4px 0 10px;
    font-size: var(--font-size-small);
    color: var(--text-muted);
}

.file-requests-card__list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.file-requests-card__row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0;
    border-top: var(--divider-width) solid var(--border-subtle);
}

.file-requests-card__row:first-child { border-top: 0; }

.file-requests-card__summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.file-requests-card__toggle {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.file-requests-card__toggle:disabled { cursor: default; }

.file-requests-card__headline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.file-requests-card__title {
    overflow: hidden;
    font-weight: 600;
    color: var(--text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-requests-card__meta {
    font-size: var(--font-size-small);
    color: var(--text-muted);
}

.file-requests-card__actions {
    display: flex;
    flex: none;
    align-items: center;
    gap: 4px;
}

.file-requests-card__empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

/* Phones: the title takes the line, the actions sit under it, the empty
   state's button takes the full width for a thumb. */
@media (max-width: 560px) {
    .file-requests-card__summary { flex-wrap: wrap; }
    .file-requests-card__toggle { flex-basis: 100%; }
    .file-requests-card__actions { width: 100%; justify-content: flex-end; }
    .file-requests-card__empty-button { width: 100%; justify-content: center; }
}


/* ---- Projects > File Requests ----------------------------------------------- */

.file-requests-page__tiles { margin: var(--content-gap-top) var(--gutter) 0; }

/* Numbers only here; the chips are the filter. */
.file-requests-page__tile { cursor: default; }

.file-requests-page__chip-divider {
    width: var(--divider-width);
    height: 20px;
    margin: 0 4px;
    background: var(--divider-colour);
}

.file-requests-table__row { cursor: pointer; }
.file-requests-table__row--expanded > td { border-bottom-color: transparent; }

.file-requests-table__title { font-weight: 600; color: var(--text-primary); }

.file-requests-table__record {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
    color: var(--text-primary);
    cursor: pointer;
}

.file-requests-table__record:hover .file-requests-table__record-name { text-decoration: underline; }

.file-requests-table__record-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-requests-table__kind {
    flex: none;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--accent-tint);
    font-size: var(--font-size-tiny);
    font-weight: 600;
    color: var(--accent);
}

.file-requests-table__kind--client      { background: var(--status-info-tint); color: var(--status-info); }
.file-requests-table__kind--contact     { background: var(--status-success-tint); color: var(--status-success); }
.file-requests-table__kind--appointment { background: var(--status-warning-tint); color: var(--status-warning-ink); }

.file-requests-table__actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    white-space: nowrap;
}

.file-requests-table__files-row > td {
    padding-top: 0;
    background: var(--surface-row-band);
}

.file-requests-table__files-row .file-request-files {
    max-width: 560px;
    padding: 10px 0 14px;
}

/* Phones: Size and Expires repeat what the row's status and file count
   already say, so they go and the rest keep legible widths. The table
   scrolls inside its own box (.data-table-scroll) if it is still too wide. */
@media (max-width: 560px) {
    .file-requests-table .file-requests-table__phone-hidden { display: none; }
    .file-requests-page__chip-divider { display: none; }
}


/* ---- The card says where closed requests went (7 Nov 2026) ----------------- */

.file-requests-card__finished {
    margin: 10px 0 0;
    font-size: var(--font-size-tiny);
    color: var(--text-muted);
}


/* ---- The File requests table on a record's Documents tab -------------------- */

/* A wide table scrolls inside its own box on a phone, never the page. */
.file-requests-table__scroller {
    max-width: 100%;
    overflow-x: auto;
}

.file-requests-table td { vertical-align: middle; }

.file-requests-table__for {
    display: block;
    margin-top: 2px;
    font-size: var(--font-size-tiny);
    color: var(--text-muted);
}

/* The cell stays a table cell (so its row's rule runs the full width); the
   buttons sit in the page's own .file-requests-table__actions inside it. */
.file-requests-table__actions-cell { text-align: right; }

/* A request with nothing received has nothing to open. */
.file-requests-table__row--quiet { cursor: default; }

/* Under the forms on an appointment's Documents tab. */
.booking-tab-section { margin-top: 26px; }
