/**
 * timeclock.css — what the Timeclock app needs on top of the Sight kit.
 *
 * The kit supplies the top bar, cards, tables, buttons, fields and badges; the
 * tenant colour arrives as --sight-primary. This adds the section tabs, the
 * Today board, and the phone layout. No box here has half its borders: every
 * panel is drawn on all four edges or none, and rules between blocks are rules.
 */

body { padding-bottom: env(safe-area-inset-bottom); font-variant-numeric: tabular-nums; }
::selection { background: var(--sight-primary-soft); color: var(--s-ink); }

.tc-loading { display: flex; align-items: center; gap: 10px; padding: 60px 0; color: var(--s-muted); justify-content: center; }

/* ── Section tabs (LoadCon's underline tabs) ─────────────────────────────── */
.tc-tabs {
  display: flex; gap: 4px;
  max-width: 1240px; margin: 0 auto; padding: 8px 18px 0;
  border-bottom: 1px solid var(--s-line);
}
.tc-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-size: 13.5px; font-weight: 600; color: var(--s-muted); text-decoration: none;
}
.tc-tab svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tc-tab:hover { color: var(--s-ink); }
.tc-tab.is-active { color: var(--sight-primary); border-bottom-color: var(--sight-primary); }
.tc-tab:focus-visible { outline: 2px solid var(--sight-primary); outline-offset: -2px; border-radius: 6px; }

.tc-page { padding-top: 22px; }

.tc-foot {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 8px 16px 40px; font-size: 11.5px; color: var(--s-faint);
}
.tc-foot img { height: 40px; width: auto; opacity: .8; }

/* ── Page furniture ──────────────────────────────────────────────────────── */
.tc-sub-strong { color: var(--s-ink); font-weight: 600; }
.tc-late { color: var(--s-danger); font-weight: 600; }
.tc-grid-2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); margin-top: 16px; }
.tc-stack { display: flex; flex-direction: column; gap: 16px; }
.s-card + .s-card { margin-top: 16px; }
.tc-grid-2 .s-card + .s-card, .tc-metrics .s-card + .s-card { margin-top: 0; }
.s-card-head p { margin: 0; color: var(--s-muted); font-size: 12.5px; }
.s-card-head .s-spacer { flex: 1; }

.tc-metrics { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.tc-metric { padding: 14px 16px; }
.tc-metric-label { font-size: 12px; font-weight: 600; color: var(--s-muted); }
.tc-metric-value { font-size: 26px; font-weight: 700; color: var(--s-ink); letter-spacing: -.02em; line-height: 1.25; margin-top: 2px; }
.tc-metric-value.is-bad { color: var(--s-danger); }
.tc-metric-value.is-ok { color: var(--s-ok); }
.tc-metric-note { font-size: 12px; color: var(--s-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tc-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.tc-toolbar .s-field { margin: 0; min-width: 150px; }
.tc-check { display: flex; align-items: center; gap: 8px; height: 38px; font-size: 13px; color: var(--s-text); }
.tc-check input { width: 17px; height: 17px; accent-color: var(--sight-primary); }

.tc-seg { display: inline-flex; border: 1px solid var(--s-line); border-radius: var(--s-radius-sm); overflow: hidden; background: var(--s-surface); }
.tc-seg button {
  height: 36px; padding: 0 13px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 560; color: var(--s-text); white-space: nowrap;
}
.tc-seg button + button { box-shadow: -1px 0 0 var(--s-line); }
.tc-seg button:hover { background: var(--s-line-soft); }
.tc-seg button[aria-pressed='true'] { background: var(--sight-primary); color: #fff; }

.tc-form { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.tc-form .s-btn { margin-bottom: 14px; }
.tc-callout {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; margin-bottom: 14px;
  border: 1px solid #fde68a; border-radius: var(--s-radius-sm);
  background: var(--s-warn-soft); color: #78350f; font-size: 13px;
}
.tc-callout.is-bad { border-color: #fecaca; background: var(--s-danger-soft); color: #7f1d1d; }
.tc-callout svg { flex: none; width: 17px; height: 17px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tc-secret {
  display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 12px;
  border: 1px solid var(--s-line); border-radius: var(--s-radius-sm); background: var(--s-line-soft);
  font: 500 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; color: var(--s-ink);
}
.tc-secret code { flex: 1; }

.s-table tr.tc-group td {
  background: var(--sight-primary-soft); color: var(--s-ink); font-weight: 650; font-size: 12.5px;
  padding: 8px 14px;
}
.s-table tr.tc-group td .s-muted { font-weight: 400; }
.s-table tr.is-voided td { color: var(--s-faint); text-decoration: line-through; }
.s-table tr.is-voided td:last-child { text-decoration: none; }
.s-table tr.tc-edit td { background: #fcfcfd; }
.tc-strong { font-weight: 600; color: var(--s-ink); }
.tc-two-line small { display: block; font-size: 12px; color: var(--s-muted); }
.s-badge svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.s-badge-in { background: var(--sight-primary-soft); color: var(--sight-primary); }
.s-badge-live { background: var(--sight-primary); color: #fff; }
.s-badge-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #a7f3d0; }

/* ── Today board ─────────────────────────────────────────────────────────── */
.tc-board { padding: 6px 0 4px; }
.tc-row, .tc-axis { display: grid; grid-template-columns: 210px 1fr; align-items: center; column-gap: 16px; padding: 0 18px; }
.tc-axis { height: 28px; font-size: 11px; color: var(--s-faint); }
.tc-rows { position: relative; }
.tc-row { min-height: 54px; }
.tc-row + .tc-row { box-shadow: 0 -1px 0 var(--s-line-soft); }
.tc-who { min-width: 0; }
.tc-who-name { font-weight: 620; color: var(--s-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-who-state { font-size: 12.5px; color: var(--s-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-who-state.is-on { color: var(--sight-primary); font-weight: 560; }
.tc-who-state.is-bad { color: var(--s-danger); font-weight: 560; }
.tc-track { position: relative; height: 26px; }
.tc-track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--s-line); }
.tc-axis-track { position: relative; height: 100%; }
.tc-axis-track span { position: absolute; top: 7px; transform: translateX(-50%); }
.tc-overlay { position: absolute; top: 0; bottom: 0; left: calc(18px + 210px + 16px); right: 18px; pointer-events: none; }
.tc-gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(229, 231, 235, .7); }
.tc-bar { position: absolute; top: 4px; height: 18px; min-width: 3px; border-radius: 4px; background: var(--sight-primary); }
.tc-bar.is-live { background: var(--sight-accent); }
.tc-bar.is-live::after { content: ''; position: absolute; right: -3px; top: -2px; width: 6px; height: 22px; border-radius: 3px; background: var(--sight-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sight-accent) 30%, transparent); }
.tc-bar.is-broken { background: var(--s-danger-soft); border: 1.5px dashed var(--s-danger); }
.tc-late-gap { position: absolute; top: 12px; height: 3px; border-radius: 2px; background: var(--s-danger); }
.tc-expect { position: absolute; top: 1px; width: 2px; height: 24px; border-radius: 1px; background: var(--s-faint); }
.tc-expect.is-late { background: var(--s-danger); }
.tc-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--s-danger); z-index: 2; }
.tc-now span { position: absolute; top: -3px; left: 50%; transform: translateX(-50%); padding: 1px 6px; border-radius: 9px; background: var(--s-danger); color: #fff; font-size: 10.5px; font-weight: 700; }
.tc-now-mini { display: none; }
.tc-sm-only { display: none; }
.tc-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 18px; font-size: 12px; color: var(--s-muted); }
.tc-legend i { display: inline-block; width: 18px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; background: var(--sight-primary); }
.tc-legend i.is-live { background: var(--sight-accent); }
.tc-legend i.is-broken { background: var(--s-danger-soft); border: 1.5px dashed var(--s-danger); }
.tc-legend i.is-expect { width: 2px; height: 14px; vertical-align: -3px; background: var(--s-faint); }
.tc-legend i.is-late { height: 3px; vertical-align: 3px; background: var(--s-danger); }

.tc-fix-list { list-style: none; margin: 0; padding: 0; }
.tc-fix-list li { padding: 13px 18px; }
.tc-fix-list li + li { box-shadow: 0 -1px 0 var(--s-line-soft); }
.tc-fix-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tc-fix-row p { margin: 2px 0 0; font-size: 12.5px; color: var(--s-muted); }
.tc-fix-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 12px; }
.tc-fix-form .s-field { margin: 0; }
.tc-kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.tc-kv dt { color: var(--s-muted); }
.tc-kv dd { margin: 0; }

.tc-sheet td.tc-cell { text-align: right; white-space: nowrap; }
.tc-sheet td.tc-total, .tc-sheet th.tc-total { background: var(--sight-primary-soft); font-weight: 650; white-space: nowrap; }
.tc-late-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--s-danger); vertical-align: 2px; }

.tc-skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, #f1f3f5 25%, #e9ecef 37%, #f1f3f5 63%); background-size: 400% 100%; animation: tc-shimmer 1.3s ease infinite; }
@keyframes tc-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ── Tablet ──────────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .tc-grid-2 { grid-template-columns: 1fr; }
  .tc-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tc-row, .tc-axis { grid-template-columns: 150px 1fr; }
  .tc-overlay { left: calc(18px + 150px + 16px); }
}

/* ── Phone: tabs become a bottom bar, the board becomes stacked rows ─────── */
@media (max-width: 720px) {
  .tc-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    max-width: none; margin: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    justify-content: space-around; gap: 0;
    background: var(--s-surface); border: 0;
    box-shadow: 0 -6px 20px rgba(16, 24, 40, .08);
  }
  .tc-tab {
    flex: 1; flex-direction: column; gap: 3px; margin: 0; padding: 7px 2px 6px;
    border: 0; border-radius: 10px; font-size: 11px; font-weight: 600;
  }
  .tc-tab svg { width: 21px; height: 21px; }
  .tc-tab.is-active { background: var(--sight-primary-soft); }
  .tc-page { padding-top: 16px; padding-bottom: 96px; }
  .tc-foot { padding-bottom: 100px; }
  .s-page-head h1 { font-size: 20px; }
  .s-page-head .s-btn { flex: 1; }
  .tc-metrics { gap: 10px; }
  .tc-metric { padding: 12px 13px; }
  .tc-metric-value { font-size: 22px; }
  .tc-axis, .tc-overlay { display: none; }
  .tc-row { grid-template-columns: 1fr; row-gap: 6px; padding: 10px 14px; }
  .tc-now-mini { display: block; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--s-danger); }
  .tc-toolbar { gap: 10px; }
  .tc-toolbar .s-field { flex: 1 1 140px; min-width: 0; }
  .tc-toolbar .tc-seg-field { flex-basis: 100%; }
  .tc-seg { display: flex; width: 100%; }
  .tc-seg button { flex: 1; padding: 0 4px; font-size: 12.5px; }
  .tc-fix-form { grid-template-columns: 1fr 1fr; }
  .tc-fix-form .s-btn { grid-column: 1 / -1; }
  .s-table th, .s-table td { padding: 10px 10px; }
  .tc-sm-only { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
  .s-table td:first-child { width: 1%; }
  .tc-two-line { width: auto !important; }
  .sight-toasts { left: 12px; right: 12px; bottom: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  .tc-skeleton { animation: none; }
}

/* The tenant mark is a wide car-over-wordmark logo; the kit's 36px square makes
   it unreadable, so it gets a landscape slot here instead. */
.sight-topbar .s-logo { width: 116px; height: 38px; border-radius: 0; background: none; }
@media (max-width: 720px) {
  .sight-topbar .s-logo { width: 92px; height: 32px; }
  .sight-topbar .s-tenant { font-size: 13px; }
}

/* ── Remote control ──────────────────────────────────────────────────────── */
.tc-remote { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
.tc-remote .tc-stack .s-card + .s-card { margin-top: 0; }
.tc-lcd {
  position: relative; width: 100%; max-width: 560px; aspect-ratio: 280 / 240; margin: 0 auto;
  border-radius: 26px; overflow: hidden; background: #091112; cursor: crosshair;
  box-shadow: 0 0 0 10px #1b1f22, 0 10px 30px rgba(16, 24, 40, .25);
}
.tc-lcd img { display: block; width: 100%; height: 100%; }
.tc-lcd-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: #8ea3a1; font-size: 13px; }
.tc-tap {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(255, 255, 255, .25); pointer-events: none;
  animation: tc-tap .7s ease-out forwards;
}
@keyframes tc-tap { to { transform: scale(1.6); opacity: 0; } }
.tc-btn-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
@media (max-width: 1000px) { .tc-remote { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .tc-lcd { border-radius: 18px; box-shadow: 0 0 0 6px #1b1f22; } }
@media (prefers-reduced-motion: reduce) { .tc-tap { animation: none; opacity: .5; } }
