/* ============================================================
   Date & Time calculators - shared presentation
   ============================================================

   Same palette as the rest of the site, taken from
   WebsiteTemplate/assets/css/style.css: #58bae4 accent, #3f89a9
   beneath it, #44475a and #212529 for text, #b6b4b4 borders,
   15px radius. These pages should look like they were always
   here.

   BOTH THEMES. The layout puts theme-light or theme-dark on the
   body from the cookie and style-dark.css repaints the site
   black with #282424 cards, so colours are tokens with a dark
   block rather than fixed values. Without that these would be
   white rectangles on a black page.

   TWO COLUMNS ON DESKTOP, ONE ON MOBILE: inputs left, results
   right, collapsing to a single column where there is not room.
   The result panel is sticky on a tall screen so changing an
   input does not scroll the answer out of view.
   ============================================================ */

:root {
    --dc-accent:        #58bae4;
    --dc-accent-strong: #3f89a9;
    --dc-accent-tint:   #e4e8f6;

    --dc-ink:    #212529;
    --dc-ink-2:  #44475a;
    --dc-ink-3:  #6c757d;

    --dc-surface:   #ffffff;
    --dc-surface-2: #f9f9f9;
    --dc-surface-3: #f3f2f1;

    --dc-border:        #d3d3d4;
    --dc-border-strong: #b6b4b4;

    --dc-ok-bg:   #e8f6ee;  --dc-ok-fg:   #1b6b45;  --dc-ok-bd:   #b7e0c9;
    --dc-warn-bg: #fdf4e3;  --dc-warn-fg: #8a5a12;  --dc-warn-bd: #f0d9a8;
    --dc-bad-bg:  #fbeceb;  --dc-bad-fg:  #98241d;  --dc-bad-bd:  #f0c2be;

    --dc-shadow: 0 10px 29px 0 rgba(68, 88, 144, .10);
}

.theme-dark {
    --dc-accent-tint: #22333c;

    --dc-ink:    #ffffff;
    --dc-ink-2:  #e9e9ea;
    --dc-ink-3:  #b1b1b1;

    --dc-surface:   #282424;
    --dc-surface-2: #1e1c1c;
    --dc-surface-3: #201e1e;

    --dc-border:        #4a4646;
    --dc-border-strong: #6f6a6a;

    --dc-ok-bg:   #14301f;  --dc-ok-fg:   #7ee2a8;  --dc-ok-bd:   #2c6244;
    --dc-warn-bg: #33260f;  --dc-warn-fg: #f5c975;  --dc-warn-bd: #6b4f1c;
    --dc-bad-bg:  #341715;  --dc-bad-fg:  #f5a29b;  --dc-bad-bd:  #6d2f2a;

    --dc-shadow: 0 10px 29px 0 rgba(0, 0, 0, .45);
}

.dc-wrap { max-width: 1100px; margin: 0 auto 28px; }

.dc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

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

.dc-panel {
    background: var(--dc-surface);
    border: 1px solid var(--dc-border-strong);
    border-radius: 15px;
    padding: 22px;
    box-shadow: var(--dc-shadow);
    color: var(--dc-ink);
}

/* Keeps the answer on screen while inputs above it are changed.
   Only where there is vertical room - on a short window a sticky
   panel can pin itself over the controls. */
@media (min-width: 901px) and (min-height: 700px) {
    .dc-results { position: sticky; top: 16px; }
}

/* Inputs -------------------------------------------------- */

.dc-field { margin-bottom: 16px; }

.dc-field label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--dc-ink-2);
    margin-bottom: 6px;
}

.dc-field input[type="date"],
.dc-field input[type="number"],
.dc-field input[type="text"],
.dc-field select {
    width: 100%;
    padding: 11px 13px;
    font-size: 15px;
    color: var(--dc-ink);
    background: var(--dc-surface);
    border: 1px solid var(--dc-border-strong);
    border-radius: 10px;
}

.dc-field input:focus,
.dc-field select:focus {
    outline: 3px solid var(--dc-accent);
    outline-offset: 1px;
    border-color: var(--dc-accent);
}

.dc-hint { font-size: 12.5px; color: var(--dc-ink-3); margin-top: 5px; }

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

.dc-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 14px;
    color: var(--dc-ink-2);
    margin-bottom: 9px;
}

.dc-check input { margin-top: 3px; accent-color: var(--dc-accent); }

/* Buttons -------------------------------------------------- */

.dc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.dc-btn {
    border: 1px solid var(--dc-border-strong);
    background: var(--dc-surface);
    color: var(--dc-ink-2);
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.dc-btn:hover { border-color: var(--dc-accent); color: var(--dc-ink); }

.dc-btn-primary {
    background: var(--dc-accent);
    border-color: var(--dc-accent);
    color: #fff;
}

.dc-btn-primary:hover { background: var(--dc-accent-strong); border-color: var(--dc-accent-strong); }

/* Results -------------------------------------------------- */

.dc-headline {
    text-align: center;
    padding: 22px 16px;
    border: 1px solid var(--dc-accent);
    border-radius: 15px;
    background: var(--dc-accent-tint);
    margin-bottom: 16px;
}

.dc-headline-value {
    font-size: 46px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--dc-ink);
    font-variant-numeric: tabular-nums;
}

.dc-headline-label { font-size: 14px; color: var(--dc-ink-2); margin-top: 4px; }

.dc-breakdown { width: 100%; border-collapse: collapse; }

.dc-breakdown td {
    padding: 10px 4px;
    border-bottom: 1px solid var(--dc-border);
    font-size: 14.5px;
    color: var(--dc-ink-2);
}

.dc-breakdown td:last-child {
    text-align: right;
    font-weight: 700;
    color: var(--dc-ink);
    font-variant-numeric: tabular-nums;
}

.dc-breakdown tr:last-child td { border-bottom: 0; }

/* The line that shows the arithmetic. The brief asks for the
   calculation to be transparent, and a number nobody can check is
   a number nobody trusts. */
.dc-working {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--dc-surface-3);
    border-radius: 10px;
    font-size: 13.5px;
    color: var(--dc-ink-2);
    line-height: 1.6;
}

.dc-holidays { margin-top: 14px; }

.dc-holidays h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--dc-ink-3);
    margin: 0 0 8px;
}

.dc-holidays li {
    font-size: 13.5px;
    color: var(--dc-ink-2);
    padding: 4px 0;
    list-style: none;
}

.dc-holidays .dc-shifted { color: var(--dc-ink-3); font-size: 12.5px; }

/* Messages. Never colour alone - each carries an icon character
   and a word, because a red border says nothing to somebody who
   cannot distinguish it from the green one. */
.dc-message {
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}

.dc-message-error { background: var(--dc-bad-bg);  color: var(--dc-bad-fg);  border-color: var(--dc-bad-bd); }
.dc-message-note  { background: var(--dc-warn-bg); color: var(--dc-warn-fg); border-color: var(--dc-warn-bd); }
.dc-message-info  { background: var(--dc-surface-3); color: var(--dc-ink-2); border-color: var(--dc-border); }

/* Cross-links between the six tools. */
.dc-siblings {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0 4px;
}

.dc-siblings a {
    display: inline-block;
    padding: 9px 15px;
    border: 1px solid var(--dc-border-strong);
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--dc-ink-2);
    text-decoration: none;
    background: var(--dc-surface);
}

.dc-siblings a:hover { border-color: var(--dc-accent); color: var(--dc-ink); }
.dc-siblings a[aria-current="page"] { background: var(--dc-accent); border-color: var(--dc-accent); color: #fff; }

@media (max-width: 575px) {
    .dc-panel { padding: 16px; }
    .dc-headline-value { font-size: 38px; }
}

/* A label that is read aloud but not shown - the <summary> above the
   field already names it visually, and a second visible label would
   be noise. */
.visually-hidden-label {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

details.dc-field > summary { list-style: revert; padding: 4px 0; }
details.dc-field > summary:focus-visible { outline: 3px solid var(--dc-accent); outline-offset: 2px; }

/* ============================================================
   Meeting Time Planner grid
   ============================================================

   COLOUR IS NEVER THE ONLY SIGNAL. Each cell shows its local hour
   as a number and carries a title with the full local date and
   time, so the grid is readable without distinguishing the three
   bands - and the legend names them in words.

   The table scrolls inside its own container rather than widening
   the page: 24 columns will not fit a phone, and a horizontally
   scrolling body breaks every other layout on the page.
   ============================================================ */

:root {
    --mt-work-bg: #d9f0e3;  --mt-work-fg: #14532d;
    --mt-edge-bg: #fbf0d5;  --mt-edge-fg: #7a4e0c;
    --mt-off-bg:  #efeeee;  --mt-off-fg:  #6c757d;
}

.theme-dark {
    --mt-work-bg: #17402a;  --mt-work-fg: #9ceabc;
    --mt-edge-bg: #3d2d12;  --mt-edge-fg: #f5cd82;
    --mt-off-bg:  #2a2727;  --mt-off-fg:  #8d8a8a;
}

.mt-scroll { overflow-x: auto; border-radius: 12px; }

.mt-grid {
    border-collapse: separate;
    border-spacing: 2px;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    min-width: 100%;
}

.mt-grid th {
    font-weight: 600;
    color: var(--dc-ink-2);
    padding: 6px 4px;
    text-align: center;
    white-space: nowrap;
}

/* The place name column stays put while the hours scroll under it -
   a row of times is meaningless once you cannot see whose it is. */
.mt-grid tbody th[scope="row"] {
    position: sticky;
    left: 0;
    z-index: 1;
    text-align: left;
    padding-right: 12px;
    background: var(--dc-surface);
}

.mt-grid td {
    padding: 7px 6px;
    text-align: center;
    border-radius: 6px;
    min-width: 34px;
}

.mt-work { background: var(--mt-work-bg); color: var(--mt-work-fg); font-weight: 600; }
.mt-edge { background: var(--mt-edge-bg); color: var(--mt-edge-fg); }
.mt-off  { background: var(--mt-off-bg);  color: var(--mt-off-fg); }

.mt-col-good { color: var(--dc-accent-strong); }
.mt-col-good::after { content: " *"; }

.mt-zones { list-style: none; padding: 0; margin: 14px 0 6px; display: flex; flex-wrap: wrap; gap: 8px; }

.mt-zone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px 7px 13px;
    border: 1px solid var(--dc-border-strong);
    border-radius: 999px;
    font-size: 13.5px;
    color: var(--dc-ink-2);
    background: var(--dc-surface);
}

.mt-ref {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--dc-accent-strong);
}

.mt-remove {
    border: 0;
    background: transparent;
    color: var(--dc-ink-3);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.mt-remove:hover { color: var(--dc-bad-fg); }

.mt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--dc-ink-2);
}

.mt-swatch {
    display: inline-block;
    width: 13px; height: 13px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: -2px;
}
