/* ===================================================================
   ACC Room Status Board — "Field Instrument" aesthetic
   Desktop/TV dashboard. Dark, utilitarian, warm.
   =================================================================== */

:root {
  /* Surface — layered depth */
  --bg: #141417;
  --bg-raised: #1e1e23;
  --bg-input: #26262d;
  --border: #333340;
  --border-subtle: #2a2a34;

  /* Text */
  --text: #f0efe8;
  --text-dim: #b8b8bc;
  --text-muted: #7a7a82;

  /* Brand — ACC identity */
  --brand: #4DBAB0;
  --brand-dim: #3a9b92;
  --brand-bg: rgba(77, 186, 176, 0.08);
  --brand-border: rgba(77, 186, 176, 0.25);

  /* Workflow accents */
  --care: #E8C547;
  --care-bg: rgba(232, 197, 71, 0.08);
  --care-border: rgba(232, 197, 71, 0.2);
  --care-glow: rgba(232, 197, 71, 0.06);

  --cleaning: #4DBAB0;
  --cleaning-bg: rgba(77, 186, 176, 0.08);
  --cleaning-border: rgba(77, 186, 176, 0.2);
  --cleaning-glow: rgba(77, 186, 176, 0.06);

  --exception: #B07CD8;
  --exception-bg: rgba(176, 124, 216, 0.08);
  --exception-border: rgba(176, 124, 216, 0.2);
  --exception-glow: rgba(176, 124, 216, 0.06);

  --sound: #E8735A;
  --sound-bg: rgba(232, 115, 90, 0.08);
  --sound-border: rgba(232, 115, 90, 0.2);
  --sound-glow: rgba(232, 115, 90, 0.06);

  /* Shared */
  --radius: 14px;
  --radius-sm: 10px;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ===================================================================
   Reset & Base
   =================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Subtle noise texture for depth */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* ===================================================================
   Screens — stacked, only .active is visible
   =================================================================== */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.screen.active {
  display: flex;
  animation: screenIn 0.25s ease-out;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   Dashboard Header
   =================================================================== */

.screen-chrome {
  flex-shrink: 0;
}

.dash-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
  min-height: 64px;
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark-sm {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--brand);
  border-radius: 50%;
  color: var(--brand);
  background: var(--brand-bg);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* Back button */
.btn-back {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.12s, background 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-back:hover { color: var(--text); background: var(--bg-raised); }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.12s, background 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon:hover { color: var(--text); background: var(--bg-raised); }

/* ===================================================================
   Dashboard Content Area
   =================================================================== */

.dash-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 40px;
}

/* ===================================================================
   Shelter & Room Picker
   =================================================================== */

.picker-heading {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  color: var(--text-dim);
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

/* Shelter picker gets bigger cards */
#shelter-grid {
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 18px;
}

#shelter-grid .picker-card {
  padding: 32px;
}

#shelter-grid .picker-card-name {
  font-size: 1.35rem;
  white-space: nowrap;
}

#shelter-grid .picker-card-abbr {
  font-size: 0.8rem;
  margin-bottom: 16px;
}

#shelter-grid .picker-card-stats {
  gap: 20px;
}

#shelter-grid .picker-stat {
  font-size: 0.85rem;
}

.picker-card {
  background: var(--bg-raised);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  user-select: none;
}

/* Left accent edge */
.picker-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--brand);
  opacity: 0.5;
  transition: opacity 0.15s;
}

.picker-card:hover {
  border-color: var(--brand-border);
  background: rgba(77, 186, 176, 0.03);
  box-shadow: 0 0 30px rgba(77, 186, 176, 0.06);
  transform: translateY(-2px);
}

.picker-card:hover::before { opacity: 1; }
.picker-card:active { transform: scale(0.98); }

.picker-card-name {
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.85);
}

.picker-card-abbr {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--brand);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.picker-card-stats {
  display: flex;
  gap: 16px;
}

.picker-stat {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.picker-stat-value {
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}

/* Room card flags */
.picker-card-flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}

.picker-flag {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.picker-flag-ok {
  background: rgba(94, 186, 125, 0.15);
  color: #5EBA7D;
  border: 1px solid rgba(94, 186, 125, 0.3);
}

.picker-flag-warn {
  background: rgba(232, 97, 77, 0.15);
  color: #E8614D;
  border: 1px solid rgba(232, 97, 77, 0.3);
}

.picker-flag-missing {
  background: rgba(122, 122, 130, 0.1);
  color: #7a7a82;
  border: 1px solid rgba(122, 122, 130, 0.25);
}

.picker-flag-capacity {
  background: rgba(232, 97, 77, 0.1);
  color: #E8614D;
  border: 1px solid rgba(232, 97, 77, 0.25);
}

.picker-flag-empty {
  background: rgba(77, 186, 176, 0.1);
  color: var(--brand);
  border: 1px solid rgba(77, 186, 176, 0.25);
}

.picker-flag-pc {
  background: rgba(232, 160, 77, 0.15);
  color: #E8A04D;
  border: 1px solid rgba(232, 160, 77, 0.3);
}

.picker-stat-pc {
  color: #E8A04D;
}

.picker-flag-weekly-ok {
  background: rgba(94, 186, 125, 0.15);
  color: #5EBA7D;
  border: 1px solid rgba(94, 186, 125, 0.3);
  font-size: 0.55rem;
}

.picker-flag-weekly-approaching {
  background: rgba(232, 197, 71, 0.15);
  color: #E8C547;
  border: 1px solid rgba(232, 197, 71, 0.3);
  font-size: 0.55rem;
}

.picker-flag-weekly-warn {
  background: rgba(232, 97, 77, 0.15);
  color: #E8614D;
  border: 1px solid rgba(232, 97, 77, 0.3);
  font-size: 0.55rem;
}

/* Staggered entrance */
.screen.active .picker-card {
  animation: cardIn 0.3s ease-out both;
}
.screen.active .picker-card:nth-child(1) { animation-delay: 0.03s; }
.screen.active .picker-card:nth-child(2) { animation-delay: 0.06s; }
.screen.active .picker-card:nth-child(3) { animation-delay: 0.09s; }
.screen.active .picker-card:nth-child(4) { animation-delay: 0.12s; }
.screen.active .picker-card:nth-child(5) { animation-delay: 0.15s; }
.screen.active .picker-card:nth-child(6) { animation-delay: 0.18s; }
.screen.active .picker-card:nth-child(7) { animation-delay: 0.21s; }
.screen.active .picker-card:nth-child(8) { animation-delay: 0.24s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   Room Header (Room View)
   =================================================================== */

.room-header {
  flex-wrap: wrap;
  gap: 12px 20px;
}

.room-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.room-name {
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: rgba(255, 255, 255, 0.85);
}

.shelter-badge-sm {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--brand);
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Weekly compliance pills — paired in room header */
.compliance-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.compliance-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, background 0.2s, opacity 0.2s;
}

.compliance-pill[hidden] { display: none; }

.compliance-pill:hover { opacity: 0.85; }

.compliance-pill-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.compliance-pill-text {
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
}

/* OK — green */
.compliance-pill.compliance-ok {
  background: rgba(94, 186, 125, 0.12);
  border: 1px solid rgba(94, 186, 125, 0.3);
  color: #5EBA7D;
}

/* Approaching — amber */
.compliance-pill.compliance-approaching {
  background: rgba(232, 197, 71, 0.12);
  border: 1px solid rgba(232, 197, 71, 0.35);
  color: #E8C547;
  animation: pulse-approaching 3s ease-in-out infinite;
}

@keyframes pulse-approaching {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Overdue — red */
.compliance-pill.compliance-overdue {
  background: rgba(232, 97, 77, 0.12);
  border: 1px solid rgba(232, 97, 77, 0.35);
  color: #E8614D;
}

/* Compliance popover (shared by sound + disinfect) */
.compliance-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  min-width: 240px;
  max-width: 340px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: detailIn 0.15s ease-out;
}

.compliance-popover-header {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.compliance-popover-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.compliance-popover-row + .compliance-popover-row {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.compliance-popover-value {
  font-weight: 600;
  color: var(--text);
  min-width: 44px;
}

.compliance-popover-value.warn { color: var(--sound); }

.compliance-popover-detail {
  color: var(--text-muted);
  flex: 1;
}

.compliance-popover-time {
  color: var(--text-dim);
  margin-left: auto;
}

.compliance-popover-staff {
  color: var(--text-dim);
}

.compliance-popover-empty {
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.72rem;
  padding: 4px;
}

/* Right side of room header */
.room-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* Room dropdown */
.room-dropdown {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 12px;
  cursor: pointer;
  outline: none;
  max-width: 200px;
  transition: border-color 0.15s;
}

.room-dropdown:focus {
  border-color: var(--brand-border);
}

.room-dropdown option {
  background: var(--bg-raised);
  color: var(--text);
}

/* Last updated */
.last-updated {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 1;
  text-align: right;
}

/* ===================================================================
   Tab Bar
   =================================================================== */

.tab-bar {
  display: flex;
  gap: 2px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
  flex-shrink: 0;
}

.tab {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}

.tab:hover { color: var(--text-dim); }

.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Legend button */
.legend-btn {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  margin-left: auto;
  align-self: center;
  transition: color 0.15s, border-color 0.15s;
  position: relative;
}

.legend-btn:hover {
  color: var(--text-dim);
  border-color: var(--border);
}

/* Legend popover */
.legend-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  min-width: 340px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  text-align: left;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}

/* Give flag/pill swatch a fixed-width lane so labels always start at the same x */
.legend-row > .status-flag {
  min-width: 48px;
  text-align: center;
  flex-shrink: 0;
}

.legend-row > .compliance-pill {
  min-width: 110px;
  text-align: center;
  flex-shrink: 0;
  justify-content: center;
}

.legend-row > .picker-flag {
  min-width: 140px;
  text-align: center;
  flex-shrink: 0;
}

.legend-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.3;
}

.legend-dot-section {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.legend-dot-col {
  flex: 1;
}

.legend-hint-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
  align-self: center;
}

.legend-hint {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.legend-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 6px 0;
}

/* ===================================================================
   Kennel Grid (Today View)
   =================================================================== */

.kennel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 12px;
}

.kennel-card {
  background: var(--bg-raised);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.2s;
}

/* Top accent line */
.kennel-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-subtle);
  transition: background 0.2s;
}

.kennel-card:hover {
  border-color: var(--border);
}

/* Fully logged card gets a subtle brand glow */
.kennel-card.complete::before {
  background: linear-gradient(90deg, var(--brand), transparent);
}

.kennel-card.complete {
  border-color: rgba(77, 186, 176, 0.15);
}

/* Empty kennel */
.kennel-card.empty {
  min-height: 80px;
  border: 1.5px dashed var(--border);
  background: transparent;
}

.kennel-card.empty:hover { border-color: var(--text-muted); }

.kennel-card.empty .kennel-label {
  color: var(--text-muted);
}

.kennel-card.empty .kennel-empty-text {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.kennel-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  margin: -16px -18px 0;
  padding: 10px 18px;
  border-radius: var(--radius) var(--radius) 0 0;
  margin-bottom: 6px;
}

.kennel-label {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.kennel-empty-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kennel-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

/* Animal info in kennel card */
.kennel-animal-name {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: rgba(255, 255, 255, 0.85);
}

.kennel-animal-id {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 6px;
  font-weight: 400;
}

.kennel-animal-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kennel-animal-meta .meta-sep {
  color: var(--text-muted);
}

.kennel-days {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
}

/* ===================================================================
   Status Dots
   =================================================================== */

.status-dots {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  justify-content: space-between;
}

.dot-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.dot-group-dots {
  display: flex;
  gap: 5px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, border-color 0.2s, transform 0.25s;
  flex-shrink: 0;
}

/* Dim dots — muted version of their category color */
.dot.dot-feed {
  background: rgba(232, 197, 71, 0.15);
  border: 1.5px solid rgba(232, 197, 71, 0.3);
}
.dot.dot-exercise {
  background: rgba(94, 186, 125, 0.15);
  border: 1.5px solid rgba(94, 186, 125, 0.3);
}
.dot.dot-social {
  background: rgba(232, 160, 77, 0.15);
  border: 1.5px solid rgba(232, 160, 77, 0.3);
}
.dot.dot-enrich {
  background: rgba(232, 120, 152, 0.15);
  border: 1.5px solid rgba(232, 120, 152, 0.3);
}
.dot.dot-rounds {
  background: rgba(130, 170, 220, 0.15);
  border: 1.5px solid rgba(130, 170, 220, 0.3);
}
.dot.dot-cleaning {
  background: rgba(77, 186, 176, 0.15);
  border: 1.5px solid rgba(77, 186, 176, 0.3);
}

.dot.dot-exception {
  background: rgba(196, 122, 219, 0.15);
  border: 1.5px solid rgba(196, 122, 219, 0.3);
}

.dot.dot-exception.done {
  background: #C47ADB;
  border-color: #C47ADB;
}

.dot.done {
  animation: dotPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Category dot colors — filled */
.dot.done.dot-feed      { background: #E8C547; border-color: #E8C547; }
.dot.done.dot-exercise  { background: #5EBA7D; border-color: #5EBA7D; }
.dot.done.dot-social    { background: #E8A04D; border-color: #E8A04D; }
.dot.done.dot-enrich    { background: #E87898; border-color: #E87898; }
.dot.done.dot-rounds    { background: #82AADC; border-color: #82AADC; }
.dot.done.dot-cleaning  { background: var(--cleaning); border-color: var(--cleaning); }

.dot-group-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

@keyframes dotPop {
  0%   { transform: scale(0.5); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ===================================================================
   Badges
   =================================================================== */

/* Status flag squares — compact inline indicators */
.status-flag {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  line-height: 1.2;
  flex-shrink: 0;
}

.flag-lt {
  background: #82AADC;
  color: #1a1d23;
}

.flag-dvm {
  background: #E8614D;
  color: #fff;
  animation: pulse-flag 2s ease-in-out infinite;
}

.flag-30ex {
  background: #C9A84C;
  color: #1a1d23;
}

/* Legacy — keep for foster tracker */
.flag-exam {
  background: #E8614D;
  color: #fff;
  animation: pulse-flag 2s ease-in-out infinite;
}

.flag-tdo {
  background: #8A7D72;
  color: #fff;
}

.flag-exception {
  background: #C47ADB;
  color: #1a1d23;
}

@keyframes pulse-flag {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* Legacy badge (kept for any remaining uses) */
.badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.5;
}

.badge-long-term {
  background: var(--care-bg);
  color: var(--care);
  border: 1px solid var(--care-border);
}

.badge-exam-overdue {
  background: var(--sound-bg);
  color: var(--sound);
  border: 1px solid var(--sound-border);
}

.badge-exception {
  background: var(--exception-bg);
  color: var(--exception);
  border: 1px solid var(--exception-border);
}

/* Kennel indicators — same size/shape as animal badges, inline with kennel name */
.kennel-indicator {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.5;
  color: var(--brand);
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
}

.kennel-indicator-capacity {
  color: var(--sound);
  background: var(--sound-bg);
  border-color: var(--sound-border);
  animation: pulse-capacity 2s ease-in-out infinite;
}

/* Week view still uses the old class */
.kennel-shared-indicator {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
  padding: 2px 7px;
  border-radius: 8px;
  letter-spacing: 0.02em;
}

.kennel-animal-separator {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 6px 0;
}

/* Week view badges (inline) */
.matrix-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.4;
  display: inline-block;
  margin-left: 4px;
}

.matrix-badge-long-term {
  background: var(--care-bg);
  color: var(--care);
  border: 1px solid var(--care-border);
}

.matrix-badge-exam-overdue {
  background: var(--sound-bg);
  color: var(--sound);
  border: 1px solid var(--sound-border);
}

/* Week view animal ID */
.matrix-animal-id {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 4px;
}

/* ===================================================================
   Compliance Matrix (Week View)
   =================================================================== */

.matrix-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}

.matrix-table th,
.matrix-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

/* Sticky first column */
.matrix-table th:first-child,
.matrix-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--bg);
  z-index: 2;
  text-align: left;
  font-weight: 600;
  padding-left: 0;
  min-width: 180px;
}

/* Sticky header row */
.matrix-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 3;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
}

.matrix-table thead th:first-child {
  z-index: 4;
}

.matrix-header-day {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.matrix-header-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* Today column highlight */
.matrix-today {
  background: rgba(77, 186, 176, 0.04);
}

.matrix-table thead th.matrix-today {
  background: rgba(77, 186, 176, 0.06);
  color: var(--brand);
}

/* Kennel name in matrix */
.matrix-kennel-name {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.matrix-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.matrix-animal-name {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

/* Matrix dots — smaller */
.matrix-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
}

.matrix-dots .dot {
  width: 10px;
  height: 10px;
}

.matrix-dot-sep {
  width: 1px;
  height: 10px;
  background: var(--border-subtle);
  margin: 0 1px;
}

.matrix-empty-cell {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* ===================================================================
   New Data Banner
   =================================================================== */

.new-data-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 20px;
  background: var(--brand-bg);
  border: none;
  border-bottom: 1px solid var(--brand-border);
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  animation: bannerSlide 0.3s ease-out;
}

.new-data-banner[hidden] { display: none; }

.new-data-banner:hover {
  background: rgba(77, 186, 176, 0.14);
}

@keyframes bannerSlide {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   Kennel Card — Expandable Detail
   =================================================================== */

.kennel-card.expanded {
  border-color: var(--brand-border);
}

.kennel-detail {
  border-top: 1px solid var(--border-subtle);
  margin-top: 10px;
  padding-top: 10px;
  animation: detailIn 0.2s ease-out;
}

.kennel-detail[hidden] { display: none; }

@keyframes detailIn {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 600px; }
}

.detail-animal-header {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
  margin-top: 8px;
}

.detail-animal-header:first-child {
  margin-top: 0;
}

.detail-group {
  margin-bottom: 8px;
}

.detail-group:last-child {
  margin-bottom: 0;
}

.detail-group-title {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--care);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.detail-group-title.detail-group-exception {
  color: var(--exception);
}

.detail-group-title.detail-group-cleaning {
  color: var(--cleaning);
}

.detail-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-type {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

/* Care type colors in detail views */
.detail-type-care { color: var(--care); }
.detail-type-feed { color: #E8C547; }
.detail-type-exercise { color: #5EBA7D; }
.detail-type-enrich { color: #E87898; }
.detail-type-social { color: #E8A04D; }
.detail-type-rounds { color: #82AADC; }
.detail-type-exception { color: var(--exception); }
.detail-type-cleaning { color: var(--cleaning); }

.detail-staff {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
}

.detail-time {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-left: auto;
}

.detail-notes {
  width: 100%;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
}

.detail-reason {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--exception);
  opacity: 0.8;
}

.detail-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 4px 0;
}

/* TDO toggle */
.detail-tdo-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.detail-tdo-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.12s;
}

.detail-tdo-btn:hover { border-color: #8A7D72; color: #8A7D72; }
.detail-tdo-btn:disabled { opacity: 0.5; cursor: default; }

.detail-tdo-active {
  background: rgba(138, 125, 114, 0.15);
  border-color: #8A7D72;
  color: #8A7D72;
}

/* ===================================================================
   Overcrowded Badge
   =================================================================== */

.badge-capacity {
  background: var(--sound-bg);
  color: var(--sound);
  border: 1px solid var(--sound-border);
  animation: pulse-capacity 2s ease-in-out infinite;
}

@keyframes pulse-capacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.matrix-badge-capacity {
  background: var(--sound-bg);
  color: var(--sound);
  border: 1px solid var(--sound-border);
}

/* ===================================================================
   Animal ID Links
   =================================================================== */

a.kennel-animal-id,
a.matrix-animal-id {
  text-decoration: none;
  transition: color 0.15s;
}

a.kennel-animal-id:hover,
a.matrix-animal-id:hover {
  color: var(--brand);
}

/* ===================================================================
   Animal Section (clickable per-animal area in kennel card)
   =================================================================== */

.kennel-animal-section {
  padding: 10px 12px;
  margin: 0 -12px;
  border-radius: 6px;
}

.kennel-animal-section + .kennel-animal-section {
  border-top: 1px solid var(--border-subtle);
}

.kennel-animal-section:hover {
  background: rgba(255, 255, 255, 0.02);
}

.kennel-animal-section.expanded {
  /* subtle highlight on expanded animal */
}

/* ===================================================================
   Week View — Kennel Group Headers
   =================================================================== */

.matrix-kennel-header-row td {
  padding: 10px 0 6px !important;
  border-bottom: 1px solid var(--border) !important;
  background: var(--bg-raised) !important;
}

.matrix-kennel-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.matrix-kennel-header .matrix-kennel-name {
  font-size: 0.78rem;
  font-weight: 600;
}

/* ===================================================================
   Week View — Day Detail Popover
   =================================================================== */

.matrix-day-detail {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: var(--bg-raised);
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 320px;
  max-width: 420px;
  white-space: nowrap;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  animation: detailIn 0.15s ease-out;
}

.matrix-day-detail-id {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-left: 4px;
  text-decoration: none;
}

.matrix-day-detail-id:hover { color: var(--brand); }

.matrix-day-detail-date {
  color: var(--text-muted);
  font-weight: 400;
}

.matrix-day-detail-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

/* ===================================================================
   Loading / Error / Empty States
   =================================================================== */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
}

.loading-state[hidden] { display: none; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.error-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--sound);
  font-size: 0.9rem;
  font-weight: 500;
}

.error-state[hidden] { display: none; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
}

.empty-state[hidden] { display: none; }

/* ===================================================================
   TV Mode Overrides
   =================================================================== */

/* TV mode picker */
.tv-mode .picker-card {
  padding: 28px;
}

.tv-mode .picker-card-name {
  font-size: 1.3rem;
}

.tv-mode .picker-card-stats {
  gap: 18px;
}

.tv-mode .picker-stat {
  font-size: 0.88rem;
}

.tv-mode .picker-heading {
  font-size: 1.5rem;
}

.tv-mode .kennel-card {
  padding: 24px 28px;
  min-height: 220px;
}

/* Kennel label row must match card padding for full-width span */
.tv-mode .kennel-label-row {
  margin: -24px -28px 8px;
  padding: 12px 28px;
}

.tv-mode .kennel-label {
  font-size: 0.95rem;
}

.tv-mode .kennel-indicator {
  font-size: 0.72rem;
  padding: 3px 10px;
}

.tv-mode .kennel-animal-name {
  font-size: 1.35rem;
}

.tv-mode .kennel-animal-id {
  font-size: 0.8rem;
}

.tv-mode .kennel-animal-meta {
  font-size: 0.88rem;
}

.tv-mode .kennel-days {
  font-size: 0.82rem;
}

.tv-mode .dot {
  width: 18px;
  height: 18px;
}

.tv-mode .dot-group-label {
  font-size: 0.72rem;
}

.tv-mode .status-dots {
  gap: 18px;
}

.tv-mode .badge {
  font-size: 0.7rem;
  padding: 3px 10px;
}

.tv-mode .status-flag {
  font-size: 0.72rem;
  padding: 3px 8px;
}

.tv-mode .kennel-animal-separator {
  margin: 8px 0;
}

.tv-mode .kennel-empty-text {
  font-size: 1.1rem;
}

.tv-mode .dash-header {
  padding: 20px 36px;
  min-height: 72px;
}

.tv-mode .room-name {
  font-size: 1.7rem;
}

.tv-mode .compliance-pill {
  font-size: 0.82rem;
  padding: 5px 14px;
}

.tv-mode .dash-content {
  padding: 28px 36px 40px;
}

.tv-mode .kennel-grid {
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}

.tv-mode .tab-bar {
  padding: 0 36px;
}

.tv-mode .tab {
  font-size: 0.95rem;
  padding: 14px 24px;
}

.tv-mode .last-updated {
  font-size: 0.78rem;
}

/* Matrix in TV mode */
.tv-mode .matrix-table th,
.tv-mode .matrix-table td {
  padding: 14px 16px;
}

.tv-mode .matrix-dots .dot {
  width: 13px;
  height: 13px;
}

.tv-mode .matrix-animal-name {
  font-size: 0.88rem;
}

/* ===================================================================
   Responsive — smaller desktops
   =================================================================== */

@media (max-width: 900px) {
  .dash-header {
    padding: 12px 16px;
  }

  .dash-content {
    padding: 16px 16px 32px;
  }

  .tab-bar {
    padding: 0 16px;
  }

  .room-header {
    flex-wrap: wrap;
  }

  .room-header-right {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
    padding-top: 4px;
  }

  .kennel-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
  }

  .picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
  }
}

@media (max-width: 600px) {
  .kennel-grid {
    grid-template-columns: 1fr;
  }

  .picker-grid {
    grid-template-columns: 1fr;
  }

  .room-header-info {
    flex-wrap: wrap;
  }

  .compliance-pills {
    margin-left: 0;
  }
}

/* ===================================================================
   Ultra-wide / large TV (>1600px)
   =================================================================== */

@media (min-width: 1600px) {
  .kennel-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (min-width: 2200px) {
  .kennel-grid {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 16px;
  }

  .tv-mode .kennel-card {
    min-height: 260px;
    padding: 28px 30px;
  }

  .tv-mode .kennel-animal-name {
    font-size: 1.5rem;
  }

  .tv-mode .dot {
    width: 22px;
    height: 22px;
  }
}

/* ===================================================================
   Scrollbar styling
   =================================================================== */

.dash-content::-webkit-scrollbar {
  width: 6px;
}

.dash-content::-webkit-scrollbar-track {
  background: transparent;
}

.dash-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.dash-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.matrix-container::-webkit-scrollbar {
  height: 6px;
}

.matrix-container::-webkit-scrollbar-track {
  background: transparent;
}

.matrix-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
