:root {
    --ap-sidebar-width: 272px;
    --ap-topbar-height: 76px;
    --ap-mobile-nav-height: 72px;
    --ap-page-max: 1440px;
    --ap-radius-xs: 10px;
    --ap-radius-sm: 14px;
    --ap-radius-md: 20px;
    --ap-radius-lg: 28px;
    --ap-radius-organic: 26px 26px 26px 10px;
    --ap-motion: 180ms ease;

    --ap-font-body:
        "Segoe UI Variable Text",
        "SF Pro Text",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Noto Sans",
        "Noto Sans Arabic",
        Tahoma,
        Arial,
        sans-serif;

    --ap-font-display:
        "Segoe UI Variable Display",
        "SF Pro Display",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Noto Sans",
        "Noto Sans Arabic",
        Tahoma,
        Arial,
        sans-serif;

    --ap-bg: #151b1a;
    --ap-bg-raised: #1a2321;
    --ap-surface: #202b28;
    --ap-surface-2: #293631;
    --ap-surface-3: #33423c;
    --ap-surface-soft: rgba(148, 199, 180, 0.12);

    --ap-border: rgba(232, 243, 238, 0.12);
    --ap-border-strong: rgba(232, 243, 238, 0.22);

    --ap-text: #f7faf8;
    --ap-text-soft: #d6dfdb;
    --ap-muted: #aab8b2;

    --ap-primary: #94c7b4;
    --ap-primary-strong: #b3dfcf;
    --ap-primary-ink: #0d1e18;

    --ap-blue: #9fc5df;
    --ap-info: #9fcbea;
    --ap-danger: #f0a29e;
    --ap-danger-soft: rgba(240, 162, 158, 0.14);
    --ap-warning: #e6c58e;
    --ap-success: #9fd0b1;

    --ap-shadow: 0 20px 58px rgba(3, 8, 6, 0.28);
    --ap-shadow-soft: 0 12px 34px rgba(3, 8, 6, 0.2);
    --ap-focus-ring: rgba(148, 199, 180, 0.28);
    --ap-shell-glass: rgba(20, 28, 25, 0.96);
    --ap-topbar-glass: rgba(21, 27, 26, 0.91);

    --bs-body-color: var(--ap-text);
    --bs-body-color-rgb: 247, 250, 248;
    --bs-body-bg: var(--ap-bg);
    --bs-body-bg-rgb: 21, 27, 26;
    --bs-emphasis-color: var(--ap-text);
    --bs-emphasis-color-rgb: 247, 250, 248;
    --bs-secondary-color: var(--ap-muted);
    --bs-secondary-color-rgb: 170, 184, 178;
    --bs-tertiary-color: var(--ap-muted);
    --bs-border-color: var(--ap-border);
    --bs-border-color-translucent: var(--ap-border);
    --bs-link-color: var(--ap-primary-strong);
    --bs-link-hover-color: var(--ap-text);
}

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

html {
    min-height: 100%;
    background: var(--ap-bg);
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 92% 4%, rgba(105, 151, 134, 0.08), transparent 28rem),
        var(--ap-bg);
    color: var(--ap-text);
    font-family: var(--ap-font-body);
    font-size: 1rem;
    line-height: 1.58;
    font-weight: 450;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--ap-primary-strong);
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--ap-text);
}

button,
input,
select,
textarea {
    font: inherit;
}

::selection {
    color: var(--ap-primary-ink);
    background: var(--ap-primary-strong);
}

.ap-skip-link {
    position: fixed;
    z-index: 3000;
    top: 0.75rem;
    inset-inline-start: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: var(--ap-radius-sm);
    background: var(--ap-primary);
    color: var(--ap-primary-ink);
}

.ap-sidebar {
    position: fixed;
    z-index: 1040;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--ap-sidebar-width);
    flex-direction: column;
    padding: 1.1rem;
    border-inline-end: 1px solid var(--ap-border);
    background: var(--ap-shell-glass);
    backdrop-filter: blur(18px);
}

.ap-sidebar-brand {
    padding: 0.4rem 0.35rem 1.4rem;
}

.ap-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--ap-text);
    text-decoration: none;
}

.ap-brand-link > span:last-child {
    display: grid;
}

.ap-brand-link strong {
    font-size: 1.04rem;
    letter-spacing: -0.02em;
}

.ap-brand-link small {
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-brand-shape {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 16px 16px 16px 5px;
    background: linear-gradient(145deg, var(--ap-primary-strong), var(--ap-primary));
    color: var(--ap-primary-ink);
    font-size: 0.73rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    box-shadow: 0 8px 22px rgba(98, 157, 135, 0.17);
}

.ap-sidebar-nav {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 0.3rem;
    overflow-y: auto;
    padding: 0 0.2rem 1rem;
    scrollbar-width: thin;
}

.ap-nav-eyebrow,
.ap-menu-label {
    margin: 0.8rem 0.75rem 0.45rem;
    color: var(--ap-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.ap-sidebar-link {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    gap: 0.8rem;
    padding: 0.72rem 0.86rem;
    border: 0;
    border-radius: 16px 16px 16px 6px;
    background: transparent;
    color: var(--ap-text-soft);
    text-align: start;
    text-decoration: none;
    transition:
        color var(--ap-motion),
        background var(--ap-motion),
        transform var(--ap-motion);
}

.ap-sidebar-link:hover,
.ap-sidebar-link:focus-visible {
    background: var(--ap-surface-soft);
    color: var(--ap-text);
    transform: translateX(2px);
}

[dir="rtl"] .ap-sidebar-link:hover,
[dir="rtl"] .ap-sidebar-link:focus-visible {
    transform: translateX(-2px);
}

.ap-sidebar-link.active {
    background: linear-gradient(115deg, rgba(133, 184, 165, 0.18), rgba(133, 184, 165, 0.07));
    color: var(--ap-primary-strong);
    font-weight: 750;
}

.ap-sidebar-link.active::before {
    position: absolute;
    inset-block: 11px;
    inset-inline-start: -0.2rem;
    width: 3px;
    border-radius: 999px;
    background: var(--ap-primary);
    content: "";
}

.ap-sidebar-button {
    cursor: pointer;
}

.ap-nav-glyph,
.ap-menu-icon {
    display: grid;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    place-items: center;
    border-radius: 8px;
    color: currentColor;
    font-size: 1.05rem;
    font-weight: 800;
}

.ap-nav-count {
    min-width: 1.55rem;
    margin-inline-start: auto;
    padding: 0.12rem 0.42rem;
    border-radius: 999px;
    background: var(--ap-primary);
    color: var(--ap-primary-ink);
    font-size: 0.7rem;
    font-weight: 900;
    text-align: center;
}

.ap-sidebar-profile {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.72rem;
    padding: 0.75rem;
    border: 1px solid var(--ap-border);
    border-radius: 20px 20px 20px 8px;
    background: var(--ap-surface);
    color: var(--ap-text);
    text-align: start;
    transition: border-color var(--ap-motion), transform var(--ap-motion);
}

.ap-sidebar-profile:hover {
    border-color: var(--ap-border-strong);
    transform: translateY(-1px);
}

.ap-sidebar-profile-copy {
    display: grid;
    min-width: 0;
    flex: 1;
}

.ap-sidebar-profile-copy strong,
.ap-sidebar-profile-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-sidebar-profile-copy small {
    color: var(--ap-muted);
    font-size: 0.73rem;
}

.ap-avatar,
.ap-mini-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border: 1px solid rgba(165, 209, 192, 0.18);
    border-radius: 50% 50% 50% 14px;
    background: linear-gradient(145deg, var(--ap-surface-3), var(--ap-surface-2));
    color: var(--ap-primary-strong);
    font-size: 0.72rem;
    font-weight: 900;
}

.ap-avatar-large {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    font-size: 0.86rem;
}

.ap-topbar {
    position: fixed;
    z-index: 1030;
    inset-block-start: 0;
    inset-inline: var(--ap-sidebar-width) 0;
    display: flex;
    height: var(--ap-topbar-height);
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--ap-border);
    background: var(--ap-topbar-glass);
    backdrop-filter: blur(18px);
}

.ap-topbar-start,
.ap-topbar-actions,
.ap-context-copy {
    display: flex;
    align-items: center;
}

.ap-topbar-start {
    min-width: 0;
    gap: 0.8rem;
}

.ap-topbar-actions {
    gap: 0.55rem;
}

.ap-context-copy {
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
}

.ap-context-copy strong {
    max-width: 30vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-context-label {
    color: var(--ap-muted);
    font-size: 0.7rem;
}

.ap-area-switcher select,
.ap-home-area-filter select {
    min-width: 190px;
    border-radius: 14px 14px 14px 6px;
}

.ap-workspace-button,
.ap-profile-trigger,
.ap-topbar-icon {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border: 1px solid var(--ap-border);
    border-radius: 15px 15px 15px 6px;
    background: var(--ap-surface);
    color: var(--ap-text-soft);
    text-decoration: none;
    transition: border-color var(--ap-motion), background var(--ap-motion), color var(--ap-motion);
}

.ap-workspace-button {
    padding: 0.55rem 0.8rem;
}

.ap-profile-trigger {
    padding: 0.25rem 0.65rem 0.25rem 0.3rem;
}

[dir="rtl"] .ap-profile-trigger {
    padding: 0.25rem 0.3rem 0.25rem 0.65rem;
}

.ap-topbar-icon {
    position: relative;
    width: 42px;
    font-size: 0.65rem;
}

.ap-workspace-button:hover,
.ap-profile-trigger:hover,
.ap-topbar-icon:hover,
.ap-topbar-icon.active {
    border-color: var(--ap-border-strong);
    background: var(--ap-surface-2);
    color: var(--ap-primary-strong);
}

.ap-notification-dot {
    position: absolute;
    inset-block-start: -0.38rem;
    inset-inline-end: -0.35rem;
    min-width: 1.25rem;
    padding: 0.08rem 0.32rem;
    border: 2px solid var(--ap-bg-raised);
    border-radius: 999px;
    background: var(--ap-danger);
    color: #1c0b0a;
    font-size: 0.62rem;
    font-weight: 900;
}

.ap-page-shell {
    min-height: 100vh;
    padding-block-start: var(--ap-topbar-height);
    padding-inline-start: var(--ap-sidebar-width);
}

.ap-main-content {
    width: min(100%, var(--ap-page-max));
    min-height: calc(100vh - var(--ap-topbar-height) - 70px);
    margin-inline: auto;
    padding: 1.7rem clamp(1rem, 3vw, 2.2rem) 2.4rem;
}

.ap-footer {
    display: flex;
    width: min(100%, var(--ap-page-max));
    margin-inline: auto;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 3vw, 2.2rem) 1.5rem;
    color: var(--ap-muted);
    font-size: 0.78rem;
}

.ap-footer a {
    color: inherit;
}

.ap-guest .ap-page-shell {
    padding: 0;
}

.ap-guest .ap-main-content {
    min-height: calc(100vh - 140px);
    padding-top: 2.5rem;
}

.ap-guest-header {
    display: flex;
    width: min(100% - 2rem, var(--ap-page-max));
    min-height: 78px;
    margin-inline: auto;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ap-guest-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ap-mega-menu {
    width: min(360px, calc(100vw - 2rem));
    max-height: min(670px, calc(100vh - 7rem));
    overflow-y: auto;
    padding: 0.65rem;
    border: 1px solid var(--ap-border-strong);
    border-radius: 22px 22px 22px 9px;
    background: var(--ap-surface);
    box-shadow: var(--ap-shadow);
}

.ap-workspace-dropdown .ap-mega-menu {
    inset-inline-start: 0 !important;
    transform: translate3d(0, 49px, 0) !important;
}

.ap-menu-section + .ap-menu-section {
    margin-top: 0.65rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--ap-border);
}

.ap-menu-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 44px;
    padding: 0.62rem 0.72rem;
    border-radius: 13px 13px 13px 5px;
    color: var(--ap-text-soft);
    text-decoration: none;
}

.ap-menu-link:hover {
    background: var(--ap-surface-2);
    color: var(--ap-text);
}

.ap-profile-panel,
.ap-action-sheet {
    border-color: var(--ap-border);
    background: var(--ap-bg-raised);
    color: var(--ap-text);
}

.ap-profile-panel {
    width: min(420px, 100vw);
}

.ap-profile-panel-head {
    padding: 1.3rem;
    border-bottom: 1px solid var(--ap-border);
}

.ap-profile-email {
    max-width: 265px;
    overflow: hidden;
    color: var(--ap-muted);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-profile-section {
    padding: 0.55rem 0 1rem;
}

.ap-profile-section + .ap-profile-section {
    border-top: 1px solid var(--ap-border);
}

.ap-profile-row {
    display: grid;
    width: 100%;
    min-height: 50px;
    grid-template-columns: 24px 1fr 18px;
    align-items: center;
    gap: 0.7rem;
    padding: 0.72rem 0.78rem;
    border: 0;
    border-radius: 14px 14px 14px 6px;
    background: transparent;
    color: var(--ap-text-soft);
    text-align: start;
    text-decoration: none;
}

.ap-profile-row:hover {
    background: var(--ap-surface-2);
    color: var(--ap-text);
}

.ap-profile-row-danger {
    color: var(--ap-danger);
}

.ap-preference-row {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.55rem 0.78rem;
}

.ap-segmented-control {
    display: inline-flex;
    padding: 0.22rem;
    border: 1px solid var(--ap-border);
    border-radius: 12px;
    background: var(--ap-bg);
}

.ap-segmented-control button {
    min-height: 34px;
    padding: 0.35rem 0.68rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ap-muted);
    font-size: 0.76rem;
    font-weight: 750;
}

.ap-segmented-control button.active {
    background: var(--ap-primary);
    color: var(--ap-primary-ink);
}

.ap-action-sheet {
    height: auto !important;
    max-height: min(82vh, 720px);
    border-radius: 28px 28px 0 0;
}

.ap-action-sheet .offcanvas-header {
    padding: 1.25rem 1.25rem 0.75rem;
}

.ap-action-sheet .offcanvas-body {
    padding: 0.75rem 1.25rem calc(1.4rem + env(safe-area-inset-bottom));
}

.ap-sheet-kicker {
    color: var(--ap-muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.ap-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.ap-action-tile {
    display: flex;
    min-height: 92px;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid var(--ap-border);
    border-radius: 20px 20px 20px 8px;
    background: var(--ap-surface);
    color: var(--ap-text);
    text-decoration: none;
}

.ap-action-tile:hover {
    border-color: var(--ap-border-strong);
    background: var(--ap-surface-2);
    color: var(--ap-text);
    transform: translateY(-1px);
}

.ap-action-symbol {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 15px 15px 15px 5px;
    background: var(--ap-surface-soft);
    color: var(--ap-primary-strong);
    font-size: 1.2rem;
    font-weight: 850;
}

.ap-action-tile > span:last-child {
    display: grid;
    min-width: 0;
}

.ap-action-tile small {
    margin-top: 0.15rem;
    color: var(--ap-muted);
    font-size: 0.75rem;
}

.ap-mobile-workspace-block {
    margin-top: 1rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--ap-border);
}

/* Home */
.ap-dashboard-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.45rem;
}

.ap-dashboard-hero h1 {
    margin: 0.18rem 0 0.3rem;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 760;
    letter-spacing: -0.055em;
}

.ap-dashboard-hero p {
    max-width: 720px;
    margin: 0;
    color: var(--ap-muted);
}

.ap-eyebrow {
    color: var(--ap-primary);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.ap-home-area-filter {
    display: grid;
    min-width: 220px;
    gap: 0.35rem;
}

.ap-home-area-filter label {
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-balance-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.ap-balance-card {
    position: relative;
    min-height: 208px;
    overflow: hidden;
    padding: 1.15rem;
    border: 1px solid var(--ap-border);
    border-radius: 30px 30px 30px 11px;
    background:
        linear-gradient(145deg, rgba(135, 184, 166, 0.08), transparent 60%),
        var(--ap-surface);
    box-shadow: var(--ap-shadow-soft);
}

.ap-balance-card::after {
    position: absolute;
    width: 130px;
    height: 130px;
    inset-block-end: -65px;
    inset-inline-end: -45px;
    border: 24px solid rgba(135, 184, 166, 0.06);
    border-radius: 50%;
    content: "";
}

.ap-balance-card.is-settled {
    background: var(--ap-surface);
    box-shadow: none;
}

.ap-balance-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ap-currency-pill,
.ap-status-chip,
.ap-settled-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    width: fit-content;
    padding: 0.28rem 0.58rem;
    border: 1px solid var(--ap-border-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--ap-text-soft);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.04em;
}

.ap-settled-label {
    color: var(--ap-success);
}

.ap-balance-amount {
    margin-top: 1.15rem;
    font-size: clamp(2.05rem, 5vw, 3.1rem);
    font-weight: 790;
    letter-spacing: -0.055em;
    line-height: 1;
}

.ap-balance-caption {
    margin-top: 0.35rem;
    color: var(--ap-muted);
    font-size: 0.8rem;
}

.ap-balance-meta {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 1.4rem;
    margin-top: 1rem;
}

.ap-balance-meta span {
    display: grid;
}

.ap-balance-meta small {
    color: var(--ap-muted);
    font-size: 0.68rem;
}

.ap-home-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    margin-bottom: 1.35rem;
}

.ap-home-metrics article {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--ap-border);
    border-radius: 18px 18px 18px 7px;
    background: var(--ap-bg-raised);
}

.ap-home-metrics span {
    color: var(--ap-muted);
    font-size: 0.78rem;
}

.ap-home-metrics strong {
    font-size: 1.15rem;
}

.ap-section-block {
    margin-bottom: 1rem;
    padding: clamp(1rem, 2vw, 1.35rem);
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-lg) var(--ap-radius-lg) var(--ap-radius-lg) 11px;
    background: var(--ap-bg-raised);
}

.ap-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ap-section-heading h2 {
    margin: 0.16rem 0 0.2rem;
    font-size: clamp(1.25rem, 3vw, 1.65rem);
    font-weight: 740;
    letter-spacing: -0.035em;
}

.ap-section-heading p {
    max-width: 670px;
    margin: 0;
    color: var(--ap-muted);
    font-size: 0.84rem;
}

.ap-text-link {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.6rem;
    border-radius: 10px;
    color: var(--ap-primary-strong);
    font-size: 0.8rem;
    font-weight: 750;
    text-decoration: none;
}

.ap-text-link:hover {
    background: var(--ap-surface-soft);
}

.ap-statement-stack {
    display: grid;
    gap: 0.85rem;
}

.ap-statement-group {
    overflow: hidden;
    border: 1px solid var(--ap-border);
    border-radius: 23px 23px 23px 8px;
    background: var(--ap-surface);
}

.ap-statement-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--ap-border);
    background: linear-gradient(90deg, var(--ap-surface-soft), transparent);
}

.ap-statement-group-head > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ap-statement-group-head h3 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 780;
    letter-spacing: -0.035em;
}

.ap-statement-group-head > span {
    color: var(--ap-muted);
    font-size: 0.75rem;
}

.ap-bill-list {
    display: grid;
}

.ap-bill-row {
    display: block;
    padding: 1rem;
    border-bottom: 1px solid var(--ap-border);
    color: var(--ap-text);
    text-decoration: none;
    transition: background var(--ap-motion);
}

.ap-bill-row:last-child {
    border-bottom: 0;
}

.ap-bill-row:hover {
    background: var(--ap-surface-2);
    color: var(--ap-text);
}

.ap-bill-row.is-overdue {
    background: linear-gradient(90deg, var(--ap-danger-soft), transparent 68%);
}

.ap-bill-row-main,
.ap-bill-row-title,
.ap-bill-money-line {
    display: flex;
    align-items: center;
}

.ap-bill-row-main {
    justify-content: space-between;
    gap: 1rem;
}

.ap-bill-row-title {
    min-width: 0;
    gap: 0.75rem;
}

.ap-bill-row-title > span:last-child {
    display: grid;
    min-width: 0;
}

.ap-bill-row-title strong,
.ap-bill-row-title small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-bill-row-title small,
.ap-bill-period {
    color: var(--ap-muted);
    font-size: 0.74rem;
}

.ap-bill-shape,
.ap-area-shape {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border-radius: 14px 14px 14px 5px;
    background: var(--ap-surface-soft);
    color: var(--ap-primary-strong);
    font-size: 1rem;
}

.ap-status-chip.danger {
    border-color: rgba(223, 141, 137, 0.23);
    background: var(--ap-danger-soft);
    color: var(--ap-danger);
}

.ap-bill-period {
    margin: 0.6rem 0 0;
    padding-inline-start: 3.25rem;
}

.ap-bill-money-line {
    justify-content: flex-end;
    gap: clamp(1rem, 4vw, 3rem);
    margin-top: 0.75rem;
}

.ap-bill-money-line span {
    display: grid;
}

.ap-bill-money-line small {
    color: var(--ap-muted);
    font-size: 0.66rem;
}

.ap-bill-outstanding strong {
    color: var(--ap-primary-strong);
}

.ap-progress-track {
    height: 4px;
    margin-top: 0.75rem;
    overflow: hidden;
    border-radius: 99px;
    background: var(--ap-bg);
}

.ap-progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--ap-primary), var(--ap-primary-strong));
}

.ap-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ap-quick-actions a {
    display: grid;
    min-height: 118px;
    align-content: center;
    gap: 0.2rem;
    padding: 1rem;
    border: 1px solid var(--ap-border);
    border-radius: 22px 22px 22px 8px;
    background: var(--ap-surface);
    color: var(--ap-text);
    text-decoration: none;
}

.ap-quick-actions a:hover {
    border-color: var(--ap-border-strong);
    background: var(--ap-surface-2);
}

.ap-quick-actions a > span {
    color: var(--ap-primary-strong);
    font-size: 1.25rem;
}

.ap-quick-actions small {
    color: var(--ap-muted);
    font-size: 0.74rem;
}

.ap-home-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.ap-feed-list {
    display: grid;
}

.ap-feed-row {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
    padding: 0.78rem 0.15rem;
    border-bottom: 1px solid var(--ap-border);
    color: var(--ap-text);
    text-decoration: none;
}

.ap-feed-row:last-child {
    border-bottom: 0;
}

.ap-feed-row:hover {
    color: var(--ap-text);
}

.ap-feed-row > span:nth-child(2) {
    display: grid;
    min-width: 0;
}

.ap-feed-row small,
.ap-feed-row time {
    overflow: hidden;
    color: var(--ap-muted);
    font-size: 0.71rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-feed-dot {
    width: 8px;
    height: 8px;
    margin-inline: auto;
    border-radius: 50%;
    background: var(--ap-border-strong);
}

.ap-feed-row.is-new .ap-feed-dot {
    background: var(--ap-primary);
    box-shadow: 0 0 0 5px rgba(135, 184, 166, 0.08);
}

.ap-feed-payment {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    background: rgba(136, 189, 156, 0.12);
    color: var(--ap-success);
    font-size: 0.7rem;
}

.ap-feed-row > b {
    color: var(--ap-primary-strong);
    font-size: 0.78rem;
    white-space: nowrap;
}

.ap-managed-area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
}

.ap-managed-area-card {
    padding: 1rem;
    border: 1px solid var(--ap-border);
    border-radius: 22px 22px 22px 8px;
    background: var(--ap-surface);
    color: var(--ap-text);
    text-decoration: none;
}

.ap-managed-area-card:hover {
    border-color: var(--ap-border-strong);
    color: var(--ap-text);
}

.ap-managed-area-title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.ap-managed-area-title > span:nth-child(2) {
    display: grid;
    min-width: 0;
    flex: 1;
}

.ap-managed-area-title small {
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-managed-area-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    margin-top: 1rem;
}

.ap-managed-area-stats span {
    display: grid;
    min-height: 58px;
    place-content: center;
    border-radius: 13px;
    background: var(--ap-bg-raised);
    text-align: center;
}

.ap-managed-area-stats small {
    color: var(--ap-muted);
    font-size: 0.62rem;
}

.ap-empty-state,
.ap-inline-empty {
    display: grid;
    place-items: center;
    text-align: center;
}

.ap-empty-state {
    min-height: 330px;
    padding: 2rem;
    border: 1px dashed var(--ap-border-strong);
    border-radius: 30px 30px 30px 11px;
    background: var(--ap-bg-raised);
}

.ap-empty-state h2 {
    margin: 0.8rem 0 0.25rem;
}

.ap-empty-state p,
.ap-inline-empty p {
    margin: 0;
    color: var(--ap-muted);
}

.ap-empty-symbol {
    display: grid;
    width: 62px;
    height: 62px;
    place-items: center;
    border-radius: 22px 22px 22px 8px;
    background: var(--ap-surface-soft);
    color: var(--ap-success);
    font-size: 1.7rem;
}

.ap-inline-empty {
    min-height: 130px;
    gap: 0.4rem;
    padding: 1rem;
}

/* Bootstrap and legacy view integration */
.btn {
    min-height: 42px;
    padding: 0.55rem 0.9rem;
    border-radius: 14px 14px 14px 6px;
    font-weight: 720;
    transition: transform var(--ap-motion), filter var(--ap-motion), background var(--ap-motion);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    border-color: var(--ap-primary);
    background: var(--ap-primary);
    color: var(--ap-primary-ink);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--ap-primary-strong);
    background: var(--ap-primary-strong);
    color: var(--ap-primary-ink);
}

.btn-outline-primary {
    border-color: rgba(135, 184, 166, 0.45);
    color: var(--ap-primary-strong);
}

.btn-outline-primary:hover {
    border-color: var(--ap-primary);
    background: var(--ap-primary);
    color: var(--ap-primary-ink);
}

.btn-secondary,
.btn-outline-secondary,
.btn-ghost {
    border-color: var(--ap-border-strong);
    background: var(--ap-surface);
    color: var(--ap-text-soft);
}

.btn-danger,
.btn-outline-danger {
    border-color: rgba(223, 141, 137, 0.35);
    background: var(--ap-danger-soft);
    color: var(--ap-danger);
}

.card {
    border: 1px solid var(--ap-border);
    border-radius: 23px 23px 23px 9px;
    background: var(--ap-surface);
    color: var(--ap-text);
    box-shadow: none;
}

.card-header {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--ap-border);
    background: transparent;
}

.card-body {
    padding: 1.1rem;
}

.form-control,
.form-select,
.form-check-input,
.input-group-text {
    border-color: var(--ap-border-strong);
    background-color: var(--ap-surface);
    color: var(--ap-text);
}

.form-control,
.form-select {
    min-height: 46px;
    border-radius: 14px 14px 14px 6px;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--ap-primary);
    background-color: var(--ap-surface-2);
    color: var(--ap-text);
    box-shadow: 0 0 0 0.2rem rgba(135, 184, 166, 0.12);
}

.form-control::placeholder {
    color: var(--ap-muted);
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--ap-bg-raised);
    color: var(--ap-muted);
}

.form-check-input:checked {
    border-color: var(--ap-primary);
    background-color: var(--ap-primary);
}

.form-text,
.text-muted {
    color: var(--ap-muted) !important;
}

.dropdown-menu,
.modal-content {
    border: 1px solid var(--ap-border-strong);
    border-radius: 20px 20px 20px 8px;
    background: var(--ap-surface);
    color: var(--ap-text);
    box-shadow: var(--ap-shadow);
}

.dropdown-item {
    border-radius: 11px;
    color: var(--ap-text-soft);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--ap-surface-2);
    color: var(--ap-text);
}

.dropdown-divider,
.modal-header,
.modal-footer {
    border-color: var(--ap-border);
}

.btn-close {
    filter: invert(1) grayscale(1);
    opacity: 0.72;
}

.table {
    --bs-table-color: var(--ap-text-soft);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--ap-border);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.018);
    --bs-table-hover-bg: var(--ap-surface-2);
    margin-bottom: 0;
}

.table > thead th {
    color: var(--ap-muted);
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.table-responsive {
    border: 1px solid var(--ap-border);
    border-radius: 18px 18px 18px 7px;
}

.list-group-item {
    border-color: var(--ap-border);
    background: transparent;
    color: var(--ap-text-soft);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    background: var(--ap-surface-2);
    color: var(--ap-text);
}

.badge {
    padding: 0.4em 0.62em;
    border-radius: 999px;
    font-weight: 760;
}

.text-bg-primary,
.bg-primary {
    background-color: var(--ap-primary) !important;
    color: var(--ap-primary-ink) !important;
}

.text-bg-secondary,
.bg-secondary {
    background-color: var(--ap-surface-3) !important;
    color: var(--ap-text-soft) !important;
}

.alert {
    border-radius: 17px 17px 17px 6px;
}

.alert-success {
    border-color: rgba(136, 189, 156, 0.25);
    background: rgba(136, 189, 156, 0.1);
    color: #b8dfc5;
}

.alert-danger {
    border-color: rgba(223, 141, 137, 0.25);
    background: var(--ap-danger-soft);
    color: #f1b4b1;
}

.pagination {
    gap: 0.3rem;
}

.page-link {
    min-width: 40px;
    border-color: var(--ap-border);
    border-radius: 12px !important;
    background: var(--ap-surface);
    color: var(--ap-text-soft);
    text-align: center;
}

.page-link:hover,
.page-item.active .page-link {
    border-color: var(--ap-primary);
    background: var(--ap-primary);
    color: var(--ap-primary-ink);
}

.ap-page-header {
    align-items: flex-start !important;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.ap-page-header h1,
main > h1 {
    font-weight: 750;
    letter-spacing: -0.045em;
}

.ap-filter-form {
    padding: 1rem;
    border: 1px solid var(--ap-border);
    border-radius: 20px 20px 20px 8px;
    background: var(--ap-bg-raised);
}

.ap-flash-message {
    position: relative;
    z-index: 2;
    margin-bottom: 1rem;
}

@media (max-width: 1199.98px) {
    .ap-topbar {
        inset-inline: 0;
        height: 68px;
        padding-inline: 0.85rem;
    }

    .ap-page-shell {
        padding-block-start: 68px;
        padding-inline-start: 0;
        padding-block-end: calc(var(--ap-mobile-nav-height) + env(safe-area-inset-bottom));
    }

    .ap-main-content {
        min-height: calc(100vh - 68px - var(--ap-mobile-nav-height));
    }

    .ap-mobile-brand {
        display: inline-flex;
        text-decoration: none;
    }

    .ap-mobile-brand .ap-brand-shape {
        width: 38px;
        height: 38px;
        border-radius: 14px 14px 14px 5px;
    }
}

@media (max-width: 767.98px) {
    .ap-topbar-actions {
        gap: 0.35rem;
    }

    .ap-profile-trigger {
        min-width: 42px;
        padding: 0.2rem;
        border: 0;
        background: transparent;
    }

    .ap-profile-trigger > span:last-child,
    .ap-workspace-button > span:first-child {
        display: none;
    }

    .ap-workspace-button {
        max-width: 138px;
        min-height: 40px;
        overflow: hidden;
        padding: 0.5rem 0.62rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ap-context-copy strong {
        max-width: 40vw;
    }

    .ap-dashboard-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .ap-home-area-filter {
        min-width: 0;
    }

    .ap-balance-strip {
        grid-auto-columns: min(84vw, 310px);
        grid-auto-flow: column;
        grid-template-columns: none;
        overflow-x: auto;
        padding: 0.1rem 0 0.5rem;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .ap-balance-strip::-webkit-scrollbar {
        display: none;
    }

    .ap-balance-card {
        scroll-snap-align: start;
    }

    .ap-home-metrics {
        gap: 0.45rem;
    }

    .ap-home-metrics article {
        min-height: 78px;
        align-items: flex-start;
        flex-direction: column-reverse;
        gap: 0.15rem;
        padding: 0.7rem;
    }

    .ap-home-metrics strong {
        font-size: 1.05rem;
    }

    .ap-section-block {
        padding: 0.9rem;
        border-radius: 22px 22px 22px 8px;
    }

    .ap-section-heading {
        align-items: flex-start;
    }

    .ap-statement-group-head {
        padding: 0.85rem;
    }

    .ap-bill-row {
        padding: 0.85rem;
    }

    .ap-bill-row-main {
        align-items: flex-start;
    }

    .ap-bill-row-status {
        flex: 0 0 auto;
    }

    .ap-bill-period {
        padding-inline-start: 0;
    }

    .ap-bill-money-line {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.45rem;
    }

    .ap-bill-money-line span {
        min-width: 0;
    }

    .ap-bill-money-line strong {
        overflow: hidden;
        font-size: 0.74rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ap-quick-actions {
        grid-template-columns: 1fr;
    }

    .ap-quick-actions a {
        min-height: 86px;
    }

    .ap-home-two-column {
        grid-template-columns: 1fr;
    }

    .ap-action-grid {
        grid-template-columns: 1fr;
    }

    .ap-action-tile {
        min-height: 80px;
    }

    .ap-footer {
        padding-bottom: 1rem;
    }
}

@media (max-width: 389.98px) {
    .ap-context-copy {
        display: none;
    }

    .ap-topbar-start {
        flex: 0 0 auto;
    }

    .ap-statement-group-head > span {
        display: none;
    }

    .ap-status-chip {
        padding-inline: 0.45rem;
        font-size: 0.63rem;
    }
}

@media print {
    .ap-sidebar,
    .ap-topbar,
    .ap-mobile-nav,
    .ap-footer,
    .ap-quick-actions,
    .btn,
    .ap-text-link {
        display: none !important;
    }

    .ap-page-shell {
        padding: 0;
    }

    body,
    .ap-section-block,
    .ap-statement-group,
    .ap-balance-card,
    .card {
        background: #fff !important;
        color: #111 !important;
        box-shadow: none !important;
    }

    .ap-main-content {
        width: 100%;
        max-width: none;
        padding: 0;
    }
}


/* Guest authentication and legacy-view compatibility */
.ap-auth-shell {
    display: grid;
    min-height: min(44rem, calc(100dvh - 12rem));
    place-items: center;
    padding-block: 1rem 2rem;
}

.ap-auth-card {
    width: min(100%, 33rem);
    border-radius: 30px 30px 30px 11px;
    background:
        linear-gradient(145deg, rgba(135, 184, 166, 0.07), transparent 55%),
        var(--ap-surface);
    box-shadow: var(--ap-shadow-soft);
}

.ap-auth-card .card-body {
    padding: clamp(1.2rem, 5vw, 2.1rem);
}

.ap-auth-actions {
    display: grid;
    gap: 0.7rem;
}

.ap-home-hero {
    padding: clamp(1.25rem, 5vw, 3rem);
    border: 1px solid var(--ap-border);
    border-radius: 32px 32px 32px 12px;
    background:
        radial-gradient(circle at top right, rgba(135, 184, 166, 0.13), transparent 44%),
        var(--ap-surface);
    box-shadow: var(--ap-shadow-soft);
}

.ap-home-hero h1 {
    max-width: 19ch;
    color: var(--ap-text);
    letter-spacing: -0.045em;
}

.ap-home-action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.ap-home-feature {
    height: 100%;
}

.ap-home-feature .card-body {
    display: flex;
    flex-direction: column;
}

.ap-home-feature .btn {
    align-self: flex-start;
    margin-top: auto;
}

.ap-register-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ap-notification-item {
    border-radius: 18px 18px 18px 7px;
}

.ap-user-name {
    max-width: 13rem;
    overflow: hidden;
    color: var(--ap-muted) !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-logout-form {
    margin: 0;
}

.ap-compact-section {
    min-width: 0;
}

.ap-home-empty {
    margin-bottom: 1rem;
}


/* Fixed-theme typography and Bootstrap contrast guard */

h1,
h2,
h3,
h4,
h5,
h6,
.display-1,
.display-2,
.display-3,
.display-4,
.display-5,
.display-6,
.card-title,
.modal-title,
.offcanvas-title {
    margin-block-start: 0;
    color: var(--ap-text);
    font-family: var(--ap-font-display);
    font-weight: 720;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

h1,
.h1 {
    font-size: clamp(1.72rem, 4vw, 2.35rem);
}

h2,
.h2 {
    font-size: clamp(1.42rem, 3vw, 1.85rem);
}

h3,
.h3 {
    font-size: clamp(1.18rem, 2.2vw, 1.45rem);
}

p,
li,
dd,
dt,
label,
legend,
.form-label,
.form-check-label {
    color: var(--ap-text-soft);
}

strong,
b,
th,
legend,
.form-label {
    color: var(--ap-text);
}

small,
.small {
    line-height: 1.45;
}

.text-dark,
.text-black,
.text-body,
.text-body-emphasis {
    color: var(--ap-text) !important;
}

.text-secondary,
.text-body-secondary {
    color: var(--ap-text-soft) !important;
}

.text-muted,
.form-text,
.text-body-tertiary {
    color: var(--ap-muted) !important;
}

.text-danger,
.field-validation-error,
.validation-summary-errors,
.validation-summary-errors li {
    color: #ffc0bc !important;
}

.text-success {
    color: #bfe6cd !important;
}

.text-warning {
    color: #f4d9aa !important;
}

.text-info {
    color: #c8e8fb !important;
}

.bg-white,
.bg-light,
.bg-body,
.bg-body-secondary,
.bg-body-tertiary {
    background-color: var(--ap-surface) !important;
    color: var(--ap-text) !important;
}

.bg-dark,
.text-bg-dark {
    background-color: var(--ap-surface-3) !important;
    color: var(--ap-text) !important;
}

.text-bg-success,
.bg-success {
    background-color: #20372a !important;
    color: #cdf0d8 !important;
}

.text-bg-warning,
.bg-warning {
    background-color: #3b3020 !important;
    color: #f8e4bc !important;
}

.text-bg-info,
.bg-info {
    background-color: #1d3544 !important;
    color: #d6efff !important;
}

.text-bg-danger,
.bg-danger {
    background-color: #482725 !important;
    color: #ffd0cd !important;
}

.card,
.card-header,
.card-footer,
.modal-content,
.offcanvas,
.dropdown-menu,
.list-group-item,
.accordion-item,
.accordion-button,
.toast {
    color: var(--ap-text-soft);
}

.card-header,
.card-footer,
.modal-header,
.modal-footer,
.offcanvas-header {
    border-color: var(--ap-border);
}

.card-subtitle,
.dropdown-header,
.breadcrumb,
.breadcrumb-item,
.breadcrumb-item + .breadcrumb-item::before {
    color: var(--ap-muted) !important;
}

.dropdown-header {
    font-weight: 760;
    letter-spacing: 0.04em;
}

.dropdown-item,
.dropdown-item-text {
    color: var(--ap-text-soft);
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--ap-primary);
    color: var(--ap-primary-ink);
}

.dropdown-item.disabled,
.dropdown-item:disabled {
    color: var(--ap-muted);
    opacity: 0.65;
}

.form-control,
.form-select,
.form-control-plaintext,
.form-check-input,
.input-group-text {
    color: var(--ap-text);
    caret-color: var(--ap-primary-strong);
}

.form-control-plaintext {
    background: transparent;
}

.form-control[readonly],
.form-control:read-only {
    background-color: var(--ap-bg-raised);
    color: var(--ap-text-soft);
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--ap-muted);
    opacity: 1;
}

.form-select,
select,
select option,
select optgroup {
    background-color: var(--ap-surface);
    color: var(--ap-text);
}

select option:disabled {
    color: var(--ap-muted);
}

.form-floating > label {
    color: var(--ap-muted);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
    color: var(--ap-primary-strong);
}

.form-floating > .form-control:focus ~ label::after,
.form-floating > .form-control:not(:placeholder-shown) ~ label::after,
.form-floating > .form-select ~ label::after {
    background-color: transparent !important;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-text-fill-color: var(--ap-text);
    box-shadow: 0 0 0 1000px var(--ap-surface) inset;
    caret-color: var(--ap-text);
    transition: background-color 9999s ease-out 0s;
}

input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"] {
    color-scheme: dark;
}

.btn {
    font-family: var(--ap-font-body);
    font-weight: 680;
    letter-spacing: -0.01em;
}

.btn-secondary,
.btn-outline-secondary,
.btn-light,
.btn-dark {
    border-color: var(--ap-border-strong);
    background: var(--ap-surface-2);
    color: var(--ap-text);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-light:hover,
.btn-light:focus,
.btn-dark:hover,
.btn-dark:focus {
    border-color: var(--ap-primary);
    background: var(--ap-surface-3);
    color: var(--ap-text);
}

.btn-success {
    border-color: #4f7c60;
    background: #31523d;
    color: #e1f5e7;
}

.btn-success:hover,
.btn-success:focus {
    border-color: #6d9a7b;
    background: #3b6048;
    color: #ffffff;
}

.btn-outline-success {
    border-color: #6d9a7b;
    color: #bfe6cd;
}

.btn-outline-success:hover,
.btn-outline-success:focus {
    background: #31523d;
    color: #e1f5e7;
}

.btn-warning {
    border-color: #8a7044;
    background: #5b482b;
    color: #ffe9be;
}

.btn-warning:hover,
.btn-warning:focus {
    background: #6b5532;
    color: #fff2d2;
}

.btn-info {
    border-color: #557e9a;
    background: #29485c;
    color: #e2f3ff;
}

.btn-info:hover,
.btn-info:focus {
    background: #34576d;
    color: #ffffff;
}

.btn-link {
    color: var(--ap-primary-strong);
}

.btn-link:hover,
.btn-link:focus {
    color: var(--ap-text);
}

.alert {
    border-width: 1px;
    color: var(--ap-text-soft);
}

.alert-primary {
    border-color: rgba(148, 199, 180, 0.3);
    background: rgba(148, 199, 180, 0.12);
    color: #d7f0e7;
}

.alert-secondary {
    border-color: var(--ap-border-strong);
    background: var(--ap-surface-2);
    color: var(--ap-text-soft);
}

.alert-info {
    border-color: rgba(159, 203, 234, 0.3);
    background: rgba(159, 203, 234, 0.12);
    color: #d6efff;
}

.alert-warning {
    border-color: rgba(230, 197, 142, 0.32);
    background: rgba(230, 197, 142, 0.12);
    color: #f8e4bc;
}

.alert-dark {
    border-color: var(--ap-border-strong);
    background: var(--ap-surface-3);
    color: var(--ap-text);
}

.alert-success .alert-link,
.alert-danger .alert-link,
.alert-warning .alert-link,
.alert-info .alert-link,
.alert-primary .alert-link {
    color: inherit;
}

.table {
    --bs-table-color: var(--ap-text-soft);
    --bs-table-bg: transparent;
    --bs-table-striped-color: var(--ap-text-soft);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.025);
    --bs-table-active-color: var(--ap-text);
    --bs-table-active-bg: var(--ap-surface-3);
    --bs-table-hover-color: var(--ap-text);
    --bs-table-hover-bg: var(--ap-surface-2);
    color: var(--ap-text-soft);
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--ap-border);
    color: inherit;
}

.table strong,
.table th,
.table a {
    color: var(--ap-text);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    color: var(--ap-text-soft);
}

.table-hover > tbody > tr:hover > * {
    color: var(--ap-text);
}

.nav-tabs {
    border-color: var(--ap-border);
}

.nav-tabs .nav-link,
.nav-pills .nav-link {
    color: var(--ap-text-soft);
}

.nav-tabs .nav-link:hover,
.nav-tabs .nav-link:focus {
    border-color: var(--ap-border-strong);
    color: var(--ap-text);
}

.nav-tabs .nav-link.active,
.nav-pills .nav-link.active {
    border-color: var(--ap-border-strong);
    background: var(--ap-surface-2);
    color: var(--ap-primary-strong);
}

.accordion-button {
    background: var(--ap-surface);
}

.accordion-button:not(.collapsed) {
    background: var(--ap-surface-2);
    color: var(--ap-primary-strong);
    box-shadow: inset 0 -1px 0 var(--ap-border);
}

.accordion-button::after {
    filter: invert(1) opacity(0.8);
}

.page-item.disabled .page-link {
    border-color: var(--ap-border);
    background: var(--ap-bg-raised);
    color: var(--ap-muted);
}

hr {
    border-color: var(--ap-border);
    opacity: 1;
}

code,
pre,
kbd {
    color: #d8f2e7;
}

pre {
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-sm);
    background: #111715;
}

:focus-visible {
    outline: 3px solid var(--ap-focus-ring);
    outline-offset: 2px;
}

[dir="rtl"] body {
    letter-spacing: 0;
}


/* Usability milestone additions */
.ap-profile-details { border-bottom: 1px solid var(--ap-border); }
.ap-profile-details > summary { list-style: none; cursor: pointer; }
.ap-profile-details > summary::-webkit-details-marker { display: none; }
.ap-profile-submenu { padding: .25rem 0 .5rem 1.25rem; }
.ap-profile-submenu .ap-profile-row { min-height: 44px; font-size: .94rem; }
.ap-area-code-card { background: linear-gradient(135deg, var(--ap-surface-2), var(--ap-surface)); }
.ap-area-code-card .h4 { letter-spacing: .12em; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* Pre-deployment mobile navigation and member-directory corrections */

.ap-profile-panel,
.ap-action-sheet {
    z-index: 1090;
}

.offcanvas-backdrop {
    z-index: 1080;
}

.ap-action-sheet {
    display: flex;
    max-height:
        calc(
            100dvh -
            max(0.75rem, env(safe-area-inset-top))
        );
    flex-direction: column;
}

.ap-action-sheet .offcanvas-header {
    flex: 0 0 auto;
}

.ap-action-sheet .offcanvas-body {
    min-height: 0;
    max-height: calc(88dvh - 84px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom:
        calc(1.75rem + env(safe-area-inset-bottom));
    scroll-padding-bottom:
        calc(1.75rem + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
}

.ap-action-sheet .ap-action-grid {
    padding-bottom: 0.25rem;
}

.ap-quick-actions {
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
}

.ap-member-section {
    overflow: visible;
    border: 1px solid var(--ap-border);
    border-radius:
        var(--ap-radius-lg)
        var(--ap-radius-lg)
        var(--ap-radius-lg)
        var(--ap-radius-xs);
    background: var(--ap-surface);
    box-shadow: var(--ap-shadow-soft);
}

.ap-member-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.2rem;
    border-bottom: 1px solid var(--ap-border);
}

.ap-member-section-header h2 {
    margin: 0.15rem 0 0.2rem;
}

.ap-member-section-header p {
    max-width: 680px;
    margin: 0;
    color: var(--ap-muted);
    font-size: 0.86rem;
}

.ap-member-count {
    flex: 0 0 auto;
    padding: 0.42rem 0.7rem;
    border: 1px solid var(--ap-border);
    border-radius: 999px;
    background: var(--ap-bg-raised);
    color: var(--ap-text-soft);
    font-size: 0.74rem;
    font-weight: 750;
}

.ap-member-search {
    position: relative;
    margin: 1rem 1rem 0.7rem;
}

.ap-member-search > span {
    position: absolute;
    z-index: 2;
    inset-block-start: 50%;
    inset-inline-start: 0.85rem;
    color: var(--ap-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.ap-member-search .form-control {
    min-height: 48px;
    padding-inline-start: 2.55rem;
    border-radius: 16px 16px 16px 7px;
}

.ap-member-list {
    display: grid;
    gap: 0.6rem;
    padding: 0.3rem 1rem 1rem;
}

.ap-member-tile {
    border: 1px solid var(--ap-border);
    border-radius: 17px 17px 17px 7px;
    background: var(--ap-bg-raised);
}

.ap-member-tile[hidden] {
    display: none !important;
}

.ap-member-tile-summary {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    min-height: 76px;
    padding: 0.72rem 0.78rem;
}

.ap-member-avatar {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 15px 15px 15px 5px;
    background: var(--ap-surface-soft);
    color: var(--ap-primary-strong);
    font-size: 0.92rem;
    font-weight: 850;
}

.ap-member-contact {
    display: grid;
    min-width: 0;
    gap: 0.08rem;
}

.ap-member-contact strong {
    overflow: hidden;
    color: var(--ap-text);
    font-size: 0.95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-member-contact a,
.ap-member-contact span {
    overflow-wrap: anywhere;
    color: var(--ap-muted);
    font-size: 0.76rem;
    text-decoration: none;
}

.ap-member-contact a:hover {
    color: var(--ap-primary-strong);
}

.ap-member-phone.is-empty {
    opacity: 0.72;
}

.ap-member-details {
    position: relative;
}

.ap-member-details > summary {
    list-style: none;
}

.ap-member-details > summary::-webkit-details-marker {
    display: none;
}

.ap-member-details-trigger {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 0.4rem;
    padding: 0.48rem 0.68rem;
    border: 1px solid var(--ap-border-strong);
    border-radius: 12px 12px 12px 5px;
    background: var(--ap-surface);
    color: var(--ap-text-soft);
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 760;
    user-select: none;
}

.ap-member-details-trigger:hover,
.ap-member-details[open] .ap-member-details-trigger {
    border-color: var(--ap-primary);
    color: var(--ap-text);
}

.ap-member-details-trigger > span:last-child {
    transition: transform var(--ap-motion);
}

.ap-member-details[open]
    .ap-member-details-trigger
    > span:last-child {
    transform: rotate(180deg);
}

.ap-member-details-panel {
    position: absolute;
    z-index: 12;
    inset-block-start: calc(100% + 0.45rem);
    inset-inline-end: 0;
    width: min(420px, calc(100vw - 2.5rem));
    padding: 0.9rem;
    border: 1px solid var(--ap-border-strong);
    border-radius: 18px 18px 18px 7px;
    background: var(--ap-surface-2);
    box-shadow: var(--ap-shadow);
}

.ap-member-metadata {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin: 0;
}

.ap-member-metadata > div {
    min-width: 0;
    padding: 0.65rem;
    border: 1px solid var(--ap-border);
    border-radius: 12px 12px 12px 5px;
    background: var(--ap-bg-raised);
}

.ap-member-metadata dt {
    margin-bottom: 0.15rem;
    color: var(--ap-muted);
    font-size: 0.65rem;
    font-weight: 750;
    text-transform: uppercase;
}

.ap-member-metadata dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--ap-text);
    font-size: 0.78rem;
    font-weight: 700;
}

.ap-member-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ap-border);
}

.ap-member-actions form {
    margin: 0;
}

.ap-member-action-note {
    color: var(--ap-muted);
    font-size: 0.76rem;
}

@media (max-width: 575.98px) {
    .ap-action-grid {
        grid-template-columns: 1fr;
    }

    .ap-action-tile {
        min-height: 78px;
    }

    .ap-quick-actions {
        grid-template-columns: 1fr;
    }

    .ap-member-section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .ap-member-tile-summary {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .ap-member-avatar {
        width: 38px;
        height: 38px;
    }

    .ap-member-details {
        grid-column: 1 / -1;
    }

    .ap-member-details-trigger {
        width: 100%;
        justify-content: space-between;
    }

    .ap-member-details-panel {
        position: static;
        width: 100%;
        margin-top: 0.55rem;
        box-shadow: none;
    }

    .ap-member-metadata {
        grid-template-columns: 1fr;
    }

    .ap-member-actions,
    .ap-member-actions form,
    .ap-member-actions .btn {
        width: 100%;
    }
}

/* ------------------------------------------------------------------
   Owner billing, archive, distribution and SuperAdmin compact UI
   ------------------------------------------------------------------ */

.ap-page-heading {
    margin-bottom: 1.2rem;
}

.ap-page-heading h1 {
    margin: 0.15rem 0 0.3rem;
}

.ap-page-heading p {
    max-width: 760px;
    margin: 0;
    color: var(--ap-muted);
}

.ap-page-heading-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.ap-page-actions,
.ap-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.ap-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.75rem 0;
    color: var(--ap-muted);
    font-size: 0.82rem;
}

.ap-compact-bill-list,
.ap-compact-area-list,
.ap-admin-tile-list,
.ap-archive-groups {
    display: grid;
    gap: 0.65rem;
}

.ap-compact-bill-tile {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 24px;
    align-items: center;
    gap: 0.85rem;
    min-height: 76px;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--ap-border);
    border-radius: 17px 17px 17px 7px;
    background: var(--ap-surface);
    color: var(--ap-text);
    text-decoration: none;
    transition:
        transform var(--ap-motion),
        border-color var(--ap-motion),
        background var(--ap-motion);
}

.ap-compact-bill-tile:hover {
    border-color: var(--ap-primary);
    background: var(--ap-surface-2);
    color: var(--ap-text);
    transform: translateY(-1px);
}

.ap-compact-bill-main,
.ap-compact-bill-value {
    display: grid;
    min-width: 0;
    gap: 0.12rem;
}

.ap-compact-bill-main > strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-compact-bill-main small,
.ap-compact-bill-category,
.ap-compact-bill-value small {
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-compact-bill-category {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ap-compact-bill-value {
    justify-items: end;
    text-align: end;
}

.ap-compact-bill-value > strong {
    font-size: 0.92rem;
}

.ap-status-chip {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.48rem;
    border: 1px solid var(--ap-border);
    border-radius: 999px;
    background: var(--ap-bg-raised);
    color: var(--ap-text-soft);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.ap-status-chip.is-published,
.ap-status-chip.is-clear {
    border-color: rgba(159, 208, 177, 0.35);
    background: rgba(159, 208, 177, 0.12);
    color: #c9ecd4;
}

.ap-status-chip.is-unpublished {
    border-color: rgba(230, 197, 142, 0.36);
    background: rgba(230, 197, 142, 0.12);
    color: #f4d9aa;
}

.ap-status-chip.danger,
.ap-status-chip.is-danger {
    border-color: rgba(240, 162, 158, 0.36);
    background: rgba(240, 162, 158, 0.12);
    color: #ffc0bc;
}

.ap-tile-chevron {
    color: var(--ap-muted);
    font-size: 1.45rem;
}

.ap-archive-date-group {
    overflow: hidden;
    border: 1px solid var(--ap-border);
    border-radius: 18px 18px 18px 7px;
    background: var(--ap-surface);
}

.ap-archive-date-group > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    align-items: center;
    gap: 0.75rem;
    min-height: 64px;
    padding: 0.8rem 1rem;
    cursor: pointer;
    list-style: none;
}

.ap-archive-date-group > summary::-webkit-details-marker,
.ap-admin-tile-details > summary::-webkit-details-marker {
    display: none;
}

.ap-archive-date {
    color: var(--ap-text);
    font-weight: 800;
}

.ap-archive-count {
    color: var(--ap-muted);
    font-size: 0.76rem;
}

.ap-archive-bill-list {
    display: grid;
    border-top: 1px solid var(--ap-border);
}

.ap-archive-bill-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 20px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.72rem 1rem;
    border-bottom: 1px solid var(--ap-border);
    color: var(--ap-text-soft);
    text-decoration: none;
}

.ap-archive-bill-row:last-child {
    border-bottom: 0;
}

.ap-archive-bill-row:hover {
    background: var(--ap-surface-2);
    color: var(--ap-text);
}

.ap-archive-bill-row > span:first-child {
    display: grid;
    min-width: 0;
}

.ap-archive-bill-row small {
    color: var(--ap-muted);
}

.ap-form-surface,
.ap-filter-surface,
.ap-admin-section {
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-lg) var(--ap-radius-lg)
        var(--ap-radius-lg) var(--ap-radius-xs);
    background: var(--ap-surface);
    box-shadow: var(--ap-shadow-soft);
}

.ap-form-surface {
    display: grid;
    gap: 0;
    overflow: hidden;
}

.ap-form-section {
    padding: 1.15rem;
    border-bottom: 1px solid var(--ap-border);
}

.ap-form-section-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ap-form-section-heading > span {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 11px 11px 11px 4px;
    background: var(--ap-surface-soft);
    color: var(--ap-primary-strong);
    font-weight: 850;
}

.ap-form-section-heading h2 {
    margin: 0;
    font-size: 1.05rem;
}

.ap-form-section-heading p {
    margin: 0.15rem 0 0;
    color: var(--ap-muted);
    font-size: 0.8rem;
}

.ap-form-actions {
    padding: 1rem 1.15rem;
}

.ap-filter-surface {
    margin-bottom: 1rem;
    padding: 1rem;
}

.ap-compact-area-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--ap-border);
    border-radius: 18px 18px 18px 7px;
    background: var(--ap-surface);
}

.ap-compact-area-tile h2 {
    margin: 0.25rem 0 0.08rem;
    font-size: 1.05rem;
}

.ap-compact-area-tile small {
    color: var(--ap-muted);
}

.ap-compact-area-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ap-distribution-guide {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--ap-border);
    border-radius: 15px 15px 15px 6px;
    background: var(--ap-surface-soft);
    color: var(--ap-text-soft);
    font-size: 0.82rem;
}

.ap-distribution-guide strong {
    flex: 0 0 auto;
    color: var(--ap-primary-strong);
}

.ap-distribution-form {
    display: grid;
    gap: 1rem;
}

.ap-distribution-members {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.ap-distribution-member {
    padding: 0.8rem;
    border: 1px solid var(--ap-border);
    border-radius: 17px 17px 17px 7px;
    background: var(--ap-surface);
    transition: border-color var(--ap-motion), background var(--ap-motion);
}

.ap-distribution-member.is-selected {
    border-color: rgba(148, 199, 180, 0.55);
    background: var(--ap-surface-2);
}

.ap-distribution-member-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.ap-member-select {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    cursor: pointer;
}

.ap-member-select > span {
    display: grid;
    min-width: 0;
}

.ap-member-select strong {
    overflow: hidden;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-member-select small {
    color: var(--ap-danger);
}

.ap-distribution-modifier-chip {
    flex: 0 0 auto;
    color: var(--ap-muted);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
}

.ap-distribution-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    align-items: end;
}

.ap-distribution-controls > label,
.ap-distribution-final {
    display: grid;
    min-width: 0;
    gap: 0.25rem;
}

.ap-distribution-controls > label > span,
.ap-distribution-final > span {
    color: var(--ap-muted);
    font-size: 0.68rem;
    font-weight: 750;
}

.ap-distribution-controls small {
    color: var(--ap-muted);
    font-size: 0.64rem;
}

.ap-distribution-final {
    min-height: 59px;
    align-content: center;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--ap-border);
    border-radius: 12px 12px 12px 5px;
    background: var(--ap-bg-raised);
}

.ap-distribution-final strong {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.ap-distribution-summary {
    overflow: hidden;
    border: 1px solid var(--ap-border-strong);
    border-radius: 20px 20px 20px 8px;
    background: var(--ap-surface);
}

.ap-distribution-summary > header,
.ap-admin-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--ap-border);
}

.ap-distribution-summary h2,
.ap-admin-section-header h2 {
    margin: 0.1rem 0 0;
    font-size: 1.05rem;
}

.ap-distribution-summary > header > strong {
    color: var(--ap-primary-strong);
}

.ap-distribution-summary > header > strong.is-mismatch {
    color: var(--ap-danger);
}

.ap-distribution-summary-rows {
    display: grid;
}

.ap-distribution-summary-rows > div,
.ap-distribution-summary-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--ap-border);
}

.ap-distribution-summary-empty {
    margin: 0;
    padding: 1rem;
    color: var(--ap-muted);
}

.ap-distribution-summary-footer {
    border-bottom: 0;
    background: var(--ap-bg-raised);
}

.ap-sticky-form-action {
    position: sticky;
    z-index: 5;
    bottom: calc(var(--ap-mobile-nav-height) + env(safe-area-inset-bottom) + 0.6rem);
    display: flex;
    justify-content: flex-end;
    padding: 0.6rem;
    border: 1px solid var(--ap-border);
    border-radius: 16px;
    background: var(--ap-topbar-glass);
    backdrop-filter: blur(14px);
}

.ap-admin-tile-list-contained {
    padding: 0.75rem;
}

.ap-admin-tile {
    overflow: visible;
    border: 1px solid var(--ap-border);
    border-radius: 17px 17px 17px 7px;
    background: var(--ap-surface);
}

.ap-admin-tile-primary {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    min-height: 68px;
    padding: 0.68rem 0.78rem;
}

.ap-admin-tile-copy {
    display: grid;
    min-width: 0;
    gap: 0.08rem;
}

.ap-admin-tile-copy > strong,
.ap-admin-tile-copy > a,
.ap-admin-tile-copy > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-admin-tile-copy > a,
.ap-admin-tile-copy > span {
    color: var(--ap-muted);
    font-size: 0.75rem;
    text-decoration: none;
}

.ap-admin-tile-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.ap-admin-tile-details {
    border-top: 1px solid var(--ap-border);
}

.ap-admin-tile-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    padding: 0.45rem 0.8rem;
    color: var(--ap-text-soft);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 750;
    list-style: none;
}

.ap-admin-tile-details[open] > summary {
    color: var(--ap-primary-strong);
}

.ap-admin-tile-panel {
    display: grid;
    gap: 0.75rem;
    padding: 0 0.8rem 0.8rem;
}

.ap-admin-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0;
}

.ap-admin-detail-grid > div {
    min-width: 0;
    padding: 0.55rem;
    border: 1px solid var(--ap-border);
    border-radius: 11px 11px 11px 4px;
    background: var(--ap-bg-raised);
}

.ap-admin-detail-grid dt {
    color: var(--ap-muted);
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
}

.ap-admin-detail-grid dd {
    margin: 0.15rem 0 0;
    overflow-wrap: anywhere;
    color: var(--ap-text);
    font-size: 0.76rem;
    font-weight: 700;
}

.ap-owner-summary-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.65rem;
    margin: 1rem 0;
}

.ap-owner-summary-card,
.ap-home-metrics > article {
    display: grid;
    gap: 0.2rem;
    padding: 0.85rem;
    border: 1px solid var(--ap-border);
    border-radius: 17px 17px 17px 7px;
    background: var(--ap-surface);
}

.ap-owner-summary-card.is-clear {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
}

.ap-currency-pill {
    color: var(--ap-muted);
    font-size: 0.68rem;
    font-weight: 850;
}

.ap-owner-summary-card > strong {
    font-size: 1.35rem;
}

.ap-owner-summary-card small,
.ap-home-metrics span {
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-home-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.ap-home-metrics strong {
    font-size: 1.3rem;
}

.ap-owner-debt-list,
.ap-owner-action-list {
    display: grid;
    gap: 0.55rem;
}

.ap-owner-debt-tile {
    display: grid;
    grid-template-columns: 42px minmax(0, 1.4fr) minmax(130px, 0.7fr) auto auto;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem;
    border: 1px solid var(--ap-border);
    border-radius: 16px 16px 16px 6px;
    background: var(--ap-bg-raised);
}

.ap-owner-debt-tile.is-overdue {
    border-color: rgba(240, 162, 158, 0.4);
}

.ap-owner-debt-person,
.ap-owner-debt-money {
    display: grid;
    min-width: 0;
}

.ap-owner-debt-person small,
.ap-owner-debt-person span,
.ap-owner-debt-money small,
.ap-owner-debt-money span {
    overflow: hidden;
    color: var(--ap-muted);
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-owner-debt-money {
    text-align: end;
}

.ap-home-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 991.98px) {
    .ap-distribution-members {
        grid-template-columns: 1fr;
    }

    .ap-admin-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ap-owner-debt-tile {
        grid-template-columns: 38px minmax(0, 1fr) auto;
    }

    .ap-owner-debt-money {
        grid-column: 2 / -1;
        text-align: start;
    }

    .ap-owner-debt-due {
        grid-column: 2;
    }
}

@media (max-width: 767.98px) {
    .ap-page-heading-actions,
    .ap-compact-area-tile,
    .ap-distribution-guide {
        align-items: stretch;
        flex-direction: column;
    }

    .ap-page-actions,
    .ap-page-actions .btn,
    .ap-compact-area-actions,
    .ap-compact-area-actions .btn {
        width: 100%;
    }

    .ap-compact-bill-tile {
        grid-template-columns: minmax(0, 1fr) 20px;
    }

    .ap-compact-bill-value {
        grid-column: 1;
        grid-row: 2;
        justify-items: start;
        text-align: start;
    }

    .ap-tile-chevron {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .ap-distribution-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ap-admin-tile-primary {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .ap-admin-tile-badges {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-inline-start: 46px;
    }

    .ap-home-two-column,
    .ap-home-metrics {
        grid-template-columns: 1fr;
    }

    .ap-mobile-nav:not(.ap-mobile-nav-admin) {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .ap-distribution-controls,
    .ap-admin-detail-grid {
        grid-template-columns: 1fr;
    }

    .ap-owner-debt-tile {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .ap-owner-debt-tile > .btn,
    .ap-owner-debt-due,
    .ap-owner-debt-money {
        grid-column: 1 / -1;
    }

    .ap-owner-debt-money {
        text-align: start;
    }

    .ap-list-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.2rem;
    }
}

/* ------------------------------------------------------------------
   Compact My Bills, payments, reports, and navigation refinement
   ------------------------------------------------------------------ */

.ap-mobile-nav-member {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.ap-mobile-nav-management-five {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

.ap-mobile-nav-management-four {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.ap-topbar-more-menu {
    min-width: 220px;
    padding: 0.45rem;
    border: 1px solid var(--ap-border-strong);
    border-radius: 16px 16px 16px 7px;
    background: var(--ap-surface-2);
    box-shadow: var(--ap-shadow);
}

.ap-topbar-more-menu .dropdown-item {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.75rem;
    border-radius: 11px 11px 11px 5px;
}

.ap-page-heading-compact {
    margin-bottom: 1rem;
}

.ap-page-heading-compact h1 {
    margin-bottom: 0.15rem;
}

.ap-page-heading-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.ap-page-heading-row p {
    margin-bottom: 0;
}

.ap-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
    color: var(--ap-muted);
    font-size: 0.78rem;
}

.ap-my-bill-list,
.ap-payment-member-list,
.ap-member-assigned-bill-list,
.ap-payment-history-list,
.ap-report-area-list {
    display: grid;
    gap: 0.62rem;
}

.ap-my-bill-tile {
    display: grid;
    gap: 0.48rem;
    padding: 0.82rem 0.9rem;
    border: 1px solid var(--ap-border);
    border-radius: 17px 17px 17px 7px;
    background: var(--ap-surface);
    color: inherit;
    text-decoration: none;
    transition:
        border-color var(--ap-motion),
        background var(--ap-motion),
        transform var(--ap-motion);
}

.ap-my-bill-tile:hover,
.ap-my-bill-tile:focus-visible {
    border-color: var(--ap-primary);
    background: var(--ap-surface-2);
    color: inherit;
    transform: translateY(-1px);
}

.ap-my-bill-mainline,
.ap-my-bill-meta-line,
.ap-my-bill-date-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.ap-my-bill-title {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 0.55rem;
}

.ap-my-bill-title strong {
    overflow: hidden;
    color: var(--ap-text);
    font-size: 0.95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-my-bill-title span {
    flex: 0 0 auto;
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-my-bill-amount {
    flex: 0 0 auto;
    color: var(--ap-primary-strong);
    font-size: 0.95rem;
    font-weight: 800;
}

.ap-my-bill-amount small {
    color: inherit;
    font-size: 0.64rem;
}

.ap-my-bill-meta-line,
.ap-my-bill-date-line {
    justify-content: flex-start;
    flex-wrap: wrap;
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-my-bill-meta-line > span:not(:last-child)::after,
.ap-my-bill-date-line > span:not(:last-child)::after {
    margin-inline-start: 0.8rem;
    color: var(--ap-border-strong);
    content: "•";
}

.ap-compact-status {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 0.22rem 0.5rem;
    border: 1px solid var(--ap-border);
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 780;
    line-height: 1;
    white-space: nowrap;
}

.ap-compact-status.is-success {
    border-color: rgba(159, 208, 177, 0.36);
    background: rgba(159, 208, 177, 0.12);
    color: #c9efd6;
}

.ap-compact-status.is-warning {
    border-color: rgba(230, 197, 142, 0.36);
    background: rgba(230, 197, 142, 0.12);
    color: #f4d9aa;
}

.ap-compact-status.is-danger {
    border-color: rgba(240, 162, 158, 0.36);
    background: rgba(240, 162, 158, 0.12);
    color: #ffc0bc;
}

.ap-compact-status.is-info {
    border-color: rgba(159, 203, 234, 0.36);
    background: rgba(159, 203, 234, 0.12);
    color: #c8e8fb;
}

.ap-compact-status.is-neutral {
    background: var(--ap-bg-raised);
    color: var(--ap-text-soft);
}

.ap-payment-member-tile {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(300px, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    padding: 0.72rem 0.8rem;
    border: 1px solid var(--ap-border);
    border-radius: 17px 17px 17px 7px;
    background: var(--ap-surface);
}

.ap-payment-member-identity {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.ap-payment-member-identity > div {
    display: grid;
    min-width: 0;
}

.ap-payment-member-identity strong,
.ap-payment-member-identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-payment-member-identity small {
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-payment-member-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 0.65rem;
}

.ap-payment-member-facts > span:not(.ap-compact-status) {
    display: grid;
    gap: 0.08rem;
}

.ap-payment-member-facts small,
.ap-member-assigned-bill-grid small {
    color: var(--ap-muted);
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
}

.ap-payment-member-facts strong,
.ap-member-assigned-bill-grid strong {
    color: var(--ap-text);
    font-size: 0.76rem;
}

.ap-payment-member-actions,
.ap-member-assigned-bill-actions,
.ap-payment-history-actions,
.ap-payment-record-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.ap-payment-total-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.ap-payment-total-strip article {
    display: grid;
    gap: 0.12rem;
    padding: 0.75rem 0.82rem;
    border: 1px solid var(--ap-border);
    border-radius: 16px 16px 16px 7px;
    background: var(--ap-surface);
}

.ap-payment-total-strip span,
.ap-payment-total-strip small {
    color: var(--ap-muted);
    font-size: 0.68rem;
}

.ap-payment-total-strip strong {
    color: var(--ap-primary-strong);
    font-size: 1rem;
}

.ap-section-block {
    margin-top: 1rem;
    padding: 0.85rem;
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius-lg) var(--ap-radius-lg)
        var(--ap-radius-lg) var(--ap-radius-xs);
    background: var(--ap-surface);
}

.ap-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.ap-section-heading h2 {
    margin: 0.1rem 0 0;
    font-size: 1.12rem;
}

.ap-member-assigned-bill-tile {
    display: grid;
    gap: 0.65rem;
    padding: 0.76rem;
    border: 1px solid var(--ap-border);
    border-radius: 15px 15px 15px 6px;
    background: var(--ap-bg-raised);
}

.ap-member-assigned-bill-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.ap-member-assigned-bill-title > div {
    display: grid;
    min-width: 0;
}

.ap-member-assigned-bill-title strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-member-assigned-bill-title small {
    color: var(--ap-muted);
    font-size: 0.68rem;
}

.ap-member-assigned-bill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
    gap: 0.48rem;
}

.ap-member-assigned-bill-grid > span {
    display: grid;
    gap: 0.08rem;
    padding: 0.5rem;
    border-radius: 10px 10px 10px 4px;
    background: var(--ap-surface);
}

.ap-payment-history-tile {
    display: grid;
    grid-template-columns: minmax(150px, 1.2fr) auto minmax(180px, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.68rem 0.75rem;
    border: 1px solid var(--ap-border);
    border-radius: 15px 15px 15px 6px;
    background: var(--ap-bg-raised);
}

.ap-payment-history-tile > div:first-child,
.ap-payment-history-copy,
.ap-payment-history-amount {
    display: grid;
    gap: 0.08rem;
}

.ap-payment-history-tile small,
.ap-payment-history-copy {
    color: var(--ap-muted);
    font-size: 0.68rem;
}

.ap-payment-history-amount {
    justify-items: end;
}

.ap-payment-record-wrap {
    width: min(720px, 100%);
    margin-inline: auto;
}

.ap-payment-record-tile {
    border: 1px solid var(--ap-border-strong);
    border-radius: 20px 20px 20px 8px;
    background: var(--ap-surface);
    box-shadow: var(--ap-shadow-soft);
}

.ap-payment-record-tile > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0.95rem;
    cursor: pointer;
    list-style: none;
}

.ap-payment-record-tile > summary::-webkit-details-marker {
    display: none;
}

.ap-payment-record-tile > summary > span:first-child {
    display: grid;
}

.ap-payment-record-tile > summary small {
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-payment-record-tile[open] > summary {
    border-bottom: 1px solid var(--ap-border);
}

.ap-payment-record-tile[open] > summary > span:last-child {
    transform: rotate(180deg);
}

.ap-payment-record-form {
    display: grid;
    gap: 0.8rem;
    padding: 0.9rem;
}

.ap-payment-record-row-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.ap-payment-form-validation:empty {
    display: none;
}

.ap-report-area-tile {
    border: 1px solid var(--ap-border);
    border-radius: 16px 16px 16px 7px;
    background: var(--ap-surface);
}

.ap-report-area-tile > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 22px;
    align-items: center;
    gap: 0.75rem;
    min-height: 68px;
    padding: 0.72rem 0.82rem;
    cursor: pointer;
    list-style: none;
}

.ap-report-area-tile > summary::-webkit-details-marker {
    display: none;
}

.ap-report-area-tile > summary > span:first-child {
    display: grid;
    min-width: 0;
}

.ap-report-area-tile > summary strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-report-area-tile > summary small {
    color: var(--ap-muted);
    font-size: 0.7rem;
}

.ap-report-area-tile[open] > summary {
    border-bottom: 1px solid var(--ap-border);
}

.ap-report-area-tile[open] > summary > span:last-child {
    transform: rotate(180deg);
}

.ap-report-count {
    padding: 0.3rem 0.5rem;
    border-radius: 999px;
    background: var(--ap-bg-raised);
    color: var(--ap-muted);
    font-size: 0.68rem;
    font-weight: 750;
}

.ap-report-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.5rem;
    padding: 0.7rem;
}

.ap-report-link-tile {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 0.6rem;
    min-height: 58px;
    padding: 0.55rem 0.6rem;
    border: 1px solid var(--ap-border);
    border-radius: 12px 12px 12px 5px;
    background: var(--ap-bg-raised);
    color: inherit;
    text-decoration: none;
}

.ap-report-link-tile:hover,
.ap-report-link-tile:focus-visible {
    border-color: var(--ap-primary);
    background: var(--ap-surface-2);
    color: inherit;
}

.ap-report-link-tile > span:first-child {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px 11px 11px 4px;
    background: var(--ap-surface-soft);
    color: var(--ap-primary-strong);
}

.ap-report-link-tile > span:last-child {
    display: grid;
    min-width: 0;
}

.ap-report-link-tile strong {
    font-size: 0.82rem;
}

.ap-report-link-tile small {
    color: var(--ap-muted);
    font-size: 0.65rem;
}

@media (max-width: 991.98px) {
    .ap-payment-member-tile {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .ap-payment-member-facts {
        grid-column: 1 / -1;
        order: 3;
    }

    .ap-payment-history-tile {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .ap-payment-history-copy {
        grid-column: 1 / -1;
    }
}

@media (max-width: 575.98px) {
    .ap-page-heading-row,
    .ap-my-bill-mainline,
    .ap-member-assigned-bill-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .ap-my-bill-title {
        width: 100%;
        align-items: flex-start;
        flex-direction: column;
        gap: 0.08rem;
    }

    .ap-my-bill-title strong {
        width: 100%;
    }

    .ap-my-bill-meta-line,
    .ap-my-bill-date-line {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem 0.6rem;
    }

    .ap-my-bill-meta-line > span:not(:last-child)::after,
    .ap-my-bill-date-line > span:not(:last-child)::after {
        content: none;
    }

    .ap-payment-member-tile,
    .ap-payment-history-tile {
        grid-template-columns: 1fr;
    }

    .ap-payment-member-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-column: auto;
    }

    .ap-payment-member-facts .ap-compact-status {
        justify-self: start;
    }

    .ap-payment-member-actions,
    .ap-member-assigned-bill-actions,
    .ap-payment-history-actions,
    .ap-payment-record-actions {
        width: 100%;
        justify-content: stretch;
    }

    .ap-payment-member-actions .btn,
    .ap-member-assigned-bill-actions .btn,
    .ap-payment-history-actions form,
    .ap-payment-history-actions .btn,
    .ap-payment-record-actions .btn {
        flex: 1 1 auto;
    }

    .ap-payment-record-row-two {
        grid-template-columns: 1fr;
    }

    .ap-report-link-grid {
        grid-template-columns: 1fr;
    }
}


/* ------------------------------------------------------------------
   Grouped owner outstanding members
   ------------------------------------------------------------------ */

.ap-owner-outstanding-list {
    display: grid;
    gap: 0.5rem;
}

.ap-owner-outstanding-tile {
    overflow: hidden;
    border: 1px solid var(--ap-border);
    border-radius: 15px 15px 15px 6px;
    background: var(--ap-bg-raised);
}

.ap-owner-outstanding-tile.is-overdue {
    border-color: rgba(240, 162, 158, 0.42);
}

.ap-owner-outstanding-tile > summary {
    display: grid;
    grid-template-columns:
        38px
        minmax(0, 1fr)
        minmax(125px, auto)
        auto;
    align-items: center;
    gap: 0.65rem;
    min-height: 64px;
    padding: 0.58rem 0.68rem;
    list-style: none;
    cursor: pointer;
}

.ap-owner-outstanding-tile > summary::-webkit-details-marker {
    display: none;
}

.ap-owner-outstanding-tile > summary:hover {
    background: var(--ap-surface-soft);
}

.ap-owner-outstanding-person,
.ap-owner-outstanding-total {
    display: grid;
    min-width: 0;
    gap: 0.05rem;
}

.ap-owner-outstanding-person strong,
.ap-owner-outstanding-person small,
.ap-owner-outstanding-person span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-owner-outstanding-person strong {
    color: var(--ap-text);
    font-size: 0.9rem;
}

.ap-owner-outstanding-person small,
.ap-owner-outstanding-person span,
.ap-owner-outstanding-total small {
    color: var(--ap-muted);
    font-size: 0.68rem;
}

.ap-owner-outstanding-total {
    justify-items: end;
    text-align: end;
}

.ap-owner-outstanding-total strong {
    color: var(--ap-text);
    font-size: 0.9rem;
}

.ap-owner-outstanding-state {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
}

.ap-details-chevron {
    color: var(--ap-muted);
    transition: transform var(--ap-motion);
}

.ap-owner-outstanding-tile[open] .ap-details-chevron {
    transform: rotate(180deg);
}

.ap-owner-outstanding-breakdown {
    padding: 0.75rem;
    border-top: 1px solid var(--ap-border);
    background: var(--ap-surface);
}

.ap-owner-outstanding-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.ap-owner-outstanding-summary > span {
    display: grid;
    gap: 0.08rem;
    padding: 0.5rem 0.58rem;
    border: 1px solid var(--ap-border);
    border-radius: 11px 11px 11px 4px;
    background: var(--ap-bg-raised);
}

.ap-owner-outstanding-summary small,
.ap-owner-outstanding-bill small {
    color: var(--ap-muted);
    font-size: 0.66rem;
}

.ap-owner-outstanding-summary strong {
    color: var(--ap-text);
    font-size: 0.8rem;
}

.ap-owner-outstanding-bills {
    display: grid;
    gap: 0.4rem;
}

.ap-owner-outstanding-bill {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(125px, auto)
        auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.52rem 0.58rem;
    border: 1px solid var(--ap-border);
    border-radius: 12px 12px 12px 5px;
    background: var(--ap-bg-raised);
}

.ap-owner-outstanding-bill > div {
    display: grid;
    min-width: 0;
    gap: 0.06rem;
}

.ap-owner-outstanding-bill > div:first-child strong {
    overflow: hidden;
    color: var(--ap-text);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-owner-outstanding-bill-amount {
    justify-items: end;
    text-align: end;
}

.ap-owner-outstanding-bill-amount strong {
    color: var(--ap-text);
    font-size: 0.78rem;
}

@media (max-width: 767.98px) {
    .ap-owner-outstanding-tile > summary {
        grid-template-columns:
            36px
            minmax(0, 1fr)
            auto;
    }

    .ap-owner-outstanding-total {
        grid-column: 2;
        justify-items: start;
        text-align: start;
    }

    .ap-owner-outstanding-state {
        grid-column: 3;
        grid-row: 1 / span 2;
    }

    .ap-owner-outstanding-bill {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .ap-owner-outstanding-bill > .btn {
        grid-column: 1 / -1;
        width: 100%;
    }
}

@media (max-width: 479.98px) {
    .ap-owner-outstanding-summary {
        grid-template-columns: 1fr;
    }

    .ap-owner-outstanding-bill {
        grid-template-columns: 1fr;
    }

    .ap-owner-outstanding-bill-amount {
        justify-items: start;
        text-align: start;
    }
}

/* ------------------------------------------------------------------
   Compact item submissions, request reviews, and protected receipts
   ------------------------------------------------------------------ */

.ap-page-heading-compact {
    margin-bottom: 1rem;
}

.ap-inline-filter,
.ap-filter-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.ap-inline-filter .form-select {
    min-width: 190px;
}

.ap-filter-strip {
    padding: 0.8rem;
    border: 1px solid var(--ap-border);
    border-radius: 18px 18px 18px 7px;
    background: var(--ap-surface);
}

.ap-filter-strip > div {
    flex: 0 1 190px;
}

.ap-filter-strip .ap-filter-search {
    flex: 1 1 260px;
}

.ap-review-tile-list,
.ap-member-submission-list,
.ap-member-request-list {
    display: grid;
    gap: 0.65rem;
}

.ap-review-tile,
.ap-member-submission-tile,
.ap-member-request-tile {
    overflow: visible;
    border: 1px solid var(--ap-border);
    border-radius: 17px 17px 17px 7px;
    background: var(--ap-surface);
    box-shadow: 0 8px 24px rgba(3, 8, 6, 0.12);
}

.ap-review-tile > summary,
.ap-member-submission-tile > summary,
.ap-member-request-tile > summary {
    list-style: none;
}

.ap-review-tile > summary::-webkit-details-marker,
.ap-member-submission-tile > summary::-webkit-details-marker,
.ap-member-request-tile > summary::-webkit-details-marker {
    display: none;
}

.ap-review-tile-summary,
.ap-member-submission-tile > summary,
.ap-member-request-tile > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 0.65rem;
    min-height: 66px;
    padding: 0.7rem 0.82rem;
    cursor: pointer;
    user-select: none;
}

.ap-review-tile-main,
.ap-member-submission-main {
    display: grid;
    min-width: 0;
    gap: 0.08rem;
}

.ap-review-tile-main strong,
.ap-member-submission-main strong {
    overflow: hidden;
    color: var(--ap-text);
    font-size: 0.92rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-review-tile-main small,
.ap-member-submission-main small {
    overflow: hidden;
    color: var(--ap-muted);
    font-size: 0.73rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-review-tile-amount,
.ap-member-submission-price {
    color: var(--ap-text);
    font-size: 0.88rem;
    font-weight: 800;
    white-space: nowrap;
}

.ap-status-pill,
.ap-mini-label {
    display: inline-flex;
    min-height: 27px;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.52rem;
    border: 1px solid var(--ap-border);
    border-radius: 999px;
    background: var(--ap-bg-raised);
    color: var(--ap-text-soft);
    font-size: 0.66rem;
    font-weight: 790;
    letter-spacing: 0.015em;
    white-space: nowrap;
}

.ap-status-pill.is-success {
    border-color: rgba(159, 208, 177, 0.33);
    background: rgba(159, 208, 177, 0.11);
    color: #c7ead3;
}

.ap-status-pill.is-danger {
    border-color: rgba(240, 162, 158, 0.34);
    background: rgba(240, 162, 158, 0.11);
    color: #ffc7c3;
}

.ap-status-pill.is-warning {
    border-color: rgba(230, 197, 142, 0.34);
    background: rgba(230, 197, 142, 0.11);
    color: #f4d9aa;
}

.ap-status-pill.is-info {
    border-color: rgba(159, 203, 234, 0.34);
    background: rgba(159, 203, 234, 0.11);
    color: #c8e8fb;
}

.ap-status-pill.is-muted {
    color: var(--ap-muted);
}

.ap-expand-glyph {
    color: var(--ap-muted);
    transition: transform var(--ap-motion);
}

.ap-review-tile[open] .ap-expand-glyph,
.ap-member-submission-tile[open] .ap-expand-glyph,
.ap-member-request-tile[open] .ap-expand-glyph {
    transform: rotate(180deg);
}

.ap-review-tile-panel,
.ap-member-submission-panel {
    display: grid;
    gap: 0.85rem;
    padding: 0.85rem;
    border-top: 1px solid var(--ap-border);
    background: var(--ap-bg-raised);
}

.ap-review-description,
.ap-member-submission-panel > p {
    margin: 0;
    color: var(--ap-text-soft);
    font-size: 0.86rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.ap-review-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 0.55rem;
}

.ap-review-detail-grid > div {
    display: grid;
    min-width: 0;
    gap: 0.08rem;
    padding: 0.58rem 0.65rem;
    border: 1px solid var(--ap-border);
    border-radius: 12px 12px 12px 5px;
    background: var(--ap-surface);
}

.ap-review-detail-grid span {
    color: var(--ap-muted);
    font-size: 0.64rem;
    font-weight: 760;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ap-review-detail-grid strong {
    overflow-wrap: anywhere;
    color: var(--ap-text);
    font-size: 0.77rem;
}

.ap-receipt-preview-link {
    display: inline-grid;
    width: min(210px, 100%);
    gap: 0.35rem;
    color: var(--ap-primary-strong);
    font-size: 0.73rem;
    font-weight: 740;
    text-decoration: none;
}

.ap-receipt-preview-link img {
    width: 100%;
    max-height: 130px;
    object-fit: cover;
    border: 1px solid var(--ap-border);
    border-radius: 14px 14px 14px 6px;
    background: var(--ap-surface);
}

.ap-receipt-preview-large {
    width: min(380px, 100%);
}

.ap-receipt-preview-large img {
    max-height: 260px;
    object-fit: contain;
}

.ap-compact-decision-form {
    display: grid;
    grid-template-columns: minmax(145px, 0.65fr) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 0.65rem;
    padding: 0.72rem;
    border: 1px solid var(--ap-border);
    border-radius: 14px 14px 14px 6px;
    background: var(--ap-surface);
}

.ap-compact-decision-form .ap-decision-reason {
    grid-column: 1 / -2;
}

.ap-tile-footer-actions,
.ap-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
}

.ap-compact-detail-card,
.ap-compact-form-card,
.ap-action-expander {
    border: 1px solid var(--ap-border);
    border-radius: 20px 20px 20px 8px;
    background: var(--ap-surface);
    box-shadow: var(--ap-shadow-soft);
}

.ap-compact-detail-card {
    display: grid;
    gap: 0.9rem;
    padding: 1rem;
    margin-bottom: 0.85rem;
}

.ap-compact-detail-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ap-compact-detail-title > div {
    display: grid;
    gap: 0.08rem;
}

.ap-compact-detail-title small,
.ap-compact-meta-line {
    color: var(--ap-muted);
    font-size: 0.76rem;
}

.ap-action-expander {
    margin-top: 0.75rem;
    overflow: hidden;
}

.ap-action-expander > summary {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.72rem 0.9rem;
    list-style: none;
    cursor: pointer;
}

.ap-action-expander > summary::-webkit-details-marker {
    display: none;
}

.ap-action-expander > summary > span:first-child {
    display: grid;
    gap: 0.08rem;
}

.ap-action-expander > summary small {
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-action-expander-body {
    padding: 0.85rem;
    border-top: 1px solid var(--ap-border);
    background: var(--ap-bg-raised);
}

.ap-compact-form-card {
    max-width: 820px;
    padding: 1rem;
}

.ap-compact-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.ap-form-span-full {
    grid-column: 1 / -1;
}

.ap-form-actions {
    margin-top: 1rem;
}

.ap-money-input .input-group-text {
    min-width: 44px;
    justify-content: center;
    color: var(--ap-primary-ink);
    background: var(--ap-primary);
}

.ap-file-upload-tile {
    display: grid;
    min-height: 96px;
    place-items: center;
    gap: 0.08rem;
    padding: 0.85rem;
    border: 1px dashed var(--ap-border-strong);
    border-radius: 16px 16px 16px 7px;
    background: var(--ap-bg-raised);
    color: var(--ap-text);
    text-align: center;
    cursor: pointer;
}

.ap-file-upload-tile > span {
    color: var(--ap-primary-strong);
    font-size: 1.2rem;
}

.ap-file-upload-tile small {
    color: var(--ap-muted);
    font-size: 0.72rem;
}

.ap-visually-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.ap-upload-preview {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.55rem;
    padding: 0.55rem;
    border: 1px solid var(--ap-border);
    border-radius: 13px 13px 13px 5px;
    background: var(--ap-bg-raised);
    color: var(--ap-text-soft);
    font-size: 0.75rem;
}

.ap-upload-preview[hidden] {
    display: none;
}

.ap-upload-preview img {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 10px 10px 10px 4px;
}

.ap-inline-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.ap-inline-chip-row > span {
    padding: 0.3rem 0.52rem;
    border: 1px solid var(--ap-border);
    border-radius: 999px;
    background: var(--ap-bg-raised);
    color: var(--ap-text-soft);
    font-size: 0.69rem;
    font-weight: 700;
}

.ap-owner-response {
    padding: 0.75rem;
    border-inline-start: 3px solid var(--ap-primary);
    border-radius: 8px;
    background: var(--ap-bg-raised);
}

.ap-owner-response p {
    margin: 0.25rem 0 0;
    white-space: pre-wrap;
}

@media (max-width: 767.98px) {
    .ap-page-heading {
        align-items: stretch;
    }

    .ap-inline-filter,
    .ap-filter-strip {
        align-items: stretch;
        flex-direction: column;
    }

    .ap-inline-filter .form-select,
    .ap-filter-strip > div,
    .ap-filter-strip .ap-filter-search,
    .ap-filter-strip .btn {
        width: 100%;
        flex-basis: auto;
    }

    .ap-review-tile-summary,
    .ap-member-submission-tile > summary,
    .ap-member-request-tile > summary {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .ap-review-tile-amount,
    .ap-member-submission-price,
    .ap-mini-label {
        grid-row: 2;
    }

    .ap-status-pill {
        justify-self: start;
    }

    .ap-expand-glyph {
        grid-column: 2;
        grid-row: 1;
    }

    .ap-compact-decision-form,
    .ap-compact-form-grid {
        grid-template-columns: 1fr;
    }

    .ap-compact-decision-form .ap-decision-reason,
    .ap-form-span-full {
        grid-column: 1;
    }

    .ap-compact-decision-form .btn,
    .ap-form-actions .btn,
    .ap-form-actions a {
        width: 100%;
    }

    .ap-compact-detail-title {
        align-items: flex-start;
        flex-direction: column;
    }
}
