:root {
    --bg: #eef4ff;
    --bg-soft: #f7faff;
    --surface: #ffffff;
    --surface-soft: #f4f7fd;
    --surface-strong: #e7eefb;
    --navy-900: #17315f;
    --navy-800: #24457d;
    --navy-700: #2f5aa1;
    --navy-600: #3d73cb;
    --navy-500: #558ff0;
    --ink-900: #1b2b45;
    --ink-700: #54657f;
    --ink-500: #7f90aa;
    --line: #d9e3f3;
    --shadow-soft: 0 10px 24px rgba(32, 61, 109, 0.08);
    --shadow-card: 0 18px 40px rgba(31, 61, 110, 0.10);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body.app-body {
    margin: 0;
    color: var(--ink-900);
    background:
        radial-gradient(circle at top left, rgba(82, 140, 236, 0.18), transparent 24%),
        linear-gradient(180deg, #edf4ff 0%, #f6f9ff 100%);
    font-family: "Manrope", "Segoe UI", sans-serif;
}

.app-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.orb-one,
.orb-two {
    position: absolute;
    border-radius: 50%;
    filter: blur(16px);
    opacity: 0.55;
}

.orb-one {
    width: 380px;
    height: 380px;
    left: -120px;
    top: -90px;
    background: radial-gradient(circle, rgba(72, 134, 236, 0.30), transparent 68%);
}

.orb-two {
    width: 320px;
    height: 320px;
    right: -70px;
    top: 180px;
    background: radial-gradient(circle, rgba(100, 156, 248, 0.22), transparent 68%);
}

.app-backdrop-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(93, 133, 205, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(93, 133, 205, 0.05) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent 100%);
}

.app-shell,
.container {
    position: relative;
    z-index: 1;
}

.app-shell {
    display: flex;
    gap: 18px;
    padding: 18px;
    align-items: flex-start;
}

.app-side-rail {
    width: 78px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 18px;
}

.rail-tile {
    min-height: 74px;
    padding: 10px 8px;
    border-radius: 22px;
    color: #fff;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(255, 255, 255, 0.22);
    transition: transform 0.18s ease, filter 0.18s ease;
}

.rail-tile:hover,
.rail-tile.active {
    color: #fff;
    transform: translateY(-2px);
    filter: saturate(1.05);
}

.rail-home {
    background: linear-gradient(135deg, #67a0ff, #3561ea);
}

.rail-sales {
    background: linear-gradient(135deg, #57d991, #17b05e);
}

.rail-bills {
    background: linear-gradient(135deg, #54b8ff, #2375ee);
}

.rail-admin {
    background: linear-gradient(135deg, #c26cff, #7d31e6);
}

.app-workspace {
    flex: 1;
    min-width: 0;
}

.app-navbar {
    padding: 0;
    margin-bottom: 16px;
}

.app-navbar-shell {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(240, 245, 253, 0.92);
    border: 1px solid rgba(207, 219, 238, 0.95);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(12px);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-right: 16px;
    text-decoration: none;
    color: var(--ink-900);
}

.app-brand:hover {
    color: var(--ink-900);
}

.app-brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #5d95f7, #315fe6);
    box-shadow: 0 8px 20px rgba(49, 95, 230, 0.25);
    font-family: "Cormorant Garamond", serif;
    font-size: 1.5rem;
    font-weight: 700;
    overflow: hidden;
}

.app-brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.app-brand-mark-fallback {
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

.app-brand-title {
    display: block;
    font-size: 1rem;
    font-weight: 800;
}

.app-brand-subtitle {
    display: block;
    color: var(--ink-500);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.app-navbar .navbar-toggler {
    box-shadow: none;
}

.app-navbar .navbar-nav {
    gap: 8px;
}

.app-navbar .nav-link {
    padding: 10px 14px;
    border-radius: 14px;
    color: var(--ink-700);
    font-weight: 700;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, #4d84ef, #3460e8);
    box-shadow: 0 10px 20px rgba(52, 96, 232, 0.22);
}

.app-userbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.app-userbar-meta {
    text-align: right;
    line-height: 1.1;
}

.app-userbar-role {
    display: block;
    color: var(--ink-500);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.app-userbar-name {
    display: block;
    color: var(--ink-900);
    font-weight: 800;
}

.app-main-shell {
    width: 100%;
}

.app-workspace .app-main-shell {
    padding: 0;
}

.container.app-main-shell {
    padding-top: 26px;
    padding-bottom: 48px;
}

.page-hero,
.section-card,
.metric-card,
.summary-box,
.action-tile,
.success-panel,
.card {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.page-hero {
    padding: 26px 28px;
    background:
        radial-gradient(circle at top right, rgba(93, 149, 247, 0.22), transparent 30%),
        linear-gradient(135deg, #f5f8ff, #eef4ff);
}

.page-kicker {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(54, 96, 232, 0.08);
    color: var(--navy-700);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-title {
    margin: 14px 0 0;
    color: var(--ink-900);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.05em;
}

.page-subtitle {
    margin: 12px 0 0;
    color: var(--ink-700);
    font-size: 1rem;
}

.hero-actions {
    display: flex;
    align-items: flex-start;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.hero-stat {
    padding: 18px 20px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(207, 219, 238, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.hero-stat span {
    display: block;
    color: var(--ink-500);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero-stat strong {
    display: block;
    margin-top: 8px;
    color: var(--ink-900);
    font-size: 1.8rem;
    font-weight: 800;
}

.metric-card {
    padding: 22px;
}

.metric-label {
    color: var(--ink-500);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.metric-value {
    margin-top: 10px;
    color: var(--ink-900);
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.metric-note {
    margin-top: 6px;
    color: var(--ink-700);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 24px 0;
}

.panel-title {
    margin: 0;
    color: var(--ink-900);
    font-size: 1.1rem;
    font-weight: 800;
}

.panel-subtitle {
    margin: 6px 0 0;
    color: var(--ink-700);
    font-size: 0.92rem;
}

.panel-body {
    padding: 22px 24px 24px;
}

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

.action-tile {
    padding: 20px;
    color: inherit;
    text-decoration: none;
    background: linear-gradient(180deg, #fbfdff, #f3f7ff);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.action-tile:hover {
    transform: translateY(-2px);
    color: inherit;
    box-shadow: 0 20px 34px rgba(31, 61, 110, 0.14);
}

.action-eyebrow {
    color: var(--navy-600);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.action-title {
    margin-top: 10px;
    color: var(--ink-900);
    font-size: 1.04rem;
    font-weight: 800;
}

.action-copy {
    margin-top: 8px;
    color: var(--ink-700);
    font-size: 0.92rem;
    line-height: 1.55;
}

.summary-box {
    padding: 18px;
    height: 100%;
}

.summary-box span {
    display: block;
    margin-bottom: 8px;
    color: var(--ink-500);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.summary-box strong {
    color: var(--ink-900);
    font-size: 1.35rem;
    font-weight: 800;
}

.total-box {
    background: linear-gradient(135deg, #2f5aa1, #558ff0);
    border-color: transparent !important;
}

.total-box span,
.total-box strong {
    color: #fff;
}

.btn {
    border-radius: 14px;
    font-weight: 700;
    padding: 0.76rem 1.15rem;
}

.btn-primary,
.btn-dark {
    border: 0;
    background: linear-gradient(135deg, #4f84ef, #3561e8);
    box-shadow: 0 10px 20px rgba(53, 97, 232, 0.22);
}

.btn-primary:hover,
.btn-dark:hover {
    background: linear-gradient(135deg, #4578e2, #2d56da);
}

.btn-light {
    border-color: #d8e2f3;
    background: #fff;
    color: var(--ink-900);
}

.btn-outline-light,
.btn-outline-dark,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning {
    border-color: #d8e2f3;
    background: #fff;
}

.btn-outline-light.active,
.btn-outline-dark.active,
.btn-outline-primary.active,
.btn-outline-secondary.active {
    color: #fff;
    background: linear-gradient(135deg, #4f84ef, #3561e8);
    border-color: transparent;
}

.form-label {
    margin-bottom: 0.45rem;
    color: var(--ink-700);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.form-control,
.form-select,
textarea.form-control {
    min-height: 48px;
    border: 1px solid #d7e1f2;
    border-radius: 16px;
    background: #fbfdff;
    color: var(--ink-900);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

textarea.form-control {
    min-height: 120px;
}

.form-control:focus,
.form-select:focus {
    border-color: #80aaf5;
    box-shadow: 0 0 0 0.22rem rgba(85, 143, 240, 0.15);
}

.password-field-wrap {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.password-field {
    flex: 1;
}

.password-toggle-btn {
    min-width: 84px;
    white-space: nowrap;
}

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table thead th {
    color: var(--ink-500);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    border-color: #e3eaf7;
    background: #f6f9ff;
}

.table tbody td {
    color: var(--ink-900);
    border-color: #e9eef8;
    vertical-align: middle;
}

.table tbody tr {
    background: #fff;
}

.table tbody tr:hover {
    background: #f8fbff;
}

.table-responsive {
    border-radius: 18px;
}

.billing-form .card-body {
    padding: 22px;
}

.billing-form .summary-box {
    min-height: 100%;
}

.badge {
    border-radius: 999px;
    padding: 0.5em 0.8em;
    font-weight: 800;
}

.text-bg-success {
    background: rgba(32, 183, 104, 0.14) !important;
    color: #15a05b !important;
}

.text-bg-danger {
    background: rgba(240, 87, 105, 0.14) !important;
    color: #e84458 !important;
}

.pagination {
    gap: 8px;
}

.page-link {
    border-radius: 12px;
    border: 1px solid #d7e1f2;
    background: #fff;
    color: var(--ink-900);
}

.page-item.active .page-link {
    border-color: transparent;
    background: linear-gradient(135deg, #4f84ef, #3561e8);
}

.alert {
    border-radius: 18px;
    border: 1px solid #dce5f5;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.text-muted,
.small {
    color: var(--ink-700) !important;
}

.login-shell {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
}

.login-card {
    border-radius: 30px;
}

.login-showcase {
    height: 100%;
    padding: 2.2rem;
    background: linear-gradient(135deg, #4f84ef, #3561e8 60%, #7744ff);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.login-brand-mark {
    width: 110px;
    height: 110px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 28px;
    margin-bottom: 22px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
    font-family: "Cormorant Garamond", serif;
    font-size: 3.6rem;
    font-weight: 700;
}

.login-brand-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
    display: block;
    margin-bottom: 22px;
}

.login-brand-name {
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.login-brand-subtitle {
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.login-demo {
    margin-top: 26px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.95rem;
    line-height: 1.8;
}

.item-card {
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    border: 1px solid #dfe7f5 !important;
    border-radius: 20px !important;
}

.item-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.item-collapse-toggle {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.item-title {
    flex: 0 0 auto;
    color: var(--ink-900);
    font-size: 1rem;
    font-weight: 800;
}

.item-compact-summary {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    color: var(--ink-600);
    font-size: 0.92rem;
}

.item-compact-summary span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-compact-summary strong {
    color: var(--ink-900);
    font-weight: 800;
    white-space: nowrap;
}

.item-row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.item-card.is-collapsed {
    background: #fff;
}

.item-card.is-collapsed .item-card-head {
    margin-bottom: 0 !important;
}

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
        padding: 14px;
    }

    .app-side-rail {
        width: auto;
        position: static;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        margin-bottom: 14px;
    }

    .rail-tile {
        min-height: 62px;
    }

    .app-navbar-shell {
        border-radius: 20px;
    }

    .app-navbar .navbar-collapse {
        margin-top: 14px;
    }

    .app-userbar {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
        padding-top: 8px;
    }

    .app-userbar-meta {
        text-align: left;
    }

    .page-hero {
        padding: 22px;
    }

    .hero-stats,
    .action-grid {
        grid-template-columns: 1fr;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 767.98px) {
    body.app-body {
        background:
            radial-gradient(circle at top left, rgba(82, 140, 236, 0.14), transparent 22%),
            linear-gradient(180deg, #edf4ff 0%, #f8fbff 100%);
    }

    .app-side-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .app-shell {
        padding: 10px;
        gap: 12px;
    }

    .app-side-rail {
        margin-bottom: 10px;
    }

    .rail-tile {
        min-height: 54px;
        padding: 8px 10px;
        border-radius: 18px;
        font-size: 0.72rem;
    }

    .app-navbar {
        margin-bottom: 12px;
    }

    .app-navbar-shell {
        padding: 12px 14px;
        border-radius: 18px;
        gap: 12px;
    }

    .app-brand {
        gap: 10px;
        margin-right: 0;
    }

    .app-brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 1.2rem;
    }

    .app-brand-title {
        font-size: 0.92rem;
    }

    .app-brand-subtitle {
        font-size: 0.65rem;
        letter-spacing: 0.08em;
    }

    .app-navbar .nav-link {
        padding: 9px 12px;
        font-size: 0.92rem;
    }

    .app-userbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .app-userbar .btn {
        width: 100%;
    }

    .page-hero,
    .panel-body,
    .panel-header,
    .metric-card,
    .card-body,
    .billing-form .card-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .page-title {
        font-size: 2.1rem;
    }

    .page-subtitle {
        font-size: 0.94rem;
        line-height: 1.6;
    }

    .hero-actions {
        width: 100%;
        flex-direction: column;
    }

    .hero-actions .btn,
    .hero-actions .hero-stat {
        width: 100%;
    }

    .hero-stats {
        gap: 10px;
        margin-top: 16px;
    }

    .hero-stat {
        padding: 14px 16px;
        border-radius: 18px;
    }

    .hero-stat strong {
        font-size: 1.5rem;
    }

    .metric-card {
        padding-top: 18px;
        padding-bottom: 18px;
    }

    .metric-value {
        font-size: 1.9rem;
    }

    .panel-header {
        padding-top: 16px;
        gap: 10px;
    }

    .panel-body {
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .action-tile {
        padding: 16px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .password-field-wrap {
        flex-direction: column;
    }

    .password-toggle-btn {
        min-width: 0;
    }

    .d-flex.gap-2,
    .d-flex.flex-wrap.gap-2,
    .d-flex.flex-wrap.gap-3,
    .d-flex.gap-3 {
        width: 100%;
    }

    .btn-group,
    .btn-group-sm {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .btn-group > .btn,
    .btn-group-sm > .btn {
        border-radius: 12px !important;
        width: 100%;
    }

    .table-responsive {
        border-radius: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 760px;
    }

    .table thead th,
    .table tbody td {
        white-space: nowrap;
    }

    .billing-form .row.g-4 {
        --bs-gutter-y: 1rem;
    }

    .billing-form .item-card {
        padding: 14px !important;
    }

    .billing-form .item-card-head {
        grid-template-columns: 1fr;
    }

    .billing-form .item-row-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .billing-form .item-card .row.g-3,
    .billing-form .item-card .row.g-2 {
        --bs-gutter-y: 0.75rem;
    }

    .billing-form .summary-box {
        padding: 14px;
    }

    .billing-form .summary-box strong {
        font-size: 1.15rem;
    }

    .login-shell {
        min-height: auto;
        padding: 10px 0 18px;
    }

    .login-card {
        border-radius: 22px;
    }

    .login-showcase {
        padding: 1.7rem;
    }

    .login-brand-mark {
        width: 88px;
        height: 88px;
        margin-bottom: 16px;
        border-radius: 24px;
        font-size: 2.8rem;
    }

    .login-brand-image {
        width: 96px;
        height: 96px;
        margin-bottom: 16px;
    }

    .login-brand-name {
        font-size: 1.8rem;
    }

    .login-brand-subtitle {
        font-size: 0.78rem;
    }
}

@media (max-width: 575.98px) {
    .app-shell {
        padding: 8px;
    }

    .page-title {
        font-size: 1.85rem;
    }

    .page-kicker,
    .metric-label,
    .summary-box span,
    .hero-stat span {
        font-size: 0.68rem;
    }

    .hero-actions .btn,
    .panel-header .btn,
    .panel-body .btn {
        min-height: 46px;
    }

    .btn-group,
    .btn-group-sm {
        grid-template-columns: 1fr;
    }

    .table {
        min-width: 680px;
    }
}

@media print {
    .app-side-rail,
    .navbar,
    .btn,
    .alert,
    .app-backdrop {
        display: none !important;
    }

    body {
        background: #fff !important;
    }
}
