﻿/* ===== Machine Metrics ===== */

/* ─── Session / event type text ──────────────────────────────────────────────── */

.session-type-running       { color: var(--chart-running); }
.session-type-flagged       { color: var(--chart-flagged); }
.session-type-standby       { color: var(--chart-standby); }
.session-type-dormant       { color: var(--chart-dormant-tt); }
.session-type-offline       { color: var(--chart-offline); }
.session-type-disconnected  { color: var(--chart-disconnected); }
.session-type-unknown       { color: var(--chart-unknown); }
.event-type-steady          { color: var(--chart-running); }
.event-type-ongoing         { color: var(--chart-ongoing); }
.event-type-dormant         { color: var(--chart-dormant-tt); }
.event-type-offline         { color: var(--chart-offline); }
.event-type-disconnected    { color: var(--chart-disconnected); }

/* ─── Instance state text ────────────────────────────────────────────────────── */

.instance-state-active       { color: var(--type-active); }
.instance-state-idle         { color: var(--type-idle); }
.instance-state-offline      { color: var(--type-offline); }
.instance-state-disconnected { color: var(--type-disconnected); }
.instance-state-unknown      { color: var(--type-unknown); }

/* ─── Instances panels ───────────────────────────────────────────────────────── */

.instances-anchor-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.3rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.table-load-more {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

/* ─── Column resize handle ───────────────────────────────────────────────────── */

.col-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  z-index: var(--z-raise-2);
  background: transparent;
  transition: background 0.12s;
}
.col-resize-handle:hover,
.col-resize-handle.active {
  background: var(--primary);
}

/* Full-height line anchored to mouse x during drag — position:fixed so it never jumps */
.col-resize-line {
  display: none;
  position: fixed;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-1px);
  background: var(--primary);
  opacity: 0.5;
  pointer-events: none;
  z-index: var(--z-toast);
}

/* ─── Open session row ───────────────────────────────────────────────────────── */

tr.session-open td {
  background: var(--session-open-row-bg) !important;
  border-right-color: var(--border-light) !important;
}
tr.session-open td:first-child {
  border-left: 3px solid var(--session-open-border);
}

/* ─── Flagged session row ────────────────────────────────────────────────────── */

tr.session-flagged td {
  background: var(--warning-bg) !important;
  border-right-color: var(--border-light) !important;
}
tr.session-flagged td:first-child {
  border-left: 3px solid var(--warning);
}

/* ─── Unknown session row ────────────────────────────────────────────────────── */

tr.session-unknown td {
  background: var(--unknown-row-bg) !important;
  border-right-color: var(--border-light) !important;
}
tr.session-unknown td:first-child {
  border-left: 3px solid var(--type-unknown);
}

/* ─── Session status badges ──────────────────────────────────────────────────── */

.session-status-open,
.session-status-closed {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.session-status-open {
  background: var(--session-open-bg);
  color: var(--type-idle);
}
.session-status-closed {
  background: var(--session-closed-bg);
  color: var(--session-closed-color);
}

.session-flag-cell {
  text-align: center !important;
  padding: 0 !important;
  width: 6px !important;
  min-width: 6px !important;
  max-width: 6px !important;
  color: var(--warning);
  font-size: 0.7rem;
  overflow: hidden;
}
.session-flag-clickable {
  cursor: pointer;
}
.session-flag-clickable:hover {
  background: var(--warning-bg) !important;
}
.session-flag-ghost {
  opacity: 0.15;
}
.session-flag-clickable:hover .session-flag-ghost {
  opacity: 0.5;
}

/* ─── Session notes (detail modal) ───────────────────────────────────────────── */

.session-notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  max-height: 160px;
  overflow-y: auto;
}
.session-note {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
}
.session-note-text {
  font-size: 0.82rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.session-note-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.session-note-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.25rem 0;
  margin-bottom: 0.75rem;
}
.session-note-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.session-note-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-size: 0.82rem;
  font-family: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}
.session-note-submit {
  align-self: flex-end;
  font-size: 0.78rem;
  padding: 0.25rem 0.75rem;
}

/* ─── Dense analytics grid table ─────────────────────────────────────────────── */

.grid-table {
  border-radius: 0;
  box-shadow: none;
  border: 2px solid var(--border);
  line-height: 1.2;
  table-layout: fixed;
  width: auto;
  min-width: 100%;
}
.grid-table th {
  padding: 0.25rem 0.3rem;
  font-size: 0.8rem;
  text-align: center;
  border-right: 1px solid var(--navbar-overlay-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: var(--z-raise-1);
  background: var(--navbar-bg);
  color: var(--navbar-text);
}
.grid-table th:last-child { border-right: none; }
.grid-table td {
  padding: 0.15rem 0.3rem;
  font-size: 0.8rem;
  text-align: center;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid-table td:last-child { border-right: none; }
.grid-table tbody tr:nth-child(odd)  td { background: var(--surface); }
.grid-table tbody tr:nth-child(even) td { background: var(--row-stripe); }
.grid-table tbody tr:last-child td { border-bottom: none; }
.grid-table tbody tr:hover td { background: var(--row-hover); cursor: default; }

/* ─── Tab full-viewport layout ───────────────────────────────────────────────── */

#tab-metrics .data-table {
  border-radius: 0;
  box-shadow: none;
}

body.metrics-tab-active .content {
  max-width: none;
  padding: 0;
  margin: 0;
}

#tab-metrics.active {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  max-width: none;
  margin: 0;
}


.metrics-page-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  min-height: 2.5rem;
  position: relative;
}

.metrics-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.metrics-page-header h2 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

.metrics-page-header h2 svg {
  flex-shrink: 0;
  color: var(--primary);
  opacity: 0.85;
}

.btn-metrics-hamburger {
  display: none;
}

.metrics-tab-dropdown {
  display: none;
}

/* Overview / Review top tab bar — center column, sized to content */
.metrics-main-tab-bar {
  display: flex;
  justify-content: center;
}


/* Not .tab-bar/.tab-btn's border-fusion trick — this sits centered in a slim toolbar, not flush against a card border */
.metrics-main-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 2rem; /* vertical padding matches .btn-chart-open so both boxed controls share a height */
  font-size: 0.8rem;
  font-weight: 600;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.metrics-main-tab:hover  { color: var(--text); background: var(--row-selected); }
.metrics-main-tab.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-deep);
}

.metrics-main-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}


/* Outer body below the page header */
.metrics-panel-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  align-items: stretch;
  background: var(--row-stripe);
}

/* Area containing overview/review views */
.machines-views-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Table columns: compress with the pane, scroll instead of collapsing further */
.machines-content table th,
.machines-content table td { min-width: 72px; white-space: nowrap; }

#view-machines-summary {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Left filter sidebar ────────────────────────────────────────────────────── */

.metrics-sidebar {
  width: 210px;
  min-width: 210px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--row-stripe);
  flex-shrink: 0;
}

.sidebar-section {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--row-stripe);
}

.sidebar-section-title,
.sidebar-collapse-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}
.sidebar-section-title { margin-bottom: 0.3rem; }
.sidebar-collapse-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: var(--z-raise-1);
  background: var(--row-stripe);
}
.btn-sidebar-collapse {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  width: 10%;
}
.btn-sidebar-collapse:hover { color: var(--text); border-color: var(--text-muted); background: var(--row-selected); }
.metrics-sidebar.sidebar-collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
  overflow: hidden;
}
.btn-sidebar-expand {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-local-badge);
  background: var(--row-stripe);
  border: 1px solid var(--border);
  border-left: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 6px 3px;
  border-radius: 0 3px 3px 0;
  line-height: 1;
}
.btn-sidebar-expand:hover { color: var(--text); }
.machines-views-area { position: relative; }


.sidebar-dt-group { margin-bottom: 0.45rem; }
.sidebar-dt-label {
  font-size: 0.63rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.sidebar-dt-input {
  display: block;
  width: 100%;
  font-size: 0.72rem;
  padding: 0.3rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
  margin-bottom: 0.2rem;
}

.btn-sidebar-apply {
  width: 100%;
  padding: 0.2rem 0;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 2px;
  letter-spacing: 0.03em;
  margin-top: 0.3rem;
}
.btn-sidebar-apply:hover { opacity: 0.85; }

.sidebar-type-group { border-bottom: 1px solid var(--border-light); }

.sidebar-type-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  width: 100%;
}
.sidebar-type-header:hover { background: var(--row-selected); }
.sidebar-type-header input { cursor: pointer; flex-shrink: 0; }

.sidebar-machine-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.65rem 0.22rem 1.4rem;
  font-size: 0.73rem;
  color: var(--text-sub);
  cursor: pointer;
  user-select: none;
}
.sidebar-machine-item:hover { background: var(--row-hover); }
.sidebar-machine-item input { cursor: pointer; flex-shrink: 0; }

/* ─── Right content area ─────────────────────────────────────────────────────── */

.machines-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Timecards sub-view wrappers must participate in the flex chain so the
   inner .metrics-table-wrap can scroll instead of growing unbounded */
#tc-view-machine,
#tc-view-adp {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.machines-status-bar {
  padding: 0.25rem 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--row-stripe);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  min-height: 1.6rem;
}

/* Sub-tab bar */
.subtab-bar {
  display: flex;
  align-items: center;
  min-height: 2.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.subtab,
.metrics-review-tab,
.metrics-stats-tab {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 1rem;
  font-size: 0.72rem;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
  margin-bottom: -1px;
}
.subtab:hover,
.metrics-review-tab:hover,
.metrics-stats-tab:hover { color: var(--text); }
.subtab.active,
.metrics-review-tab.active,
.metrics-stats-tab.active { color: var(--text); border-bottom-color: var(--primary); }

/* Subtab wrap — transparent on desktop; becomes a positioned hamburger on mobile */
.btn-metrics-subtab-hamburger { display: none; }
.metrics-subtab-wrap { display: contents; }
.metrics-subtab-dropdown { display: contents; }

/* Open-chart toggle button in the tab bar */
.btn-chart-open {
  display: flex;
  align-items: center;
  padding: 0.28rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  margin: auto 0.75rem auto 0.75rem;
  transition: background 0.15s, color 0.15s;
}
.btn-chart-open:hover { background: var(--surface-deep); color: var(--text); }
.btn-chart-open.active { background: var(--surface-deep); color: var(--primary); border-color: var(--primary); }

/* Machine select in the chart pane header */
.chart-machine-select {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0.1rem 0.2rem;
  min-width: 80px;
  max-width: 150px;
  cursor: pointer;
  flex-shrink: 0;
}
.chart-machine-select:focus { outline: none; border-bottom-color: var(--primary); }

.metrics-table-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
}

/* ─── Shift view (table + chart side by side) ────────────────────────────────── */

#view-shift {
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.shift-table-pane {
  flex: 1;
  overflow-y: auto;
  min-width: 300px;
}

.chart-pane-handle {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: var(--border);
  transition: background 0.15s;
}
.chart-pane-handle:hover,
.chart-pane-handle.dragging { background: var(--primary); }


/* Chart view tab switcher (bar / pie / events) */
.chart-view-tabs {
  display: flex;
  gap: 2px;
  align-items: center;
}
.chart-view-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 3px 5px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.chart-view-tab:hover {
  background: var(--row-selected);
  color: var(--text);
  border-color: var(--border);
}
.chart-view-tab.active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--row-selected);
}

.chart-tab-inner-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
  margin: 0 5px;
  flex-shrink: 0;
}
.perf-mode-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.perf-window-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: 5px;
}
.perf-window-wrap.hidden { display: none; }
.perf-window-input {
  width: 48px;
  height: 22px;
  text-align: center;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 3px 0 0 3px;
  background: transparent;
  color: inherit;
  padding: 0 2px;
  box-sizing: border-box;
}
.perf-window-input::-webkit-inner-spin-button,
.perf-window-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.perf-window-input { -moz-appearance: textfield; }
.perf-window-btns {
  display: flex;
  flex-direction: column;
  height: 22px;
}
.btn-perf-window {
  flex: 1;
  width: 14px;
  border: 1px solid var(--border);
  border-left: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 7px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-perf-window:first-child { border-radius: 0 3px 0 0; border-bottom: none; }
.btn-perf-window:last-child  { border-radius: 0 0 3px 0; }
.btn-perf-window:hover { background: var(--row-selected); color: var(--text); }

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  z-index: var(--z-raise-2);
}
#machines-chart { width: 100%; height: 100%; }
#machines-pie-chart, #machines-events-chart, #machines-perf-chart { width: 100%; height: 100%; }
.canvas-bar, .canvas-pie, .canvas-events, .canvas-perf { width: 100%; height: 100%; }

/* ─── Floating chart docker (new structure) ──────────────────────────────────── */

.chart-pane {
  flex-shrink: 0;
  width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: none;
}
.chart-pane:not(.collapsed) { width: 380px; }
.chart-pane.collapsed { display: none; }

/* Placeholder shown when chart is floating outside the docker */
.chart-pane-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
}
.chart-pane-placeholder.hidden { display: none; }

/* Drop-target highlight when dragging a detached float back over the docker */
.chart-pane.drop-target { background: var(--surface); }

/* Detached / floating-over-page state */
.machines-chart-float.detached {
  position: fixed;
  z-index: var(--z-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  overflow: hidden;
  resize: both;
  min-width: 320px;
  min-height: 200px;
  flex: none;
}
.machines-chart-float.detached.hidden { display: none; }

/* The floating chart window — lives inside the docker when docked */
.machines-chart-float {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  background: var(--surface);
}

/* Titlebar */
.chart-float-titlebar {
  display: flex;
  align-items: center;
  padding: 0.22rem 0.5rem;
  background: var(--navbar-bg);
  color: var(--navbar-text);
  border-bottom: 1px solid var(--border);
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
  gap: 0.4rem;
}
.machines-chart-float:not(.detached) .chart-float-titlebar { cursor: default; }
.chart-float-titlebar:active { cursor: grabbing; }

/* Machine select in titlebar */
.chart-float-titlebar .chart-machine-select { color: var(--navbar-text); border-bottom-color: var(--navbar-overlay-soft); }
.chart-float-titlebar .chart-machine-select option { color: var(--text); background: var(--surface); }

.chart-status {
  font-size: 0.68rem;
  color: var(--navbar-link);
  flex: 1;
}

/* Titlebar icon buttons (fullscreen, etc.) */
.chart-float-icon-btn {
  background: none;
  border: none;
  color: var(--navbar-link);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  flex-shrink: 0;
}
.chart-float-icon-btn:hover { color: var(--navbar-text); }

/* Titlebar close and dock-back buttons */
.chart-float-close,
.chart-float-dock-back {
  background: none;
  border: none;
  color: var(--navbar-text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  opacity: 0.7;
  transition: opacity 0.1s;
  flex-shrink: 0;
}
.chart-float-close { margin-left: auto; font-size: 1.1rem; }
.chart-float-close:hover,
.chart-float-dock-back:hover { opacity: 1; }
.chart-float-dock-back.hidden { display: none; }

.chart-titlebar-sep {
  width: 1px;
  height: 1rem;
  background: var(--navbar-overlay-soft);
  flex-shrink: 0;
}

/* Canvas wrap inside the float */
.chart-wrap {
  flex: 1;
  position: relative;
  padding: 0.5rem 0.5rem 0.25rem;
  min-height: 200px;
  overflow-x: auto;
  overflow-y: hidden;
}

/* ─── Chart hover tooltip ────────────────────────────────────────────────────── */

.chart-tooltip {
  position: fixed;
  display: none;
  left: 0;
  top: 0;
  background: var(--tooltip-bg);
  border: 1px solid var(--tooltip-border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--tooltip-text);
  pointer-events: none;
  z-index: var(--z-float);
  white-space: nowrap;
  line-height: 1.6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  will-change: transform;
  transition: transform 55ms ease-out;
}
.chart-tooltip .tt-title { font-weight: 600; color: var(--tt-active); }
.chart-tooltip .tt-time               { color: var(--tt-time); }
.chart-tooltip .tt-detail             { color: var(--tt-muted); }
.chart-tooltip .tt-note               { color: var(--tt-muted); font-style: italic; margin-top: 3px; border-top: 1px solid var(--border); padding-top: 3px; }
.chart-tooltip .tt-hint               { color: var(--tt-muted); font-style: italic; margin-top: 2px; }
.chart-tooltip .tt-affirm             { color: var(--tt-running);  font-size: 0.8em; margin-top: 2px; }
.chart-tooltip .tt-warn               { color: var(--tt-flagged); font-size: 0.8em; margin-top: 2px; }

/* ─── Inline review response / notes ────────────────────────────────────────── */

/* Override grid-table td defaults for cells containing form elements */
.review-td-edit {
  padding: 0.05rem 0.15rem !important;
  text-align: left !important;
  overflow: visible !important;
}

.review-category-select {
  width: 100%;
  font-size: 0.75rem;
  padding: 0.12rem 0.2rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-sizing: border-box;
}
.review-category-select:focus { outline: none; border-color: var(--primary); }

.review-notes-input {
  width: 100%;
  font-size: 0.75rem;
  padding: 0.12rem 0.25rem;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  box-sizing: border-box;
}
.review-notes-input:hover { border-color: var(--border); }
.review-notes-input:focus { border-color: var(--primary); outline: none; background: var(--bg); }

/* ─── Reports / Accept inline forms ─────────────────────────────────────────── */

.reports-resolve-cell {
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.reports-fix-input {
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  min-width: 160px;
  flex: 1 1 160px;
}

.reports-fix-cell { color: var(--text-muted); font-size: 0.8rem; }

/* Row saving / error states */
.row-saving { opacity: 0.6; pointer-events: none; transition: opacity 0.15s; }
.row-save-error { background: color-mix(in srgb, var(--danger) 12%, transparent) !important; transition: background 0.2s; }

/* Accept / reject button loading state */
.btn-accept.btn-loading,
.btn-reject.btn-loading {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Logs ───────────────────────────────────────────────────────────────────── */

.log-message-cell { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.log-traceback { margin-top: 0.4rem; padding: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; font-size: 0.72rem; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow-y: auto; }

.info-row--full { flex-direction: column; align-items: flex-start; gap: 0.3rem; }

/* ─── Dashboard ──────────────────────────────────────────────────────────────── */

.dashboard-loading-bar {
  height: 2px;
  width: 100%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: var(--border);
}
.dashboard-loading-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: var(--primary);
  animation: dashboard-loading-sweep 1.1s ease-in-out infinite;
}
@keyframes dashboard-loading-sweep {
  0%   { left: -50%; }
  100% { left: 100%; }
}

.dashboard-view-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  flex: 1;
}

.dashboard-group {
  display: flex;
  flex-direction: column;
}

.dashboard-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 0.9rem 1.1rem 0.3rem;
  border-bottom: 1px solid var(--border-light, var(--border));
}

.dashboard-shifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(240px, 50%), 1fr));
  gap: 1.1rem;
  padding: 1.1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(240px, 25%), 1fr));
  gap: 1.1rem;
  padding: 1.1rem;
  align-content: flex-start;
}

#main-view-dashboard .dashboard-shifts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 1500px) {
  #main-view-dashboard .dashboard-shifts-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1900px) {
  #main-view-dashboard .dashboard-shifts-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  #main-view-dashboard .dashboard-shifts-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  box-shadow: 0 1px 3px var(--shadow-sm, rgba(0,0,0,0.06));
  cursor: default;
  transition: opacity 0.15s;
}

.dashboard-card.dragging {
  opacity: 0.12;
  pointer-events: none;
}

/* Row + column highlight for cards adjacent to the drag target */
.dashboard-card.drop-highlight {
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-drag-handle {
  color: var(--text-muted);
  cursor: grab;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.dashboard-drag-handle:hover { opacity: 1; }
.dashboard-card:active .dashboard-drag-handle { cursor: grabbing; }

.dashboard-card-section {
  padding-top: 0.6rem;
  margin-top: 0.6rem;
  border-top: 1px solid var(--border-light, var(--border));
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dashboard-card-header + .dashboard-card-section {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.dashboard-section-title {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.dashboard-section-range {
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.7;
  cursor: help;
}


.dashboard-activity-block {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  /* --surface-deep, not --surface — this sits directly on .dashboard-card, which is
     also --surface; without a border/shadow here it would blend flat into the card. */
  background: var(--surface-deep);
  border-radius: 6px;
  padding: 0.32rem 0.5rem;
}

.dashboard-activity-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.82rem;
}

.dashboard-activity-context {
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-stats-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.dashboard-stats-ok {
  font-size: 0.8rem;
  color: var(--success);
  font-weight: 600;
}

.dashboard-activity-file-chip {
  font-size: 0.7rem;
  font-family: monospace;
  font-weight: 600;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.dashboard-review-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: lowercase;
}

.dashboard-open-badge {
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: inherit;
  transition: opacity 0.15s;
}
.dashboard-open-badge:hover { opacity: 0.75; }

/* orange — needs operator response */
.dashboard-review-unresponded {
  background: var(--badge-warning-bg, rgba(255,152,0,0.15));
  color: var(--warning);
}

/* slate blue — responded but not yet accepted/rejected */
.dashboard-review-unresolved {
  background: var(--info-bg);
  color: var(--info-color);
}

/* green — all resolved */
.dashboard-review-resolved {
  background: var(--badge-success-bg);
  color: var(--success);
}

.dashboard-review-counter {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
  cursor: default;
}

.dashboard-review-sep {
  margin: 0 0.3rem;
  opacity: 0.35;
  font-weight: 400;
}

.dashboard-review-badges { flex-wrap: wrap; gap: 0.25rem; justify-content: flex-start; }

.dashboard-empty {
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
