/* /features/site-management/ only: the body of the hero's live instrument (a day on site
   replaying itself, with a timeline to drag; js/pages/site-management.js). The instrument's
   shell (stage, board header, activity footer) is .site-instrument in css/public-site.css. */

.sm-board {
    --sm-green: #146C43;
    --sm-green-bg: #E7F5EC;
    --sm-amber: #8A4B0A;
    --sm-amber-bg: #FFF2DC;
    --sm-blue: #1D4ED8;
    --sm-blue-bg: #E8EEFD;
    --sm-violet-bg: #EFEAFB;
}

/* Header status: on site (the shell's green), before/after work, rain delay, diary submitted */
.sm-board .site-instrument__status.is-idle { background: #F0EEF4; color: var(--site-text-2); }
.sm-board .site-instrument__status.is-delay { background: var(--sm-amber-bg); color: var(--sm-amber); }
.sm-board .site-instrument__status.is-done { background: var(--sm-violet-bg); color: var(--site-accent); }

/* ---------- The day: a timeline to drag ---------- */
.sm-day {
    position: relative;
    height: 52px;
    margin: 0 28px 12px;
    cursor: ew-resize;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.sm-day__track, .sm-day__fill { position: absolute; top: 26px; height: 6px; border-radius: 3px; }
.sm-day__track { left: 0; right: 0; background: var(--site-panel); }
.sm-day__fill { left: 0; width: 0; background: var(--site-accent); }
.sm-day__mark { position: absolute; top: 24px; width: 1px; height: 10px; background: var(--site-line); }
.sm-day__mark span {
    position: absolute;
    top: 13px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--site-font-mono);
    font-size: 10px;
    color: var(--site-subtle);
    white-space: nowrap;
}
.sm-day__handle {
    position: absolute;
    top: 29px;
    left: 0;
    z-index: 2;
    width: 16px;
    height: 16px;
    border: 3px solid var(--site-accent);
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%);
    transition: box-shadow .2s ease;
}
.sm-day:hover .sm-day__handle, .sm-day.is-scrubbing .sm-day__handle { box-shadow: 0 0 0 5px color-mix(in srgb, var(--site-accent) 18%, transparent); }
.sm-day__time {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--site-accent);
    color: #fff;
    font-family: var(--site-font-mono);
    font-size: 11px;
    white-space: nowrap;
    transform: translateX(-50%);
}

/* ---------- Panels ---------- */
.sm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sm-panel {
    height: 196px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--site-line);
    border-radius: 10px;
}
.sm-panel__head {
    flex: none;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--site-text);
    white-space: nowrap;
}
.sm-panel__tag { font-family: var(--site-font-mono); font-size: 10.5px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; color: var(--site-subtle); }

.sm-feed { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.sm-feed__empty { padding: 6px 0; font-size: 12px; font-style: italic; color: var(--site-subtle); }
.sm-row {
    flex: none;
    min-height: 26px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    border-bottom: 1px solid #F0EEF4;
    font-size: 12px;
    color: var(--site-text-2);
}
.sm-row.is-new { animation: sm-row-in .4s cubic-bezier(.34, 1.3, .64, 1) backwards; }
@keyframes sm-row-in { from { opacity: 0; transform: translateY(-6px); } }
.sm-row__main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-row__main small { font-size: 11px; color: var(--site-subtle); }
.sm-row__time, .sm-row__how { flex: none; font-family: var(--site-font-mono); font-size: 10.5px; color: var(--site-subtle); white-space: nowrap; }
.sm-row__how.is-outside { color: var(--sm-amber); }
.sm-avatar {
    flex: none;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--site-panel);
    color: var(--site-accent);
    font-family: var(--site-font-mono);
    font-size: 9.5px;
}
.sm-tag {
    flex: none;
    min-width: 34px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #F0EEF4;
    color: var(--site-text-2);
    font-family: var(--site-font-mono);
    font-size: 9.5px;
    letter-spacing: .06em;
    text-align: center;
    text-transform: uppercase;
}
.sm-tag--in, .sm-tag--closed { background: var(--sm-green-bg); color: var(--sm-green); }
.sm-tag--delay, .sm-tag--open { background: var(--sm-amber-bg); color: var(--sm-amber); }
.sm-tag--assigned { background: var(--sm-blue-bg); color: var(--sm-blue); }
.sm-tag--rectified { background: var(--sm-violet-bg); color: var(--site-accent); }
.sm-row--delay { color: var(--sm-amber); }

/* Diary: the day's weather, filled in from the Bureau of Meteorology */
.sm-weather {
    flex: none;
    margin-bottom: 6px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    background: var(--site-paper);
    font-size: 12.5px;
    color: var(--site-text);
    transition: background-color .4s ease;
}
.sm-weather.is-raining { background: var(--sm-blue-bg); }
.sm-weather__now { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-weather__rain { font-family: var(--site-font-mono); font-size: 11px; color: var(--sm-blue); }
.sm-weather__source { font-family: var(--site-font-mono); font-size: 9.5px; letter-spacing: .06em; color: var(--site-subtle); }

/* Defects: the app's own statuses */
.sm-tiles { flex: none; margin-bottom: 6px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sm-tile { padding: 5px 4px; border-radius: 8px; background: #FAFAFC; text-align: center; }
.sm-tile__num { display: block; font-size: 17px; font-weight: 600; line-height: 1.25; }
.sm-tile__label { display: block; font-family: var(--site-font-mono); font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--site-subtle); }
.sm-tile--open .sm-tile__num { color: var(--sm-amber); }
.sm-tile--assigned .sm-tile__num { color: var(--sm-blue); }
.sm-tile--rectified .sm-tile__num { color: var(--site-accent); }
.sm-tile--closed .sm-tile__num { color: var(--sm-green); }
.sm-tile.is-flash { animation: sm-tile-flash .8s ease; }
@keyframes sm-tile-flash { from { background: var(--site-panel); } }

/* Toolbox talk */
.sm-talk { flex: none; margin-bottom: 6px; padding: 9px 11px; border-radius: 8px; background: var(--site-paper); }
.sm-talk__title { font-size: 13px; font-weight: 600; color: var(--site-text); }
.sm-talk__meta { margin-top: 1px; font-size: 11px; color: var(--site-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-talk__track { height: 6px; margin: 8px 0 5px; overflow: hidden; border-radius: 3px; background: #E4E0EC; }
.sm-talk__fill { width: 0; height: 100%; border-radius: 3px; background: var(--site-accent); transition: width .4s ease; }
.sm-talk__count { font-size: 11.5px; color: var(--site-text-2); }
.sm-talk__count.is-done { color: var(--sm-green); font-weight: 600; }
.sm-past { min-height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid #F0EEF4; font-size: 12px; color: var(--site-text-2); }
.sm-past__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-past__ratio { flex: none; font-family: var(--site-font-mono); font-size: 10.5px; color: var(--sm-green); }

/* ---------- Narrow: sign-ins and the diary, one above the other ---------- */
@media (max-width: 760px) {
    .sm-day { margin: 0 24px 10px; }
    .sm-day__mark.is-minor span { display: none; }
    .sm-grid { grid-template-columns: minmax(0, 1fr); }
    .sm-panel--defects, .sm-panel--talk { display: none; }
}
@media (max-width: 480px) {
    .sm-row__how { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .sm-day__handle, .sm-weather, .sm-talk__fill { transition: none; }
}
