:root {
    color-scheme: dark;
    --nd-canvas: #0b1116;
    --nd-panel: #101a22;
    --nd-raised: #16232c;
    --nd-border: #273845;
    --nd-strong: #e7f0f5;
    --nd-muted: #a0b3c1;
    --nd-accent: #87ebd3;
    --nd-warm: #e6bd78;
    --nd-width: 77rem;
    --nd-gutter: clamp(1rem, 4vw, 3rem);
    --nd-mono: 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;
}

html.dark .fi-body { background: var(--nd-canvas); color: var(--nd-strong); }
.nd-mono { font-family: var(--nd-mono); }
.nd-muted, .nd-card p { color: var(--nd-muted); }
.nd-masthead a:focus-visible, .nd-masthead button:focus-visible, .nd-overview a:focus-visible {
    outline: 2px solid var(--nd-accent);
    outline-offset: 4px;
}

/* Filament supplies the authenticated layout and renders the NodeDeck masthead inside it. */
.fi-layout:has(.nd-masthead) { display: flex; flex-direction: column; }
.nd-masthead { z-index: 5; position: relative; border-bottom: 1px solid var(--nd-border); background: #0e171e; }
.nd-masthead-inner {
    min-height: 4.35rem;
    max-width: var(--nd-width);
    margin-inline: auto;
    padding-inline: var(--nd-gutter);
    display: grid;
    grid-template-columns: minmax(10rem, 1fr) auto minmax(10rem, 1fr);
    align-items: center;
    gap: 1.25rem;
}
.nd-home { width: fit-content; color: var(--nd-strong); }
.nd-brand { display: inline-flex; align-items: center; gap: .62rem; font-size: 1.21rem; font-weight: 740; letter-spacing: -.055em; white-space: nowrap; }
.nd-brand-accent { color: var(--nd-accent); }
.nd-mark { position: relative; display: inline-grid; place-content: center; width: 2rem; height: 2rem; border: 1px solid #2e625a; border-radius: .46rem; background: #112b2a; }
.nd-mark i { display: block; width: .85rem; height: .28rem; border-radius: 2px; background: var(--nd-accent); transform: skewY(-16deg); }
.nd-mark i + i { margin-top: .15rem; width: .6rem; background: #60ad9a; }
.nd-nav { display: flex; gap: .22rem; align-items: center; border: 1px solid var(--nd-border); padding: .22rem; border-radius: .55rem; background: #0b1218; }
.nd-nav a { padding: .45rem .78rem; border-radius: .32rem; font-size: .83rem; font-weight: 620; color: var(--nd-muted); }
.nd-nav a:hover { color: var(--nd-strong); background: var(--nd-panel); }
.nd-nav [aria-current='page'] { color: var(--nd-accent); background: #15302d; box-shadow: inset 0 0 0 1px #255048; }
.nd-user { display: flex; justify-content: flex-end; align-items: center; min-width: 0; gap: .7rem; }
.nd-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--nd-muted); font-size: .79rem; }
.nd-quiet { flex: 0 0 auto; padding: .36rem .55rem; color: var(--nd-strong); font-size: .8rem; border: 1px solid var(--nd-border); border-radius: .38rem; }
.nd-quiet:hover { background: var(--nd-raised); }
.fi-layout:has(.nd-masthead) .fi-main { max-width: var(--nd-width); width: 100%; padding-inline: var(--nd-gutter); }

.nd-overview { display: grid; gap: 1.3rem; }
.nd-hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1.4rem; padding-block: clamp(.55rem, 2.5vw, 1.8rem) .55rem; }
.nd-kicker { display: flex; gap: .55rem; align-items: center; color: var(--nd-accent); font: 650 .72rem/1.4 var(--nd-mono); letter-spacing: .075em; text-transform: uppercase; }
.nd-kicker span, .nd-status-dot, .nd-event-dot { display: inline-block; flex: 0 0 auto; width: .42rem; height: .42rem; border-radius: 50%; background: var(--nd-accent); }
.nd-hero h1 { margin: .62rem 0 .38rem; color: var(--nd-strong); font-size: clamp(1.9rem, 5.5vw, 3.3rem); line-height: 1.08; letter-spacing: -.062em; font-weight: 720; }
.nd-hero .nd-muted { font-size: .92rem; }
.nd-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.nd-button { display: inline-flex; align-items: center; gap: .35rem; min-height: 2.58rem; border: 1px solid var(--nd-border); border-radius: .45rem; padding: .46rem .85rem; font-size: .83rem; font-weight: 690; color: var(--nd-strong); background: var(--nd-panel); }
.nd-button:hover { background: var(--nd-raised); }
.nd-primary { color: #0a211d; background: var(--nd-accent); border-color: var(--nd-accent); }
.nd-primary:hover { background: #b3f5e5; }
.nd-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--nd-border); border-radius: .68rem; background: linear-gradient(115deg, #122721, var(--nd-panel) 55%); }
.nd-totals > div { position: relative; padding: .87rem clamp(.75rem, 3.8vw, 1.5rem) 1rem; }
.nd-totals > div + div { border-left: 1px solid var(--nd-border); }
.nd-totals dt { color: #afc2cc; font-size: .81rem; font-weight: 650; }
.nd-totals dd { margin: .2rem 0 0; font-size: clamp(1.65rem, 5.8vw, 2.9rem); line-height: 1; letter-spacing: -.065em; font-weight: 660; font-variant-numeric: tabular-nums; }
.nd-overview-grid { display: grid; grid-template-columns: minmax(0, 1.64fr) minmax(15rem, 1fr); gap: 1rem; align-items: start; }
.nd-card { min-width: 0; border: 1px solid var(--nd-border); border-radius: .68rem; background: var(--nd-panel); }
.nd-card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.5rem; padding: .8rem 1.15rem; }
.nd-card-header h2 { font-size: 1.02rem; line-height: 1.3; font-weight: 680; letter-spacing: -.022em; }
.nd-card-header p { font-size: .76rem; margin-top: .22rem; }
.nd-card-header a { font-size: .77rem; font-weight: 680; color: var(--nd-accent); white-space: nowrap; }
.nd-card-header a:hover, .nd-table a:hover { text-decoration: underline; text-underline-offset: 3px; }
.nd-table-wrap { overflow-x: auto; }
.nd-table { width: 100%; border-collapse: collapse; text-align: start; font-size: .82rem; }
.nd-table td, .nd-table th { padding: .61rem .65rem; border-top: 1px solid var(--nd-border); overflow-wrap: anywhere; }
.nd-table td:first-child, .nd-table th:first-child { padding-left: 1.15rem; }
.nd-table td:last-child, .nd-table th:last-child { padding-right: 1.15rem; text-align: right; }
.nd-table th { color: var(--nd-muted); background: #0d161e; font-size: .72rem; font-weight: 610; }
.nd-table a { color: var(--nd-strong); font-weight: 670; }
.nd-table small, .nd-activity small { display: block; margin-top: .2rem; color: var(--nd-muted); overflow-wrap: anywhere; font-size: .72rem; }
.nd-tag { display: inline-block; padding: .15rem .48rem; border: 1px solid #314653; border-radius: .29rem; background: #172832; color: #bdcfd9; font: 600 .72rem/1.4 system-ui, sans-serif; }
.nd-card-foot { display: flex; align-items: center; gap: .48rem; border-top: 1px solid var(--nd-border); padding: .65rem 1.15rem; font-size: .74rem; }
.nd-status-dot { background: var(--nd-warm); }
.nd-activity { margin: 0; padding: 0; list-style: none; }
.nd-activity li { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: .5rem; padding: .75rem 1.15rem; border-top: 1px solid var(--nd-border); }
.nd-activity strong { font-size: .8rem; font-weight: 680; }
.nd-activity time { color: var(--nd-muted); font-size: .69rem; white-space: nowrap; }
.nd-event-dot { background: #65baaa; margin-top: .45rem; }
.nd-empty, .nd-activity .nd-empty { display: block; padding: 1.14rem 1.15rem; color: var(--nd-muted); border-top: 1px solid var(--nd-border); font-size: .82rem; }

/* Filament list, edit and create views share the NodeDeck layout and components. */
html.dark .fi-body .fi-header-heading { font-size: clamp(1.7rem, 4vw, 2.45rem); font-weight: 720; letter-spacing: -.053em; }
html.dark .fi-body .fi-ta-ctn, html.dark .fi-body .fi-section, html.dark .fi-body .fi-modal-window {
    background-color: var(--nd-panel);
    border: 1px solid var(--nd-border);
    border-radius: .68rem;
    box-shadow: none;
}
html.dark .fi-body .fi-ta-header-toolbar, html.dark .fi-body .fi-ta-header-cell { background: #0d161e; }
html.dark .fi-body .fi-input-wrp { background-color: #0d171f; border-radius: .42rem; }
html.dark .fi-body .fi-btn { border-radius: .45rem; }
html.dark .fi-body .fi-btn.fi-color-primary { background: var(--nd-accent); color: #0a211d; }
html.dark .fi-body .fi-btn.fi-color-primary:hover { background: #b3f5e5; }

.fi-simple-layout:has(.nd-auth-intro) {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    min-height: 100svh;
    gap: 0;
}
.nd-auth-intro { display: flex; flex-direction: column; justify-content: center; align-items: start; gap: clamp(2.5rem, 12vh, 7rem); padding: clamp(1.5rem, 7vw, 6rem); background: linear-gradient(145deg, #17362e, #0d171f 70%); border-right: 1px solid var(--nd-border); }
.nd-auth-headline { margin: .7rem 0 1rem; color: var(--nd-strong); font-size: clamp(2.3rem, 6vw, 5.4rem); line-height: .96; letter-spacing: -.071em; font-weight: 725; }
.nd-auth-copy p:last-child { max-width: 24rem; color: var(--nd-muted); }
.fi-simple-layout:has(.nd-auth-intro) .fi-simple-main-ctn { padding: 1.5rem; }
html.dark .fi-simple-layout:has(.nd-auth-intro) .fi-simple-main { background: var(--nd-panel); border: 1px solid var(--nd-border); border-radius: .75rem; box-shadow: none; }
.fi-simple-layout:has(.nd-auth-intro) .fi-simple-header .fi-logo { display: none; }

@media (max-width: 760px) {
    .nd-masthead-inner { grid-template-columns: minmax(0, 1fr) auto; padding-block: .78rem .65rem; gap: .6rem; }
    .nd-nav { order: 3; grid-column: 1 / -1; }
    .nd-nav a { flex: 1 1 0; text-align: center; }
    .nd-overview-grid, .fi-simple-layout:has(.nd-auth-intro) { grid-template-columns: minmax(0, 1fr); }
    .nd-auth-intro { gap: 1.25rem; border-right: 0; border-bottom: 1px solid var(--nd-border); }
    .nd-auth-headline { font-size: clamp(2.2rem, 9vw, 3.8rem); }
}

@media (max-width: 410px) {
    .nd-user-name { display: none; }
    .nd-card-header, .nd-card-foot, .nd-activity li { padding-inline: .75rem; }
    .nd-table td:first-child, .nd-table th:first-child { padding-left: .75rem; }
    .nd-table td:last-child, .nd-table th:last-child { padding-right: .75rem; }
}

.nd-project {
    margin: 0;
    background: #0b1017;
    color: #e6edf5;
    font-family: system-ui, sans-serif;
}
.nd-project .nd-overview {
    width: min(72rem, calc(100% - 2rem));
    margin: 2rem auto;
}
.nd-project a { color: #80dfce; }
.nd-project summary { cursor: pointer; }
.nd-file-tools { padding: 1rem; }
.nd-file-form { margin-block: .75rem; }
.nd-file-form label { display: inline-block; margin: .4rem; }
.nd-file-form input:not([type="checkbox"]), .nd-file-form textarea {
    box-sizing: border-box;
    max-width: 100%;
    background: #121b25;
    border: 1px solid #405468;
    border-radius: .35rem;
    color: inherit;
    font: inherit;
    padding: .45rem;
}
.nd-file-form:has(textarea) label, .nd-file-form textarea { display: block; width: 100%; }
