:root {
    --plag-primary: #003737;
    --plag-primary-dark: #002828;
    --plag-energy: #0feb73;
    --plag-soft-white: #f8f2f0;
    --plag-ink: #003737;
    --plag-sidebar: #003737;
    --tblr-body-color: var(--plag-ink);
    --tblr-body-font-family: "Poppins", Arial, sans-serif;
    margin-right: 0;
    margin-left: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: clip;
    color: var(--plag-ink);
    font-family: "Poppins", Arial, sans-serif;
    font-weight: 300;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--plag-ink);
    font-weight: 200;
}

.btn {
    border-radius: 999px;
    font-weight: 500;
}

.btn-primary {
    --tblr-btn-bg: var(--plag-primary);
    --tblr-btn-border-color: var(--plag-primary);
    --tblr-btn-hover-bg: var(--plag-primary-dark);
    --tblr-btn-hover-border-color: var(--plag-primary-dark);
}

.btn-outline-primary {
    --tblr-btn-color: var(--plag-primary);
    --tblr-btn-border-color: var(--plag-primary);
    --tblr-btn-hover-color: #fff;
    --tblr-btn-hover-bg: var(--plag-primary);
    --tblr-btn-hover-border-color: var(--plag-primary);
    --tblr-btn-active-color: #fff;
    --tblr-btn-active-bg: var(--plag-primary-dark);
    --tblr-btn-active-border-color: var(--plag-primary-dark);
    color: var(--plag-primary);
    border-color: var(--plag-primary);
}

.text-primary {
    color: var(--plag-primary) !important;
}

.text-secondary,
.form-hint {
    color: rgba(0, 55, 55, 0.68) !important;
}

a {
    color: var(--plag-primary);
}

.auth-shell {
    display: grid;
    max-width: 100%;
    min-height: 100vh;
    margin: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-brand-panel {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 3rem 5rem;
    color: var(--plag-ink);
    background: linear-gradient(160deg, #ffffff 0%, #f8f5ff 45%, #fff9eb 100%);
}

.auth-brand-content {
    position: relative;
    z-index: 2;
    max-width: 560px;
}

.auth-brand-logo,
.sidebar-logo {
    display: block;
    width: auto;
}

.auth-brand-logo {
    height: 42px;
    margin-bottom: 6rem;
}

.auth-brand-eyebrow,
.auth-eyebrow {
    margin-bottom: 1.25rem;
    color: var(--plag-primary);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.auth-eyebrow {
    margin-bottom: 0.5rem;
}

.auth-brand-panel h1 {
    max-width: 500px;
    margin-bottom: 1.5rem;
    font-size: clamp(2.75rem, 5vw, 4.75rem);
    font-weight: 200;
    letter-spacing: -0.05em;
    line-height: 1.02;
}

.auth-brand-copy {
    max-width: 460px;
    margin: 0;
    color: rgba(0, 55, 55, 0.7);
    font-size: 1.15rem;
    line-height: 1.7;
}

.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.25rem;
    background: #fff;
}

.auth-card-wrap {
    width: min(100%, 430px);
}

.auth-mobile-logo {
    display: none;
    width: auto;
    height: 36px;
    margin-bottom: 3rem;
}

.auth-form-panel .form-control {
    min-height: 3rem;
    padding: 0.65rem 1rem;
    border-color: #dce0e8;
    border-radius: 0.65rem;
    font-size: 1rem;
}

.auth-form-panel .form-control:focus {
    border-color: var(--plag-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 55, 55, 0.12);
}

.auth-form-panel .form-hint {
    font-size: 12px;
}

.verification-code {
    letter-spacing: 0.35em;
    font-weight: 500;
}

.auth-form-panel .btn-lg {
    min-height: 3rem;
    padding: 0.65rem 1rem;
    font-size: 1rem;
}

.auth-footer {
    margin: 2.5rem 0 0;
    color: #8b92a5;
    font-size: 0.8rem;
    text-align: center;
}

.page {
    min-height: 100vh;
    background: #f8f8f8;
}

.page-wrapper {
    min-width: 0;
    background: #f8f8f8;
}

.dashboard-sidebar {
    overflow-x: clip;
    border-right: 1px solid rgba(0, 55, 55, 0.1);
    background: #fff;
    box-shadow: 8px 0 28px rgba(0, 55, 55, 0.035);
}

.sidebar-logo {
    height: 34px;
}

.admin-sidebar-label {
    margin-top: 0.75rem;
    color: rgba(0, 55, 55, 0.58);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.dashboard-sidebar .container-fluid,
.dashboard-sidebar .navbar-collapse {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.dashboard-sidebar > .container-fluid {
    overflow-x: clip;
    padding-right: 1.25rem !important;
    padding-left: 1.25rem !important;
}

.dashboard-sidebar .navbar-collapse {
    flex-direction: column;
    align-items: stretch;
    overflow-x: clip;
}

.dashboard-sidebar .navbar-nav,
.dashboard-sidebar .nav-item,
.dashboard-sidebar .nav-link {
    min-width: 0;
    max-width: 100%;
}

.dashboard-sidebar .nav-link {
    margin-bottom: 0.25rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: #003737;
    font-weight: 500;
}

.dashboard-sidebar .nav-link:hover {
    color: var(--plag-primary);
    background: rgba(0, 55, 55, 0.045);
}

.dashboard-sidebar .nav-link.active {
    border-radius: 0.5rem;
    color: #003737;
    background: #e5ebeb;
}

.dashboard-sidebar .nav-link-icon {
    color: currentColor;
}

.dashboard-sidebar .nav-link.disabled {
    color: rgba(0, 55, 55, 0.38);
}

.documentation-toggle {
    display: flex;
    align-items: center;
}

.documentation-chevron {
    display: inline-flex;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.documentation-toggle[aria-expanded="true"] .documentation-chevron {
    transform: rotate(90deg);
}

.documentation-subnav {
    position: relative;
    display: block;
    margin: 0.1rem 0 0.5rem;
    padding-left: 0;
}

.documentation-subnav::before {
    position: absolute;
    top: 0.3rem;
    bottom: 0.3rem;
    left: 1rem;
    width: 1px;
    background: rgba(0, 55, 55, 0.14);
    content: "";
}

.dashboard-sidebar .documentation-subnav .nav-link {
    margin: 0;
    padding: 0.5rem 1rem;
    padding-inline-start: 1.5rem !important;
    font-size: 0.82rem;
}

.dashboard-sidebar .documentation-subnav .nav-link.active {
    color: #003737;
    background: #e5ebeb;
    box-shadow: none;
}

.sidebar-account {
    width: 100%;
    min-width: 0;
    padding: 1.25rem 0 1.25rem;
    margin-top: auto;
    border-top: 1px solid rgba(0, 55, 55, 0.1);
}

.sidebar-account .btn {
    min-height: 2.75rem;
}

.dashboard-header {
    padding-top: 2rem;
}

.dashboard-header .page-pretitle {
    color: rgba(0, 55, 55, 0.58);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
}

.dashboard-header .page-title {
    margin-top: 0.35rem;
    font-size: 2rem;
    font-weight: 300;
}

.welcome-card {
    overflow: hidden;
    border: 1px solid rgba(0, 55, 55, 0.08);
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 12px 36px rgba(0, 55, 55, 0.055);
}

.api-key-card,
.credits-card,
.query-history-card {
    border: 1px solid rgba(0, 55, 55, 0.08);
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 12px 36px rgba(0, 55, 55, 0.04);
    scroll-margin-top: 2rem;
}

.query-history-count {
    align-self: flex-start;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    color: var(--plag-primary);
    background: #e5ebeb;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.query-history-empty {
    padding: 2rem;
    border: 1px dashed rgba(0, 55, 55, 0.18);
    border-radius: 0.85rem;
    color: rgba(0, 55, 55, 0.62);
    text-align: center;
}

.query-history-table {
    min-width: 900px;
    margin-bottom: 0;
    table-layout: fixed;
}

.query-history-table th {
    color: rgba(0, 55, 55, 0.58);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.query-history-time {
    color: rgba(0, 55, 55, 0.62);
    font-size: 0.78rem;
    white-space: nowrap;
}

.query-history-preview-cell {
    overflow: hidden;
    width: 46%;
    min-width: 300px;
}

.query-history-preview {
    display: -webkit-box;
    overflow: hidden;
    overflow-wrap: anywhere;
    color: var(--plag-primary);
    font-size: 0.82rem;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.query-history-meta {
    margin-top: 0.3rem;
    color: rgba(0, 55, 55, 0.5);
    font-size: 0.68rem;
}

.query-status {
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    color: #003737;
    background: #e5ebeb;
    font-size: 0.7rem;
    font-weight: 500;
}

.query-status-completed,
.query-status-submitted {
    background: rgba(15, 235, 115, 0.18);
}

.query-status-failed,
.query-status-rejected {
    color: #7d2525;
    background: #f8e3e3;
}

.query-score {
    display: block;
    margin-top: 0.3rem;
    color: rgba(0, 55, 55, 0.58);
    font-size: 0.7rem;
}

.credits-balance {
    display: flex;
    min-width: 150px;
    flex-direction: column;
    align-items: flex-end;
}

.credits-balance strong {
    color: var(--plag-primary);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 300;
    letter-spacing: -0.04em;
    line-height: 1;
}

.credits-balance span,
.credits-summary {
    color: rgba(0, 55, 55, 0.58);
    font-size: 0.8rem;
    font-weight: 500;
}

.credits-progress {
    height: 0.7rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(0, 55, 55, 0.08);
}

.credits-progress .progress-bar {
    border-radius: inherit;
    background: var(--plag-energy);
}

.dashboard-eyebrow {
    color: var(--plag-primary);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.api-key-alert {
    border: 1px solid rgba(15, 235, 115, 0.35);
    border-radius: 0.75rem;
    color: var(--plag-primary);
    background: rgba(15, 235, 115, 0.12);
}

.api-key-value {
    max-width: 680px;
}

.api-key-value .form-control {
    min-width: 0;
    border-color: rgba(0, 55, 55, 0.2);
    border-radius: 999px 0 0 999px;
    color: var(--plag-primary);
    background: #f8f8f8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
}

.api-key-value .btn {
    border-radius: 0 999px 999px 0;
}

.api-key-masked {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(0, 55, 55, 0.12);
    border-radius: 0.75rem;
    color: rgba(0, 55, 55, 0.5);
    background: #f8f8f8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.api-key-masked strong {
    color: var(--plag-primary);
    font-weight: 500;
    letter-spacing: 0.08em;
}

.dashboard-mark {
    display: grid;
    width: 150px;
    height: 150px;
    place-items: center;
    border-radius: 38px;
    color: var(--plag-primary);
    background: var(--plag-energy);
    box-shadow: 0 24px 50px rgba(0, 55, 55, 0.18);
    font-size: 5rem;
    font-weight: 500;
}

.documentation-page,
.query-history-page,
.admin-users-page {
    padding-bottom: 3rem;
}

.admin-card {
    overflow: hidden;
    border: 1px solid rgba(0, 55, 55, 0.08);
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 12px 36px rgba(0, 55, 55, 0.04);
}

.admin-toolbar,
.admin-history-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-search-form {
    display: flex;
    width: min(100%, 620px);
    gap: 0.65rem;
}

.admin-search-form .form-control {
    min-width: 180px;
    border-color: rgba(0, 55, 55, 0.16);
    border-radius: 0.65rem;
}

.admin-users-table {
    min-width: 760px;
    margin-bottom: 0;
}

.admin-users-table th {
    color: rgba(0, 55, 55, 0.58);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-credit-value {
    margin-top: 0.2rem;
    color: var(--plag-primary);
    font-size: 1.6rem;
    font-weight: 300;
}

.admin-credit-card {
    margin-bottom: 1rem;
}

.admin-credit-alert {
    border: 1px solid rgba(15, 235, 115, 0.35);
    border-radius: 0.85rem;
    color: var(--plag-primary);
    background: rgba(15, 235, 115, 0.12);
}

.admin-credit-panel {
    display: grid;
    align-items: end;
    gap: 2rem;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
}

.admin-credit-form .form-label {
    font-weight: 500;
}

.admin-credit-controls,
.admin-history-totals {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-credit-controls .form-control {
    min-width: 0;
    border-color: rgba(0, 55, 55, 0.16);
    border-radius: 0.65rem;
}

.admin-credit-controls .btn {
    flex: 0 0 auto;
}

.admin-history-totals {
    align-items: flex-end;
    gap: 1.5rem;
}

.documentation-lead {
    max-width: 760px;
    color: rgba(0, 55, 55, 0.68);
    font-size: 1rem;
    line-height: 1.75;
}

.documentation-card {
    overflow: hidden;
    border: 1px solid rgba(0, 55, 55, 0.08);
    border-radius: 1.1rem;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0, 55, 55, 0.04);
}

.documentation-card + .documentation-card {
    margin-top: 1rem;
}

.documentation-card .card-body {
    padding: 1.75rem;
}

.documentation-section-title {
    margin-bottom: 0.6rem;
    font-size: 1.35rem;
    font-weight: 300;
}

.documentation-kicker {
    margin-bottom: 0.4rem;
    color: rgba(0, 55, 55, 0.56);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.endpoint-heading {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.endpoint-method {
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    color: var(--plag-primary);
    background: rgba(15, 235, 115, 0.2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 700;
}

.endpoint-path,
.inline-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.endpoint-path {
    color: var(--plag-primary);
    font-size: 1rem;
    font-weight: 600;
}

.inline-code {
    padding: 0.12rem 0.35rem;
    border-radius: 0.35rem;
    color: var(--plag-primary);
    background: rgba(0, 55, 55, 0.06);
    font-size: 0.86em;
}

.code-block {
    position: relative;
    margin: 1rem 0 0;
    padding: 1.15rem 1.25rem;
    overflow-x: auto;
    border-radius: 0.85rem;
    color: #e8fff4;
    background: #002f2f;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.65;
    white-space: pre;
}

.documentation-note {
    padding: 1rem 1.1rem;
    border-left: 3px solid var(--plag-energy);
    border-radius: 0.35rem 0.75rem 0.75rem 0.35rem;
    color: rgba(0, 55, 55, 0.78);
    background: rgba(15, 235, 115, 0.09);
}

.documentation-table {
    margin: 1rem 0 0;
}

.documentation-table th {
    color: rgba(0, 55, 55, 0.6);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.documentation-table td,
.documentation-table th {
    padding: 0.8rem 0.75rem;
    vertical-align: top;
}

.documentation-table td:first-child {
    color: var(--plag-primary);
    font-weight: 500;
    white-space: nowrap;
}

.documentation-list {
    margin: 0;
    padding-left: 1.2rem;
    color: rgba(0, 55, 55, 0.72);
}

.documentation-list li + li {
    margin-top: 0.45rem;
}

@media (max-width: 991.98px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand-panel {
        display: none;
    }

    .auth-form-panel {
        min-height: 100vh;
        padding: 2rem 1.25rem;
    }

    .auth-mobile-logo {
        display: block;
    }

    .dashboard-sidebar {
        box-shadow: 0 1px 0 rgba(0, 55, 55, 0.1);
    }

    .dashboard-sidebar .navbar-collapse {
        padding-bottom: 1rem;
    }

    .credits-balance {
        align-items: flex-start;
    }
}

@media (max-width: 767.98px) {
    .admin-toolbar,
    .admin-history-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-credit-panel {
        grid-template-columns: 1fr;
    }

    .admin-history-totals {
        width: 100%;
        align-items: center;
        justify-content: space-between;
    }

    .admin-search-form {
        flex-wrap: wrap;
    }

    .admin-search-form .form-control {
        width: 100%;
    }

    .query-history-table {
        min-width: 0;
    }

    .query-history-table thead {
        display: none;
    }

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

    .query-history-table tr {
        padding: 1rem 0;
        border-bottom: 1px solid rgba(0, 55, 55, 0.1);
    }

    .query-history-table tr:first-child {
        padding-top: 0;
    }

    .query-history-table tr:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .query-history-table td,
    .query-history-table td.text-end {
        min-width: 0;
        padding: 0.3rem 0;
        border: 0;
        text-align: left !important;
    }

    .query-history-table td::before {
        display: block;
        margin-bottom: 0.15rem;
        color: rgba(0, 55, 55, 0.5);
        content: attr(data-label);
        font-size: 0.62rem;
        font-weight: 500;
        letter-spacing: 0.07em;
        text-transform: uppercase;
    }

    .query-history-preview-cell {
        width: 100%;
    }
}
