:root {
    color-scheme: light;
    --ink: #1d2925;
    --muted: #6b7771;
    --line: #e2e8e4;
    --paper: #ffffff;
    --canvas: #f3f6f3;
    --forest: #204b3c;
    --forest-soft: #e5f0e9;
    --lime: #d7ed83;
    --amber: #ae6b15;
    --amber-soft: #fff2dc;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: "Trebuchet MS", "Lucida Sans Unicode", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

.topbar {
    background: var(--forest);
    color: #fff;
}

.topbar-inner {
    width: min(1120px, calc(100% - 48px));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
}

.brand strong {
    color: var(--lime);
    font-weight: 500;
}

.brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--lime);
    color: var(--forest);
    font-size: 12px;
    font-weight: 800;
}

.environment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #d8e6de;
    font-size: 12px;
    text-transform: uppercase;
}

.environment-dot,
.status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--lime);
}

.page-shell {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 48px 0 28px;
}

.page-heading,
.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--forest);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1,
h2 {
    margin-bottom: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

h1 {
    font-size: 40px;
    line-height: 1.12;
}

h2 {
    font-size: 25px;
    line-height: 1.2;
}

.description {
    margin: 10px 0 0;
    color: var(--muted);
}

.updated-label,
.result-count {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin-top: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    overflow: hidden;
}

.metric {
    min-height: 144px;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid var(--line);
}

.metric:first-child {
    border-left: 0;
}

.metric-primary {
    background: var(--forest-soft);
}

.metric-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.metric-value {
    margin-top: 5px;
    color: var(--forest);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 45px;
    font-weight: 500;
    line-height: 1.05;
}

.metric-note {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

.companies-section {
    margin-top: 44px;
}

.section-heading {
    margin-bottom: 18px;
}

.table-scroll {
    overflow-x: auto;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

td {
    color: #45534c;
    font-size: 13px;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.company-name,
.company-slug {
    display: block;
}

.company-name {
    color: var(--ink);
    font-weight: 700;
}

.company-slug {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
}

.status-active {
    color: var(--forest);
}

.status-active .status-dot {
    background: #43835d;
}

.status-inactive {
    color: var(--amber);
}

.status-inactive .status-dot {
    background: #d09232;
}

.empty-state {
    padding: 30px 18px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    color: var(--muted);
    text-align: center;
}

.empty-title {
    margin-bottom: 4px;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
}

.empty-state p:last-child {
    margin-bottom: 0;
    font-size: 13px;
}

.page-footer {
    margin-top: 30px;
    color: var(--muted);
    font-size: 11px;
}

.page-footer span {
    padding: 0 5px;
    color: var(--forest);
}

body.central-app {
    min-height: 100vh;
    background: var(--canvas);
}

.central-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 5;
    width: 250px;
    padding: 24px 16px 16px;
    display: flex;
    flex-direction: column;
    background: #193e33;
    color: #fff;
}

.central-sidebar .brand {
    padding: 0 8px 26px;
    border-bottom: 1px solid rgb(255 255 255 / 13%);
}

.sidebar-nav {
    padding-top: 23px;
}

.nav-caption {
    margin: 0 10px 8px;
    color: #a9c2b5;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.1px;
    text-transform: uppercase;
}

.nav-caption-spaced {
    margin-top: 28px;
}

.nav-link {
    min-height: 42px;
    margin: 3px 0;
    padding: 0 11px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 6px;
    color: #d3e2d9;
    font-size: 13px;
    text-decoration: none;
    transition: background-color 120ms ease, color 120ms ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: #2e5b49;
    color: #fff;
}

.nav-link.is-active {
    box-shadow: inset 3px 0 0 var(--lime);
}

.nav-icon {
    width: 19px;
    color: var(--lime);
    font-size: 18px;
    line-height: 1;
    text-align: center;
}

.sidebar-account {
    margin-top: auto;
    padding: 14px 5px 0;
    display: flex;
    align-items: center;
    gap: 9px;
    border-top: 1px solid rgb(255 255 255 / 13%);
}

.account-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--lime);
    color: var(--forest);
    font-size: 13px;
    font-weight: 800;
}

.account-details {
    min-width: 0;
    flex: 1;
}

.account-details strong,
.account-details span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-details strong {
    color: #fff;
    font-size: 11px;
}

.account-details span {
    margin-top: 2px;
    color: #b7c9bf;
    font-size: 10px;
}

.icon-button {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #e4eee8;
    cursor: pointer;
    font-size: 19px;
}

.icon-button:hover {
    background: rgb(255 255 255 / 12%);
}

.central-main {
    min-height: 100vh;
    margin-left: 250px;
}

.central-topbar {
    min-height: 64px;
    padding: 0 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    color: var(--muted);
    font-size: 12px;
}

.central-topbar .environment {
    color: var(--forest);
}

.central-topbar .environment-dot {
    background: #5a9567;
}

.central-content {
    width: min(1120px, calc(100% - 72px));
    margin: 0 auto;
    padding: 38px 0 25px;
}

.central-content .page-heading {
    margin-bottom: 28px;
}

.central-content h1 {
    font-size: 36px;
}

.central-content .metrics {
    margin-top: 0;
}

.metrics-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metrics-compact .metric {
    min-height: 115px;
}

.data-section,
.form-section {
    margin-top: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
}

.data-section .section-heading {
    padding: 22px 22px 18px;
    align-items: flex-end;
}

.data-section .section-heading .eyebrow {
    margin-bottom: 5px;
}

.data-section .section-heading h2 {
    font-size: 22px;
}

.data-section .table-scroll {
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.data-section th:first-child,
.data-section td:first-child {
    padding-left: 22px;
}

.data-section th:last-child,
.data-section td:last-child {
    padding-right: 22px;
    text-align: right;
}

.table-empty {
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

.tag-list,
.row-actions,
.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.tag {
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--forest-soft);
    color: var(--forest);
    font-size: 11px;
    font-weight: 700;
}

.tag-muted {
    background: #eef1ef;
    color: var(--muted);
}

.button {
    min-height: 38px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 5px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    background: var(--forest);
    color: #fff;
}

.button-primary:hover {
    background: #15372d;
}

.button-quiet {
    border-color: var(--line);
    background: #fff;
    color: var(--ink);
}

.button-quiet:hover {
    background: #f3f6f3;
}

.button-danger {
    border-color: #edd4ca;
    background: #fff;
    color: #a44731;
}

.button-danger:hover {
    background: #fcf3ef;
}

.button-small {
    min-height: 31px;
    padding: 0 9px;
    font-size: 11px;
}

.pagination-wrap {
    padding: 14px 20px;
}

.pagination-wrap nav > div:first-child {
    color: var(--muted);
    font-size: 11px;
}

.pagination-wrap nav > div:last-child {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
}

.pagination-wrap a,
.pagination-wrap span[aria-current] span,
.pagination-wrap span[aria-disabled] span {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--forest);
    font-size: 11px;
    text-decoration: none;
}

.pagination-wrap span[aria-current] span {
    border-color: var(--forest);
    background: var(--forest);
    color: #fff;
}

.form-section {
    max-width: 800px;
    padding: 24px;
}

.central-form {
    display: grid;
    gap: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.central-form label,
.permission-fieldset legend {
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
}

.central-form input:not([type="checkbox"]),
.central-form select {
    width: 100%;
    min-height: 41px;
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid #d5ddd8;
    border-radius: 5px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
}

.central-form input:focus,
.central-form select:focus {
    border-color: #629079;
    outline: 2px solid rgb(75 124 98 / 15%);
}

.central-form small,
.field-note {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
}

.permission-fieldset {
    margin: 0;
    padding: 15px;
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.permission-fieldset legend {
    padding: 0 6px;
}

.check-option,
.remember-option {
    display: flex;
    align-items: center;
    gap: 9px;
}

.check-option {
    padding: 8px 9px;
    border-radius: 4px;
    background: #f6f8f6;
}

.check-option input,
.remember-option input {
    width: 15px;
    height: 15px;
    accent-color: var(--forest);
}

.form-actions {
    justify-content: flex-end;
}

.tenant-filters {
    margin-bottom: 18px;
    padding: 16px;
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--paper);
}

.tenant-filter-field {
    min-width: 190px;
    flex: 1;
}

.tenant-filter-field label {
    display: block;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
}

.tenant-filter-field input,
.tenant-filter-field select {
    width: 100%;
    min-height: 41px;
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid #d5ddd8;
    border-radius: 5px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
}

.tenant-filter-field input:focus,
.tenant-filter-field select:focus {
    border-color: #629079;
    outline: 2px solid rgb(75 124 98 / 15%);
}

.tenant-table {
    min-width: 780px;
}

.audit-table {
    min-width: 980px;
}

.audit-change {
    display: block;
    font-size: 12px;
}

.audit-change + .audit-change {
    margin-top: 4px;
}

.tenant-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.tenant-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
}

.tenant-status::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a7aaa2;
    content: "";
}

.tenant-status.active {
    color: var(--forest);
}

.tenant-status.active::before {
    background: #43835d;
}

.tenant-status.suspended {
    color: var(--amber);
}

.tenant-status.suspended::before {
    background: #d09232;
}

.tenant-domain {
    color: var(--muted);
    font-size: 12px;
}

.notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 12px;
}

.notice p:last-child {
    margin-bottom: 0;
}

.notice-success {
    border-color: #cbded0;
    background: #edf5ef;
    color: #28523b;
}

.notice-error {
    border-color: #ebcfc4;
    background: #fcf1ec;
    color: #8d3f2a;
}

body.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--canvas);
}

.login-shell {
    width: min(430px, calc(100% - 32px));
    padding: 24px 0;
}

.login-brand {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    color: var(--forest);
    font-size: 15px;
    font-weight: 700;
}

.login-brand strong {
    color: #77943f;
    font-weight: 500;
}

.login-panel {
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 12px 32px rgb(23 47 36 / 7%);
}

.login-panel h1 {
    font-size: 32px;
}

.login-panel .description {
    margin-bottom: 24px;
    font-size: 13px;
}

.button-wide {
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
}

.login-footer {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

@media (max-width: 760px) {
    .central-sidebar {
        position: static;
        width: 100%;
        padding: 12px 16px;
    }

    .central-sidebar .brand {
        padding: 0 2px 11px;
    }

    .sidebar-nav {
        padding-top: 11px;
        display: flex;
        align-items: center;
        gap: 4px;
        overflow-x: auto;
    }

    .nav-caption {
        display: none;
    }

    .nav-link {
        min-height: 36px;
        flex: 0 0 auto;
        margin: 0;
        padding: 0 9px;
        font-size: 11px;
    }

    .nav-icon {
        font-size: 15px;
    }

    .sidebar-account {
        display: none;
    }

    .central-main {
        min-height: calc(100vh - 116px);
        margin-left: 0;
    }

    .central-topbar {
        min-height: 48px;
        padding: 0 18px;
    }

    .central-content {
        width: calc(100% - 32px);
        padding-top: 26px;
    }

    .central-content .page-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 520px) {
    .form-grid,
    .metrics-compact {
        grid-template-columns: 1fr;
    }

    .central-content h1 {
        font-size: 31px;
    }

    .form-section {
        padding: 17px;
    }

    .data-section .section-heading {
        padding: 18px 15px;
    }

    .data-section th:first-child,
    .data-section td:first-child {
        padding-left: 14px;
    }

    .row-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 700px) {
    .topbar-inner,
    .page-shell {
        width: min(100% - 32px, 560px);
    }

    .page-shell {
        padding-top: 32px;
    }

    .page-heading,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .updated-label {
        margin-top: 4px;
    }

    h1 {
        font-size: 34px;
    }

    .metrics {
        grid-template-columns: 1fr 1fr;
        margin-top: 26px;
    }

    .metric {
        min-height: 120px;
        padding: 20px;
        border-top: 1px solid var(--line);
    }

    .metric:first-child {
        grid-column: 1 / -1;
        border-top: 0;
    }

    .metric:nth-child(2) {
        border-left: 0;
    }

    .metric-value {
        font-size: 38px;
    }

    .companies-section {
        margin-top: 34px;
    }

    th,
    td {
        padding: 13px 12px;
    }
}

@media (max-width: 440px) {
    .topbar-inner,
    .page-shell {
        width: calc(100% - 24px);
    }

    .metrics {
        grid-template-columns: 1fr;
    }

    .metric,
    .metric:first-child,
    .metric:nth-child(2) {
        min-height: 104px;
        grid-column: auto;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .metric:first-child {
        border-top: 0;
    }
}