.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 999px;
    font-weight: 800;
    line-height: 1;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
    color: #031008;
    background: linear-gradient(135deg, var(--green), var(--green-2));
    box-shadow: 0 16px 32px rgba(36, 211, 102, 0.2);
    padding: 0.95rem 1.25rem;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 40px rgba(36, 211, 102, 0.28);
}

.secondary-button {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(244, 255, 248, 0.12);
    padding: 0.85rem 1.1rem;
}

.secondary-button:hover {
    background: rgba(255, 255, 255, 0.11);
    border-color: rgba(36, 211, 102, 0.35);
}

.ghost-button {
    color: var(--text);
    background: transparent;
    border: 1px solid rgba(244, 255, 248, 0.14);
    padding: 0.75rem 1rem;
}

.ghost-button:hover {
    background: rgba(255, 255, 255, 0.06);
}

.danger-button {
    color: #fff;
    background: linear-gradient(135deg, rgba(255, 77, 79, 0.92), #b92325);
    padding: 0.95rem 1.25rem;
}

.danger-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 40px rgba(255, 77, 79, 0.16);
}

.icon-button {
    min-height: 34px;
    padding: 0.4rem 0.75rem;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(244, 255, 248, 0.08);
    font-size: 0.78rem;
}

.icon-button:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

.app-topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 50;
    min-height: var(--topbar-height);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.25rem;
    align-items: center;
    padding: 1rem clamp(1rem, 3vw, 2.5rem);
    border-bottom: 1px solid rgba(244, 255, 248, 0.08);
    background: rgba(3, 8, 6, 0.86);
    backdrop-filter: blur(18px);
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 220px;
}

.brand-icon {
    width: 48px;
    height: 48px;
    overflow: hidden;
    border-radius: 16px;
    background: var(--green-soft);
    border: 1px solid rgba(36, 211, 102, 0.22);
    box-shadow: 0 14px 30px rgba(36, 211, 102, 0.12);
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-lockup h1 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.brand-lockup p {
    margin: 0.18rem 0 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.app-nav {
    justify-self: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    max-width: 820px;
    padding: 0.4rem;
    border: 1px solid rgba(244, 255, 248, 0.09);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
}

.app-nav a {
    color: var(--muted);
    border-radius: 999px;
    padding: 0.58rem 0.78rem;
    font-size: 0.82rem;
    font-weight: 800;
    transition: background 160ms ease, color 160ms ease;
}

.app-nav a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
}

.app-nav a.active {
    color: #031008;
    background: linear-gradient(135deg, var(--green), var(--green-2));
}

.panel {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
        var(--panel);
    box-shadow: var(--shadow);
    padding: clamp(1.1rem, 2vw, 1.5rem);
}

.wide-panel {
    min-width: 0;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.panel-header h3 {
    margin: 0.18rem 0 0;
    font-size: clamp(1.25rem, 2vw, 1.7rem);
    letter-spacing: -0.04em;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.eyebrow {
    margin: 0;
    color: var(--green);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.metric-card {
    position: relative;
    overflow: hidden;
    min-height: 148px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at top right, rgba(36, 211, 102, 0.18), transparent 14rem),
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
        var(--panel);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.metric-card.danger {
    background:
        radial-gradient(circle at top right, rgba(255, 77, 79, 0.16), transparent 14rem),
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
        var(--panel);
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.metric-card strong {
    display: block;
    margin-top: 0.55rem;
    color: var(--text);
    font-size: clamp(1.7rem, 3vw, 2.35rem);
    letter-spacing: -0.06em;
}

.metric-card small {
    display: block;
    margin-top: 0.5rem;
    color: var(--muted-2);
}

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

.table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(244, 255, 248, 0.08);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.18);
}

.stack-list {
    display: grid;
    gap: 0.75rem;
}

.list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid rgba(244, 255, 248, 0.08);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.045);
    padding: 0.95rem;
}

.list-card strong,
.list-card span {
    display: block;
}

.list-card span {
    margin-top: 0.3rem;
    color: var(--green);
    font-weight: 800;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    min-height: 30px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 900;
}

.status-pill.paid {
    color: #031008;
    background: var(--green);
}

.status-pill.unpaid {
    color: #fff;
    background: rgba(255, 77, 79, 0.92);
}

.result-card {
    display: grid;
    gap: 0.45rem;
    margin-top: 1.25rem;
    border: 1px solid rgba(36, 211, 102, 0.14);
    border-radius: var(--radius-md);
    background:
        radial-gradient(circle at top right, rgba(36, 211, 102, 0.16), transparent 14rem),
        rgba(255, 255, 255, 0.045);
    padding: 1rem;
}

.result-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
}

.result-card strong {
    margin-bottom: 0.55rem;
    color: var(--text);
    font-size: 1.45rem;
    letter-spacing: -0.04em;
}

.mini-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}

.mini-metrics div {
    border: 1px solid rgba(244, 255, 248, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.045);
    padding: 0.8rem;
}

.mini-metrics span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.mini-metrics strong {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.98rem;
}

.toast {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 100;
    max-width: min(380px, calc(100vw - 2rem));
    border: 1px solid rgba(36, 211, 102, 0.22);
    border-radius: var(--radius-md);
    color: #031008;
    background: linear-gradient(135deg, var(--green), var(--green-2));
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
    padding: 1rem 1.1rem;
    font-weight: 900;
}

@media (max-width: 1180px) {
    .app-topbar {
        grid-template-columns: 1fr auto;
    }

    .app-nav {
        grid-column: 1 / -1;
        justify-self: stretch;
        border-radius: var(--radius-md);
        overflow-x: auto;
        justify-content: flex-start;
    }

    .brand-lockup {
        min-width: 0;
    }
}

@media (max-width: 860px) {
    .app-topbar {
        padding: 0.8rem 1rem;
    }

    .brand-lockup p {
        display: none;
    }

    .brand-icon {
        width: 42px;
        height: 42px;
    }

    .app-nav {
        display: none;
    }

    .ghost-button {
        min-height: 40px;
        padding: 0.65rem 0.85rem;
    }

    .metric-grid,
    .mini-metrics {
        grid-template-columns: 1fr;
    }

    .panel-header {
        flex-direction: column;
    }
}