/**
 * portal-layout.css
 * Sagsportal — Layout, structure and responsive behaviour
 *
 * No colours, no fonts, no visual decorations here.
 * Load order: portal-layout.css → portal-theme-{name}.css → portal-custom.css
 */

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* ── Animations ── */
@keyframes portalFadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes portalOrbDrift {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    40% {
        transform: translate(16px, -18px) scale(1.06);
    }
    70% {
        transform: translate(-10px, 14px) scale(0.96);
    }
}

@keyframes portalBlobDrift {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(28px, -22px) scale(1.07);
    }
    66% {
        transform: translate(-18px, 28px) scale(0.94);
    }
}

@keyframes portalSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.portal-fade-up {
    animation: portalFadeUp 0.4s ease forwards;
}

.portal-d1 {
    animation-delay: 0.05s;
    opacity: 0;
}

.portal-d2 {
    animation-delay: 0.12s;
    opacity: 0;
}

.portal-d3 {
    animation-delay: 0.19s;
    opacity: 0;
}

.portal-d4 {
    animation-delay: 0.26s;
    opacity: 0;
}

.portal-d5 {
    animation-delay: 0.33s;
    opacity: 0;
}

.portal-d5-late {
    animation-delay: 0.44s;
    opacity: 0;
}

/* ── Root ── */
html, body {
    min-height: 100vh;
}

body {
    background: var(--portal-page-bg, transparent);
    color: var(--portal-text-primary);
    transition: background 0.3s, color 0.2s;
}

html {
    font-family: var(--portal-font-family, system-ui, sans-serif);
}

/* ── Background layers (full-page decorative) ── */
.portal-bg-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.portal-bg-geo {
    background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 48px 48px;
}

.portal-bg-dots {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 24px 24px;
}

.portal-bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: portalOrbDrift 10s ease-in-out infinite;
}

.portal-bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    animation: portalBlobDrift 12s ease-in-out infinite;
}

.portal-bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.22;
    background: var(--portal-glow, #2e6da4);
}

.portal-lq-page-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    transition: background 0.4s;
    background: var(--portal-lq-bg, transparent);
}

/* Per-theme background layer colour utilities */
.portal-bg-orb-1 {
    background: var(--portal-orb-1, #0078d4);
}

.portal-bg-orb-2 {
    background: var(--portal-orb-2, #50e6ff);
}

.portal-bg-blob-1 {
    background: var(--portal-blob-1, rgba(99, 179, 237, .5));
}

.portal-bg-blob-2 {
    background: var(--portal-blob-2, rgba(167, 139, 250, .4));
}

.portal-bg-blob-3 {
    background: var(--portal-blob-3, rgba(110, 231, 183, .35));
}

.portal-mt-circle {
    position: absolute;
    border-radius: 50%;
    animation: portalOrbDrift 14s ease-in-out infinite;
}

.portal-mt-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
}

/* Sit above bg layers */
.portal-topbar, .portal-content, .portal-login-page {
    position: relative;
    z-index: 10;
}

/* Inner page wrapper — used by Livewire views inside .portal-content <main>.
   No padding here; all spacing comes from the outer <main class="portal-content">. */
.portal-page {
    position: relative;
    z-index: 10;
    width: 100%;
}

/* ── Topbar ── */
.portal-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 24px;
    z-index: 100;
}

.portal-topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    cursor: pointer;
    text-decoration: none;
}

.portal-topbar-brand:hover .portal-topbar-name {
    opacity: 0.75;
}

.portal-topbar-brand:hover .portal-topbar-icon {
    opacity: 0.75;
}

.portal-topbar-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.portal-topbar-name {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.9;
}

.portal-topbar-search {
    flex: 1;
    max-width: 420px;
    position: relative;
}

.portal-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.portal-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    font-size: 14px;
}

.portal-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.portal-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.12s;
}

.portal-user-avatar:hover {
    opacity: 0.8;
}

.portal-topbar-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 5px 10px;
}

/* ── Page content ── */
.portal-content {
    padding: 80px 24px 60px;
    max-width: 1100px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .portal-content {
        padding: 80px 40px 60px;
    }
}

.portal-content--narrow {
    max-width: 900px;
}

.portal-content--wide {
    max-width: 1280px;
}

/* ── Back link ── */
.portal-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 5px 10px 5px 6px;
    margin-bottom: 20px;
}

/* ── Page header ── */
.portal-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    position: relative;
    z-index: 20;
}

.portal-page-title {
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.portal-page-sub {
    font-size: 14px;
    font-weight: 300;
    margin-bottom: 0;
}

/* ── Panel header (inside card) ── */
.portal-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 12px;
}

.portal-panel-link {
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 8px;
    margin: -6px -8px;
}

/* ── Card heading ── */
.portal-card-heading {
    padding: 14px 20px 12px;
}

/* ── Info rows ── */
.portal-info-rows {
    padding: 0 0 8px;
}

.portal-info-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 18px;
}

.portal-info-val {
    text-align: right;
}

.portal-info-val--strong {
    font-size: 16px;
    font-weight: 600;
}

/* ── Grids ── */
.portal-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.portal-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.portal-grid-top {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.portal-split {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 14px;
    align-items: start;
}

.portal-main-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
}

@media (max-width: 1024px) {
    .portal-grid-top {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 860px) {
    .portal-main-grid {
        grid-template-columns: 1fr;
    }

    .portal-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .portal-grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .portal-grid-top {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .portal-grid-2 {
        grid-template-columns: 1fr;
    }

    .portal-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ── Forms ── */
.portal-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}

.portal-form-hint {
    font-size: 12px;
    line-height: 1.4;
    margin-top: 2px;
}

.portal-form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.portal-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.portal-input {
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
}

.portal-select {
    padding: 9px 12px;
    font-size: 14px;
}

.portal-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    resize: none;
}

.portal-pct-wrap {
    position: relative;
}

.portal-pct-wrap .portal-input {
    padding-right: 28px;
}

.portal-pct-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    pointer-events: none;
}

/* ── Buttons ── */
.portal-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 14px;
}

.portal-button--wide {
    width: 100%;
    justify-content: center;
    padding: 11px;
}

.portal-button--sm {
    padding: 7px 14px;
    font-size: 13px;
}

.portal-button-ghost {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    font-size: 13px;
}

.portal-submit-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ── Collapsible section ── */
.portal-coll-section {
    margin-bottom: 12px;
}

.portal-coll-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    user-select: none;
}

.portal-coll-title {
    font-size: 15px;
    font-weight: 600;
}

.portal-coll-toggle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.portal-coll-toggle .icon-plus {
    display: block;
}

.portal-coll-toggle .icon-minus {
    display: none;
}

.portal-coll-header.open .portal-coll-toggle .icon-plus {
    display: none;
}

.portal-coll-header.open .portal-coll-toggle .icon-minus {
    display: block;
}

.portal-coll-header.open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
}

.portal-coll-body {
    border-top: none;
    border-bottom-left-radius: var(--portal-radius-card);
    border-bottom-right-radius: var(--portal-radius-card);
}

/* ── Data table ── */
.portal-data-table {
    width: 100%;
    border-collapse: collapse;
}

.portal-data-table th {
    padding: 9px 18px;
    text-align: left;
    white-space: nowrap;
}

.portal-data-table td {
    padding: 11px 18px;
    font-size: 13px;
    vertical-align: middle;
}

.portal-data-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.portal-data-table th.num {
    text-align: right;
}

/* ── Message list ── */
.portal-message-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 13px 20px;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px solid var(--portal-divider);
    transition: background 0.12s;
    /* Button reset */
    width: 100%;
    text-align: left;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    font-family: var(--portal-font-family);
    color: inherit;
}

.portal-message-item:last-of-type {
    border-bottom: none;
}

.portal-message-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.portal-message-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
    background: var(--portal-divider);
}

.portal-message-item.unread .portal-message-dot {
    background: var(--portal-accent);
}

.portal-message-body {
    flex: 1;
    min-width: 0;
}

.portal-message-from {
    font-size: 12px;
    margin-bottom: 2px;
}

.portal-message-title {
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-message-item.unread .portal-message-title {
    font-weight: 600;
}

.portal-message-preview {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-message-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}

.portal-message-time {
    font-size: 11px;
}

.portal-message-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 100px;
}

.portal-message-arrow {
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.15s;
    transform: translateX(-3px);
    margin-top: 3px;
}

.portal-message-item:hover .portal-message-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ── Compose area ── */
.portal-compose-area {
    padding: 14px 18px;
}

.portal-compose-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.portal-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

/* ── Item cards ── */
.portal-item {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    position: relative;
}

.portal-item-gc {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.portal-item-g2 {
    grid-template-columns: 1fr 1fr;
}

.portal-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.portal-item-lbl {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.portal-item-val {
    font-size: 14px;
    font-weight: 500;
}

.portal-item-val--big {
    font-size: 18px;
    font-weight: 600;
}

.portal-item-rm {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    background: none;
}

/* ── Creditor dropdown ── */
.portal-creditor-wrap {
    position: relative;
    flex-shrink: 0;
    z-index: 300;
}

.portal-creditor-btn {
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 7px;
    max-width: 220px;
    cursor: pointer;
    padding: 6px 10px 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}

.portal-creditor-name {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: left;
}

.portal-creditor-chevron {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.portal-creditor-wrap.open .portal-creditor-chevron {
    transform: rotate(180deg);
}

.portal-creditor-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 250px;
    overflow: hidden;
    display: none;
    z-index: 200;
}

.portal-creditor-wrap.open .portal-creditor-dropdown {
    display: block;
}

.portal-creditor-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 13px;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--portal-font-family);
}

.portal-creditor-opt-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-creditor-opt-role {
    font-size: 11px;
    margin-top: 1px;
}

/* ── Login layout ── */
.portal-login-page {
    display: flex;
    min-height: 100vh;
}

/* Brand panel — solid background + per-theme decorative layers inside */
.portal-brand-panel {
    display: none;
    width: 50%;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    flex-direction: column;
    justify-content: space-between;
    background: var(--portal-brand-bg, #0f3460);
    transition: background 0.3s;
}

@media (min-width: 1024px) {
    .portal-brand-panel {
        display: flex;
    }
}

/* Form panel — solid surface colour per theme */
.portal-form-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 24px;
    background: var(--portal-surface, transparent);
    transition: background 0.3s;
}

/* Form card — varies dramatically per theme (Fluent=none, Liquid=glass, Linux/Material=shadow box) */
.portal-form-inner {
    width: 100%;
    max-width: 360px;
    background: var(--portal-form-card-bg, transparent);
    border: 1px solid var(--portal-form-card-border, transparent);
    border-radius: var(--portal-form-card-radius, 0);
    padding: var(--portal-form-card-padding, 0);
    box-shadow: var(--portal-form-card-shadow, none);
    transition: background 0.3s, border-color 0.25s;
}

@media (min-width: 1024px) {
    .portal-mob-brand {
        display: none;
    }
}

.portal-input-group {
    margin-bottom: 16px;
}

/* ── Mobile responsive ── */
@media (max-width: 480px) {
    .portal-content {
        padding: 72px 16px 48px;
    }

    .portal-topbar {
        padding: 0 16px;
    }

    .portal-topbar-search {
        display: none;
    }

    .portal-data-table {
        display: block;
    }

    .portal-data-table thead {
        display: none;
    }

    .portal-data-table tbody {
        display: block;
    }

    .portal-data-table tr {
        display: flex;
        flex-wrap: wrap;
        gap: 12px 16px;
        padding: 14px 16px;
    }

    .portal-data-table td {
        display: flex;
        flex-direction: column;
        padding: 0;
        border-bottom: none !important;
        flex: 1 1 auto;
        min-width: 90px;
    }

    .portal-data-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        margin-bottom: 3px;
    }

    .portal-data-table td.num {
        text-align: left;
    }

    .portal-coll-title {
        font-size: 14px;
    }

    .portal-pay-tabs {
        flex-wrap: wrap;
    }

    .portal-pay-tab {
        flex: 1 1 calc(50% - 4px);
        font-size: 12px;
        padding: 8px 6px;
    }
}

/* ── Dashboard ── */
.portal-dashboard-welcome {
    margin-bottom: 0;
}

.portal-action-tiles {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.portal-action-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    min-width: 200px;
    text-decoration: none;
}

.portal-action-tile-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--portal-text-primary);
}

.portal-action-tile-sub {
    font-size: 12px;
    color: var(--portal-text-secondary);
    margin-top: 2px;
}

.portal-tile-arrow {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--portal-text-muted);
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    transform: translateX(-3px);
}

.portal-action-tile:hover .portal-tile-arrow,
.portal-status-row:hover .portal-tile-arrow,
.portal-activity-item:hover .portal-tile-arrow {
    opacity: 1;
    transform: translateX(0);
}

.portal-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 20px;
    border-bottom: 1px solid var(--portal-divider);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.portal-status-row:last-child {
    border-bottom: none;
}

.portal-status-row:hover {
    background: rgba(255, 255, 255, .05);
}

.portal-status-count {
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-status-count-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--portal-text-primary);
}

.portal-arrears-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 20px;
    border-top: 1px solid var(--portal-divider);
}

.portal-arrears-label {
    font-size: 12px;
    color: var(--portal-text-muted);
}

.portal-arrears-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--portal-text-primary);
    font-variant-numeric: tabular-nums;
}

.portal-activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 20px;
    border-bottom: 1px solid var(--portal-divider);
    text-decoration: none;
    transition: background 0.12s;
}

.portal-activity-item:last-child {
    border-bottom: none;
}

.portal-activity-item:hover {
    background: rgba(255, 255, 255, .05);
}

.portal-activity-number {
    font-size: 13px;
    font-weight: 500;
    color: var(--portal-text-primary);
}

.portal-activity-flow {
    font-size: 11px;
    color: var(--portal-text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.portal-activity-time {
    font-size: 11px;
    color: var(--portal-text-muted);
    margin-top: 1px;
}

.portal-right-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.portal-empty-state {
    padding: 28px 20px;
    text-align: center;
    color: var(--portal-text-muted);
    font-size: 14px;
}

/* ── Payment success toast ── */
.portal-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: var(--portal-radius-card);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    animation: portalToastIn 0.25s ease forwards;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

.portal-toast--success {
    background: rgb(25, 128, 56);
    color: #fff;
}

@keyframes portalToastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes portalToastOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
}

.portal-toast.hiding {
    animation: portalToastOut 0.25s ease forwards;
}

/* ── Dashboard 12-column grid ── */
.portal-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: auto;
    gap: 1rem;

    .portal-dashboard-grid {
        display: grid;
        grid-template-columns: repeat(12, 1fr);
        grid-auto-rows: auto;
        align-items: stretch;
        gap: 16px;
    }
}

@media (max-width: 1024px) {
    .portal-dashboard-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 680px) {
    .portal-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .portal-dashboard-grid > * {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
    }
}

/* ── Charts ── */

/* Grid items are flex columns so children can fill the row height */
.portal-dashboard-grid > * {
    display: flex;
    flex-direction: column;
}

/* portal-card fills the grid cell — handles both direct child and
   Livewire components with a single intermediate wrapper div */
.portal-dashboard-grid > * > .portal-card,
.portal-dashboard-grid > * > * > .portal-card {
    flex: 1;
    min-height: 0;
}

/* portal-card is always a flex column so inner content can grow */
.portal-card {
    display: flex;
    flex-direction: column;
}

.portal-charts-thirds {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.portal-charts-thirds--reverse {
    grid-template-columns: 1fr 2fr;
}

@media (max-width: 860px) {
    .portal-charts-thirds,
    .portal-charts-thirds--reverse {
        grid-template-columns: 1fr;
    }
}

/* ── Charts ── */

/* Chart card — no padding; header and body handle their own spacing */
.portal-chart-card {
    padding: 0;
}

.portal-chart-card--fill {
    display: flex;
    flex-direction: column;
}

/* Chart header — matches portal-panel-header exactly */
.portal-chart-title {
    font-size: var(--portal-label-size, 11px);
    font-weight: var(--portal-label-weight, 600);
    color: var(--portal-text-secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 14px 20px 0;
}

/* Sub-title closes the header area with border-bottom */
.portal-chart-sub {
    font-size: 11px;
    color: var(--portal-text-muted);
    padding: 3px 20px 12px;
    border-bottom: 1px solid var(--portal-divider);
}

/* Fixed-height canvas wrap (non-fill charts) */
.portal-chart-canvas-wrap {
    position: relative;
    height: 220px;
    margin: 16px 20px 20px;
}

/* Flex canvas wrap (fill charts) */
.portal-chart-canvas-wrap--flex {
    flex: 1;
    min-height: 0;
    position: relative;
    margin: 12px 20px 20px;
}

.portal-chart-canvas-wrap--tall {
    height: 200px;
    margin: 16px 20px 20px;
}

.portal-gauge-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 20px;
    pointer-events: none;
}

.portal-gauge-pct {
    font-size: 28px;
    font-weight: 700;
    color: var(--portal-text-primary);
    line-height: 1;
}

.portal-gauge-label {
    font-size: 11px;
    font-weight: var(--portal-label-weight);
    text-transform: var(--portal-label-transform);
    letter-spacing: 0.05em;
    color: var(--portal-text-muted);
    margin-top: 4px;
}

.portal-gauge-stats {
    display: flex;
    gap: 20px;
    margin: 0 20px 20px;
    justify-content: center;
}

.portal-gauge-stat {
    text-align: center;
}

.portal-gauge-stat-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--portal-text-primary);
    font-variant-numeric: tabular-nums;
}

.portal-gauge-stat-lbl {
    font-size: 11px;
    color: var(--portal-text-muted);
    margin-top: 2px;
    font-weight: var(--portal-label-weight);
    text-transform: var(--portal-label-transform);
    letter-spacing: 0.04em;
}

@media (max-width: 860px) {
    .portal-charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Filter bar ── */
.portal-filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.portal-filter-label {
    font-size: var(--portal-label-size);
    font-weight: var(--portal-label-weight);
    text-transform: var(--portal-label-transform);
    letter-spacing: 0.05em;
    color: var(--portal-text-muted);
    margin-right: 2px;
}

.portal-filter-chip {
    padding: 5px 13px;
    font-size: 13px;
    font-family: var(--portal-font-family);
    font-weight: 500;
    border-radius: var(--portal-radius-badge);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    white-space: nowrap;
}

.portal-filter-chip:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.portal-filter-sep {
    width: 1px;
    height: 18px;
    background: var(--portal-divider);
    margin: 0 2px;
    flex-shrink: 0;
}

.portal-filter-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--portal-text-muted);
    white-space: nowrap;
}

/* ── Files table ── */
.portal-files-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.portal-files-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.portal-files-table th {
    padding: 9px 16px;
    text-align: left;
    font-size: var(--portal-label-size);
    font-weight: var(--portal-label-weight);
    text-transform: var(--portal-label-transform);
    letter-spacing: 0.04em;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.portal-files-table td {
    padding: 12px 16px;
    font-size: 13px;
    vertical-align: middle;
    border-top: 1px solid var(--portal-divider);
}

.portal-files-table tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

.portal-files-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.portal-files-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.portal-file-nr {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--portal-text-primary);
}

.portal-file-debtor-name {
    font-size: 13px;
    color: var(--portal-text-primary);
}

.portal-file-debtor-addr {
    font-size: 11px;
    color: var(--portal-text-muted);
    margin-top: 1px;
}

.portal-row-arrow {
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    transform: translateX(-3px);
    color: var(--portal-text-muted);
}

.portal-files-table tbody tr:hover .portal-row-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ── Pagination ── */
.portal-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--portal-divider);
    gap: 12px;
    flex-wrap: wrap;
}

.portal-pagination-info {
    font-size: 12px;
    color: var(--portal-text-muted);
}

.portal-pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.portal-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
    font-family: var(--portal-font-family);
    border-radius: var(--portal-radius-tile);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.portal-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Login — brand panel interior ── */
.portal-brand-inner {
    position: relative;
    z-index: 10;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px;
}

.portal-brand-product-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .45);
    margin-bottom: 14px;
}

.portal-brand-tagline {
    font-size: clamp(38px, 3.2vw, 45px);
    font-weight: 300;
    line-height: 1.2;
    letter-spacing: -.02em;
    color: #fff;
}

.portal-brand-tagline strong {
    font-weight: 600;
}

.portal-brand-description {
    font-size: 14px;
    line-height: 1.78;
    font-weight: 300;
    color: rgba(255, 255, 255, .42);
    max-width: 310px;
    margin-top: 16px;
}

.portal-brand-blobs {
    display: flex;
    gap: 10px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.portal-brand-blob {
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: var(--portal-radius-card);
    padding: 13px 17px;
}

.portal-brand-blob-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .45);
    margin-bottom: 3px;
}

.portal-brand-blob-value {
    font-size: 15px;
    font-weight: 300;
    color: #fff;
}

.portal-brand-divider {
    height: 1px;
    background: rgba(255, 255, 255, .12);
    margin-bottom: 20px;
}

.portal-brand-badges {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.portal-brand-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255, 255, 255, .35);
    font-size: 12px;
}

/* ── Login — mobile brand header ── */
.portal-mob-brand {
    margin-bottom: 28px;
}

.portal-mob-brand-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-mob-brand-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--portal-text-secondary);
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* ── Login — form ── */
.portal-login-heading {
    margin-bottom: 24px;
}

.portal-login-title {
    margin-bottom: 5px;
}

.portal-login-subtitle {
    font-size: 14px;
    color: var(--portal-text-secondary);
    font-weight: 300;
}

.portal-auth-error {
    background: rgba(209, 52, 56, .12);
    border: 1px solid rgba(209, 52, 56, .25);
    border-radius: var(--portal-radius-input);
    padding: 10px 14px;
    font-size: 13px;
    color: #ff7a7a;
    margin-bottom: 20px;
}

/* ── User message banner (above login form) ── */
.portal-user-message {
    width: 100%;
    max-width: 360px;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    white-space: pre-wrap;
    background: var(--portal-form-card-bg, transparent);
    border: 1px solid var(--portal-form-card-border, transparent);
    border-radius: var(--portal-form-card-radius, 0);
    box-shadow: var(--portal-form-card-shadow, none);
    color: var(--portal-text-primary);
    transition: background 0.3s, border-color 0.25s;
}

[data-theme="liquid-glass"] .portal-user-message {
    backdrop-filter: blur(52px) saturate(200%);
    -webkit-backdrop-filter: blur(52px) saturate(200%);
}

@media (max-width: 1023px) {
    .portal-user-message {
        background: none;
        border: none;
        box-shadow: none;
        padding: 0 0 12px;
    }
}

.portal-form-group--login {
    margin-bottom: 16px;
}

.portal-form-label {
    display: block;
    margin-bottom: 5px;
}

.portal-input--error {
    border-color: rgb(209, 52, 56);
}

.portal-field-error {
    font-size: 12px;
    color: rgb(209, 52, 56);
    margin-top: 4px;
}

.portal-password-wrap {
    position: relative;
}

.portal-password-wrap .portal-input {
    padding-right: 42px;
}

.portal-password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--portal-text-muted);
    padding: 3px;
    line-height: 0;
}

.portal-login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.portal-remember-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--portal-text-secondary);
}

.portal-checkbox {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    background: var(--portal-input-bg);
    border: 1px solid var(--portal-input-border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: background 0.13s, border-color 0.13s, box-shadow 0.13s;
}

.portal-checkbox:hover {
    border-color: var(--portal-input-border-focus);
    box-shadow: 0 0 0 3px var(--portal-accent-ring);
}

.portal-checkbox:focus {
    outline: none;
    border-color: var(--portal-input-border-focus);
    box-shadow: 0 0 0 3px var(--portal-accent-ring);
}

.portal-checkbox:checked {
    background: var(--portal-accent);
    border-color: var(--portal-accent);
}

.portal-checkbox:checked:focus {
    box-shadow: 0 0 0 3px var(--portal-accent-ring);
}

.portal-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

/* Legacy alias — keep login "remember me" working */
.portal-remember-checkbox {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    background: var(--portal-input-bg);
    border: 1px solid var(--portal-input-border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: background 0.13s, border-color 0.13s, box-shadow 0.13s;
}

.portal-remember-checkbox:hover {
    border-color: var(--portal-input-border-focus);
    box-shadow: 0 0 0 3px var(--portal-accent-ring);
}

.portal-remember-checkbox:focus {
    outline: none;
    border-color: var(--portal-input-border-focus);
    box-shadow: 0 0 0 3px var(--portal-accent-ring);
}

.portal-remember-checkbox:checked {
    background: var(--portal-accent);
    border-color: var(--portal-accent);
}

.portal-remember-checkbox:checked:focus {
    box-shadow: 0 0 0 3px var(--portal-accent-ring);
}

.portal-remember-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.portal-forgot-link {
    color: var(--portal-accent);
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.portal-button-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.portal-loading-spinner {
    animation: portalSpin .8s linear infinite;
}

.portal-login-support {
    margin-top: 20px;
}

.portal-login-support .portal-divider {
    height: 1px;
    margin-bottom: 20px;
}

.portal-support-text {
    font-size: 12px;
    color: var(--portal-text-muted);
    text-align: center;
}

.portal-support-link {
    color: var(--portal-accent);
    font-weight: 500;
    text-decoration: none;
}

.portal-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
