@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
    --bg: #f2f7ff;
    --bg-soft: #edf3fd;
    --card: #ffffff;
    --card-border: #d8e4f2;
    --text: #0f172a;
    --muted: #64748b;
    --accent: #0869c9;
    --accent-2: #0e9f95;
    --sidebar-top: #0b1528;
    --sidebar-bottom: #102d53;
    --sidebar-link: #b9cae6;
    --sidebar-link-hover: #ecf4ff;
    --danger: #cc2b2b;
    --shadow-soft: 0 10px 28px rgba(12, 33, 62, 0.08);
    --shadow-card: 0 14px 34px rgba(13, 33, 61, 0.1);
    --radius-card: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Manrope", "Segoe UI", sans-serif;
    background:
        radial-gradient(1200px 540px at 0% -8%, rgba(8, 105, 201, 0.12), transparent 68%),
        radial-gradient(950px 460px at 100% -10%, rgba(14, 159, 149, 0.12), transparent 68%),
        linear-gradient(180deg, var(--bg), var(--bg-soft));
}

::selection {
    background: rgba(8, 105, 201, 0.2);
    color: #05152b;
}

.app-shell,
.firm-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar,
.firm-sidebar {
    width: 274px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--sidebar-top) 0%, var(--sidebar-bottom) 100%);
    color: #fff;
    box-shadow: 0 18px 44px rgba(8, 20, 42, 0.35);
    display: flex;
    flex-direction: column;
}

.sidebar .brand,
.firm-sidebar .brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 800;
    color: #041120;
    background: linear-gradient(135deg, #f4f9ff, #9cc9ff);
}

.nav-stack {
    display: grid;
    gap: 0.24rem;
    padding: 0.72rem;
}

.sidebar .nav-link,
.firm-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.64rem;
    border-radius: 12px;
    padding: 0.68rem 0.82rem;
    color: var(--sidebar-link);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sidebar .nav-link i,
.firm-sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 0.98rem;
}

.sidebar .nav-link:hover,
.firm-sidebar .nav-link:hover {
    color: var(--sidebar-link-hover);
    transform: translateX(2px);
    background: rgba(255, 255, 255, 0.08);
}

.sidebar .nav-link.active,
.firm-sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(8, 105, 201, 0.96), rgba(14, 159, 149, 0.96));
    box-shadow: 0 10px 24px rgba(13, 84, 160, 0.35);
}

.sidebar .nav-tree {
    display: grid;
    gap: 0.2rem;
    margin: -0.08rem 0 0.28rem 0.35rem;
    padding-left: 0.72rem;
    border-left: 1px dashed rgba(185, 202, 230, 0.35);
}

.sidebar .nav-sublink {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.58rem;
    border-radius: 10px;
    color: rgba(221, 233, 252, 0.86);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sidebar .nav-sublink i {
    width: 16px;
    text-align: center;
    font-size: 0.78rem;
}

.sidebar .nav-sublink:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
}

.sidebar .nav-sublink.active {
    color: #fff;
    background: rgba(8, 105, 201, 0.38);
    box-shadow: inset 0 0 0 1px rgba(120, 178, 245, 0.42);
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.9rem 0.8rem 1rem;
}

.app-shell > .content-area,
.firm-shell > .firm-content {
    flex: 1;
    min-width: 0;
    padding: 0;
}

.app-shell > .content-area > .container-fluid,
.firm-shell > .firm-content > .container-fluid {
    padding: 1.55rem 1.65rem;
}

.content-area > .content-area {
    padding: 0;
}

.content-area > * {
    animation: fade-up 0.28s ease both;
}

.container-fluid {
    max-width: 100%;
}

.container {
    max-width: 1240px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #0b1a34;
    font-weight: 800;
    letter-spacing: -0.01em;
}

h4 {
    font-size: clamp(1.3rem, 1.1rem + 0.6vw, 1.75rem);
}

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

.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
}

.card.shadow-sm {
    box-shadow: var(--shadow-card) !important;
}

.card-header {
    background: linear-gradient(180deg, #f8fbff, #eef5ff);
    border-bottom: 1px solid var(--card-border);
    border-top-left-radius: var(--radius-card) !important;
    border-top-right-radius: var(--radius-card) !important;
    font-weight: 700;
    padding: 0.82rem 1rem;
}

.card-body {
    padding: 1rem 1.1rem;
}

.list-group-item {
    border-color: #dbe5f2;
    background: transparent;
}

.display-6 {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.btn {
    border-radius: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 0.54rem 0.9rem;
}

.btn-sm {
    padding: 0.35rem 0.68rem;
}

.btn-primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.btn-primary:hover,
.btn-primary:focus-visible {
    border-color: transparent;
    background: linear-gradient(135deg, #085db3, #0d8c84);
}

.btn-success {
    border-color: transparent;
    background: linear-gradient(135deg, #1e9d55, #13af95);
}

.btn-success:hover,
.btn-success:focus-visible {
    border-color: transparent;
    background: linear-gradient(135deg, #19864a, #109581);
}

.btn-outline-primary {
    border-color: #9dbde3;
    color: #0b5cb1;
}

.btn-outline-primary:hover {
    background: #0b5cb1;
    border-color: #0b5cb1;
    color: #fff;
}

.btn-outline-danger {
    border-color: #f2b7bf;
    color: #b91c1c;
}

.btn-outline-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.form-label {
    margin-bottom: 0.35rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: #324256;
}

.form-control,
.form-select {
    border-radius: 11px;
    border-color: #ccdae9;
    min-height: 42px;
    box-shadow: none !important;
}

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

.form-control:focus,
.form-select:focus {
    border-color: #65a6e5;
    box-shadow: 0 0 0 0.22rem rgba(8, 105, 201, 0.14) !important;
}

.table-responsive {
    border-radius: 14px;
    border: 1px solid #d8e4f2;
    background: #fff;
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    border-bottom-color: #dbe5f2;
    padding-top: 0.64rem;
    padding-bottom: 0.64rem;
}

.table thead th {
    background: linear-gradient(180deg, #f8fbff, #eef5ff);
    color: #334155;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.045em;
    border-bottom-color: #cfdeee;
    white-space: nowrap;
}

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

.badge {
    border-radius: 999px;
    padding: 0.42rem 0.62rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.alert {
    border-radius: 12px;
    border: 1px solid transparent;
}

.alert-info {
    color: #0f3f69;
    background: #eaf5ff;
    border-color: #cce4fa;
}

.modal-content {
    border-radius: 16px;
    border: 1px solid #d6e2f0;
    box-shadow: 0 24px 58px rgba(6, 22, 47, 0.24);
}

.modal-header {
    border-bottom-color: #e1eaf5;
}

.modal-footer {
    border-top-color: #e1eaf5;
}

.modal-backdrop.show {
    opacity: 0.42;
    backdrop-filter: blur(1.3px);
}

.navbar {
    border-bottom: 1px solid #cfddec;
    background: linear-gradient(90deg, #0b1528, #133664) !important;
}

.navbar .navbar-brand {
    font-weight: 800;
    letter-spacing: 0.02em;
}

.ops-hero,
.hero-card {
    background: linear-gradient(135deg, #0b1f3b, #0f4f8d) !important;
    color: #fff;
    border-radius: 22px;
    border: 0;
    box-shadow: 0 22px 44px rgba(11, 31, 59, 0.22);
}

.format-card,
.quick-card {
    border: 1px solid #dbe6f3;
    border-radius: 18px;
    height: 100%;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.quick-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(12, 30, 56, 0.14);
    transition: all 0.22s ease;
}

.quick-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: #e7f1ff;
    color: #0b5eb3;
}

.ledger-table .sale-col {
    background: #fff8da !important;
}

.ledger-table .bal-col {
    background: #ecf5ff !important;
}

.ledger-table .pay-col {
    background: #f2f1ff !important;
}

.ledger-table thead th {
    vertical-align: middle;
    white-space: nowrap;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.ledger-table td {
    white-space: nowrap;
    font-size: 0.92rem;
}

.sticky-head thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

body.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.auth-shell {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    border: 1px solid #d8e4f2;
    border-radius: 24px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 26px 64px rgba(10, 31, 58, 0.2);
}

.auth-aside {
    padding: 2rem;
    background: linear-gradient(145deg, #0b1f3b, #125b9f);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-aside h1 {
    color: #fff;
    font-size: clamp(1.55rem, 1.4rem + 0.5vw, 2rem);
}

.auth-form {
    padding: 2rem;
    display: flex;
    align-items: center;
}

.auth-form .card {
    width: 100%;
    border: 0;
    box-shadow: none;
}

.auth-form .container {
    max-width: 100%;
    padding: 0 !important;
}

.auth-form .container .card {
    max-width: 470px;
    margin: 0 auto;
}

.auth-form .card-title {
    margin-bottom: 1.4rem !important;
}

.auth-form .form-floating > .form-control {
    height: 52px;
    min-height: 52px;
}

.auth-form .form-floating > label {
    color: #64748b;
}

.auth-footer-note {
    font-size: 0.85rem;
    color: #c8d8ef;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1180px) {
    .sidebar,
    .firm-sidebar {
        width: 92px;
    }

    .sidebar .brand span:not(.brand-mark),
    .firm-sidebar .brand span:not(.brand-mark),
    .sidebar .nav-link span,
    .firm-sidebar .nav-link span {
        display: none;
    }
}

@media (max-width: 900px) {
    .app-shell,
    .firm-shell {
        display: block;
    }

    .sidebar,
    .firm-sidebar {
        width: auto;
        box-shadow: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-stack {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .app-shell > .content-area > .container-fluid,
    .firm-shell > .firm-content > .container-fluid {
        padding: 1rem;
    }

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

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-aside {
        padding: 1.4rem;
    }

    .auth-form {
        padding: 1.1rem;
    }
}
