:root {
    --ink: #18283c;
    --muted: #758194;
    --line: #e6ebf1;
    --teal: #087f74;
    --nav: #11283b;
    --bg: #f5f7fa
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font: 14px/1.55 'Segoe UI', Arial, sans-serif;
    color: var(--ink);
    background: var(--bg)
}

[hidden] {
    display: none !important
}

button,
input,
select,
textarea {
    font: inherit
}

button,
a,
input,
select,
textarea {
    outline-offset: 4px
}

button {
    cursor: pointer
}

button:disabled {
    cursor: not-allowed;
    opacity: .5
}

a {
    color: var(--teal);
    text-decoration: none
}

h1,
h2,
h3,
p {
    margin-top: 0
}

h1 {
    font-size: 32px;
    letter-spacing: -1px;
    line-height: 1.2;
    margin-bottom: 10px
}

h2 {
    font-size: 17px;
    letter-spacing: -.3px;
    margin-bottom: 5px
}

h3 {
    font-size: 17px
}

.muted {
    color: var(--muted)
}

.small,
small {
    font-size: 12px
}

.eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.9px;
    color: var(--teal);
    display: block;
    margin-bottom: 12px
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 2px
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 37px;
    height: 39px;
    background: #23b6a0;
    border-radius: 10px;
    color: #102b3a;
    font-size: 26px;
    letter-spacing: -2px
}

.brand-sub {
    display: block;
    font-size: 8px;
    letter-spacing: 1.8px;
    font-weight: 500;
    opacity: .6
}

.primary,
.secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 8px;
    padding: 11px 18px;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid transparent
}

.primary {
    background: var(--teal);
    color: white;
    box-shadow: 0 3px 5px #087f7410
}

.primary:hover {
    background: #076b63
}

.secondary {
    border-color: #dfe5ed;
    color: #40536a;
    background: white
}

.secondary:hover {
    background: #f0f5f8
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--teal);
    font-size: 12px;
    padding: 8px
}

.icon-button {
    background: transparent;
    border: 0;
    color: inherit;
    padding: 8px;
    font-size: 22px;
    line-height: 1
}

.full {
    width: 100%
}

input,
textarea {
    padding: 11px 13px;
    border: 1px solid #d9e0e9;
    border-radius: 7px;
    background: white;
    color: var(--ink);
    width: 100%
}

input:focus,
textarea:focus {
    border-color: var(--teal);
    outline: 2px solid #087f7415
}

label {
    display: block;
    margin: 18px 0 7px;
    font-weight: 600;
    font-size: 12px
}

textarea {
    min-height: 100px
}

.form-error {
    color: #b43440;
    background: #fff1f2;
    border: 1px solid #f5d4d9;
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
    white-space: pre-line
}

.secure-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #31b49a;
    margin-right: 7px
}

.login-page {
    display: flex;
    min-height: 100vh
}

.login-story {
    width: 54%;
    background: radial-gradient(ellipse at 20% 90%, #19655f 0, transparent 55%), linear-gradient(135deg, #102438, #142f42);
    color: white;
    padding: 48px 7%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden
}

.login-story:after {
    content: '';
    position: absolute;
    width: 450px;
    height: 450px;
    border: 1px solid #ffffff0c;
    border-radius: 50%;
    right: -200px;
    top: 10%;
    box-shadow: 0 0 0 70px #ffffff03, 0 0 0 140px #ffffff02;
    pointer-events: none
}

.story-copy {
    margin: auto 0;
    padding: 80px 0;
    position: relative;
    z-index: 1
}

.story-copy .eyebrow {
    color: #60cfb7
}

.story-copy h1 {
    font-size: 44px;
    line-height: 1.25;
    letter-spacing: -1.5px
}

.story-copy p {
    color: #acbdc8;
    max-width: 350px;
    font-size: 16px
}

.process-line {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 11px;
    margin-top: 40px;
    color: #a8c9ca
}

.process-line span {
    padding: 7px 11px;
    border: 1px solid #ffffff25;
    border-radius: 6px
}

.login-story footer {
    font-size: 11px;
    color: #a1b7bd;
    display: flex;
    justify-content: space-between;
    gap: 15px
}

.login-panel {
    width: 46%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    flex-direction: column;
    padding: 48px
}

.login-box {
    max-width: 360px;
    width: 100%;
    margin: auto
}

.login-box h2 {
    font-size: 29px;
    letter-spacing: -1px
}

.login-box>p {
    margin-bottom: 30px
}

.login-box form>.primary {
    margin-top: 25px;
    justify-content: space-between;
    padding: 13px 18px
}

.password-wrap {
    position: relative
}

.password-wrap input {
    padding-right: 60px
}

.password-wrap button {
    position: absolute;
    right: 7px;
    top: 5px
}

.login-help {
    border-top: 1px solid var(--line);
    padding-top: 25px;
    margin-top: 30px;
    font-size: 11px;
    color: var(--muted)
}

.login-box .small {
    margin-top: 10px
}

.login-foot {
    font-size: 10px;
    letter-spacing: .6px;
    color: #91a0b2;
    padding-top: 30px
}

.app-shell {
    display: flex;
    min-height: 100vh
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    background: var(--nav);
    color: #a8bbca;
    width: 248px;
    padding: 32px 22px;
    display: flex;
    flex-direction: column;
    z-index: 20
}

.workspace-label {
    font-size: 9px;
    letter-spacing: 1.6px;
    color: #688294;
    margin-top: 40px
}

.workspace-identity {
    display: flex;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid #ffffff12;
    padding: 16px 0 23px;
    margin-bottom: 24px
}

.workspace-identity strong {
    font-size: 12px;
    color: #e7eff6;
    display: block;
    max-width: 160px;
    overflow-wrap: anywhere
}

.workspace-identity small {
    font-size: 10px;
    color: #7893a6
}

.workspace-icon {
    background: #214257;
    color: #70c8b8;
    border: 1px solid #38596b;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 21px
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 7px
}

.nav-link {
    display: flex;
    gap: 13px;
    align-items: center;
    text-align: left;
    border: 0;
    background: transparent;
    color: #a0b6c7;
    border-radius: 7px;
    padding: 5px 14px;
    font-size: 14px
}

.nav-link span {
    font-size: 18px;
    width: 21px
}

.nav-link.active {
    background: #1b746b;
    color: white
}

.nav-link:hover {
    background: #ffffff0b
}

.nav-link.active:hover {
    background: #1b746b
}

.sidebar-bottom {
    margin-top: auto;
    font-size: 10px;
    color: #92adbb;
    padding-top: 35px
}

.sidebar-bottom small {
    display: block;
    color: #597a8e;
    font-size: 9px;
    margin-top: 7px
}

.main-shell {
    width: calc(100% - 248px);
    margin-left: 248px
}

.topbar {
    height: 80px;
    border-bottom: 1px solid var(--line);
    padding: 0 38px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px
}

.breadcrumb {
    font-size: 12px;
    color: #8490a0
}

.breadcrumb span {
    margin: 0 12px;
    color: #c1cbd7
}

.breadcrumb strong {
    color: #42526a;
    font-weight: 500
}

.topbar-right {
    display: flex;
    gap: 14px;
    align-items: center
}

.environment {
    background: #f5f7fa;
    border: 1px solid #e7ebf0;
    font-size: 10px;
    color: #7c8b9c;
    border-radius: 20px;
    padding: 4px 9px
}

.avatar {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #ddede8;
    color: #227265;
    font-size: 12px;
    font-weight: 700
}

.account strong {
    display: block;
    font-size: 11px;
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis
}

.account small {
    display: block;
    font-size: 9px;
    color: #8d9bae
}

#menu-toggle {
    display: none
}

#content {
    max-width: 1600px;
    margin: auto;
    padding: 38px
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px
}

.page-heading .muted {
    font-size: 13px;
    margin-bottom: 0
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 30px
}

.stat {
    background: white;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 22px;
    position: relative
}

.stat-icon {
    position: absolute;
    right: 18px;
    top: 21px;
    border-radius: 9px;
    background: #e9f4f1;
    color: #1d8a79;
    padding: 7px 11px;
    font-size: 17px
}

.stat:nth-child(2) .stat-icon {
    background: #edf1fc;
    color: #6377bc
}

.stat:nth-child(3) .stat-icon {
    background: #fdf4e5;
    color: #b28a47
}

.stat:nth-child(4) .stat-icon {
    background: #f2edfa;
    color: #9570b3
}

.stat p {
    font-size: 11px;
    color: #78879a;
    margin-bottom: 9px
}

.stat strong {
    font-size: 29px;
    letter-spacing: -1px
}

.stat small {
    display: block;
    color: #8b99aa;
    font-size: 10px;
    margin-top: 8px
}

.table-card {
    border: 1px solid var(--line);
    border-radius: 11px;
    background: white;
    overflow: hidden
}

.table-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 25px 20px;
    gap: 12px
}

.table-heading p {
    margin-bottom: 0
}

.count-badge {
    background: #f1f5f8;
    color: #758498;
    border-radius: 20px;
    font-size: 10px;
    padding: 5px 10px;
    white-space: nowrap
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 0 25px 22px
}

.search-wrap {
    position: relative;
    width: 290px
}

.search-wrap>span {
    position: absolute;
    left: 12px;
    top: 6px;
    color: #8e9bad;
    font-size: 23px
}

.search-wrap input {
    font-size: 12px;
    padding: 10px 12px 10px 36px;
    background: #fafbfd
}

.filters {
    display: flex;
    gap: 12px;
    align-items: center
}

.filters>div {
    min-width: 135px
}

.filters #tenant-filter-wrap {
    min-width: 190px
}

.filters .page-size-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 85px
}

.page-size-wrap label {
    margin: 0;
    color: #8b97a7;
    font-size: 11px;
    font-weight: 400
}

.page-size-wrap .select2-container {
    min-width: 60px
}

.table-scroll {
    overflow: auto
}

table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    font-size: 12px
}

th {
    background: #f8fafc;
    padding: 13px 25px;
    color: #8a97a8;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .6px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    white-space: nowrap
}

td {
    padding: 20px 25px;
    border-bottom: 1px solid #f0f3f6;
    color: #62748a;
    vertical-align: middle
}

td strong {
    font-size: 12px;
    color: #273a50;
    display: block;
    font-weight: 600
}

td small {
    display: block;
    color: #98a4b3;
    font-size: 10px
}

.tenant-cell {
    display: flex;
    align-items: center;
    gap: 12px
}

.tenant-logo {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 37px;
    height: 37px;
    border-radius: 9px;
    background: #ecf3f1;
    color: #448f80;
    font-weight: 700;
    font-size: 12px
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    border-radius: 20px;
    padding: 4px 9px;
    background: #e9f7ef;
    color: #338760;
    white-space: nowrap
}

.status:before {
    content: '';
    width: 5px;
    height: 5px;
    background: currentColor;
    border-radius: 50%
}

.status.inactive {
    background: #fff1ee;
    color: #ba6e59
}

.table-action {
    border: 1px solid #e6ecf1;
    background: white;
    color: #4c657a;
    padding: 5px 9px;
    border-radius: 5px;
    font-size: 11px;
    white-space: nowrap;
    margin-right: 5px
}

.table-action:hover {
    background: #edf7f3;
    color: var(--teal)
}

.pagination {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    align-items: center;
    padding: 18px 25px
}

.page-controls {
    display: flex;
    gap: 14px;
    align-items: center
}

.page-controls button {
    font-size: 11px;
    padding: 7px 12px
}

.empty-state {
    text-align: center;
    padding: 40px
}

.empty-state>span {
    font-size: 36px;
    color: #9cb3be
}

.empty-state p {
    font-size: 12px
}

.workspace-footnote {
    font-size: 10px;
    color: #9ba8b6;
    margin: 20px 0
}

.notice {
    padding: 14px 18px;
    background: #fff5de;
    color: #866326;
    border: 1px solid #f2e4c0;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 12px
}

dialog {
    border: 0;
    border-radius: 14px;
    padding: 0;
    width: min(650px, calc(100vw - 32px));
    max-height: 90vh;
    box-shadow: 0 25px 90px #10263840;
    color: var(--ink)
}

dialog::backdrop {
    background: #10263885;
    backdrop-filter: blur(3px)
}

dialog form {
    padding: 28px
}

.dialog-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line)
}

.dialog-heading .eyebrow {
    font-size: 9px;
    margin-bottom: 8px
}

.dialog-heading h2 {
    font-size: 23px
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--line)
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px
}

.form-grid .wide {
    grid-column: 1/-1
}

.section-label {
    font-weight: 700;
    font-size: 12px;
    margin-top: 25px;
    margin-bottom: 0;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line)
}

.help {
    font-size: 11px;
    color: #8b98a7;
    margin: 8px 0 0
}

.route-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    counter-reset: stage
}

.route-list li {
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    counter-increment: stage
}

.route-list li:before {
    content: counter(stage);
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e7f4ee;
    color: var(--teal);
    margin-right: 12px;
    font-size: 10px
}

.toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 100;
    background: #123f38;
    color: white;
    border-radius: 10px;
    padding: 15px 22px;
    box-shadow: 0 8px 30px #123f3820;
    max-width: calc(100vw - 50px)
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}

.select2-container {
    font-size: 12px;
    max-width: 100%
}

.select2-container--default .select2-selection--single {
    height: 40px;
    border-color: #d9e0e9;
    border-radius: 7px
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px;
    padding-left: 12px;
    padding-right: 30px
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px;
    right: 7px
}

.select2-dropdown {
    border-color: #d9e0e9;
    border-radius: 7px;
    overflow: hidden;
    font-size: 12px
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--teal)
}

.select2-search__field {
    border-radius: 5px
}

.select2-container--open {
    z-index: 1000
}

#data-table[aria-busy=true] {
    opacity: .5
}

@media(min-width:1500px) {
    #content {
        padding: 25px 25px
    }

    .story-copy h1 {
        font-size: 53px
    }
}

@media(max-width:1100px) {
    .sidebar {
        width: 215px;
        padding: 30px 15px
    }

    .main-shell {
        margin-left: 215px;
        width: calc(100% - 215px)
    }

    #content {
        padding: 25px
    }

    .topbar {
        padding: 0 25px
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .table-toolbar {
        flex-wrap: wrap
    }

    .account {
        display: none
    }

    .story-copy h1 {
        font-size: 36px
    }

    .login-story {
        padding: 40px
    }

    .login-story footer span {
        display: none
    }
}

@media(max-width:760px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 20px 0 70px #10263850
    }

    .main-shell {
        margin-left: 0;
        width: 100%
    }

    #menu-toggle {
        display: block
    }

    .topbar {
        height: 65px;
        padding: 0 16px
    }

    .breadcrumb {
        margin-right: auto
    }

    .environment,
    .avatar {
        display: none
    }

    .topbar-right {
        gap: 3px
    }

    #content {
        padding: 24px 16px
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column
    }

    h1 {
        font-size: 28px
    }

    .stats-grid {
        gap: 10px
    }

    .stat {
        padding: 17px
    }

    .stat-icon {
        display: none
    }

    .table-toolbar,
    .table-heading,
    .pagination {
        padding-left: 16px;
        padding-right: 16px
    }

    .filters {
        flex-wrap: wrap;
        width: 100%;
        gap: 8px
    }

    .filters>div {
        flex: 1
    }

    .search-wrap {
        width: 100%
    }

    .pagination {
        align-items: flex-start;
        flex-direction: column
    }

    .login-story {
        display: none
    }

    .login-panel {
        width: 100%;
        padding: 40px 24px;
        min-height: 100vh
    }

    .form-grid {
        grid-template-columns: 1fr
    }

    .form-grid .wide {
        grid-column: auto
    }

    td,
    th {
        padding: 14px 16px
    }

    .page-controls {
        gap: 10px
    }
}


.brand-pending .brand,
.brand-pending .sidebar-bottom {
    visibility: hidden
}

.brand-name {
    overflow-wrap: anywhere;
    letter-spacing: .3px;
    font-size: 17px;
    line-height: 1.4
}

.brand-mark {
    flex-shrink: 0
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    background: white;
    padding: 3px
}

.tenant-branded .brand-mark {
    background: white;
    color: var(--teal)
}

.tenant-branded .sidebar {
    background: color-mix(in srgb, var(--teal) 30%, #101b2d)
}

.tenant-branded .nav-link.active {
    background: var(--teal)
}

.tenant-branded .login-story {
    background: linear-gradient(135deg, color-mix(in srgb, var(--teal) 45%, #102438), #142f42)
}

.company-form {
    padding: 30px;
    max-width: 1000px
}

.profile-header {
    display: flex;
    justify-content: space-between;
    gap: 20px
}

.profile-header>div:last-child {
    min-width: 220px
}

.branding-preview {
    display: flex;
    gap: 25px;
    align-items: center;
    border: 1px solid var(--line);
    padding: 25px;
    background: #f8fafc;
    border-radius: 12px;
    margin: 25px 0
}

.preview-logo {
    width: 110px;
    height: 90px;
    display: grid;
    place-items: center;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 28px;
    font-weight: 700
}

.preview-logo img {
    max-width: 100%;
    max-height: 85px;
    object-fit: contain
}

.branding-preview strong {
    font-size: 23px
}

.branding-preview p {
    color: var(--muted);
    margin: 5px 0 12px
}

.brand-link {
    background: #f4f8fa;
    padding: 20px;
    margin-top: 25px;
    border-radius: 10px
}

.brand-link p {
    margin: 8px 0;
    overflow-wrap: anywhere
}

.company-form input[type=color] {
    height: 44px;
    padding: 4px
}

.tenant-branded .page-heading .eyebrow {
    color: var(--teal)
}

@media(max-width:760px) {
    .company-form {
        padding: 18px
    }

    .profile-header {
        flex-direction: column
    }

    .branding-preview {
        padding: 15px;
        gap: 15px
    }

    .branding-preview strong {
        font-size: 18px
    }
}

.brand-pending .login-story footer,
.brand-pending .login-foot {
    visibility: hidden
}

.tenant-branded .stat-icon {
    background: color-mix(in srgb, var(--teal) 10%, white);
    color: var(--teal)
}
/* Fixed-size status summaries, separate from paginated document registers. */
#operational-overview > p { line-height: 1.6; margin-bottom: 18px; }
#operational-overview .stats-grid { grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
#operational-overview h3 { margin: 0 0 18px; font-size: 16px; }
#operational-overview ul { padding-left: 20px; line-height: 1.7; font-size: 13px; }
