/* --- CSS Variables (Theme Colors) --- */
:root {
  --bg-color: #f4f5f7;
  --card-bg: #ffffff;
  --text-color: #172b4d;
  --text-muted: #6b778c;
  --border-color: #ebecf0;
  --accent-color: #60a5fa;
  --btn-ghost-hover: #f1f2f4;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --sidebar-width: 380px; 
}

/* Optional: keep local Plus Jakarta Sans files available if needed later */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/plus-jakarta-sans/PlusJakartaSans-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fonts/plus-jakarta-sans/PlusJakartaSans-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('assets/fonts/plus-jakarta-sans/PlusJakartaSans-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/plus-jakarta-sans/PlusJakartaSans-700.ttf') format('truetype');
}

body.dark-mode {
  --bg-color: #1d2125;
  --card-bg: #282c34;
  --text-color: #d1d5db;
  --text-muted: #9ca3af;
  --border-color: #374151;
  --accent-color: #60a5fa;
  --btn-ghost-hover: #374151;
}

body.dark-mode .card,
body.dark-mode .table,
body.dark-mode .table-head,
body.dark-mode .table-pagination {
  border-color: #4b5563;
  background: #242a34;
}

body.dark-mode .chart-container {
  border: 1px solid #4b5563;
  background: #1f2430;
}

/* --- Base Styles --- */
* { box-sizing: border-box; }
body {
  font-family: var(--font-family);
  margin: 0;
  background: var(--bg-color);
  color: var(--text-color);
  transition: background 0.2s, color 0.2s;
  font-size: 14px;
  font-weight: var(--font-weight-normal);
  line-height: 1.5;
}
body.resizing {
  user-select: none;
  -webkit-user-select: none;
}

/* --- Layout (Sidebar + Main) --- */
#mainContent {
  padding: 0 20px; 
  transition: margin-right 0.3s ease, width 0.3s ease;
}

#detailSidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: var(--sidebar-width); 
  max-width: 90vw;
  background: var(--card-bg);
  border-left: 1px solid var(--border-color);
  z-index: 100;
  display: flex; 
  flex-direction: column; 
  overflow-y: hidden; 
  transform: translateX(100%);
  transition: transform 0.3s ease, width 0s; 
}
#detailSidebar.visible { transform: translateX(0); }
body.sidebar-visible #mainContent { 
  margin-right: calc(var(--sidebar-width) + 10px); 
  width: calc(100% - (var(--sidebar-width) + 10px));
}

/* === ที่จับ (Handle) สำหรับลาก === */
.resize-handle {
  position: absolute;
  left: -8px;
  top: 0;
  width: 12px;
  height: 100%;
  cursor: ew-resize;
  z-index: 2;
  background: transparent;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.2s;
}
.resize-handle:hover,
body.resizing .resize-handle {
  background: rgba(96,165,250,0.16);
  box-shadow: inset 2px 0 0 rgba(96,165,250,0.5);
}
.resize-handle::after {
  content: '';
  display: block;
  width: 6px;
  height: 26px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(148,163,184,0.8) 0%, rgba(148,163,184,0.2) 100%);
}
/* ============================= */

/* ปรับ handle ของ widget chart: ซ่อนปกติ, โชว์ตอน hover เท่านั้น และให้สีอ่อนลง */
.charts .card .resize-handle { display: none !important; }


.sidebar-header {
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.sidebar-header h3 { margin: 0; }
.sidebar-header .close-btn { font-size: 24px; padding: 0 8px; }

#detailSidebarContent {
  padding: 20px;
  overflow-y: auto; 
  flex-grow: 1;
}
#detailSidebarContent .detail-item { margin-bottom: 12px; }
#detailSidebarContent .detail-item label { font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 4px; }
#detailSidebarContent .detail-item p { margin: 0; white-space: pre-wrap; word-wrap: break-word; }

/* --- Header --- */
header {
  padding: 15px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  position: relative;
}
header h1 {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent-color);
  margin: 0;
  font-family: var(--font-family);
}
.corner-actions {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
}
.corner-top {
  display: flex;
  gap: 10px;
  align-items: center;
}
.corner-actions .status-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}
.corner-actions .status-block .label {
  font-size: 11px;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  text-transform: uppercase;
  display: none;
}
.corner-actions .latest-block {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.corner-actions .latest-value {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}
.corner-actions .status-block .btn.small-btn {
  padding: 4px 12px;
  font-size: 13px;
}
.icon-actions .btn.small-btn {
  padding: 6px 10px;
  font-size: 14px;
}
.sync-inline{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:600;
  color:var(--text-muted);
}
.sync-inline .btn{
  min-width:70px;
}
.icon-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.icon-actions.inline {
  justify-content: flex-start;
  gap: 6px;
}
.icon-actions .btn {
  min-width: 40px;
}
.icon-actions button {
  color: #071d4d !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.layout-toggle-icon {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
  object-fit: contain;
}
.icon-actions button#btnSettings {
  margin-left: 8px;
}
.controls { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 15px; 
  align-items: flex-end; 
  position: relative; /* สำหรับให้ control บางอัน float ขวา */
}
.control { display: flex; flex-direction: column; }
.control label { 
  font-weight: var(--font-weight-semibold); 
  margin-bottom: 5px; 
  color: var(--text-muted);
  font-family: var(--font-family);
}
.control select option,
#ownerFilter option {
  white-space: pre-wrap !important;
  display: block;
}
#ownerFilter {
  width: 220px !important;
  min-width: 200px;
  max-width: 220px;
}
.control.grow { flex-grow: 1; }
.control.flex-end { /* <<< ใหม่: จัดให้ไปอยู่ขวาสุด */
  margin-left: auto; 
  margin-right: 0;
}
.hidden-label { /* <<< ใหม่: ซ่อน label สำหรับปุ่มที่ไม่มี */
  visibility: hidden;
  height: 0;
  margin: 0;
  padding: 0;
}

.range { display: flex; align-items: center; gap: 5px; }
.loaders { display: flex; gap: 5px; }
.view-buttons { display: flex; gap: 5px; }
.muted { color: var(--text-muted); }
.controls .controls-sync {
  margin-left: auto;
  display: flex;
  align-items: flex-end;
  gap: 20px;
}
.controls .controls-sync .sync-block,
.controls .controls-sync .latest-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.controls .controls-sync .latest-inline label {
  margin-bottom: 0;
}

/* --- Forms (Buttons, Inputs) --- */
input[type="text"], input[type="date"], input[type="file"], select, input[id="csvUrl"] {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
}
input[id="csvUrl"] { width: 100%; }
.btn {
  background: var(--accent-color);
  color: white;
  border: 0;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
  transition: background 0.2s, opacity 0.2s;
}
.btn:hover {
  opacity: 0.9;
}
.btn:disabled { background: #ccc; }
.btn.ghost {
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}
.btn.ghost:hover { background: var(--btn-ghost-hover); }
.btn.small-btn { padding: 4px 10px; font-size: 16px; }
.btn-icon { font-size: 16px; padding: 4px 8px; }
.btn.full-width { /* <<< ใหม่: ปุ่มเต็มความกว้างใน dropdown */
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  margin-bottom: 8px;
}
.btn.full-width:last-child { margin-bottom: 0; }
.modal-filter {
  width: 100%;
  margin: 8px 0 10px;
}
.chip {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--btn-ghost-hover);
  color: var(--text-color);
  font-size: 12px;
}
.inline-option { margin: 6px 0 10px; font-size: 13px; }
.inline-option select { margin-left: 6px; }
.metric-card {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  min-width: 120px;
}
.metric-title {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.metric-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-color);
}


/* --- Cards & Charts --- */
.card {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}
.charts { 
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 20px 0; 
  align-items: stretch; 
  justify-content: center;
  transition: none;
}
.charts .card.w4 {
  min-width: 380px;
  flex: 1 1 380px;
}

.charts.layout-2 .card:not(.w-full) { width: calc(50% - 10px); flex-grow: 0; }
.charts.layout-3 .card:not(.w-full) { width: calc(33.333% - 14px); flex-grow: 0; }
.charts.layout-4 .card:not(.w-full) { width: calc(25% - 15px); flex-grow: 0; }
.charts.layout-custom .card { flex-grow: 1; }

.charts .card.w-full { width: 100%; min-width: 0; }
.charts .card {
  padding: 16px 18px 16px; 
  display: flex; 
  flex-direction: column; 
  flex: 1 1 240px;
  min-width: 0;
  position: relative;
  max-width: 100%;
  box-sizing: border-box;
  cursor: default;
  margin-bottom: 0; /* use gap spacing instead */
  transition: width 0.18s ease, height 0.18s ease;
  gap: 12px;
}
.charts .card .chart-container {
  height: 100%;
}

.charts .card.resizing {
  user-select: none;
}

.charts .card.resizing * {
  pointer-events: none;
}
.charts .card h3 { flex-shrink: 0; }
.card-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-tools .small-label {
  font-size: 12px;
  color: var(--text-muted);
}
.card-tools select {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-color);
}
.chart-container {
  flex-grow: 1;
  position: relative;
  min-height: 240px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.charts .card canvas { position: relative; }
.charts .card .chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}
.charts .card .chart-container,
.charts .card {
  height: 100%;
}
.charts .card {
  min-height: 340px;
}

/* กันไม่ให้ canvas โชว์เส้นประเวลา focus/click */
.charts canvas {
  outline: none;
}
.chart-container.short {
  height: 100%;
}
.w4 { flex: 1 1 240px; }
.w-full { flex: 1 1 100%; width: 100%; }
.inline-filter { margin-bottom: 10px; }

.charts .card.w4.dragging { opacity: 0.5; }
.charts .card.w4.drag-over { 
  outline: none; 
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.6);
  border-radius: 8px;
}

.modern-gradient-bg {
  background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  border: 0;
  padding: 8px;
}
body.dark-mode .modern-gradient-bg {
  background: linear-gradient(135deg, #1f2933 0%, #111827 100%);
  border: 0;
}

/* --- Table --- */
.table { padding: 0; }
.table-head {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.table-title { display: flex; align-items: center; gap: 10px; }
.table-title h3 { margin: 0; }
.chart-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--btn-ghost-hover);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-color);
}
.chart-filter .btn.small-btn {
  padding: 2px 8px;
  font-size: 12px;
}
.table-head .right { display: flex; gap: 10px; }
.table-wrap { overflow-x: hidden; width: 100%; }
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 15px 12px;
  font-size: 12px;
}
.table-pagination.left {
  justify-content: flex-start;
}
table { width: 100%; max-width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; }
th, td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  min-width: 60px;
}
th {
  height: 44px;
  line-height: 1.2;
}
.col-no, .col-seq {
  text-align: right;
}
th.col-no, th.col-seq {
  text-align: right;
}
td.col-owner {
  white-space: pre-line;
  line-height: 1.3;
}
.align-center { text-align: center; }
th {
  background: var(--bg-color);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  position: relative;
  padding: 4px 10px;
  line-height: 1.2;
  border-right: none; /* single visible line comes from resizer */
}
th.dragging { opacity: 0.4; }
th.drop-target {
  outline: 2px dashed var(--accent-color);
  outline-offset: -4px;
}
td { }
tbody tr:hover {
  background: var(--btn-ghost-hover);
  cursor: pointer;
}
.resizer {
  position: absolute;
  right: 0;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize !important;
  user-select: none;
  border-left: 1px solid #d7dce4;
  opacity: 0.5;
  pointer-events: auto;
  z-index: 3;
  background: transparent;
}
.resizer:hover {
  opacity: 1;
  border-left-color: #94a3b8;
}
.resizer:hover {
  opacity: 0.9;
}
.sortable { cursor: pointer; }
.sortable .th-content { pointer-events: none; color: var(--text-color); display: flex; justify-content: center; text-align: center; width: 100%; }
.align-right { text-align: right; }
th.align-right .th-content { justify-content: center; text-align: center; }
.sortable.sorted.asc .th-content::after {
  content: '▲';
  font-size: 10px;
  margin-left: 4px;
}
.sortable.sorted.desc .th-content::after {
  content: '▼';
  font-size: 10px;
  margin-left: 4px;
}

/* --- Responsive (Mobile) --- */
@media (max-width: 768px) {
  header {
    padding: 12px;
    margin-left: 0;
  }
  header h1 { margin-bottom: 12px; }
  .corner-actions {
    position: static;
    align-items: flex-end;
    margin-bottom: 8px;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .control { width: 100%; }
  .range { gap: 8px; }
  .view-buttons { width: 100%; justify-content: flex-start; }
  .table-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .table-head .right { width: 100%; justify-content: space-between; }
  .table-pagination { justify-content: space-between; }
  .charts { flex-direction: column; }
  .w4, .w-full { width: 100% !important; }
  .charts .card { 
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
  }
  .chart-container { height: 220px; }
  .chart-container.short { height: 260px; }
  .resize-handle { display: none; } /* ซ่อน resize handle ใน mobile */
  table { table-layout: fixed; }
  th, td { white-space: nowrap; font-size: 12px; }
  .table-wrap { overflow-x: hidden; }
  .table-head .right input { width: 150px; }
  .table-head .right button { white-space: nowrap; padding: 6px 10px; font-size: 12px; }
  .table-head { padding: 10px; }
  .table { padding: 0; }
  .dashboard-title-text { font-size: 1.3rem; }
  .dashboard-logo-blue {
    width: 55px;
    height: 55px;
    background: transparent;
    filter: brightness(1.25) saturate(1.1) sepia(0) hue-rotate(343deg) drop-shadow(0 0 0 #60A5FA);
  }
}

@media (max-width: 480px) {
  body { font-size: 13px; }
  .charts { flex-direction: column; }
  .chart-container { height: 220px; }
  .chart-container.short { height: 240px; }
  th, td { white-space: normal; font-size: 12px; padding: 6px; }
  table { table-layout: fixed; }
  .table-head { padding: 8px; }
  .table-head .right { flex-direction: column; align-items: flex-start; gap: 6px; }
  .table-head .right input { width: 100%; }
  .table-head .right button { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
  .modal-content.small-modal {
    max-width: 90%;
  }
  .settings-selects {
    grid-template-columns: 1fr;
  }
}

/* --- Modal (Column Picker) --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-overlay.visible {
  display: flex;
}
.modal-content {
  width: 90%;
  max-width: 500px;
  padding: 20px;
  border-radius: 14px;
}
.modal-content.small-modal { /* <<< ใหม่: สำหรับ dropdown setting */
  max-width: 300px; 
  padding: 12px 14px;
}
.modal-content.small-modal h3 {
  margin-top: 0;
  margin-bottom: 15px;
  text-align: center;
}
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 20px 0;
}
.checkbox-grid label { display: flex; align-items: center; gap: 5px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.settings-options { /* <<< ใหม่: สำหรับปุ่มใน dropdown */
  display: flex;
  flex-direction: column;
}
.settings-selects {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 12px;
  row-gap: 12px;
  align-items: start;
}
.settings-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
  min-width: 0;
}
.settings-row label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.settings-row select {
  padding: 8px 10px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  font-weight: 600;
  font-size: 14px;
}
.settings-row input[type="number"],
.settings-row input[type="date"] {
  padding: 8px 10px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 14px;
  font-weight: 600;
}
.modal-actions.settings-actions {
  justify-content: space-between;
  margin-top: 12px;
}
.settings-options .btn {
  width: 100%;
  justify-content: center;
  border-radius: 10px;
  font-weight: 700;
}
.settings-row button.btn {
  width: 100%;
  justify-content: center;
  font-weight: 700;
}
.settings-selects .settings-row:last-child {
  grid-column: span 2;
}
.modal-actions {
  justify-content: center;
  gap: 12px;
}

footer { padding: 20px 0; }
footer .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
footer .footer-right img {
  display: block;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding: 0 2px;
  margin-bottom: 4px;
}
.card-header h3 {
  margin: 0;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-color);
}
.timeline-year {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.timeline-year-select {
  min-width: 150px;
  padding: 6px 32px 6px 14px;
  text-align: center;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  font-weight: 600;
  appearance: none;
  position: relative;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  cursor: pointer;
}
.timeline-year-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(96,165,250,0.25);
}
.timeline-legend {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.timeline-legend .legend-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  letter-spacing: 0.2px;
  border: 1px solid rgba(0,0,0,0.05);
  cursor: pointer;
  opacity: 0.9;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}
.timeline-legend .legend-pill.active { opacity: 1; box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.timeline-legend .legend-pill.inactive { opacity: 0.45; filter: grayscale(0.3); }
.timeline-legend .legend-pill:focus { outline: none; }
.timeline-legend .legend-pill:hover { transform: translateY(-1px); }
.year-chip {
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-color);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  min-width: 90px;
  text-align: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.year-chip:hover { background: var(--btn-ghost-hover); }
.year-chip.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}
.charts .card { position: relative; }
.charts .card.resizing {
  box-shadow: 0 0 0 2px #2563eb;
  z-index: 10;
}

/* --- Dashboard Title and Logo --- */
.dashboard-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}
.dashboard-logo {
  width: 48px;
  height: 48px;
  background: transparent;
  border-radius: 50%;
  filter: hue-rotate(190deg) brightness(1.2) saturate(1.2);
}
.dashboard-title-text {
  color: #60a5fa;
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0;
}
.dashboard-logo-blue {
  width: 55px;
  height: 55px;
  background: transparent;
  filter: brightness(1.25) saturate(1.1) sepia(0) hue-rotate(343deg) drop-shadow(0 0 0 #60A5FA);
}

/* Layout grid icons */
.layout-grid-icons {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.layout-icon {
  background: none;
  border: none;
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  outline: none;
}
.layout-icon img {
  width: 32px;
  height: 32px;
  filter: grayscale(0) brightness(1);
  transition: filter 0.2s;
}
.layout-row-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.layout-icon.active,
.layout-icon:hover {
  background: #e0e7ff;
  box-shadow: 0 0 0 2px #2563eb;
}
.layout-icon.active img {
  filter: drop-shadow(0 0 2px #2563eb) brightness(1.2);
}
@media (prefers-color-scheme: dark) {
  .layout-icon {
    background: none;
  }
  .layout-icon.active,
  .layout-icon:hover {
    background: #1e293b;
    box-shadow: 0 0 0 2px #2563eb;
  }
  .layout-icon img {
    filter: grayscale(0) brightness(0.8);
  }
  .layout-icon.active img {
    filter: drop-shadow(0 0 2px #2563eb) brightness(1.4);
  }
}
