:root {
  --sidebar-bg: #1d2327;
  --sidebar-text: #c3c4c7;
  --sidebar-active: #2271b1;
  --bg: #f0f2f5;
  --card-bg: #fff;
  --text: #1e1e1e;
}

body, html {
  margin: 0;
  height: 100%;
  font-family: "Open Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
}

.sidebar .logo {
  padding: 16px;
  font-weight: bold;
  color: #fff;
  border-bottom: 1px solid #2c3338;
}

.nav-item {
  padding: 12px 16px;
  border: none;
  background: none;
  color: var(--sidebar-text);
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.nav-item.active, .nav-item:hover {
  background: var(--sidebar-active);
  color: #fff;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  padding: 12px 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.view {
  display: none;
  padding: 20px;
  overflow-y: auto;
}
.view.active {
  display: block;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.card {
  background: var(--card-bg);
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; font-size: 14px; }
input, select, textarea {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
button {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}
button.primary { background: var(--sidebar-active); color: #fff; border: none; }
button.warn { background: #ffb703; color: #000; border: none; }
button.danger { background: #ef476f; color: #fff; border: none; }

.list-header, .list-item {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #ddd;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.month {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}
.month h4 {
  margin: 0;
  padding: 8px;
  background: var(--sidebar-active);
  color: #fff;
}
.month table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.month th, .month td {
  border: 1px solid #eee;
  width: 14.28%;
  height: 60px;
  vertical-align: top;
  padding: 2px;
}
.event {
  background: var(--sidebar-active);
  color: #fff;
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-top: 2px;
  display: block;
}
.calendar-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: bold;
  font-size: 16px;
}

.calendar-grid table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.calendar-grid th, .calendar-grid td {
  border: 1px solid #eee;
  width: 14.28%;
  height: 80px;
  vertical-align: top;
  padding: 2px;
}
.calendar-grid th {
  background: #f9f9f9;
  font-weight: bold;
}
.calendar-grid td div.day {
  font-size: 11px;
  font-weight: bold;
}
.event {
  background: var(--sidebar-active);
  color: #fff;
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-top: 2px;
  display: block;
}
/* Center the calendar and let it expand */
#calendarGrid {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}

/* Make the calendar table fill most of the page */
#calendarGrid table {
  width: 100%;
  max-width: 1000px;   /* keeps it from being too wide on huge screens */
  border-collapse: collapse;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  border-radius: 6px;
  overflow: hidden;
}

/* Header row */
#calendarGrid th {
  background: var(--sidebar-active);
  color: #fff;
  padding: 8px;
  text-align: center;
  font-weight: bold;
}

/* Day cells */
#calendarGrid td {
  border: 1px solid #eee;
  width: 14.28%;   /* 7 columns */
  height: 120px;   /* taller cells to fill space */
  vertical-align: top;
  padding: 4px;
}

/* Day number */
#calendarGrid td .day {
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 4px;
}

/* Events inside cells */
#calendarGrid .event {
  background: var(--sidebar-active);
  color: #fff;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-top: 2px;
  display: block;
  word-break: break-word;
}
.analytics-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
  gap: 16px;
  margin-bottom: 20px;
}
#analytics canvas {
  margin-top: 20px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
}
.calendar-grid {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  padding: 20px;
}

.calendar-grid table {
  width: 100%;
  max-width: 1000px;
  border-collapse: collapse;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  border-radius: 6px;
  overflow: hidden;
}

.calendar-grid th {
  background: var(--sidebar-active);
  color: #fff;
  padding: 8px;
  text-align: center;
  font-weight: bold;
}

.calendar-grid td {
  border: 1px solid #eee;
  width: 14.28%;
  height: 120px;
  vertical-align: top;
  padding: 4px;
  position: relative;
}

.calendar-grid td.today {
  background: #f0f8ff;
  border: 2px solid var(--sidebar-active);
}

.calendar-grid td .day {
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 4px;
}

.event {
  background: var(--sidebar-active);
  color: #fff;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-top: 2px;
  display: block;
  word-break: break-word;
}
body.theme-label {
  font-family: var(--site-font, 'Inter', sans-serif);
  background: var(--site-bg, #f9f9f9);
  color: var(--site-text, #222);
}
body.dark {
  background: #121212;
  color: #eee;
}
body.dark .card, body.dark .form-grid, body.dark .list-item {
  background: #1e1e1e;
  border-color: #333;
}
body.dark .sidebar {
  background: #1a1a1a;
}
body.dark .topbar {
  background: #222;
}
.drop-zone {
  border: 2px dashed #ccc;
  padding: 20px;
  text-align: center;
  margin-top: 20px;
  border-radius: 6px;
  background: #fafafa;
}
.drop-zone.dragover {
  background: #e0f7fa;
  border-color: var(--sidebar-active);
}
