html {
    font-size: 16px;
}

body {
    -webkit-text-size-adjust: 100%;
}

/* Keep tap targets comfortable on a phone without bloating the desktop UI. */
@media (max-width: 767.98px) {
    .btn,
    .form-control,
    .form-select {
        min-height: 2.75rem;
    }

    .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
        margin-top: 0.15rem;
    }

    .form-check-label {
        padding-left: 0.25rem;
    }
}

/* Wide admin grids: scroll sideways rather than squashing, and keep the row
   label visible while doing it. */
.matrix-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.matrix-scroll table {
    margin-bottom: 0;
}

.matrix-scroll th.sticky-col,
.matrix-scroll td.sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: var(--bs-body-bg);
    box-shadow: 1px 0 0 var(--bs-border-color);
}

.matrix-scroll thead th.sticky-col {
    z-index: 3;
    background-color: var(--bs-tertiary-bg);
}

/* Card list used instead of a table on narrow screens. */
.stack-card + .stack-card {
    margin-top: 0.5rem;
}

.scroll-panel {
    max-height: 18rem;
    overflow-y: auto;
}

@media (max-width: 575.98px) {
    .scroll-panel {
        max-height: 14rem;
    }
}


/* Meal type mapping rows. One set of form controls that reflows, rather than a
   table and a card list — duplicate inputs in one form would post twice and the
   hidden copy would overwrite the visible one. */
.mt-row {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--bs-border-color);
}

.mt-row.mt-unmapped {
    background-color: var(--bs-warning-bg-subtle);
}

.mt-row > div + div {
    margin-top: 0.4rem;
}

.mt-head {
    font-weight: 600;
    background-color: var(--pmck-teal-soft, #e2efee);
    border-top: 0;
}

@media (min-width: 768px) {
    .mt-row {
        display: grid;
        grid-template-columns: minmax(9rem, 1.3fr) 6rem minmax(11rem, 1.4fr) 6rem 8rem;
        gap: 0.75rem;
        align-items: center;
    }

    .mt-row > div + div {
        margin-top: 0;
    }

    .mt-name code {
        word-break: break-word;
    }
}

/* Preserves the line breaks someone typed into a feedback box. */
.prewrap { white-space: pre-wrap; }

/* ---- Ops Scorecard daily grid (Spec 8 section 3) --------------------------
   A month of KPIs is a wide, dense table: narrow day columns, a KPI name that
   stays put while it scrolls, and one colour per state. Green is a 1, red a 0,
   black a day that has not happened and pale one that has passed unanswered. */

.ops-grid th,
.ops-grid td { white-space: nowrap; }

.ops-grid .ops-day { width: 1.9rem; padding: 0.15rem; font-weight: 500; }

.ops-sticky {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bs-body-bg);
    min-width: 17rem;
    white-space: normal;
}

.ops-cell {
    display: block;
    width: 100%;
    min-width: 1.6rem;
    height: 1.6rem;
    border: 0;
    border-radius: 0.15rem;
    padding: 0;
    font-size: 0.7rem;
    line-height: 1.6rem;
    text-align: center;
}

.ops-yes { background: var(--bs-success); color: #fff; }
.ops-no { background: var(--bs-danger); color: #fff; }
.ops-open { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.ops-future { background: #212529; }

/* The days a weekly KPI's single cell spans. Not an unanswered day. */
.ops-span { background: var(--bs-tertiary-bg); }

/* A score the system filled in, so an overridden one can be told apart. */
.ops-auto { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55); }

.ops-key {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 0.15rem;
    vertical-align: -0.1rem;
}

/* ---- Store scope: showing what a brand, region or group grant covers -------
   A store reached by one of those is marked rather than ticked. Ticking its own
   box would turn the group grant into a list of individual grants on save, and
   the point of granting a group is that a store added to it later is included
   without anybody coming back to this screen. */

.scope-row-covered {
    background: var(--bs-success-bg-subtle, #d1e7dd);
    border-radius: 0.2rem;
}

.scope-row-covered .form-check-label { font-weight: 500; }

.scope-covered { font-weight: 400; }
