:root {
    --ink-950: #08111f;
    --ink-900: #0c1728;
    --ink-800: #13243a;
    --slate-600: #63738b;
    --slate-300: #c9d3df;
    --paper: #f4f7fb;
    --white: #ffffff;
    --electric: #2f6bff;
    --mint: #28d7a0;
    --amber: #ffb547;
    --danger: #f15b70;
    --line: #dfe6ef;
    --display: 'Space Grotesk', sans-serif;
    --body: 'Manrope', sans-serif;
    --mono: 'IBM Plex Mono', monospace;
    --sidebar-width: 264px;
}

html {
    background: var(--paper);
}
body {
    font-family: var(--body);
    color: var(--ink-900);
    background: var(--paper);
}
h1,
h2,
h3,
h4,
h5,
.brand-copy {
    font-family: var(--display);
}
a {
    color: var(--electric);
}

.content-wrapper {
    background: var(--paper);
}
.content-header {
    padding: 28px 28px 14px;
}
.content-header h1 {
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -0.045em;
}
.section-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--electric);
    font: 600 0.6rem var(--mono);
    letter-spacing: 0.14em;
}
.page-lead {
    max-width: 560px;
    margin: 7px 0 0;
    color: var(--slate-600);
    font-size: 0.86rem;
}
.content {
    padding: 0 20px 28px;
}

.kanata-sidebar {
    width: var(--sidebar-width);
    background: var(--ink-950);
    box-shadow: none !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.brand-link {
    height: 74px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-950);
    background: var(--mint);
    box-shadow: 0 0 0 5px rgba(40, 215, 160, 0.1);
}
.brand-copy {
    display: flex;
    flex-direction: column;
    color: var(--white);
    line-height: 1;
    letter-spacing: -0.02em;
}
.brand-copy strong {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
}
.brand-copy small {
    color: #7f91aa;
    font: 500 0.58rem/1.6 var(--mono);
    letter-spacing: 0.16em;
}
.sidebar {
    padding: 0 12px;
}
.user-panel {
    align-items: center;
    padding: 18px 8px !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}
.user-initials {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--ink-800);
    border: 1px solid #28405e;
    color: var(--mint);
    font: 600 0.78rem var(--mono);
}
.user-panel .info {
    min-width: 0;
    line-height: 1.2;
}
.user-panel .info a {
    color: #e8eef6;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-kicker {
    display: block;
    color: #6e819c;
    font: 500 0.55rem var(--mono);
    letter-spacing: 0.13em;
    margin-bottom: 4px;
}
.nav-sidebar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 44px;
    color: #95a6bb;
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: 0.88rem;
    font-weight: 600;
}
.nav-sidebar .nav-link .nav-icon {
    width: 24px;
    margin-right: 10px;
    font-size: 0.92rem;
}
.nav-sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.nav-sidebar .nav-link.active {
    color: #fff !important;
    background: var(--ink-800) !important;
    box-shadow: none !important;
}
.nav-sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    width: 3px;
    height: 22px;
    border-radius: 0 4px 4px 0;
    background: var(--mint);
    box-shadow: 0 0 14px var(--mint);
}
.nav-sidebar .nav-link.active .nav-icon {
    color: var(--mint);
}
.nav-header {
    color: #52657e !important;
    font: 600 0.58rem var(--mono) !important;
    letter-spacing: 0.17em;
    padding: 22px 12px 8px !important;
}

.kanata-topbar {
    min-height: 74px;
    margin-left: var(--sidebar-width);
    background: rgba(244, 247, 251, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    padding: 0 22px;
}
.menu-trigger {
    width: 40px;
    height: 40px;
    display: grid !important;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--ink-900) !important;
}
.page-context {
    margin-left: 18px;
    color: var(--slate-600);
    font: 600 0.64rem var(--mono);
    letter-spacing: 0.14em;
}
.pulse-dot,
.system-status i {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 9px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 5px rgba(40, 215, 160, 0.12);
}
.logout-link {
    display: flex !important;
    align-items: center;
    gap: 9px;
    color: var(--slate-600) !important;
    font-size: 0.82rem;
    font-weight: 700;
}
.logout-form {
    margin: 0;
}
.logout-form button {
    border: 0;
    background: transparent;
}

.card {
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 12px 35px rgba(25, 45, 75, 0.06);
    overflow: hidden;
}
.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: 18px 20px;
}
.card-title {
    font-weight: 700;
    letter-spacing: -0.02em;
}
.filter-count {
    display: inline-flex;
    margin-left: 8px;
    padding: 4px 7px;
    border-radius: 99px;
    color: #175b49;
    background: rgba(40, 215, 160, 0.14);
    font: 600 0.58rem var(--mono);
    vertical-align: middle;
}
.card-body {
    padding: 20px;
}
.card-primary.card-outline,
.card-info.card-outline,
.card-success.card-outline,
.card-warning.card-outline,
.card-danger.card-outline {
    border-top: 3px solid var(--electric);
}
.card-success.card-outline {
    border-top-color: var(--mint);
}
.card.card-primary:not(.card-outline) > .card-header,
.card.card-info:not(.card-outline) > .card-header,
.card.card-success:not(.card-outline) > .card-header,
.card.card-warning:not(.card-outline) > .card-header,
.card.card-danger:not(.card-outline) > .card-header {
    color: var(--white);
    background: var(--ink-800);
    border-bottom: 3px solid var(--mint);
}
.card-warning.card-outline {
    border-top-color: var(--amber);
}
.card-danger.card-outline {
    border-top-color: var(--danger);
}

.small-box {
    min-height: 142px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: none;
    color: var(--white) !important;
}
.small-box.bg-info,
.small-box.bg-primary {
    background: var(--electric) !important;
}
.small-box.bg-success {
    background: #0c9e78 !important;
}
.small-box.bg-danger {
    background: #d84f65 !important;
}
.small-box .inner {
    padding: 22px;
}
.small-box h3 {
    font: 600 clamp(1.35rem, 2.4vw, 2rem) var(--mono);
    letter-spacing: -0.05em;
}
.small-box p {
    opacity: 0.78;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.small-box .icon {
    top: 12px;
    right: 18px;
    opacity: 0.12;
}
.small-box-footer {
    background: rgba(0, 0, 0, 0.12) !important;
    padding: 8px !important;
    font-size: 0.75rem;
}

.btn {
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 0.58rem 0.9rem;
}
.btn-primary {
    background: var(--electric);
    border-color: var(--electric);
    box-shadow: 0 7px 18px rgba(47, 107, 255, 0.18);
}
.btn-primary:hover,
.btn-primary:focus {
    background: #1d59ea;
    border-color: #1d59ea;
}
.form-control,
.custom-select {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink-900);
}
.form-control:focus,
.custom-select:focus {
    border-color: var(--electric);
    box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}
.table {
    color: var(--ink-900);
}
.table thead th {
    border: 0;
    background: #f7f9fc;
    color: var(--slate-600);
    font: 600 0.65rem var(--mono);
    letter-spacing: 0.07em;
    text-transform: uppercase;
}
.table td {
    border-top-color: #edf1f6;
    vertical-align: middle;
}
.modal-content {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(8, 17, 31, 0.25);
    overflow: hidden;
}
.delete-dialog {
    padding: 30px;
    text-align: center;
}
.delete-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin: 0 auto 20px;
    border-radius: 16px;
    color: var(--danger);
    background: rgba(241, 91, 112, 0.12);
    font-size: 1.1rem;
}
.delete-dialog h4 {
    margin: 8px 0 14px;
    font-weight: 700;
    letter-spacing: -0.035em;
}
.delete-dialog p {
    margin-bottom: 8px;
}
.alert {
    border: 0;
    border-radius: 12px;
}
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 16px;
    text-align: center;
}
.empty-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border-radius: 14px;
    color: var(--electric);
    background: rgba(47, 107, 255, 0.1);
}
.empty-state strong {
    font-family: var(--display);
    font-size: 1rem;
}
.empty-state p {
    margin: 6px 0 16px;
    color: var(--slate-600);
    font-size: 0.78rem;
}

.main-footer {
    margin-left: var(--sidebar-width);
    border-top: 1px solid var(--line);
    background: var(--paper);
    color: var(--slate-600);
    font-size: 0.72rem;
    padding: 18px 28px;
}
.footer-separator {
    margin: 0 8px;
    color: var(--slate-300);
}
.system-status {
    font: 600 0.58rem var(--mono);
    letter-spacing: 0.12em;
}
.system-status i {
    width: 6px;
    height: 6px;
    margin-right: 7px;
}

/* Login: split-screen financial cockpit */
.kanata-login-page {
    min-height: 100vh;
    display: block;
    background: var(--paper);
}
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 1.1fr) minmax(420px, 0.9fr);
}
.login-story {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(34px, 5vw, 72px);
    overflow: hidden;
    color: #fff;
    background: var(--ink-950);
}
.login-story::after {
    content: '';
    position: absolute;
    width: 520px;
    height: 520px;
    right: -240px;
    top: 15%;
    border: 1px solid rgba(47, 107, 255, 0.35);
    border-radius: 50%;
    box-shadow:
        0 0 0 80px rgba(47, 107, 255, 0.035),
        0 0 0 160px rgba(47, 107, 255, 0.02);
}
.story-topline,
.login-index,
.login-meta {
    position: relative;
    z-index: 1;
    font: 600 0.62rem var(--mono);
    letter-spacing: 0.13em;
    color: #7f91aa;
}
.story-copy {
    position: relative;
    z-index: 1;
    max-width: 650px;
}
.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: clamp(50px, 10vh, 110px);
    font: 700 1rem var(--display);
    letter-spacing: 0.15em;
}
.story-copy h1 {
    margin: 0;
    font-size: clamp(3.4rem, 7vw, 7.4rem);
    font-weight: 600;
    line-height: 0.86;
    letter-spacing: -0.075em;
}
.story-copy h1 em {
    color: var(--mint);
    font-style: normal;
}
.story-copy p {
    max-width: 510px;
    margin-top: 34px;
    color: #9fb0c5;
    font-size: clamp(0.95rem, 1.3vw, 1.12rem);
    line-height: 1.8;
}
.ledger-pulse {
    position: relative;
    z-index: 1;
    height: 54px;
    display: flex;
    align-items: center;
    gap: clamp(10px, 2vw, 28px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.ledger-pulse span {
    flex: 1;
    height: 1px;
    background: #3a4b62;
}
.ledger-pulse span:nth-child(2) {
    height: 15px;
    background: var(--electric);
}
.ledger-pulse span:nth-child(4) {
    height: 36px;
    background: var(--mint);
}
.ledger-pulse span:nth-child(6) {
    height: 22px;
    background: var(--amber);
}
.login-panel {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 42px;
}
.login-box {
    width: min(100%, 430px);
    margin: 0;
}
.login-heading {
    margin-bottom: 26px;
}
.login-heading h2 {
    margin: 15px 0 8px;
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.055em;
}
.login-heading p {
    color: var(--slate-600);
}
.login-card {
    box-shadow: 0 24px 65px rgba(25, 45, 75, 0.1);
}
.login-card-body {
    padding: 30px;
    background: var(--white);
}
.login-form label {
    color: #46566c;
    font-size: 0.74rem;
    font-weight: 700;
}
.login-form .input-group-text {
    min-width: 46px;
    justify-content: center;
    color: var(--slate-600);
    background: #f7f9fc;
    border-color: var(--line);
    border-radius: 0 10px 10px 0;
}
.login-submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding-inline: 18px;
}
.login-help {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    color: var(--slate-600);
    font-size: 0.76rem;
    line-height: 1.6;
}
.login-help > span {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #087c5d;
    background: rgba(40, 215, 160, 0.13);
}
.login-help code {
    color: var(--electric);
    background: #eef3ff;
    padding: 2px 5px;
    border-radius: 4px;
}
.login-meta {
    margin: 22px 0 0;
    text-align: center;
    color: #9ca9b9;
}
.login-meta span {
    margin: 0 8px;
    color: var(--mint);
}

@media (min-width: 992px) {
    .content-wrapper {
        margin-left: var(--sidebar-width) !important;
    }
}
@media (max-width: 991.98px) {
    .kanata-sidebar {
        width: 250px;
    }
    .kanata-topbar,
    .main-footer {
        margin-left: 0;
    }
    .login-shell {
        grid-template-columns: 1fr;
    }
    .login-story {
        min-height: 360px;
        padding: 34px 28px;
    }
    .story-copy h1 {
        font-size: clamp(3.4rem, 13vw, 5.4rem);
    }
    .brand-lockup {
        margin-bottom: 48px;
    }
    .story-copy p {
        margin-top: 22px;
    }
    .ledger-pulse {
        margin-top: 35px;
    }
    .login-panel {
        min-height: auto;
        padding: 48px 22px 70px;
    }
}
@media (max-width: 575.98px) {
    .content-header {
        padding: 22px 18px 10px;
    }
    .content {
        padding: 0 10px 22px;
    }
    .kanata-topbar {
        min-height: 64px;
        padding: 0 12px;
    }
    .logout-link span {
        display: none;
    }
    .card {
        border-radius: 13px;
    }
    .login-story {
        min-height: 330px;
    }
    .story-topline {
        font-size: 0.52rem;
    }
    .story-copy p {
        font-size: 0.88rem;
        line-height: 1.65;
    }
    .login-panel {
        padding-top: 38px;
    }
    .login-card-body {
        padding: 24px 20px;
    }
    .content-header .row {
        align-items: center;
    }
    .content-header h1 {
        font-size: 1.65rem;
    }
    .content-header h1 > i {
        display: none;
    }
    .breadcrumb {
        float: none !important;
        margin-top: 6px;
        padding: 0;
        font-size: 0.76rem;
        background: transparent;
    }
    .card-header .card-tools {
        position: static;
        width: 100%;
        margin: 14px 0 0;
    }
    .card-header .card-tools form {
        width: 100% !important;
    }

    /* Mobile users become readable identity cards instead of a clipped table. */
    .page-users .table-responsive {
        overflow: visible;
    }
    .page-users table,
    .page-users tbody,
    .page-users tr,
    .page-users td {
        display: block;
        width: 100%;
    }
    .page-users thead {
        display: none;
    }
    .page-users tbody {
        padding: 8px 14px;
    }
    .page-users tbody tr {
        position: relative;
        margin: 10px 0;
        padding: 16px 52px 16px 16px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--white);
    }
    .page-users tbody td {
        padding: 2px 0;
        border: 0;
        white-space: normal;
    }
    .page-users tbody td:first-child {
        padding-right: 4px;
        font-weight: 700;
    }
    .page-users tbody td:nth-child(2) code {
        display: block;
        overflow: hidden;
        color: var(--slate-600);
        font-size: 0.67rem;
        text-overflow: ellipsis;
    }
    .page-users tbody td:nth-child(3),
    .page-users tbody td:nth-child(5),
    .page-users tbody td:nth-child(6),
    .page-users tbody td:nth-child(7) {
        display: none;
    }
    .page-users tbody td:nth-child(4) {
        margin-top: 8px;
    }
    .page-users tbody td:nth-child(8) {
        position: absolute;
        top: 14px;
        right: 14px;
        width: auto;
    }
    .page-users .card-footer {
        border-top: 0;
        background: var(--white);
    }

    /* Empty transaction tables should read as a state, not a broken grid. */
    .page-index .table tbody tr:only-child td[colspan] {
        display: block;
        width: 100%;
        padding: 32px 16px !important;
    }
    .page-index .table:has(tbody tr:only-child td[colspan]) thead {
        display: none;
    }
}
@media (prefers-reduced-motion: no-preference) {
    .pulse-dot {
        animation: kanata-pulse 2.4s ease-out infinite;
    }
    .card,
    .small-box,
    .btn {
        transition:
            transform 0.2s ease,
            box-shadow 0.2s ease,
            border-color 0.2s ease;
    }
    .card:hover {
        transform: translateY(-1px);
        box-shadow: 0 16px 42px rgba(25, 45, 75, 0.09);
    }
}
@keyframes kanata-pulse {
    0%,
    45% {
        box-shadow: 0 0 0 0 rgba(40, 215, 160, 0.28);
    }
    80%,
    100% {
        box-shadow: 0 0 0 8px rgba(40, 215, 160, 0);
    }
}
