/* TaxProfile owns this composition; controls and tenant colors use theme tokens. */
.taxprofile-page {
    min-width: 0;
}

.taxprofile-editor {
    max-width: 1040px;
}

.taxprofile-create {
    max-width: 800px;
}

.taxprofile-page .card {
    border: 1px solid var(--mkp-border);
    border-radius: var(--mkp-radius-lg);
    background: var(--mkp-surface);
    box-shadow: var(--mkp-shadow);
}

.taxprofile-section {
    margin-bottom: 24px;
}

.taxprofile-section .card-body,
.taxprofile-search {
    padding: 24px;
}

.taxprofile-section-heading {
    margin-bottom: 20px;
}

.taxprofile-section-heading h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
}

.taxprofile-section-heading p,
.taxprofile-empty p {
    margin: 4px 0 0;
    color: var(--mkp-muted-foreground);
    font-size: 14px;
    line-height: 22px;
}

.taxprofile-fields {
    display: grid;
    grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
    gap: 20px;
}

.taxprofile-rate-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px auto;
    align-items: end;
    gap: 16px;
}

.taxprofile-rate-fields .btn {
    min-height: var(--mkp-control-height);
}

.taxprofile-next-step {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--mkp-border);
    color: var(--mkp-muted-foreground);
}

.taxprofile-next-step p {
    margin: 0;
}

.taxprofile-search .admin-search {
    width: min(100%, 380px);
}

/* Keep search close to the rows without changing its submit/filter hooks. */
.taxprofile-search {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 16px 20px;
}

.taxprofile-search .form-label {
    margin: 0;
}

.taxprofile-list .k-grid-table {
    table-layout: fixed;
}

.taxprofile-page .k-grid :is(.k-grid-header-table, .k-grid-table) > colgroup > col:not([style*="width"]) {
    width: auto;
}

.taxprofile-page .k-grid :is(.k-grid-header-table, .k-grid-table) > thead > tr > th {
    color: var(--mkp-foreground);
    font-size: 14px;
    font-weight: 500;
    background: var(--mkp-muted);
    height: 40px;
    padding-block: 0;
}

.taxprofile-page .k-grid tbody .btn .fa {
    font-size: 14px;
}

.taxprofile-list .k-grid .btn-group {
    gap: 6px;
}

.taxprofile-list .k-grid-norecords,
.taxprofile-list .k-grid-norecords-template {
    width: 100%;
    max-width: none;
}

/* The unpaged country list belongs to the page scroll, not a second viewport. */
.taxprofile-country-grid .k-grid.mkp-grid-bounded > .k-grid-container > .k-grid-content,
.taxprofile-country-grid .k-grid.mkp-grid-bounded > .k-grid-content {
    max-height: none;
    overflow-y: auto;
}

.taxprofile-country-grid .k-grid .k-grid-table > tbody > tr > td {
    padding-block: 3px;
}

/* Preserve the two sections, but keep existing rates near the profile fields. */
.taxprofile-editor:not(.taxprofile-create) .taxprofile-section {
    margin-bottom: 16px;
}

.taxprofile-editor:not(.taxprofile-create) .taxprofile-section .card-body {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
}

.taxprofile-editor:not(.taxprofile-create) .taxprofile-section-heading {
    margin: 0;
}

.taxprofile-list > .k-grid,
.taxprofile-country-grid > .k-grid {
    border-inline: 0;
    border-bottom: 0;
    border-radius: 0 0 var(--mkp-radius-lg) var(--mkp-radius-lg);
}

.taxprofile-country-grid td:nth-child(3),
.taxprofile-country-grid th:nth-child(3) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.taxprofile-empty {
    width: 100%;
    padding: 36px 20px;
    text-align: center;
    white-space: normal;
}

.taxprofile-empty > i {
    display: block;
    margin-bottom: 12px;
    color: var(--mkp-muted-foreground);
    font-size: 24px;
}

.taxprofile-empty strong {
    font-weight: 600;
    color: var(--mkp-foreground);
}

@media (max-width: 640px) {
    .taxprofile-editor:not(.taxprofile-create) .taxprofile-section .card-body {
        grid-template-columns: minmax(0, 1fr);
        padding: 16px;
    }

    .taxprofile-section .card-body,
    .taxprofile-search {
        padding: 20px 16px;
    }

    .taxprofile-fields,
    .taxprofile-rate-fields {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .taxprofile-next-step {
        padding: 16px;
    }
}
