/* =========================================================
   WhiskersAdmin application styles
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "cv11", "ss01";
    min-height: 100vh;
    min-height: 100dvh;
    accent-color: var(--primary);
}

body {
    padding-bottom: env(safe-area-inset-bottom);
    /* Prevent briefly visible horizontal scrollbar during the mobile page-slide animation. */
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--ink);
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
    font-weight: 700;
    margin: 0 0 var(--space-3);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { margin: 0 0 var(--space-3); color: var(--ink-soft); }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--primary-hover); text-decoration: underline; }

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.1em 0.35em;
    color: var(--ink);
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--space-4) 0;
}

::selection { background: var(--primary-soft); color: var(--ink); }

:focus-visible {
    outline: none;
    box-shadow: var(--shadow-ring);
    border-radius: var(--radius-sm);
}

/* ============ Bootstrap overrides ============ */

.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    transition: background-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
}
.btn:active { transform: translateY(1px); }

.btn-primary,
.btn-primary:focus {
    color: var(--on-brand);
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover,
.btn-primary:active {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--on-brand);
}

.btn-outline-primary,
.btn-outline-primary:focus {
    color: var(--primary);
    background: transparent;
    border-color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary-soft);
    color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-outline-secondary,
.btn-outline-secondary:focus {
    color: var(--ink-soft);
    background: transparent;
    border-color: var(--border-strong);
}
.btn-outline-secondary:hover {
    background: var(--surface-sunken);
    color: var(--ink);
    border-color: var(--border-strong);
}

.btn-outline-danger,
.btn-outline-danger:focus {
    color: var(--danger);
    background: transparent;
    border-color: var(--danger);
}
.btn-outline-danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: var(--danger);
}

.btn-ghost {
    color: var(--ink-soft);
    background: transparent;
    border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-sunken); color: var(--ink); }

.btn:focus,
.btn:active:focus { box-shadow: var(--shadow-ring); }

/* Form controls */
.form-control,
.form-select {
    background-color: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.75rem;
    font-size: var(--text-base);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.form-control::placeholder { color: var(--ink-subtle); }
.form-control:focus,
.form-select:focus {
    background-color: var(--surface);
    color: var(--ink);
    border-color: var(--primary);
    box-shadow: var(--shadow-ring);
    outline: none;
}
.form-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: var(--space-1);
}

/* Alerts */
.alert {
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    padding: 0.75rem 1rem;
    font-size: var(--text-sm);
}
.alert-info { background: var(--primary-soft); color: var(--primary-hover); border-color: transparent; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: transparent; }

/* Tables */
.table {
    color: var(--ink);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--surface-sunken);
    --bs-table-hover-color: var(--ink);
}
.table thead th {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--ink-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 0.75rem;
}
.table tbody td {
    padding: 0.75rem;
    vertical-align: middle;
    border-color: var(--border);
    color: var(--ink-soft);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1rem;
    font-weight: 600;
    color: var(--ink);
}
.card-body { padding: 1rem; }

.badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: var(--radius-pill);
}

/* ============ Preloader ============ */
.app-loading {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    background: var(--bg);
}
.app-loading-mark {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-3xl);
    letter-spacing: var(--tracking-tight);
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.app-loading-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ App shell ============ */
.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--page-gutter);
    padding-top: env(safe-area-inset-top);
}
[data-theme="dark"] .app-topbar {
    background: rgba(11, 18, 32, 0.82);
}

.topbar-inner {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-lg);
    letter-spacing: var(--tracking-tight);
    color: var(--ink);
    text-decoration: none;
}
.brand-mark:hover { color: var(--ink); text-decoration: none; }
.brand-mark-dot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--brand-gradient);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    box-shadow: var(--shadow-sm);
}
.brand-mark-text .sub {
    font-weight: 600;
    color: var(--ink-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    display: block;
    line-height: 1;
    margin-top: 2px;
}
.brand-mark-text .main { display: block; line-height: 1; }

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--ink-soft);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
    font-size: 1.1rem;
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--ink); }
.icon-btn:focus-visible { box-shadow: var(--shadow-ring); outline: none; }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.25rem 0.25rem 0.25rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: var(--text-sm);
    font-weight: 500;
    max-width: 220px;
}
.user-chip .label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* ============ Main layout regions ============ */
.app-body {
    flex: 1;
    width: 100%;
    display: flex;
    gap: var(--space-6);
}

.app-main {
    flex: 1;
    min-width: 0;
    padding: var(--space-4) var(--page-gutter) calc(var(--bottomnav-h) + var(--space-6) + env(safe-area-inset-bottom)) var(--page-gutter);
}

.page-container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
}

/* ============ Page transition (mobile only) ============
   Wrapper gets @key="Nav.Uri" so it's recreated on every route change,
   which re-fires the CSS animation. <html data-nav-back> toggled by a
   popstate listener in index.html to flip direction on browser back.
   Desktop stays static; reduced-motion users get nothing. */
@media (max-width: 767.98px) {
    .page-anim {
        animation: page-slide-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
        will-change: transform, opacity;
    }
    html[data-nav-back] .page-anim {
        animation-name: page-slide-back;
    }
}
@keyframes page-slide-in {
    from { opacity: 0; transform: translate3d(8%, 0, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes page-slide-back {
    from { opacity: 0; transform: translate3d(-8%, 0, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .page-anim { animation: none !important; }
}

/* ============ Sidebar (desktop only) ============ */
.app-sidebar {
    display: none;
}

@media (min-width: 768px) {
    .app-main {
        padding-bottom: var(--space-8);
    }

    .app-sidebar {
        display: flex;
        flex-direction: column;
        width: var(--sidebar-w);
        flex: 0 0 var(--sidebar-w);
        padding: var(--space-4) var(--space-3) var(--space-4) var(--page-gutter);
        position: sticky;
        top: var(--topbar-h);
        align-self: flex-start;
        max-height: calc(100vh - var(--topbar-h));
        overflow-y: auto;
    }
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--ink-soft);
    font-weight: 500;
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.sidebar-link i,
.sidebar-link .whiskers-icon { font-size: 1.1rem; color: var(--ink-muted); width: 1.3rem; text-align: center; }
.sidebar-link:hover { background: var(--surface-sunken); color: var(--ink); text-decoration: none; }
.sidebar-link.active {
    background: var(--primary-soft);
    color: var(--primary-hover);
}
.sidebar-link.active i,
.sidebar-link.active .whiskers-icon { color: var(--primary); }

.sidebar-section-title {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--ink-subtle);
    font-weight: 600;
    padding: var(--space-3) var(--space-3) var(--space-1);
}

/* ============ Bottom nav (mobile only) ============ */
.app-bottomnav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
}
[data-theme="dark"] .app-bottomnav {
    background: rgba(11, 18, 32, 0.9);
}

.bottomnav-inner {
    max-width: 560px;
    margin: 0 auto;
    height: var(--bottomnav-h);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}
.bottomnav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--ink-muted);
    text-decoration: none;
    font-size: var(--text-xs);
    font-weight: 500;
    transition: color var(--dur-fast) var(--ease-out);
    position: relative;
}
.bottomnav-link i,
.bottomnav-link .whiskers-icon { font-size: 1.35rem; }
.bottomnav-link:hover { color: var(--ink); text-decoration: none; }
.bottomnav-link.active {
    color: var(--primary);
}
.bottomnav-link.active::before {
    content: "";
    position: absolute;
    top: 6px;
    width: 28px;
    height: 3px;
    border-radius: 2px;
    background: var(--primary);
}

@media (min-width: 768px) {
    .app-bottomnav { display: none; }
    .app-main { padding-bottom: var(--space-8); }
}

/* ============ Page heads / typography helpers ============ */
.page-head {
    margin-bottom: var(--space-5);
}
.page-head h1 {
    font-size: var(--text-2xl);
    margin: 0;
}
@media (min-width: 768px) {
    .page-head h1 { font-size: var(--text-3xl); }
}
.page-head .eyebrow {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--ink-muted);
    font-weight: 600;
    margin-bottom: var(--space-1);
}
.page-head .subtitle {
    color: var(--ink-muted);
    font-size: var(--text-sm);
    margin: var(--space-1) 0 0;
}

.eyebrow {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--ink-muted);
    font-weight: 600;
}

.muted { color: var(--ink-muted); }
.subtle { color: var(--ink-subtle); }

.divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-4) 0;
}

/* ============ Chips / tags ============ */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    color: var(--ink-soft);
    font-size: var(--text-xs);
    font-weight: 600;
    border: 1px solid var(--border);
}
.chip i { font-size: 0.9rem; }
.chip.chip-brand { background: var(--primary-soft); color: var(--primary-hover); border-color: transparent; }
.chip.chip-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.chip-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.chip.chip-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }

/* ============ Application list cards ============ */
.app-list {
    display: grid;
    gap: var(--space-3);
}
.app-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-med) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
}
.app-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    text-decoration: none;
    color: inherit;
}
.app-card:focus-visible {
    box-shadow: var(--shadow-ring);
    outline: none;
}

.app-card .date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    padding: var(--space-2) var(--space-3);
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
    line-height: 1;
}
.app-card .date-block .mo {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    margin-bottom: 2px;
}
.app-card .date-block .day {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--ink);
}

.app-card .main-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.app-card .name {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--ink);
    line-height: var(--leading-snug);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-card .meta {
    font-size: var(--text-sm);
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.app-card .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-subtle); }
.app-card .meta .cat {
    color: var(--primary-hover);
    font-weight: 600;
}
.app-card .chevron {
    color: var(--ink-subtle);
    font-size: 1.1rem;
}
.app-card .chevron-stack {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.app-card .fav-dot {
    color: var(--accent);
    font-size: 0.95rem;
}

/* ============ Toolbar ============ */
.toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.toolbar .form-select {
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    font-size: var(--text-sm);
}
.toolbar-label {
    font-size: var(--text-sm);
    color: var(--ink-muted);
    font-weight: 600;
}
.toolbar-spacer { flex: 1; }

/* ============ Detail page ============ */
.detail-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    margin-bottom: var(--space-4);
}
.detail-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 100% 0%,
            rgba(62, 156, 196, 0.18) 0%,
            rgba(62, 156, 196, 0.08) 25%,
            rgba(62, 156, 196, 0) 55%);
    pointer-events: none;
}
[data-theme="dark"] .detail-hero::before {
    background:
        radial-gradient(circle at 100% 0%,
            rgba(91, 180, 209, 0.22) 0%,
            rgba(91, 180, 209, 0.08) 30%,
            rgba(91, 180, 209, 0) 60%);
}
.detail-hero .hero-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 800;
    line-height: var(--leading-tight);
    margin: 0 0 var(--space-1);
}
.detail-hero .hero-sub {
    color: var(--ink-muted);
    font-size: var(--text-sm);
    margin: 0 0 var(--space-3);
}
.detail-hero .hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.detail-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-4);
    overflow: hidden;
}
.detail-section h3 {
    margin: 0;
    padding: var(--space-4) var(--space-4) var(--space-2);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    font-family: var(--font-sans);
    color: var(--ink-muted);
    font-weight: 700;
}
.detail-section .section-body {
    padding: var(--space-2) var(--space-4) var(--space-4);
}

.kv-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3) var(--space-4);
    margin: 0;
}
@media (min-width: 620px) {
    .kv-grid { grid-template-columns: 1fr 1fr; }
}
.kv-grid .kv-full { grid-column: 1 / -1; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .k {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--ink-muted);
    font-weight: 600;
}
.kv .v {
    color: var(--ink);
    font-size: var(--text-base);
    line-height: var(--leading-snug);
    word-break: break-word;
}
.kv .v.yes { color: var(--success); font-weight: 600; }
.kv .v.no { color: var(--ink-muted); }

.back-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}
.back-bar .spacer { flex: 1; }
.back-bar .share-feedback {
    animation: fade-in var(--dur-med) var(--ease-out);
}

.btn-fav {
    color: var(--ink-muted);
    background: transparent;
    border: 1px solid var(--border-strong);
}
.btn-fav:hover { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.btn-fav.is-on {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: transparent;
}
.btn-fav.is-on:hover { color: var(--accent); background: var(--accent-soft); }
.btn-fav .bi { transition: transform var(--dur-fast) var(--ease-out); }
.btn-fav.is-on .bi { transform: scale(1.15); }
@keyframes fade-in {
    from { opacity: 0; transform: translateY(-2px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ Dashboard ============ */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}
@media (min-width: 900px) {
    .dash-grid { grid-template-columns: 1fr 1fr; }
}

.dash-hero {
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-4);
    position: relative;
    overflow: hidden;
}
.dash-hero::after {
    content: "";
    position: absolute;
    top: -60px; right: -60px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.16);
    filter: blur(20px);
}
.dash-hero h1 { color: #fff; margin: 0; font-size: var(--text-2xl); }
.dash-hero p { color: rgba(255,255,255,0.88); margin: var(--space-1) 0 0; }

/* Activity scoreboard -- split per kind (adoption / foster) */
.activity-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
@media (max-width: 359px) {
    .activity-grid { grid-template-columns: 1fr; }
}

.activity-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transition: transform var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-med) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
}
.activity-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.9;
}
.activity-card.is-adoption::before {
    background: radial-gradient(circle at 100% 0%, rgba(62, 156, 196, 0.12), transparent 55%);
}
.activity-card.is-foster::before {
    background: radial-gradient(circle at 100% 0%, rgba(249, 114, 89, 0.14), transparent 55%);
}
.activity-card > * { position: relative; z-index: 1; }

.activity-card:hover,
.activity-card:focus-visible {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    color: inherit;
    text-decoration: none;
}

.activity-card.has-new {
    box-shadow: 0 0 0 1px var(--border), var(--shadow-md);
}
.activity-card.is-adoption.has-new { box-shadow: 0 0 0 1px var(--primary), var(--shadow-md); }
.activity-card.is-foster.has-new { box-shadow: 0 0 0 1px var(--accent), var(--shadow-md); }

.activity-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    font-weight: 700;
    color: var(--ink-muted);
    margin-bottom: var(--space-2);
}
.activity-card.is-adoption .activity-head { color: var(--primary); }
.activity-card.is-foster .activity-head { color: var(--accent); }
.activity-head .activity-icon {
    display: inline-flex;
    font-size: 1.05rem;
    line-height: 1;
}

.activity-num {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: 800;
    color: var(--ink);
    line-height: 1;
    letter-spacing: var(--tracking-tight);
}
.activity-card.has-new .activity-num { color: var(--ink); }
.activity-label {
    color: var(--ink-muted);
    font-size: var(--text-sm);
    margin-top: 2px;
}

.activity-sub {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    font-size: var(--text-xs);
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    font-weight: 600;
}
.activity-sub .n {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--ink-soft);
    font-size: var(--text-sm);
    margin-right: 0.35em;
}

.activity-new {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: var(--accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    box-shadow: 0 0 0 4px rgba(249, 114, 89, 0.18);
    z-index: 2;
    animation: activity-pulse 2.2s ease-in-out infinite;
}
.activity-card.is-adoption .activity-new {
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(62, 156, 196, 0.22);
}
@keyframes activity-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
    .activity-new { animation: none; }
}

.activity-empty {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--ink-muted);
    line-height: 1;
}

.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.dash-card-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
}
.dash-card-head h2 {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    margin: 0;
    flex: 1;
}
.dash-card-body { padding: var(--space-2); flex: 1; }
.dash-card-foot {
    padding: var(--space-2) var(--space-3) var(--space-3);
    display: flex;
    justify-content: flex-end;
}

.dash-card .collapse-btn {
    display: none;
}
.dash-card.is-collapsed .dash-card-body,
.dash-card.is-collapsed .dash-card-foot {
    display: none;
}
.dash-card .collapse-btn .bi {
    transition: transform var(--dur-med) var(--ease-out);
}
.dash-card.is-collapsed .collapse-btn .bi {
    transform: rotate(-90deg);
}
@media (max-width: 899.98px) {
    .dash-card .collapse-btn { display: inline-flex; }
}

.mini-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background var(--dur-fast) var(--ease-out);
}
.mini-row:hover { background: var(--surface-sunken); text-decoration: none; color: inherit; }
.mini-row .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-hover);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-display);
    font-size: var(--text-sm);
}
.mini-row .name {
    font-weight: 600;
    color: var(--ink);
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mini-row .sub {
    color: var(--ink-muted);
    font-size: var(--text-xs);
}
.mini-row .when {
    color: var(--ink-muted);
    font-size: var(--text-xs);
    white-space: nowrap;
}

/* ============ Empty / loading / error states ============ */
.state-block {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--ink-muted);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
}
.state-block .icon {
    font-size: 2rem;
    color: var(--ink-subtle);
    margin-bottom: var(--space-2);
}

.spinner-inline {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    animation: spin 900ms linear infinite;
    display: inline-block;
    vertical-align: -3px;
    margin-right: var(--space-2);
}

.skeleton {
    background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--border) 37%, var(--surface-sunken) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: var(--radius-md);
}
@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ============ Login / centered layout ============ */
.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-6) var(--page-gutter);
    background:
        radial-gradient(1200px circle at 20% 0%, rgba(62,156,196,0.12), transparent 60%),
        radial-gradient(1000px circle at 90% 100%, rgba(249,114,89,0.10), transparent 60%),
        var(--bg);
}
/* When the viewport is short (mobile soft keyboard up), stop centering so
   the focused input + submit button can scroll into view naturally. */
@media (max-height: 700px) {
    .auth-shell {
        justify-content: flex-start;
        padding-top: var(--space-4);
    }
}
/* Give focused inputs breathing room from the keyboard / viewport edge when
   the browser auto-scrolls them into view. */
.auth-card .form-control {
    scroll-margin-top: var(--space-6);
    scroll-margin-bottom: 120px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-6);
}
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}
.auth-brand .brand-mark-dot {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 22px;
}
.auth-brand .title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-xl);
    color: var(--ink);
    letter-spacing: var(--tracking-tight);
}
.auth-brand .sub { color: var(--ink-muted); font-size: var(--text-sm); }

/* ============ Notifications page ============ */
.notif-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-3);
}
.notif-card .icon-wrap {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.notif-card.is-accent .icon-wrap { background: var(--accent-soft); color: var(--accent); }
.notif-card .notif-body { flex: 1; min-width: 0; }
.notif-card .notif-body h4 { margin: 0 0 2px; font-size: var(--text-base); }
.notif-card .notif-body p { margin: 0; color: var(--ink-muted); font-size: var(--text-sm); }

/* ============ Error / validation ============ */
.validation-message { color: var(--danger); font-size: var(--text-sm); margin-top: 2px; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }

/* ============ Error boundary banner ============ */
#blazor-error-ui {
    background: var(--danger);
    color: #fff;
    bottom: 0;
    display: none;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    color: #fff;
}
#blazor-error-ui a { color: #fff; text-decoration: underline; }
.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem;
    color: #fff;
    border-radius: var(--radius-md);
}
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ============ Custom icons ============ */
.whiskers-icon {
    display: inline-block;
    vertical-align: -0.18em;
    flex-shrink: 0;
}

/* ============ Utilities ============ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.hide-sm { display: none; }
@media (min-width: 768px) { .hide-sm { display: initial; } }
@media (min-width: 768px) { .show-sm-only { display: none; } }

/* ============ Mobile topbar action spacing ============
   On mobile the user-chip is hidden, so the theme toggle and sign-out icons
   sit immediately next to each other. Bump the gap to keep the destructive
   sign-out action out of fat-finger range when toggling theme. */
@media (max-width: 767.98px) {
    .topbar-actions {
        gap: var(--space-3);
    }
}

/* Subtle danger styling for the sign-out icon button so it reads as
   destructive. Stays understated until interacted with. */
.icon-btn-danger:hover,
.icon-btn-danger:focus-visible {
    background: rgba(220, 53, 69, 0.10);
    color: var(--danger, #dc3545);
    border-color: rgba(220, 53, 69, 0.25);
}

/* ============ Confirm dialog ============ */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 18, 32, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: dialog-fade-in 140ms ease-out;
}
.dialog-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-5);
    max-width: 380px;
    width: 100%;
    animation: dialog-slide-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dialog-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--ink);
    margin: 0 0 var(--space-2) 0;
}
.dialog-body {
    color: var(--ink-muted);
    margin: 0 0 var(--space-4) 0;
    font-size: var(--text-base);
}
.dialog-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    flex-wrap: wrap;
}
@keyframes dialog-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes dialog-slide-in {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .dialog-backdrop, .dialog-card { animation: none; }
}
