/* ============================================================
   Tela /tenants — CSS global (NÃO CSS isolation).
   Carregado via <link> em App.razor pra evitar issues de scope.
   Todas as classes .tn-* + variantes pra cards, toggles, dialogs.
   ============================================================ */

/* === Page header === */
.tenants-page .tn-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.tenants-page .tn-page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.tenants-page .tn-page-subtitle {
    font-size: 13px;
    color: #888;
    margin: 4px 0 0;
}

/* === Form "New tenant" colapsável === */
.tenants-page .tn-new-form-details {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tenants-page .tn-new-form-summary {
    cursor: pointer;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #5c6bc0;
    list-style: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tenants-page .tn-new-form-summary::-webkit-details-marker { display: none; }

.tenants-page .tn-new-form-hint {
    font-size: 11px;
    font-weight: 400;
    color: #aaa;
}

.tenants-page .tn-new-form-body {
    padding: 12px 16px 16px;
    border-top: 1px solid #f0f0f0;
}

.tenants-page .tn-new-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.tenants-page .tn-field--full { grid-column: 1 / -1; }

.tenants-page .tn-new-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

/* === Search bar === */
.tenants-page .tn-search {
    position: relative;
    margin-bottom: 16px;
}

.tenants-page .tn-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #bbb;
    font-size: 15px;
    pointer-events: none;
}

.tenants-page .tn-search-input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
    background: #fff;
    font-family: inherit;
}

.tenants-page .tn-search-input:focus { border-color: #5c6bc0; }

/* === Empty / loading state === */
.tenants-page .tn-empty {
    background: #fff;
    border: 1px dashed #ddd;
    border-radius: 10px;
    padding: 32px 16px;
    text-align: center;
    font-size: 13px;
    color: #888;
}

.tenants-page .tn-card-name {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
}

/* === Badge === */
.tn-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    background: #e8eaf6;
    color: #3949ab;
    letter-spacing: 0.02em;
}

.tn-badge.green {
    background: #e8f5e9;
    color: #2e7d32;
}

.tn-badge.tn-badge--danger {
    background: #ffebee;
    color: #c62828;
}

/* Tier badges — modalidade do produto entregue (PR product-tier).
   Cores conforme spec v3: SMB verde · Enterprise indigo · Mixed amber. */
.tn-badge.tn-tier-smb {
    background: #e8f5e9;
    color: #2e7d32;
}

.tn-badge.tn-tier-enterprise {
    background: #e8eaf6;
    color: #3949ab;
}

.tn-badge.tn-tier-mixed {
    background: #fff8e1;
    color: #b07000;
}

/* === Buttons (config + delete) === */
.tenants-page .tn-btn-config {
    padding: 6px 12px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    font-size: 11px;
    font-weight: 700;
    color: #555;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all 0.15s;
    font-family: inherit;
    width: 100%;
}

.tenants-page .tn-btn-config:hover {
    border-color: #5c6bc0;
    color: #5c6bc0;
}

/* === Form fields (compartilhado com modais) === */
.tn-field { margin-bottom: 16px; }

.tn-field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tn-field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.tn-field-label-row .tn-field-label { margin-bottom: 0; }

.tn-field-label code {
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    color: #c62828;
    font-weight: 700;
}

.tn-field-input,
.tn-field-textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid #ddd;
    border-radius: 7px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.tn-field-input:focus,
.tn-field-textarea:focus { border-color: #5c6bc0; }

.tn-field-input:disabled { background: #fafafa; cursor: not-allowed; }

.tn-field-textarea {
    resize: vertical;
    line-height: 1.6;
}

.mono {
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace !important;
    font-size: 13px;
}

.tn-field-help {
    font-size: 11px;
    color: #aaa;
    margin-top: 3px;
    display: block;
    line-height: 1.5;
}

.tn-field-help code {
    background: #f5f5f5;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #c62828;
}

.tn-btn-save {
    padding: 9px 20px;
    border: none;
    border-radius: 7px;
    background: #5c6bc0;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(92, 107, 192, 0.3);
    font-family: inherit;
}

.tn-btn-save:disabled {
    background: #c5cae9;
    cursor: not-allowed;
    box-shadow: none;
}

.tn-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
}

.tn-btn-cancel {
    padding: 9px 20px;
    border: 1.5px solid #ddd;
    border-radius: 7px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s;
}

.tn-btn-cancel:hover:not(:disabled) { border-color: #999; }
.tn-btn-cancel:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Delete dialog específicos === */
.tn-delete-title-line {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tn-delete-icon {
    font-size: 28px;
    line-height: 1;
}

.tn-delete-title-text {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
}

.tn-delete-body { padding: 4px 0; }

.tn-delete-warning {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    color: #c62828;
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.tn-delete-tenant { margin-bottom: 16px; }

.tn-delete-tenant-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 6px;
}

.tn-delete-tenant-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tn-delete-tenant-name {
    font-size: 13px;
    color: #666;
}

.tn-delete-paths {
    background: #f5f5f5;
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 12px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 16px;
}

.tn-delete-paths-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
}

.tn-delete-paths-list li { padding: 2px 0; }

.tn-delete-paths-list code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ddd;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    font-size: 11px;
    color: #333;
}

.tn-btn-delete-confirm {
    padding: 9px 24px;
    border: none;
    border-radius: 7px;
    background: #e53935;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.3);
    font-family: inherit;
}

.tn-btn-delete-confirm:disabled {
    background: #ef9a9a;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============================================================
   Lista de tenants (mockup_tenants.html) — sem toggles nas linhas.
   ============================================================ */
.tenants-page .tn-list {
    background: #fff;
    border: 1px solid #e6e9ef;
    border-radius: 12px;
    overflow: hidden;
}
.tenants-page .tn-list-head,
.tenants-page .tn-list-row {
    display: flex;
    align-items: center;
    padding: 14px 18px;
}
.tenants-page .tn-list-head {
    padding: 10px 18px;
    background: #f8f9fc;
    border-bottom: 1px solid #e6e9ef;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    color: #6b7385;
    text-transform: uppercase;
}
.tenants-page .tn-list-row { border-bottom: 1px solid #eef0f4; }
.tenants-page .tn-list-row:last-child { border-bottom: none; }
.tenants-page .tn-list-row:hover { background: #f8f9fc; }
.tenants-page .tn-c-name { width: 340px; min-width: 0; }
.tenants-page .tn-c-status { width: 130px; }
.tenants-page .tn-c-rec { flex: 1; min-width: 0; }
.tenants-page .tn-c-maq { width: 110px; color: #6b7385; }
.tenants-page .tn-c-act { width: 120px; text-align: right; }
.tenants-page .tn-list-sub { font-size: 12px; color: #6b7385; margin-top: 3px; }
.tenants-page .tn-st { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; }
.tenants-page .tn-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: #2f9e5b; margin-right: 7px; display: inline-block;
}
.tenants-page .tn-dot.off { background: #c9ced8; }
.tenants-page .tn-rec-sum { font-size: 12.5px; color: #6b7385; margin-bottom: 5px; }
.tenants-page .tn-chip {
    display: inline-block; font-size: 11.5px; padding: 3px 8px; border-radius: 12px;
    margin: 0 6px 4px 0; background: #eef8f1; color: #256b40;
}
.tenants-page .tn-chip.off { background: #fff3e0; color: #b26a00; }
.tenants-page .tn-chip.none { background: #f1f3f7; color: #8a929e; }
.tenants-page .tn-list-hint { font-size: 11.5px; color: #9aa2ae; margin-top: 10px; }
.tenants-page .tn-btn-config {
    border: 1px solid #dfe3ea; background: #fff; border-radius: 9px; padding: 8px 14px;
    font: inherit; font-size: 13px; font-weight: 600; color: #1f2734; cursor: pointer; white-space: nowrap;
}
.tenants-page .tn-btn-config:hover { border-color: #4c6ef5; color: #4c6ef5; }

@media (max-width: 900px) {
    .tenants-page .tn-list-head { display: none; }
    .tenants-page .tn-list-row { flex-wrap: wrap; row-gap: 8px; }
    .tenants-page .tn-c-name, .tenants-page .tn-c-rec { width: 100%; flex: none; }
    .tenants-page .tn-c-status, .tenants-page .tn-c-maq { width: auto; margin-right: 16px; }
    .tenants-page .tn-c-act { width: auto; margin-left: auto; }
}

/* ============================================================
   Modal "Configurar" — cabeçalho, abas, recursos, rodapé.
   Fora de .tenants-page: o MudDialog renderiza no portal.
   ============================================================ */
.tn-cfg-dialog .mud-dialog-title { background: #eef1f6; padding: 20px 26px; }
.tn-cfg-dialog .mud-dialog-content { padding: 0; }
.tn-cfg-dialog .mud-dialog-actions { padding: 0; }
.tn-cfg-head-row { display: flex; align-items: center; gap: 6px; padding-right: 44px; flex-wrap: wrap; }
.tn-cfg-name { font-size: 20px; font-weight: 800; margin-right: 4px; }
.tn-cfg-spacer { flex: 1; }
.tn-cfg-master-label { font-size: 13px; font-weight: 600; margin-right: 4px; }
.tn-cfg-sub { font-size: 12px; color: #6b7385; margin-top: 6px; }

.tn-cfg-tabs {
    display: flex; background: #eef1f6; padding: 0 26px; border-bottom: 1px solid #e3e7ef;
}
.tn-cfg-tab {
    padding: 12px 16px; font: inherit; font-size: 13px; font-weight: 600; color: #6b7385;
    background: none; border: none; border-bottom: 3px solid transparent; margin-right: 4px; cursor: pointer;
}
.tn-cfg-tab.on { color: #4c6ef5; border-bottom-color: #4c6ef5; }
.tn-cfg-pane { padding: 22px 26px; max-height: 540px; overflow-y: auto; }
.tn-cfg-pane[hidden] { display: none; }
.tn-cfg-two { display: flex; gap: 26px; }
.tn-cfg-col { flex: 1; min-width: 0; }
.tn-cfg-sep {
    font-size: 11px; font-weight: 700; letter-spacing: .06em; color: #8a929e; text-transform: uppercase;
    margin: 18px 0 10px; padding-top: 14px; border-top: 1px dashed #e3e7ef;
}

.tn-cfg-logos { display: flex; gap: 12px; margin-bottom: 8px; }
.tn-cfg-logo-card { flex: 1; min-width: 0; border: 1px solid #dfe3ea; border-radius: 10px; padding: 12px; }
.tn-cfg-logo-title { font-size: 12px; font-weight: 600; color: #6b7385; margin-bottom: 8px; }
.tn-cfg-logo-box {
    height: 56px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.tn-cfg-logo-box.light { background: #f4f6f9; border: 1px solid #e6e9ef; }
.tn-cfg-logo-box.dark { background: #0f1a2b; }
.tn-cfg-logo-box img { max-height: 40px; max-width: 90%; object-fit: contain; }
.tn-cfg-logo-empty { font-size: 10px; color: #9ca3af; }
.tn-cfg-logo-btns { margin-top: 8px; display: flex; gap: 6px; }
.tn-cfg-small { padding: 5px 10px !important; font-size: 12px !important; cursor: pointer; }
.tn-cfg-prev {
    height: 40px; border-radius: 8px; display: flex; align-items: center; gap: 10px;
    padding: 0 12px; font-size: 9px; letter-spacing: .08em; margin-bottom: 8px;
}
.tn-cfg-prev.light { background: #fff; border: 1px solid #e6e9ef; color: #6b7385; }
.tn-cfg-prev.dark { background: #0f1a2b; color: #9fb3cc; margin-bottom: 0; }
.tn-cfg-prev img { height: 18px; object-fit: contain; }

.tn-cfg-machines { min-height: 180px; }
.tn-cfg-badge-all {
    display: inline-block; font-size: 11px; font-weight: 600; background: #e8effc; color: #2b5cc7;
    border-radius: 10px; padding: 2px 8px; margin-left: 8px; vertical-align: middle;
}
.tn-cfg-code-neutral { background: #f1f3f7 !important; color: #556 !important; }

.tn-cfg-feat { display: flex; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #f0f2f6; }
.tn-cfg-feat:last-of-type { border-bottom: none; }
.tn-cfg-feat-txt { flex: 1; padding-right: 12px; }
.tn-cfg-feat-t { font-weight: 600; font-size: 13.5px; }
.tn-cfg-feat-d { font-size: 12px; color: #6b7385; margin-top: 2px; }
.tn-cfg-feat.new .tn-cfg-feat-t { color: #5b3fc0; }
.tn-cfg-feat.dis { opacity: .5; }
.tn-cfg-novo {
    display: inline-block; font-size: 10px; font-weight: 700; background: #ece6fd; color: #5b3fc0;
    border-radius: 10px; padding: 1px 7px; margin-left: 6px; vertical-align: middle;
}
.tn-cfg-rec-help { display: block; margin-top: 12px; }

.tn-sw {
    width: 38px; height: 22px; border-radius: 20px; background: #cfd5df; position: relative;
    cursor: pointer; flex: none; margin-top: 2px; border: none; padding: 0;
}
.tn-sw::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    border-radius: 50%; background: #fff; transition: left .12s;
}
.tn-sw.on { background: #4c6ef5; }
.tn-sw.on::after { left: 18px; }
.tn-sw.master.on { background: #2f9e5b; }
.tn-sw:disabled { cursor: not-allowed; }
.tn-sw:focus-visible { outline: 2px solid #4c6ef5; outline-offset: 2px; }

.tn-cfg-foot {
    width: 100%; display: flex; align-items: center; gap: 10px;
    background: #f8f9fc; border-top: 1px solid #e6e9ef; padding: 14px 26px;
}
.tn-cfg-btn-danger {
    border: 1px solid #f1c4c4; background: #fff; color: #c62828; border-radius: 9px;
    padding: 9px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.tn-cfg-btn-danger:hover:not(:disabled) { background: #fdecea; }
.tn-cfg-btn-danger:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 700px) {
    .tn-cfg-two, .tn-cfg-logos { flex-direction: column; }
    .tn-cfg-tabs, .tn-cfg-pane, .tn-cfg-foot { padding-left: 16px; padding-right: 16px; }
}
