/* Magus Hub — application styles */

:root {
    --hub-bg: #faf7f2;
    --hub-surface: #f0f4ec;
    --hub-accent: #6b8f71;
    --hub-accent-dark: #4a6b50;
    --hub-accent-light: #e4efe6;
    --hub-rose: #c97b84;
    --hub-rose-light: #f5e8ea;
    --hub-green: #7ba05b;
    --hub-warm: #a67c52;
    --hub-ink: #3d4035;
    --hub-muted: #6b7280;
    --hub-border: #e5e7df;
    --hub-shadow: rgba(61, 64, 53, 0.08);
}

[x-cloak] { display: none !important; }

.vf-search-hit {
    background: rgba(251, 191, 36, 0.5);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.blocker-pills-grid {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem;
    max-width: 14rem;
    margin-inline: auto;
    justify-items: center;
}

.blocker-pills-grid > *:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
}

.blocker-pill {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0.125rem 0.375rem;
    font-size: 0.65rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
}

.vf-catalog-hint-wrap {
    position: relative;
    display: inline-flex;
    vertical-align: top;
    z-index: 1;
}

.vf-catalog-hint-wrap--adjacent .vf-catalog-hint-card {
    top: 0;
    transform: none;
}

.vf-catalog-hint-wrap:focus-within,
.vf-catalog-hint-wrap.is-open {
    z-index: 70;
}

.vf-catalog-hint-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 9999px;
    border: none;
    padding: 0;
    background: var(--hub-accent-light);
    color: var(--hub-accent-dark);
    cursor: help;
    transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.vf-catalog-hint-btn svg {
    width: 0.875rem;
    height: 0.875rem;
}

.vf-catalog-hint-btn:hover,
.vf-catalog-hint-wrap:focus-within .vf-catalog-hint-btn {
    background: var(--hub-accent);
    color: #fff;
    transform: scale(1.05);
}

.vf-catalog-hint-card {
    position: absolute;
    left: calc(100% + 0.125rem);
    top: 50%;
    transform: translateY(-50%);
    z-index: 60;
    width: min(22rem, calc(100vw - 2rem));
    max-height: min(32rem, 75vh);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
    border-radius: 0.625rem;
    border: 1px solid var(--hub-border);
    background-color: #fff;
    padding: 0.625rem 0.75rem;
    box-shadow: 0 12px 32px rgba(61, 64, 53, 0.16);
    scrollbar-width: thin;
    scrollbar-color: rgba(107, 143, 113, 0.35) transparent;
    isolation: isolate;
}

/* Invisible bridge so the pointer can reach the card without closing */
.vf-catalog-hint-card::before {
    content: "";
    position: absolute;
    right: 100%;
    top: -0.5rem;
    bottom: -0.5rem;
    width: 0.75rem;
}

.vf-catalog-hint-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--hub-ink);
    line-height: 1.3;
}

.vf-catalog-hint-meta {
    margin-top: 0.125rem;
    font-size: 0.6875rem;
    color: var(--hub-muted);
}

.vf-catalog-hint-desc {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #57534e;
}

.mh-rich-desc strong {
    font-weight: 700;
}

.mh-rich-desc em {
    font-style: italic;
}

.mh-rich-desc u {
    text-decoration: underline;
}

.mh-rich-desc .mh-desc-accent {
    color: var(--hub-accent-dark);
}

.mh-rich-desc .mh-desc-warm {
    color: #a67c52;
}

.mh-rich-desc .mh-desc-rose {
    color: #c97b84;
}

.mh-rich-desc .mh-desc-muted {
    color: #78716c;
}

.mh-rich-desc .mh-desc-green {
    color: #7ba05b;
}

.vf-catalog-hint-modifiers {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--hub-border);
}

.vf-catalog-hint-modifiers-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hub-accent-dark);
}

.vf-catalog-hint-modifiers ul {
    margin-top: 0.25rem;
    list-style: none;
    padding: 0;
}

.vf-catalog-hint-modifiers li {
    font-size: 0.6875rem;
    line-height: 1.35;
    color: #57534e;
}

.vf-catalog-hint-modifiers li + li {
    margin-top: 0.125rem;
}

.vf-catalog-hint-card--fixed {
    position: fixed !important;
    z-index: 200;
    left: auto;
    right: auto;
    transform: none !important;
}

.vf-catalog-hint-card--fixed::before {
    display: none;
}

body {
    font-family: "Source Sans 3", system-ui, sans-serif;
}

h1, h2, h3, .brand-text {
    font-family: "DM Sans", system-ui, sans-serif;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875em;
}

/* Brand */

.version-text {
    color: var(--hub-warm);
    font-weight: 600;
}

.brand-text {
    color: var(--hub-accent-dark);
    font-weight: 600;
}

.brand-text:hover {
    color: var(--hub-accent);
}

/* Subtle botanical backdrop (Classic only — Grimoire uses mh-grimoire.css) */

html[data-mh-ui="classic"] body.app-shell {
    background-color: var(--hub-bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(107, 143, 113, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(201, 123, 132, 0.08), transparent);
}

/* Cards & panels */

.app-card {
    background: #fff;
    border: 1px solid var(--hub-border);
    border-radius: 0.875rem;
    box-shadow: 0 1px 3px var(--hub-shadow);
}

.app-card-hover {
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.app-card-hover:hover {
    background: var(--hub-accent-light);
    border-color: rgba(107, 143, 113, 0.35);
    box-shadow: 0 4px 14px rgba(107, 143, 113, 0.12);
}

/* Forms */

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--hub-ink);
}

.form-input {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--hub-border);
    background: #fff;
    padding: 0.5rem 0.75rem;
    color: var(--hub-ink);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-input::placeholder {
    color: #a8a29e;
}

.form-input:focus {
    outline: none;
    border-color: var(--hub-accent);
    box-shadow: 0 0 0 3px rgba(107, 143, 113, 0.18);
}

.form-select {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--hub-border);
    background: #fff;
    padding: 0.5rem 0.75rem;
    color: var(--hub-ink);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-select:focus {
    outline: none;
    border-color: var(--hub-accent);
    box-shadow: 0 0 0 3px rgba(107, 143, 113, 0.18);
}

.form-textarea {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    min-height: 6rem;
    border-radius: 0.5rem;
    border: 1px solid var(--hub-border);
    background: #fff;
    padding: 0.5rem 0.75rem;
    color: var(--hub-ink);
    resize: vertical;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--hub-accent);
    box-shadow: 0 0 0 3px rgba(107, 143, 113, 0.18);
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background: var(--hub-accent-light);
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--hub-accent-dark);
}

.table-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.375rem;
}

.table-actions form {
    display: block;
    margin: 0;
}

/* Buttons */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: var(--hub-accent);
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    transition: background-color 150ms ease;
}

.btn-primary:hover {
    background: var(--hub-accent-dark);
}

/* Tailwind CDN fallback — hub accent primary actions */
a.bg-hub-accent,
button.bg-hub-accent,
input.bg-hub-accent[type="submit"] {
    background-color: var(--hub-accent);
    color: #fff;
}

a.bg-hub-accent:hover,
button.bg-hub-accent:hover,
input.bg-hub-accent[type="submit"]:hover {
    background-color: var(--hub-accent-dark);
    color: #fff;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid var(--hub-border);
    background: #fff;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--hub-ink);
    transition: background-color 150ms ease, border-color 150ms ease;
}

.btn-secondary:hover {
    background: var(--hub-surface);
    border-color: rgba(107, 143, 113, 0.35);
}

.avatar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: var(--hub-rose-light);
    color: var(--hub-rose);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(201, 123, 132, 0.25);
}

/* Page back icon button */

.mh-page-back {
    display: inline-flex;
    margin-top: 0.125rem;
    height: 2.25rem;
    width: 2.25rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: var(--hub-accent);
    transition: background-color 150ms ease, color 150ms ease;
}

.mh-page-back:hover {
    background: var(--hub-accent-light);
    color: var(--hub-accent-dark);
}

.mh-page-back__icon {
    height: 1.25rem;
    width: 1.25rem;
}

/* Brand logo mark (Ars Magica emblem) */

.mh-brand-logo {
    display: inline-flex;
    height: 2.25rem;
    width: 2.25rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.mh-brand-logo--login {
    height: 3rem;
    width: 3rem;
}

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

/* User menu */

.mh-user-menu-btn {
    border-radius: 0.75rem;
    border: 1px solid transparent;
    padding: 0.375rem 0.5rem;
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.mh-user-menu-btn__name {
    color: var(--hub-ink);
    font-size: 0.875rem;
}

.mh-user-menu-btn__chevron {
    color: var(--hub-muted);
}

html[data-mh-ui="classic"] .mh-user-menu-btn:hover {
    background: var(--hub-surface);
    border-color: rgba(107, 143, 113, 0.2);
    box-shadow: 0 4px 12px rgba(61, 64, 53, 0.06);
}

.mh-user-menu-panel {
    overflow: hidden;
    border-radius: 1rem;
    box-shadow: 0 16px 40px rgba(61, 64, 53, 0.12);
}

html[data-mh-ui="classic"] .mh-user-menu-panel {
    background: #fff;
    border: 1px solid var(--hub-border);
}

.mh-user-menu-panel__header {
    border-bottom: 1px solid var(--hub-border);
}

.mh-user-menu-panel__name {
    color: var(--hub-ink);
}

.mh-user-menu-panel__username,
.mh-user-menu-panel__email-label {
    color: var(--hub-muted);
}

.mh-user-menu-panel__email {
    color: #78716c;
}

.mh-user-menu-link {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #57534e;
    transition: background-color 150ms ease, color 150ms ease;
}

.mh-user-menu-link:hover {
    background: var(--hub-surface);
    color: var(--hub-accent-dark);
}

.mh-user-menu-link--danger {
    color: #be123c;
}

.mh-user-menu-link--danger:hover {
    background: #fff1f2;
    color: #9f1239;
}

/* Impersonation banner (high visibility in both themes) */

.mh-impersonation-banner__title {
    color: #451a03;
}

.mh-impersonation-banner__subtitle {
    color: rgba(69, 26, 3, 0.8);
}

/* Main navigation */

.nav-pill-group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.35rem;
    border-radius: 0.875rem;
    overflow: visible;
}

html[data-mh-ui="classic"] .nav-pill-group {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--hub-border);
    box-shadow: 0 1px 2px var(--hub-shadow);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.625rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.25rem;
    color: var(--hub-muted);
    border: 1px solid transparent;
    transition: color 150ms ease, background-color 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.nav-link:hover:not(.nav-link-active) {
    color: var(--hub-accent-dark);
    background: var(--hub-accent-light);
}

.nav-link-active,

.nav-link-active:hover {
    color: var(--hub-accent-dark);
    background: var(--hub-accent-light);
    border-color: rgba(107, 143, 113, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.nav-link-active svg {
    color: var(--hub-accent);
}

.nav-link-mobile {
    width: 100%;
    justify-content: flex-start;
    padding: 0.75rem 0.875rem;
}

.nav-dropdown {
    overflow: hidden;
    border-radius: 0.875rem;
    border: 1px solid var(--hub-border);
    background: #fff;
    padding: 0.375rem;
    box-shadow: 0 12px 32px var(--hub-shadow);
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-radius: 0.625rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--hub-ink);
    transition: background-color 150ms ease, color 150ms ease;
}

.nav-dropdown-item:hover {
    background: var(--hub-surface);
    color: var(--hub-accent-dark);
}

.nav-dropdown-item-active {
    background: var(--hub-accent-light);
    color: var(--hub-accent-dark);
}

/* Main nav — mobile drawer (Classic + New View) */

body.mh-nav-open {
    overflow: hidden;
}

.mh-nav-icon-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mh-nav-link-label {
    white-space: nowrap;
}

.mh-nav-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
    padding: 0.5rem;
    color: var(--hub-muted);
    border: 1px solid var(--hub-border);
    background: #fff;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.mh-nav-menu-btn:hover {
    color: var(--hub-accent-dark);
    background: var(--hub-surface);
    border-color: rgba(107, 143, 113, 0.25);
}

.mh-nav-mobile-shell {
    position: relative;
}

.mh-nav-mobile-backdrop {
    position: fixed;
    inset: 0;
    top: 3.5rem;
    z-index: 45;
    background: rgba(61, 64, 53, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

@media (min-width: 640px) {
    .mh-nav-mobile-backdrop {
        top: 4rem;
    }
}

.mh-nav-mobile-drawer {
    position: fixed;
    top: 3.5rem;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: min(100%, 22rem);
    border-left: 1px solid var(--hub-border);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: -12px 0 40px rgba(61, 64, 53, 0.12);
}

@media (min-width: 640px) {
    .mh-nav-mobile-drawer {
        top: 4rem;
    }
}

.mh-nav-mobile-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--hub-border);
}

.mh-nav-mobile-drawer-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--hub-ink);
}

.mh-nav-mobile-drawer-sub {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: var(--hub-muted);
}

.mh-nav-mobile-drawer-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.85rem 1rem 1.25rem;
}

.mh-nav-mobile-view-toggle {
    margin-bottom: 1rem;
}

.mh-nav-mobile-section + .mh-nav-mobile-section {
    margin-top: 1.15rem;
}

.mh-nav-mobile-section-label {
    margin-bottom: 0.45rem;
    padding-inline: 0.15rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #a8a29e;
}

.mh-nav-mobile-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mh-nav-mobile-link {
    width: 100%;
    justify-content: flex-start;
    padding: 0.72rem 0.85rem;
}

.mh-nav-mobile-arrow {
    margin-left: auto;
    width: 1rem;
    height: 1rem;
    color: #d6d3d1;
    flex-shrink: 0;
}

.mh-nav-chevron-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mh-nav-chevron.is-open,

.mh-nav-chevron-wrap svg.rotate-180 {
    transform: rotate(180deg);
}

.mh-nav-chevron,

.mh-nav-chevron-wrap svg {
    transition: transform 160ms ease;
}

.mh-nav-lucide,

.mh-nav-icon-slot svg {
    width: 1rem;
    height: 1rem;
}

/* Plugin status badges */

.badge-enabled {
    background: var(--hub-accent-light);
    color: var(--hub-accent-dark);
}

.badge-disabled {
    background: #f5f5f4;
    color: #78716c;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Loading overlay */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(250, 247, 242, 0.82);
    backdrop-filter: blur(4px);
}

.loading-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--hub-border);
    background: #fff;
    padding: 2rem 2.5rem;
    box-shadow: 0 12px 40px var(--hub-shadow);
    border-radius: 0.875rem;
}

.loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--hub-accent-light);
    border-top-color: var(--hub-accent);
    border-radius: 9999px;
    animation: loading-spin 0.75s linear infinite;
}

.loading-text {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--hub-ink);
}

@keyframes loading-spin {
    to {
        transform: rotate(360deg);
    }
}

/* App section tabs (forms and detail views) */
.app-section-tabs {
    display: flex;
    flex-direction: column;
    position: relative;
}

.app-section-tab-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-section-tablist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    border-bottom: 1px solid var(--hub-border);
    background: linear-gradient(180deg, #fff 0%, var(--hub-surface) 100%);
    padding: 0.75rem 1rem 0;
}

.app-section-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: -1px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 0.625rem 0.625rem 0 0;
    background: transparent;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--hub-muted);
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.app-section-tab:hover {
    color: var(--hub-accent-dark);
    background: rgba(255, 255, 255, 0.72);
}

.app-section-tab-icon {
    display: inline-flex;
    height: 1.75rem;
    width: 1.75rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: var(--hub-accent-light);
    color: var(--hub-accent-dark);
    transition: background-color 150ms ease, color 150ms ease;
}

.app-section-tab-text {
    line-height: 1.2;
}

.app-section-tab-count {
    display: inline-flex;
    min-width: 1.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(107, 143, 113, 0.14);
    padding: 0.125rem 0.4375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--hub-accent-dark);
}

.app-section-tab-count-alert {
    background: #dc2626;
    color: #fff;
}

.nav-badge {
    display: inline-flex;
    min-width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0 0.3125rem;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
}

.nav-badge-alert {
    background: #dc2626;
    color: #fff;
}

.nav-badge-dot {
    min-width: 0.5rem;
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
}

.mh-nav-live-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.mh-nav-live-play-btn:hover,
.mh-nav-live-play-btn.is-active {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.55);
    color: #065f46;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.mh-nav-live-play-label {
    line-height: 1;
}

.mh-nav-live-play-dot {
    width: 0.5rem;
    height: 0.5rem;
    flex-shrink: 0;
    border-radius: 9999px;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
    animation: mh-live-play-pulse 2s ease-in-out infinite;
}

.mh-nav-live-play-dot--sm {
    width: 0.4375rem;
    height: 0.4375rem;
}

.mh-nav-live-play-count {
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    font-size: 0.625rem;
}

@keyframes mh-live-play-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
    }
    50% {
        box-shadow: 0 0 0 0.35rem rgba(16, 185, 129, 0);
    }
}

.mh-live-play-menu__panel {
    display: none;
}

.mh-live-play-menu.is-open .mh-live-play-menu__panel {
    display: block;
}

.mh-nav-notifications-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    color: #57534e;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.mh-nav-notifications-btn:hover,
.mh-nav-notifications-btn.is-active {
    background: #f5f5f4;
    color: #7c3aed;
}

.mh-nav-notifications-badge {
    position: absolute;
    top: -0.125rem;
    right: -0.25rem;
    min-width: 1rem;
    height: 1rem;
    font-size: 0.5625rem;
}

.app-section-tab-count-dot {
    min-width: 0.5rem;
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    font-size: 0;
    line-height: 0;
}

.app-section-panel {
    display: none;
    padding: 1.5rem;
}

.app-section-panel-flex {
    flex-direction: column;
    gap: 1rem;
}

.impersonation-banner {
    border-bottom: 1px solid #fbbf24;
    background: linear-gradient(90deg, #fef3c7 0%, #fde68a 100%);
}

.impersonation-banner-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid #d97706;
    background: #fff;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #92400e;
    transition: background-color 150ms ease, color 150ms ease;
}

.impersonation-banner-btn:hover {
    background: #fffbeb;
    color: #78350f;
}

@keyframes dash-v2-enter {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dash-v2-enter {
    opacity: 0;
}

.dash-v2-enter.is-entered {
    animation: dash-v2-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--enter-delay, 0) * 1ms);
}

.dash-v2-panel {
    border-radius: 1rem;
    border: 1px solid var(--hub-border);
    background: #fff;
    padding: 1.15rem 1.25rem;
    box-shadow: 0 1px 3px var(--hub-shadow);
    transition: box-shadow 180ms ease, transform 180ms ease;
}

.dash-v2-panel:hover {
    box-shadow: 0 8px 24px rgba(61, 64, 53, 0.08);
}

.dash-v2-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dash-v2-panel-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.dash-v2-panel-icon--season {
    background: rgba(123, 160, 91, 0.15);
    color: var(--hub-green);
}

.dash-v2-panel-icon--crops {
    background: rgba(107, 143, 113, 0.15);
    color: var(--hub-accent-dark);
}

.dash-v2-panel-icon--primary {
    background: rgba(123, 160, 91, 0.15);
    color: var(--hub-green);
}

.dash-v2-panel-icon--secondary {
    background: rgba(107, 143, 113, 0.15);
    color: var(--hub-accent-dark);
}

.dash-v2-panel-icon--tertiary {
    background: rgba(201, 123, 132, 0.15);
    color: var(--hub-rose);
}

.dash-v2-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--hub-ink);
}

.dash-v2-panel-sub {
    margin-top: 0.15rem;
    font-size: 0.8125rem;
    color: var(--hub-muted);
}

.dash-v2-panel-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--hub-accent);
    text-decoration: none;
}

.dash-v2-panel-link:hover {
    color: var(--hub-accent-dark);
}

.dash-v2-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.dash-v2-pill--neutral {
    background: #f5f5f4;
    color: #57534e;
}

.dash-v2-pill--accent {
    background: var(--hub-accent-light);
    color: var(--hub-accent-dark);
}

.dash-v2-pill--sky {
    background: #e0f2fe;
    color: #0369a1;
}

.dash-v2-pill--amber {
    background: #fef3c7;
    color: #b45309;
}

.dash-v2-pill--violet {
    background: #ede9fe;
    color: #6d28d9;
}

.dash-v2-pill--earth {
    background: rgba(166, 124, 82, 0.15);
    color: var(--hub-warm);
}

html[data-mh-ui="classic"] body.app-shell {
    background: linear-gradient(180deg, #faf7f2 0%, #f3f7ef 48%, #faf7f2 100%);
}

.mh-page-content.is-entering {
    animation: mh-page-enter 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mh-page-content > .space-y-6 > * {
    animation: mh-section-enter 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mh-page-content > .space-y-6 > *:nth-child(1) { animation-delay: 40ms; }

.mh-page-content > .space-y-6 > *:nth-child(2) { animation-delay: 90ms; }

.mh-page-content > .space-y-6 > *:nth-child(3) { animation-delay: 140ms; }

.mh-page-content > .space-y-6 > *:nth-child(4) { animation-delay: 190ms; }

.mh-page-content > .space-y-6 > *:nth-child(5) { animation-delay: 240ms; }

.mh-page-content > .space-y-6 > *:nth-child(n+6) { animation-delay: 280ms; }

.mh-page-content > .space-y-4 > * {
    animation: mh-section-enter 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

html[data-mh-ui="classic"] nav.sticky,
html[data-mh-ui="classic"] .mh-main-nav {
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(107, 143, 113, 0.18);
    border-bottom-color: rgba(107, 143, 113, 0.18);
    box-shadow: 0 8px 24px rgba(61, 64, 53, 0.06);
}

.mh-nav-desktop-group {
    padding: 0.5rem 0.45rem;
    border-radius: 0.875rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 244, 236, 0.55) 100%);
    box-shadow: 0 4px 14px rgba(61, 64, 53, 0.06);
    overflow: visible;
    flex-shrink: 0;
}

/* Nav visibility — app.css owns breakpoints (do not rely on Tailwind CDN for primary nav). */
.mh-nav-desktop-only {
    display: none !important;
}

.mh-nav-mobile-only {
    display: block;
}

.mh-nav-menu-btn.mh-nav-mobile-only {
    display: inline-flex;
}

@media (min-width: 1024px) {
    .mh-nav-desktop-only {
        display: inline-flex !important;
    }

    .mh-nav-desktop-divider.mh-nav-desktop-only {
        display: block !important;
    }

    .mh-nav-mobile-only {
        display: none !important;
    }
}

.mh-nav-desktop-divider {
    display: none;
    width: 1px;
    height: 1.5rem;
    flex-shrink: 0;
    background: rgba(214, 211, 209, 0.85);
}

.mh-nav-noscript-fallback {
    border-top: 1px solid rgba(214, 211, 209, 0.45);
    padding-top: 0.5rem;
}

.mh-nav-desktop-group .nav-link {
    border-radius: 0.65rem;
}

.mh-nav-icon-slot {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 0.5rem;
    background: rgba(240, 244, 236, 0.85);
    color: var(--hub-accent);
    transition: background-color 160ms ease, color 160ms ease;
}

.nav-link-active .mh-nav-icon-slot,

.nav-link:hover:not(.nav-link-active) .mh-nav-icon-slot {
    background: rgba(228, 239, 230, 0.95);
    color: var(--hub-accent-dark);
}

.nav-link-mobile .mh-nav-icon-slot {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.7rem;
    background: rgba(240, 244, 236, 0.95);
}

.nav-link-mobile.nav-link-active .mh-nav-icon-slot {
    background: var(--hub-accent-light);
    color: var(--hub-accent-dark);
}

.nav-link-mobile {
    border-radius: 0.85rem;
    border: 1px solid transparent;
    background: #fff;
    box-shadow: 0 1px 2px rgba(61, 64, 53, 0.04);
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

.nav-link-mobile:hover {
    transform: translateX(2px);
    border-color: rgba(107, 143, 113, 0.2);
    box-shadow: 0 6px 16px rgba(61, 64, 53, 0.06);
}

.nav-link-mobile.nav-link-active {
    border-color: rgba(107, 143, 113, 0.3);
    background: linear-gradient(135deg, rgba(228, 239, 230, 0.55) 0%, #fff 100%);
    box-shadow: 0 4px 14px rgba(107, 143, 113, 0.12);
}

.mh-nav-menu-btn {
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(61, 64, 53, 0.06);
}

.mh-nav-menu-btn--close {
    background: var(--hub-surface);
}

.mh-nav-mobile-drawer {
    background: linear-gradient(180deg, #fff 0%, #f8faf5 100%);
    box-shadow: -16px 0 48px rgba(61, 64, 53, 0.14);
}

.mh-nav-mobile-drawer-head {
    background: rgba(255, 255, 255, 0.92);
}

.mh-nav-mobile-section-label {
    color: var(--hub-accent-dark);
    opacity: 0.75;
}

.nav-dropdown {
    border-radius: 1rem;
    padding: 0.45rem;
    box-shadow: 0 16px 40px rgba(61, 64, 53, 0.12);
}

.nav-dropdown-item .mh-nav-icon-slot {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.55rem;
}

.mh-user-menu-btn {
    border-radius: 0.75rem;
    border: 1px solid transparent;
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

html[data-mh-ui="classic"] .mh-user-menu-btn:hover {
    border-color: rgba(107, 143, 113, 0.2);
    box-shadow: 0 4px 12px rgba(61, 64, 53, 0.06);
}

.mh-user-menu-panel {
    border-radius: 1rem;
    box-shadow: 0 16px 40px rgba(61, 64, 53, 0.12);
}

.nav-link {
    transition:
        background-color 160ms ease,
        color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

.mh-nav-desktop-group .nav-link:hover:not(.nav-link-active) {
    transform: none;
    box-shadow: 0 2px 8px rgba(61, 64, 53, 0.08);
}

.nav-link:hover:not(.nav-link-active) {
    transform: translateY(-1px);
}

.nav-link-active:hover {
    box-shadow: 0 2px 10px rgba(107, 143, 113, 0.18);
}

.app-card {
    border-radius: 1rem;
    box-shadow:
        0 1px 3px var(--hub-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease,
        background-color 180ms ease;
}

.app-card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(61, 64, 53, 0.1);
}

.btn-primary {
    box-shadow: 0 6px 16px rgba(107, 143, 113, 0.28);
    transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(107, 143, 113, 0.34);
}

.btn-secondary,

.btn-secondary:hover,

.form-input,

.form-select,

.form-textarea {
    border-radius: 0.65rem;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.form-input:focus,

.form-select:focus,

.form-textarea:focus {
    box-shadow: 0 0 0 4px rgba(107, 143, 113, 0.14);
}

.app-section-tabs {
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(61, 64, 53, 0.06);
}

.app-section-tab {
    transition: color 160ms ease, background-color 160ms ease;
}

.app-section-panel {
    animation: mh-section-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

table tbody tr {
    transition: background-color 150ms ease;
}

table tbody tr:hover {
    background: rgba(240, 244, 236, 0.65);
}

.badge-enabled,

.badge-disabled,

.badge-warning {
    border-radius: 9999px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.mh-page-content .mb-6.space-y-2 > div {
    border-radius: 0.85rem;
    box-shadow: 0 4px 14px rgba(61, 64, 53, 0.06);
    animation: mh-section-enter 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

html[data-mh-ui="classic"] footer,
html[data-mh-ui="classic"] .mh-app-footer {
    background: rgba(255, 255, 255, 0.72);
    border-top: 1px solid rgba(229, 231, 223, 0.8);
    color: #6b7280;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

h1.text-2xl {
    letter-spacing: -0.02em;
}

.mh-page-content h1.text-2xl.font-bold.text-hub-ink {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: none;
    color: var(--hub-ink);
}

.mh-page-content h1.text-2xl.font-bold.text-hub-ink + p.mt-1.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--hub-muted);
}

a.rounded-md.border,

button.rounded-md.border {
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

a.rounded-md.border:hover,

button.rounded-md.border:hover {
    transform: translateY(-1px);
}

.app-section-tablist {
    gap: 0.5rem;
    padding: 0.85rem 1rem 0;
    background: linear-gradient(180deg, #fff 0%, var(--hub-surface) 100%);
    border-bottom-color: rgba(107, 143, 113, 0.15);
}

.app-section-tab {
    border-radius: 0.75rem 0.75rem 0 0;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease;
}

.app-section-tab:hover {
    transform: translateY(-1px);
}

.app-section-tab-icon {
    border-radius: 0.55rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.app-section-tab-icon svg,

.app-section-tab-icon [data-lucide] {
    width: 1rem;
    height: 1rem;
}

.app-section-tab-count {
    padding: 0.15rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: inset 0 0 0 1px rgba(107, 143, 113, 0.12);
}

.app-section-panel {
    padding-top: 1.375rem;
}

.mh-section-panel-heading h2,

.v2-panel-heading-title {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hub-accent-dark);
}

.mh-section-panel-heading p,

.v2-panel-heading-desc {
    color: var(--hub-muted);
}

/* Legacy status badges → V2 pills (pages not yet migrated to v2_status macro) */

.tag-pill,

span.inline-flex.rounded-full.bg-hub-accent-light,

span.inline-flex.items-center.rounded-full.bg-hub-accent-light {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.2rem 0.55rem !important;
    font-size: 0.6875rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    line-height: 1.3;
    background: var(--hub-accent-light) !important;
    color: var(--hub-accent-dark) !important;
    box-shadow: inset 0 0 0 1px rgba(107, 143, 113, 0.12);
}

span.inline-flex.rounded-full.bg-stone-100,

span.inline-flex.items-center.rounded-full.bg-stone-100 {
    background: #f5f5f4 !important;
    color: #57534e !important;
    box-shadow: inset 0 0 0 1px rgba(28, 25, 23, 0.06);
}

span.inline-flex.rounded-full.bg-amber-100,

span.inline-flex.items-center.rounded-full.bg-amber-100 {
    background: #fef3c7 !important;
    color: #b45309 !important;
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.15);
}

.badge-enabled {
    border-radius: 9999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: inset 0 0 0 1px rgba(107, 143, 113, 0.12);
}

.badge-disabled {
    border-radius: 9999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Sub-navigation (users, etc.) */

.app-subnav {
    gap: 0.45rem;
    padding: 0.35rem;
    border: 1px solid var(--hub-border);
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 4px 14px rgba(61, 64, 53, 0.06);
}

.app-subnav a.rounded-md {
    border-radius: 9999px !important;
    padding: 0.45rem 0.85rem !important;
    font-weight: 600;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.app-subnav a.rounded-md:hover {
    transform: translateY(-1px);
}

.app-subnav a.bg-hub-accent-light {
    box-shadow: inset 0 0 0 1px rgba(107, 143, 113, 0.2);
}

.app-settings-grid a.group.rounded-xl {
    border-radius: 1rem !important;
    box-shadow: 0 1px 3px var(--hub-shadow);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.app-settings-grid a.group.rounded-xl:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(61, 64, 53, 0.1);
}

/* List / table wrappers */

.overflow-hidden.rounded-xl.border.border-stone-200,

div.rounded-xl.border.border-stone-200.bg-white.shadow-sm {
    border-radius: 1rem !important;
    box-shadow: 0 8px 24px rgba(61, 64, 53, 0.06);
}

html[data-mh-ui="classic"] table thead {
    background: linear-gradient(180deg, var(--hub-surface) 0%, rgba(240, 244, 236, 0.9) 100%) !important;
}

/* Row icon circles in tables */

span.inline-flex.h-9.w-9.rounded-xl,

span.inline-flex.h-10.w-10.rounded-xl {
    box-shadow: 0 2px 8px rgba(61, 64, 53, 0.08);
    transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}

tbody tr:hover span.inline-flex.h-9.w-9.rounded-xl,

tbody tr:hover span.inline-flex.h-10.w-10.rounded-xl {
    transform: scale(1.04);
}

/* Page metric cards (generic) */

.mh-page-content .rounded-xl.border.border-stone-200.bg-white.p-4.shadow-sm,

.mh-page-content .rounded-xl.border.border-stone-200.bg-white.p-5.shadow-sm {
    border-radius: 0.85rem !important;
    border-color: rgba(107, 143, 113, 0.15) !important;
    background: linear-gradient(145deg, var(--hub-surface) 0%, #fff 100%) !important;
    box-shadow: 0 4px 14px rgba(61, 64, 53, 0.06);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.mh-page-content .rounded-xl.border.border-stone-200.bg-white.p-4.shadow-sm:hover,

.mh-page-content .rounded-xl.border.border-stone-200.bg-white.p-5.shadow-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(61, 64, 53, 0.08);
}

.mh-page-content > .space-y-6 > h1.text-2xl,

.mh-page-content .space-y-6 > div > h1.text-2xl,

.mh-page-content .space-y-8 > div > h1.text-2xl {
    letter-spacing: -0.02em;
}

.mh-page-content .space-y-6 > .flex.items-center.justify-between,

.mh-page-content .space-y-6 > .flex.flex-wrap.items-start.justify-between {
    padding-bottom: 0.25rem;
}

.impersonation-banner {
    box-shadow: 0 4px 14px rgba(61, 64, 53, 0.08);
}

@keyframes mh-page-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mh-section-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Saga activity log wall */
.saga-log-wall {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.saga-log-entry {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--hub-border, #e7e5e4);
}

.saga-log-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.saga-log-entry:first-child {
    padding-top: 0;
}

.saga-log-entry-icon {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    background: var(--hub-accent-light, #e4efe6);
    color: var(--hub-accent-dark, #4a6b50);
}

.saga-log-entry-icon .mh-nav-lucide,
.saga-log-entry-icon svg {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.5625rem;
}

.saga-log-entry-headline {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--hub-ink, #3d4035);
}

.saga-log-entry-body {
    min-width: 0;
    flex: 1;
}
