/*
 * The two layout shells.
 *
 * Element defaults and the components they are built from live in base.css;
 * this file only arranges them. As there, no literal colour, size or radius:
 * everything reads a token.
 *
 * The two shells share a navigation item (.nav__item) and differ in everything
 * else, which is the point -- one is a 390px phone held at arm's length on a
 * scaffold, the other a 1920px desktop.
 */

/* ---- Navigation items (shared) ------------------------------------------ */

.nav__item {
    display: flex;
    align-items: center;
    min-height: var(--tap-min);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: var(--weight-bold);
    text-decoration: none;
}

.nav__item--current {
    background: var(--accent);
    color: var(--text-on-accent);
}

/*
 * A screen that has not been built yet. Muted, not light grey -- the token
 * still clears 7:1, so the item stays readable and the menu still says how much
 * of the app is coming.
 */
.nav__item--pending {
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ---- The painter's shell ------------------------------------------------ */

.painter {
    /* Roomier than the office: this is read at arm's length with paint on your
       hands. The office sets its own --gutter below. */
    --gutter: var(--space-4);

    display: flex;
    flex-direction: column;
    /* The primary size. Centred rather than stretched: a day list is not more
       readable for being 1600px wide. */
    max-width: var(--painter-width);
    min-height: 100dvh;
    margin: 0 auto;
    background: var(--surface);
    /* Only visible on a wider screen, where it separates the column from the
       page behind it. */
    border-inline: var(--border-width) solid var(--border);
}

.painter__account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: var(--tap-min);
    padding: var(--space-2) var(--gutter);
    border-bottom: var(--border-width) solid var(--border);
    font-size: var(--text-sm);
}

/* The dark ("dia") logo on the light column. Sized by height, as tall as a
   primary button: big enough that "SCHILDERWERKEN" under the name reads, and
   the row stays one row beside the single line of account text. */
.painter__logo {
    display: block;
    width: auto;
    height: var(--tap-primary);
}

.painter__user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.painter__header:not(:empty) {
    padding: var(--space-3) var(--gutter);
    border-bottom: var(--border-width) solid var(--border);
}

/*
 * The day total stays in view while the line list scrolls under it -- handoff
 * 1b, "teller, sticky, blijft in beeld bij scrollen". Sticky rather than fixed,
 * so it never overlaps the action bar on a short screen.
 */
.painter__counter {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-sunken);
}

.painter__counter:not(:empty) {
    padding: var(--space-4) var(--gutter);
    border-bottom: var(--border-width) solid var(--border);
}

.painter__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4) var(--gutter);
}

.painter__actions:not(:empty) {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3) var(--gutter);
    border-top: var(--border-width) solid var(--border);
}

/*
 * In-page navigation, not a fixed bar: on a phone a fixed bottom bar fights
 * the browser's own chrome, and the day screen already ends in an action bar
 * the painter has to reach.
 */
.painter__nav {
    display: flex;
    border-top: var(--border-width) solid var(--border);
}

.painter__nav .nav__item {
    flex: 1;
    justify-content: center;
    min-height: var(--tap-primary);
    border-radius: 0;
}

/* ---- The office shell --------------------------------------------------- */

.office {
    --gutter: var(--space-5);

    display: grid;
    grid-template-columns: var(--office-nav-width) 1fr;
    min-height: 100dvh;
}

.office__nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    /* Denser than the painter's: a mouse does not need 56px rows. */
    padding: var(--space-4) var(--space-3);
    border-right: var(--border-width) solid var(--border);
    background: var(--surface);
}

/* The dark ("dia") logo, straight on the light navigation -- as on the login
   screens. */
.office__brand {
    display: flex;
    margin-bottom: var(--space-2);
    padding: var(--space-2) var(--space-3);
}

.office__brand img {
    display: block;
    width: 112px;
    height: auto;
}

.office__account {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    /* Pushed to the bottom of the column, away from the six real items. */
    margin-top: auto;
    padding: var(--space-3);
    border-top: var(--border-width) solid var(--border);
    font-size: var(--text-sm);
}

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

.office__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--gutter);
    border-bottom: var(--border-width) solid var(--border);
    background: var(--surface);
}

.office__actions {
    display: flex;
    gap: var(--space-3);
}

.office__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-5);
    padding: var(--gutter);
}

/*
 * The office is designed at 1920px, but the owner does open this on a laptop.
 * Below the width where a 250px column plus a readable table stops fitting, the
 * navigation becomes a row above the page instead of disappearing behind a
 * hamburger -- six items fit on one line, and a menu nobody can see is a menu
 * nobody uses.
 */
@media (max-width: 900px) {
    .office {
        grid-template-columns: 1fr;
    }

    .office__nav {
        flex-flow: row wrap;
        align-items: center;
        border-right: 0;
        border-bottom: var(--border-width) solid var(--border);
    }

    .office__account {
        flex-direction: row;
        gap: var(--space-3);
        margin-top: 0;
        padding: 0 var(--space-3);
        border-top: 0;
    }
}

/* ---- Office list screens (2d, 2f) --------------------------------------- */

/*
 * The filter row above a list: alle / actief / inactief on 2d, the status chips
 * on 2f. Links rather than a form, so a filtered list is a URL the office can
 * bookmark, and the current chip says so to a screen reader too.
 */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-min);
    padding: 0 var(--space-4);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}

.filter-chip--current {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--text-on-accent);
}

/* A standing explanation under a list, such as "Klanten worden nooit verwijderd". */
.page-note {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* ---- Office detail forms (2e, 2g) --------------------------------------- */

/*
 * A two-way choice drawn as one control: Particulier / Zakelijk on 2e, binnen /
 * buiten on 2g. Radio buttons underneath, so the keyboard and the screen reader
 * get a real radio group.
 */
.segmented {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    border: 0;
}

.segmented legend {
    width: 100%;
    margin-bottom: var(--space-2);
}

.segmented .field__help {
    width: 100%;
}

.segmented__option {
    position: relative;
    cursor: pointer;
}

.segmented__option input {
    position: absolute;
    opacity: 0;
}

.segmented__option span {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-min);
    padding: 0 var(--space-4);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-weight: var(--weight-bold);
}

.segmented__option input:checked + span {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--text-on-accent);
}

.segmented__option input:focus-visible + span {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/*
 * A detail screen: the form on the left and what it is about on the right --
 * a customer's projects on 2e, the usage figure and bookings on 2g.
 */
.detail {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--space-5);
    align-items: start;
}

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

.detail__form,
.detail__aside {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.detail__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

/* A field that spans both columns: an address block, a description. */
.detail__wide {
    grid-column: 1 / -1;
}

.detail__address {
    margin: 0;
    padding: 0;
    border: 0;
}

.detail__address legend {
    margin-bottom: var(--space-2);
}

/* ---- Usage of an estimate (2c, 2g) -------------------------------------- */

/*
 * Bar plus percentage. Over 100% the bar is full and dark and the number bold;
 * without an estimate the bar is dashed and empty and the number a dash. The
 * number always carries the meaning; the bar is the shortcut.
 */
.usage {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
}

.usage__bar {
    flex: 1;
    min-width: 6rem;
    height: var(--space-3);
    overflow: hidden;
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.usage__fill {
    display: block;
    height: 100%;
    background: var(--accent);
}

.usage--over .usage__fill {
    background: var(--text);
}

.usage--over .usage__value {
    font-weight: var(--weight-bold);
}

.usage--none .usage__bar {
    border-style: dashed;
    background: var(--state-empty-surface);
}

.usage__value {
    min-width: 4.5rem;
    font-family: var(--font-numeric);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* A filter in the page header, such as 2c's status select. */
.header-filter {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-filter .field__control {
    width: auto;
}

/* 2c: over the estimate, the remaining figure is bold as well as negative. */
.table .is-over {
    font-weight: var(--weight-bold);
}

/* ---- Day chips (2j, 2h) ------------------------------------------------- */

/*
 * Ma-zo as toggles: the company's working days on 2j, an employee's fixed days
 * off on 2h. Checkboxes underneath, so the keyboard and the screen reader get
 * real checkboxes; only the chip is drawn.
 */
.day-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    border: 0;
}

.day-chips legend {
    width: 100%;
    margin-bottom: var(--space-2);
}

.chip {
    position: relative;
    cursor: pointer;
}

.chip input {
    position: absolute;
    opacity: 0;
}

.chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--tap-min);
    min-height: var(--tap-min);
    padding: 0 var(--space-3);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-weight: var(--weight-bold);
}

.chip input:checked + span {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--text-on-accent);
}

.chip input:focus-visible + span {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* ---- 2h: the detail panel under the list --------------------------------- */

.employee-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.employee-panel__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

/* The row whose detail is open below the list. */
.table tr[aria-current="true"] td {
    background: var(--surface-sunken);
}
