/* Timekeeper's own styles, on top of Pico CSS. Keep this file small. */

.narrow {
    max-width: 32rem;
    margin-inline: auto;
}

.muted {
    color: var(--pico-muted-color);
}

form.inline {
    margin: 0;
}

form.inline button {
    margin: 0;
    padding: 0.25rem 0.75rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--pico-border-radius);
    border-left: 4px solid;
}

.flash-success {
    border-color: var(--pico-ins-color);
    background: color-mix(in srgb, var(--pico-ins-color) 10%, transparent);
}

.flash-error {
    border-color: var(--pico-del-color);
    background: color-mix(in srgb, var(--pico-del-color) 10%, transparent);
}

.error-message {
    white-space: pre-wrap;
}

.page-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.inline-choice {
    display: inline-flex;
    gap: 0.25rem;
    margin-right: 1rem;
}

small.error {
    color: var(--pico-del-color);
}

/* Employee import preview: rows with problems stand out, and their
   problems are listed in red. */
.import-preview tr.has-error td {
    background: color-mix(in srgb, var(--pico-del-color) 8%, transparent);
}

.import-preview tr.problems td {
    padding-top: 0;
}

.import-preview ul.error {
    margin: 0;
    padding-left: 1rem;
    color: var(--pico-del-color);
}

.import-preview ul.error li {
    list-style: disc;
    margin: 0;
}

dl.details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
}

dl.details dt {
    color: var(--pico-muted-color);
}

dl.details dd {
    margin: 0;
}

/* On narrow screens, let the navigation wrap onto several lines instead
   of making the page wider than the screen. */
header nav,
header nav ul {
    flex-wrap: wrap;
}

/* Time clock */

.clock-card {
    text-align: center;
}

.clock-button {
    width: 100%;
    max-width: 20rem;
    font-size: 1.25rem;
}

.big-number {
    font-size: 1.75rem;
    font-weight: bold;
    margin: 0;
}

.negative {
    color: var(--pico-del-color);
}

.month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.month-nav h2 {
    margin: 0;
}

dl.summary {
    margin-block: 1rem;
}

table.timesheet tr.day-off td {
    color: var(--pico-muted-color);
}

table.timesheet tr.today td {
    font-weight: bold;
}

table.timesheet tr.needs-checking td {
    background: color-mix(in srgb, var(--pico-del-color) 10%, transparent);
}

table.timesheet .entry {
    display: inline-block;
    margin-right: 1rem;
    white-space: nowrap;
}

table.timesheet .entry a,
table.timesheet .add-entry {
    font-size: 0.85em;
}

table.timesheet .work-location {
    color: var(--pico-muted-color);
}

table.timesheet .day-note {
    display: inline-block;
    margin-right: 1rem;
    padding: 0 0.4rem;
    border-radius: var(--pico-border-radius);
    background: color-mix(in srgb, var(--pico-primary) 12%, transparent);
    font-size: 0.85em;
}

/* Leave */

.status-pending {
    color: var(--pico-color-amber-550, #b7791f);
}

.status-rejected,
.status-withdrawn {
    color: var(--pico-muted-color);
    text-decoration: line-through;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
}

.button-row form {
    margin: 0;
}

.button-row input[type=text] {
    margin: 0;
    min-width: 12rem;
}

/* Reports */

.report-tabs {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.report-tabs a {
    padding-bottom: 0.5rem;
    text-decoration: none;
}

.report-tabs a[aria-current="page"] {
    border-bottom: 3px solid var(--pico-primary);
    font-weight: bold;
}

table.report td,
table.report th {
    white-space: nowrap;
}

/* Audit log: the fields that a change touched. */
tr.changed td {
    background: color-mix(in srgb, var(--pico-mark-background-color) 35%, transparent);
}

.fingerprint {
    font-family: var(--pico-font-family-monospace);
    font-size: 0.8em;
    word-break: break-all;
}

.audit-check button {
    width: auto;
}

td.nowrap {
    white-space: nowrap;
}

/* ----- Leave overview (templates/leave_overview) ------------------------
   Three month columns, and the legend and holiday balance beside them.
   On narrow screens the months scroll sideways and the summary goes below. */

.leave-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}

.leave-calendar {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    max-width: 100%;
}

table.leave-month {
    width: 11rem;
    flex: none;
    font-size: 0.875rem;
}

table.leave-month th,
table.leave-month td {
    padding: 0.15rem 0.5rem;
}

table.leave-month thead th {
    text-transform: uppercase;
    font-weight: bold;
    background: var(--pico-table-row-stripped-background-color);
}

table.leave-month td.weekday {
    width: 2rem;
    text-align: center;
}

table.leave-month td.date {
    width: 2.5rem;
    text-align: right;
    color: var(--pico-primary);
}

table.leave-month td.marks {
    white-space: nowrap;
}

table.leave-month tr.weekend td {
    background: color-mix(in srgb, var(--pico-muted-color) 15%, transparent);
}

table.leave-month tr.day-off td,
.leave-swatch.day-off {
    background: color-mix(in srgb, var(--pico-ins-color) 15%, transparent);
}

table.leave-month tr.today td {
    font-weight: bold;
    box-shadow: inset 0 -2px var(--pico-primary);
}

/* One marker per absence: filled when approved, an outline while waiting
   for approval, and half filled for part of a day. */
.leave-mark,
.leave-swatch {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    margin-right: 0.15rem;
    vertical-align: middle;
    border: 1px solid var(--pico-color);
}

.leave-mark {
    border-color: var(--mark);
    background: var(--mark);
}

.leave-mark.pending {
    background: transparent;
    border-width: 2px;
}

.leave-mark.part {
    background: linear-gradient(135deg, var(--mark) 50%, transparent 50%);
}

.leave-summary {
    flex: 1 1 18rem;
    min-width: 16rem;
}

.leave-summary table {
    font-size: 0.875rem;
}

.leave-summary td,
.leave-summary th {
    padding: 0.25rem 0.5rem;
}

.leave-summary td:first-child {
    width: 2rem;
}

.leave-summary .number {
    text-align: right;
    white-space: nowrap;
}

.leave-summary tr.section th {
    background: var(--pico-table-row-stripped-background-color);
    font-weight: bold;
}

.leave-summary tr.total th {
    border-top: 2px solid var(--pico-muted-border-color);
}

.person-picker {
    margin: 0;
}

.person-picker select {
    margin: 0;
}

.leave-overview-links {
    font-size: 0.875rem;
}

/* Work locations and employee status */

.work-location-choice {
    margin-bottom: 1rem;
}

.work-location-choice legend {
    margin-bottom: 0.5rem;
}

.status-badge {
    display: inline-block;
    padding: 0 0.5rem;
    border-radius: var(--pico-border-radius);
    font-size: 0.875em;
    white-space: nowrap;
}

.status-badge.status-in {
    background: color-mix(in srgb, var(--pico-ins-color) 18%, transparent);
}

.status-badge.status-leave,
.status-badge.status-sick,
.status-badge.status-away {
    background: color-mix(in srgb, var(--pico-primary) 14%, transparent);
}

.status-badge.status-out {
    background: var(--pico-muted-border-color);
}

/* Fob readers: a new reader's device key, shown once. Long keys wrap on phones. */
.device-key code {
    word-break: break-all;
    user-select: all;
}

/* ----- Company branding -------------------------------------------------
   An admin can set a company name, logo and main colour on the Settings
   page (see src/Branding). */

/* The logo in the header, next to the company name. */
header nav a.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-logo {
    height: 2.25rem;
    width: auto;
    max-width: 10rem;
    object-fit: contain;
}

/* The logo and name above the sign-in form. */
.login-brand {
    text-align: center;
    margin-bottom: 1rem;
}

.login-logo {
    max-height: 5rem;
    max-width: 100%;
    width: auto;
}

.login-company {
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0.5rem 0 0;
}

/* The current logo on the Settings page. */
.logo-preview {
    max-height: 4rem;
    width: auto;
}

.colour-picker {
    max-width: 6rem;
    height: 2.5rem;
    padding: 0.25rem;
}

/* Company colour. The layout sets --brand (the colour) and --brand-text
   (black or white, whichever reads best on it) on <html data-brand>.
   `:root:root` makes these rules win over Pico's own colour rules, which
   use two-part selectors. Hover and focus shades are mixed from the
   colour, so only one colour has to be chosen. */
:root:root[data-brand] {
    --pico-primary: var(--brand);
    --pico-primary-background: var(--brand);
    --pico-primary-border: var(--brand);
    --pico-primary-underline: color-mix(in srgb, var(--brand) 50%, transparent);
    --pico-primary-hover: color-mix(in srgb, var(--brand) 80%, black);
    --pico-primary-hover-background: color-mix(in srgb, var(--brand) 85%, black);
    --pico-primary-hover-border: color-mix(in srgb, var(--brand) 85%, black);
    --pico-primary-hover-underline: color-mix(in srgb, var(--brand) 80%, black);
    --pico-primary-focus: color-mix(in srgb, var(--brand) 40%, transparent);
    --pico-primary-inverse: var(--brand-text);
}

/* In dark mode, links in a dark company colour would be hard to read on
   the dark background, so they are lightened. Buttons keep the colour. */
@media (prefers-color-scheme: dark) {
    :root:root[data-brand]:not([data-theme="light"]) {
        --pico-primary: color-mix(in srgb, var(--brand) 55%, white);
        --pico-primary-underline: color-mix(in srgb, var(--brand) 55%, transparent);
        --pico-primary-hover: color-mix(in srgb, var(--brand) 40%, white);
        --pico-primary-hover-underline: color-mix(in srgb, var(--brand) 40%, white);
    }
}

/* ----- Footer ------------------------------------------------------------
   "Powered by Timekeeper", on every page. Not part of the branding. */
.site-footer {
    text-align: center;
    color: var(--pico-muted-color);
    padding-block: 1.5rem;
}

/* ----- Bookings ----------------------------------------------------------
   The free times of a bookable asset, as a row of buttons per day. */
.booking-day h3 {
    margin-block: 1rem 0.5rem;
    font-size: 1.05rem;
}

.booking-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.booking-slots form.inline {
    margin: 0;
}

.booking-slot {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-muted-border-color);
    font-size: 0.95rem;
    width: auto;
    margin: 0;
}

.booking-slot.mine {
    background: var(--pico-ins-color);
    border-color: var(--pico-ins-color);
    color: #fff;
}

.booking-slot.taken {
    background: var(--pico-secondary-background);
    color: var(--pico-secondary-inverse);
}

.booking-slot.unavailable {
    color: var(--pico-muted-color);
    text-decoration: line-through;
}

.my-bookings form.inline button[type=submit] {
    width: auto;
    padding: 0.2rem 0.75rem;
    margin-inline-start: 0.5rem;
    font-size: 0.9rem;
}
