.card,
.app-hero {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(18px);
}

.card-body {
    color: var(--app-text);
}

.display-6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6,
h1,
h2,
h3,
h4,
h5,
h6 {
    color: #f8fafc;
    letter-spacing: -0.035em;
}

.lead {
    color: var(--app-muted);
}

.text-body-secondary,
.link-secondary {
    color: var(--app-muted) !important;
}

.btn {
    border-radius: 999px;
    font-weight: 650;
    padding-inline: 1rem;
}

.btn-primary {
    border-color: var(--app-primary);
    color: var(--app-primary-contrast);
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-strong));
    box-shadow: 0 12px 34px rgba(14, 165, 233, 0.28);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    border-color: #7dd3fc;
    color: var(--app-primary-contrast);
    background: linear-gradient(135deg, #7dd3fc, var(--app-primary));
}

.btn-outline-primary,
.btn-outline-secondary {
    border-color: var(--app-border);
    color: var(--app-text);
    background: rgba(15, 23, 42, 0.5);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-primary:focus-visible,
.btn-outline-secondary:focus-visible {
    border-color: rgba(125, 211, 252, 0.72);
    color: #f8fafc;
    background: rgba(56, 189, 248, 0.14);
}

.form-control {
    border-color: var(--app-border);
    border-radius: 0.9rem;
    color: var(--app-text);
    background-color: rgba(2, 6, 23, 0.34);
}

.form-control:focus {
    border-color: var(--app-primary);
    color: var(--app-text);
    background-color: rgba(2, 6, 23, 0.48);
    box-shadow: 0 0 0 0.22rem rgba(56, 189, 248, 0.16);
}

.alert {
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    box-shadow: 0 16px 48px rgba(2, 6, 23, 0.22);
}

.badge.text-bg-primary {
    color: var(--app-primary-contrast) !important;
    background: var(--app-primary) !important;
}

.app-footer {
    border-top: 1px solid var(--app-border);
    background: rgba(15, 23, 42, 0.48);
}

.app-hero h1 {
    font-weight: 800;
}

.app-page-header {
    margin-bottom: 1.5rem;
}

.app-page-kicker {
    margin-bottom: 0.75rem;
    color: var(--app-primary);
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.app-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem;
}

.app-action-card {
    display: block;
    min-height: 100%;
    padding: 1rem;
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    color: var(--app-text);
    text-decoration: none;
    background: rgba(15, 23, 42, 0.42);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.app-action-card:hover,
.app-action-card:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(125, 211, 252, 0.58);
    color: #f8fafc;
    background: rgba(56, 189, 248, 0.1);
}

.app-action-card small {
    display: block;
    margin-top: 0.35rem;
    color: var(--app-muted);
}

@media (max-width: 575.98px) {
    .card-body {
        padding: 1.35rem !important;
    }
}

.card-header,
.app-card-header {
    border-bottom: 1px solid var(--app-border);
    color: #f8fafc;
    font-weight: 700;
    letter-spacing: -0.015em;
    background: rgba(15, 23, 42, 0.46);
}

.card-header:first-child,
.app-card-header:first-child {
    border-radius: calc(var(--app-radius) - 1px) calc(var(--app-radius) - 1px) 0 0;
}

.app-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.app-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.app-section-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    color: #f8fafc;
    font-size: 0.92rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.app-section-title::before {
    width: 0.45rem;
    height: 0.45rem;
    content: "";
    border-radius: 999px;
    background: var(--app-primary);
    box-shadow: 0 0 0 0.24rem rgba(56, 189, 248, 0.11);
}

.app-metric-value {
    color: #f8fafc;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.06em;
    line-height: 1;
}

.app-definition-list dt {
    color: var(--app-muted);
    font-weight: 650;
}

.app-definition-list dd {
    color: var(--app-text);
}

.app-empty-state {
    padding: 1rem;
    color: var(--app-muted);
}

.app-record-group {
    padding: 1rem;
    border-bottom: 1px solid var(--app-border);
}

.app-record-group:last-child {
    border-bottom: 0;
}

.app-record-group-title {
    margin-bottom: 0.85rem;
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: 750;
}

.table.app-data-table {
    --bs-table-color: var(--app-text);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--app-border);
    --bs-table-hover-color: #f8fafc;
    --bs-table-hover-bg: rgba(56, 189, 248, 0.075);
    color: var(--app-text);
}

.app-data-table thead th {
    border-bottom-color: var(--app-border);
    color: var(--app-muted);
    font-size: 0.74rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(2, 6, 23, 0.24);
}

.app-data-table td,
.app-data-table th {
    vertical-align: middle;
}

.app-data-table code,
.app-code-value {
    display: inline-block;
    max-width: 100%;
    padding: 0.12rem 0.38rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 0.5rem;
    color: #bae6fd;
    background: rgba(2, 6, 23, 0.38);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.table-fixed-records {
    width: 100%;
    table-layout: fixed;
}

.table-fixed-records th:nth-child(1),
.table-fixed-records td:nth-child(1) {
    width: 140px;
}

.table-fixed-records th:nth-child(3),
.table-fixed-records td:nth-child(3) {
    width: 90px;
}

.table-fixed-records th:nth-child(4),
.table-fixed-records td:nth-child(4) {
    width: 170px;
}

.record-value-cell {
    max-width: 0;
}

.record-value-code {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.app-form-card {
    max-width: 760px;
}

.form-text {
    color: var(--app-muted);
}

.btn-outline-danger {
    border-color: rgba(248, 113, 113, 0.42);
    color: #fecaca;
    background: rgba(127, 29, 29, 0.16);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus-visible {
    border-color: rgba(248, 113, 113, 0.82);
    color: #fff;
    background: rgba(220, 38, 38, 0.34);
}

.btn-danger {
    border-color: rgba(248, 113, 113, 0.82);
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.app-danger-card {
    border-color: rgba(248, 113, 113, 0.44);
}

.app-danger-header {
    border-bottom-color: rgba(248, 113, 113, 0.38);
    color: #fee2e2;
    background: rgba(127, 29, 29, 0.46);
}

@media (max-width: 767.98px) {
    .app-toolbar {
        flex-direction: column;
    }

    .app-toolbar-actions {
        justify-content: flex-start;
    }
}

/* Customer area final UX */

.app-customer-hero {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 1rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.14), rgba(15, 23, 42, 0.72));
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(18px);
}

.app-customer-identity {
    min-width: min(100%, 16rem);
    padding: 1rem;
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    background: rgba(2, 6, 23, 0.24);
}

.app-metric-grid,
.app-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.app-metric-card .card-body,
.app-summary-card .card-body {
    min-height: 9rem;
}

.app-metric-label {
    margin-bottom: 0.75rem;
    color: var(--app-primary);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.app-status-list {
    display: grid;
    gap: 1rem;
}

.app-status-item {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.app-status-dot {
    flex: 0 0 auto;
    width: 0.7rem;
    height: 0.7rem;
    margin-top: 0.38rem;
    border-radius: 999px;
    background: var(--app-primary);
    box-shadow: 0 0 0 0.28rem rgba(56, 189, 248, 0.12);
}

.app-domain-link {
    color: #f8fafc;
}

.app-domain-link:hover,
.app-domain-link:focus-visible {
    color: #7dd3fc;
}

.app-domain-table th:first-child,
.app-domain-table td:first-child {
    min-width: 14rem;
}

.app-inline-alert {
    border-color: rgba(56, 189, 248, 0.28);
    color: #dbeafe;
    background: rgba(14, 165, 233, 0.12);
}

.app-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.app-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.38rem 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 999px;
    color: #bae6fd;
    background: rgba(2, 6, 23, 0.32);
    overflow-wrap: anywhere;
}

.app-table-actions {
    white-space: nowrap;
}

.app-table-actions .btn + .btn {
    margin-left: 0.25rem;
}

.app-form-grid {
    display: grid;
    gap: 1rem;
}

.app-form-check {
    padding: 0.9rem 0.9rem 0.9rem 2.55rem;
    border: 1px solid var(--app-border);
    border-radius: 0.9rem;
    background: rgba(2, 6, 23, 0.18);
}

.app-form-check .form-check-input {
    margin-left: -1.55rem;
}

.app-empty-state-lg {
    padding: 2rem;
    text-align: center;
}

.alert-danger {
    border-color: rgba(248, 113, 113, 0.36);
    color: #fee2e2;
    background: rgba(127, 29, 29, 0.32);
}

.record-value-cell {
    max-width: 34rem;
}

.record-value-code {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 991.98px) {
    .app-customer-hero {
        flex-direction: column;
    }

    .app-metric-grid,
    .app-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .app-metric-grid,
    .app-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .app-table-actions {
        white-space: normal;
    }

    .app-table-actions .btn {
        margin-bottom: 0.25rem;
    }
}

.app-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--bs-body-bg);
}

.app-subnav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.85rem;
    border-radius: var(--bs-border-radius);
    color: var(--bs-body-color);
    text-decoration: none;
    border: 1px solid transparent;
}

.app-subnav-link:hover {
    color: var(--bs-primary);
    border-color: var(--bs-primary-border-subtle);
    background: var(--bs-primary-bg-subtle);
}

.app-subnav-link.active {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}

/* --- Mobile: turn wide data tables into stacked, labelled cards ------------
   Below the md breakpoint each row becomes a card and every cell shows its
   column name (from the td's data-label) above the value, instead of a
   cramped horizontally scrolling table. Cells without a data-label (e.g. the
   actions column) render without a label. */
@media (max-width: 767.98px) {
    .app-data-table thead {
        display: none;
    }

    .app-data-table,
    .app-data-table tbody,
    .app-data-table tr,
    .app-data-table td {
        display: block;
        width: 100%;
    }

    .app-data-table tr {
        margin-bottom: 0.85rem;
        padding: 0.5rem 1rem 0.75rem;
        border: 1px solid var(--app-border);
        border-radius: 1rem;
        background: rgba(2, 6, 23, 0.2);
    }

    .app-data-table tr:last-child {
        margin-bottom: 0;
    }

    .app-data-table td {
        padding: 0.4rem 0;
        border: 0;
        box-shadow: none;
        text-align: left;
    }

    .app-data-table td + td {
        border-top: 1px solid rgba(148, 163, 184, 0.12);
    }

    .app-data-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.15rem;
        color: var(--app-muted);
        font-size: 0.72rem;
        font-weight: 750;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .app-data-table td.app-table-actions {
        text-align: left;
    }

    /* Fixed-layout record tables: drop the rigid column widths when stacked. */
    .table-fixed-records {
        table-layout: auto;
    }

    .table-fixed-records th,
    .table-fixed-records td,
    .record-value-cell {
        width: auto;
        max-width: none;
    }
}
