body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
}
#toolbar {
  margin-bottom: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
button {
  padding: 10px 15px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}
button:hover { background-color: #0056b3; }
button.secondary { background-color: #6c757d; }
button.secondary:hover { background-color: #545b62; }
button.active-nav { background-color: #1e7e34; }
#status { color: #666; font-size: 0.9rem; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  padding: 8px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
  color: #fff;
  background: #6c757d;
  font-size: 0.9rem;
}
.nav-links a:hover { background: #545b62; }
.nav-links a.active { background: #1e7e34; }
.toolbar-select {
  padding: 7px 9px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}
.toolbar-label { font-size: 0.9rem; color: #555; display: flex; align-items: center; gap: 4px; }
#filters-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
#filters-bar input[type="text"], #filters-bar input[type="date"] {
  padding: 7px 9px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9rem;
}
#main-container {
  display: flex;
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
  min-height: 0;
}
#tree-sidebar {
  width: 32%;
  min-width: 260px;
  border-right: 1px solid #ccc;
  padding: 15px;
  overflow-y: auto;
  background-color: #f8f9fa;
}
#viewer-content {
  flex: 1;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  overflow: auto;
}
#viewer-content img {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
#meta {
  width: 100%;
  max-width: 720px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.5;
  word-break: break-all;
}
#placeholder-text { color: #888; font-style: italic; }
#viewer-placeholder { color: #888; font-style: italic; }
.error { color: #c82333; }
ul { list-style-type: none; padding-left: 18px; margin: 4px 0; }
.tree-item {
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 3px;
}
.tree-item:hover { background-color: #e2e6ea; }
.tree-item.active { background-color: #cce5ff; }
.folder { font-weight: bold; color: #856404; }
.file { color: #155724; }
.folder::before { content: "📁 "; }
.file::before { content: "🖼 "; }
.blocked { color: #c82333; }
#stats-panel {
  flex: 1; border: 1px solid #ccc; border-radius: 4px;
  padding: 20px; overflow-y: auto; background: #fff; min-height: 0;
}
#stats-panel h2 { margin: 0 0 4px; font-size: 1.15rem; }
#stats-panel .scope { color: #666; font-size: 0.85rem; margin-bottom: 16px; }
.cards { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.card {
  flex: 1; min-width: 150px; background: #f8f9fa;
  border: 1px solid #e2e6ea; border-radius: 6px; padding: 14px 16px;
}
.card .label {
  font-size: 0.72rem; color: #777; text-transform: none;
  letter-spacing: .1px; line-height: 1.35;
}
.card .value { font-size: 1.7rem; font-weight: bold; color: #1e293b; margin-top: 4px; }
.card .sub { font-size: 0.8rem; color: #888; margin-top: 2px; }
.card.peak .value { color: #1e7e34; }
.stats-section { margin-bottom: 22px; }
.stats-section h3 { font-size: 0.95rem; margin: 0 0 10px; color: #333; }
.barrow { display: flex; align-items: center; gap: 10px; margin: 3px 0; font-size: 0.85rem; }
.barrow .name { width: 180px; flex-shrink: 0; color: #333; }
.barrow .track { flex: 1; background: #eef1f4; border-radius: 3px; height: 16px; overflow: hidden; }
.barrow .fill { height: 100%; background: #007bff; }
.barrow.hour .fill { background: #1e7e34; }
.barrow .count { width: 72px; text-align: right; color: #555; flex-shrink: 0; }
#stats-empty { color: #888; font-style: italic; }
.goal-banner {
  border-radius: 10px; padding: 18px 20px; margin-bottom: 20px;
  border: 2px solid #cbd5e1; background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}
.goal-banner.met {
  border-color: #22c55e; background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}
.goal-banner.warn {
  border-color: #f59e0b; background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}
.goal-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px; margin-bottom: 12px; }
.goal-head .title { font-size: 1.05rem; font-weight: bold; color: #0f172a; }
.goal-head .badge {
  font-size: 0.8rem; font-weight: bold; padding: 4px 10px; border-radius: 999px;
  background: #e2e8f0; color: #475569;
}
.goal-banner.met .badge { background: #22c55e; color: #fff; }
.goal-banner.warn .badge { background: #f59e0b; color: #fff; }
.goal-numbers { font-size: 2rem; font-weight: bold; color: #1e293b; line-height: 1.1; }
.goal-numbers .of { font-size: 1.1rem; font-weight: normal; color: #64748b; }
.goal-track {
  height: 28px; background: #e2e8f0; border-radius: 999px; overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.08);
}
.goal-fill {
  height: 100%; border-radius: 999px; transition: width .4s ease;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}
.goal-banner.met .goal-fill { background: linear-gradient(90deg, #22c55e, #16a34a); }
.goal-banner.warn .goal-fill { background: linear-gradient(90deg, #f59e0b, #d97706); }
.goal-sub { margin-top: 10px; font-size: 0.85rem; color: #64748b; }
.day-row {
  display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 0.85rem;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.day-row:hover { background: #f1f5f9; }
.day-row.active { background: #dbeafe; outline: 1px solid #93c5fd; }
.day-row .date { width: 92px; flex-shrink: 0; font-weight: 600; color: #334155; }
.day-row .track { flex: 1; background: #eef1f4; border-radius: 4px; height: 14px; overflow: hidden; }
.day-row .fill { height: 100%; background: #3b82f6; }
.day-row.met .fill { background: #22c55e; }
.day-row .nums { width: 110px; text-align: right; color: #475569; flex-shrink: 0; }
.day-row .icon { width: 22px; text-align: center; flex-shrink: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.summary-card {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px 16px;
}
.summary-card h4 { margin: 0 0 8px; font-size: 0.85rem; color: #334155; font-weight: 600; }
.summary-card .big { font-size: 1.6rem; font-weight: bold; color: #0f172a; line-height: 1.2; }
.summary-card .detail { font-size: 0.8rem; color: #64748b; margin-top: 6px; line-height: 1.45; }
.summary-card.richmedia { border-left: 4px solid #2563eb; }
.summary-card.visit { border-left: 4px solid #059669; }
.summary-card.visit .visit-split { display: flex; gap: 16px; margin-top: 4px; }
.summary-card.visit .visit-split .ok { color: #059669; }
.summary-card.visit .visit-split .fail { color: #dc2626; }
.summary-card.visit .visit-split .num { font-size: 1.4rem; font-weight: bold; }
.day-row .nums { font-size: 0.78rem; line-height: 1.35; }
.day-row .nums .visit-tag { color: #059669; }
.day-row .nums .visit-fail { color: #dc2626; }
#lang-switch { margin-left: auto; font-size: 0.9rem; }
#lang-switch a { color: #007bff; text-decoration: none; margin: 0 4px; }
#lang-switch a.active { font-weight: bold; text-decoration: underline; }
