:root {
    --brand-bg: #f7f9fb;
    --brand-surface: #ffffff;
    --brand-text: #1f2937;
    --brand-muted: #6b7280;
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-200: #bfdbfe;
    --accent: #2563eb; /* primary blue */
    --accent-700: #1d4ed8;
    --accent-800: #1e40af;
    --accent-soft: #e8f0ff;
    --border: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--brand-bg);
    color: var(--brand-text);
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--brand-100);
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

    .sidebar .logo {
        font-weight: 700;
        font-size: 1.5rem;
        margin-bottom: 2rem;
        color: var(--accent-800);
    }

    .sidebar nav a {
        display: block;
        padding: .4rem .5rem;
        margin-bottom: .4rem;
        color: var(--accent-800);
        text-decoration: none;
        border-radius: .5rem;
    }

        .sidebar nav a i {
            display: inline-block;
            width: 1.25rem;
            margin-right: .6rem;
            text-align: center;
        }

        .sidebar nav a:hover {
            background: var(--brand-50);
        }

.content {
    flex: 1;
    padding: 2rem;
}

/* header spacing */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 14px; /* mere luft ned til tabellen */
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    flex-wrap: wrap;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.detail-grid > div {
    display: grid;
    gap: .25rem;
    min-width: 0;
}

.detail-label {
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.datatable-toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
}

    .datatable-toolbar input[type="search"] {
        min-width: 260px;
        margin-top: 0;
    }

.template-datatable-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

    .template-datatable-card::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 110px;
        background: linear-gradient(110deg, #eef4ff 0%, #f8fbff 42%, rgba(255,255,255,0) 78%);
        pointer-events: none;
    }

.template-toolbar {
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.datatable-count {
    display: inline-flex;
    align-items: center;
    padding: .28rem .65rem;
    border-radius: 999px;
    border: 1px solid var(--brand-200);
    color: var(--accent-800);
    background: var(--accent-soft);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .01em;
}

.template-datatable-card .datatable-toolbar {
    background: rgba(255,255,255,.86);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .38rem .45rem;
    backdrop-filter: blur(3px);
}

    .template-datatable-card .datatable-toolbar .hint {
        margin: 0;
        font-weight: 600;
    }

    .template-datatable-card .datatable-toolbar input[type="search"] {
        border: none;
        padding: .4rem .5rem;
        min-width: 280px;
    }

        .template-datatable-card .datatable-toolbar input[type="search"]:focus {
            outline: none;
            box-shadow: none;
        }

.table-shell {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: auto;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04), 0 10px 24px rgba(15, 23, 42, .05);
}

.template-table {
    min-width: 920px;
    border-collapse: separate;
    border-spacing: 0;
}

    .template-table thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background: linear-gradient(180deg, #f5f9ff 0%, #edf3ff 100%);
        border-bottom: 1px solid #d8e4ff;
    }

    .template-table tbody tr {
        transition: transform .14s ease, background-color .14s ease;
    }

        .template-table tbody tr:hover {
            background: #f9fbff;
            transform: translateY(-1px);
        }

    .template-table td {
        vertical-align: middle;
        border-bottom: 1px solid #edf2f8;
    }

        .template-table td:last-child {
            text-align: right;
        }

    .template-table tbody tr:last-child td {
        border-bottom: none;
    }

.template-id {
    display: inline-block;
    max-width: 310px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .84rem;
    color: #344054;
    background: #f5f7fb;
    border: 1px solid #e5eaf2;
    border-radius: 8px;
    padding: .2rem .42rem;
}

.domain-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .55rem;
    border-radius: 999px;
    border: 1px solid #cfe1ff;
    background: #edf4ff;
    color: #1e429f;
    font-weight: 600;
    font-size: .85rem;
    white-space: nowrap;
}

    .domain-pill.legacy {
        border-color: #e3e7ee;
        background: #f7f8fb;
        color: #667085;
    }

.row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: .32rem .62rem;
    border-radius: 999px;
    border: 1px solid #d6ddf3;
    color: #1d4ed8;
    font-weight: 700;
    text-decoration: none;
    background: #f8faff;
    transition: background-color .14s ease, border-color .14s ease, transform .14s ease;
}

    .row-action:hover {
        background: #edf3ff;
        border-color: #c5d5ff;
        transform: translateY(-1px);
    }

    .row-action:focus-visible {
        outline: 2px solid #bfd3ff;
        outline-offset: 1px;
    }


.card {
    background: var(--brand-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    padding: 1.2rem;
    margin-bottom: 1.2rem;
}

h1, h2 {
    color: var(--accent-800);
    margin: .2rem 0 .8rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: .55rem .7rem;
    margin-top: .25rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 1rem;
    background: #fff;
}

    input:focus,
    select:focus,
    textarea:focus {
        outline: 3px solid var(--brand-100);
        border-color: var(--accent);
    }

/* buttons & links */
.btn,
button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: .6rem 1.05rem;
    border-radius: .6rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

    .btn:hover,
    button:hover {
        background: var(--accent-700);
    }

    .btn:active,
    button:active {
        background: var(--accent-800);
    }

    .btn.secondary {
        background: var(--brand-100);
        color: var(--accent-800);
        border: 1px solid var(--brand-200);
    }

        .btn.secondary:hover {
            background: var(--brand-50);
        }

.btn {
    padding: .55rem .9rem;
    border-radius: .6rem;
    font-weight: 600;
}

/* tables */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

    .table th, .table td {
        padding: .6rem .7rem;
        border-bottom: 1px solid var(--border);
        text-align: left;
    }

    .table thead th {
        background: var(--brand-50);
        color: var(--brand-muted);
        font-weight: 600;
    }

.table-sort {
    background: #f8faff;
    color: #1f3f93;
    border: 1px solid #d5def4;
    padding: .38rem .62rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: .9rem;
    line-height: 1;
    font-weight: 600;
    transition: background-color .14s ease, border-color .14s ease, transform .14s ease;
}

    .table-sort::after {
        content: "sort";
        margin-left: .42rem;
        font-size: .7rem;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: #6b7280;
    }

    .table-sort.is-active[data-dir="asc"]::after {
        content: "asc";
        color: #1d4ed8;
    }

    .table-sort.is-active[data-dir="desc"]::after {
        content: "desc";
        color: #1d4ed8;
    }

    .table-sort.is-active {
        border-color: #b8cbff;
        background: #eef4ff;
        color: #1e429f;
    }

    .table-sort:hover {
        background: #eef3ff;
        border-color: #c2d2ff;
        transform: translateY(-1px);
    }

    .table-sort:focus-visible {
        outline: 2px solid #bfd3ff;
        outline-offset: 1px;
    }

    .table tbody tr:hover {
        background: #fafcff;
    }


    .table thead th:first-child {
        border-top-left-radius: 8px;
    }

    .table thead th:last-child {
        border-top-right-radius: 8px;
    }

    .table tbody tr:hover {
        background: #fafcff;
    }

.text-right {
    text-align: right;
}

.nowrap {
    white-space: nowrap;
}

/* form layout */
.form {
    display: grid;
    gap: 12px;
}

.row-2 {
    display: grid;
    grid-template-columns: 1.6fr 0.6fr;
    gap: 12px;
}

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--brand-text);
}

.field input {
    width: 100%;
}

.hint {
    color: var(--brand-muted);
    font-size: .92rem;
    margin-top: 4px;
}

/* kill blue autofill background (Edge/Chrome) */
input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    -webkit-text-fill-color: inherit !important;
}

.option-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 .4rem
}

.icon {
    width: 42px;
    height: 42px;
    color: var(--accent-800);
    flex-shrink: 0
}

.icon-m365 {
    color: #d83b01;
}

.alert {
    padding: .6rem .8rem;
    border-radius: .6rem;
    margin: 0 0 .8rem;
    border: 1px solid var(--border)
}

.alert-success {
    background: var(--brand-50);
    border-color: var(--brand-200)
}

.alert-error {
    background: #ffeceb;
    border-color: #fca5a5;
    color: #7f1d1d
}


.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px
}

    .field .hint {
        margin-top: 2px
    }

.span-2 {
    grid-column: 1/-1
}

.row-end {
    grid-column: 1/-1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: .25rem
}

.muted {
    color: #667085
}

.enterprise-page {
    max-width: 1280px;
    margin: 0 auto;
}

.enterprise-titlebar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

    .enterprise-titlebar h1 {
        margin: .15rem 0 0;
        color: #102033;
        font-size: 2rem;
        line-height: 1.15;
    }

.breadcrumb-line {
    color: #64748b;
    font-size: .9rem;
    font-weight: 700;
}

.enterprise-form {
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #dfe6ef;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
}

.enterprise-form-section {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1.35rem 1.4rem;
    border-bottom: 1px solid #eef2f7;
}

.section-heading {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
}

    .section-heading h2 {
        margin: 0;
        color: #102033;
        font-size: .98rem;
        line-height: 1.25;
    }

    .section-heading p {
        margin: .16rem 0 0;
        color: #64748b;
        font-size: .88rem;
        font-weight: 600;
    }

.section-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    color: #047857;
    font-size: .78rem;
    font-weight: 800;
    flex: 0 0 auto;
}

.form-field-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}

.form-stack {
    display: grid;
    gap: 1rem;
}

.enterprise-form .field label,
.enterprise-form .field-label {
    color: #334155;
    display: block;
    font-size: .88rem;
    font-weight: 750;
    margin-bottom: 4px;
}

.enterprise-form input[type="text"],
.enterprise-form input[type="email"],
.enterprise-form input[type="password"],
.enterprise-form select,
.enterprise-form textarea {
    min-height: 44px;
    margin-top: 0;
    border-color: #d8e0eb;
    border-radius: 8px;
    background: #fbfdff;
    color: #102033;
    box-shadow: inset 0 1px 1px rgba(15, 23, 42, .03);
}

    .enterprise-form input::placeholder {
        color: #94a3b8;
    }

    .enterprise-form input:focus,
    .enterprise-form select:focus,
    .enterprise-form textarea:focus {
        outline: 4px solid #dbeafe;
        border-color: #2563eb;
        background: #fff;
    }

.permission-matrix {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.permission-toggle {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .75rem;
    min-height: 74px;
    padding: .8rem;
    border: 1px solid #dfe6ef;
    border-radius: 8px;
    background: #fbfdff;
    cursor: pointer;
    transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

    .permission-toggle:hover {
        border-color: #bfd3ff;
        background: #f8fbff;
        transform: translateY(-1px);
    }

    .permission-toggle input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .permission-toggle input:checked + .toggle-visual {
        background: #2563eb;
        border-color: #2563eb;
    }

        .permission-toggle input:checked + .toggle-visual::after {
            transform: translateX(18px);
            background: #fff;
        }

    .permission-toggle input:checked ~ .permission-copy strong {
        color: #123b7a;
    }

    .permission-toggle:has(input:checked) {
        border-color: #b8cbff;
        background: #f5f9ff;
        box-shadow: 0 8px 22px rgba(37, 99, 235, .08);
    }

    .permission-toggle input:focus-visible + .toggle-visual {
        outline: 3px solid #bfdbfe;
        outline-offset: 2px;
    }

.toggle-visual {
    position: relative;
    width: 42px;
    height: 24px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #e2e8f0;
    transition: background-color .14s ease, border-color .14s ease;
}

    .toggle-visual::after {
        content: "";
        position: absolute;
        top: 3px;
        left: 3px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, .22);
        transition: transform .14s ease, background-color .14s ease;
    }

.permission-copy {
    display: grid;
    gap: .16rem;
    min-width: 0;
}

    .permission-copy strong {
        color: #1e293b;
        font-size: .94rem;
        line-height: 1.2;
    }

    .permission-copy small {
        color: #64748b;
        font-size: .82rem;
        font-weight: 600;
        line-height: 1.25;
    }

.invitation-section {
    background: #fcfdfa;
}

.invitation-panel {
    display: flex;
    align-items: center;
    gap: .9rem;
    min-height: 72px;
    padding: .9rem 1rem;
    border: 1px solid #d9f99d;
    border-radius: 8px;
    background: #f7fee7;
}

.invitation-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #102033;
    color: #ffffff;
    font-weight: 900;
    flex: 0 0 auto;
}

.invitation-panel strong,
.invitation-panel span {
    display: block;
}

.invitation-panel strong {
    color: #102033;
    font-size: .96rem;
}

.invitation-panel span {
    margin-top: .12rem;
    color: #475569;
    font-size: .9rem;
    font-weight: 600;
}

.enterprise-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .65rem;
    padding: 1rem 1.4rem;
    background: #f8fafc;
}

    .enterprise-actions .btn,
    .enterprise-actions button,
    .enterprise-titlebar .btn {
        border-radius: 8px;
    }

.user-form-note,
.configuration-placeholder-help {
    padding: .75rem .9rem;
    border: 1px solid #d8e4ff;
    border-radius: 8px;
    background: #f5f9ff;
    color: #1f3f93;
    font-weight: 600;
}

.user-permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .7rem;
    padding: .85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcff;
}

    .user-permission-grid label {
        display: flex;
        align-items: center;
        gap: .55rem;
        margin: 0;
        padding: .45rem .55rem;
        border-radius: 8px;
        background: #fff;
        border: 1px solid #edf2f8;
        font-weight: 600;
    }

.domain-transfer-field {
    gap: .75rem;
}

.domain-transfer-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.domain-transfer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.domain-bucket {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcff;
    min-height: 240px;
    overflow: hidden;
}

.domain-bucket-title {
    padding: .65rem .8rem;
    border-bottom: 1px solid var(--border);
    color: #344054;
    font-weight: 700;
    background: #f5f7fb;
}

.domain-list {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    min-height: 190px;
    padding: .7rem;
}

.domain-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .7rem;
    width: 100%;
    padding: .55rem .65rem;
    border: 1px solid #d6ddf3;
    border-radius: 8px;
    background: #fff;
    color: #1f2937;
    font-weight: 600;
    text-align: left;
    cursor: grab;
}

    .domain-chip:hover {
        background: #f5f9ff;
        border-color: #bfd3ff;
    }

    .domain-chip.assigned {
        border-color: #b8cbff;
        background: #edf4ff;
        color: #1e429f;
    }

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1rem;
}

.auth-card {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
    padding: 2rem;
}

.auth-logo {
    display: block;
    max-width: 150px;
    margin: 0 auto 1.25rem;
}

.auth-link {
    color: var(--accent-800);
    font-weight: 600;
    text-decoration: none;
}

    .auth-link:hover {
        text-decoration: underline;
    }

.json-preview {
    margin: .4rem 0 0;
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    white-space: pre-wrap;
    font-family: Consolas, 'Courier New', monospace;
    font-size: .9rem;
}

.field label.tracking-toggle,
label.tracking-toggle {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, max-content) 44px;
    align-items: center;
    column-gap: 30px;
    min-height: 0;
    margin: 0;
    padding: .7rem 1rem;
    border: 1px solid #cbd7ee;
    border-radius: 8px;
    background: #f8fbff;
    cursor: pointer;
    overflow: hidden;
}

    .tracking-toggle input[type="checkbox"] {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        border: 0;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        opacity: 0;
        overflow: hidden;
        pointer-events: none;
    }

.tracking-toggle-visual {
    position: relative;
    display: block;
    grid-column: 2;
    grid-row: 1;
    width: 44px;
    height: 24px;
    border: 1px solid #8ea3c3;
    border-radius: 999px;
    background: #d6e0ee;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .18);
    transition: background-color .14s ease, border-color .14s ease;
}

    .tracking-toggle-visual::after {
        content: "";
        position: absolute;
        top: 3px;
        left: 3px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #ffffff;
        box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
        transition: transform .14s ease;
    }

.tracking-toggle input[type="checkbox"]:checked ~ .tracking-toggle-visual {
    border-color: var(--primary);
    background: var(--primary);
}

    .tracking-toggle input[type="checkbox"]:checked ~ .tracking-toggle-visual::after {
        transform: translateX(20px);
    }

.tracking-toggle input[type="checkbox"]:focus-visible ~ .tracking-toggle-visual {
    outline: 3px solid #bfd3ff;
    outline-offset: 2px;
}

.tracking-toggle-copy {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    gap: .15rem;
    min-width: 0;
}

    .tracking-toggle-copy strong {
        color: var(--text-strong);
        font-size: .94rem;
        line-height: 1.2;
    }

    .tracking-toggle-copy small {
        color: var(--text-muted);
        font-size: .84rem;
        font-weight: 600;
        line-height: 1.25;
    }

.tracking-toggle.compact {
    grid-template-columns: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}

    .tracking-toggle.compact .tracking-toggle-visual {
        grid-column: 1;
    }

.compact-toggle-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .8rem;
    min-height: 44px;
    padding: .25rem 0 0;
}

    .compact-toggle-row > span {
        display: grid;
        gap: .15rem;
        min-width: 0;
    }

    .compact-toggle-row strong {
        color: var(--text-strong);
        font-size: .94rem;
        line-height: 1.2;
    }

    .compact-toggle-row small {
        color: var(--text-muted);
        font-size: .84rem;
        font-weight: 600;
        line-height: 1.25;
    }

.bulk-send-form {
    margin-bottom: 1.2rem;
}

.bulk-send-form .alert {
    margin: 1rem 1.4rem 0;
}

.bulk-send-options {
    align-items: start;
}

.step-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding-top: .15rem;
}

.bulk-send-options .step-actions {
    justify-content: flex-end;
    align-self: end;
}

.bulk-send-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
    padding: 1rem 1.4rem;
    background: #fbfdff;
}

.validation-summary-valid {
    display: none;
}

@media (max-width: 980px) {
    .enterprise-form-section {
        grid-template-columns: 1fr;
        gap: .9rem;
    }

    .permission-matrix {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .template-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .template-datatable-card .datatable-toolbar {
        width: 100%;
    }

        .template-datatable-card .datatable-toolbar input[type="search"] {
            width: 100%;
            min-width: 0;
        }
}

@media (max-width: 760px) {
    .enterprise-titlebar {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-field-grid,
    .permission-matrix {
        grid-template-columns: 1fr;
    }

    .enterprise-form-section,
    .enterprise-actions {
        padding: 1rem;
    }

    .enterprise-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

        .enterprise-actions .btn,
        .enterprise-actions button {
            width: 100%;
            text-align: center;
        }

    .domain-transfer {
        grid-template-columns: 1fr;
    }

    .table-shell {
        border: none;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
        background: transparent;
    }

    .template-table {
        min-width: 0;
    }

        .template-table thead {
            display: none;
        }

        .template-table,
        .template-table tbody,
        .template-table tr,
        .template-table td {
            display: block;
            width: 100%;
        }

            .template-table tbody tr {
                margin-bottom: .7rem;
                padding: .45rem .6rem;
                background: #fff;
                border: 1px solid #e7edf9;
                border-radius: 12px;
                box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
                transform: none;
            }

            .template-table td {
                border: none;
                padding: .35rem 0;
                text-align: left;
            }

                .template-table td::before {
                    content: attr(data-label);
                    display: block;
                    margin-bottom: .15rem;
                    color: #667085;
                    font-size: .74rem;
                    font-weight: 700;
                    text-transform: uppercase;
                    letter-spacing: .04em;
                }

                .template-table td:last-child {
                    text-align: left;
                    margin-top: .25rem;
                }
}

/* 2026 enterprise UI baseline */
:root {
    --app-bg: #f6f8fb;
    --surface: #ffffff;
    --text-strong: #102033;
    --text-body: #243244;
    --text-muted: #667085;
    --line: #dde5ef;
    --line-soft: #edf1f6;
    --primary: #255ee8;
    --primary-hover: #1f4fc4;
    --primary-soft: #eef4ff;
    --success: #087443;
    --success-soft: #ecfdf3;
    --warning: #a15c07;
    --warning-soft: #fffaeb;
}

body {
    background: var(--app-bg);
    color: var(--text-body);
    font-size: 15px;
}

.sidebar {
    width: 232px;
    background: #dbeafe;
    border-right: 1px solid #c7d8ee;
    padding: 1.25rem 1rem;
}

    .sidebar .logo {
        margin-bottom: 2.25rem;
    }

        .sidebar .logo img {
            max-height: 104px !important;
        }

    .sidebar nav {
        display: grid;
        gap: .18rem;
    }

    .sidebar nav .nav-divider {
        min-height: 1px;
        margin: .62rem .55rem;
        border-top: 1px solid #b7cae4;
    }

    .sidebar nav a {
        position: relative;
        display: flex;
        align-items: center;
        gap: 0;
        min-height: 36px;
        margin: 0;
        padding: .5rem .68rem;
        border-radius: 8px;
        color: #123b7a;
        font-size: .95rem;
        font-weight: 650;
        line-height: 1.1;
    }

        .sidebar nav a i {
            display: inline-block;
            flex: 0 0 1.1rem;
            width: 1.1rem;
            margin-right: .65rem;
            text-align: center;
            color: inherit;
        }

        .sidebar nav a:hover {
            background: rgba(255,255,255,.48);
            color: #0f2e63;
        }

        .sidebar nav a.active {
            background: #ffffff;
            color: #0b2b63;
            box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
        }

.content {
    padding: 2rem;
}

h1, h2 {
    color: var(--text-strong);
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}

    .page-heading h1 {
        margin: 0;
        color: var(--text-strong);
        font-size: 1.75rem;
        line-height: 1.15;
    }

    .page-heading p {
        margin: .28rem 0 0;
        color: var(--text-muted);
        font-size: .94rem;
        font-weight: 600;
    }

.card,
.data-card,
.enterprise-form {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.card {
    padding: 1rem;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: .42rem .82rem;
    border-radius: 8px;
    background: var(--primary);
    font-size: .92rem;
    font-weight: 750;
    line-height: 1.1;
    vertical-align: middle;
}

    .btn:hover,
    button:hover {
        background: var(--primary-hover);
    }

    .btn.secondary {
        background: #f8fafc;
        color: #1d4ed8;
        border: 1px solid #cbd7ee;
    }

        .btn.secondary:hover {
            background: #eef4ff;
        }

.data-card {
    overflow: hidden;
    border-radius: 4px;
    box-shadow: none;
}

.data-card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .82rem 1rem;
    border-bottom: 1px solid #cfd7e2;
    background: #ffffff;
}

.data-card-title {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
}

    .data-card-title h2 {
        margin: 0;
        color: var(--text-strong);
        font-size: 1rem;
        line-height: 1.2;
    }

    .data-card-title span {
        color: var(--text-muted);
        font-size: .82rem;
        font-weight: 700;
        white-space: nowrap;
    }

.data-search {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-width: min(360px, 42vw);
    margin: 0;
    padding: .2rem .36rem .2rem .55rem;
    border: 1px solid #cfd7e2;
    border-radius: 4px;
    background: #ffffff;
}

    .data-search span {
        color: #475467;
        font-size: .86rem;
        font-weight: 750;
    }

    .data-search input[type="search"] {
        min-width: 0;
        width: 100%;
        margin: 0;
        padding: .36rem .4rem;
        border: 0;
        border-radius: 6px;
        background: transparent;
        font-size: .92rem;
    }

        .data-search input[type="search"]:focus {
            outline: none;
            box-shadow: none;
        }

.table-shell {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.data-table {
    min-width: 920px;
}

    .data-table th,
    .data-table td {
        padding: .56rem .8rem;
        border-bottom: 1px solid #dfe5ec;
        vertical-align: middle;
    }

    .data-table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: #eef2f6;
        color: #2f3d4f;
        font-size: .78rem;
        font-weight: 800;
        letter-spacing: .02em;
        text-transform: uppercase;
        border-bottom: 1px solid #c7d0dc;
    }

    .data-table tbody tr:hover {
        background: #f7f9fc;
    }

    .data-table tbody tr:last-child td {
        border-bottom: 0;
    }

.card .table {
    border: 1px solid #d7dee8;
    border-radius: 4px;
    overflow: hidden;
}

    .card .table th,
    .card .table td {
        padding: .56rem .8rem;
        border-bottom: 1px solid #dfe5ec;
        vertical-align: middle;
    }

    .card .table thead th {
        background: #eef2f6;
        color: #2f3d4f;
        font-size: .78rem;
        font-weight: 800;
        letter-spacing: .02em;
        text-transform: uppercase;
        border-bottom: 1px solid #c7d0dc;
    }

    .card .table tbody tr:hover {
        background: #f7f9fc;
    }

.table-sort {
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: .8rem;
    font-weight: 800;
    text-align: left;
}

    .table-sort:hover {
        background: transparent;
        color: var(--primary);
        transform: none;
    }

    .table-sort::after {
        content: "";
        display: inline-block;
        width: .42rem;
        height: .42rem;
        margin-left: .38rem;
        border-right: 1.5px solid currentColor;
        border-bottom: 1.5px solid currentColor;
        opacity: .35;
        transform: rotate(45deg) translateY(-2px);
    }

    .table-sort.is-active {
        background: transparent;
        border: 0;
        color: var(--primary);
    }

    .table-sort.is-active[data-dir="asc"]::after {
        content: "";
        opacity: 1;
        transform: rotate(225deg) translateY(-1px);
    }

    .table-sort.is-active[data-dir="desc"]::after {
        content: "";
        opacity: 1;
        transform: rotate(45deg) translateY(-2px);
    }

.action-cell {
    width: 1%;
    text-align: right !important;
    white-space: nowrap;
}

.row-action {
    min-width: 0;
    padding: .3rem .56rem;
    border-radius: 4px;
    border-color: #b9c5d6;
    background: #fff;
    color: #1746a2;
    font-size: .88rem;
    font-weight: 750;
}

    .row-action:hover {
        background: #eef4ff;
        transform: none;
    }

.table-id {
    display: inline-block;
    max-width: 160px;
    overflow: hidden;
    padding: .08rem .28rem;
    border: 1px solid #d7dee8;
    border-radius: 3px;
    background: #ffffff;
    color: #344054;
    font-size: .78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-id-full {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
}

.status-pill,
.domain-pill,
.badge {
    display: inline;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #344054;
    font-size: .86rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-success {
    color: #047857;
}

.status-warning,
.badge-warn {
    color: #b45309;
}

.status-muted,
.status-neutral,
.badge-muted {
    color: #475467;
}

.badge-success {
    color: #047857;
}

.empty-state {
    margin: 1rem;
    border: 1px dashed #cbd7ee;
    border-radius: 8px;
    background: #fbfdff;
    color: var(--text-muted);
    padding: .9rem;
    text-align: center;
    font-weight: 650;
}

.empty-state.compact {
    margin-top: .75rem;
}

.enterprise-titlebar h1 {
    color: var(--text-strong);
    font-size: 1.75rem;
}

.enterprise-form {
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.enterprise-form-section {
    padding: 1.05rem 1.1rem;
}

.enterprise-actions {
    padding: .85rem 1.1rem;
}

@media (max-width: 760px) {
    .page-heading,
    .data-card-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .data-search {
        min-width: 0;
        width: 100%;
    }

    .data-table {
        min-width: 0;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tbody tr {
        padding: .65rem .8rem;
        border-bottom: 1px solid var(--line-soft);
    }

    .data-table td {
        display: grid;
        grid-template-columns: 120px minmax(0, 1fr);
        gap: .75rem;
        padding: .28rem 0;
        border: 0;
    }

    .data-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: .78rem;
        font-weight: 800;
    }

    .action-cell {
        text-align: left !important;
    }
}
