/* YLEINEN LAYOUT */

.cc-app {
  border: 1px solid #ddd;
  padding: 1.5rem;
  border-radius: 8px;
  background: #fff;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* 1) OHJAUSPANEELI */

.cc-control-panel {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 1rem;
}

.cc-control-panel h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.cc-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
}

.cc-field label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.cc-field select,
.cc-field input[type="number"] {
  width: 100%;
  max-width: 180px;
}

.cc-checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cc-actions {
  text-align: right;
}

/* 2) TALOT A JA B */

.cc-houses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.cc-house-block {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem;
}

.cc-house-block h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

/* Taulukko 24h */

.cc-hour-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.cc-hour-table th,
.cc-hour-table td {
  border: 1px solid #eee;
  padding: 0.2rem 0.4rem;
}

.cc-hour-table th {
  background: #f7f7f7;
}

/* Stats-rivi */

.cc-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.cc-stat {
  flex: 1 1 80px;
  border-radius: 6px;
  border: 1px solid #eee;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  background: #fafafa;
}

.cc-stat span {
  display: block;
  color: #666;
  margin-bottom: 0.15rem;
}

.cc-stat strong {
  font-size: 0.95rem;
}

/* Chart-wrapper */

.cc-chart-wrapper {
  width: 100%;
}

/* 3) KALENTERI */

.cc-calendar-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  border-top: 1px solid #eee;
  padding-top: 1.5rem;
}

.cc-calendar-wrapper h2 {
  width: 100%;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.cc-calendar-main {
  flex: 1 1 55%;
  min-width: 280px;
}

.cc-calendar-sidepanel {
  flex: 1 1 35%;
  min-width: 260px;
  border-left: 1px solid #eee;
  padding-left: 1.5rem;
}

.cc-calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.cc-month-label {
  font-weight: 600;
  font-size: 1.1rem;
}

.cc-nav-month {
  border: 1px solid #ccc;
  background: #f7f7f7;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
}

.cc-nav-month:hover {
  background: #eee;
}

.cc-weekday-row,
.cc-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cc-weekday {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  padding: 0.25rem 0;
}

.cc-day {
  position: relative;
  min-height: 48px;
  padding: 0.25rem;
  text-align: right;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.85rem;
}

.cc-day.outside-month {
  opacity: 0.27;
  cursor: default;
}

.cc-day-number {
  position: relative;
  z-index: 2;
}

.cc-day-dot {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e0e0e0;
  z-index: 1;
}

/* Väriskaala kalenterin täpälle */

.cc-day-dot.level-0 {
  background: #e0e0e0;
}

.cc-day-dot.level-1 {
  background: #8bc34a;
}

.cc-day-dot.level-2 {
  background: #ffc107;
}

.cc-day-dot.level-3 {
  background: #ff9800;
}

.cc-day-dot.level-4 {
  background: #f44336;
}

.cc-day.selected {
  border-color: #0073aa;
  background: #f0f7ff;
}

.cc-panel-block + .cc-panel-block {
  margin-top: 1.25rem;
}

.cc-panel-block h3 {
  margin: 0 0 0.5rem;
}

.cc-day-info,
.cc-month-summary {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cc-selected-day-label {
  font-weight: 500;
  font-size: 0.95rem;
}

.cc-calendar-sidepanel input[type="number"] {
  width: 100%;
  max-width: 180px;
}

.cc-calendar-sidepanel button {
  margin-top: 0.25rem;
  align-self: flex-start;
}

.cc-help {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

/* RESPONSIVE */

@media (max-width: 768px) {
  .cc-control-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cc-calendar-wrapper {
    flex-direction: column;
  }

  .cc-calendar-sidepanel {
    border-left: none;
    border-top: 1px solid #eee;
    padding-left: 0;
    padding-top: 1rem;
  }
}

