/*
 * Atelier Mécanique du Centre, workshop planning.
 *
 * Written phone first. The rules below the tokens are the phone layout: one
 * bay column at a time, one panel column, cards instead of tables, and
 * nothing smaller than a finger or a readable line. Every min-width query
 * further down only adds room; none of them is needed for the page to work.
 *
 * Two invariants hold at every width:
 *   1. no fixed pixel width above 400px, anywhere;
 *   2. every interactive element is at least 44px in both axes.
 */

:root {
    --navy: #04285B;
    --blue: #0560E3;
    --cyan: #4ECCEC;
    --green: #23E294;
    --amber: #8A5200;
    --red: #B3261E;

    --ink: #04285B;
    --ink-70: rgba(4, 40, 91, 0.74);
    --ink-55: rgba(4, 40, 91, 0.62);
    --line: rgba(4, 40, 91, 0.13);
    --line-soft: rgba(4, 40, 91, 0.07);
    --panel-solid: #ffffff;
    --soft: #F5F9FF;

    /* Pixels per minute. It carries its unit so that calc(minutes * --pxpm)
       resolves to a length. On a phone one bay is on screen at a time, so the
       scale can be generous enough for a 14px line to fit inside a forty
       minute block. */
    --pxpm: 1.8px;
    --span: 570;
    --radius: 16px;

    --tap: 44px;
    --fs-1: 14px;
    --fs-2: 15px;
    --fs-3: 16px;
    --fs-4: 18px;
    --gut: 12px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* A control that sets its own display would otherwise outrank the hidden
   attribute and stay on screen while the code believes it is gone. */
[hidden] { display: none !important; }

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

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    font-size: var(--fs-3);
    background: linear-gradient(160deg, #ffffff 0%, #EFF6FF 42%, #ffffff 100%);
    background-attachment: fixed;
    line-height: 1.5;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(60vw 44vw at 8% -6%, rgba(78, 204, 236, 0.28), transparent 62%),
        radial-gradient(56vw 40vw at 100% 20%, rgba(5, 96, 227, 0.18), transparent 62%),
        radial-gradient(50vw 36vw at 26% 96%, rgba(35, 226, 148, 0.16), transparent 62%);
}

a { color: var(--blue); }

:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
    border-radius: 8px;
}

.skip {
    position: absolute;
    left: -9999px;
    top: 0;
    background: #fff;
    padding: 12px 18px;
    z-index: 100;
    border-radius: 0 0 12px 0;
    font-weight: 700;
    min-height: var(--tap);
    display: inline-flex;
    align-items: center;
}
.skip:focus { left: 0; }

.sr {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- workshop header ---------- */

.site-head {
    position: relative;
    z-index: 30;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 32px rgba(4, 40, 91, 0.07);
}

.head-in {
    max-width: 1420px;
    margin: 0 auto;
    padding: 8px var(--gut);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.shop {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: var(--tap);
    text-decoration: none;
    color: var(--ink);
}
.shop-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--blue), var(--green));
    box-shadow: 0 6px 16px rgba(5, 96, 227, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    color: #fff;
    font-weight: 900;
    font-size: var(--fs-1);
    display: grid;
    place-items: center;
}
.shop-name {
    font-weight: 900;
    font-size: var(--fs-2);
    letter-spacing: -0.02em;
    line-height: 1.15;
    min-width: 0;
}
.shop-name small {
    display: block;
    font-weight: 600;
    font-size: var(--fs-1);
    color: var(--ink-55);
}

.langs { display: inline-flex; gap: 4px; align-items: center; flex: 0 0 auto; }
.langs a {
    min-height: var(--tap);
    min-width: var(--tap);
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-1);
    font-weight: 800;
    border-radius: 12px;
    text-decoration: none;
    color: var(--ink-70);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.7);
}
.langs a[aria-current="true"] { color: #fff; background: var(--navy); border-color: var(--navy); }

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

.wrap {
    position: relative;
    z-index: 10;
    max-width: 1420px;
    margin: 0 auto;
    padding: 16px var(--gut) 44px;
}

.glass {
    background: rgba(255, 255, 255, 0.66);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 18px 50px rgba(4, 40, 91, 0.09);
    border-radius: 20px;
}

.hero { padding: 18px 16px 16px; margin-bottom: 14px; }

h1 {
    margin: 0 0 8px;
    font-size: clamp(25px, 6.6vw, 42px);
    line-height: 1.1;
    letter-spacing: -0.028em;
    font-weight: 900;
    max-width: 22ch;
}
h1 .grad {
    background: linear-gradient(100deg, var(--blue), var(--cyan) 48%, var(--green));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lede {
    margin: 0;
    max-width: 76ch;
    font-size: var(--fs-2);
    color: var(--ink-70);
    font-weight: 500;
}

.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.facts li {
    font-size: var(--fs-1);
    font-weight: 700;
    color: var(--ink-70);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 14px;
}

/* ---------- tabs ----------
   They wrap. A rail that scrolls sideways hides its own last item, and the
   thumb has no way to know the item is there. */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.66);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 18px;
}
.tabs button {
    flex: 1 1 auto;
    font: inherit;
    font-size: var(--fs-1);
    font-weight: 800;
    color: var(--ink-70);
    background: transparent;
    border: 0;
    min-height: var(--tap);
    padding: 8px 14px;
    border-radius: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.tabs button:hover { background: rgba(5, 96, 227, 0.08); }
.tabs button[aria-selected="true"] {
    color: #fff;
    background: linear-gradient(100deg, var(--blue), var(--cyan));
    box-shadow: 0 6px 18px rgba(5, 96, 227, 0.3);
}

.panel { display: none; }
.panel.on { display: block; }

/* ---------- app surface ---------- */

.surface {
    background: var(--panel-solid);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 34px rgba(4, 40, 91, 0.07);
    overflow: hidden;
}

.bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px var(--gut);
    border-bottom: 1px solid var(--line);
}
/* A toolbar on a phone is a stack of full width rows, not a row that
   silently pushes its last control off the edge. */
.bar.stack { display: grid; gap: 8px; align-items: stretch; }
.daynav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.daynav .btn { padding: 8px 6px; }

#dragHint { padding: 0 var(--gut) 14px; margin: 0; }
#sheetNote { padding: 0 var(--gut) 16px; margin: 0; }
#breakIntro { padding: 12px var(--gut) 0; margin: 0; font-size: var(--fs-1); color: var(--ink-70); font-weight: 500; }
.selfbox h3 { margin: 0 0 6px; font-size: var(--fs-3); font-weight: 900; }
.selfbox p { margin: 0 0 12px; font-size: var(--fs-1); color: var(--ink-70); max-width: 92ch; font-weight: 500; }

.btn {
    font: inherit;
    font-size: var(--fs-1);
    font-weight: 700;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    min-height: var(--tap);
    padding: 8px 14px;
    cursor: pointer;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}
.btn:hover { background: var(--soft); border-color: rgba(5, 96, 227, 0.4); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(100deg, var(--blue), var(--cyan));
    box-shadow: 0 6px 18px rgba(5, 96, 227, 0.28);
}
.btn.primary:hover { filter: brightness(1.05); background: linear-gradient(100deg, var(--blue), var(--cyan)); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: rgba(179, 38, 30, 0.35); }
.btn.danger:hover { background: rgba(179, 38, 30, 0.07); }
.btn.small { font-size: var(--fs-1); padding: 6px 12px; }
.btn.grow { flex: 1 1 auto; }

.spacer { flex: 1 1 auto; }

.daylabel { font-weight: 900; font-size: var(--fs-2); letter-spacing: -0.01em; }
.daymeta { font-size: var(--fs-1); color: var(--ink-55); font-weight: 600; }

input, select, textarea {
    font: inherit;
    /* 16px keeps iOS Safari from zooming the page on focus. */
    font-size: var(--fs-3);
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    min-height: var(--tap);
    padding: 8px 12px;
    width: 100%;
    max-width: 100%;
}
select { cursor: pointer; }
label { font-size: var(--fs-1); font-weight: 800; color: var(--ink-70); display: block; margin-bottom: 4px; }

/* ---------- bay switcher, phone only ----------
   One bay is on screen at a time, and the switcher says which and how busy
   the others are. Nothing is hidden: the other bays are one tap away and the
   count is on the tab. */

.bayswitch {
    display: flex;
    gap: 6px;
    padding: 10px var(--gut);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.bayswitch button {
    flex: 1 1 90px;
    font: inherit;
    font-size: var(--fs-1);
    font-weight: 800;
    min-height: var(--tap);
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink-70);
    cursor: pointer;
    line-height: 1.2;
}
.bayswitch button small { display: block; font-weight: 600; font-size: var(--fs-1); color: var(--ink-55); }
.bayswitch button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.bayswitch button[aria-pressed="true"] small { color: rgba(255, 255, 255, 0.82); }

/* ---------- calendar ---------- */

.calwrap { padding: 0 0 6px; }

.cal {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
}

.cal-h {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 9px 8px;
    font-size: var(--fs-1);
    font-weight: 900;
    text-align: center;
}
.cal-h small { display: block; font-weight: 600; color: var(--ink-55); font-size: var(--fs-1); }
.cal-h.axis { text-align: start; }

.axiscell {
    position: relative;
    height: calc(var(--span) * var(--pxpm));
    border-right: 1px solid var(--line);
}
.axiscell span {
    position: absolute;
    right: 5px;
    transform: translateY(-50%);
    white-space: nowrap;
    font-size: var(--fs-1);
    font-variant-numeric: tabular-nums;
    color: var(--ink-55);
    font-weight: 700;
}
/* The opening hour sits on the very first pixel of the column, so centring it
   on the line would push half of it under the sticky bay header. */
.axiscell span:first-child { transform: translateY(0); }

.col {
    position: relative;
    height: calc(var(--span) * var(--pxpm));
    border-right: 1px solid var(--line-soft);
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(4, 40, 91, 0.09) 0,
        rgba(4, 40, 91, 0.09) 1px,
        transparent 1px,
        transparent calc(60 * var(--pxpm))
    );
}
.col:last-child { border-right: 0; }
.col.dropping { background-color: rgba(5, 96, 227, 0.05); }

.shade {
    position: absolute;
    left: 0;
    right: 0;
    background: repeating-linear-gradient(135deg, rgba(4, 40, 91, 0.06) 0 6px, rgba(4, 40, 91, 0.02) 6px 12px);
    border-top: 1px dashed rgba(4, 40, 91, 0.18);
    border-bottom: 1px dashed rgba(4, 40, 91, 0.18);
    z-index: 0;
    pointer-events: none;
}
.shade span {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: var(--fs-1);
    font-weight: 800;
    color: var(--ink-55);
}

.appt {
    position: absolute;
    left: 4px;
    right: 4px;
    z-index: 2;
    border-radius: 10px;
    border: 1px solid rgba(4, 40, 91, 0.16);
    background: #EAF2FE;
    padding: 5px 8px 5px 28px;
    overflow: hidden;
    cursor: pointer;
    touch-action: pan-y;
    box-shadow: 0 2px 8px rgba(4, 40, 91, 0.1);
}
/* The coloured edge is also the drag handle. On a touch screen only this
   strip starts a drag, so the rest of the block still scrolls the page. */
.grip {
    position: absolute;
    inset: 0 auto 0 0;
    width: 22px;
    border-radius: 10px 0 0 10px;
    background: var(--sc, #0560E3);
    cursor: grab;
    touch-action: none;
}
.grip::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 58%;
    max-height: 28px;
    min-height: 10px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.85);
}
.grip:active { cursor: grabbing; }
.appt.dragging .grip { cursor: grabbing; }

.appt .t {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: var(--fs-1);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1.25;
    white-space: nowrap;
}
.appt .t b { font-weight: 700; color: var(--ink-55); overflow: hidden; text-overflow: ellipsis; }
.appt .n {
    font-size: var(--fs-1);
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.appt .m { font-size: var(--fs-1); color: var(--ink-55); font-weight: 600; line-height: 1.25; }
.appt.picked { outline: 3px solid var(--blue); outline-offset: 1px; z-index: 9; }
.appt.dim { opacity: 0.32; }
.appt.flash-bad { animation: shake 0.36s ease; border-color: var(--red); }
.appt.flash-ok { animation: pop 0.4s ease; }
.appt.blocking { outline: 3px solid var(--red); outline-offset: 1px; z-index: 8; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    45% { transform: translateX(5px); }
    70% { transform: translateX(-3px); }
}
@keyframes pop {
    0% { transform: scale(0.96); }
    55% { transform: scale(1.02); }
    100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* The bay is still held after the job, for the clean up. The band is the
   geometry of that; the minutes are written in the block above it, in the
   legend under the calendar and in the rules tab. */
.buf {
    position: absolute;
    left: 4px;
    right: 4px;
    z-index: 1;
    border-radius: 0 0 10px 10px;
    background: repeating-linear-gradient(135deg, rgba(4, 40, 91, 0.13) 0 5px, rgba(4, 40, 91, 0.04) 5px 10px);
    border: 1px dashed rgba(4, 40, 91, 0.2);
    border-top: 0;
    pointer-events: none;
    overflow: hidden;
}
.buf span {
    display: block;
    padding: 3px 8px;
    font-size: var(--fs-1);
    font-weight: 700;
    color: var(--ink-55);
    white-space: nowrap;
}

.ghost {
    position: absolute;
    left: 4px;
    right: 4px;
    z-index: 10;
    border-radius: 10px;
    border: 2px dashed var(--blue);
    background: rgba(5, 96, 227, 0.14);
    pointer-events: none;
    padding: 5px 8px;
    font-size: var(--fs-1);
    font-weight: 800;
    color: var(--navy);
    overflow: hidden;
}
.ghost.bad { border-color: var(--red); background: rgba(179, 38, 30, 0.14); color: #7F1D1D; }
.ghost .why { display: block; font-weight: 600; font-size: var(--fs-1); line-height: 1.25; margin-top: 2px; }

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 12px var(--gut);
    border-top: 1px solid var(--line);
    font-size: var(--fs-1);
    color: var(--ink-55);
    font-weight: 600;
    align-items: center;
}
.legend .k { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(4, 40, 91, 0.2); display: inline-block; flex: 0 0 auto; }
.legend .sw.buf { position: static; background: repeating-linear-gradient(135deg, rgba(4, 40, 91, 0.24) 0 4px, rgba(4, 40, 91, 0.06) 4px 8px); }
.legend .sw.closed { background: repeating-linear-gradient(135deg, rgba(4, 40, 91, 0.14) 0 4px, rgba(4, 40, 91, 0.03) 4px 8px); }

/* ---------- side rail ---------- */

.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.rail { display: grid; gap: 14px; min-width: 0; }

.card { padding: var(--gut); }
.card h3 { margin: 0 0 4px; font-size: var(--fs-3); font-weight: 900; letter-spacing: -0.01em; }
.card p.hint { margin: 0 0 10px; font-size: var(--fs-1); color: var(--ink-55); font-weight: 500; }

.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.log li {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: var(--fs-1);
    background: #fff;
}
.log li.bad { border-color: rgba(179, 38, 30, 0.34); background: rgba(179, 38, 30, 0.045); }
.log li.good { border-color: rgba(35, 226, 148, 0.5); background: rgba(35, 226, 148, 0.07); }
.log .head { display: flex; align-items: center; gap: 8px; font-weight: 900; margin-bottom: 3px; flex-wrap: wrap; }
.log .body { color: var(--ink-70); font-weight: 500; }
.log ul { margin: 6px 0 0; padding-inline-start: 18px; }
.log ul li { border: 0; background: none; padding: 2px 0; font-size: var(--fs-1); }

/* Small print is still print. These are the labels that used to be written
   at eleven and a half pixels inline; they now sit on the same floor as
   everything else. */
.mini { font-size: var(--fs-1); font-weight: 800; }
.muted, .mini.muted { color: var(--ink-55); font-weight: 700; }
.freedtag { margin-top: 6px; font-size: var(--fs-1); font-weight: 800; color: #7A5C00; }
.outhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badline { margin-top: 8px; color: var(--red); font-weight: 700; }
.cascade-box { margin-top: 10px; }
.cascade-do { margin-top: 8px; }
.closedline { padding: 16px var(--gut); margin: 0; font-size: var(--fs-1); }
.empty { margin: 0; }

.tag {
    display: inline-flex;
    align-items: center;
    font-size: var(--fs-1);
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 999px;
}
.tag.bad { background: rgba(179, 38, 30, 0.12); color: #8E1D17; }
.tag.good { background: rgba(6, 118, 71, 0.12); color: #056B41; }
.tag.info { background: rgba(5, 96, 227, 0.1); color: var(--blue); }

.slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.slot {
    font: inherit;
    font-size: var(--fs-1);
    font-weight: 800;
    border: 1px solid rgba(5, 96, 227, 0.4);
    background: rgba(5, 96, 227, 0.07);
    color: var(--navy);
    border-radius: 12px;
    min-height: var(--tap);
    padding: 7px 12px;
    cursor: pointer;
    text-align: start;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    flex: 1 1 150px;
}
.slot:hover { background: rgba(5, 96, 227, 0.16); }
.slot small { display: block; font-weight: 600; color: var(--ink-55); font-size: var(--fs-1); }

.wait { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wait li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: var(--fs-1); }
.wait li.freed { border-color: rgba(241, 188, 0, 0.6); background: rgba(241, 188, 0, 0.09); }
.wait .who { font-weight: 900; }
.wait .what { color: var(--ink-70); font-weight: 600; }
.wait .row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.wait .row .btn { flex: 1 1 auto; }

/* ---------- tables ----------
   Card list first. A six column table on a 360px screen shows three of its
   columns and hides the rest behind a sideways scroll with no affordance,
   which is how the row action of this very demo used to be invisible. */

.tablewrap { min-width: 0; }

table { width: 100%; border-collapse: collapse; font-size: var(--fs-1); display: block; }
caption {
    display: block;
    text-align: start;
    font-weight: 900;
    padding: 14px var(--gut) 8px;
    font-size: var(--fs-3);
}
thead { display: none; }
tbody { display: block; }
tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    padding: 4px 12px;
    margin: 0 var(--gut) 10px;
}
tbody td {
    display: grid;
    grid-template-columns: minmax(0, 11ch) minmax(0, 1fr);
    gap: 4px 12px;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: var(--fs-1);
    text-align: start;
}
tbody td:last-child { border-bottom: 0; }
tbody td::before {
    content: attr(data-label);
    grid-column: 1;
    grid-row: 1;
    font-size: var(--fs-1);
    font-weight: 800;
    color: var(--ink-55);
}
/* A cell can hold more than one element, and without this the second one
   would land under the label instead of beside the first. */
tbody td > * { grid-column: 2; }
tbody td:empty { display: none; }
td.num { font-variant-numeric: tabular-nums; }
td .sub { display: block; font-size: var(--fs-1); color: var(--ink-55); font-weight: 600; }
td .dot { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-inline-end: 8px; vertical-align: baseline; }
tr.free td { color: var(--ink-55); background: transparent; }
tr.free { background: rgba(4, 40, 91, 0.02); }

/* ---------- week ---------- */

.weekgrid { display: grid; grid-template-columns: 1fr; gap: 10px; padding: var(--gut); }

.weekday { border: 1px solid var(--line); border-radius: 13px; padding: 11px; background: #fff; min-height: 110px; min-width: 0; }
.weekday h4 { margin: 0 0 8px; font-size: var(--fs-1); font-weight: 900; }
.weekday h4 small { display: block; font-size: var(--fs-1); font-weight: 600; color: var(--ink-55); }
.weekday.closed { background: repeating-linear-gradient(135deg, rgba(4, 40, 91, 0.04) 0 6px, transparent 6px 12px); }
.wk { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wk li {
    font-size: var(--fs-1);
    border: 1px solid var(--line);
    border-inline-start: 4px solid var(--blue);
    border-radius: 8px;
    padding: 7px 9px;
    background: #FAFCFF;
}
.wk li b { font-variant-numeric: tabular-nums; }
.wk li span { display: block; color: var(--ink-55); font-weight: 600; }
.wk .empty { color: var(--ink-55); font-size: var(--fs-1); font-weight: 600; }
.wkload { font-size: var(--fs-1); font-weight: 800; color: var(--ink-55); margin-top: 8px; }

/* ---------- try to break it ---------- */

.attempts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; padding: var(--gut); }
.att { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.att h4 { margin: 0; font-size: var(--fs-2); font-weight: 900; line-height: 1.3; }
.att p { margin: 0; font-size: var(--fs-1); color: var(--ink-70); font-weight: 500; }
.att .out { font-size: var(--fs-1); border-top: 1px solid var(--line-soft); padding-top: 9px; margin-top: auto; }
.att .out ul { margin: 6px 0 0; padding-inline-start: 18px; color: var(--ink-70); }
.att .out li { margin-bottom: 3px; }

.selfbox { padding: var(--gut); border-top: 1px solid var(--line); }
.selfout { margin-top: 10px; font-size: var(--fs-1); font-weight: 700; }
.selfout .m { display: block; font-weight: 600; color: var(--ink-55); font-size: var(--fs-1); margin-top: 4px; }

/* ---------- rules ---------- */

.rules { padding: var(--gut) 0; display: grid; gap: 18px; }
.rules > div { padding: 0 var(--gut); }
.rules > div.tablewrap { padding: 0; }
.rules h3 { margin: 0 0 8px; font-size: var(--fs-4); font-weight: 900; }
.rules p { margin: 0 0 10px; font-size: var(--fs-1); color: var(--ink-70); max-width: 86ch; }
.rules ol { margin: 0; padding-inline-start: 22px; font-size: var(--fs-1); color: var(--ink-70); }
.rules ol li { margin-bottom: 5px; }
.rules .note {
    font-size: var(--fs-1);
    color: var(--ink-70);
    background: rgba(241, 188, 0, 0.1);
    border: 1px solid rgba(241, 188, 0, 0.42);
    border-radius: 13px;
    padding: 12px 14px;
    max-width: 92ch;
    margin: 0 var(--gut);
}

/* ---------- dialog ----------
   A bottom sheet on a phone, a centred card when there is room. */

dialog {
    border: 0;
    padding: 0;
    color: var(--ink);
    background: #fff;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0 0 auto;
    position: fixed;
    inset: auto 0 0 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -20px 60px rgba(4, 40, 91, 0.28);
    max-block-size: 92dvh;
    display: none;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(4, 40, 91, 0.45); backdrop-filter: blur(3px); }
#dlgForm { display: flex; flex-direction: column; min-height: 0; }
.dlg-h { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.dlg-h h2 { margin: 0; font-size: var(--fs-4); font-weight: 900; flex: 1; letter-spacing: -0.015em; }
.dlg-b { padding: 14px 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.dlg-f {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}
.dlg-f .btn { flex: 1 1 140px; }
.fields { display: grid; grid-template-columns: 1fr; gap: 12px; }
.fields .wide { grid-column: 1 / -1; }
.iconbtn {
    min-width: var(--tap);
    min-height: var(--tap);
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    font-size: var(--fs-4);
    font-weight: 800;
    cursor: pointer;
    color: var(--ink-70);
    flex: 0 0 auto;
}

.verdict { margin-top: 14px; border-radius: 14px; padding: 12px; font-size: var(--fs-1); }
.verdict.bad { border: 1px solid rgba(179, 38, 30, 0.4); background: rgba(179, 38, 30, 0.05); }
.verdict.good { border: 1px solid rgba(35, 226, 148, 0.55); background: rgba(35, 226, 148, 0.08); }
.verdict h3 { margin: 0 0 6px; font-size: var(--fs-2); font-weight: 900; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.verdict p { margin: 0 0 6px; color: var(--ink-70); }
.verdict ul { margin: 6px 0 0; padding-inline-start: 20px; }
.verdict li { margin-bottom: 4px; }
.verdict .sub { font-weight: 900; font-size: var(--fs-1); margin: 12px 0 2px; }

/* ---------- footer ---------- */

footer.foot { margin-top: 20px; padding: 18px 18px 20px; font-size: var(--fs-1); color: var(--ink-70); }
footer.foot p { margin: 0 0 10px; max-width: 92ch; }
footer.foot p:last-child { margin-bottom: 0; }
footer.foot .made { color: var(--ink-55); }
footer.foot .made a { font-weight: 700; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 2px; }

.printhead { display: none; }

/* ================================================================
   Wider screens only add room.
   ================================================================ */

@media (min-width: 560px) {
    :root { --gut: 16px; }
    .fields { grid-template-columns: 1fr 1fr; }
    .dlg-f .btn { flex: 0 1 auto; }
}

@media (min-width: 720px) {
    :root {
        /* Three bays fit side by side now, so the timeline can be denser
           without pushing any line below the readable floor. */
        --pxpm: 1.4px;
        --gut: 18px;
    }
    .wrap { padding: 22px var(--gut) 52px; }
    .hero { padding: 26px 24px 22px; border-radius: 24px; }

    .bayswitch { display: none; }
    .cal { grid-template-columns: 52px repeat(3, minmax(0, 1fr)); }
    .calwrap { padding-bottom: 8px; }

    .weekgrid { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
    .bar.stack { display: flex; align-items: center; }
    .bar.stack > div:not(.daynav) { min-width: 0; }
    .daynav { display: flex; gap: 8px; }
    .bar.stack input[type="date"],
    .bar.stack select { width: auto; min-width: 190px; }
    .bar.stack .btn.primary { margin-inline-start: auto; }
    #printBtn, #runAll { margin-inline-start: auto; }

    /* There is room for a real table now. */
    table { display: table; }
    caption { display: table-caption; }
    thead { display: table-header-group; }
    tbody { display: table-row-group; }
    tbody tr { display: table-row; border: 0; border-radius: 0; padding: 0; margin: 0; background: transparent; }
    thead th {
        display: table-cell;
        text-align: start;
        padding: 10px 12px;
        font-size: var(--fs-1);
        font-weight: 900;
        color: var(--ink-70);
        border-bottom: 1px solid var(--line);
        background: var(--soft);
        position: sticky;
        top: 0;
    }
    tbody td {
        display: table-cell;
        padding: 10px 12px;
        border-bottom: 1px solid var(--line-soft);
        vertical-align: top;
        text-align: start;
    }
    tbody td::before { content: none; }
    tbody td:empty { display: table-cell; }
    td.num, th.num { white-space: nowrap; }
    tr.free td { font-style: italic; }
    .rules > div { padding: 0 var(--gut); }
    .rules .note { margin: 0 var(--gut); }
}

@media (min-width: 1080px) {
    .split { grid-template-columns: minmax(0, 1fr) 340px; }
    .log { max-height: 460px; overflow-y: auto; }
    dialog {
        position: fixed;
        inset: 0;
        margin: auto;
        width: min(560px, calc(100% - 32px));
        max-block-size: min(86dvh, 760px);
        border-radius: 22px;
        box-shadow: 0 30px 80px rgba(4, 40, 91, 0.28);
    }
}

/* ---------- print: the day sheet only ---------- */

@media print {
    body { background: #fff; }
    body::before { display: none; }
    .site-head, .tabs, .hero, .rail, footer.foot, .noprint, .skip, .bayswitch { display: none !important; }
    .wrap { padding: 0; max-width: none; }
    .panel { display: none !important; }
    .panel.printable { display: block !important; }
    .surface, .glass { box-shadow: none; border: 0; border-radius: 0; background: #fff; }
    .split { display: block; }
    table { display: table; font-size: 11pt; page-break-inside: auto; }
    caption { display: table-caption; padding: 10px 0 4px; }
    thead { display: table-header-group; }
    thead th { display: table-cell; background: #fff; border-bottom: 1px solid #000; position: static; text-align: start; padding: 5px 8px; }
    tbody { display: table-row-group; }
    tbody tr { display: table-row; margin: 0; padding: 0; border: 0; }
    tbody td { display: table-cell; padding: 5px 8px; border-bottom: 1px solid #ccc; }
    tbody td::before { content: none; }
    tr { page-break-inside: avoid; }
    .sheetbay { page-break-inside: avoid; margin-bottom: 14px; }
    .printhead { display: block !important; margin-bottom: 12px; }
    .printhead h2 { margin: 0 0 3px; font-size: 15pt; }
    .printhead p { margin: 0; font-size: 9pt; color: #444; }
    tr.free td { font-style: italic; color: #666; }
}
