/*
 * Meus Arquivos (TASK-455): aba "Meus Arquivos" do "Meu perfil" e aba "Arquivos" da ficha do usuário.
 * Medidor da cota em painel rebaixado (com aviso aos 85%), área de envio múltiplo com arrastar e soltar,
 * sub-abas Arquivos/Lixeira (`sn2-subnav`, à esquerda) e a tabela paginada.
 */

.sn2-ufiles {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sn2-ufiles__head .sn2-card__lead { max-width: 64ch; margin-bottom: 0; }

/* Medidor da cota. */
.sn2-ufiles__quota {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--sn2-border-soft);
    border-radius: var(--sn2-radius-lg);
    background: var(--sn2-bg-sunken);
}

.sn2-ufiles__quota-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sn2-ufiles__quota-icon {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--sn2-radius-md);
    background: var(--sn2-accent-soft);
    color: var(--sn2-accent);
}

.sn2-ufiles__quota.is-warn .sn2-ufiles__quota-icon { background: var(--sn2-warning-bg); color: var(--sn2-warning-fg); }

.sn2-ufiles__quota.is-danger .sn2-ufiles__quota-icon { background: var(--sn2-danger-bg); color: var(--sn2-danger-fg); }

.sn2-ufiles__quota-text { flex: 1; min-width: 0; }

.sn2-ufiles__quota-value {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 6px;
    margin: 0;
}

.sn2-ufiles__quota-value b {
    font-size: var(--sn2-text-lg);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--sn2-fg-1);
}

.sn2-ufiles__quota-value span { font-size: var(--sn2-text-sm); color: var(--sn2-fg-2); }

.sn2-ufiles__quota-sub {
    margin: 2px 0 0;
    font-size: var(--sn2-text-xs);
    color: var(--sn2-fg-3);
}

.sn2-ufiles__quota-percent {
    flex: none;
    font-size: var(--sn2-text-lg);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--sn2-fg-2);
}

.sn2-ufiles__quota.is-warn .sn2-ufiles__quota-percent { color: var(--sn2-warning-fg); }

.sn2-ufiles__quota.is-danger .sn2-ufiles__quota-percent { color: var(--sn2-danger-fg); }

.sn2-ufiles__meter { height: 10px; }

.sn2-ufiles__meter:not(.sn2-meter--warn):not(.sn2-meter--danger) > span { background: var(--sn2-gradient, var(--sn2-accent)); }

.sn2-ufiles__quota-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--sn2-radius-md);
    background: var(--sn2-warning-bg);
    color: var(--sn2-warning-fg);
    font-size: var(--sn2-text-sm);
}

.sn2-ufiles__quota.is-danger .sn2-ufiles__quota-alert { background: var(--sn2-danger-bg); color: var(--sn2-danger-fg); }

.sn2-ufiles__quota-alert .sn2-icon { flex: none; margin-top: 2px; }

.sn2-ufiles__quota-alert b { margin-right: 4px; font-weight: 600; }

/* Envio múltiplo. */
.sn2-ufiles__upload {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
}

.sn2-ufiles__upload > .sn2-field { flex: 1 1 320px; margin: 0; }

.sn2-ufiles__upload-actions { display: flex; gap: 8px; padding-top: 18px; }

.sn2-ufiles__drop {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 76px;
    padding: 14px 16px;
    border: 1.5px dashed var(--sn2-border-2);
    border-radius: var(--sn2-radius-md);
    background: var(--sn2-surface);
    cursor: pointer;
    transition: border-color var(--sn2-dur-fast) var(--sn2-ease-standard), background var(--sn2-dur-fast) var(--sn2-ease-standard);
}

.sn2-ufiles__drop:hover,
.sn2-ufiles__drop:focus-within,
.sn2-ufiles__drop.is-over {
    border-color: var(--sn2-accent);
    background: var(--sn2-accent-soft);
}

.sn2-ufiles__drop:focus-within { box-shadow: 0 0 0 3px var(--sn2-accent-ring); }

.sn2-ufiles__drop.has-file { border-style: solid; border-color: var(--sn2-accent); }

.sn2-field.is-invalid .sn2-ufiles__drop { border-color: var(--sn2-danger); }

.sn2-ufiles__drop-icon {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--sn2-radius-md);
    background: var(--sn2-bg-sunken);
    color: var(--sn2-fg-2);
}

.sn2-ufiles__drop.has-file .sn2-ufiles__drop-icon,
.sn2-ufiles__drop.is-over .sn2-ufiles__drop-icon { background: var(--sn2-accent-soft); color: var(--sn2-accent); }

.sn2-ufiles__drop-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sn2-ufiles__drop-text b { font-weight: 600; color: var(--sn2-fg-1); }

.sn2-ufiles__drop-text span { font-size: var(--sn2-text-xs); color: var(--sn2-fg-3); }

.sn2-ufiles__drop-busy {
    margin-left: auto;
    font-size: var(--sn2-text-xs);
    font-weight: 600;
    color: var(--sn2-accent);
}

.sn2-ufiles__picked {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.sn2-ufiles__picked li {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--sn2-text-sm);
    color: var(--sn2-fg-2);
}

.sn2-ufiles__picked .sn2-icon { flex: none; color: var(--sn2-fg-3); }

.sn2-ufiles__picked-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sn2-ufiles__picked-size {
    margin-left: auto;
    font-size: var(--sn2-text-xs);
    font-variant-numeric: tabular-nums;
    color: var(--sn2-fg-3);
}

/* Sub-abas e barra da lixeira. */
.sn2-ufiles__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
}

.sn2-ufiles__views { justify-content: flex-start; }

.sn2-ufiles__count {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: var(--sn2-radius-pill);
    background: var(--sn2-gray-20);
    font-size: var(--sn2-text-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--sn2-fg-2);
}

.sn2-ufiles__trash-hint { margin: -4px 0 0; }

/* Tabela. */
.sn2-ufiles__name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 420px;
    min-width: 0;
}

.sn2-ufiles__type {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--sn2-radius-md);
    background: var(--sn2-bg-sunken);
    color: var(--sn2-fg-2);
}

.sn2-ufiles__name-text {
    overflow: hidden;
    font-weight: 500;
    color: var(--sn2-fg-1);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sn2-ufiles__row.is-trashed .sn2-ufiles__name-text { color: var(--sn2-fg-2); }

.sn2-ufiles__col-size,
.sn2-ufiles__when {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sn2-ufiles__when { color: var(--sn2-fg-2); }

.sn2-ufiles__actions { width: 1%; white-space: nowrap; text-align: right; }

.sn2-ufiles__actions-row { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }

.sn2-ufiles__rename {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 460px;
}

.sn2-ufiles__rename .sn2-input { flex: 1; min-width: 0; }

@media (max-width: 640px) {
    .sn2-ufiles__quota { padding: 12px; }

    .sn2-ufiles__quota-icon { display: none; }

    .sn2-ufiles__upload-actions { width: 100%; padding-top: 0; }

    .sn2-ufiles__drop { min-height: 64px; padding: 12px; }

    .sn2-ufiles__name { max-width: 220px; }
}

/* ---------------------------------------------------------------- Armazenamento por usuário (TASK-456) */
.sn2-ustorage__summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.sn2-ustorage__stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.sn2-ustorage__stat-icon {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--sn2-radius-md);
    background: var(--sn2-accent-bg, var(--sn2-gray-20));
    color: var(--sn2-accent-fg, var(--sn2-accent));
}

.sn2-ustorage__stat--warn .sn2-ustorage__stat-icon { background: var(--sn2-warning-bg); color: var(--sn2-warning-fg); }

.sn2-ustorage__stat--info .sn2-ustorage__stat-icon { background: var(--sn2-info-bg); color: var(--sn2-info-fg); }

.sn2-ustorage__stat-text { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }

.sn2-ustorage__stat-value {
    font-size: var(--sn2-text-xl);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--sn2-fg-1);
}

.sn2-ustorage__stat-label { font-size: var(--sn2-text-sm); color: var(--sn2-fg-3); }

.sn2-ustorage__row.is-inactive .sn2-person__name { color: var(--sn2-fg-2); }

.sn2-ustorage__row .sn2-person__name { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.sn2-ustorage__col-usage { min-width: 180px; }

.sn2-ustorage__used {
    display: block;
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--sn2-fg-1);
}

.sn2-ustorage__meter { max-width: 220px; }

.sn2-ustorage__meter:not(.sn2-meter--warn):not(.sn2-meter--danger) > span { background: var(--sn2-gradient, var(--sn2-accent)); }

.sn2-ustorage__col-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sn2-ustorage__hint {
    display: block;
    margin-top: 2px;
    font-size: var(--sn2-text-xs);
    color: var(--sn2-fg-3);
}

.sn2-ustorage__percent { font-weight: 500; color: var(--sn2-fg-2); }

.sn2-ustorage__percent.is-warn { color: var(--sn2-warning-fg); }

.sn2-ustorage__percent.is-danger { color: var(--sn2-danger-fg); }

.sn2-ustorage__modal-lead { margin: 0 0 12px; color: var(--sn2-fg-2); }

@media (max-width: 640px) {
    .sn2-ustorage__col-usage { min-width: 0; }

    .sn2-ustorage__meter { max-width: none; }
}
