/* Janisty – "Schiefer & Messing". Colors live here as tokens; MudBlazor gets the same values via JanistyTheme. */
:root {
    --j-slate: #1D2A31;
    --j-slate-raised: #26363E;
    --j-slate-text: #A9B6BB;
    --j-slate-strong: #F2F5F4;
    --j-slate-line: rgba(255, 255, 255, .08);

    --j-fir: #2C6B5A;
    --j-fir-strong: #215546;
    --j-fir-soft: #E4EFEA;

    --j-brass: #D2A048;
    --j-brass-soft: #F7EEDB;
    --j-brass-ink: #7A5512;

    --j-red: #B0412E;
    --j-red-soft: #F7E4E0;
    --j-blue: #2F5F92;
    --j-blue-soft: #E3ECF5;

    --j-lime: #E7ECE9;
    --j-surface: #FFFFFF;
    --j-ink: #18232A;
    --j-muted: #56636A;
    --j-line: #DDE3E0;
    --j-frame: #CFD8D3;
    --j-hairline: #E6EBE8;
    --j-tint: #F4F7F5;
    --j-hover: #F2F5F3;
    --j-lift: 0 1px 2px rgba(24, 35, 42, .05);

    --j-radius-lg: 16px;
    --j-radius: 12px;
    --j-radius-sm: 8px;

    --j-sidebar-width: 248px;
    --j-topbar-height: 56px;
    --j-bottom-nav-height: 64px;
    --j-gutter: 32px;
}

html, body {
    background: var(--j-lime);
}

body {
    color: var(--j-ink);
    -webkit-font-smoothing: antialiased;
}

:focus-visible {
    outline: 2px solid var(--j-fir);
    outline-offset: 2px;
}

.tabular {
    font-variant-numeric: tabular-nums;
}

/* ---------- Shell: slate sidebar, light work area ---------- */

.shell {
    display: grid;
    grid-template-columns: var(--j-sidebar-width) minmax(0, 1fr);
    min-height: 100dvh;
}

.shell.is-collapsed {
    --j-sidebar-width: 76px;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 12px 12px;
    background: var(--j-slate);
    color: var(--j-slate-text);
    overflow-y: auto;
    z-index: 1300;
}

.sidebar-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px 14px;
    min-height: 44px;
}

.brand {
    color: var(--j-slate-strong);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -.01em;
    line-height: 1;
}

.brand-tenant {
    display: block;
    margin-top: 3px;
    font-size: .78rem;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--j-slate-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.sidebar-toggle {
    all: unset;
    margin-left: auto;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--j-radius-sm);
    color: var(--j-slate-text);
    cursor: pointer;
}

.sidebar-toggle:hover {
    background: var(--j-slate-raised);
    color: var(--j-slate-strong);
}

.sidebar-toggle:focus-visible {
    outline: 2px solid var(--j-brass);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-group {
    padding: 16px 12px 6px;
    font-size: .78rem;
    color: #7F8E94;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--j-slate-text);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}

.nav-item .mud-icon-root {
    font-size: 1.3rem;
    flex: none;
}

.nav-item:hover {
    background: var(--j-slate-raised);
    color: var(--j-slate-strong);
}

.nav-item.active {
    background: rgba(210, 160, 72, .14);
    color: var(--j-slate-strong);
}

.nav-item.active .mud-icon-root {
    color: var(--j-brass);
}

.nav-item:focus-visible {
    outline: 2px solid var(--j-brass);
    outline-offset: -2px;
}

.sidebar-foot {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--j-slate-line);
}

.user-card {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border-radius: var(--j-radius);
    cursor: pointer;
}

.user-card:hover {
    background: var(--j-slate-raised);
}

.user-card:focus-visible {
    outline: 2px solid var(--j-brass);
}

.user-card-text {
    min-width: 0;
    line-height: 1.25;
}

.user-card-name {
    display: block;
    color: var(--j-slate-strong);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-card-role {
    display: block;
    font-size: .8rem;
}

.avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--j-brass);
    color: var(--j-slate);
    font-weight: 700;
    font-size: .85rem;
}

/* Collapsed sidebar: icons only; the label is still there for screen readers and as tooltip. */
.shell.is-collapsed .nav-item span,
.shell.is-collapsed .nav-group,
.shell.is-collapsed .brand-text,
.shell.is-collapsed .user-card-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* Collapsed, a group label becomes a thin divider. */
.shell.is-collapsed .nav-group {
    position: static;
    width: auto;
    height: 1px;
    margin: 10px 12px;
    padding: 0;
    clip: auto;
    background: var(--j-slate-line);
}

.shell.is-collapsed .nav-item,
.shell.is-collapsed .user-card {
    justify-content: center;
    padding: 0;
}

.shell.is-collapsed .user-card {
    padding: 8px 0;
}

.shell.is-collapsed .sidebar-head {
    flex-direction: column;
    padding-inline: 0;
}

.shell.is-collapsed .sidebar-toggle {
    margin-left: 0;
}

.shell-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    width: 100%;
    padding: 28px var(--j-gutter) 32px;
}

.topbar {
    display: none;
}

.scrim {
    display: none;
}


/* ---------- Page header ---------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 20px;
}

.page-head h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.015em;
    line-height: 1.2;
}

.page-head p {
    margin: 4px 0 0;
    color: var(--j-muted);
    max-width: 70ch;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* ---------- List / detail ---------- */

.ld {
    display: grid;
    grid-template-columns: clamp(300px, 24vw, 460px) minmax(0, 1fr);
    grid-template-areas:
        "head head"
        "list detail";
    gap: 0 20px;
    align-items: start;
}

.ld > .page-head {
    grid-area: head;
}

.ld-list {
    grid-area: list;
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 48px);
    background: var(--j-surface);
    border: 1px solid var(--j-frame);
    border-radius: var(--j-radius-lg);
    box-shadow: var(--j-lift);
    overflow: hidden;
}

.ld-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 12px 10px;
    border-bottom: 1px solid var(--j-line);
    background: var(--j-tint);
}

.ld-items {
    overflow-y: auto;
    padding: 6px;
}

.ld-detail {
    grid-area: detail;
    min-width: 0;
}

.ld-empty-hint {
    padding: 24px 16px;
    color: var(--j-muted);
    text-align: center;
}

/* One entry of a list pane. */
.li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--j-radius);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.li {
    position: relative;
}

/* Hairlines between entries, starting after the leading tile; hidden around hovered or selected entries. */
.li + .li::before {
    content: "";
    position: absolute;
    top: 0;
    left: 64px;
    right: 12px;
    border-top: 1px solid var(--j-hairline);
}

.li:hover::before,
.li.is-selected::before,
.li:hover + .li::before,
.li.is-selected + .li::before {
    opacity: 0;
}

.li:hover {
    background: var(--j-hover);
}

.li.is-selected {
    background: var(--j-fir-soft);
    box-shadow: inset 3px 0 0 var(--j-fir);
}

.li:focus-visible {
    outline-offset: -2px;
}

.li-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.li-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.li-sub {
    font-size: .9rem;
    color: var(--j-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.li-below {
    margin-top: 4px;
}

.li-trail {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: .85rem;
    color: var(--j-muted);
}

.li.is-inactive .li-title {
    color: var(--j-muted);
}

/* Leading square in a list entry: initials, an icon or a number. */
.tile {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--j-fir-soft);
    color: var(--j-fir-strong);
    font-weight: 700;
    font-size: .85rem;
}

.li.is-selected .tile {
    background: var(--j-fir);
    color: #fff;
}

.tile.is-brass {
    background: var(--j-brass-soft);
    color: var(--j-brass-ink);
}

.tile.is-red {
    background: var(--j-red-soft);
    color: var(--j-red);
}

.tile.is-muted {
    background: #ECEFED;
    color: var(--j-muted);
}

/* Filter chips above a list. */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter {
    all: unset;
    background: var(--j-surface);
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--j-line);
    font-size: .875rem;
    font-weight: 500;
    color: var(--j-muted);
    cursor: pointer;
}

.filter:hover {
    background: var(--j-hover);
}

.filter[aria-pressed="true"] {
    border-color: var(--j-fir);
    background: var(--j-fir);
    color: #fff;
}

.filter-count {
    font-size: .78rem;
    opacity: .8;
}

.filter:focus-visible {
    outline: 2px solid var(--j-fir);
    outline-offset: 2px;
}

/* Search field inside a list pane. */
.search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    background: var(--j-surface);
    border: 1px solid var(--j-frame);
    color: var(--j-muted);
}

.search:focus-within {
    outline: 2px solid var(--j-fir);
}

.search input {
    all: unset;
    flex: 1;
    min-width: 0;
    color: var(--j-ink);
}

.search input::placeholder {
    color: var(--j-muted);
}

/* ---------- Detail pane ---------- */

.detail {
    background: var(--j-surface);
    border: 1px solid var(--j-frame);
    border-radius: var(--j-radius-lg);
    box-shadow: var(--j-lift);
    overflow: hidden;
}

.detail-back {
    display: none;
}

.detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--j-line);
    background: var(--j-tint);
}

.detail-title {
    display: flex;
    gap: 16px;
    align-items: center;
    min-width: 0;
}

.detail-title .tile {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    font-size: 1.05rem;
}

.detail-title h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.015em;
    line-height: 1.2;
}

.detail-title p {
    margin: 4px 0 0;
    color: var(--j-muted);
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dsec {
    padding: 20px 28px 24px;
}

.dsec + .dsec {
    border-top: 1px solid var(--j-line);
}

.dsec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 36px;
    margin-bottom: 10px;
}

.dsec-head h3 {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 700;
}

.dsec-empty {
    color: var(--j-muted);
}

/* Label/value pairs in a detail section. */
.facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px 24px;
    margin: 0;
    padding: 14px 18px;
    border-radius: var(--j-radius);
    background: var(--j-tint);
    border: 1px solid var(--j-hairline);
}

.facts dt {
    font-size: .82rem;
    color: var(--j-muted);
}

.facts dd {
    margin: 2px 0 0;
    font-weight: 500;
}

/* Rows inside a detail section (doors, contacts, collections …). */
.rows {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--j-frame);
    border-radius: var(--j-radius);
    overflow: hidden;
}

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 8px 14px;
    color: inherit;
    text-decoration: none;
}

.row + .row {
    border-top: 1px solid var(--j-hairline);
}

a.row:hover {
    background: var(--j-hover);
}

.row-main {
    flex: 1;
    min-width: 0;
}

.row-title {
    font-weight: 600;
}

.row-sub {
    font-size: .875rem;
    color: var(--j-muted);
}

.row-end {
    flex: none;
    color: var(--j-muted);
    font-size: .9rem;
}

/* Nothing selected yet. */
.detail-placeholder {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 360px;
    padding: 32px;
    text-align: center;
    color: var(--j-muted);
    background: var(--j-surface);
    border: 1px dashed #CBD3CF;
    border-radius: var(--j-radius-lg);
}

.detail-placeholder .mud-icon-root {
    font-size: 2.5rem;
    color: #B5C0BB;
}

.detail-placeholder strong {
    display: block;
    color: var(--j-ink);
    font-size: 1.05rem;
}

/* ---------- Status pills ---------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    background: #ECEFED;
    color: var(--j-muted);
}

.pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.pill.is-ok {
    background: var(--j-fir-soft);
    color: var(--j-fir-strong);
}

.pill.is-warn {
    background: var(--j-brass-soft);
    color: var(--j-brass-ink);
}

.pill.is-bad {
    background: var(--j-red-soft);
    color: var(--j-red);
}

.pill.is-info {
    background: var(--j-blue-soft);
    color: var(--j-blue);
}

/* ---------- Cards for non-list pages ---------- */

.panel {
    background: var(--j-surface);
    border: 1px solid var(--j-frame);
    border-radius: var(--j-radius-lg);
    box-shadow: var(--j-lift);
}

.panel-pad {
    padding: 20px 24px;
}

/* ---------- Dashboard ---------- */

.today-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.today-figure {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--j-radius-lg);
    background: var(--j-surface);
    border: 1px solid var(--j-frame);
    box-shadow: var(--j-lift);
    color: inherit;
    text-decoration: none;
}

a.today-figure:hover {
    border-color: #C9D2CE;
}

.today-figure strong {
    display: block;
    font-size: 1.6rem;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.today-figure span {
    color: var(--j-muted);
    font-size: .9rem;
}

/* ---------- Work plan ---------- */

.day-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: var(--j-radius);
    background: var(--j-surface);
    border: 1px solid var(--j-line);
}

.progress {
    height: 8px;
    border-radius: 999px;
    background: #CFD8D3;
    overflow: hidden;
}

.progress > div {
    height: 100%;
    border-radius: inherit;
    background: var(--j-brass);
    transition: width .4s ease;
}

.progress.is-done > div {
    background: var(--j-fir);
}

/* Visits side by side once there is room for two readable cards. */
.visits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
    gap: 16px;
    align-items: start;
}

.visit {
    background: var(--j-surface);
    border: 1px solid var(--j-frame);
    box-shadow: var(--j-lift);
    border-radius: var(--j-radius-lg);
    overflow: hidden;
}

.visit-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 8px;
}

.visit-head h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.visit-head p {
    margin: 2px 0 0;
    color: var(--j-muted);
    font-size: .9rem;
}

.visit-tasks {
    padding: 0 12px;
}

.visit-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 20px 14px;
    border-top: 1px solid var(--j-line);
    background: var(--j-tint);
}

.visit.is-cancelled {
    opacity: .6;
}

.task-row {
    min-height: 52px;
    border-top: 1px solid #EEF1EF;
}

.task-row:first-child {
    border-top: none;
}

.task-row .mud-checkbox .mud-typography {
    font-size: 1.05rem;
}

.task-row.is-done .mud-checkbox .mud-typography {
    color: var(--j-muted);
    text-decoration: line-through;
    text-decoration-color: var(--j-fir);
}

/* ---------- Phone ---------- */

.bottom-nav {
    display: none;
}

@media (max-width: 959.98px) {
    :root {
        --j-gutter: 16px;
    }

    .shell,
    .shell.is-collapsed {
        --j-sidebar-width: 280px;
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--j-sidebar-width);
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .shell.menu-open .sidebar {
        transform: none;
    }

    .shell.menu-open .scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 22, 26, .45);
        z-index: 1250;
    }

    .sidebar-toggle {
        display: none;
    }

    /* On the phone the drawer always shows labels. */
    .shell.is-collapsed .nav-item span,
    .shell.is-collapsed .nav-group,
    .shell.is-collapsed .brand-text,
    .shell.is-collapsed .user-card-text {
        position: static;
        width: auto;
        height: auto;
        clip: auto;
    }

    .shell.is-collapsed .nav-group {
        margin: 0;
        padding: 16px 12px 6px;
        background: none;
    }

    .shell.is-collapsed .nav-item {
        justify-content: flex-start;
        padding: 0 12px;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 1200;
        display: flex;
        align-items: center;
        gap: 10px;
        height: var(--j-topbar-height);
        padding: 0 12px;
        background: var(--j-slate);
        color: var(--j-slate-strong);
    }

    .content {
        padding: 18px var(--j-gutter) calc(var(--j-bottom-nav-height) + 24px);
    }

    .page-head h1 {
        font-size: 1.5rem;
    }


    .bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1200;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        height: calc(var(--j-bottom-nav-height) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--j-surface);
        border-top: 1px solid var(--j-line);
    }

    .bottom-nav a,
    .bottom-nav button {
        all: unset;
        display: grid;
        place-items: center;
        align-content: center;
        gap: 2px;
        font-size: .75rem;
        font-weight: 600;
        color: var(--j-muted);
        cursor: pointer;
    }

    .bottom-nav .mud-icon-root {
        padding: 3px 18px;
        border-radius: 999px;
        box-sizing: content-box;
    }

    .bottom-nav a.active {
        color: var(--j-fir-strong);
    }

    .bottom-nav a.active .mud-icon-root {
        background: var(--j-fir-soft);
    }

    .bottom-nav a:focus-visible,
    .bottom-nav button:focus-visible {
        outline: 2px solid var(--j-fir);
        outline-offset: -4px;
    }

    /* List/detail becomes list → detail with a back link. */
    .ld {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "head"
            "list"
            "detail";
    }

    .ld-list {
        position: static;
        max-height: none;
    }

    .ld.has-selection > .page-head,
    .ld.has-selection > .ld-list,
    .ld:not(.has-selection) > .ld-detail:not(.keep-on-phone) {
        display: none;
    }

    .ld:not(.has-selection) > .ld-detail.keep-on-phone {
        margin-top: 16px;
    }

    .detail {
        border-radius: var(--j-radius-lg);
    }

    .detail-back {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin: 14px 16px 0;
        color: var(--j-fir-strong);
        font-weight: 600;
        text-decoration: none;
    }

    .detail-head {
        padding: 12px 16px 16px;
    }

    .detail-title h2 {
        font-size: 1.3rem;
    }

    .dsec {
        padding: 16px;
    }
}

/* ---------- MudBlazor, brought in line ---------- */

.mud-paper-outlined,
.mud-card.mud-paper-outlined,
.mud-table-outlined {
    border-color: var(--j-line);
}

.mud-paper-outlined,
.mud-table-outlined {
    border-radius: var(--j-radius-lg);
}

.mud-dialog {
    border-radius: 18px;
}

.mud-dialog .mud-dialog-title {
    font-weight: 700;
}

.mud-button-filled {
    box-shadow: none !important;
}

.mud-button-root.mud-button {
    border-radius: 10px;
}

.mud-input-outlined .mud-input-outlined-border {
    border-radius: 10px;
}

.mud-chip {
    border-radius: 999px;
}

.mud-snackbar {
    border-radius: var(--j-radius);
}

.mud-popover {
    border-radius: var(--j-radius);
}

.mud-tab {
    text-transform: none;
    font-weight: 600;
    letter-spacing: 0;
}

/* ---------- Sign-in ---------- */

.login-background {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background:
        radial-gradient(1200px 600px at 100% 0, rgba(44, 107, 90, .10), transparent 60%),
        var(--j-lime);
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 36px 32px 32px;
    background: var(--j-surface);
    border: 1px solid var(--j-line);
    border-radius: 22px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.login-brand .brand {
    color: var(--j-ink);
    font-size: 1.75rem;
}

@media (prefers-reduced-motion: reduce) {
    .progress > div,
    .sidebar {
        transition: none;
    }
}

/* ---------- Printing: only the document, on white paper ---------- */
@media print {
    .sidebar,
    .topbar,
    .bottom-nav,
    .scrim,
    .demo-ribbon,
    .ld-list,
    .ld > .page-head,
    .mud-snackbar-provider,
    #mud-snackbar-container,
    .no-print {
        display: none !important;
    }

    html, body, .shell, .content {
        background: #fff !important;
        color: #000 !important;
    }

    .shell,
    .ld {
        display: block !important;
    }

    .content {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none;
    }

    .detail,
    .panel,
    .visit,
    .mud-paper,
    .mud-card {
        box-shadow: none !important;
        border-color: #999 !important;
        break-inside: avoid;
    }
}

/* Signature pad: a lined field like on paper forms; touch must not scroll the page. */
.signature-pad {
    width: 100%;
    height: 180px;
    touch-action: none;
    background:
        linear-gradient(to top, transparent 44px, #9AA3A0 44px, #9AA3A0 45px, transparent 45px),
        #FFFFFF;
    border: 1px solid var(--j-line);
    border-radius: var(--j-radius);
    cursor: crosshair;
}

/* Work report ("Arbeitsnachweis"), modelled on the paper form the business already uses. */
.work-report {
    max-width: 190mm;
    margin: 0 auto;
    padding: 18mm 16mm;
    background: #FFFFFF;
    color: #111;
    font-family: Arial, "Helvetica Neue", sans-serif;
    font-size: 11pt;
    line-height: 1.45;
    border: 1px solid var(--j-line);
}

.work-report h1 {
    font-size: 20pt;
    margin: 0 0 6px;
}

.work-report .rule {
    border: none;
    border-top: 2px solid #111;
    margin: 4px 0;
}

.work-report .company {
    text-align: right;
    margin: 6px 0;
}

.work-report .label {
    font-weight: 700;
}

.work-report .fields {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 16px;
    margin: 18px 0;
}

.work-report .handwriting {
    color: #0b2a6f;
    border-bottom: 1px solid #999;
    min-height: 1.6em;
}

.work-report .disclaimer {
    font-size: 9.5pt;
    margin-top: 32px;
}

.work-report .signature {
    display: grid;
    grid-template-columns: max-content 1fr;
    align-items: end;
    gap: 16px;
    margin-top: 24px;
}

.work-report .signature img {
    max-height: 70px;
}

.work-report .signature-box {
    border: 1px solid #999;
    min-height: 74px;
    padding: 2px 8px;
}

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    .work-report {
        border: none;
        max-width: none;
    }
}

.li-below {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* A printed document inside a detail pane: on paper only the document itself appears. */
@media print {
    .detail:has(.receipt) > .detail-head,
    .detail:has(.receipt) > .detail-back {
        display: none !important;
    }

    .detail:has(.receipt) {
        border: none !important;
    }
}

.panel .mud-typography-h6 {
    margin-bottom: 8px;
}

/* Links inside text read as links; list rows and buttons keep their own look. */
.dsec a:not(.row):not(.mud-button-root),
.facts a {
    color: var(--j-fir-strong);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(44, 107, 90, .35);
    text-underline-offset: 3px;
}

.dsec a:not(.row):not(.mud-button-root):hover {
    text-decoration-color: currentColor;
}

.dsec .row-sub a:not(.row):not(.mud-button-root) {
    font-weight: 400;
    text-decoration: none;
}

.panel .mud-table-outlined {
    border-radius: var(--j-radius);
}

/* Breadcrumbs above a page title. */
.crumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 0;
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
    font-size: .85rem;
    color: var(--j-muted);
}

.crumbs li + li::before {
    content: "›";
    margin: 0 8px;
    color: #A3AEAA;
}

.crumbs a {
    color: var(--j-muted);
    text-decoration: none;
}

.crumbs a:hover {
    color: var(--j-fir-strong);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.crumbs [aria-current="page"] {
    color: var(--j-ink);
    font-weight: 500;
}

/* Shown by Blazor after an unhandled error. */
#blazor-error-ui {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 2000;
    transform: translateX(-50%);
    width: min(560px, calc(100% - 32px));
    box-sizing: border-box;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--j-radius);
    background: var(--j-slate);
    color: var(--j-slate-strong);
    box-shadow: 0 8px 24px rgba(24, 35, 42, .25);
}

#blazor-error-ui[style*="block"] {
    display: flex !important;
}

#blazor-error-ui .reload {
    margin-left: auto;
    color: var(--j-brass);
    font-weight: 600;
    white-space: nowrap;
}

#blazor-error-ui .dismiss {
    all: unset;
    cursor: pointer;
    padding: 0 4px;
}

/* Demo: a brass band across the top-left corner instead of a banner. */
.demo-ribbon {
    position: fixed;
    top: 16px;
    left: -38px;
    z-index: 1400;
    width: 136px;
    padding: 4px 0;
    transform: rotate(-45deg);
    background: var(--j-brass);
    color: var(--j-slate);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    pointer-events: none;
}

.shell:has(.demo-ribbon) .sidebar-head {
    padding-top: 20px;
    padding-left: 26px;
}

.shell.is-collapsed:has(.demo-ribbon) .sidebar-head {
    padding-left: 0;
}

@media (max-width: 959.98px) {
    .shell:has(.demo-ribbon) .topbar {
        padding-left: 52px;
    }
}

/* Desktop: the app fills the window. Lists and details scroll on their own, like an application, not a web page. */
@media (min-width: 960px) {
    .shell {
        height: 100dvh;
        overflow: hidden;
    }

    .shell-main {
        height: 100dvh;
        overflow: hidden;
    }

    .content {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        overflow-y: auto;
    }

    .ld {
        flex: 1;
        min-height: 0;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .ld-list {
        position: static;
        height: 100%;
        max-height: none;
        min-height: 0;
    }

    .ld-detail {
        height: 100%;
        min-height: 0;
        overflow-y: auto;
        border-radius: var(--j-radius-lg);
    }

    .ld-detail > .detail,
    .ld-detail > .detail-placeholder,
    .ld-detail > .panel {
        min-height: 100%;
        box-sizing: border-box;
    }

    .fill {
        flex: 1;
        min-height: 0;
    }
}

/* Dashboard: today's visits and urgent tickets use the remaining height. */
.dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 16px;
}

.dash-grid > .panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

@media (max-width: 959.98px) {
    .dash-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Work plan: day, three days, week and month ---------- */

.plan {
    display: flex;
    flex-direction: column;
}

/* Segmented switch for the view. */
.segmented {
    display: inline-flex;
    padding: 3px;
    border-radius: var(--j-radius);
    background: var(--j-surface);
    border: 1px solid var(--j-frame);
}

.segmented button {
    all: unset;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    color: var(--j-muted);
    cursor: pointer;
}

.segmented button:hover {
    color: var(--j-ink);
}

.segmented button[aria-pressed="true"] {
    background: var(--j-fir);
    color: #fff;
}

.segmented button:focus-visible {
    outline: 2px solid var(--j-fir);
    outline-offset: 1px;
}

/* Columns: one per day. */
.plan-cols {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(var(--plan-days), minmax(180px, 1fr));
    gap: 12px;
    overflow-x: auto;
}

.plan-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--j-surface);
    border: 1px solid var(--j-frame);
    border-radius: var(--j-radius-lg);
    box-shadow: var(--j-lift);
    overflow: hidden;
}

.plan-col-head {
    all: unset;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 0 8px;
    padding: 12px 14px;
    background: var(--j-tint);
    border-bottom: 1px solid var(--j-line);
    cursor: pointer;
}

.plan-col-head:hover .plan-col-weekday {
    color: var(--j-fir-strong);
}

.plan-col-head:focus-visible {
    outline: 2px solid var(--j-fir);
    outline-offset: -2px;
}

.plan-col-weekday {
    font-weight: 700;
}

.plan-col-date {
    grid-column: 1;
    font-size: .85rem;
    color: var(--j-muted);
}

.plan-col-count {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font-size: .85rem;
    font-weight: 600;
    color: var(--j-muted);
}

.plan-col.is-today .plan-col-head {
    background: var(--j-fir-soft);
    box-shadow: inset 0 3px 0 var(--j-fir);
}

.plan-col-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}

.plan-empty {
    margin: 8px 4px;
    font-size: .875rem;
    color: var(--j-muted);
}

.plan-visit {
    all: unset;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border-radius: var(--j-radius);
    border: 1px solid var(--j-line);
    border-left: 3px solid var(--j-brass);
    background: var(--j-surface);
    cursor: pointer;
}

.plan-visit:hover {
    background: var(--j-hover);
}

.plan-visit:focus-visible {
    outline: 2px solid var(--j-fir);
}

.plan-visit.is-started {
    border-left-color: var(--j-blue);
}

.plan-visit.is-done {
    border-left-color: var(--j-fir);
}

.plan-visit.is-cancelled {
    border-left-color: var(--j-frame);
    opacity: .6;
}

.plan-visit-title {
    font-weight: 600;
    line-height: 1.3;
}

.plan-visit-sub {
    font-size: .82rem;
    color: var(--j-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.plan-visit-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--j-muted);
}

.mini-progress {
    flex: 1;
    height: 5px;
    border-radius: 999px;
    background: #DCE3DF;
    overflow: hidden;
}

.mini-progress > span {
    display: block;
    height: 100%;
    background: var(--j-fir);
}

.mini-avatar {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--j-brass-soft);
    color: var(--j-brass-ink);
    font-size: .65rem;
    font-weight: 700;
}

/* Month: a calendar that fills the window. */
.plan-month {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: auto repeat(var(--plan-weeks), minmax(96px, 1fr));
    background: var(--j-surface);
    border: 1px solid var(--j-frame);
    border-radius: var(--j-radius-lg);
    box-shadow: var(--j-lift);
    overflow: hidden;
}

.plan-month-weekday {
    padding: 8px 10px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--j-muted);
    background: var(--j-tint);
    border-bottom: 1px solid var(--j-line);
}

.plan-day {
    all: unset;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 6px 8px;
    border-right: 1px solid var(--j-hairline);
    border-bottom: 1px solid var(--j-hairline);
    cursor: pointer;
    overflow: hidden;
}

.plan-day:nth-child(7n + 7) {
    border-right: none;
}

.plan-day:hover {
    background: var(--j-hover);
}

.plan-day:focus-visible {
    outline: 2px solid var(--j-fir);
    outline-offset: -2px;
}

.plan-day.is-other {
    background: var(--j-tint);
}

.plan-day.is-other .plan-day-num {
    color: #9AA6A1;
}

.plan-day-num {
    align-self: flex-start;
    display: grid;
    place-items: center;
    min-width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: .85rem;
    font-weight: 600;
}

.plan-day.is-today .plan-day-num {
    background: var(--j-fir);
    color: #fff;
}

.plan-day-entries {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.plan-day-entry {
    display: block;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: .78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--j-brass-soft);
    color: var(--j-brass-ink);
}

.plan-day-entry.is-done {
    background: var(--j-fir-soft);
    color: var(--j-fir-strong);
}

.plan-day-entry.is-cancelled {
    background: #ECEFED;
    color: var(--j-muted);
    text-decoration: line-through;
}

.plan-day-more {
    font-size: .75rem;
    color: var(--j-muted);
    padding: 0 6px;
}

@media (max-width: 959.98px) {
    /* Phone: days stacked, the month as a compact calendar with coloured marks. */
    .plan-cols {
        grid-template-columns: minmax(0, 1fr);
        overflow: visible;
    }

    .plan-col-body {
        overflow: visible;
    }

    .plan-month {
        grid-template-rows: auto repeat(var(--plan-weeks), minmax(56px, auto));
    }

    .plan-day {
        padding: 4px;
        align-items: center;
    }

    .plan-day-entries {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .plan-day-entry {
        width: 6px;
        height: 6px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        background: var(--j-brass);
    }

    .plan-day-entry.is-done {
        background: var(--j-fir);
    }

    .plan-day-entry.is-cancelled {
        background: var(--j-frame);
    }

    .plan-day-more {
        font-size: .7rem;
        padding: 0;
    }

    .plan-day-more-word {
        display: none;
    }

    /* Empty days only show their heading. */
    .plan-col-body:has(.plan-empty) {
        display: none;
    }

    .plan-col:has(.plan-empty) .plan-col-head {
        border-bottom: none;
    }

    .segmented button {
        padding: 5px 9px;
    }
}
