/*
 * Portal CPB – panel theme.
 * Loaded after Filament's stylesheet (render hook in AdminPanelProvider). Filament's own rules live in
 * cascade layers, so plain rules here take precedence without !important.
 */
@import url('https://fonts.bunny.net/css?family=ibm-plex-mono:400,500&display=swap');

:root {
    /* Calmer, squarer Filament components */
    --radius-md: 0.25rem;
    --radius-lg: 0.375rem;
    --radius-xl: 0.5rem;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --cpb-surface: #ffffff;
    --cpb-subtle: var(--gray-50);
    --cpb-border: var(--gray-200);
    --cpb-border-strong: var(--gray-300);
    --cpb-text: var(--gray-950);
    --cpb-text-2: var(--gray-600);
    --cpb-text-3: var(--gray-500);
    --cpb-accent: var(--primary-600);
    --cpb-accent-soft: var(--primary-50);
    --cpb-warning: #b54708;
    --cpb-warning-soft: #fffaeb;
    --cpb-warning-icon: #fef0c7;
    --cpb-danger: #b42318;
    --cpb-danger-soft: #fef3f2;
    --cpb-danger-border: #fecdca;
    --cpb-status-nowa: var(--gray-400);
    --cpb-status-przyjeta: #2e6bd8;
    --cpb-status-w_toku: #d97706;
    --cpb-status-zamknieta: #12855a;
}

.dark {
    --cpb-surface: var(--gray-900);
    --cpb-subtle: color-mix(in oklab, white 4%, transparent);
    --cpb-border: color-mix(in oklab, white 10%, transparent);
    --cpb-border-strong: color-mix(in oklab, white 20%, transparent);
    --cpb-text: #ffffff;
    --cpb-text-2: var(--gray-300);
    --cpb-text-3: var(--gray-400);
    --cpb-accent: var(--primary-400);
    --cpb-accent-soft: color-mix(in oklab, var(--primary-400) 15%, transparent);
    --cpb-warning: #fdb022;
    --cpb-warning-soft: color-mix(in oklab, #fdb022 8%, transparent);
    --cpb-warning-icon: color-mix(in oklab, #fdb022 18%, transparent);
    --cpb-danger: #f97066;
    --cpb-danger-soft: color-mix(in oklab, #f97066 12%, transparent);
    --cpb-danger-border: color-mix(in oklab, #f97066 30%, transparent);
}

[x-cloak] {
    display: none !important;
}

/* ---------- Panel shell ---------- */

@media (min-width: 64rem) {
    .fi-sidebar {
        background-color: var(--cpb-surface);
        border-inline-end: 1px solid var(--cpb-border);
    }
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: var(--cpb-accent-soft);
}

.fi-header-heading {
    letter-spacing: -0.01em;
}

/* Tabs: underline instead of pills */
.fi-tabs {
    column-gap: 1.5rem;
    scrollbar-width: none;
}

.fi-tabs:not(.fi-contained) {
    width: auto;
    margin-inline: 0;
    padding: 0;
    border-radius: 0;
    background-color: transparent;
    box-shadow: none;
    border-bottom: 1px solid var(--cpb-border);
}

.fi-tabs-item,
.fi-tabs-item:hover,
.fi-tabs-item.fi-active {
    background-color: transparent;
}

.fi-tabs-item {
    border-radius: 0;
    padding-inline: 0.125rem;
    padding-block: 0.625rem;
    margin-block-end: -1px;
    border-bottom: 2px solid transparent;
}

.fi-tabs-item .fi-tabs-item-label {
    color: var(--cpb-text-2);
}

.fi-tabs-item:hover .fi-tabs-item-label {
    color: var(--cpb-text);
}

.fi-tabs-item.fi-active {
    border-bottom-color: var(--cpb-accent);
}

.fi-tabs-item.fi-active .fi-tabs-item-label {
    color: var(--cpb-text);
    font-weight: 600;
}

.fi-tabs.fi-contained {
    padding-block: 0;
    padding-inline: 1rem;
}

/* ---------- Tables (compact) ---------- */

.fi-ta-ctn {
    box-shadow: 0 0 0 1px var(--cpb-border);
}

.fi-ta-table {
    font-size: 0.875rem;
}

/* Filament pads the column content, not the cell – tighten that padding only */
.fi-ta-header-cell {
    padding: 0.625rem 0.75rem;
}

.fi-ta-text {
    padding-block: 0.625rem;
}

.fi-ta-header-cell {
    background-color: var(--cpb-subtle);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--cpb-text-2);
}

.fi-ta-header-cell-label {
    font-size: 0.75rem;
    font-weight: 500;
}

.fi-ta-text {
    font-size: 0.8125rem;
}

.fi-badge {
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
}

.fi-ta-icon {
    width: 1rem;
    height: 1rem;
}

.fi-ta-row {
    min-height: 2.5rem;
}

.fi-ta-text-item,
.fi-ta-text-description {
    line-height: 1.35;
}

.fi-ta-text-description {
    margin-top: 0.125rem;
    font-size: 0.75rem;
}

/* Case list: keep titles readable instead of squeezing them into a narrow column */
.fi-ta-cell-title,
.fi-ta-header-cell-title {
    min-width: 16rem;
}

.fi-ta-cell-latest-note\.created-at,
.fi-ta-header-cell-latest-note\.created-at {
    min-width: 11rem;
}

.fi-ta-cell-clinic\.name,
.fi-ta-header-cell-clinic\.name {
    min-width: 9rem;
}

/* ---------- Shared case elements ---------- */

.cpb-sig,
.cpb-mono {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--cpb-text-2);
}

.cpb-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    color: var(--cpb-text);
}

.cpb-dot {
    flex: none;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background-color: currentColor;
}

.cpb-dot-nowa {
    background-color: transparent;
    box-shadow: inset 0 0 0 2px var(--cpb-status-nowa);
}

.cpb-dot-przyjeta {
    background-color: var(--cpb-status-przyjeta);
}

.cpb-dot-w_toku {
    background-color: var(--cpb-status-w_toku);
}

.cpb-dot-zamknieta {
    background-color: var(--cpb-status-zamknieta);
}

.cpb-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 1.5rem;
    padding-inline: 0.5rem;
    border: 1px solid var(--cpb-border);
    border-radius: 4px;
    background-color: var(--cpb-surface);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--cpb-text);
}

.cpb-tag {
    display: inline-block;
    padding: 0 0.375rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.125rem;
    vertical-align: 1px;
    white-space: nowrap;
}

.cpb-tag-danger {
    color: var(--cpb-danger);
    background-color: var(--cpb-danger-soft);
    border: 1px solid var(--cpb-danger-border);
}

.cpb-due {
    display: block;
    font-size: 0.75rem;
    color: var(--cpb-text-3);
}

.cpb-due-today,
.cpb-due-soon {
    color: var(--cpb-warning);
    font-weight: 500;
}

.cpb-due-today,
.cpb-due-overdue {
    font-weight: 600;
}

.cpb-due-overdue {
    color: var(--cpb-danger);
}

.cpb-muted {
    color: var(--cpb-text-3);
}

.cpb-small {
    font-size: 0.8125rem;
}

.cpb-strong {
    font-weight: 500;
}

.cpb-label {
    font-size: 0.75rem;
    color: var(--cpb-text-3);
}

.cpb-pre {
    white-space: pre-line;
}

/* Case page header */
.cpb-subheading {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.cpb-subheading-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
}

.cpb-subheading-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    color: var(--cpb-text-2);
}

/* ---------- Case page ---------- */

.cpb-case {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    color: var(--cpb-text);
    font-size: 0.875rem;
    line-height: 1.45;
}

.cpb-card {
    background-color: var(--cpb-surface);
    border: 1px solid var(--cpb-border);
    border-radius: 8px;
}

.cpb-card-padded {
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.cpb-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--cpb-border);
}

.cpb-card-header-sm {
    padding: 0.75rem 1.25rem;
}

.cpb-card-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.cpb-h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.cpb-h2-sm {
    font-size: 0.875rem;
}

.cpb-h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.cpb-block {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.cpb-reading {
    max-width: 72ch;
    font-size: 0.9375rem;
    line-height: 1.65;
    white-space: pre-line;
    color: var(--cpb-text);
}

.cpb-reading-rich {
    white-space: normal;
}

.cpb-empty {
    padding: 1.25rem 1.5rem;
    color: var(--cpb-text-3);
}

.cpb-columns {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem;
}

.cpb-main {
    flex: 999 1 34rem;
    min-width: 0;
}

.cpb-aside {
    flex: 1 1 18rem;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.cpb-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Status path and deadline */
.cpb-progress {
    display: flex;
    flex-wrap: wrap;
    overflow: hidden;
}

.cpb-steps {
    flex: 999 1 30rem;
    display: flex;
    margin: 0;
    padding: 1.125rem 1.5rem;
    list-style: none;
}

.cpb-step {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-top: 1.75rem;
}

.cpb-step:last-child {
    flex: 0 0 auto;
}

/* Connector to the next step */
.cpb-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 0.5625rem;
    left: 1.75rem;
    right: 0.5rem;
    height: 2px;
    background-color: var(--cpb-border);
}

.cpb-step-done:not(:last-child)::after {
    background-color: var(--cpb-accent);
}

.cpb-step-marker {
    position: absolute;
    top: 0;
    left: 0;
    width: 1.25rem;
    height: 1.25rem;
    box-sizing: border-box;
    border-radius: 9999px;
    border: 2px solid var(--cpb-border-strong);
    background-color: var(--cpb-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.cpb-step-done .cpb-step-marker {
    border-color: var(--cpb-accent);
    background-color: var(--cpb-accent);
}

.cpb-step-current .cpb-step-marker {
    border-color: var(--cpb-accent);
}

.cpb-step-current .cpb-step-marker::after {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background-color: var(--cpb-accent);
}

.cpb-step-check {
    width: 0.75rem;
    height: 0.75rem;
}

.cpb-step-label {
    font-weight: 500;
}

.cpb-step-current .cpb-step-label {
    font-weight: 600;
}

.cpb-step-upcoming .cpb-step-label {
    color: var(--cpb-text-2);
}

.cpb-step-date {
    font-size: 0.75rem;
    color: var(--cpb-text-3);
}

.cpb-deadline {
    flex: 1 1 16rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.125rem 1.5rem;
    border-inline-start: 1px solid var(--cpb-border);
}

.cpb-deadline-soon,
.cpb-deadline-today {
    background-color: var(--cpb-warning-soft);
}

.cpb-deadline-overdue {
    background-color: var(--cpb-danger-soft);
}

.cpb-deadline-icon {
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--cpb-subtle);
    color: var(--cpb-text-2);
}

.cpb-deadline-soon .cpb-deadline-icon,
.cpb-deadline-today .cpb-deadline-icon {
    background-color: var(--cpb-warning-icon);
    color: var(--cpb-warning);
}

.cpb-deadline-overdue .cpb-deadline-icon {
    background-color: var(--cpb-danger-border);
    color: var(--cpb-danger);
}

.cpb-deadline-icon .fi-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.cpb-deadline-date {
    font-size: 0.9375rem;
    font-weight: 600;
}

.cpb-deadline .cpb-due {
    font-size: 0.8125rem;
}

/* Case tabs sit directly on the page */
.cpb-tabs {
    border-bottom: 1px solid var(--cpb-border);
}

/* Definition lists */
.cpb-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 2rem;
    margin: 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--cpb-border);
}

.cpb-facts dt,
.cpb-client-facts dt {
    font-size: 0.8125rem;
    color: var(--cpb-text-3);
}

.cpb-facts dd,
.cpb-client-facts dd {
    margin: 0.125rem 0 0;
}

.cpb-facts-wide {
    grid-column: 1 / -1;
}

.cpb-sections {
    padding: 0.5rem 1.5rem 1.5rem;
}

.cpb-section-row {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    gap: 0.75rem 1.5rem;
    padding-block: 1rem;
    border-bottom: 1px solid var(--cpb-border);
}

.cpb-section-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.cpb-section-row .cpb-facts {
    padding-top: 0;
    border-top: 0;
}

.cpb-details {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 0.875rem 0.75rem;
    margin: 0;
    padding: 1rem 1.25rem 1.25rem;
}

.cpb-details dt {
    color: var(--cpb-text-3);
}

.cpb-details dd {
    margin: 0;
    min-width: 0;
}

.cpb-details dd .cpb-small {
    display: block;
}

.cpb-person {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.cpb-avatar {
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--cpb-accent-soft);
    color: var(--cpb-text);
    font-size: 0.625rem;
    font-weight: 600;
}

/* Client */
.cpb-client {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 1rem 1.25rem 1.25rem;
}

.cpb-client-name {
    font-size: 0.9375rem;
    font-weight: 600;
}

.cpb-client-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 0;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--cpb-border);
    border-radius: 6px;
    background-color: var(--cpb-subtle);
}

.cpb-client-facts dt {
    font-size: 0.75rem;
}

.cpb-contact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cpb-contact li {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.cpb-contact-icon {
    flex: none;
    width: 1rem;
    height: 1rem;
    margin-top: 0.125rem;
    color: var(--cpb-text-3);
}

.cpb-case a:not(.fi-btn):not(.fi-link):not(.fi-icon-btn) {
    color: var(--cpb-accent);
}

.cpb-case a:not(.fi-btn):not(.fi-link):not(.fi-icon-btn):hover {
    text-decoration: underline;
}

.cpb-client-reporter {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--cpb-border);
    overflow-wrap: anywhere;
}

/* Files */
.cpb-files {
    margin: 0;
    padding: 0.375rem 0.75rem 0.625rem;
    list-style: none;
}

.cpb-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.cpb-files:not(.cpb-files-compact) .cpb-file + .cpb-file {
    border-top: 1px solid var(--cpb-border);
}

.cpb-file-ext {
    flex: none;
    width: 1.75rem;
    height: 2rem;
    box-sizing: border-box;
    border: 1px solid var(--cpb-border-strong);
    border-radius: 4px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 3px;
    font-family: var(--font-mono);
    font-size: 0.5rem;
    font-weight: 500;
    color: var(--cpb-text-2);
    overflow: hidden;
}

.cpb-file-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.cpb-case a.cpb-file-name {
    color: var(--cpb-text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Case history */
.cpb-segmented {
    display: inline-flex;
    padding: 2px;
    border-radius: 6px;
    background-color: var(--cpb-subtle);
    box-shadow: inset 0 0 0 1px var(--cpb-border);
}

.cpb-segmented button {
    height: 2rem;
    padding-inline: 0.75rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--cpb-text-2);
}

.cpb-segmented button.cpb-active {
    background-color: var(--cpb-surface);
    color: var(--cpb-text);
    box-shadow: 0 1px 2px rgb(16 24 40 / 0.08), 0 0 0 1px var(--cpb-border);
}

.cpb-count {
    color: var(--cpb-text-3);
    font-variant-numeric: tabular-nums;
}

.cpb-composer {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--cpb-border);
}

.cpb-composer-label {
    font-weight: 500;
}

.cpb-textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--cpb-border-strong);
    border-radius: 6px;
    background-color: var(--cpb-surface);
    color: var(--cpb-text);
    font: inherit;
    line-height: 1.5;
}

.cpb-textarea:focus {
    outline: 2px solid var(--cpb-accent);
    outline-offset: -1px;
    border-color: transparent;
}

.cpb-textarea::placeholder {
    color: var(--cpb-text-3);
}

.cpb-composer-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.cpb-error {
    font-size: 0.8125rem;
    color: var(--cpb-danger);
}

.cpb-journal {
    margin: 0;
    padding: 1.25rem 1.5rem 0.25rem;
    list-style: none;
}

.cpb-entry {
    position: relative;
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    column-gap: 0.875rem;
    padding-bottom: 1.25rem;
}

/* Timeline line between markers */
.cpb-entry:not(:last-child)::before {
    content: '';
    position: absolute;
    left: calc(1rem - 0.5px);
    top: 2.25rem;
    bottom: 0.25rem;
    width: 1px;
    background-color: var(--cpb-border);
}

.cpb-entry-marker {
    width: 2rem;
    height: 2rem;
    box-sizing: border-box;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cpb-border);
    background-color: var(--cpb-surface);
    color: var(--cpb-text-2);
    font-size: 0.6875rem;
    font-weight: 600;
}

.cpb-entry-marker .fi-icon {
    width: 0.9375rem;
    height: 0.9375rem;
}

.cpb-entry-note .cpb-entry-marker {
    border-color: transparent;
    background-color: var(--cpb-accent-soft);
    color: var(--cpb-text);
}

.cpb-entry-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cpb-entry-head {
    min-height: 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
}

.cpb-entry-author {
    font-weight: 600;
}

.cpb-role {
    padding: 0 0.375rem;
    border: 1px solid var(--cpb-border);
    border-radius: 4px;
    font-size: 0.75rem;
    line-height: 1.125rem;
    color: var(--cpb-text-2);
}

.cpb-entry-time {
    margin-inline-start: auto;
    font-size: 0.8125rem;
    color: var(--cpb-text-3);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.cpb-entry-text {
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--cpb-border);
    border-radius: 6px;
    background-color: var(--cpb-subtle);
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.cpb-prose > * + * {
    margin-top: 0.5rem;
}

.cpb-prose ul,
.cpb-prose ol {
    padding-inline-start: 1.25rem;
}

.cpb-prose ul {
    list-style: disc;
}

.cpb-prose ol {
    list-style: decimal;
}

.cpb-prose strong {
    font-weight: 600;
}

/* ---------- Brand mark (topbar and sign-in) ---------- */

.cpb-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    height: 2rem;
    color: var(--cpb-text);
    letter-spacing: normal;
}

.cpb-brand-mark {
    flex: none;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-600);
    color: #ffffff;
}

.dark .cpb-brand-mark {
    background-color: var(--primary-500);
}

.cpb-brand-mark svg {
    width: 1.125rem;
    height: 1.125rem;
}

.cpb-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    white-space: nowrap;
}

.cpb-brand-name {
    font-size: 0.9375rem;
    font-weight: 600;
}

.cpb-brand-sub {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--cpb-text-3);
}

/* ---------- Language switcher ---------- */

.cpb-locale {
    display: inline-flex;
    padding: 2px;
    border-radius: 6px;
    background-color: var(--cpb-subtle);
    box-shadow: inset 0 0 0 1px var(--cpb-border);
}

.cpb-locale a {
    min-width: 2.25rem;
    padding: 0.3125rem 0.5rem;
    border-radius: 4px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--cpb-text-2);
    text-decoration: none;
}

.cpb-locale a:hover {
    color: var(--cpb-text);
}

.cpb-locale a.cpb-locale-active {
    background-color: var(--cpb-surface);
    color: var(--cpb-text);
    box-shadow: 0 1px 2px rgb(16 24 40 / 0.08), 0 0 0 1px var(--cpb-border);
}

.fi-topbar .cpb-locale {
    margin-inline-end: 0.75rem;
}

/* ---------- Sign-in and password change ---------- */

.cpb-auth {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    background-color: var(--cpb-surface);
    color: var(--cpb-text);
}

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

@media (min-width: 64rem) {
    .cpb-auth {
        grid-template-columns: minmax(26rem, 42%) minmax(0, 1fr);
    }

    .cpb-auth-brand {
        position: relative;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 3rem;
        padding: 2.5rem 3.5rem;
        background-color: var(--primary-600);
        color: #ffffff;
    }

    .dark .cpb-auth-brand {
        background-color: var(--primary-800);
    }

    .cpb-auth-bar-brand {
        visibility: hidden;
    }
}

.cpb-auth-brand .cpb-brand {
    color: #ffffff;
}

.cpb-auth-brand .cpb-brand-mark {
    background-color: rgb(255 255 255 / 0.12);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18);
}

.cpb-auth-brand .cpb-brand-sub {
    color: rgb(255 255 255 / 0.7);
}

.cpb-auth-brand-foot {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 0.8125rem;
    color: rgb(255 255 255 / 0.6);
}

.cpb-auth-watermark {
    position: absolute;
    right: -7rem;
    bottom: -6rem;
    width: 28rem;
    height: 28rem;
    color: rgb(255 255 255 / 0.045);
    pointer-events: none;
}

.cpb-auth-panel {
    min-width: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.5rem 1.5rem;
}

@media (min-width: 40rem) {
    .cpb-auth-panel {
        padding: 1.5rem 2.5rem 2rem;
    }
}

.cpb-auth-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cpb-auth-bar-end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cpb-auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-block: 2.5rem;
}

.cpb-auth-main > .fi-simple-page {
    width: 100%;
    max-width: 24rem;
}

.cpb-auth-main .fi-simple-header {
    align-items: flex-start;
}

.cpb-auth-main .fi-simple-header .fi-logo {
    display: none;
}

.cpb-auth-main .fi-simple-header-heading {
    text-align: start;
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.cpb-auth-main .fi-simple-header-subheading {
    text-align: start;
    font-size: 0.9375rem;
    color: var(--cpb-text-2);
}

.cpb-auth-main .fi-input-wrp {
    min-height: 2.75rem;
}

.cpb-auth-main .fi-btn {
    min-height: 2.75rem;
}

.cpb-auth-form-actions {
    margin-top: 1.5rem;
}

.cpb-auth-form-actions .fi-btn {
    width: 100%;
}

.cpb-auth-hint {
    margin: 1rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--cpb-text-3);
}

.cpb-auth-help {
    max-width: 24rem;
    margin: 0 auto;
    text-align: center;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--cpb-text-3);
}

/* ---------- Narrow screens ---------- */

@media (max-width: 40rem) {
    .cpb-card-padded {
        padding: 1.25rem;
    }

    .cpb-facts,
    .cpb-section-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .cpb-deadline {
        border-inline-start: 0;
        border-top: 1px solid var(--cpb-border);
    }

    .cpb-step-date {
        display: none;
    }
}

/* ---------- Print ---------- */

@media print {
    .fi-sidebar,
    .fi-topbar,
    .fi-header-actions-ctn,
    .fi-breadcrumbs,
    .cpb-tabs,
    .cpb-composer,
    .cpb-segmented,
    .cpb-aside .fi-link {
        display: none !important;
    }

    .fi-main-ctn,
    .fi-main {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
    }

    .cpb-card {
        break-inside: avoid;
    }
}

/* ---------- Roles and permissions matrix ---------- */

.cpb-matrix-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cpb-matrix-clinic {
    max-width: 22rem;
}

.cpb-matrix-intro {
    max-width: 48rem;
}

.cpb-matrix-wrap {
    overflow-x: auto;
}

.cpb-matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.cpb-matrix th,
.cpb-matrix td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--cpb-border);
}

.cpb-matrix thead th {
    background: var(--cpb-subtle);
    color: var(--cpb-text);
    text-align: center;
    vertical-align: bottom;
    min-width: 8.5rem;
}

.cpb-matrix .cpb-matrix-corner,
.cpb-matrix .cpb-matrix-permission {
    position: sticky;
    inset-inline-start: 0;
    z-index: 1;
    min-width: 16rem;
    text-align: start;
    background: var(--cpb-surface);
}

.cpb-matrix thead .cpb-matrix-corner {
    background: var(--cpb-subtle);
    color: var(--cpb-text-2);
    font-weight: 500;
}

.cpb-matrix .cpb-matrix-permission {
    font-weight: 400;
    color: var(--cpb-text);
}

.cpb-matrix-role-name {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
}

.cpb-matrix-role-meta {
    display: block;
    margin-top: 0.125rem;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--cpb-text-3);
}

.cpb-matrix-lock {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--cpb-text-3);
}

.cpb-matrix .cpb-matrix-group th {
    padding-block: 0.375rem;
    background: var(--cpb-subtle);
    color: var(--cpb-text-2);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: start;
    text-transform: uppercase;
}

.cpb-matrix-cell {
    text-align: center;
}

.cpb-matrix tbody tr:last-child > * {
    border-bottom: 0;
}

.cpb-matrix-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ---------- Embedding the application form ---------- */

.cpb-embed-layout {
    display: grid;
    gap: 1.5rem;
    align-items: start;
}

@media (min-width: 72rem) {
    .cpb-embed-layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .cpb-embed-preview {
        position: sticky;
        top: 5rem;
    }
}

.cpb-embed-preview {
    padding: 1rem;
}

/* A clinic's own link and frame of the form, under the clinic form */
.cpb-clinic-embed {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.cpb-embed-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.cpb-embed-frame {
    display: block;
    width: 100%;
    height: 70vh;
    margin-top: 0.75rem;
    border: 1px solid var(--cpb-border);
    border-radius: var(--radius-md);
    background: #ffffff;
}

.cpb-code {
    margin: 0.5rem 0 0.75rem;
    padding: 0.75rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    white-space: pre-wrap;
    word-break: break-all;
    background: var(--cpb-subtle);
    border: 1px solid var(--cpb-border);
    border-radius: var(--radius-md);
}

.cpb-callout {
    padding: 0.75rem 1rem;
    color: var(--cpb-warning);
    background: var(--cpb-warning-soft);
    border: 1px solid var(--cpb-warning-icon);
    border-radius: var(--radius-md);
}

.cpb-callout a {
    margin-inline-start: 0.5rem;
    text-decoration: underline;
}

/* ── Clinic report for FUPP ─────────────────────────────────────────────── */

.cpb-report-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.cpb-report-toolbar > div {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 14rem;
}

.cpb-report-figures {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2.5rem;
    margin: 0;
}

.cpb-report-figures dd {
    margin: 0;
    font-size: 1.5rem;
}

.cpb-report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.cpb-report-toolbar > .cpb-report-wide {
    flex: 1 1 22rem;
}
