/* ------------------------------------------------------------------
   Programme of Works
   Colours sampled from the Superdrug Kettering PDF so the web version
   comes out the same as the spreadsheet always has.
   ------------------------------------------------------------------ */

:root {
    --green: #00B050;
    --accent: #00B050;
    --cta: #00B050;
    --cta-hover: #009845;
    --grid: #D9D9D9;
    --ink: #111;
    --muted: #666;
    --paper: #fff;
    --shell: #f4f5f6;
    --line: #dcdfe3;
    --red: #FF0000;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--shell);
    color: var(--ink);
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* ---------- shell ---------- */

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 20px;
}

.topbar-brand {
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
    text-decoration: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-client { color: var(--muted); font-size: 13px; }

.page { padding: 20px; }

.notice {
    background: color-mix(in srgb, var(--cta) 8%, #fff);
    border: 1px solid var(--cta);
    padding: 10px 14px;
    border-radius: 6px;
    margin: 0 0 16px;
}

.error {
    background: #fdecea;
    border: 1px solid #f5c2bd;
    color: #8a1c12;
    padding: 10px 14px;
    border-radius: 6px;
    margin: 0 0 16px;
}

/* ---------- buttons ---------- */

.btn {
    display: inline-block;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 7px 13px;
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { background: #f7f8f9; }

.btn-primary {
    background: var(--cta);
    border-color: var(--cta);
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); }

.btn-quiet { border-color: transparent; color: var(--muted); }

.btn-danger { color: #b3261e; }

.btn-small { padding: 4px 9px; font-size: 12px; }

.btn:disabled { opacity: .5; cursor: default; }

/* ---------- cards and forms ---------- */

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px 20px;
    margin: 0 0 18px;
}

.card h2 { margin: 0 0 14px; font-size: 15px; }

label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 4px; }

input[type=text], input[type=date], input[type=number], input[type=password], select {
    font: inherit;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    width: 100%;
}

input:focus, select:focus { outline: 2px solid var(--cta); outline-offset: -1px; }

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

/* ---------- programme list ---------- */

.list { list-style: none; margin: 0; padding: 0; }

.list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.list li:last-child { border-bottom: 0; }

.list-title { font-weight: 600; text-decoration: none; color: var(--ink); }

.list-meta { color: var(--muted); font-size: 12px; }

.empty { color: var(--muted); padding: 8px 0; }

/* ---------- the chart, shared by editor and print ---------- */

.pow { width: 100%; }

.pow-head-title { font-size: 17px; font-weight: 700; margin: 0 0 6px; }

.pow-revision {
    color: var(--red);
    font-weight: 700;
    text-decoration: underline;
    margin: 0 0 8px;
    font-size: 12px;
}

.pow-meta {
    display: grid;
    grid-template-columns: max-content max-content;
    gap: 2px 40px;
    font-size: 12px;
    margin: 0 0 10px;
}

.pow-meta b { font-weight: 700; }

.pow-logo { max-height: 62px; width: auto; }

.pow-headline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

table.grid {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
    font-size: 10px;
}

table.grid th, table.grid td {
    border: 1px solid var(--grid);
    padding: 0;
    vertical-align: middle;
    overflow: hidden;
}

/* Kept in step with the printed sheet, where these were too small to read. */
.week-bar {
    background: #000;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-align: left;
    padding: 3px 5px;
    white-space: nowrap;
    border-color: #000;
}

.day-num {
    text-align: center;
    font-size: 10px;
    color: var(--ink);
    padding: 3px 0;
}

.col-head {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    padding: 6px 5px;
    text-align: left;
}

.col-head.centre { text-align: center; }

.day-init {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    padding: 5px 0;
}

tr.section-row td {
    font-weight: 700;
    font-size: 10px;
    padding: 4px 6px;
    background: #fff;
    border-left-color: #fff;
    border-right-color: #fff;
}

tr.task-row td.cell-text { padding: 3px 6px; font-size: 10px; }
tr.task-row td.cell-date { padding: 3px 6px; font-size: 10px; text-align: center; }

td.day { height: 15px; }

td.day.weekend-shade { background: #fbfbfb; }

td.day .marker {
    display: block;
    text-align: center;
    font-weight: 700;
    font-size: 10px;
    color: #fff;
    line-height: 15px;
}

/* ---------- editor ---------- */

.editor-bar {
    position: sticky;
    top: 45px;
    z-index: 30;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.editor-bar .spacer { flex: 1; }

.save-state { font-size: 12px; color: var(--muted); }
.save-state.dirty { color: #b26a00; }
.save-state.saved { color: var(--cta); }

.paper-note { font-size: 12px; color: var(--muted); }
.paper-note.warn { color: #b26a00; font-weight: 600; }

.scroller {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow-x: auto;
    padding: 16px;
}

table.editor {
    border-collapse: collapse;
    font-size: 12px;

    /* The print sheet is fixed to the paper width. The editor is not - it sizes
       to its content and scrolls sideways, so the task descriptions stay
       readable however long the job runs. */
    table-layout: auto;
    width: auto;
    min-width: 100%;
}

table.editor td.cell-wide { min-width: 300px; }
table.editor td.cell-company { min-width: 160px; }
table.editor td.cell-date { min-width: 128px; }

table.editor th, table.editor td {
    border: 1px solid var(--grid);
    padding: 0;
}

table.editor .col-head { padding: 5px 6px; font-size: 10px; }

table.editor input[type=text],
table.editor input[type=date],
table.editor input[type=number] {
    border: 0;
    border-radius: 0;
    padding: 4px 6px;
    font-size: 12px;
    background: transparent;
    width: 100%;
}

table.editor input:focus { outline: 2px solid var(--cta); outline-offset: -2px; }

table.editor td.day { width: 17px; min-width: 17px; height: 22px; cursor: default; }

table.editor tr.section-row td { background: #f0f2f4; border-color: var(--grid); }

/* Clear air above each section, and clear space beside the heading, matching
   the printed sheet. */
table.editor tr.section-row td { padding-top: 7px; }

/* Written with tr.section-row so it outranks the section row's own background,
   which is a class deeper. The editor mirrors the printed sheet: clear space
   beside the heading, no boxes. */
table.editor tr.section-row td.section-gap {
    background: #fff;
    border-right: 0;
}

table.editor tr.section-row input {
    font-weight: 700;
    font-size: 12px;
}

.row-tools { display: flex; gap: 3px; padding: 2px 4px; white-space: nowrap; }

.swatch {
    width: 22px;
    height: 22px;
    border: 1px solid var(--line);
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    display: block;
    margin: 2px auto;
}

.wk-toggle {
    display: block;
    margin: 0 auto;
    width: 34px;
    height: 20px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.wk-toggle.on { background: var(--cta); border-color: var(--cta); color: #fff; }

.colour-menu {
    position: absolute;
    z-index: 60;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
    display: grid;
    grid-template-columns: repeat(5, 26px);
    gap: 6px;
}

.colour-menu button {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, .18);
    cursor: pointer;
    padding: 0;
}

/* ---------- lock screen ---------- */

.lock-wrap {
    max-width: 320px;
    margin: 12vh auto 0;
}

/* ---------- print ---------- */

.print-only { display: none; }

@media print {
    .topbar, .editor-bar, .no-print { display: none !important; }
    .print-only { display: block; }
    html, body { background: #fff; }
    .page { padding: 0; }
    .scroller { border: 0; padding: 0; overflow: visible; }

    /* Repeat the week bars, day numbers and column headings on every page. */
    thead { display: table-header-group; }
    tr, td, th { page-break-inside: avoid; }

    table.grid { font-size: 8px; }
    td.day { height: 13px; }
}

@page { margin: 10mm; }

body.paper-A3 { --paper-width: 420mm; }
body.paper-A1 { --paper-width: 841mm; }

/* The contact and handover line that repeats above the grid on every page. */
.repeat-meta {
    background: #fff;
    border-color: #fff;
    text-align: left;
    font-size: 10px;
    font-weight: 400;
    padding: 0 6px 3px 0;
    white-space: nowrap;
}

.repeat-meta .repeat-gap { margin-left: 34px; }

/* The four header wordings print on the sheet, so the caption itself is the
   input. It reads as a caption until you click it. */
/* Written as input[type=text].label-edit so it outranks the generic input
   rule further up, which is more specific than a bare class. */
input[type=text].label-edit {
    display: block;
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 1px 3px;
    margin: 0 0 3px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--muted);
    border-radius: 4px;
}

input[type=text].label-edit:hover { border-color: var(--line); background: #fff; }

input[type=text].label-edit:focus {
    border-color: var(--cta);
    background: #fff;
    color: var(--ink);
    outline: none;
}
