/* LM design system - adapted from LM_CapacityManagement.
   Brand navy #013469, accent indigo #667eea / purple #764ba2. */

html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #667eea;
}

.btn-primary {
    color: #fff;
    background-color: #667eea;
    border-color: #5a6fd6;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #5a6fd6;
    border-color: #4e5fc2;
}

/* ── Sign-in "dialog" card ── */
.login-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 1rem 3rem;
}

/* 68px, not LM_Board's 52: this app uses the roundel rather than the bare white mark (see
   AuthCard.razor), and a circle needs a little more height than a wordmark to carry the same
   visual weight above a 430px card. */
.login-logo {
    height: 68px;
    width: auto;
    margin-bottom: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(1, 52, 105, 0.14);
    padding: 2.5rem 2.25rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #013469;
    text-align: center;
    margin-bottom: 0.35rem;
}

.login-title.danger {
    color: #c0392b;
}

.login-subtitle {
    text-align: center;
    color: #6b7280;
    margin-bottom: 1.75rem;
}

/* Full-width navy primary action, matching the brand top bar. */
.btn-login {
    width: 100%;
    background: #013469;
    border: 1px solid #013469;
    color: #fff;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-login:hover,
.btn-login:focus {
    background: #012a55;
    border-color: #012a55;
    color: #fff;
}

/* Secondary sign-in option (passkey): outlined so it reads below the primary button. */
.btn-login-outline {
    width: 100%;
    background: #fff;
    border: 1px solid #013469;
    color: #013469;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-login-outline:hover,
.btn-login-outline:focus {
    background: #f0f4fa;
    color: #013469;
}

.login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
    margin: 1.25rem 0;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid #e5e7eb;
}

.login-divider::before { margin-right: 0.75rem; }
.login-divider::after { margin-left: 0.75rem; }

.login-links {
    text-align: center;
}

.login-links a {
    font-weight: 600;
    text-decoration: none;
}

.login-links a:hover {
    text-decoration: underline;
}

.login-note {
    text-align: center;
    color: #9ca3af;
    font-size: 0.82rem;
    margin-top: 1.5rem;
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .login-card {
        padding: 2rem 1.5rem;
    }
}

/* ── Two-row navbar ── */
.navbar-wrapper {
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.navbar-top {
    background: #013469;
    padding: 0.5rem 1rem;
}

.navbar-top .navbar-brand {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.navbar-top .navbar-logo {
    height: 40px;
    width: auto;
    margin-right: 12px;
}

.navbar-top .brand-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.user-section {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    color: #fff;
}

.user-info .user-name {
    font-weight: 500;
}

.user-info i.fa-user-circle {
    font-size: 1.25rem;
}

/* Menu bar */
.navbar-menu {
    background: #013469;
    padding: 0;
    min-height: auto;
    box-shadow: none;
}

.navbar-menu .container-fluid {
    padding: 0;
    display: flex;
    align-items: stretch;
}

.navbar-menu .navbar-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    margin: 0;
    padding: 0;
    list-style: none;
}

.navbar-menu .nav-item {
    display: flex;
    align-items: stretch;
    margin: 0;
    padding: 0;
}

.navbar-menu .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    line-height: 1.5;
}

.navbar-menu .nav-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.15);
}

.navbar-menu .nav-link.active {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.2);
}

/* ── Cards ── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    background-color: #fff;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 1rem 1.25rem;
    font-weight: 600;
    border-radius: 12px 12px 0 0 !important;
}

.card-body {
    padding: 1.25rem;
}

/* ── Forms & tables ── */
.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.table {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.page-header {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* ── Register statement: pinned toolbar and totals ──
   A statement runs to dozens of rows. Two things must never scroll away: the actions (hunting for
   "Add entry" at the bottom of a long list is miserable) and the net position (a net-worth statement
   whose grand total is off-screen has buried its own answer).

   <main> is the app's scroll container (MainLayout.razor.css), so top/bottom 0 resolve to its
   visible edges - no offset for the nav bar height, and nothing to re-tune if the nav ever changes.
   Both bars are opaque so rows pass cleanly behind them. */
/* Sits clear of the nav at rest and docks flush only once scrolled.
   Two earlier attempts were worse: a negative margin-top pulled it hard against the menu bar so it
   read as clipped, and a sticky `top` offset left a gap that rows scrolled through, which looked
   like a rendering fault. Letting .content's own padding do the spacing needs neither - and with no
   negative margin there is no way for the card to end up underlapping the nav. */
.register-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0.8rem 1.1rem;
    margin-bottom: 1rem;
}

/* .page-title is otherwise a bare h1 at Bootstrap's 2.5rem, which is most of why this header was
   so tall. The period label does not need to be the loudest thing on the page. */
.register-toolbar .page-title {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
}

.register-totals {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin-bottom: 0;
    /* Upward shadow: signals that rows continue underneath rather than the list having ended. */
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.10);
}

@media (max-width: 767.98px) {
    .register-toolbar {
        padding: 0.55rem 0.85rem;
    }

    .register-toolbar .page-title {
        font-size: 1.05rem;
    }
}

/* ── Dashboard: KPI stat cards ── */
.stat-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    padding: 1.15rem 1.35rem;
    display: flex;
    /* Top-align the text: cards with a sub-line are taller, and centring would push the labels of
       the shorter cards down so they no longer line up across the row. */
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    height: 100%;
}

.stat-label {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.72rem;
    font-weight: 600;
    color: #8a94a6;
    margin-bottom: 0.15rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.05;
    color: #1a2230;
    font-variant-numeric: tabular-nums;
}

.stat-sub {
    font-size: 0.76rem;
    color: #8a94a6;
    margin-top: 0.2rem;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    flex-shrink: 0;
    align-self: center; /* icon stays vertically centred even though the text is top-aligned */
}

.stat-icon-navy { background: linear-gradient(135deg, #013469, #1e5aa8); }
.stat-icon-purple { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-icon-green { background: linear-gradient(135deg, #11998e, #38ef7d); }
.stat-icon-pink { background: linear-gradient(135deg, #f093fb, #f5576c); }
.stat-icon-blue { background: linear-gradient(135deg, #4facfe, #00c6fb); }
.stat-icon-red { background: linear-gradient(135deg, #ff6a6a, #ee0979); }
.stat-icon-amber { background: linear-gradient(135deg, #f7971e, #ffd200); }

/* Count pill used in dashboard summary tables */
.count-pill {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    background: #013469;
    color: #fff;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ── Subtle badges ──
   Bootstrap 5.3 added the bg-*-subtle / text-*-emphasis utilities; this app self-hosts 5.1, where
   they don't exist. Without them a `badge bg-primary-subtle text-primary-emphasis` renders as
   .badge's white text on a transparent background - invisible except when the row highlights on
   hover. Values are Bootstrap 5.3's own light-theme subtle/emphasis pairs. */
.bg-primary-subtle { background-color: #cfe2ff !important; }
.bg-secondary-subtle { background-color: #e2e3e5 !important; }
.bg-success-subtle { background-color: #d1e7dd !important; }
.bg-info-subtle { background-color: #cff4fc !important; }
.bg-warning-subtle { background-color: #fff3cd !important; }
.bg-danger-subtle { background-color: #f8d7da !important; }

.text-primary-emphasis { color: #052c65 !important; }
.text-secondary-emphasis { color: #2b2f32 !important; }
.text-success-emphasis { color: #0a3622 !important; }
.text-info-emphasis { color: #055160 !important; }
.text-warning-emphasis { color: #664d03 !important; }
.text-danger-emphasis { color: #58151c !important; }

/* ── Toasts (self-dismissing "it worked" feedback) ── */
.toast-host {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none; /* let clicks through the empty container */
}

.toast-item {
    pointer-events: auto;
    display: flex;
    align-items: center;
    min-width: 260px;
    max-width: 380px;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: #fff;
    font-size: 0.92rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    animation: toast-in 0.22s ease-out;
}

.toast-success { background: #1e7e4f; }
.toast-danger { background: #c0392b; }
.toast-warning { background: #9a6700; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .toast-item {
        animation: none;
    }
}

@media (max-width: 575.98px) {
    .toast-host {
        left: 1rem;
        right: 1rem;
    }

    .toast-item {
        min-width: 0;
        max-width: none;
    }
}

/* ── Responsive / mobile ── */

/* Wrapped tables keep the rounded card look while scrolling horizontally on narrow screens. */
.table-responsive {
    border-radius: 12px;
}

/* Rating scale: comfortable finger targets, wrap cleanly instead of overflowing. */
.rating-options .btn {
    min-height: 44px;
}

/* Menu bar: on tablets/phones let items wrap to another line rather than run off-screen. */
@media (max-width: 991.98px) {
    .navbar-menu .navbar-nav {
        flex-wrap: wrap;
    }

    .navbar-menu .nav-link {
        padding: 0.55rem 0.85rem;
    }
}

/* Small screens: tidy the header rows, page titles and card padding. */
@media (max-width: 767.98px) {
    .page-header {
        padding: 1.1rem;
    }

    .page-header h1,
    h1 {
        font-size: 1.5rem;
    }

    /* Title-and-actions rows stack instead of squashing. */
    .page-header.d-flex,
    .page-header .d-flex {
        flex-wrap: wrap;
        gap: 0.6rem;
    }

    .card-header,
    .card-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Very small screens: keep the top brand bar uncramped. */
@media (max-width: 575.98px) {
    .navbar-top {
        padding: 0.5rem 0.75rem;
    }

    .navbar-top .brand-text {
        font-size: 1.05rem;
    }

    .user-info .user-name {
        display: none;
    }
}
