:root {
  --accent: #2563eb;
  --text: #1f2937;
  --muted: #6b7280;
  --bg: #f9fafb;
  --panel-bg: #ffffff;
  --border: #e5e7eb;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  margin: 0;
  padding: 0;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  flex-wrap: wrap;
  gap: 0.75rem;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
  width: 100%;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Unlocked State Header Highlight */
header.unlocked-mode {
  border-bottom: 2px solid #f59e0b !important;
  background-color: #fffbeb !important;
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
}

main {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease-in-out;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

#extraTasksPanel, 
.extra-tasks-panel {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

#extraTasks, 
#checkedExtraTasks {
  min-height: 90px;
  max-height: none !important; /* Allow panels to grow as needed */
  height: auto !important;
  overflow-y: visible !important;
  border-radius: 0.375rem;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem !important;
}

#extraTasks {
  border: 1px dashed var(--border);
  background: #fafafa;
}

#checkedExtraSection {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 0.375rem;
  padding: 0.5rem;
}

#scheduleScroll {
  max-height: 700px;
  overflow-y: auto;
  position: relative;
}

.hour-container {
  display: flex;
  flex-direction: column;
}

.time-block {
  height: 30px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-left: 0.5rem;
  position: relative;
  box-sizing: border-box;
}

.time-block.drag-over {
  background-color: #eff6ff;
}

.increment-label {
  font-size: 0.75rem;
  color: var(--muted);
  user-select: none;
  min-width: 50px;
}

.task {
  position: absolute;
  left: 60px;
  right: 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--accent);
  border-radius: 0.375rem;
  padding: 0.15rem 0.4rem !important; /* Compact padding */
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  box-sizing: border-box;
  overflow: hidden;
  cursor: grab;
  z-index: 10;
  pointer-events: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

/* Conflict Highlighting */
.task.has-conflict {
  border-left-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.task button, .task input, .task select, .task-header, .task-drag-handle {
  pointer-events: auto;
}

.task.extra-location {
  position: relative;
  left: auto;
  right: auto;
  margin-bottom: 0.25rem !important; /* Tighter vertical spacing */
}

.task-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.task-drag-handle {
  cursor: grab;
  color: var(--muted);
  user-select: none;
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 100px;
}

.touch-ghost {
  position: fixed;
  pointer-events: none;
  opacity: 0.85;
  z-index: 1000;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.drop-preview {
  position: absolute;
  left: 60px;
  right: 10px;
  background: rgba(37, 99, 235, 0.15);
  border: 2px dotted var(--accent);
  border-radius: 0.375rem;
  pointer-events: none;
  z-index: 20;
  box-sizing: border-box;
}

/* Extra Task Drop Insertion Line */
.extra-drop-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--accent);
  border-radius: 2px;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 0 4px rgba(37, 99, 235, 0.5);
}

.time-block.drag-over-span {
  background-color: #eff6ff !important;
  border-color: #bfdbfe !important;
}

.current-time-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent);
  z-index: 10;
  pointer-events: none;
}

.current-time-line::before {
  content: "";
  position: absolute;
  left: 55px;
  top: -4px;
  width: 10px;
  height: 10px;
  background-color: #ef4444;
  border-radius: 50%;
}

.hidden-control {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

.active-focus {
  background-color: #1e3a8a !important;
  color: #ffffff !important;
  border-color: #1e3a8a !important;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.hidden-modal {
  display: none !important;
}

.modal-content {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  position: relative;
}

.add-modal-content {
  max-width: 500px;
  padding-top: 3.5rem;
}

.modal-close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
  color: #ef4444;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease;
  z-index: 20;
}

.modal-close-x:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

button {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  min-height: 36px;
  transition: background 0.15s ease;
}

button:hover {
  background: #f3f4f6;
}

button.accent-btn {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

button.accent-btn:hover {
  background: #1d4ed8;
}

input[type="text"], select {
  padding: 0.4rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  box-sizing: border-box;
}

.controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }
  
  header > div:last-child {
    display: none;
  }

  header .controls {
    justify-content: stretch !important;
  }

  header .controls button {
    flex: 1;
  }
}