/*
    The developer portal's own styles (PRPD-2311). Everything here is Envoy's alone: a piece moves into Wayfinder when a
    second app needs it. Colours and type come from Wayfinder's tokens (--pds-*), never raw values where a token exists.
*/

:root {
    --portal-header-height: 64px;
    --portal-sidebar-width: 264px;
    --portal-radius: 12px;
    --portal-border: var(--pds-stone-2);
    --portal-canvas: var(--pds-stone-1-subtle);
    --portal-muted: var(--pds-ink-500);
}

body {
    min-height: 100vh;
    background: var(--portal-canvas);
    color: var(--pds-ink);
}

/* ===== Header ===== */

.portal-header {
    height: var(--portal-header-height);
    background: var(--pds-white);
    border-bottom: 1px solid var(--portal-border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.portal-header .brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: var(--pds-ink);
    text-decoration: none;
}

.brand-tag {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .2rem .5rem;
    border-radius: 999px;
    background: var(--pds-chartreuse-subtle);
    border: 1px solid var(--pds-chartreuse-border);
}

.portal-header nav a {
    color: var(--pds-ink);
    text-decoration: none;
    font-size: .925rem;
}

.portal-header nav a:hover {
    color: var(--pds-periwinkle);
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 600;
    background: var(--pds-lilac-subtle);
    color: var(--pds-ink);
    border: 1px solid var(--pds-lilac-border);
    flex-shrink: 0;
}

.avatar.square {
    border-radius: 8px;
    background: var(--pds-chartreuse);
    border-color: var(--pds-chartreuse-darker);
}

/* ===== Workspace: sidebar + content ===== */

.workspace {
    display: grid;
    grid-template-columns: 1fr;
    min-height: calc(100vh - var(--portal-header-height));
}

@media (min-width: 992px) {
    .workspace {
        grid-template-columns: var(--portal-sidebar-width) 1fr;
    }

    .workspace-sidebar {
        position: sticky;
        top: var(--portal-header-height);
        height: calc(100vh - var(--portal-header-height));
        overflow-y: auto;
        border-right: 1px solid var(--portal-border);
    }
}

.workspace-sidebar {
    background: var(--pds-white);
    padding: 1rem .875rem 1.5rem;
    border-bottom: 1px solid var(--portal-border);
}

.workspace-content {
    padding: 2rem 1rem 4rem;
    min-width: 0;
}

@media (min-width: 768px) {
    .workspace-content {
        padding: 2.25rem 2.5rem 4rem;
    }
}

.workspace-content > .inner {
    max-width: 72rem;
    margin: 0 auto;
}

/* Switchers: a full-width button that opens a menu */

.switcher {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .5rem .625rem;
    border: 1px solid var(--portal-border);
    border-radius: 10px;
    background: var(--pds-white);
    color: var(--pds-ink);
    text-align: left;
}

.switcher:hover,
.switcher[aria-expanded="true"] {
    border-color: var(--pds-periwinkle-border);
    background: var(--pds-stone-1-subtle);
}

.switcher .switcher-text {
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.switcher .switcher-label {
    display: block;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--portal-muted);
}

.switcher .switcher-value {
    display: block;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.switcher-menu {
    width: 100%;
    border-radius: 10px;
    border-color: var(--portal-border);
    box-shadow: 0 12px 32px rgba(18, 20, 26, .12);
    padding: .375rem;
}

.switcher-menu .dropdown-item {
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .6rem;
}

.switcher-menu .dropdown-item.active,
.switcher-menu .dropdown-item:active {
    background: var(--pds-periwinkle-subtle);
    color: var(--pds-ink);
}

/* Sidebar menu */

.side-label {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--portal-muted);
    margin: 1.5rem .5rem .5rem;
}

.side-nav {
    list-style: none;
    padding: 0;
    margin: .5rem 0 0;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .5rem .625rem;
    border-radius: 8px;
    color: var(--pds-ink);
    text-decoration: none;
    font-size: .925rem;
}

.side-nav a i {
    width: 1.1rem;
    text-align: center;
    color: var(--portal-muted);
}

.side-nav a:hover {
    background: var(--pds-stone-1);
}

.side-nav a[aria-current="page"] {
    background: var(--pds-periwinkle-subtle);
    font-weight: 600;
}

.side-nav a[aria-current="page"] i {
    color: var(--pds-periwinkle);
}

/* ===== Segmented control ===== */

.segmented {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    background: var(--pds-stone-1);
    border: 1px solid var(--portal-border);
    border-radius: 9px;
}

.segmented.full {
    display: flex;
    width: 100%;
}

.segmented.full > * {
    flex: 1;
    text-align: center;
}

.segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented label,
.segmented a,
.segmented span {
    padding: .3rem .8rem;
    border-radius: 6px;
    font-size: .85rem;
    color: var(--portal-muted);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.segmented label:hover,
.segmented a:hover {
    color: var(--pds-ink);
}

.segmented input:checked + label,
.segmented a[aria-current="page"] {
    background: var(--pds-white);
    color: var(--pds-ink);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(18, 20, 26, .12);
}

.segmented input:focus-visible + label {
    outline: 2px solid var(--pds-periwinkle);
    outline-offset: 1px;
}

.segmented span[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .55;
}

/* An environment the integration hasn't reached: dimmed, and a link to where it is asked for. */
.segmented a.not-reached {
    opacity: .55;
}

/* ===== Page header ===== */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-head .eyebrow {
    font-size: .8rem;
    color: var(--portal-muted);
    margin-bottom: .25rem;
}

.page-head .eyebrow a {
    color: var(--portal-muted);
}

.page-head h1 {
    font-size: 1.75rem;
    margin: 0;
}

.page-head .lede {
    color: var(--portal-muted);
    margin: .4rem 0 0;
    max-width: 44rem;
}

/* ===== Panels ===== */

.panel {
    background: var(--pds-white);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--portal-border);
}

.panel-head h2 {
    font-size: 1.05rem;
    margin: 0;
}

.panel-head .hint {
    color: var(--portal-muted);
    font-size: .85rem;
    margin: .15rem 0 0;
}

.panel-body {
    padding: 1.25rem;
}

.panel-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.25rem;
    background: var(--pds-stone-1-subtle);
    border-bottom: 1px solid var(--portal-border);
}

.panel-toolbar .form-select {
    width: auto;
    min-width: 11rem;
    font-size: .85rem;
}

/* ===== Tables ===== */

.data-table {
    width: 100%;
    margin: 0;
    font-size: .9rem;
}

.data-table th {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--portal-muted);
    background: var(--pds-white);
    padding: .65rem 1.25rem;
    border-bottom: 1px solid var(--portal-border);
    white-space: nowrap;
}

.data-table td {
    padding: .8rem 1.25rem;
    border-bottom: 1px solid var(--pds-stone-1);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover td {
    background: var(--pds-stone-1-subtle);
}

.data-table .mono,
.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .84rem;
}

.data-table .muted,
.muted {
    color: var(--portal-muted);
}

.data-table td * {
    overflow-wrap: anywhere;
}

.data-table .actions {
    text-align: right;
    white-space: nowrap;
}

/* ===== Stat tiles and cards ===== */

.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
}

.integration-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--pds-white);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: 1.25rem;
}

.integration-card h3 {
    font-size: 1.1rem;
    margin: 0;
}

.integration-card .description {
    color: var(--portal-muted);
    font-size: .9rem;
    margin: .25rem 0 0;
}

.env-health {
    display: grid;
    gap: .5rem;
}

.env-health .row-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .75rem;
    border-radius: 8px;
    background: var(--pds-stone-1-subtle);
    font-size: .875rem;
}

.env-name {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
}

.env-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pds-lilac);
}

.env-dot.production {
    background: var(--bs-success);
}

.stat {
    color: var(--portal-muted);
}

.stat strong {
    color: var(--pds-ink);
}

.stat .failing {
    color: var(--bs-danger-text-emphasis);
    font-weight: 600;
}

/* ===== Empty states and notes ===== */

.empty {
    text-align: center;
    padding: 2.5rem 1.25rem;
    color: var(--portal-muted);
}

.empty i {
    font-size: 1.75rem;
    color: var(--pds-periwinkle);
    margin-bottom: .75rem;
    display: block;
}

.empty .title {
    color: var(--pds-ink);
    font-weight: 600;
    margin-bottom: .25rem;
}

.note {
    display: flex;
    gap: .75rem;
    padding: .9rem 1rem;
    border-radius: 10px;
    font-size: .9rem;
    background: var(--pds-lilac-subtle);
    border: 1px solid var(--pds-lilac-border);
}

.note i {
    margin-top: .15rem;
}

.secret-box {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: var(--pds-white);
    border: 1px dashed var(--pds-periwinkle-border);
    border-radius: 8px;
    padding: .75rem;
    overflow-wrap: anywhere;
}

/* ===== Key–value lists and code ===== */

.facts {
    display: grid;
    grid-template-columns: minmax(8rem, 12rem) 1fr;
    gap: .6rem 1.25rem;
    margin: 0;
    font-size: .9rem;
}

.facts dt {
    color: var(--portal-muted);
    font-weight: 400;
}

.facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.code-block {
    margin: 0;
    padding: 1rem 1.25rem;
    background: #1f2230;
    color: #e8eaf2;
    font-size: .82rem;
    line-height: 1.55;
    max-height: 28rem;
    overflow: auto;
}

/* ===== Narrow pages (sign-in, policy, organisations) ===== */

.narrow {
    max-width: 44rem;
    margin: 0 auto;
    padding: 2.5rem 1rem 4rem;
}

.form-panel {
    background: var(--pds-white);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: 1.5rem;
}

.form-panel .form-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: 1.5rem;
}

.account-menu {
    width: 14rem;
}

.avatar.sm {
    width: 22px;
    height: 22px;
    font-size: .7rem;
    border-radius: 6px;
}

.form-panel.compact {
    max-width: 40rem;
}

/* The staff area (PRPD-2486): marked on every page, so it is never taken for a partner's own view. */
.brand-tag.staff-tag {
    background: var(--pds-ink);
    border-color: var(--pds-ink);
    color: var(--pds-white);
}

.staff-banner {
    background: var(--pds-ink);
    color: var(--pds-white);
    font-size: .85rem;
    padding: .45rem 1.5rem;
}

/* Wider than the developer portal's narrow pages: staff read tables, not forms. */
.narrow.staff-main {
    max-width: 68rem;
}

/* Text a person typed into a box, shown with the line breaks they gave it. */
.as-written {
    white-space: pre-wrap;
}
