/* ============================================================
   User tables — the column cards of «Configuração de Tabelas de Utilizador» and the table
   cards of «Tabelas de Utilizador». Both reuse the load order's occurrence cards
   (.load-order-gd-card + .load-order-occ-*), as the trip does; only the tones by field type,
   the wider badge text and the detail pane's field grid live here.
   ============================================================ */

/* Field-type tones: the card's left border, badge and chip say what kind of column it is. */
.load-order-occ-card.user-table-type-text,
.load-order-occ-type-chip.user-table-type-text,
.load-order-occ-add.user-table-type-text {
    --occ-tone: #185FA5;
    --occ-tone-soft: #E6F1FB;
}

.load-order-occ-card.user-table-type-number,
.load-order-occ-type-chip.user-table-type-number {
    --occ-tone: #1D7A5F;
    --occ-tone-soft: #E3F3ED;
}

.load-order-occ-card.user-table-type-date,
.load-order-occ-type-chip.user-table-type-date {
    --occ-tone: #D85A30;
    --occ-tone-soft: #FBECE4;
}

.load-order-occ-card.user-table-type-bool,
.load-order-occ-type-chip.user-table-type-bool {
    --occ-tone: #5F6B80;
    --occ-tone-soft: #F1F4F9;
}

.load-order-occ-card.user-table-type-lookup,
.load-order-occ-type-chip.user-table-type-lookup {
    --occ-tone: #534AB7;
    --occ-tone-soft: #ECEAF8;
}

/* A column that is not shown keeps its tone, faded. */
.load-order-occ-card.user-table-is-inactive {
    opacity: .65;
}

/* The badge carries up to three letters (F4, TDU), not a single one. */
.user-table-badge {
    font-size: 9px;
    letter-spacing: -.4px;
}

/* A column already created in the database: why there is no remove button. */
.user-table-lock {
    color: #5f6b80;
    font-size: 11px;
}

.user-table-col-search {
    flex: 1 1 auto;
    min-width: 0;
}

.user-table-col-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    align-items: end;
}

.user-table-col-fields + .user-table-col-fields {
    margin-top: 10px;
}

.user-table-col-note {
    margin: 0 0 10px;
    color: #5f6b80;
    font-size: 12px;
}

/* ============================================================
   «Configuração de Tabelas de Utilizador» — identification row, «Pronto a usar?» panel and the
   «Menu» tab.
   ============================================================ */

/* Identification: the technical name and the active flag on one row; the menu name is on the
   «Menu» tab. */
.user-table-ident {
    display: grid;
    grid-template-columns: minmax(0, 520px) auto;
    justify-content: start;
    gap: 12px 16px;
    align-items: end;
    padding: 4px 12px 12px;
}

@media (max-width: 991px) {
    .user-table-ident {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* «Pronto a usar?»: one row per point, a coloured dot for its state. */
.user-table-check {
    margin: 0;
    padding: 4px 12px 8px;
    list-style: none;
}

.user-table-check-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 0;
    border-top: 1px solid #e4edf7;
}

.user-table-check-item:first-child {
    border-top: 0;
}

.user-table-check-dot {
    display: grid;
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    place-items: center;
    border-radius: 50%;
    background: #c3cede;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.user-table-check-dot.is-done {
    background: #1d7a5f;
}

.user-table-check-dot.is-missing {
    background: #b86e00;
}

.user-table-check-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
    color: #002b63;
    font-size: 13px;
}

.user-table-check-detail {
    overflow: hidden;
    color: #5f6b80;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-table-check-action {
    align-self: flex-start;
    padding: 0;
    border: 0;
    background: none;
    color: #185fa5;
    font-size: 12px;
    font-weight: 700;
}

.user-table-check-action:hover {
    text-decoration: underline;
}

.user-table-check-action .oi {
    margin-left: 4px;
    font-size: 9px;
}

/* «Menu» tab with no location yet: an amber mark after the label. */
.jump-ui-tab.user-table-tab-pending::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 6px;
    border-radius: 50%;
    background: #b86e00;
    vertical-align: middle;
}

/* «Menu» tab, drawn as the Dynamic Lists' one: «Apresentação» (the menu name and the entry it
   produces) on the left, «Onde aparece no menu» (the shared product and module tree) on the right. */
.user-table-menu-tab {
    display: grid;
    grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
}

@media (max-width: 1100px) {
    .user-table-menu-tab {
        grid-template-columns: 1fr;
    }
}

.user-table-menu-card {
    min-width: 0;
    border: 1px solid #cbd9ea;
    border-radius: 8px;
    background: #ffffff;
    color: #002b63;
}

.user-table-menu-card h2 {
    margin: 0;
    color: #002b63;
    font-size: 15px;
    font-weight: 700;
}

.user-table-menu-presentation {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
}

.user-table-menu-card-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #e4edf7;
}

.user-table-menu-location {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    overflow: hidden;
}

.user-table-menu-location > :last-child {
    margin: 0 12px;
}

.user-table-menu-muted {
    color: #506680;
    font-size: 12px;
}

.user-table-menu-label {
    color: #506680;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.user-table-menu-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #e4edf7;
}

.user-table-menu-preview-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px dashed #cfd8e4;
    border-radius: 8px;
}

.user-table-menu-preview-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #e8f1fc;
    color: #0b55b0;
}

.user-table-menu-preview-title {
    font-size: 15px;
    font-weight: 500;
}

/* The page sits in containers that centre their text, and the captions, the «Pronto a usar?»
   points and the «Menu» tab's cards all inherited it. Each of them reads as a list or a form, so
   they are set to the left here, whatever the containers around them say. */
.user-table-ident,
.user-table-ident .jump-ui-label,
.user-table-check,
.user-table-check-copy,
.user-table-menu-tab {
    text-align: left;
}

/* ============================================================
   «Tabelas de Utilizador»: the table list on the left and the bar above the records grid.
   Inside the split workspace the section is a flex column with a definite height, so the list
   and the grid wrapper take the free space and scroll on their own; in direct mode (a table
   opened from its menu entry) there is no pane and the page scrolls instead.
   ============================================================ */

/* ---- Table list ---- */
.user-tables-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-bottom: 8px;
}

.user-tables-filter-field {
    flex: 1 1 auto;
    min-width: 0;
}

.user-tables-filter-count {
    color: #5d79a5;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.user-tables-empty {
    margin: 0;
    padding: 12px;
    border: 1px dashed var(--app-page-border, #dbe7f6);
    border-radius: var(--app-page-radius, 8px);
    color: #5d79a5;
    font-size: 12px;
    text-align: center;
}

/* A flex column of fixed-height rows, not a grid of cards: a card is height: 100%, and a
   percentage height inside an auto-sized grid row collapsed every entry onto the next one. */
.user-tables-list {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--app-page-border, #dbe7f6);
    border-radius: var(--app-page-radius, 8px);
    background: #fff;
}

.user-tables-row {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    width: 100%;
    min-height: 34px;
    padding: 0 10px 0 7px;
    border: 0;
    border-left: 3px solid transparent;
    border-bottom: 1px solid #eef3fa;
    background: transparent;
    color: #06245d;
    font-family: var(--app-page-font-family, 'Inter', 'Segoe UI', sans-serif);
    font-size: 12.5px;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
}

.user-tables-row:last-child {
    border-bottom: 0;
}

.user-tables-row:hover {
    background: #f6f9fe;
}

.user-tables-row:focus-visible {
    outline: 2px solid #78aeea;
    outline-offset: -2px;
}

.user-tables-row.is-selected {
    border-left-color: #0057b8;
    background: #eef6ff;
}

.user-tables-row-initial {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    border-radius: 5px;
    background: #e6f1fb;
    color: #185fa5;
    font-size: 10px;
    font-weight: 800;
}

.user-tables-row.is-selected .user-tables-row-initial {
    background: #0057b8;
    color: #fff;
}

.user-tables-row-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 650;
}

/* Tabular digits keep the counts in a column the eye can run down. */
.user-tables-row-count {
    flex: 0 0 auto;
    color: #5d79a5;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.user-tables-row.is-selected .user-tables-row-count {
    color: #06245d;
    font-weight: 600;
}

/* ---- Bar above the records grid ---- */
.user-tables-toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 0 auto;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--app-page-border, #dbe7f6);
}

.user-tables-toolbar-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.user-tables-toolbar-title {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #003d8f;
    font-family: var(--app-page-font-family, 'Inter', 'Segoe UI', sans-serif);
    font-size: 16px;
    font-weight: 850;
    line-height: 1.2;
}

.user-tables-toolbar-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    color: #0057b8;
    font-size: 12px;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.user-tables-toolbar-link .oi {
    font-size: 10px;
}

.user-tables-toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.user-tables-toolbar-spacer {
    flex: 1 1 auto;
}

/* How many rows the «Eliminar selecionadas» button will take. */
.user-tables-toolbar-count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #b42318;
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
}

/* The grid fills what the toolbar leaves of the pane: the same flex chain the shared card used
   to carry, so a grid of 100% height has a definite height to take. */
.user-tables-grid {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

/* The per-row delete button in the grid's command column. */
.user-tables-row-delete {
    appearance: none;
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #b42318;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
}

.user-tables-row-delete:hover {
    background: #ffecec;
}

.user-tables-row-delete:focus-visible {
    outline: 2px solid #b42318;
    outline-offset: 1px;
}

/* ============================================================
   «Criar tabela com o assistente» (UserTableCreateWizard): the four steps above the content, the
   identification fields, the copy source, the review and the step counter in the footer.
   ============================================================ */

.user-table-wizard {
    text-align: left;
}

.user-table-wizard-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
}

.user-table-wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #dbe7f6;
    border-radius: 8px;
    background: #ffffff;
    color: #06245d;
    text-align: left;
}

.user-table-wizard-step:disabled {
    cursor: default;
    opacity: .75;
}

.user-table-wizard-step.is-current {
    border-color: #0057b8;
    box-shadow: 0 0 0 2px #e6f1fb;
}

.user-table-wizard-step-number {
    display: grid;
    flex: none;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    background: #e8eef7;
    color: #557097;
    font-size: 12px;
    font-weight: 800;
}

.user-table-wizard-step.is-done .user-table-wizard-step-number {
    background: #1d7a5f;
    color: #ffffff;
}

.user-table-wizard-step.is-current .user-table-wizard-step-number {
    background: #0057b8;
    color: #ffffff;
}

.user-table-wizard-step-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.user-table-wizard-step-copy strong {
    font-size: 12.5px;
}

.user-table-wizard-step-copy small {
    overflow: hidden;
    color: #557097;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-table-wizard .jump-ui-callout {
    margin-bottom: 8px;
}

/* Under the column cards, the note keeps the same distance as between dialog sections. */
.user-table-wizard .load-order-occ-layout + .jump-ui-callout {
    margin-top: 8px;
}

.user-table-wizard-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}

.user-table-wizard-copy {
    max-width: 520px;
    margin-top: 10px;
}

.user-table-wizard-note {
    margin: 6px 0 0;
    color: #557097;
    font-size: 12px;
}

.user-table-wizard-review {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 8px;
    margin-bottom: 8px;
}

/* Side by side, the two sections must not take the stacked sections' top margin. */
.user-table-wizard-review > .jump-dialog-section + .jump-dialog-section {
    margin-top: 0;
}

.user-table-wizard-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px 12px;
    margin: 0;
    font-size: 13px;
}

.user-table-wizard-summary dt {
    color: #557097;
    font-weight: 600;
}

.user-table-wizard-summary dd {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: #06245d;
    font-weight: 700;
}

.user-table-wizard-columns {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.user-table-wizard-columns th {
    padding: 6px 8px;
    border-bottom: 1px solid #dbe7f6;
    color: #557097;
    font-size: 11.5px;
    font-weight: 700;
    text-align: left;
}

.user-table-wizard-columns td {
    padding: 6px 8px;
    border-bottom: 1px solid #eef3f9;
    color: #06245d;
}

.user-table-wizard-columns tr.is-inactive td {
    color: #8a9bb4;
}

.user-table-wizard-footer {
    position: relative;
}

.user-table-wizard-position {
    position: absolute;
    top: 50%;
    left: 12px;
    color: #557097;
    font-size: 12px;
    font-weight: 700;
    transform: translateY(-50%);
}

/* The wizard's «Menu» step: the menu name and the entry's preview, one under the other. */
.user-table-wizard-presentation {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 520px;
}
